PR gold/15354
[external/binutils.git] / gold / ChangeLog
1 2013-04-11  Alan Modra  <amodra@gmail.com>
2
3         PR gold/15354
4         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
5         .branch_lt to match bfd ld.  Adjust comments throughout file.
6
7 2013-04-04  Ian Lance Taylor  <iant@google.com>
8
9         GCC PR c++/56840
10         * object.cc (do_layout_deferred_sections): Handle .eh_frame
11         sections before checking whether they are included in the link.
12
13 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
14
15         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
16         object before calling the plugin claim_file handler.  Pass the elf
17         object of the archive to the plugin. Delete the elf object if the
18         plugin claims the file.
19
20 2013-03-21  Alan Modra  <amodra@gmail.com>
21
22         * layout.cc (Layout::set_segment_offsets): Accept writable .text
23         segment when omagic.
24
25 2013-03-21  Alan Modra  <amodra@gmail.com>
26
27         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
28         comparison warning.
29         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
30         uninitialized" warning.
31
32 2013-03-20  Alan Modra  <amodra@gmail.com>
33
34         * symtab.h (Symbol::clear_version): New function.
35         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
36         is_needed by weak references.  Clear version for symbols defined
37         in as-needed objects that are not needed.
38
39 2013-03-15  Alan Modra  <amodra@gmail.com>
40
41         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
42         static and public.  Add report_err param.  Return false for data refs.
43         (Target_powerpc::rela_dyn_section): New overloaded function.
44         (Target_powerpc::plt_, iplt_): Elucidate.
45         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
46         (Output_data_plt_powerpc::do_write): Don't write .iplt.
47         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
48         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
49         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
50         push_branch and make_plt_entry for ifunc syms when
51         reloc_needs_plt_for_ifunc.
52         (Target_powerpc::Relocate::relocate): Don't use plt entry value
53         for ifunc unless reloc_needs_plt_for_ifunc.
54
55 2013-03-15  Alan Modra  <amodra@gmail.com>
56
57         * gc.h (gc_process_relocs): Don't look through function descriptors.
58         * icf.cc (get_section_contents): Do so here instead.
59
60 2013-03-13  Alan Modra  <amodra@gmail.com>
61
62         * powerpc.cc (is_branch_reloc): Forward declare.
63         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
64         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
65         false for 64-bit, true for 32-bit non-branch relocs.
66         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
67         * testsuite/Makefile.am (icf_test): Use linker map file instead of
68         nm output.
69         (icf_safe_test): Generate linker map file as well as nm output.
70         (icf_safe_so_test): Likewise.
71         * testsuite/Makefile.in: Regenerate.
72         * testsuite/icf_test.sh: Parse linker map file to determine
73         section folding.
74         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
75         * testsuite/icf_safe_so_test.sh: Likewise.
76         (X86_32_or_ARM_specific_safe_fold): Merge into..
77         (arch_specific_safe_fold): ..this.
78         (X86_64_specific_safe_fold): Delete unused function.
79
80 2013-03-12  Alan Modra  <amodra@gmail.com>
81
82         * gc.h (gc_process_relocs): Look through function descriptors
83         to determine shndx, symvalue and addend used by ICF.  Tidy
84         variable duplication.
85
86 2013-03-11  Alan Modra  <amodra@gmail.com>
87
88         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
89         * layout.cc (Layout_task_runner::run): ..to here.
90         * symtab.h (struct Symbol_location): Extract from..
91         (class Symbol_table): ..here.
92         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
93         * target.h (class Target): Add function_location and
94         do_function_location functions.
95         (class Sized_target): Add do_function_location.
96         * object.h (class Sized_relobj_file): Move find_shdr..
97         (class Object): ..to here.
98         * object.cc: Likewise.  Update to suit.  Instantiate.
99         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
100         * powerpc.cc (class Powerpc_dynobj): New.
101         (Target_powerpc::do_function_location): New function.
102         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
103         (Powerpc_dynobj::do_read_symbols): New function.
104         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
105
106 2013-03-08  Ian Lance Taylor  <iant@google.com>
107
108         * options.cc (General_options::string_to_object_format): Accept
109         "default".
110
111 2013-03-08  Alan Modra  <amodra@gmail.com>
112
113         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
114         pointer to Post_fde.
115         (struct Post_fde): Move definition to here..
116         * ehframe.cc (struct Post_fde): ..from here.
117         (Cie::write): Don't alloc Post_fde.
118         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
119
120 2013-03-07  Alan Modra  <amodra@gmail.com>
121
122         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
123         relocation referencing .LC0.
124         * testsuite/discard_locals_test.sh: Remove FIXMEs.
125
126 2013-03-07  Alan Modra  <amodra@gmail.com>
127
128         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
129         always_inline.  Add assembly for powerpc to avoid GOT.
130
131 2013-03-07  Alan Modra  <amodra@gmail.com>
132
133         * testsuite/script_test_10.sh: Don't test .bss section
134         header number.
135
136 2013-03-06  Alan Modra  <amodra@gmail.com>
137
138         * powerpc.cc (class Powerpc_relobj): Move some member functions.
139         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
140         all callers.  Handle folded sections.
141         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
142         to Powerpc_relobj.
143         (Global_symbol_visitor_opd::operator()): Likewise.
144
145 2013-03-04  Alan Modra  <amodra@gmail.com>
146
147         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
148         * testsuite/Makefile.in: Regenerate.
149
150 2013-03-01  Cary Coutant  <ccoutant@google.com>
151
152         Add dwp support for v2 DWARF package file format.
153         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
154         tu_length parameter.  Adjust all callers.
155         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
156         * dwp.cc: Include dwarf.h.
157         (Section_bounds): New struct type.
158         (Unit_set): New struct type.
159         (Dwo_file::Dwo_file): Initialize new data member.
160         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
161         Combine and rename to...
162         (Dwo_file::read_unit_index): ...this.
163         (Dwo_file::sized_read_compunit_index)
164         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
165         (Dwo_file::sized_read_unit_index): ...this.
166         (Dwo_file::copy_section): Remove section_name, is_str_offsets
167         parameters; add section_id parameter.
168         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
169         (Dwo_file::add_unit_set): ...this.
170         (Dwo_file::shndx_map_): Remove.
171         (Dwo_file::sect_offsets_): New data member.
172         (Dwp_output_file::Dwp_output_file): Initialize new data members.
173         (Dwp_output_file::add_section): Rename to...
174         (Dwp_output_file::add_contribution): ...this.
175         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
176         (Dwp_output_file::add_tu_set): Likewise.
177         (Dwp_output_file::Contribution): New type.
178         (Dwp_output_file::Section::contributions): New data member.
179         (Dwp_output_file::Cu_or_tu_set): Remove.
180         (Dwp_output_file::Section::Section): New ctor.
181         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
182         (Dwp_output_file::Dwp_index::Section_table): New type.
183         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
184         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
185         parameter.
186         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
187         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
188         (Dwp_output_file::Dwp_index::section_table): New member function.
189         (Dwp_output_file::Dwp_index::section_table_end): New member function.
190         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
191         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
192         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
193         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
194         (Dwp_output_file::Dwp_index::section_table_): New data member.
195         (Dwp_output_file::Dwp_index::section_mask_): New data member.
196         (Dwp_output_file::add_output_section): New member function.
197         (Dwp_output_file::write_new_section): New member function.
198         (Dwp_output_file::write_contributions): New member function.
199         (Dwp_output_file::section_id_map_): New data member.
200         (class Dwo_id_info_reader): Remove.
201         (class Unit_reader): New class.
202         (get_dwarf_section_name): New function.
203         (Dwo_file::read_executable): Adjust initializations of class data.
204         (Dwo_file::read): Add support for v2 package file format.
205         (Dwo_file::read_unit_index): Likewise.
206         (Dwo_file::sized_read_unit_index): Likewise.
207         (Dwo_file::copy_section): Likewise.
208         (Dwo_file::add_unit_set): Likewise.
209         (Dwp_output_file::add_output_section): Likewise.
210         (Dwp_output_file::add_contribution): Likewise.
211         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
212         for empty slot.
213         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
214         file format.
215         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
216         slot.
217         (Dwp_output_file::initialize): Remove unused function.
218         (Dwp_output_file::finalize): Add support for v2 package file format.
219         (Dwp_output_file::write_index): Likewise.
220         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
221         function prototype.
222
223 2013-03-01  Cary Coutant  <ccoutant@google.com>
224
225         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
226         function into class definition in header file.
227         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
228         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
229         New function.
230         (Dwarf_info_reader::check_buffer): Move here from .cc file.
231
232 2013-02-28  Alan Modra  <amodra@gmail.com>
233
234         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
235         * target.cc (Target::do_plt_fde_location): New function.
236         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
237         accessor function, and constructor param.
238         (struct Post_fde, Post_fdes): Declare.
239         (Cie::write): Add post_fdes param.
240         * ehframe.cc (Fde::write): Use plt_fde_location.
241         (struct Post_fde): Define.
242         (Cie::write): Stash FDEs added post merge mapping.
243         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
244         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
245         (Eh_frame::do_sized_write): Arrange to write post map FDES after
246         other FDEs.
247         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
248         (Target_powerpc::has_glink): New function.
249         (Target_powerpc::do_relax): Add eh_frame info for stubs.
250         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
251         glink_eh_frame_fde_32, default_fde): New data.
252         (Stub_table::eh_frame_added_): New var.
253         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
254         Make const.
255         (Stub_table::add_eh_frame): New function.
256         (Output_data_glink::add_eh_frame): New function.
257         (Target_powerpc::make_glink_section): Call add_eh_frame.
258
259 2013-02-15  Ian Lance Taylor  <iant@google.com>
260
261         * options.h (DEFINE_uint64_alias): Define.
262         (class General_options): Add -Ttext-segment as an alias for
263         -Ttext.
264
265 2013-02-15  Alan Modra  <amodra@gmail.com>
266
267         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
268         (Stub_table::do_write): ..here, two places.
269         (Stub_table::plt_call_size): Use it here too.
270
271 2013-02-11  Ian Lance Taylor  <iant@google.com>
272
273         * descriptors.cc (Descriptors::close_all): New function.
274         * descriptors.h (class Descriptors): Declare close_all.
275         (close_all_descriptors): New inline function.
276         * plugin.cc: Include "descriptors.h".
277         (Plugin_manager::cleanup): Call close_all_descriptors.
278
279 2013-02-06  Alan Modra  <amodra@gmail.com>
280
281         * README: Update coding style link.
282
283 2013-01-28  Cary Coutant  <ccoutant@google.com>
284
285         * dwp.cc (File_list): New typedef.
286         (Dwo_name_info_reader): New class.
287         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
288         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
289         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
290         (Dwo_file::read_executable): New function.
291         (Dwo_file::read): Move common setup code to ...
292         (Dwo_file::make_object): ... here.
293         (dwp_options): Add --exec/-e.
294         (usage): Likewise.
295         (main): Likewise.
296
297 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
298
299         * layout.cc (Layout::layout): Check for option text_reorder.
300         (Layout::make_output_section): Ditto.
301         * options.h (text_reorder): New option.
302         * output.cc (Input_section_sort_compare): Remove special ordering
303         of section names.
304         (Output_section::
305          Input_section_sort_section_name_special_ordering_compare::
306          operator()): New function.
307         (Output_section::sort_attached_input_sections): Use new sort function
308         for .text.
309         * output.h (Input_section_sort_section_name_special_ordering_compare):
310         New struct.
311         * testsuite/Makefile.am (text_section_grouping): Test option
312         --no-text-reorder
313         * testsuite/Makefile.in: Regenerate.
314         * testsuite/text_section_grouping.sh: Check order of functions without
315         default text reordering.
316
317 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
318
319         * options.h (General_options): Change default to true for new_dtags.
320
321 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
322
323         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
324         when enable_new_dtags is false.  Only add DT_RUNPATH when
325         enable_new_dtags is true.
326
327 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
328
329         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
330         used in declaration and definition consistent.
331         (Target_powerpc::symval_for_branch): Ditto.
332
333 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
334
335         * testsuite/plugin_final_layout.cc: Fix comment.
336
337 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
338
339         * layout.cc (Layout::layout): Do not do default sorting for
340         text sections when section ordering is specified.
341         (make_output_section): Ditto.
342         * testsuite/plugin_final_layout.cc: Name the function sections
343         to catch reordering issues.
344
345 2013-01-15  Alan Modra  <amodra@gmail.com>
346
347         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
348         plt-thread-safe.
349
350 2013-01-15  Alan Modra  <amodra@gmail.com>
351
352         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
353         * testsuite/Makefile.in: Regenerate.
354
355 2013-01-14  Alan Modra  <amodra@gmail.com>
356
357         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
358         * testsuite/Makefile.in: Regenerate.
359
360 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
361
362         PR bfd/14430
363         Fix mingw gold build with plugins enabled
364         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
365         * configure.ac: Export DLOPEN_LIBS and add headers check.
366         * plugin.cc: Handle non-dlfcn case.
367         * Makefile.in: Regenerate.
368         * config.in: Regenerate.
369         * configure: Regenerate.
370         * testsuite/Makefile.in: Regenerate.
371
372 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
373
374         * output.h (sort_attached_input_sections): Change to be public.
375         * script-sections.cc
376         (Output_section_definition::set_section_addresses): Sort
377         attached input sections according to section order before linker
378         script assigns section addresses.
379         (Orphan_output_section::set_section_addresses): Sort
380         attached input sections according to section order before linker
381         script assigns section addresses.
382         * Makefile.am (final_layout.sh): Use a simple linker script to
383         check if section ordering still works.
384         * Makefile.in: Regenerate.
385
386 2013-01-09  Ben Cheng  <bccheng@google.com>
387
388         * arm.cc (Target_arm::attributes_accept_div): New function.
389         (Target_arm::attributes_forbid_div): New function.
390         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
391         attribute using the same new functions as what bfd/elf32_arm.c
392         does.
393
394 2013-01-07  Cary Coutant  <ccoutant@google.com>
395
396         PR gold/14993
397         * output.cc (Output_section::add_input_section): For incremental
398         updates, don't track input sections that are allocated from patch
399         space.
400
401 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
402             Ian Lance Taylor  <iant@google.com>
403
404         PR gold/14897
405         * configure.ac (--enable-ld): Removed.
406         (install_as_default): Set to yes only for --enable-gold=default
407         or --disable-ld.
408         * configure: Regenerated.
409
410 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
411
412         * options.h (General_options): Add -fuse-ld= for GCC linker
413         option compatibility.
414
415 2013-01-04  Cary Coutant  <ccoutant@google.com>
416
417         * configure.ac: Fix typo restoring CXXFLAGS.
418         * configure: Regenerate.
419
420 2013-01-04  Cary Coutant  <ccoutant@google.com>
421
422         * testsuite/Makefile.am (CXXLINK_S): New macro.
423         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
424         * testsuite/Makefile.in: Regenerate.
425
426 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
427
428         * version.cc (print_version): Update copyright year to 2013.
429
430 2012-12-20  Ian Lance Taylor  <iant@google.com>
431
432         * layout.cc (Layout::special_ordering_of_input_section): New
433         function.
434         (Layout::layout): If input section requires special ordering, must
435         sort input sections.
436         (Layout::make_output_section): May sort .text input sections.
437         (Layout::is_section_name_prefix_grouped): Remove.
438         * layout.h (class Layout): Declare
439         special_ordering_of_input_section.  Don't declare
440         is_section_name_prefix_grouped.
441         * output.cc (Output_section::add_input_section): Revert last
442         change.
443         (Output_section::Input_section_sort::match_file_name): Don't crash
444         if called on output section data.
445         (Output_section::Input_section_sort_compare): Sort based on
446         special ordering.
447         (Output_section::Input_section_sort_section_order_index_compare):
448         Revert last patch.
449         (Output_section::sort_attached_input_sections): Likewise.
450
451 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
452
453         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
454         * layout.h (Layout::is_section_name_prefix_grouped): New function.
455         * output.cc (Output_section::add_input_section): Check if section
456         name contains special prefix.  Keep input sections to sort such
457         sections.
458         (Output_section::Input_section_sort_section_order_index_compare
459          ::operator()): Group sections according to prefixes.
460         (Output_section::sort_attached_input_sections): Add condition to
461         Input_section_entry constructor call.
462         * testsuite/Makefile.am (text_section_grouping): New test.
463         * testsuite/Makefile.in: Regenerate.
464         * testsuite/text_section_grouping.cc: New file.
465         * testsuite/text_section_grouping.sh: New file.
466
467 2012-12-17  Nick Clifton  <nickc@redhat.com>
468
469         * Makefile.am: Add copyright notice.
470         * NEWS: Likewise.
471         * README: Likewise.
472         * configure.ac: Likewise.
473         * ftruncate.c: Likewise.
474         * Makefile.in: Regenerate.
475
476 2012-12-14  Cary Coutant  <ccoutant@google.com>
477
478         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
479         --no-as-needed flag.
480         (exception_separate_shared_12_test): Likewise.
481         (incremental_copy_test): Likewise.
482         * testsuite/Makefile.in: Regenerate.
483
484 2012-12-14  Cary Coutant  <ccoutant@google.com>
485
486         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
487         (Dwp_output_file::Dwp_index::enter_set): Add assert.
488
489 2012-12-12  Alan Modra  <amodra@gmail.com>
490
491         * powerpc.cc (class Track_tls): New.
492         (class Relocate, class Scan): Inherit Track_tls.
493         (Target_powerpc::Scan::local, global): Track tls optimization
494         and avoid creating plt entry for __tls_get_addr if all uses
495         are optimized away.
496         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
497
498 2012-12-12  Alan Modra  <amodra@gmail.com>
499
500         * options.h (General_options): Add --toc-sort/--no-toc-sort.
501         Replace no_toc_optimize with toc_optimize.
502         * output.h (Output_section::input_sections): Provide non-const variant.
503         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
504         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
505         accessors.
506         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
507         (class Sort_toc_sections): New.
508         (Target_powerpc::do_finalize_sections): Sort toc sections.
509         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
510
511 2012-12-10  Roland McGrath  <mcgrathr@google.com>
512
513         * testsuite/binary_unittest.cc (read_all): New function.
514         (Sized_binary_test): Use it instead of ::read.
515         * fileread.cc (do_read): Don't assume pread always reads the whole
516         amount in a single call.
517
518 2012-12-10  Alan Modra  <amodra@gmail.com>
519
520         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
521         Set EM_PPC64 or EM_PPC here.
522         (Target_selector_powerpc::do_recognize): Delete.
523
524 2012-12-10  Alan Modra  <amodra@gmail.com>
525
526         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
527         stub_table_.
528         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
529
530 2012-12-07  Roland McGrath  <mcgrathr@google.com>
531
532         * testsuite/binary_unittest.cc (Sized_binary_test):
533         Use open_descriptor rather than ::open.
534
535 2012-12-07  Alan Modra  <amodra@gmail.com>
536
537         * powerpc.cc (Stub_table::do_write): Delete redundant Address
538         typedef and invalid_address constant.
539         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
540         instantiate constants.
541
542 2012-12-06  Roland McGrath  <mcgrathr@google.com>
543
544         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
545         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
546         * aclocal.m4: Regenerate.
547         * configure: Regenerate.
548         * Makefile.in: Regenerate.
549         * testsuite/Makefile.in: Regenerate.
550
551 2012-12-07  Alan Modra  <amodra@gmail.com>
552
553         * options.h (General_options): Add no_toc_optimize.
554         * powerpc.cc (ok_lo_toc_insn): New function.
555         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
556
557 2012-12-06  Alan Modra  <amodra@gmail.com>
558
559         * options.h (General_options): Add plt_align, plt_static_chain,
560         plt_thread_safe.  Update stub_group_size help text.
561         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
562         for new plt_thread_safe_ var.
563         (use_plt_offset): Correct comments.
564         (Target_powerpc::do_relax): Look for thread creation symbols to
565         determine default plt_thread_safe value.  Clear plt call stubs
566         as well as branch stubs each iteration.
567         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
568         insn constants.
569         (l, hi, ha, write_insn): Move earlier.
570         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
571         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
572         plt stubs too.
573         (Stub_table::update_size): Adjust.
574         (Stub_table::prev_size, set_prev_size): Delete.
575         (Stub_table::stub_align): Let --plt-align affect result.
576         (Stub_table::plt_call_size): Calculate sizes for various stubs.
577         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
578         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
579         (Stub_table::do_write): Support more stub variants.
580
581 2012-12-04  Alan Modra  <amodra@gmail.com>
582
583         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
584         (Target_powerpc::do_define_standard_symbols): New function.
585
586 2012-12-03  Alan Modra  <amodra@gmail.com>
587
588         * output.h: Formatting, whitespace.
589
590 2012-12-03  Alan Modra  <amodra@gmail.com>
591
592         * layout.h (Layout::get_executable_sections): Declare.
593         * layout.cc (Layout::get_executable_sections): New function.
594         * arm.cc (Target_arm::group_sections): Use it.
595         (Arm_output_section::group_sections): Delete now redundant test.
596         * output.cc (Output_reloc::Output_reloc): Add is_relative.
597         param to handle relative relocs.
598         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
599         (Output_data_reloc::add_absolute): Adjust.
600         (Output_data_reloc::add_relative): New function.
601         (Output_data::reset_data_size): New function.
602         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
603         (Output_section::set_addralign): New function.
604         (Output_section::checkpoint_set_addralign): New function.
605         (Output_section::clear_section_offsets_need_adjustment): New function.
606         (Output_section::input_sections): Make public.
607         * powerpc.cc (class Output_data_brlt_powerpc): New.
608         (class Stub_table, class Stub_control): New.
609         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
610         stub_table_, set_stub_table, stub_table): New vectors and accessor
611         functions.
612         (Target_powerpc::do_may_relax, do_relax, push_branch,
613         new_stub_table, stub_tables, brlt_section, group_sections,
614         add_branch_lookup_table, find_branch_lookup_table,
615         write_branch_lookup_table, make_brlt_section): New functions.
616         (Target_powerpc::struct Sort_sections, class Branch_info): New.
617         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
618         branch_info_): New vars.
619         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
620         make call stubs here.
621         (Output_data_glink): Remove all call stub handling from this class.
622         (Target_powerpc::Scan::local, global): Save interesting branch
623         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
624         (Target_powerpc::do_finalize_sections): Only make reg save/restore
625         functions on final link.
626         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
627         Handle long branch destinations too.
628         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
629         do_plt_address_for_local): Adjust lookup of plt call stubs.
630
631 2012-11-30  Alan Modra  <amodra@gmail.com>
632
633         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
634         relocs against protected symbols when building 32-bit shared libs.
635
636 2012-11-30  Alan Modra  <amodra@gmail.com>
637
638         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
639         param.  Call got_section() to make .got.  Update all callers
640         and their callers and so on.
641
642 2012-11-30  Alan Modra  <amodra@gmail.com>
643
644         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
645         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
646         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
647         value if it already exists.
648
649 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
650
651         PR gold/14858
652         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
653
654 2012-11-14  Roland McGrath  <mcgrathr@google.com>
655
656         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
657         than bfc instruction for data sandboxing.
658
659 2012-11-08  Alan Modra  <amodra@gmail.com>
660
661         * po/POTFILES.in: Regenerate.
662
663 2012-11-05  Alan Modra  <amodra@gmail.com>
664
665         * configure.ac: Apply 2012-09-10 change to config.in here.
666         * configure: Regenerate.
667
668 2012-11-05  Alan Modra  <amodra@gmail.com>
669
670         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
671         (struct Opd_ent): Use "Address" rather than "Offset".
672         (Output_data_got_powerpc::got_base_offset): Return Valtype.
673         (Target_powerpc::got_section): Make public.
674         (Target_powerpc::scan_relocs): Move code setting symbols..
675         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
676         Create _SDA_BASE_ only when referenced.
677
678 2012-11-02  Roland McGrath  <mcgrathr@google.com>
679
680         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
681         from last change.
682
683 2012-11-01  Roland McGrath  <mcgrathr@google.com>
684
685         * target.h (Sized_target::relocate_relocs): Use Elf_Off
686         for offset_in_output_section parameter.
687         (Sized_target::relocate_special_relocatable): Likewise.
688         * arm.cc (Target_arm::relocate_relocs): Likewise.
689         (Target_arm::relocate_special_relocatable): Likewise.
690         * i386.cc (Target_i386::relocate_relocs): Likewise.
691         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
692         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
693         * target-reloc.h (relocate_relocs): Likewise.
694         * testsuite/testfile.cc (Target_test): Likewise.
695         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
696         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
697
698         * system.h: Move inclusion of <clocale> to after <libintl.h> in
699         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
700
701         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
702         parameter, which is unused in the [!F_SETFD] case.
703
704         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
705         SYMNDX to off_t before comparing it to this->data_size().
706         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
707         * incremental.cc (Output_section_incremental_inputs::do_write):
708         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
709
710         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
711
712 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
713
714         * gold.cc (Target_arm::do_adjust_elf_header): Add the
715         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
716         in EABI_VER5.
717
718 2012-10-29  Cary Coutant  <ccoutant@google.com>
719
720         * dwp.cc (usage): Add file and exit status parameters;
721         add --help and --version options.
722         (print_version): New function.
723         (main): Add --help and --version options.
724
725 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
726
727         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
728         final_layout_sequence.txt.
729         * testsuite/Makefile.in: Regenerated.
730
731 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
732
733         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
734         COMPILE generated by automake.
735         (LINK1): Likewise.
736         (CXXCOMPILE1): Likewise.
737         (CXXLINK1): Likewise.
738         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
739         (LINK): Likewise.
740         (CXXCOMPILE): Likewise.
741         (CXXLINK): Likewise.
742         * testsuite/Makefile.in: Regenerated.
743
744 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
745
746         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
747         on bad fwrite return.
748
749 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
750
751         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
752         on val.
753
754 2012-10-23  Cary Coutant  <ccoutant@google.com>
755
756         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
757         * testsuite/Makefile.in: Regenerate.
758         * testsuite/dwp_test.h: New source file.
759         * testsuite/dwp_test_1.cc: New source file.
760         * testsuite/dwp_test_1.s: New source file.
761         * testsuite/dwp_test_1.sh: New source file.
762         * testsuite/dwp_test_1b.cc: New source file.
763         * testsuite/dwp_test_1b.s: New source file.
764         * testsuite/dwp_test_2.cc: New source file.
765         * testsuite/dwp_test_2.s: New source file.
766         * testsuite/dwp_test_2.sh: New source file.
767         * testsuite/dwp_test_main.cc: New source file.
768         * testsuite/dwp_test_main.s: New source file.
769
770 2012-10-23  Cary Coutant  <ccoutant@google.com>
771
772         * dwp.h: New header file.
773         * dwp.cc: New source file.
774         * gold.h: Move shared declarations to system.h.
775         * system.h: New header file.
776         * Makefile.am: Add dwp.
777         * Makefile.in: Regenerate.
778
779 2012-10-23  Cary Coutant  <ccoutant@google.com>
780
781         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
782         Dwarf_info_reader::read_from_pointer.
783         (Dwarf_pubnames_table::read_header): Likewise.
784         (Dwarf_pubnames_table::next_name): Likewise.
785         (Dwarf_die::read_attributes): Likewise.
786         (Dwarf_die::skip_attributes): Likewise.
787         (Dwarf_info_reader::read_from_pointer): New function template.
788         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
789         (Dwarf_pubnames_table): Likewise.
790         (Dwarf_info_reader::read_from_pointer): New function template.
791         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
792         Dwarf_pubnames_table ctor.
793
794 2012-10-23  Cary Coutant  <ccoutant@google.com>
795
796         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
797         abbrev_shndx.
798         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
799         abbrev_shndx_.
800         (Dwarf_info_reader::set_abbrev_shndx): New method.
801         (Dwarf_info_reader::abbrev_shndx_): New data member.
802
803 2012-10-23  Cary Coutant  <ccoutant@google.com>
804
805         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
806         from object, not parameters.
807         (Dwarf_info_reader::parse): Likewise.
808         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
809         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
810         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
811         methods.
812
813 2012-10-23  Cary Coutant  <ccoutant@google.com>
814
815         * fileread.cc (Input_file::Input_file): New constructor.
816         * fileread.h (class Input_file): Add new constructor.
817
818 2012-10-18  Alan Modra  <amodra@gmail.com>
819
820         PR gold/14727
821         * object.cc (Relobj::is_section_name_included): Also match
822         .sdata personality section.
823
824 2012-10-18  Alan Modra  <amodra@gmail.com>
825
826         * target-reloc.h (class Default_comdat_behavior): New, package up..
827         (get_comdat_behaviour): ..this.
828         (relocate_section): Add Relocate_comdat_behavior template arg,
829         adjust code to suit.
830         * arm.cc (Target_arm::relocate_section): Adjust to suit.
831         (Target_arm::scan_reloc_section): Likewise.
832         * i386.cc (Target_i386::relocate_section): Likewise.
833         * sparc.cc (Target_sparc::relocate_section): Likewise.
834         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
835         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
836         * powerpc.cc (class Relocate_comdat_behavior): New.
837         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
838         gold::relocate_section with new template arg.
839
840 2012-10-18  Alan Modra  <amodra@gmail.com>
841
842         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
843         dynamic relocs for GOT_TPREL got entries, without symbol if
844         resolving locally.
845         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
846         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
847         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
848
849 2012-10-17  Alan Modra  <amodra@gmail.com>
850
851         PR gold/14726
852         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
853
854 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
855
856         * layout.cc (Layout::include_section): Keep sections marked
857         SHF_EXCLUDE when doing relocatable links.
858
859 2012-10-16  Alan Modra  <amodra@gmail.com>
860
861         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
862         (Target_powerpc::do_finalize_sections): Call it.
863         (Output_data_save_res): New class and supporting functions.
864         (Target_powerpc::symval_for_branch): Only look up .opd entry for
865         normal symbols defined in object files.
866
867 2012-10-12  Alan Modra  <amodra@gmail.com>
868
869         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
870         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
871         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
872         section if scan_opd_relocs not yet called.
873         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
874
875 2012-10-12  Alan Modra  <amodra@gmail.com>
876
877         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
878         add_local_ifunc_entry): Revert last change.
879         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
880
881 2012-10-05  Alan Modra  <amodra@gmail.com>
882
883         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
884         do_plt_address_for_global): New functions.
885         (Output_data_got_powerpc::do_write): Don't segfault when linking
886         statically.
887         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
888         add_local_ifunc_entry): Return true on adding entry..
889         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
890         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
891         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
892         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
893         set up symbols here.
894         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
895         syms here.  Do so even when no .iplt.  Don't segfault when linking
896         statically.
897         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
898         new variants without reloc param.
899         (Glink_sym_ent::Glink_sym_ent): Likewise.
900         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
901         reloc when refs will resolve to plt call stub.
902         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
903         R_PPC_PLTREL24 to resolve locally.
904         (Target_powerpc::Scan::global): Correct ifunc handling.
905         (Target_powerpc::Relocate::relocate): Correct local sym glink
906         lookup.  Don't destroy "value" when we have a plt call stub,
907         and when checking plt call validity.
908         (Target_powerpc::do_dynsym_value): Simplify.
909
910 2012-10-05  Alan Modra  <amodra@gmail.com>
911
912         * i386.cc (Output_data_plt_i386::address_for_global,
913         address_for_local): Add plt offset to returned value.  Adjust uses.
914         * sparc.cc (Output_data_plt_sparc::address_for_global,
915         address_for_local): Likewise.
916         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
917         address_for_local): Likewise.
918         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
919         address_for_local): Likewise.
920         * target.h (Target::plt_address_for_global, plt_address_for_local):
921         Update comment.
922         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
923         (Output_data_got::Got_entry::write): Nor here.
924         * output.h: Comment fix.
925
926 2012-10-02  Jiong Wang  <jiwang@tilera.com>
927
928         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
929         global_offset_table_ value for larget got.
930         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
931
932 2012-09-29  Alan Modra  <amodra@gmail.com>
933
934         * powerpc.cc (Target_powerpc::iplt_): New output section.
935         (Target_powerpc::iplt_section, make_iplt_section,
936         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
937         (Target_powerpc::make_plt_entry): Handle ifunc syms.
938         Target_powerpc::plt_entry_count): Count iplt entries too.
939         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
940         reloc section in constructor.  New params.
941         (Target_powerpc::make_plt_section): Create reloc section here instead.
942         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
943         functions.
944         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
945         (Output_data_glink::add_entry, find_entry): New functions to
946         deal with local syms.
947         (Glink_sym_ent): Add support for local syms.
948         (Output_data_glink::do_write): Handle ifunc plt entries.
949         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
950         (Target_powerpc::Scan::local, global): Handle ifunc syms.
951         (Target_powerpc::Relocate::relocate): Likewise.
952         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
953
954 2012-09-25  Alan Modra  <amodra@gmail.com>
955
956         * object.h (Sized_relobj_file::adjust_local_symbol,
957         do_adjust_local_symbol): New functions.
958         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
959         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
960         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
961         and irregular opd entry spacing.
962         (Powerpc_relobj::do_read_relocs): Add opd size checks.
963         (Global_symbol_visitor_opd): New functor.
964         (Target_powerpc::do_finalize_sections): Omit global symbols defined
965         on deleted opd entries.
966
967 2012-09-15  Jiong Wang  <jiwang@tilera.com>
968
969         * tilegx.cc: New file.
970         * Makefile.am (TARGETSOURCES): Add tilegx.cc
971         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
972         * configure.tgt: Add entries for tilegx*.
973         * configure.ac: Likewise.
974         * Makefile.in: Rebuild.
975         * configure: Likewise.
976         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
977         tilegx.
978
979 2012-09-13  Alan Modra  <amodra@gmail.com>
980
981         * target-reloc.h (scan_relocs): Call scan.local for relocs
982         against symbols in discarded sections.  Pass is_discarded
983         param.
984         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
985         Add is_discarded param.
986         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
987         is_discarded to flag opd entry as discarded.  Don't emit dyn
988         relocs on such entries.
989         (Target_powerpc::Scan::global): Similarly detect and handle
990         such opd entries.
991         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
992         opd_ent_.  Update all uses.
993         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
994         (Target_powerpc::relocate_section): Zero out discarded opd
995         entry relocs.
996
997 2012-09-12  Ian Lance Taylor  <iant@google.com>
998
999         PR gold/14570
1000         * output.cc: Rename Output_data_got template parameter from size
1001         to got_size for all functions.  Compile all variants of
1002         Output_data_got.
1003         (Output_data_got::Got_entry::write): Correct use of size for
1004         symbol value.  Use local_is_tls rather than casting to
1005         Sized_relobj_file.
1006         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1007         (class Sized_relobj_file): Add do_local_is_tls.
1008         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1009
1010 2012-09-11  Alan Modra  <amodra@gmail.com>
1011
1012         PR gold/14566
1013         * layout.cc (Layout::set_segment_offsets): When using
1014         common-page-size alignment, ensure we are on a new max-page-size
1015         page.
1016         * output.cc (Output_segment::set_section_addresses): Use
1017         abi_pagesize, not common_pagesize for relro boundary.
1018         (Output_segment::set_offset): Likewise.
1019
1020 2012-09-11  Alan Modra  <amodra@gmail.com>
1021
1022         * output.h (Output_data_got::add_global_tls, add_local_tls,
1023         add_local_tls_pair): New functions.
1024         (Output_data_got::add_local_pair_with_rel): Remove second
1025         reloc param.  Expand comment.
1026         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1027         use_plt_or_tls_offset_, similarly for constructor param.
1028         (Output_data_got::Got_entry::write): Add got_index param.
1029         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1030         add_local_tls_pair): New functions.
1031         (Output_data_got::Got_entry::write): Handle tls symbols
1032         with use_plt_or_tls_offset_ set specially.
1033         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1034         (Output_data_got::do_write): Replace iterator with index, pass
1035         index to entry write function.
1036         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1037         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1038         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1039         call.
1040         * i386.cc (Target_i386::Scan::local): Likewise.
1041         * sparc.cc (Target_sparc::Scan::local): Likewise.
1042         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1043         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1044         do_tls_offset_for_global): New functions.
1045         (Target_powerpc::Scan::local): Correct TLS relocations and got
1046         entry values.
1047         (Target_powerpc::Scan::global): Don't emit unnecessary
1048         dynamic relocations on TLS GOT entries.
1049
1050 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1051
1052         * config.in: Disable sanity check for kfreebsd.
1053
1054 2012-09-10  Sterling Augustine  <saugustine@google.com>
1055
1056         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1057         (Gdb_index::pubtypes_read): New parameter.
1058         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1059         to calls.
1060         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1061         pubtypes_object_.
1062
1063 2012-09-09  Alan Modra  <amodra@gmail.com>
1064
1065         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1066         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1067         * gc.h (gc_process_relocs): Call target gc_add_reference.
1068         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1069         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1070         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1071         unnecessary cast.
1072         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1073         to cater for when we don't need code offset.  Update use.
1074         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1075         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1076         set_opd_valid): New functions.
1077         (Target_powerpc::do_gc_add_reference): New function.
1078         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1079         stashed refs.
1080         (Target_powerpc::do_gc_mark_symbol): New function.
1081
1082 2012-09-06  Cary Coutant  <ccoutant@google.com>
1083
1084         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1085         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1086         (Dwarf_die::skip_attributes): Likewise.
1087         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1088         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1089         (main): Call it.
1090         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1091
1092 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1093
1094         * testsuite/script_test_3.t: Add .got.plt output section
1095         statement.
1096         * testsuite/script_test_4.t: Likewise.
1097
1098 2012-09-05  Alan Modra  <amodra@gmail.com>
1099
1100         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1101         update all uses and lose "enum" when using type.
1102
1103 2012-09-05  Alan Modra  <amodra@gmail.com>
1104
1105         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1106         * configure: Regenerate.
1107         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1108         (plugin_final_layout.stdout): Likewise.
1109         (memory_test): Set page sizes to 0x1000.
1110         * testsuite/Makefile.in: Regenerate.
1111         * testsuite/discard_locals_test.sh: Add FIXME comment.
1112         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1113         * testsuite/pr14265.t: Add .got output section statement.
1114         * testsuite/script_test_2.t: Likewise.
1115         * testsuite/script_test_3.t: Likewise.
1116         * testsuite/script_test_4.t: Likewise.
1117         * testsuite/script_test_5.t: Likewise.
1118         * testsuite/script_test_6.t: Likewise.
1119         * testsuite/script_test_7.t: Likewise.
1120         * testsuite/script_test_9.t: Likewise.
1121
1122 2012-09-05  Alan Modra  <amodra@gmail.com>
1123
1124         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1125         (Powerpc_relocate_functions::Status): New typedef.
1126         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1127         (Target_powerpc::Scan::local): Handle REL64.
1128         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1129         for REL32 and REL64.
1130         (Target_powerpc::symval_for_branch): New function, extracted from..
1131         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1132         checks.  Report overflow errors.
1133
1134 2012-09-05  Alan Modra  <amodra@gmail.com>
1135
1136         * object.h (Sized_relobj_file::emit_relocs): Delete.
1137         (Sized_relobj_file::emit_relocs_reltype): Delete.
1138         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1139         relocate_relocs for --emit-relocs.
1140         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1141         * output.h: Update comment.
1142         (Output_segment::first_section): New function.
1143         (Output_segment::first_section_load_address): Use first_section.
1144         * output.cc (Output_segment::first_section): New function extracted..
1145         (Output_segment::first_section_load_address): ..from here.  Delete.
1146         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1147         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1148         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1149         adjust call to target.h function.
1150         * i386.cc (Target_i386): Likewise.
1151         * sparc.cc (Target_sparc): Likewise.
1152         * x86_64.cc (Target_x86_64): Likewise.
1153         * powerpc.cc (Target_powerpc): Likewise.
1154         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1155         first tls section has section symbol for optimised local dynamic
1156         output relocs.
1157         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1158         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1159         optimised tls code.
1160         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1161         Rename to relocate_relocs.  Update error message.
1162
1163 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1164
1165         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1166         --just-symbols.
1167
1168 2012-08-31  Alan Modra  <amodra@gmail.com>
1169
1170         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1171         (Powerpc_relobj::toc_base_offset): New stub function.
1172         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1173         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1174         (Target_powerpc::Relocate::enum skip_tls): New.
1175         (Target_powerpc::call_tls_get_addr_): New var.
1176         (Target_powerpc::is_branch_reloc): Move to file scope.
1177         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1178         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1179         New functions.
1180         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1181         (powerpc_info): Correct common_pagesize for ppc64.
1182         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1183         (Powerpc_relocate_functions): Add overflow check enums and functions.
1184         Add non-shift version of rela, rela_ua.  Delete all rel public
1185         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1186         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1187         addr16_ha3, addr14 functions.
1188         (Output_data_got_powerpc::add_constant_pair): New function.
1189         (Output_data_got_powerpc::got_base_offset): Likewise.
1190         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1191         (instruction constants): Sort, add some more.
1192         (Output_data_glink::do_write): Add and use Address typedef.  Use
1193         object->toc_base_offset() stub for 64-bit.
1194         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1195         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1196         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1197         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1198         Always treat .opd relocs as against locally defined symbol.
1199         Correct condition for RELATIVE relocs.
1200         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1201         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1202         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1203         calculations.  Handle TLS relocs, and more.  Add overflow
1204         checking and adjust for Powerpc_relocate_functions changes.
1205         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1206         Reinstate --emit-relocs code with FIXME.
1207
1208 2012-08-30  Alan Modra  <amodra@gmail.com>
1209
1210         * layout.cc (Layout::set_segment_offsets): Set p_align to
1211         abi_pagesize, not common_pagesize.
1212         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1213         to determine whether file header can go in segment.
1214
1215 2012-08-30  Alan Modra  <amodra@gmail.com>
1216
1217         * output.h (Output_reloc::Output_reloc <output section>): Add
1218         is_relative param.  Adjust calls.
1219         (Output_reloc::add_output_section_relative): New functions.
1220         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1221         is_relative.
1222         (Output_reloc::symbol_value): Handle SECTION_CODE.
1223
1224 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1225
1226         * gold.cc (queue_middle_tasks): Call layout again when unique
1227         segments for sections is desired.
1228         * layout.cc (Layout::Layout): Initialize new members.
1229         (Layout::get_output_section_flags): New function.
1230         (Layout::choose_output_section): Call get_output_section_flags.
1231         (Layout::layout): Make output section for mapping to a unique segment.
1232         (Layout::insert_section_segment_map): New function.
1233         (Layout::attach_allocated_section_to_segment): Make unique segment for
1234         output sections marked so.
1235         (Layout::segment_precedes): Check for unique segments when sorting.
1236         * layout.h (Layout::Unique_segment_info): New struct.
1237         (Layout::Section_segment_map): New typedef.
1238         (Layout::insert_section_segment_map): New function.
1239         (Layout::get_output_section_flags): New function.
1240         (Layout::is_unique_segment_for_sections_specified): New function.
1241         (Layout::set_unique_segment_for_sections_specified): New function.
1242         (Layout::unique_segment_for_sections_specified_): New member.
1243         (Layout::section_segment_map_): New member.
1244         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1245         Rename is_gc_pass_one to is_pass_one.
1246         Rename is_gc_pass_two to is_pass_two.
1247         Rename is_gc_or_icf to is_two_pass.
1248         Check for which pass based on whether symbols data is present.
1249         Make it two pass when unique segments for sections is desired.
1250         * output.cc (Output_section::Output_section): Initialize new
1251         members.
1252         * output.h (Output_section::is_unique_segment): New function.
1253         (Output_section::set_is_unique_segment): New function.
1254         (Output_section::is_unique_segment_): New member.
1255         (Output_section::extra_segment_flags): New function.
1256         (Output_section::set_extra_segment_flags): New function.
1257         (Output_section::extra_segment_flags_): New member.
1258         (Output_section::segment_alignment): New function.
1259         (Output_section::set_segment_alignment): New function.
1260         (Output_section::segment_alignment_): New member.
1261         (Output_segment::Output_segment): Initialize is_unique_segment_.
1262         (Output_segment::is_unique_segment): New function.
1263         (Output_segment::set_is_unique_segment): New function.
1264         (Output_segment::is_unique_segment_): New member.
1265         * plugin.cc (allow_unique_segment_for_sections): New function.
1266         (unique_segment_for_sections): New function.
1267         (Plugin::load): Add new functions to transfer vector.
1268         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1269         * Makefile.in: Regenerate.
1270         * testsuite/plugin_final_layout.sh: Check if unique segment
1271         functionality works.
1272         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1273         are available.
1274         (allow_unique_segment_for_sections): New global.
1275         (unique_segment_for_sections): New global.
1276         (claim_file_hook): Call allow_unique_segment_for_sections.
1277         (all_symbols_read_hook): Call unique_segment_for_sections.
1278
1279 2012-08-22  Cary Coutant  <ccoutant@google.com>
1280
1281         * layout.cc (Layout::include_section): Don't assert on GROUP
1282         sections with --emit-relocs.
1283
1284 2012-08-21  Cary Coutant  <ccoutant@google.com>
1285
1286         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1287         if --export-dynamic-symbol names an undef symbol.
1288
1289 2012-08-18  Alan Modra  <amodra@gmail.com>
1290
1291         * powerpc.cc: Formatting and white space.
1292         (Powerpc_relobj): Rename got2_section_ to special_.
1293         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1294         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1295         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1296         (Target_powerpc): Add Address typedef and invalid_address.  Use
1297         throughout.
1298         (Target_powerpc::is_branch_reloc): New function.
1299         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1300         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1301         for dst_mask, value and addend.
1302         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1303         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1304         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1305         uint16_t for 24-bit offset.  Use get_output_section_offset and
1306         check return.
1307         (Target_powerpc::Scan::local): Handle more relocs.
1308         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1309         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1310         Plug in toc restoring insn after plt calls.  Translate branches
1311         to function descriptor symbols to corresponding entry point.
1312         (Target_powerpc::relocate_for_relocatable): Check return from
1313         get_output_section_offset.
1314         * symtab.h: Comment typo.
1315
1316 2012-08-14  Ian Lance Taylor  <iant@google.com>
1317
1318         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1319         unsupported_relocal_local to call unsupported_reloc_global.
1320
1321 2012-08-14  Nick Clifton  <nickc@redhat.com>
1322
1323         PR ld/14265
1324         * script-sections.cc (Sections_element::output_section_name): Add
1325         keep return parameter.
1326         (Output_section_element::match_name): Add keep return parameter.
1327         Return the value of the keep_ member.
1328         * script-sections.h (class Output_section): Update
1329         output_section_name prototype.
1330         * layout.cc (Layout::keep_input_section): New public member
1331         function.
1332         (Layout::choose_output_section): Pass keep parameter to
1333         output_section_name.
1334         * layout.h (class Layout): Add keep_input_section.
1335         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1336         sections.
1337         * testsuite/Makefile.am: Add a test.
1338         * testsuite/Makefile.in: Regenerate.
1339         * testsuite/pr14265.c: Source file for the test.
1340         * testsuite/pr14265.t: Linker script for the test.
1341         * testsuite/pr14265.sh: Shell script for the test.
1342
1343 2012-08-14  Alan Modra  <amodra@gmail.com>
1344
1345         * target.h (Target::output_section_name): New function.
1346         (Target::do_output_section_name): New function.
1347         * layout.cc (Layout::choose_output_section): Call the above.
1348         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1349
1350 2012-08-14  Alan Modra  <amodra@gmail.com>
1351
1352         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1353         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1354         for replace_constant call.
1355         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1356         (Output_data_glink::do_print_to_mapfile): New function.
1357         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1358         (Target_powerpc::Relocate::relocate): Likewise.
1359
1360 2012-08-14  Alan Modra  <amodra@gmail.com>
1361
1362         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1363         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1364         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1365         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1366         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1367         here.
1368         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1369         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1370         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1371         here.
1372         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1373         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1374
1375 2012-08-12  Alan Modra  <amodra@gmail.com>
1376
1377         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1378         (glink insn constants): Use uint32_t.
1379         (Output_data_glink::add_entry): Use insert, not [] operator.
1380
1381 2012-08-11  Alan Modra  <amodra@gmail.com>
1382
1383         * object.h (Sized_relobj_file::find_shdr): New function.
1384         (Sized_relobj_file::find_special_sections): New function.
1385         * object.cc (Sized_relobj_file::find_shdr): New function.
1386         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1387         (Sized_relobj_file::find_special_sections): New function, split out..
1388         (Sized_relobj_file::do_read_symbols): ..from here.
1389         * output.h (Output_data_got::replace_constant): New function.
1390         (Output_data_got::num_entries): New function.
1391         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1392         (Output_data_got::got_offset): Protected rather than private.
1393         (Output_data_got::replace_got_entry): New function.
1394         * output.cc (Output_data_got::replace_got_entry): New function.
1395         * powerpc.cc (class Powerpc_relobj): New.
1396         (class Powerpc_relocate_functions): Delete all psymval variants or
1397         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1398         Implement _ha functions using corresponding _hi function.
1399         (Powerpc_relobj::find_special_sections): New function.
1400         (Target_powerpc::do_make_elf_object): New function.
1401         (class Output_data_got_powerpc): New.
1402         (class Output_data_glink): New.
1403         (class Powerpc_scan_relocatable_reloc): New.
1404         Many more changes througout file.
1405
1406 2012-08-09  Nick Clifton  <nickc@redhat.com>
1407
1408         * po/vi.po: Updated Vietnamese translation.
1409
1410 2012-08-07  Ian Lance Taylor  <iant@google.com>
1411
1412         * layout.cc (Layout::add_target_dynamic_tags): If
1413         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1414         plt_rel.
1415
1416 2012-07-30  Nick Clifton  <nickc@redhat.com>
1417
1418         * po/gold.pot: Updated template.
1419         * po/es.po: Updated Spanish translation.
1420
1421 2012-07-18  Cary Coutant  <ccoutant@google.com>
1422
1423         PR gold/14344
1424         * configure.ac: Add check for -gpubnames support.
1425         * configure: Regenerate.
1426         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1427         support; force -gno-pubnames.
1428         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1429         support.
1430         (gdb_index_test_4): New test.
1431         * testsuite/Makefile.in: Regenerate.
1432         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1433         * testsuite/gdb_index_test_2.sh: Likewise.
1434         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1435         * testsuite/gdb_index_test_4.sh: New script.
1436         * testsuite/gdb_index_test_comm.sh: New script with common code;
1437         don't look for space after colon.
1438
1439 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1440
1441         * gold.cc (queue_middle_tasks): Update function order only after
1442         deferred objects due to plugins are processed.
1443
1444 2012-07-11  Ian Lance Taylor  <iant@google.com>
1445
1446         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1447         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1448         (Target_arm::scan_reloc_for_stub): Likewise.
1449         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1450         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1451         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1452         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1453         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1454
1455 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1456             Ian Lance Taylor  <iant@google.com>
1457
1458         PR gold/14309
1459         * configure.ac: Test whether std::tr1::hash<off_t> works.
1460         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1461         needed.
1462         * output.h (class Output_fill): Add virtual destructor.
1463         * configure, config.in: Rebuild.
1464
1465 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1466
1467         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1468
1469 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1470
1471         * plugin.cc (Plugin::load): Handle position independent executables.
1472
1473 2012-06-06  Cary Coutant  <ccoutant@google.com>
1474
1475         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1476         add .debug_macro.
1477         (lines_only_debug_sections): Likewise.
1478         (gdb_fast_lookup_sections): New static array.
1479         (is_gdb_debug_section): Rename formal parameter.
1480         (is_lines_only_debug_section): Likewise.
1481         (is_gdb_fast_lookup_section): New function.
1482         (Layout::include_section): Check for ".zdebug_" prefix; pass
1483         section name suffix to is_gdb_debug_section, et al.; check for
1484         fast-lookup sections when building .gdb_index.
1485         * options.h (--strip-debug-gdb): Update GDB version number.
1486
1487 2012-06-06  Cary Coutant  <ccoutant@google.com>
1488
1489         * configure.ac: Add check for fallocate.
1490         * configure: Regenerate.
1491         * config.in: Regenerate.
1492
1493         * options.h (class General_options): Add --mmap-output-file and
1494         --posix-fallocate options.
1495         * output.cc: (posix_fallocate): Remove; replace with...
1496         (gold_fallocate): New function.
1497         (Output_file::map_no_anonymous): Call gold_fallocate.
1498         (Output_file::map): Check --mmap-output-file option.
1499
1500 2012-06-05  Jing Yu  <jingyu@google.com>
1501
1502         * gold.h (textdomain): Add do {} to empty while(0).
1503         (bindtextdomain): Likewise.
1504
1505 2012-06-04  Cary Coutant  <ccoutant@google.com>
1506
1507         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1508         has_dynsym_index.
1509
1510 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1511
1512         * symtab.cc (Symbol_table::define_special_symbol):
1513         Initialize *poldsym to prevent uninitialized variable errors.
1514
1515 2012-05-23  Cary Coutant  <ccoutant@google.com>
1516
1517         * layout.cc (Layout::section_name_mapping): Add rules to handle
1518         exact match on .data.rel.ro.local or .data.rel.ro.
1519         (Layout::output_section_name): Check for exact matches.
1520
1521 2012-05-23  Cary Coutant  <ccoutant@google.com>
1522
1523         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1524         more carefully.
1525
1526 2012-05-22  Cary Coutant  <ccoutant@google.com>
1527
1528         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1529         object before exporting symbol.
1530
1531 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1532
1533         * testsuite/tls_test.cc: Include "config.h" first.
1534         * testsuite/tls_test_c.c: Likewise.
1535
1536 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1537             Nick Clifton  <nickc@redhat.com>
1538
1539         PR 14072
1540         * configure.in: Add check that sysdep.h has been included before
1541         any system header files.
1542         * configure: Regenerate.
1543         * config.in: Regenerate.
1544
1545 2012-05-14  Cary Coutant  <ccoutant@google.com>
1546
1547         * layout.cc (Layout::make_output_section): Mark .tdata section
1548         as RELRO.
1549         * testsuite/relro_test.cc: Add a TLS variable.
1550
1551 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1552
1553         PR gold/14091
1554         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1555         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1556         R_X86_64_64.
1557
1558 2012-05-08  Cary Coutant  <ccoutant@google.com>
1559
1560         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1561         (lines_only_debug_sections): Likewise.
1562
1563 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1564
1565         * nacl.cc: New file.
1566         * nacl.h: New file.
1567         * Makefile.am (CCFILES, HFILES): Add them.
1568         * Makefile.in: Regenerate.
1569         * i386.cc (Output_data_plt_i386_nacl): New class.
1570         (Output_data_plt_i386_nacl_exec): New class.
1571         (Output_data_plt_i386_nacl_dyn): New class.
1572         (Target_i386_nacl): New class.
1573         (Target_selector_i386_nacl): New class.
1574         (target_selector_i386): Use it instead of Target_selector_i386.
1575         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1576         (Target_x86_64_nacl): New class.
1577         (Target_selector_x86_64_nacl): New class.
1578         (target_selector_x86_64, target_selector_x32): Use it instead of
1579         Target_selector_x86_64.
1580         * arm.cc (Output_data_plt_arm_nacl): New class.
1581         (Target_arm_nacl): New class.
1582         (Target_selector_arm_nacl): New class.
1583         (target_selector_arm, target_selector_armbe): Use it instead of
1584         Target_selector_arm.
1585
1586         * target-select.cc (select_target): Take new Input_file* and off_t
1587         arguments, pass them on to recognize method of selector.
1588         * object.cc (make_elf_sized_object): Update caller.
1589         * parameters.cc (parameters_force_valid_target): Likewise.
1590         * incremental.cc (make_sized_incremental_binary): Likewise.
1591         * target-select.h: Update decl.
1592         (Target_selector::recognize): Take new Input_file* argument,
1593         pass it on to do_recognize.
1594         (Target_selector::do_recognize): Take new Input_file* argument.
1595         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1596         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1597         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1598         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1599
1600         * target.h (Target::Target_info): New members isolate_execinstr
1601         and rosegment_gap.
1602         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1603         * arm.cc (Target_arm::arm_info): Update initializer.
1604         * i386.cc (Target_i386::i386_info): Likewise.
1605         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1606         * sparc.cc (Target_sparc::sparc_info): Likewise.
1607         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1608         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1609         * layout.cc (Layout::attach_allocated_section_to_segment):
1610         Take new const Target* argument.  If target->isolate_execinstr(), act
1611         like --rosegment.
1612         (Layout::find_first_load_seg): Take new const Target* argument;
1613         if target->isolate_execinstr(), reject PF_X segments.
1614         (Layout::relaxation_loop_body): Update caller.
1615         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1616         reset file offset to zero when we hit LOAD_SEG, and then do a second
1617         loop over the segments before LOAD_SEG to reassign offsets after
1618         addresses have been determined.  Handle target->rosegment_gap().
1619         (Layout::attach_section_to_segment): Take new const Target* argument;
1620         pass it to attach_allocated_section_to_segment.
1621         (Layout::make_output_section): Update caller.
1622         (Layout::attach_sections_to_segments): Take new const Target* argument;
1623         pass it to attach_section_to_segment.
1624         * gold.cc (queue_middle_tasks): Update caller.
1625         * layout.h (Layout): Update method decls with new arguments.
1626
1627         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1628         Target_info pointer to use.
1629         (Target_arm::do_make_data_plt): New virtual method.
1630         (Target_arm::make_data_plt): New method that calls it.
1631         (Target_arm::make_plt_entry): Use it.
1632         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1633         for the section alignment.
1634         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1635         method.
1636         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1637         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1638         method.
1639         (Output_data_plt_arm::get_plt_entry_size): Call it.
1640         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1641         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1642         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1643         method.
1644         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1645         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1646         method instead of sizeof(plt_entry).
1647         (Output_data_plt_arm::add_entry): Likewise.
1648         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1649         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1650         than static method.
1651         (Target_arm::plt_entry_size): Likewise.
1652         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1653         Move to ...
1654         (Output_data_plt_arm_standard): ... here, new class.
1655         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1656         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1657         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1658
1659         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1660         Take additional argument for the PLT entry size.
1661         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1662         Use get_plt_entry_size method rather than plt_entry_size variable.
1663         (Output_data_plt_x86_64::reserve_slot): Likewise.
1664         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1665         (Output_data_plt_x86_64::add_entry): Likewise.
1666         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1667         (Output_data_plt_x86_64::address_for_global): Likewise.
1668         (Output_data_plt_x86_64::address_for_local): Likewise.
1669         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1670         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1671         Make method non-static.
1672         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1673         method.
1674         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1675         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1676         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1677         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1678         virtual method.
1679         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1680         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1681         virtual method.
1682         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1683         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1684         virtual method.
1685         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1686         (Output_data_plt_x86_64::plt_entry_size)
1687         (Output_data_plt_x86_64::first_plt_entry)
1688         (Output_data_plt_x86_64::plt_entry)
1689         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1690         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1691         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1692         (Output_data_plt_x86_64_standard): ... here, new class.
1693         (Target_x86_64::Target_x86_64): Take optional argument for the
1694         Target_info pointer to use.
1695         (Target_x86_64::do_make_data_plt): New virtual method.
1696         (Target_x86_64::make_data_plt): New method to call it.
1697         (Target_x86_64::init_got_plt_for_update): Use that.
1698         Call this->plt_->add_eh_frame method here.
1699         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1700         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1701         rather than static method.
1702         (Target_x86_64::plt_entry_size): Likewise.
1703         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1704         rather than plt_entry_size variable.  Move guts of PLT filling to...
1705         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1706         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1707         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1708
1709         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1710         additional argument for the section alignment.
1711         Don't do add_eh_frame_for_plt here.
1712         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1713         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1714         variable.
1715         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1716         method.
1717         (Output_data_plt_i386::get_plt_entry_size): Call it.
1718         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1719         (Output_data_plt_i386::add_eh_frame): New method to call it.
1720         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1721         method.
1722         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1723         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1724         method.
1725         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1726         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1727         method instead of plt_entry_size.
1728         (Output_data_plt_i386::plt_entry_size)
1729         (Output_data_plt_i386::plt_eh_frame_fde_size)
1730         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1731         (Output_data_plt_i386_standard): ... here, new class.
1732         (Output_data_plt_i386_exec): New class.
1733         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1734         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1735         (Output_data_plt_i386::exec_plt_entry): Move to ...
1736         (Output_data_plt_i386_exec::plt_entry): ... here.
1737         (Output_data_plt_i386_dyn): New class.
1738         (Output_data_plt_i386::first_plt_entry): Move to ...
1739         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1740         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1741         (Output_data_plt_i386_dyn::plt_entry): ... here.
1742         (Target_i386::Target_i386): Take optional argument for the Target_info
1743         pointer to use.
1744         (Target_i386::do_make_data_plt): New virtual method.
1745         (Target_i386::make_data_plt): New method to call it.
1746         (Target_i386::make_plt_section): Use that.
1747         Call this->plt_->add_eh_frame method here.
1748         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1749         rather than plt_entry_size variable.
1750         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1751         (Output_data_plt_i386::address_for_local): Likewise.
1752         (Output_data_plt_i386::do_write): Likewise.
1753         Move guts of PLT filling to...
1754         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1755         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1756         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1757         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1758
1759 2012-05-01  Cary Coutant  <ccoutant@google.com>
1760
1761         * dwarf_reader.cc (Dwarf_die::read_attributes)
1762         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1763         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1764         * reduced_debug_output.cc
1765         (Output_reduced_debug_info_section::get_die_end): Remove
1766         DW_FORM_GNU_ref_index.  Add default case.
1767
1768 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1769
1770         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1771         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1772         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1773         DW_AT_high_pc as offset from DW_AT_low_pc.
1774
1775         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1776         * testsuite/Makefile.in: Regenerate.
1777         * testsuite/gdb_index_test_3.c: New test source file.
1778         * testsuite/gdb_index_test_3.sh: New test source file.
1779
1780 2012-04-25  Ian Lance Taylor  <iant@google.com>
1781
1782         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1783         pointer.
1784         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1785         as a class, not a struct.
1786         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1787         (Target_arm::apply_cortex_a8_workaround): Likewise.
1788         * gc.h: Declare Reloc_types as a struct, not a class.
1789         * object.h: Declare Symbols_data as a struct.
1790         * reloc.h: Declare Read_relocs_data as a struct.
1791         * target.h: Declare Relocate_info as a struct.
1792
1793 2012-04-24  David S. Miller  <davem@davemloft.net>
1794
1795         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1796         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1797         and R_SPARC_WPLT30.
1798
1799 2012-04-24  Cary Coutant  <ccoutant@google.com>
1800
1801         * incremental-dump.cc (find_input_containing_global): Replace
1802         magic number with symbolic constant.
1803         (dump_incremental_inputs): Update version number.
1804         * incremental.cc (Output_section_incremental_inputs): Update version
1805         number; import symbolic constants from Incremental_inputs_reader.
1806         (Incremental_inputs::create_data_sections): Align relocations
1807         section correctly for 64-bit targets.
1808         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1809         constants; add padding.
1810         (Output_section_incremental_inputs::write_header): Add assert for
1811         header_size.
1812         (Output_section_incremental_inputs::write_input_files): Add assert
1813         for input_entry_size.
1814         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1815         add assert for object_info_size, input_section_entry_size,
1816         global_sym_entry_size.
1817         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1818         for data structure sizes; use them.
1819         (Incremental_input_entry_reader): Import symbolic constants from
1820         Incremental_inputs_reader; use them.
1821
1822 2012-04-23  David S. Miller  <davem@davemloft.net>
1823
1824         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1825         and elf_flags_set_.
1826         (Target_sparc::Target_sparc): Initialize new fields.
1827         (Target_sparc::do_make_elf_object): New function.
1828         (Target_sparc::do_adjust_elf_header): New function.
1829
1830 2012-04-23  Cary Coutant  <ccoutant@google.com>
1831
1832         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1833         CU range table of gdb index.
1834
1835 2012-04-20  David S. Miller  <davem@davemloft.net>
1836
1837         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1838         instead of false.
1839
1840 2012-04-16  David S. Miller  <davem@davemloft.net>
1841
1842         * sparc.cc (Target_sparc::got_address): New function.
1843         (Sparc_relocate_functions::gdop_hix22): New function.
1844         (Sparc_relocate_functions::gdop_lox10): New function.
1845         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1846         relocs.
1847         (Target_sparc::Scan::local): Likewise if the global symbol is not
1848         preemptible and is not IFUNC.
1849         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1850         transformations for local and non-preemptible non-IFUNC global
1851         symbols.
1852
1853         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1854         writing out 64-bit part of ranges.
1855
1856         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1857         -fpic and -fpie respectively.
1858         * Makefile.in: Regenerate.
1859
1860         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1861         (Target_sparc::Target_sparc): Initialize new field.
1862         (Target_sparc::do_plt_section_for_global): New function.
1863         (Target_sparc::do_plt_section_for_local): New function.
1864         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1865         (Target_sparc::make_plt_section): New function, broken out of
1866         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1867         (Target_sparc::make_plt_entry): Call make_plt_section.
1868         (Target_sparc::make_local_ifunc_plt_entry): New function.
1869         (Target_sparc::rela_ifunc_section): New function.
1870         (Target_sparc::plt_section): Remove const.
1871         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1872         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1873         and ifunc_count_ fields.
1874         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1875         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1876         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1877         (Output_data_plt_sparc::rela_ifunc): New function.
1878         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1879         (Output_data_plt_sparc::has_ifunc_section): New function.
1880         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1881         (Output_data_plt_sparc::address_for_global): New function.
1882         (Output_data_plt_sparc::address_for_local): New function.
1883         (Output_data_plt_sparc::plt_index_to_offset): New function.
1884         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1885         and entry_count.
1886         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1887         entry_count.
1888         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1889         R_SPARC_JMP_IREL to switch.
1890         (Target_sparc::Scan::check_non_pic): Likewise.
1891         (Target_sparc::Scan::local): Handle IFUNC symbols.
1892         (Target_sparc::Scan::local): Likewise.
1893         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1894         and plt_address_for_local.
1895         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1896         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1897
1898         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1899         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1900         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1901         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1902         global relocs too.
1903         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1904         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1905         calls.
1906         * sparc.cc (Target_sparc::Scan::global): Likewise.
1907         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1908
1909 2012-04-16  Cary Coutant  <ccoutant@google.com>
1910
1911         * archive.cc (Library_base::should_include_member): Check for
1912         --export-dynamic-symbol.
1913         * options.h (class General_options): Add --export-dynamic-symbol.
1914         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1915         --export-dynamic-symbol.
1916         (Symbol_table::gc_mark_undef_symbols): Likewise.
1917         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1918
1919 2012-04-12  David S. Miller  <davem@davemloft.net>
1920
1921         * sparc.cc (Reloc::wdisp10): New relocation method.
1922         (Reloc::h34): Likewise.
1923         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1924         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1925         R_SPARC_WDISP10.
1926         (Target_sparc::Scan::local): Likewise.
1927         (Target_sparc::Scan::global): Likewise.
1928         (Target_sparc::Relocate::relocate): Likewise.
1929
1930 2012-04-09  Cary Coutant  <ccoutant@google.com>
1931
1932         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1933         low_pc == 0.
1934
1935 2012-04-06  Ian Lance Taylor  <iant@google.com>
1936
1937         * timer.cc: #include <unistd.h>.
1938
1939 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1940
1941         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1942         * config.in: Regenerate.
1943         * configure: Regenerate.
1944
1945 2012-04-05  Nick Clifton  <nickc@redhat.com>
1946
1947         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1948         (AM_LC_MESSAGES): Add.
1949         * aclocal.m4: Regenerate.
1950         * config.in: Regenerate.
1951         * configure: Regenerate.
1952
1953 2012-03-21  Cary Coutant  <ccoutant@google.com>
1954
1955         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1956         * Makefile.in: Regenerate.
1957         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1958         (Sized_elf_reloc_mapper::symbol_section): New function.
1959         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1960         (make_elf_reloc_mapper): New function.
1961         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1962         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1963         (Dwarf_abbrev_table::do_get_abbrev): New function.
1964         (Dwarf_ranges_table::read_ranges_table): New function.
1965         (Dwarf_ranges_table::read_range_list): New function.
1966         (Dwarf_pubnames_table::read_section): New function.
1967         (Dwarf_pubnames_table::read_header): New function.
1968         (Dwarf_pubnames_table::next_name): New function.
1969         (Dwarf_die::Dwarf_die): New function.
1970         (Dwarf_die::read_attributes): New function.
1971         (Dwarf_die::skip_attributes): New function.
1972         (Dwarf_die::set_name): New function.
1973         (Dwarf_die::set_linkage_name): New function.
1974         (Dwarf_die::attribute): New function.
1975         (Dwarf_die::string_attribute): New function.
1976         (Dwarf_die::int_attribute): New function.
1977         (Dwarf_die::uint_attribute): New function.
1978         (Dwarf_die::ref_attribute): New function.
1979         (Dwarf_die::child_offset): New function.
1980         (Dwarf_die::sibling_offset): New function.
1981         (Dwarf_info_reader::check_buffer): New function.
1982         (Dwarf_info_reader::parse): New function.
1983         (Dwarf_info_reader::do_parse): New function.
1984         (Dwarf_info_reader::do_read_string_table): New function.
1985         (Dwarf_info_reader::lookup_reloc): New function.
1986         (Dwarf_info_reader::get_string): New function.
1987         (Dwarf_info_reader::visit_compilation_unit): New function.
1988         (Dwarf_info_reader::visit_type_unit): New function.
1989         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1990         Sized_elf_reloc_mapper.
1991         (Sized_dwarf_line_info::symbol_section): Remove function.
1992         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1993         (Sized_dwarf_line_info::read_line_mappings): Remove object
1994         parameter, adjust callers.
1995         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1996         * dwarf_reader.h: Include <sys/types.h>.
1997         (class Track_relocs): Remove forward declaration.
1998         (class Elf_reloc_mapper): New class.
1999         (class Sized_elf_reloc_mapper): New class.
2000         (class Dwarf_abbrev_table): New class.
2001         (class Dwarf_range_list): New class.
2002         (class Dwarf_ranges_table): New class.
2003         (class Dwarf_pubnames_table): New class.
2004         (class Dwarf_die): New class.
2005         (class Dwarf_info_reader): New class.
2006         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2007         (Sized_dwarf_line_info::symbol_section): Remove member function.
2008         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2009         base class.
2010         * gdb-index.cc: New source file.
2011         * gdb-index.h: New source file.
2012         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2013         and .debug_types sections, call Layout::add_to_gdb_index.
2014         (Sized_relobj_incr::do_section_name): Implement.
2015         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2016         return type; Implement.
2017         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2018         return type.
2019         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2020         parameter list and return type.
2021         (Sized_incr_dynobj::do_section_contents): Likewise.
2022         * layout.cc: Include gdb-index.h.
2023         (Layout::Layout): Initialize gdb_index_data_.
2024         (Layout::init_fixed_output_section): Check for .gdb_index section.
2025         (Layout::add_to_gdb_index): New function. Instantiate.
2026         * layout.h: Add forward declaration for class Gdb_index.
2027         (Layout::add_to_gdb_index): New member function.
2028         (Layout::gdb_index_data_): New data member.
2029         * main.cc: Include gdb-index.h.
2030         (main): Print statistics for gdb index.
2031         * object.cc (Object::section_contents): Move code into
2032         do_section_contents.
2033         (need_decompressed_section): Check for sections needed when building
2034         gdb index.
2035         (build_compressed_section_map): Likewise.
2036         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2037         gdb index.
2038         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2039         sections; call Layout::add_to_gdb_index.
2040         (Sized_relobj_file::do_decompressed_section_contents): Call
2041         do_section_contents directly.
2042         * object.h (Object::do_section_contents): Adjust parameter list and
2043         return type.
2044         (Object::do_decompressed_section_contents): Call do_section_contents
2045         directly.
2046         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2047         return type.
2048         * options.h (class General_options): Add --gdb-index option.
2049         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2050         list and return type.
2051         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2052         * reloc.h (Track_relocs::checkpoint): New function.
2053         (Track_relocs::reset): New function.
2054
2055         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2056         New test cases.
2057         * testsuite/Makefile.in: Regenerate.
2058         * testsuite/gdb_index_test.cc: New test source file.
2059         * testsuite/gdb_index_test_1.sh: New test source file.
2060         * testsuite/gdb_index_test_2.sh: New test source file.
2061
2062 2012-03-19  Doug Kwan  <dougkwan@google.com>
2063
2064         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2065         (Target_arm::do_finalize_sections): Remove code which defines
2066         __exidx_start and __exidx_end.  Make symbol table parameter
2067         anonymous as it is not used.
2068         * gold.cc (queue_middle_tasks): Call target hook to define any
2069         target-specific symbols.
2070         * target.h (Target::define_standard_symbols): New method.
2071         (Target::do_define_standard_symbols): Same.
2072         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2073         * testsuite/Makefile.in: Regenerate.
2074         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2075         and __exidx_end.
2076         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2077         relocations are generated for __exidx_start and __exidx_end.
2078
2079 2012-03-16  Doug Kwan  <dougkwan@google.com>
2080
2081         * testsuite/Makefile.am: Disable test initpri3b.
2082         * testsuite/Makefile.in: Regenerate.
2083
2084 2012-03-15  Doug Kwan  <dougkwan@google.com>
2085
2086         * arm.cc (Target_arm::got_section): Make .got section read-only
2087         if -z now is given.
2088
2089 2012-03-15  Ian Lance Taylor  <iant@google.com>
2090
2091         PR gold/13850
2092         * layout.cc (Layout::make_output_section): Correctly mark
2093         SHT_INIT_ARRAY, et. al., as relro.
2094
2095 2012-03-14  Doug Kwan  <dougkwan@google.com>
2096
2097         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2098         dynamic relocations for protected symbols in shared objects.
2099
2100 2012-03-13  Ian Lance Taylor  <iant@google.com>
2101
2102         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2103         keep the larger alignment.
2104
2105 2012-03-12  Cary Coutant  <ccoutant@google.com>
2106
2107         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2108         handling of DW_LNE_define_file.
2109
2110 2012-03-12  Cary Coutant  <ccoutant@google.com>
2111
2112         * reduced_debug_output.cc
2113         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2114         codes to switch.
2115
2116 2012-02-29  Cary Coutant  <ccoutant@google.com>
2117
2118         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2119
2120 2012-02-29  Cary Coutant  <ccoutant@google.com>
2121
2122         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2123         Call Object::decompressed_section_contents.
2124         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2125         New dtor.
2126         (Sized_dwarf_line_info::buffer_start_): New data member.
2127         * merge.cc (Output_merge_data::do_add_input_section): Call
2128         Object::decompressed_section_contents.
2129         (Output_merge_string::do_add_input_section): Likewise.
2130         * object.cc (need_decompressed_section): New function.
2131         (build_compressed_section_map): Decompress sections needed later.
2132         (Sized_relobj_file::do_decompressed_section_contents): New function.
2133         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2134         * object.h (Object::decompressed_section_contents): New function.
2135         (Object::discard_decompressed_sections): New function.
2136         (Object::do_decompressed_section_contents): New function.
2137         (Object::do_discard_decompressed_sections): New function.
2138         (Compressed_section_info): New type.
2139         (Compressed_section_map): Include decompressed section contents.
2140         (Sized_relobj_file::do_decompressed_section_contents): New function.
2141         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2142
2143 2012-02-16  Cary Coutant  <ccoutant@google.com>
2144
2145         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2146         * testsuite/Makefile.in: Regenerate.
2147
2148 2012-02-14  Cary Coutant  <ccoutant@google.com>
2149
2150         * options.cc (General_options::finalize): Disallow -pie and -static.
2151
2152 2012-02-03  Doug Kwan  <dougkwan@google.com>
2153
2154         * arm.cc (Arm_relocate_functions::abs8,
2155         Arm_relocate_functions::abs16): Use
2156         Bits::has_signed_unsigned_overflow32.
2157         (Arm_relocate_functions::thm_abs8): Correct range of
2158         overflow check.
2159         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2160         in assertions.
2161
2162 2012-02-02  Doug Kwan  <dougkwan@google.com>
2163
2164         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2165         position independent outputs, not just shared objects.
2166
2167 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2168
2169         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2170         * configure: Regenerated.
2171
2172 2012-01-27  Ian Lance Taylor  <iant@google.com>
2173
2174         * reloc.h (Bits): New class with static functions, copied from
2175         namespace utils in arm.cc.
2176         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2177         instead.
2178
2179 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2180
2181         * incremental.cc (write_info_blocks): Correct relocation offset.
2182
2183 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2184
2185         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2186         (Relocate::tls_gd_to_le): Likewise.
2187
2188 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2189
2190         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2191
2192 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2193
2194         * configure.ac: Check if -mcmodel=medium works.
2195         * configure: Regenerated.
2196
2197 2012-01-24  Cary Coutant  <ccoutant@google.com>
2198
2199         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2200         definition and ...
2201         (read_unsigned_LEB_128_x): ... this new function.
2202         (read_signed_LEB_128): Replaced with inline definition and ...
2203         (read_signed_LEB_128_x): ... this new function.
2204         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2205         (read_unsigned_LEB_128): Add inline definition.
2206         (read_signed_LEB_128_x): New function.
2207         (read_signed_LEB_128): Add inline definition.
2208         * testsuite/Makefile.am (leb128_unittest): New unit test.
2209         * testsuite/Makefile.in: Regenerate.
2210         * testsuite/leb128_unittest.cc: New unit test.
2211
2212 2012-01-23  Ian Lance Taylor  <iant@google.com>
2213
2214         PR gold/13617
2215         * i386.cc (Target_i386::do_code_fill): When using a jmp
2216         instruction, pad with nop instructions.
2217         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2218
2219 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2220
2221         * x86_64.cc (gc_process_relocs): Add typename on types used in
2222         template.
2223         (scan_relocs): Likewise.
2224         (relocate_section): Likewise.
2225         (apply_relocation): Likewise.
2226
2227 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2228
2229         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2230         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2231         under x32.
2232
2233 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2234
2235         * x86_64.cc: Initial support for x32.
2236
2237 2012-01-03  Cary Coutant  <ccoutant@google.com>
2238
2239         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2240         Use abstract base class for GOT.
2241         * gold/output.h (class Output_data_got_base): New abstract base class.
2242         (class Output_data_got): Derive from new base class, adjust ctors.
2243         (Output_data_got::reserve_slot): Make virtual; rename to
2244         do_reserve_slot; Adjust callers.
2245         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2246         pointer to abstract base class.
2247         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2248
2249 2011-12-18  Ian Lance Taylor  <iant@google.com>
2250
2251         * object.h (Relobj::local_symbol_value): New function.
2252         (Relobj::local_plt_offset): New function.
2253         (Relobj::local_has_got_offset): New function.
2254         (Relobj::local_got_offset): New function.
2255         (Relobj::set_local_got_offset): New function.
2256         (Relobj::do_local_symbol_value): New pure virtual function.
2257         (Relobj::do_local_plt_offset): Likewise.
2258         (Relobj::do_local_has_got_offset): Likewise.
2259         (Relobj::do_local_got_offset): Likewise.
2260         (Relobj::do_set_local_got_offset): Likewise.
2261         (Sized_relobj::do_local_has_got_offset): Rename from
2262         local_has_got_offset.
2263         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2264         (Sized_relobj::do_set_local_got_offset): Rename from
2265         set_local_got_offset.
2266         (Sized_relobj_file::do_local_plt_offset): Rename from
2267         local_plt_offset.
2268         (Sized_relobj_file::do_local_symbol_value): New function.
2269         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2270         local_plt_offset.
2271         * output.cc (Output_data_got::Got_entry::write): Change object to
2272         Relobj.  Use local_symbol_value.
2273         (Output_data_got::add_global_with_rel): Change rel_dyn to
2274         Output_data_reloc_generic*.  Use add_global_generic.
2275         (Output_data_got::add_global_with_rela): Remove.  Change all
2276         callers to use add_global_with_rel.
2277         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2278         Output_data_reloc_generic*.  Use add_global_generic.
2279         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2280         callers to use add_global_pair_with_rel.
2281         (Output_data_got::add_local): Change object to Relobj*.
2282         (Output_data_got::add_local_plt): Likewise.
2283         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2284         change rel_dyn to Output_data_reloc_generic*.  Use
2285         add_local_generic.
2286         (Output_data_got::add_local_with_rela): Remove.  Change all
2287         callers to use all_local_with_rel.
2288         (Output_data_got::add_local_pair_with_rel): Change object to
2289         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2290         add_output_section_generic.
2291         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2292         callers to use add_local_pair_with_rel.
2293         (Output_data_got::reserve_local): Change object to Relobj*.
2294         * output.h: (class Output_data_reloc_generic): Add pure virtual
2295         declarations for add_global_generic, add_local_generic,
2296         add_output_section_generic.
2297         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2298         functions for Output_data_reloc_generic.  Update declarations for
2299         changes listed in output.cc.
2300         (class Output_data_got): Change template parameter to got_size.
2301         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2302         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2303         function.
2304         (Sized_relobj_incr::do_local_plt_offset): New function.
2305         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2306         add_global_generic.
2307
2308 2011-12-17  Cary Coutant  <ccoutant@google.com>
2309
2310         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2311         * resolve.cc (Symbol_table::resolve): Likewise.
2312         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2313         arrays.
2314         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2315
2316 2011-12-16  Ian Lance Taylor  <iant@google.com>
2317
2318         * output.h (Output_data_reloc_generic::add): Only call
2319         add_dynamic_reloc if this is a dynamic reloc section.
2320
2321 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2322
2323         PR gold/13505
2324         * target-reloc.h (apply_relocation): Replace <64, false> with
2325         <size, big_endian>.
2326
2327 2011-11-25  Nick Clifton  <nickc@redhat.com>
2328
2329         * po/it.po: New Italian translation.
2330
2331 2011-11-17  Sterling Augustine  <saugustine@google.com>
2332
2333         * script.cc (script_include_directive): Implement.
2334         (read_script_file): New local variables name and search_path. Update
2335         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2336         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2337         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2338
2339 2011-11-11  Sterling Augustine  <saugustine@google.com>
2340
2341         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2342         (file_or_sections_cmd): Likewise.
2343
2344 2011-11-11  Doug Kwan  <dougkwan@google.com>
2345
2346         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2347         if --just-symbols is given.
2348
2349 2011-11-10  Doug Kwan  <dougkwan@google.com>
2350
2351         PR gold/13362
2352         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2353         when processing data relocs.
2354         * reloc.h (Relocate_functions::rel_unaligned): New method.
2355         (Relocate_functions::pcrel_unaligned): Ditto.
2356         (Relocate_functions::rel32_unaligned): Ditto.
2357         (Relocate_functions::pcrel32_unaligned): Ditto.
2358
2359 2011-11-09  Doug Kwan  <dougkwan@google.com>
2360
2361         PR gold/13362
2362         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2363         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2364         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2365         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2366         (Relocate_functions::rel_unaligned): New.
2367         (Relocate_functions::rel32_unaligned): New.
2368         * target-reloc.h (relocate_for_relocatable): Add code to handle
2369         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2370         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2371         arm_unaligned_reloc_r): New targets.
2372         * testsuite/Makefile.in: Regenerate.
2373         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2374         linking.
2375
2376 2011-11-02  Ian Lance Taylor  <iant@google.com>
2377
2378         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2379         NATIVE_LINKER.
2380         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2381         * options.cc (General_options::finalize): Use library search path
2382         from configure script if specified.  If not native and no sysroot,
2383         only search TOOLLIBDIR.
2384         * options.h (Search_directory::Search_directory): Change name to
2385         const std::string&.
2386         (General_options::add_to_library_path_with_sysroot): Change arg to
2387         const std::string&.
2388         * configure, Makefile.in, config.in: Rebuild.
2389
2390 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2391
2392         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2393         we are working around the ARM1176 Erratum.
2394         * options.h (General_options::fix_arm1176): Add option.
2395         * testsuite/Makefile.am: Add testcases, and keep current ones
2396         working.
2397         * testsuite/Makefile.in: Regenerate.
2398         * testsuite/arm_fix_1176.s: New file.
2399         * testsuite/arm_fix_1176.sh: Likewise.
2400
2401 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2402
2403         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2404         may_use_blx_.
2405         (Target_arm::may_use_blx): Remove method.
2406         (Target_arm::set_may_use_blx): Likewise.
2407         (Target_arm::may_use_v4t_interworking): New method.
2408         (Target_arm::may_use_v5t_interworking): Likewise.
2409         (Target_arm::may_use_blx_): Remove member variable.
2410         (Arm_relocate_functions::arm_branch_common): Check for v5T
2411         interworking.
2412         (Arm_relocate_functions::thumb_branch_common): Likewise.
2413         (Reloc_stub::stub_type_for_reloc): Likewise.
2414         (Target_arm::do_finalize_sections): Correct interworking checks.
2415         * testsuite/Makefile.am: Add new tests.
2416         * testsuite/Makefile.in: Regenerate.
2417         * testsuite/arm_farcall_arm_arm.s: New test.
2418         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2419         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2420         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2421         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2422         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2423         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2424         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2425
2426 2011-10-31  Cary Coutant  <ccoutant@google.com>
2427
2428         PR gold/13023
2429         * expression.cc (Expression::eval_with_dot): Add
2430         is_section_dot_assignment parameter.
2431         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2432         absolute and assigning to dot within a section.
2433         * script-sections.cc
2434         (Output_section_element_assignment::set_section_addresses): Pass
2435         dot_section to set_if_absolute.
2436         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2437         as is_section_dot_assignment flag to eval_with_dot.
2438         (Output_section_element_dot_assignment::set_section_addresses):
2439         Likewise.
2440         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2441         parameter.  Also set value if relative to dot_section; set the
2442         symbol's output_section.
2443         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2444         parameter.  Adjust all callers.
2445         (Expression::eval_maybe_dot): Likewise.
2446         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2447         Adjust all callers.
2448         * testsuite/script_test_2.t: Test assignment of an absolute value
2449         to dot within an output section element.
2450
2451 2011-10-31  Cary Coutant  <ccoutant@google.com>
2452
2453         * options.h (class General_options): Add --[no-]gnu-unique options.
2454         * symtab.cc (Symbol_table::sized_write_globals): Convert
2455         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2456
2457 2011-10-31  Cary Coutant  <ccoutant@google.com>
2458
2459         PR gold/13359
2460         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2461         unnecessary assertion.
2462         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2463
2464 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2465
2466         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2467         gc_mark_symbol.
2468         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2469         gc_mark_symbol.
2470         Change to just keep the section associated with symbol.
2471         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2472         they are externally visible and --export-dynamic is turned on.
2473         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2474
2475 2011-10-19  Ian Lance Taylor  <iant@google.com>
2476
2477         PR gold/13163
2478         * script-sections.cc
2479         (Output_section_element_dot_assignment::needs_output_section): New
2480         function.
2481
2482 2011-10-19  Ian Lance Taylor  <iant@google.com>
2483
2484         PR gold/13204
2485         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2486         --section-start option was seen.
2487         * options.h (General_options::any_section_start): New function.
2488
2489 2011-10-18  David S. Miller  <davem@davemloft.net>
2490
2491         PR binutils/13301
2492         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2493         member to track relocation locations that have moved during TLS
2494         reloc optimizations.
2495         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2496         (Target_sparc::Relocate::relocate): Adjust view down by 4
2497         bytes if it matches reloc_adjust_addr_.
2498         (Target_sparc::Relocate::relocate_tls): Always move the
2499         __tls_get_addr call delay slot instruction forward 4 bytes when
2500         performing relaxation.
2501
2502 2011-10-18  Cary Coutant  <ccoutant@google.com>
2503
2504         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2505         (Output_file::map_no_anonymous): Check for non-zero
2506         return code from posix_fallocate.
2507
2508 2011-10-17  Cary Coutant  <ccoutant@google.com>
2509
2510         PR gold/13245
2511         * plugin.cc (is_visible_from_outside): Check for symbols
2512         referenced from dynamic objects.
2513         * resolve.cc (Symbol_table::resolve): Don't count references
2514         from dynamic objects as references from real ELF files.
2515         * testsuite/plugin_test_2.sh: Adjust expected result.
2516
2517 2011-10-17  Cary Coutant  <ccoutant@google.com>
2518
2519         * gold.cc: Include timer.h.
2520         (queue_middle_tasks): Stamp time.
2521         (queue_final_tasks): Likewise.
2522         * main.cc (main): Store timer in parameters.  Print timers
2523         for each pass.
2524         * parameters.cc (Parameters::Parameters): Initialize timer_.
2525         (Parameters::set_timer): New function.
2526         (set_parameters_timer): New function.
2527         * parameters.h (Parameters::set_timer): New function.
2528         (Parameters::timer): New function.
2529         (Parameters::timer_): New data member.
2530         (set_parameters_timer): New function.
2531         * timer.cc (Timer::stamp): New function.
2532         (Timer::get_pass_time): New function.
2533         * timer.h (Timer::stamp): New function.
2534         (Timer::get_pass_time): New function.
2535         (Timer::pass_times_): New data member.
2536
2537 2011-10-17  Cary Coutant  <ccoutant@google.com>
2538
2539         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2540         task for members of lib groups.
2541
2542 2011-10-17  Cary Coutant  <ccoutant@google.com>
2543
2544         PR gold/13288
2545         * fileread.cc (File_read::find_view): Add assert.
2546         (File_read::make_view): Move bounds check (replace with assert)...
2547         (File_read::find_or_make_view): ... to here.
2548
2549 2011-10-12  Cary Coutant  <ccoutant@google.com>
2550
2551         * output.cc (Output_file::open_base_file): Handle case where
2552         ::read returns less than requested size.
2553
2554 2011-10-10  Cary Coutant  <ccoutant@google.com>
2555
2556         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2557         Initialize defined_count_.
2558         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2559         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2560         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2561         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2562         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2563         * incremental.h (Sized_relobj_incr::defined_count_): New data
2564         member.
2565         (Sized_incr_dynobj::defined_count_): New data member.
2566         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2567         Return zeroes instead of internal error.
2568
2569 2011-10-10  Cary Coutant  <ccoutant@google.com>
2570
2571         PR gold/13249
2572         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2573         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2574         * output.h (class Output_reloc): Add use_plt_offset flag.
2575         (Output_reloc::type_): Adjust size of bit field.
2576         (Output_reloc::use_plt_offset_): New bit field.
2577         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2578         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2579         flag.  Adjust all callers.
2580         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2581         creating RELATIVE relocations.
2582
2583 2011-10-10  Nick Clifton  <nickc@redhat.com>
2584
2585         * po/es.po: Updated Spanish translation.
2586         * po/fi.po: Updated Finnish translation.
2587
2588 2011-10-03   Diego Novillo  <dnovillo@google.com>
2589
2590         * options.cc (parse_uint): Fix dereference of RETVAL.
2591
2592 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2593
2594         * layout.h (section_order_map_): New member.
2595         (get_section_order_map): New member function.
2596         * output.cc (Output_section::add_input_section): Check for patterns
2597         only when --section-ordering-file is specified.
2598         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2599         output_sections have been formed.
2600         * layout.cc (Layout_Layout): Initialize section_order_map_.
2601         * plugin.cc (update_section_order): Store order in order_map. Do not
2602         update the order.
2603         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2604         * testsuite/Makefile.in: Regenerate.
2605         * testsuite/plugin_section_order.c: New file.
2606         * testsuite/plugin_final_layout.cc: New file.
2607         * testsuite/plugin_final_layout.sh: New file.
2608
2609 2011-09-29  Cary Coutant  <ccoutant@google.com>
2610
2611         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2612         Check for NULL.
2613         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2614         symbols during incremental update.
2615         (Symbol_table::add_from_dynobj): Likewise.
2616
2617 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2618             Ian Lance Taylor  <iant@google.com>
2619
2620         * symtab.cc (Symbol_table::define_special_symbol): Always
2621         canonicalize version string.
2622
2623 2011-09-26  Cary Coutant  <ccoutant@google.com>
2624
2625         * gold.cc (queue_initial_tasks): Move option checks ...
2626         * options.cc (General_options::finalize): ... to here. Disable
2627         some options; make others fatal.
2628
2629 2011-09-26  Cary Coutant  <ccoutant@google.com>
2630
2631         gcc PR lto/47247
2632         * plugin.cc (get_symbols_v2): New function.
2633         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2634         (is_referenced_from_outside): New function.
2635         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2636         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2637         (get_symbols): Pass version parameter.
2638         (get_symbols_v2): New function.
2639         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2640         parameter.
2641         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2642         (onload): Add LDPT_GET_SYMBOLS_V2.
2643         (all_symbols_read_hook): Use get_symbols_v2; check for
2644         LDPR_PREVAILING_DEF_IRONLY_EXP.
2645         * testsuite/plugin_test_3.sh: Update expected results.
2646
2647 2011-09-23  Simon Baldwin  <simonb@google.com>
2648
2649         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2650         configuration options.
2651         * configure: Regenerate.
2652         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2653         * Makefile.in: Regenerate.
2654         * testsuite/Makefile.in: Regenerate.
2655
2656 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2657
2658         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2659
2660 2011-09-19  Cary Coutant  <ccoutant@google.com>
2661
2662         * incremental.cc (can_incremental_update): Fix typo in comment.
2663         * incremental.h (can_incremental_update): Likewise.
2664
2665 2011-09-18  Cary Coutant  <ccoutant@google.com>
2666
2667         * incremental.cc (can_incremental_update): New function.
2668         * incremental.h (can_incremental_update): New function.
2669         * layout.cc (Layout::init_fixed_output_section): Call it.
2670         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2671         * object.cc (Sized_relobj_file::do_layout): Call
2672         can_incremental_update.
2673
2674 2011-09-13  Cary Coutant  <ccoutant@google.com>
2675
2676         * configure.ac: Check for glibc support for gnu_indirect_function
2677         support with static linking, setting automake conditional
2678         IFUNC_STATIC.
2679         * Makefile.in: Regenerate.
2680         * configure: Regenerate.
2681
2682         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2683         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2684         for IFUNC_STATIC.
2685         * testsuite/Makefile.in: Regenerate.
2686
2687 2011-09-13  Cary Coutant  <ccoutant@google.com>
2688
2689         * incremental.cc (Sized_relobj_incr::do_layout): Call
2690         report_comdat_group for kept comdat sections.
2691         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2692         * testsuite/Makefile.in: Regenerate.
2693         * testsuite/incr_comdat_test_1.cc: New source file.
2694         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2695         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2696         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2697
2698 2011-09-13  Ian Lance Taylor  <iant@google.com>
2699
2700         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2701         variable external_symbols_offset.
2702
2703 2011-09-12  Ian Lance Taylor  <iant@google.com>
2704
2705         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2706         triggered if object has no symbols.
2707
2708 2011-09-09  David S. Miller  <davem@davemloft.net>
2709
2710         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2711         (Output_fill_debug_line::do_write): Likewise.
2712
2713 2011-08-29  Cary Coutant  <ccoutant@google.com>
2714
2715         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2716         casts to match formatting specs.
2717         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2718
2719 2011-08-26  Cary Coutant  <ccoutant@google.com>
2720
2721         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2722         remaining hole size when allocating.
2723         (Layout::make_output_section): Set fill methods for debug sections.
2724         * layout.h (Free_list::Free_list_node): Move from private to
2725         public.
2726         (Free_list::set_min_hole_size): New function.
2727         (Free_list::begin, Free_list::end): New functions.
2728         (Free_list::min_hole_): New data member.
2729         * output.cc: Include dwarf.h.
2730         (Output_fill_debug_info::do_minimum_hole_size): New function.
2731         (Output_fill_debug_info::do_write): New function.
2732         (Output_fill_debug_line::do_minimum_hole_size): New function.
2733         (Output_fill_debug_line::do_write): New function.
2734         (Output_section::Output_section): Initialize new data member.
2735         (Output_section::set_final_data_size): Ensure patch space is larger
2736         than minimum hole size.
2737         (Output_section::do_write): Fill holes in debug sections.
2738         * output.h (Output_fill): New class.
2739         (Output_fill_debug_info): New class.
2740         (Output_fill_debug_line): New class.
2741         (Output_section::set_free_space_fill): New function.
2742         (Output_section::free_space_fill_): New data member.
2743         * testsuite/Makefile.am (incremental_test_3): Add
2744         --incremental-patch option.
2745         (incremental_test_4): Likewise.
2746         (incremental_test_5): Likewise.
2747         (incremental_test_6): Likewise.
2748         (incremental_copy_test): Likewise.
2749         (incremental_common_test_1): Likewise.
2750         * testsuite/Makefile.in: Regenerate.
2751
2752 2011-08-26  Nick Clifton  <nickc@redhat.com>
2753
2754         * po/es.po: Updated Spanish translation.
2755
2756 2011-08-01  Cary Coutant  <ccoutant@google.com>
2757
2758         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2759         * gold/testsuite/Makefile.in: Regenerate.
2760         * gold/testsuite/justsyms_exec.c: New source file.
2761         * gold/testsuite/justsyms_lib.c: New source file.
2762
2763 2011-08-01  Cary Coutant  <ccoutant@google.com>
2764
2765         * layout.cc (Layout::set_segment_offsets): Don't realign text
2766         segment if -Ttext was specified.
2767         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2768         file type.
2769         * object.h (Sized_relobj_file::e_type): New function.
2770         (Sized_relobj_file::e_type_): New data member.
2771         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2772         base address for ET_EXEC files.
2773         * target.cc (Target::do_make_elf_object_implementation): Allow
2774         ET_EXEC files with --just-symbols option.
2775
2776 2011-07-28  Cary Coutant  <ccoutant@google.com>
2777
2778         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2779         Add thread_number parameter.
2780         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2781         * workqueue-threads.cc
2782         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2783         current thread if its thread number is greater than desired thread
2784         count.
2785         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2786         Add thread_number parameter.
2787         (Workqueue::should_cancel_thread): Likewise.
2788         (Workqueue::find_runnable_or_wait): Pass thread_number to
2789         should_cancel_thread.
2790         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2791         parameter.
2792
2793 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2794
2795         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2796         only after checking if it cannot be forced local.
2797         * symtab.h (is_externally_visible): Check if the symbol is not forced
2798         local.
2799
2800 2011-07-15  Ian Lance Taylor  <iant@google.com>
2801
2802         * options.h (class General_options): Add --print-output-format.
2803         Move -EL next to -EB, for  better --help output.
2804         * target-select.cc: Include <cstdio>, "options.h", and
2805         "parameters.h".
2806         (Target_selector::do_target_bfd_name): New function.
2807         (print_output_format): New function.
2808         * target-select.h (class Target_selector): Update declarations.
2809         (Target_selector::target_bfd_name): New function.
2810         (print_output_format): Declare.
2811         * main.cc: Include "target-select.h".
2812         (main): Handle --print-output-format.
2813         * gold.cc: Include "target-select.h".
2814         (queue_initial_tasks): Handle --print-output-format when there are
2815         no input files.
2816         * parameters.cc (parameters_force_valid_target): Give a better
2817         error message if -EB/-EL does not match target.
2818         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2819         function.
2820
2821 2011-07-15  Ian Lance Taylor  <iant@google.com>
2822
2823         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2824         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2825         (Output_data_plt_i386::do_write): Write address of .dynamic
2826         section to first entry in .got.plt section.
2827         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2828         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2829         Initialize layout_.
2830         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2831         section to first entry in .got.plt section.
2832         * layout.h (Layout::dynamic_section): New function.
2833
2834 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2835
2836         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2837         to claim_file call.
2838         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2839         input_section_position_, and input_section_glob_.
2840         (read_layout_from_file): Call function section_ordering_specified.
2841         * layout.h (is_section_ordering_specified): New function.
2842         (section_ordering_specified): New function.
2843         (section_ordering_specified_): New boolean member.
2844         * main.cc(main): Call load_plugins after layout object is defined.
2845         * output.cc (Output_section::add_input_section): Use
2846         function section_ordering_specified to check if section ordering is
2847         needed.
2848         * output.cc (Output_section::add_relaxed_input_section): Use
2849         function section_ordering_specified to check if section ordering is
2850         needed.
2851         (Output_section::update_section_layout): New function.
2852         (Output_section::sort_attached_input_sections): Check if input section
2853         must be reordered.
2854         * output.h (Output_section::update_section_layout): New function.
2855         * plugin.cc (get_section_count): New function.
2856         (get_section_type): New function.
2857         (get_section_name): New function.
2858         (get_section_contents): New function.
2859         (update_section_order): New function.
2860         (allow_section_ordering): New function.
2861         (Plugin::load): Add the new interfaces to the transfer vector.
2862         (Plugin_manager::load_plugins): New parameter.
2863         (Plugin_manager::all_symbols_read): New parameter.
2864         (Plugin_manager::claim_file): New parameter. Save the elf object for
2865         unclaimed objects.
2866         (Plugin_manager::get_elf_object): New function.
2867         (Plugin_manager::get_view): Change to directly use the bool to check
2868         if get_view is called from claim_file_hook.
2869         * plugin.h (input_objects): New function
2870         (Plugin__manager::load_plugins): New parameter.
2871         (Plugin_manager::claim_file): New parameter.
2872         (Plugin_manager::get_elf_object): New function.
2873         (Plugin_manager::in_claim_file_handler): New function.
2874         (Plugin_manager::in_claim_file_handler_): New member.
2875         (layout): New function.
2876         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2877         handler with an extra parameter. Make the elf object before calling
2878         claim_file handler.
2879         * testsuite/plugin_test.c (get_section_count): New function pointer.
2880         (get_section_type): New function pointer.
2881         (get_section_name): New function pointer.
2882         (get_section_contents): New function pointer.
2883         (update_section_order): New function pointer.
2884         (allow_section_ordering): New function pointer.
2885         (onload): Check if the new interfaces exist.
2886
2887 2011-07-13  Ian Lance Taylor  <iant@google.com>
2888
2889         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2890         relro section.
2891         * x86_64.cc (Target_x86_64::got_section): Likewise.
2892         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2893         (relro_now_test_SOURCES): New variable.
2894         (relro_now_test_DEPENDENCIES): New variable.
2895         (relro_now_test_LDFLAGS): New variable.
2896         (relro_now_test_LDADD): New variable.
2897         (relro_now_test.so): New target.
2898         * testsuite/Makefile.in: Rebuild.
2899
2900 2011-07-12  Ian Lance Taylor  <iant@google.com>
2901
2902         PR gold/12980
2903         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2904         GLOB_DAT relocation rather than a RELATIVE relocation for a
2905         protected symbol when creating a shared library.
2906         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2907         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2908         * testsuite/protected_main_1.cc (main): Test that protected
2909         function has same address.
2910
2911 2011-07-11  Ian Lance Taylor  <iant@google.com>
2912
2913         PR gold/12979
2914         * options.h (class General_options): Add -Bgroup.
2915         * options.cc (General_options::finalize): If -Bgroup is set,
2916         default to --unresolved-symbols=report-all.
2917         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2918         * target-reloc.h (issue_undefined_symbol_error): Handle
2919         --unresolved-symbols=report-all.
2920
2921 2011-07-08  Ian Lance Taylor  <iant@google.com>
2922
2923         PR gold/11985
2924         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2925         if linker script discards key sections.
2926         (Layout::create_dynamic_symtab): Likewise.
2927         (Layout::assign_local_dynsym_offsets): Likewise.
2928         (Layout::sized_create_version_sections): Likewise.
2929         (Layout::create_interp): Likewise.
2930         (Layout::finish_dynamic_section): Likewise.
2931         (Layout::set_dynamic_symbol_size): Likewise.
2932
2933 2011-07-08  Ian Lance Taylor  <iant@google.com>
2934
2935         PR gold/12386
2936         * options.h (class General_options): Add --unresolved-symbols.
2937         * target-reloc.h (issue_undefined_symbol_error): Check
2938         --unresolved-symbols.  Add comments.
2939
2940 2011-07-08  Ian Lance Taylor  <iant@google.com>
2941
2942         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2943         expression more complex.
2944
2945 2011-07-08  Ian Lance Taylor  <iant@google.com>
2946
2947         PR gold/11317
2948         * target-reloc.h (issue_undefined_symbol_error): New inline
2949         function, broken out of relocate_section.
2950         (relocate_section): Call issue_undefined_symbol_error.
2951         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2952         there is no TLS segment if we are about to issue an undefined
2953         symbol error.
2954         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2955
2956 2011-07-08  Ian Lance Taylor  <iant@google.com>
2957
2958         PR gold/12279
2959         * resolve.cc (Symbol_table::should_override): Add fromtype
2960         parameter.  Change all callers.  Give error when linking together
2961         TLS and non-TLS symbol.
2962         (Symbol_table::should_override_with_special): Add fromtype
2963         parameter.  Change all callers.
2964         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2965         there is no TLS segment if we have reported some errors.
2966         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2967
2968 2011-07-08  Ian Lance Taylor  <iant@google.com>
2969
2970         PR gold/12372
2971         * target.h (Target::plt_address_for_global): New function.
2972         (Target::plt_address_for_local): New function.
2973         (Target::plt_section_for_global): Remove.
2974         (Target::plt_section_for_local): Remove.
2975         (Target::do_plt_address_for_global): New virtual function.
2976         (Target::do_plt_address_for_local): New virtual function.
2977         (Target::do_plt_section_for_global): Remove.
2978         (Target::do_plt_section_for_local): Remove.
2979         (Target::register_global_plt_entry): Add Symbol_table and Layout
2980         parameters.
2981         * output.cc (Output_data_got::Got_entry::write): Use
2982         plt_address_for_global and plt_address_for_local.
2983         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2984         address of output section.
2985         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2986         got_irelative_, and irelative_count_ fields.  Update
2987         declarations.
2988         (Output_data_plt_i386::has_irelative_section): New function.
2989         (Output_data_plt_i386::entry_count): Add irelative_count_.
2990         (Output_data_plt_i386::set_final_data_size): Likewise.
2991         (class Target_i386): Add got_irelative_ and rel_irelative_
2992         fields.  Update declarations.
2993         (Target_i386::Target_i386): Initialize new fields.
2994         (Target_i386::do_plt_address_for_global): New function replacing
2995         do_plt_section_for_global.
2996         (Target_i386::do_plt_address_for_local): New function replacing
2997         do_plt_section_for_local.
2998         (Target_i386::got_section): Create got_irelative_.
2999         (Target_i386::rel_irelative_section): New function.
3000         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3001         fields.  Don't define __rel_iplt_{start,end}.
3002         (Output_data_plt_i386::add_entry): Add symtab and layout
3003         parameters.  Change all callers.  Use different PLT and GOT for
3004         IFUNC symbols.
3005         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3006         layout parameters.  Change all callers.  Use different PLT and
3007         GOT.
3008         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3009         (Output_data_plt_i386::rel_irelative): New function.
3010         (Output_data_plt_i386::address_for_global): New function.
3011         (Output_data_plt_i386::address_for_local): New function.
3012         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3013         IRELATIVE GOT when changing IFUNC GOT entries.
3014         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3015         reloc.
3016         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3017         if we didn't create an IRELATIVE GOT.
3018         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3019         plt_address_for_local.
3020         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3021         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3022         got_irelative_, and irelative_count_ fields.  Update
3023         declarations.
3024         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3025         Initialize new fields.  Remove symtab parameter.  Change all
3026         callers.
3027         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3028         irelative_count_.
3029         (Output_data_plt_x86_64::has_irelative_section): New function.
3030         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3031         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3032         fields.  Update declarations.
3033         (Target_x86_64::Target_x86_64): Initialize new fields.
3034         (Target_x86_64::do_plt_address_for_global): New function replacing
3035         do_plt_section_for_global.
3036         (Target_x86_64::do_plt_address_for_local): New function replacing
3037         do_plt_section_for_local.
3038         (Target_x86_64::got_section): Create got_irelative_.
3039         (Target_x86_64::rela_irelative_section): New function.
3040         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3041         all callers.  Don't create __rel_iplt_{start,end}.
3042         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3043         parameters.  Change all callers.  Use different PLT and GOT for
3044         IFUNC symbols.
3045         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3046         layout parameters.  Change all callers.  Use different PLT and
3047         GOT.
3048         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3049         parameters.  Change all callers.  Use different PLT and GOT for
3050         IFUNC symbols.
3051         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3052         (Output_data_plt_x86_64::rela_irelative): New function.
3053         (Output_data_plt_x86_64::address_for_global): New function.
3054         (Output_data_plt_x86_64::address_for_local): New function.
3055         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3056         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3057         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3058         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3059         parameters.
3060         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3061         reloc.
3062         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3063         symbols if we didn't create an IRELATIVE GOT.
3064         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3065         plt_address_for_local.
3066         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3067         * testsuite/ifuncvar1.c: New test file.
3068         * testsuite/ifuncvar2.c: New test file.
3069         * testsuite/ifuncvar3.c: New test file.
3070         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3071         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3072         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3073         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3074         * testsuite/Makefile.in: Rebuild.
3075
3076 2011-07-07  Cary Coutant  <ccoutant@google.com>
3077
3078         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3079         (two_file_test_1_ndebug.o): Likewise.
3080         (two_file_test_1b_ndebug.o): Likewise.
3081         (two_file_test_2_ndebug.o): Likewise.
3082         (two_file_test_main_ndebug.o): Likewise.
3083         (incremental_test_2): Link with no-debug versions.
3084
3085 2011-07-06  Cary Coutant  <ccoutant@google.com>
3086
3087         * gold/incremental.cc
3088         (Output_section_incremental_inputs::write_info_blocks): Check for
3089         hidden and internal symbols.
3090
3091 2011-07-06  Cary Coutant  <ccoutant@google.com>
3092
3093         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3094         Check disposition for startup file.
3095         (Incremental_inputs::report_command_line): Ignore
3096         --incremental-startup-unchanged option.
3097         * options.cc (General_options::parse_incremental_startup_unchanged):
3098         New function.
3099         (General_options::General_options): Initialize new data member.
3100         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3101         (General_options): Add --incremental-startup-unchanged option.
3102         (General_options::incremental_startup_disposition): New function.
3103         (General_options::incremental_startup_disposition_): New data member.
3104
3105 2011-07-06  Cary Coutant  <ccoutant@google.com>
3106
3107         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3108         input file index to Script_info ctor.
3109         (Sized_incremental_binary::do_file_has_changed): Find the
3110         command-line argument for files named in scripts.
3111         * incremental.h (Script_info::Script_info): New ctor
3112         with input file index.
3113         (Script_info::input_file_index): New function.
3114         (Script_info::input_file_index_): New data member.
3115         (Incremental_binary::get_library): Add const.
3116         (Incremental_binary::get_script_info): Add const.
3117         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3118         * testsuite/Makefile.am (incremental_test_5): New test case.
3119         (incremental_test_6): New test case.
3120         * testsuite/Makefile.in: Regenerate.
3121
3122 2011-07-06  Cary Coutant  <ccoutant@google.com>
3123
3124         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3125         debug output when command lines differ.
3126
3127 2011-07-06  Cary Coutant  <ccoutant@google.com>
3128
3129         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3130         --incremental-patch option.
3131         * layout.cc (Free_list::allocate): Extend allocation beyond original
3132         end if enabled.
3133         (Layout::make_output_section): Mark sections that should get
3134         patch space.
3135         * options.cc (parse_percent): New function.
3136         * options.h (parse_percent): New function.
3137         (DEFINE_percent): New macro.
3138         (General_options): Add --incremental-patch option.
3139         * output.cc (Output_section::Output_section): Initialize new data
3140         members.
3141         (Output_section::add_input_section): Print section name when out
3142         of patch space.
3143         (Output_section::add_output_section_data): Likewise.
3144         (Output_section::set_final_data_size): Add patch space when
3145         doing --incremental-full.
3146         (Output_section::do_reset_address_and_file_offset): Remove patch
3147         space.
3148         (Output_segment::set_section_list_addresses): Print debug output
3149         only if --incremental-update.
3150         * output.h (Output_section::set_is_patch_space_allowed): New function.
3151         (Output_section::is_patch_space_allowed_): New data member.
3152         (Output_section::patch_space_): New data member.
3153         * parameters.cc (Parameters::incremental_full): New function.
3154         * parameters.h (Parameters::incremental_full): New function
3155         * testsuite/Makefile.am (incremental_test_2): Add test for
3156         --incremental-patch option.
3157         * testsuite/Makefile.in: Regenerate.
3158         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3159         (t18): Remove function body.
3160
3161 2011-07-05  Doug Kwan  <dougkwan@google.com>
3162
3163         PR gold/12771
3164         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3165         Arm_Address type for relocation result.
3166         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3167         overflow check.
3168         (Arm_relocate_functions::abs32): Use unaligned access.
3169         (Arm_relocate_functions::rel32): Ditto.
3170         (Arm_relocate_functions::prel31): Ditto.
3171         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3172         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3173         static data relocations.
3174         * testsuite/Makefile.in: Regnerate.
3175         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3176
3177 2011-07-05  Ian Lance Taylor  <iant@google.com>
3178
3179         PR gold/12392
3180         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3181         symbols if necessary.
3182         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3183
3184 2011-07-05  Ian Lance Taylor  <iant@google.com>
3185
3186         PR gold/12952
3187         * resolve.cc (Symbol::override_base_with_special): Simply override
3188         version with special symbol version, ignoring previous version.
3189
3190 2011-07-05  Ian Lance Taylor  <iant@google.com>
3191
3192         * object.cc (Sized_relobj_file::include_section_group): Add
3193         information to comment about signature location.
3194
3195 2011-07-02  Ian Lance Taylor  <iant@google.com>
3196
3197         PR gold/12957
3198         * options.h (class General_options): Add -f and -F.
3199         * options.cc (General_options::finalize): Fatal error if -f/-F
3200         are used without -shared.
3201         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3202
3203 2011-07-02  Ian Lance Taylor  <iant@google.com>
3204
3205         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3206
3207 2011-07-01  Ian Lance Taylor  <iant@google.com>
3208
3209         PR gold/12525
3210         PR gold/12952
3211         * resolve.cc (Symbol::override_base_with_special): Don't override
3212         the version if the overriding symbol has a different name.
3213         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3214         all callers.  If we give an error about an undefined version,
3215         define the base version if necessary.
3216         * dynobj.h (class Versions): Update declaration.
3217         * testsuite/weak_alias_test_5.cc: New file.
3218         * testsuite/weak_alias_test.script: New file.
3219         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3220         and versioned_alias have the right value, and call t2.
3221         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3222         weak_alias_test_5.so.
3223         (weak_alias_test_LDADD): Likewise.
3224         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3225         * testsuite/Makefile.in: Rebuild.
3226
3227 2011-07-01  Ian Lance Taylor  <iant@google.com>
3228
3229         PR gold/12525
3230         * options.h (class General_options): Support -z notext.
3231         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3232         -Wl,-z,notext.
3233         (two_file_shared_nonpic.so): Likewise.
3234         (two_file_shared_mixed.so): Likewise.
3235         (two_file_shared_mixed_1.so): Likewise.
3236         (weak_undef_lib_nonpic.so): Likewise.
3237         (alt/weak_undef_lib_nonpic.so): Likewise.
3238         (tls_test_shared_nonpic.so): Likewise.
3239         * testsuite/Makefile.in: Rebuild.
3240
3241 2011-07-01  Ian Lance Taylor  <iant@google.com>
3242
3243         PR gold/12525
3244         * configure.ac: Test whether static linking works, setting
3245         the automake conditional HAVE_STATIC.
3246         * testsuite/Makefile.am: Disable tests using -static if
3247         HAVE_STATIC is not true.
3248         * configure, testsuite/Makefile.in: Rebuild.
3249
3250 2011-07-01  Ian Lance Taylor  <iant@google.com>
3251
3252         PR gold/12525
3253         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3254         Assert if we see DW_EH_PE_indirect.
3255         * target.h (Target::ehframe_datarel_base): New function.
3256         (Target::do_ehframe_datarel_base): New target function.
3257         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3258         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3259         function.
3260
3261 2011-07-01  Ian Lance Taylor  <iant@google.com>
3262
3263         PR gold/12571
3264         * options.h (class General_options): Add
3265         --ld-generated-unwind-info.
3266         * ehframe.cc (Fde::write): Add address parameter.  Change all
3267         callers.  If associated with PLT, fill in address and size.
3268         (Cie::set_output_offset): Only add merge mapping if there is an
3269         object.
3270         (Cie::write): Add address parameter.  Change all callers.
3271         (Eh_frame::add_ehframe_for_plt): New function.
3272         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3273         input_offset_ fields into union u_, with new plt field.
3274         (Fde::Fde): Adjust for new union field.
3275         (Fde::Fde) [Output_data version]: New constructor.
3276         (Fde::add_mapping): Only add merge mapping if there is an object.
3277         (class Cie): Update declarations.
3278         (class Eh_frame): Declare add_ehframe_for_plt.
3279         * layout.cc (Layout::layout_eh_frame): Break out code into
3280         make_eh_frame_section, and call it.
3281         (Layout::make_eh_frame_section): New function.
3282         (Layout::add_eh_frame_for_plt): New function.
3283         * layout.h (class Layout): Update declarations.
3284         * merge.cc (Merge_map::add_mapping): Add assertion.
3285         * i386.cc: Include "dwarf.h".
3286         (class Output_data_plt_i386): Make first_plt_entry,
3287         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3288         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3289         and plt_eh_frame_fde.
3290         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3291         boundary.  Call add_eh_frame_for_plt if appropriate.
3292         * x86_64.cc: Include "dwarf.h".
3293         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3294         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3295         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3296         and plt_eh_frame_fde.
3297         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3298         appropriate.
3299
3300 2011-06-29  Ian Lance Taylor  <iant@google.com>
3301
3302         PR gold/12629
3303         * object.cc (Sized_relobj_file::layout_section): Change shdr
3304         parameter to be const.
3305         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3306         out of do_layout.
3307         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3308         appropriate.  Call layout_eh_frame_section.
3309         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3310         sections.
3311         * object.h (class Sized_relobj_file): Update declarations.
3312
3313 2011-06-29  Ian Lance Taylor  <iant@google.com>
3314
3315         PR gold/12652
3316         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3317         modifier.
3318         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3319
3320 2011-06-29  Ian Lance Taylor  <iant@google.com>
3321
3322         PR gold/12675
3323         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3324         SHT_X86_64_UNWIND.
3325         * layout.cc (Layout::layout_eh_frame): Likewise.
3326
3327 2011-06-29  Ian Lance Taylor  <iant@google.com>
3328
3329         PR gold/12695
3330         * layout.cc (Layout::symtab_section_shndx): New function.
3331         * layout.h (class Layout): Declare symtab_section_shndx.
3332         * output.cc (Output_section::write_header): Call it.
3333
3334 2011-06-29  Ian Lance Taylor  <iant@google.com>
3335
3336         PR gold/12818
3337         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3338         symbols which are not used in a relocation.
3339
3340 2011-06-28  Ian Lance Taylor  <iant@google.com>
3341
3342         PR gold/12898
3343         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3344         script create indistinguishable segments.
3345         (Layout::set_segment_offsets): Use stable_sort when sorting
3346         segments.  Pass this to Compare_segments constructor.
3347         * layout.h (class Layout): Make segment_precedes non-static.
3348         (class Compare_segments): Change from struct to class.  Add
3349         layout_ field.  Add constructor.
3350         * script-sections.cc
3351         (Script_sections::attach_sections_using_phdrs_clause): Rename
3352         local orphan to is_orphan.  Don't report failure to put empty
3353         section in segment.  On attachment failure, report name of
3354         section, and attach to first PT_LOAD segment.
3355
3356 2011-06-28  Ian Lance Taylor  <iant@google.com>
3357
3358         PR gold/12934
3359         * target-select.cc (Target_selector::Target_selector): Add
3360         emulation parameter.  Change all callers.
3361         (select_target_by_bfd_name): Rename from select_target_by_name.
3362         Change all callers.
3363         (select_target_by_emulation): New function.
3364         (supported_emulation_names): New function.
3365         * target-select.h (class Target_selector): Add emulation_ field.
3366         Update declarations.
3367         (Target_selector::recognize_by_bfd_name): Rename from
3368         recognize_by_name.  Change all callers.
3369         (Target_selector::supported_bfd_names): Rename from
3370         supported_names.  Change all callers.
3371         (Target_selector::recognize_by_emulation): New function.
3372         (Target_selector::supported_emulations): New function.
3373         (Target_selector::emulation): New function.
3374         (Target_selector::do_recognize_by_bfd_name): Rename from
3375         do_recognize_by_name.  Change all callers.
3376         (Target_selector::do_supported_bfd_names): Rename from
3377         do_supported_names.  Change all callers.
3378         (Target_selector::do_recognize_by_emulation): New function.
3379         (Target_selector::do_supported_emulations): New function.
3380         (select_target_by_bfd_name): Change name in declaration.
3381         (select_target_by_emulation): Declare.
3382         (supported_emulation_names): Declare.
3383         * parameters.cc (parameters_force_valid_target): Try to find
3384         target based on emulation from -m option.
3385         * options.h (class General_options): Change doc string for -m.
3386         * options.cc (help): Print emulations.
3387         (General_options::parse_V): Likewise.
3388         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3389         Add emulation parameter.  Change all callers.
3390
3391 2011-06-28  Ian Lance Taylor  <iant@google.com>
3392
3393         * target.h (class Target): Add osabi_ field.
3394         (Target::osabi): New function.
3395         (Target::set_osabi): New function.
3396         (Target::Target): Initialize osabi_.
3397         (Target::do_adjust_elf_header): Make pure virtual.
3398         (Sized_target::do_adjust_elf_header): Declare.
3399         * target.cc (Sized_target::do_adjust_elf_header): New function.
3400         (class Sized_target): Instantiate all versions.
3401         * freebsd.h (class Target_freebsd): Remove.
3402         (Target_selector_freebsd::do_recognize): Call set_osabi on
3403         Target.
3404         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3405         (Target_selector_freebsd::set_osabi): Remove.
3406         * i386.cc (class Target_i386): Inherit from Sized_target rather
3407         than Target_freebsd.
3408         * x86_64.cc (class Target_x86_64): Likewise.
3409
3410 2011-06-28  Ian Lance Taylor  <iant@google.com>
3411
3412         * target.h (Target::can_check_for_function_pointers): Rewrite.
3413         Make non-virtual.
3414         (Target::can_icf_inline_merge_sections): Likewise.
3415         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3416         (Target::Target_info): Add can_icf_inline_merge_sections field.
3417         (Target::do_can_check_for_function_pointers): New virtual
3418         function.
3419         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3420         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3421         from can_check_for_function_pointers, move in file.
3422         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3423         section_may_have_icf_unsafe_poineters, move in file.
3424         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3425         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3426         Rename from can_check_for_function_pointers, move in file.
3427         (Target_i386::can_icf_inline_merge_sections): Remove.
3428         (Target_i386::i386_info): Initialize
3429         can_icf_inline_merge_sections.
3430         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3431         Initialize can_icf_inline_merge_sections.
3432         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3433         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3434         Rename from can_check_for_function_pointers, move in file.
3435         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3436         (Target_x86_64::x86_64_info): Initialize
3437         can_icf_inline_merge_sections.
3438         * testsuite/testfile.cc (Target_test::test_target_info):
3439         Likewise.
3440         * icf.cc (get_section_contents): Correct formatting.
3441
3442 2011-06-27  Ian Lance Taylor  <iant@google.com>
3443
3444         * symtab.cc (Symbol::versioned_name): New function.
3445         (Symbol_table::add_to_final_symtab): Use versioned_name when
3446         appropriate.
3447         (Symbol_table::sized_write_symbol): Likewise.
3448         * symtab.h (class Symbol): Declare versioned_name.
3449         * stringpool.h (class Stringpool_template): Add variant of add
3450         which takes a std::basic_string.
3451         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3452         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3453         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3454         (ver_test_12.o): New target.
3455         * testsuite/Makefile.in: Rebuild.
3456
3457 2011-06-27  Doug Kwan  <dougkwan@google.com>
3458
3459         * arm.cc (Arm_relocate_functions::thm_jump8,
3460         Arm_relocate_functions::thm_jump11): Use a wider signed
3461         type to compute offset.
3462         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3463         arm_thm_jump8.
3464         * testsuite/Makefile.in: Regenerate.
3465         * testsuite/arm_branch_in_range.sh: Check test results of
3466         arm_thm_jump11 and arm_thm_jump8.
3467         * testsuite/arm_thm_jump11.s: New test source file.
3468         * testsuite/arm_thm_jump11.t: New linker script.
3469         * testsuite/arm_thm_jump8.s: New test source file.
3470         * testsuite/arm_thm_jump8.t: New linker script.
3471
3472 2011-06-24  Ian Lance Taylor  <iant@google.com>
3473
3474         * layout.cc: Include "object.h".
3475         (ctors_sections_in_init_array): New static variable.
3476         (Layout::is_ctors_in_init_array): New function.
3477         (Layout::layout): Add entry to ctors_sections_in_init_array if
3478         appropriate.
3479         * layout.h (class Layout): Declare is_ctors_in_init_array.
3480         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3481         is_ctors_reverse_view is set.
3482         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3483         all callers.  Set is_ctors_reverse_view field of View_size.
3484         (Sized_relobj_file::reverse_words): New function.
3485         * object.h (Sized_relobj_file::View_size): Add
3486         is_ctors_reverse_view field.
3487         (class Sized_relobj_file): Update declarations.
3488         * testsuite/initpri3.c: New test.
3489         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3490         initpri3b.
3491         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3492         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3493         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3494         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3495         * testsuite/Makefile.in: Rebuild.
3496
3497 2011-06-24  Cary Coutant  <ccoutant@google.com>
3498
3499         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3500         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3501         (debug_msg_cdebug.err): New targets.
3502         * testsuite/Makefile.in: Regenerate.
3503         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3504         Fix checks for link with shared library.
3505
3506 2011-06-24  Doug Kwan  <dougkwan@google.com>
3507
3508         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3509         skip empty text sections.
3510         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3511
3512 2011-06-22  Ian Lance Taylor  <iant@google.com>
3513
3514         PR gold/12910
3515         * options.h (class General_options): Add --ctors-in-init-array.
3516         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3517         friends as SHT_PROGBITS for merging sections.
3518         (Layout::layout): Remove special handling of .init_array and
3519         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3520         and .dtors if ctors_in_init_array.
3521         (Layout::make_output_section): Force correct section types for
3522         .init_array and friends.  Don't sort if doing relocatable link,
3523         Don't sort .ctors and .dtors if ctors_in_init_array.
3524         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3525         (Layout::output_section_name): Add relobj parameter.  Change all
3526         callers.  Handle .ctors. and .dtors. in code rather than table.
3527         Handle .ctors and .dtors if ctors_in_init_array.
3528         (Layout::match_file_name): New function, moved from output.cc.
3529         * layout.h (class Layout): Update declarations.
3530         * output.cc: Include "layout.h".
3531         (Input_section_sort_entry::get_priority): New function.
3532         (Input_section_sort_entry::match_file_name): Just call
3533         Layout::match_file_name.
3534         (Output_section::Input_section_sort_init_fini_compare::operator()):
3535         Handle .ctors and .dtors.  Sort by explicit priority rather than
3536         by name.
3537         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3538         * testsuite/initpri2.c: New test.
3539         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3540         (check_PROGRAMS): Add initpri2.
3541         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3542         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3543         * configure, testsuite/Makefile.in: Rebuild.
3544
3545 2011-06-19  Ian Lance Taylor  <iant@google.com>
3546
3547         PR gold/12880
3548         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3549         .interp section to a PT_INTERP segment even if we have seen a
3550         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3551         clause in a linker script.
3552         (Layout::finalize): Don't create a .interp section if we've
3553         already create a PT_INTERP segment.
3554         (Layout::create_interp): Always call choose_output_section (revert
3555         patch of 2011-06-17).  Don't create PT_INTERP segment.
3556         * script-sections.cc
3557         (Script_sections::create_note_and_tls_segments): Add a .interp
3558         section to a PT_INTERP segment even if we have seen a
3559         --dynamic-linker option.
3560
3561 2011-06-18  Ian Lance Taylor  <iant@google.com>
3562
3563         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3564         merely because a non-PT_LOAD segment has a dynamic reloc.
3565
3566 2011-06-18  Ian Lance Taylor  <iant@google.com>
3567
3568         * layout.cc (Layout::finish_dynamic_section): Don't create
3569         DT_FLAGS entry if not needed.
3570
3571 2011-06-18  Ian Lance Taylor  <iant@google.com>
3572
3573         PR gold/12745
3574         * layout.cc (Layout::layout_eh_frame): Correct handling of
3575         writable .eh_frame section.
3576
3577 2011-06-17  Ian Lance Taylor  <iant@google.com>
3578
3579         PR gold/12893
3580         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3581         symbol is redefined with the exact same object and value.
3582
3583 2011-06-17  Ian Lance Taylor  <iant@google.com>
3584
3585         PR gold/12880
3586         * layout.h (class Layout): Add interp_segment_ field.
3587         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3588         (Layout::attach_allocated_section_to_segment): If making shared
3589         library, put .interp section in PT_INTERP segment.
3590         (Layout::finalize): Also call create_interp if -dynamic-linker
3591         option was used.
3592         (Layout::create_interp): Assert that there is no PT_INTERP
3593         segment.  If not using a SECTIONS clause, use make_output_section.
3594         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3595         * script-sections.cc
3596         (Script_sections::create_note_and_tls_segments): If making shared
3597         library, put .interp section in PT_INTERP segment.
3598
3599 2011-06-17  Ian Lance Taylor  <iant@google.com>
3600
3601         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3602         when making a shared library.
3603
3604 2011-06-17  Ian Lance Taylor  <iant@google.com>
3605
3606         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3607         parameter.  Change all callers.  Don't issue warning about PC32
3608         against locally defined symbol.
3609
3610 2011-06-16  Ian Lance Taylor  <iant@google.com>
3611
3612         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3613         occurs in same object.
3614
3615 2011-06-14  Alan Modra  <amodra@gmail.com>
3616
3617         * po/POTFILES.in: Regenerate.
3618
3619 2011-06-09  Ian Lance Taylor  <iant@google.com>
3620
3621         * script-sections.cc
3622         (Orphan_output_section::set_section_addresses): For a relocatable
3623         link set address to 0.
3624
3625 2011-06-09  Cary Coutant  <ccoutant@google.com>
3626
3627         PR gold/12804
3628         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3629         used with --compress-debug-sections.
3630         * gold/object.cc (Sized_relobj_file::do_layout): Report
3631         uncompressed size of compressed input sections.
3632
3633 2011-06-08  Cary Coutant  <ccoutant@google.com>
3634
3635         PR gold/12804
3636         * testsuite/two_file_test_2_v1.cc: Change initialization of
3637         v2 to keep it in .data.
3638
3639 2011-06-07  Cary Coutant  <ccoutant@google.com>
3640
3641         * common.cc (Symbol_table::do_allocate_commons_list): Call
3642         gold_fallback.
3643         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3644         (Errors::fallback): New function.
3645         (gold_fallback): New function.
3646         * errors.h (Errors::fallback): New function.
3647         * gold.cc (gold_exit): Change status parameter to enum; adjust
3648         all callers.
3649         (queue_initial_tasks): Call gold_fallback.
3650         * gold.h: Include cstdlib.
3651         (Exit_status): New enum type.
3652         (gold_exit): Change status parameter to enum.
3653         (gold_fallback): New function.
3654         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3655         (Layout::create_symtab_sections): Likewise.
3656         (Layout::create_shdrs): Likewise.
3657         * main.cc (main): Adjust call to gold_exit.
3658         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3659         (Output_data_got::add_got_entry_pair): Likewise.
3660         (Output_section::add_input_section): Likewise.
3661         (Output_section::add_output_section_data): Likewise.
3662         (Output_segment::set_section_list_addresses): Likewise.
3663         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3664
3665 2011-06-07  Cary Coutant  <ccoutant@google.com>
3666
3667         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3668         for incremental links.
3669         * output.cc (Output_segment::set_section_list_addresses): Remove
3670         FIXME and test for TLS or BSS.
3671
3672 2011-06-07  Cary Coutant  <ccoutant@google.com>
3673
3674         * testsuite/Makefile.am: Add incremental_copy_test,
3675         incremental_common_test_1.
3676         * testsuite/Makefile.in: Regenerate.
3677         * testsuite/common_test_1_v1.c: New source file.
3678         * testsuite/common_test_1_v2.c: New source file.
3679         * testsuite/copy_test_v1.cc: New source file.
3680
3681 2011-06-07  Cary Coutant  <ccoutant@google.com>
3682
3683         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3684         update, allocate common from bss section's free list.
3685         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3686         linker-defined symbols.
3687         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3688         Skip GOT and PLT entries that are no longer referenced.
3689         (Output_section_incremental_inputs::write_info_blocks): Mark
3690         linker-defined symbols.
3691         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3692         * output.cc (Output_section::allocate): New function.
3693         * output.h (Output_section::allocate): New function.
3694         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3695         linker-defined symbols.
3696         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3697         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3698         (Symbol::init_base_output_data): Likewise.
3699         (Symbol::init_base_output_segment): Likewise.
3700         (Symbol::init_base_constant): Likewise.
3701         (Sized_symbol::init_output_data): Likewise.
3702         (Sized_symbol::init_output_segment): Likewise.
3703         (Sized_symbol::init_constant): Likewise.
3704         (Symbol_table::do_define_in_output_data): Likewise.
3705         (Symbol_table::do_define_in_output_segment): Likewise.
3706         (Symbol_table::do_define_as_constant): Likewise.
3707         * symtab.h (Symbol::is_predefined): New function.
3708         (Symbol::init_base_output_data): Add is_predefined parameter.
3709         (Symbol::init_base_output_segment): Likewise.
3710         (Symbol::init_base_constant): Likewise.
3711         (Symbol::is_predefined_): New data member.
3712         (Sized_symbol::init_output_data): Add is_predefined parameter.
3713         (Sized_symbol::init_output_segment): Likewise.
3714         (Sized_symbol::init_constant): Likewise.
3715         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3716
3717 2011-06-07  Cary Coutant  <ccoutant@google.com>
3718
3719         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3720         instead of emit_copy_reloc.
3721         (Copy_relocs::emit_copy_reloc): Refactor.
3722         (Copy_relocs::make_copy_reloc): New function.
3723         (Copy_relocs::add_copy_reloc): Remove.
3724         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3725         section.
3726         (Copy_relocs::make_copy_reloc): New function.
3727         (Copy_relocs::add_copy_reloc): Remove.
3728         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3729         unchanged input files.
3730         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3731         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3732         Reserve BSS space for COPY relocations.
3733         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3734         (Output_section_incremental_inputs::write_info_blocks): Record
3735         whether a symbol is copied from a shared object.
3736         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3737         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3738         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3739         (Incremental_input_entry_reader::get_output_symbol_index): Add
3740         is_copy parameter.
3741         (Incremental_binary::emit_copy_relocs): New function.
3742         (Incremental_binary::do_emit_copy_relocs): New function.
3743         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3744         new data member.
3745         (Sized_incremental_binary::add_copy_reloc): New function.
3746         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3747         (Sized_incremental_binary::Copy_reloc): New struct.
3748         (Sized_incremental_binary::Copy_relocs): New typedef.
3749         (Sized_incremental_binary::copy_relocs_): New data member.
3750         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3751         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3752         * target.h (Sized_target::emit_copy_reloc): New function.
3753         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3754
3755 2011-06-02  Cary Coutant  <ccoutant@google.com>
3756
3757         PR gold/12163
3758         * gold/archive.cc (Archive::Archive): Initialize new data member.
3759         (Archive::include_all_members): Return if archive has already been
3760         included.
3761         * gold/archive.h (Archive::include_all_members_): New data member.
3762
3763 2011-06-02  Nick Clifton  <nickc@redhat.com>
3764
3765         * dynobj.h: Fix spelling mistake in comment.
3766         * output.cc: Likewise.
3767
3768 2011-05-31  Doug Kwan  <dougkwan@google.com>
3769             Asier Llano
3770
3771         PR gold/12826
3772         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3773         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3774         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3775         redundant arm_exidx_test.so.
3776         * testsuite/Makefile.in: Regenerate.
3777         (check_SCRIPTS): Add pr12826.sh
3778         (check_DATA): Add pr12826.stdout
3779         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3780         * testsuite/pr12826.sh: New file.
3781         * testsuite/pr12826_1.s: Ditto.
3782         * testsuite/pr12826_1.s: Ditto.
3783
3784 2011-05-30  Ian Lance Taylor  <iant@google.com>
3785
3786         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3787         sections.
3788
3789 2011-05-29  Ian Lance Taylor  <iant@google.com>
3790
3791         PR gold/12804
3792         * testsuite/Makefile.am: Use different file name for two_file_test
3793         temporary file for each incremental test.
3794         * testsuite/Makefile.in: Rebuild.
3795
3796 2011-05-29  Ian Lance Taylor  <iant@google.com>
3797
3798         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3799         binary input file is empty.
3800
3801 2011-05-27  Ian Lance Taylor  <iant@google.com>
3802
3803         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3804         (ver_test_9.so): Likewise.
3805         * testsuite/Makefile.in: Rebuild.
3806
3807 2011-05-26 Cary Coutant  <ccoutant@google.com>
3808
3809         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3810         * incremental.cc (Incremental_inputs::report_input_section): Fix
3811         comment, indentation.
3812         (Incremental_inputs::report_comdat_group): New function.
3813         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3814         of data for incremental input file entry.
3815         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3816         group count, COMDAT group signatures.
3817         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3818         an unchanged input file.
3819         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3820         Initialize new data member.
3821         (Incremental_object_entry::add_comdat_group): New function.
3822         (Incremental_object_entry::get_comdat_group_count): New function.
3823         (Incremental_object_entry::get_comdat_signature_key): New function.
3824         (Incremental_object_entry::groups_): New data member.
3825         (Incremental_inputs::report_comdat_group): New function.
3826         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3827         data for incremental input file entry.
3828         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3829         (Incremental_input_entry_reader::get_input_section): Adjust size of
3830         data for incremental input file entry.
3831         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3832         (Incremental_input_entry_reader::get_comdat_group_signature): New
3833         function.
3834         * object.cc (Sized_relobj::include_section_group): Report kept
3835         COMDAT groups for incremental links.
3836
3837 2011-05-24  David Meyer  <pdox@google.com>
3838
3839         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3840         with name parameter.  Add found_name parameter.
3841         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3842         * dirsearch.h (class Dirsearch): Update declaration.
3843
3844 2011-05-24  Ian Lance Taylor  <iant@google.com>
3845
3846         * archive.cc (Library_base::should_include_member): Pull in object
3847         from archive if it defines the entry symbol.
3848         * parameters.cc (Parameters::entry): New function.
3849         * parameters.h (class Parameters): Declare entry.
3850         * output.h (class Output_file_header): Remove entry_ field.
3851         * output.cc (Output_file_header::Output_file_header): Remove entry
3852         parameter.  Change all callers.
3853         (Output_file_header::entry): Use parameters->entry.
3854         * gold.cc (queue_middle_tasks): Likewise.
3855         * plugin.cc (Plugin_hook::run): Likewise.
3856
3857 2011-05-24 Cary Coutant  <ccoutant@google.com>
3858
3859         * gold.cc (queue_initial_tasks): Pass incremental base filename
3860         to Output_file::open_base_file; don't print error message.
3861         * incremental-dump.cc (main): Adjust call to
3862         Output_file::open_for_modification.
3863         * incremental-dump.cc (main): Likewise.
3864         * incremental.cc (Incremental_inputs::report_command_line):
3865         Ignore --incremental-base option when comparing command lines.
3866         Ignore parameter when given as separate argument.
3867         * options.h (class General_options): Add --incremental-base.
3868         * output.cc (Output_file::Output_file):
3869         (Output_file::open_base_file): Add base_name and writable parameters;
3870         read base file into new file; print error message here.
3871         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3872         callers.
3873         * output.h (Output_file::open_for_modification): Rename to...
3874         (Output_file::open_base_file): ...this; add base_name and
3875         writable parameters; adjust all callers.
3876         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3877         callers.
3878         * testsuite/Makefile.am (incremental_test_4): Test
3879         --incremental-base.
3880         * testsuite/Makefile.in: Regenerate.
3881
3882 2011-05-24 Cary Coutant  <ccoutant@google.com>
3883
3884         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3885         incremental_test_4.
3886         * testsuite/Makefile.in: Regenerate.
3887         * testsuite/two_file_test_1_v1.cc: New test source file.
3888         * testsuite/two_file_test_1b_v1.cc: New test source file.
3889         * testsuite/two_file_test_2_v1.cc: New test source file.
3890
3891 2011-05-24 Cary Coutant  <ccoutant@google.com>
3892
3893         * dynobj.h (Dynobj::do_dynobj): New function.
3894         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3895         flag and soname for shared objects.
3896         * incremental.cc (Incremental_inputs::report_object): Make
3897         either Incremental_object_entry or Incremental_dynobj_entry; add
3898         soname to string table.
3899         (Incremental_inputs::report_input_section): Add assertion.
3900         (Output_section_incremental_inputs::set_final_data_size): Adjust
3901         type of input file entry for shared libraries; adjust size of
3902         shared library info entry.
3903         (Output_section_incremental_inputs::write_input_files): Write
3904         as_needed flag for shared libraries.
3905         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3906         of input file entry for shared libraries; write soname.
3907         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3908         soname from incremental info.
3909         * incremental.h (enum Incremental_input_flags): Add
3910         INCREMENTAL_INPUT_AS_NEEDED.
3911         (Incremental_input_entry::Incremental_input_entry): Initialize new
3912         data member.
3913         (Incremental_input_entry::set_as_needed): New function.
3914         (Incremental_input_entry::as_needed): New function.
3915         (Incremental_input_entry::do_dynobj_entry): New function.
3916         (Incremental_input_entry::as_needed_): New data member.
3917         (Incremental_object_entry::Incremental_object_entry): Don't check
3918         for shared library.
3919         (Incremental_object_entry::do_type): Likewise.
3920         (class Incremental_dynobj_entry): New class.
3921         (Incremental_input_entry_reader::as_needed): New function.
3922         (Incremental_input_entry_reader::get_soname): New function.
3923         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3924         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3925         size of shared library info entry.
3926         * layout.cc (Layout::finish_dynamic_section): Don't test for
3927         incremental link when adding DT_NEEDED entries.
3928         * object.h (Object::Object): Initialize new data member.
3929         (Object::dynobj): New function.
3930         (Object::set_as_needed): New function.
3931         (Object::as_needed): New function.
3932         (Object::do_dynobj): New function.
3933         (Object::as_needed_): New data member.
3934
3935 2011-05-24 Cary Coutant  <ccoutant@google.com>
3936
3937         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3938         info; adjust display of GOT entries.
3939         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3940         vector of input objects; remove file_status_.
3941         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3942         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3943         got_plt reader; call target hooks to reserve GOT entries.
3944         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3945         of input file info header and GOT info entry.
3946         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3947         relocation info.
3948         (Got_plt_view_info::got_descriptor): Remove.
3949         (Got_plt_view_info::sym_index): New data member.
3950         (Got_plt_view_info::input_index): New data member.
3951         (Local_got_offset_visitor::visit): Write input file index.
3952         (Global_got_offset_visitor::visit): Write 0 for input file index.
3953         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3954         with sym_index and input_index.
3955         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3956         incremental info GOT entry; replace got_descriptor with input_index.
3957         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3958         map from input file index to object.
3959         (Sized_relobj_incr::do_layout): Replace direct data member reference
3960         with accessor function.
3961         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3962         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3963         Adjust size of input file info header.
3964         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3965         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3966         (Incremental_input_entry_reader::get_input_section): Adjust size of
3967         input file info header.
3968         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3969         of incremental info GOT entry.
3970         (Incremental_got_plt_reader::get_got_desc): Remove.
3971         (Incremental_got_plt_reader::get_got_symndx): New function.
3972         (Incremental_got_plt_reader::get_got_input_index): New function.
3973         (Sized_incremental_binary::Sized_incremental_binary): Remove
3974         file_status_; add input_objects_.
3975         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3976         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3977         (Sized_incremental_binary::file_is_unchanged): Remove.
3978         (Sized_incremental_binary::set_input_object): New function.
3979         (Sized_incremental_binary::input_object): New function.
3980         (Sized_incremental_binary::file_status_): Remove.
3981         (Sized_incremental_binary::input_objects_): New data member.
3982         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3983         references.
3984         (Sized_relobj_incr::invalid_address): Move to base class.
3985         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3986         class.
3987         (Sized_relobj_incr::do_output_section_offset): Likewise.
3988         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3989         (Sized_relobj_incr::section_offsets_): Likewise.
3990         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3991         function.
3992         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3993         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3994         with accessor function.
3995         (Sized_relobj_file::do_layout): Likewise.
3996         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3997         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3998         (Sized_relobj_file::compute_final_local_value): Replace refs to
3999         section_offsets_ with accessor function.
4000         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4001         * object.h (Relobj::Relobj): Initialize new data members.
4002         (Relobj::add_dyn_reloc): New function.
4003         (Relobj::first_dyn_reloc): New function.
4004         (Relobj::dyn_reloc_count): New function.
4005         (Relobj::first_dyn_reloc_): New data member.
4006         (Relobj::dyn_reloc_count_): New data member.
4007         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4008         references.
4009         (Sized_relobj::Address): New typedef.
4010         (Sized_relobj::invalid_address): Move here from child class.
4011         (Sized_relobj::Sized_relobj): Initialize new data members.
4012         (Sized_relobj::sized_relobj): New function.
4013         (Sized_relobj::is_output_section_offset_invalid): Move here from
4014         child class.
4015         (Sized_relobj::get_output_section_offset): Likewise.
4016         (Sized_relobj::local_has_got_offset): Likewise.
4017         (Sized_relobj::local_got_offset): Likewise.
4018         (Sized_relobj::set_local_got_offset): Likewise.
4019         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4020         (Sized_relobj::clear_got_offsets): New function.
4021         (Sized_relobj::section_offsets): Move here from child class.
4022         (Sized_relobj::do_output_section_offset): Likewise.
4023         (Sized_relobj::do_set_section_offset): Likewise.
4024         (Sized_relobj::Local_got_offsets): Likewise.
4025         (Sized_relobj::local_got_offsets_): Likewise.
4026         (Sized_relobj::section_offsets_): Likewise.
4027         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4028         references.
4029         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4030         class.
4031         (Sized_relobj_file::sized_relobj): New function
4032         (Sized_relobj_file::local_has_got_offset): Move to base class.
4033         (Sized_relobj_file::local_got_offset): Likewise.
4034         (Sized_relobj_file::set_local_got_offset): Likewise.
4035         (Sized_relobj_file::get_output_section_offset): Likewise.
4036         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4037         (Sized_relobj_file::do_output_section_offset): Likewise.
4038         (Sized_relobj_file::do_set_section_offset): Likewise.
4039         (Sized_relobj_file::Local_got_offsets): Likewise.
4040         (Sized_relobj_file::local_got_offsets_): Likewise.
4041         (Sized_relobj_file::section_offsets_): Likewise.
4042         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4043         (all constructors).
4044         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4045         (Output_reloc::get_symbol_index): Likewise.
4046         (Output_reloc::local_section_offset): Likewise.
4047         (Output_reloc::get_address): Likewise.
4048         (Output_reloc::symbol_value): Likewise.
4049         (Output_data_got::reserve_slot): Move to class definition.
4050         (Output_data_got::reserve_local): New function.
4051         (Output_data_got::reserve_slot_for_global): Remove.
4052         (Output_data_got::reserve_global): New function.
4053         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4054         (all constructors, two instantiations).
4055         (Output_reloc::get_relobj): New function (two instantiations).
4056         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4057         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4058         (Output_data_reloc::add_global): Adjust type of relobj.
4059         (Output_data_reloc::add_global_relative): Likewise.
4060         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4061         (Output_data_reloc::add_local): Likewise.
4062         (Output_data_reloc::add_local_relative): Likewise.
4063         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4064         (Output_data_reloc::add_local_section): Likewise.
4065         (Output_data_reloc::add_output_section): Likewise.
4066         (Output_data_reloc::add_absolute): Likewise.
4067         (Output_data_reloc::add_target_specific): Likewise.
4068         (Output_data_got::reserve_slot): Move definition here.
4069         (Output_data_got::reserve_local): New function.
4070         (Output_data_got::reserve_global): New function.
4071         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4072         section_offsets_ with accessor function.
4073         (Sized_relobj_file::write_sections): Likewise.
4074         (Sized_relobj_file::do_relocate_sections): Likewise.
4075         * target.h (Sized_target::reserve_local_got_entry): New function.
4076         (Sized_target::reserve_global_got_entry): New function.
4077         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4078         (Target_x86_64::reserve_global_got_entry): New function.
4079         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4080
4081 2011-05-23 Cary Coutant  <ccoutant@google.com>
4082
4083         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4084         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4085         bit when checking got_type.
4086         * incremental.cc (Sized_incremental_binary::setup_readers):
4087         Store symbol table and string table locations; initialize bit vector
4088         of file status flags.
4089         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4090         unchanged files.
4091         (Sized_incremental_binary::do_process_got_plt): New function.
4092         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4093         (Output_section_incremental_inputs::set_final_data_size): Record
4094         file index for each input file.
4095         (Output_section_incremental_inputs::write_got_plt): Store file index
4096         instead of input entry offset for each GOT entry.
4097         * incremental.h
4098         (Incremental_input_entry::Incremental_input_entry): Initialize new
4099         data member.
4100         (Incremental_input_entry::set_offset): Store file index.
4101         (Incremental_input_entry::get_file_index): New function.
4102         (Incremental_input_entry::file_index_): New data member.
4103         (Incremental_binary::process_got_plt): New function.
4104         (Incremental_binary::do_process_got_plt): New function.
4105         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4106         data members.
4107         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4108         (Sized_incremental_binary::set_file_is_unchanged): New function.
4109         (Sized_incremental_binary::file_is_unchanged): New function.
4110         (Sized_incremental_binary::do_process_got_plt): New function.
4111         (Sized_incremental_binary::file_status_): New data member.
4112         (Sized_incremental_binary::main_symtab_loc_): New data member.
4113         (Sized_incremental_binary::main_strtab_loc_): New data member.
4114         * output.cc (Output_data_got::Got_entry::write): Add case
4115         RESERVED_CODE.
4116         (Output_data_got::add_global): Call add_got_entry.
4117         (Output_data_got::add_global_plt): Likewise.
4118         (Output_data_got::add_global_with_rel): Likewise.
4119         (Output_data_got::add_global_with_rela): Likewise.
4120         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4121         (Output_data_got::add_global_pair_with_rela): Likewise.
4122         (Output_data_got::add_local): Call add_got_entry.
4123         (Output_data_got::add_local_plt): Likewise.
4124         (Output_data_got::add_local_with_rel): Likewise.
4125         (Output_data_got::add_local_with_rela): Likewise.
4126         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4127         (Output_data_got::add_local_pair_with_rela): Likewise.
4128         (Output_data_got::reserve_slot): New function.
4129         (Output_data_got::reserve_slot_for_global): New function.
4130         (Output_data_got::add_got_entry): New function.
4131         (Output_data_got::add_got_entry_pair): New function.
4132         (Output_section::add_output_section_data): Edit FIXME.
4133         * output.h
4134         (Output_section_data_build::Output_section_data_build): New
4135         constructor with size parameter.
4136         (Output_data_space::Output_data_space): Likewise.
4137         (Output_data_got::Output_data_got): Initialize new data member; new
4138         constructor with size parameter.
4139         (Output_data_got::add_constant): Call add_got_entry.
4140         (Output_data_got::reserve_slot): New function.
4141         (Output_data_got::reserve_slot_for_global): New function.
4142         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4143         (Output_data_got::add_got_entry): New function.
4144         (Output_data_got::add_got_entry_pair): New function.
4145         (Output_data_got::free_list_): New data member.
4146         * target.h (Sized_target::init_got_plt_for_update): New function.
4147         (Sized_target::register_global_plt_entry): New function.
4148         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4149         Initialize new data member; call init; add constructor with PLT count.
4150         (Output_data_plt_x86_64::init): New function.
4151         (Output_data_plt_x86_64::add_relocation): New function.
4152         (Output_data_plt_x86_64::reserve_slot): New function.
4153         (Output_data_plt_x86_64::free_list_): New data member.
4154         (Target_x86_64::init_got_plt_for_update): New function.
4155         (Target_x86_64::register_global_plt_entry): New function.
4156         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4157         incremental updates.
4158         (Output_data_plt_x86_64::add_relocation): New function.
4159         * testsuite/object_unittest.cc (Object_test): Set default options.
4160
4161 2011-05-16  Ian Lance Taylor  <iant@google.com>
4162
4163         * options.h (class General_options): Make -i a synonym for -r.
4164
4165 2011-05-16  Ian Lance Taylor  <iant@google.com>
4166
4167         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4168
4169 2011-05-10 Cary Coutant  <ccoutant@google.com>
4170
4171         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4172         strip_all (-s).
4173
4174 2011-05-06  Ian Lance Taylor  <iant@google.com>
4175
4176         * layout.cc (Layout::layout): If the output section flags change,
4177         update the ordering.
4178
4179 2011-04-25 Cary Coutant  <ccoutant@google.com>
4180
4181         * incremental-dump.cc (dump_incremental_inputs): Print local
4182         symbol info for each input file.
4183         * incremental.cc
4184         (Output_section_incremental_inputs::set_final_data_size): Add local
4185         symbol info to input file entries in incremental info.
4186         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4187         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4188         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4189         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4190         implementation.
4191         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4192         (Sized_incr_relobj::do_relocate): Write the local symbols.
4193         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4194         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4195         Adjust size of input file header.
4196         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4197         (Incremental_inputs_reader::get_local_symbol_count): New function.
4198         (Incremental_inputs_reader::get_input_section): Adjust size of input
4199         file header.
4200         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4201         (Sized_incr_relobj::This): New typedef.
4202         (Sized_incr_relobj::sym_size): New const data member.
4203         (Sized_incr_relobj::Local_symbol): New struct.
4204         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4205         (Sized_incr_relobj::do_local_symbol_offset): New function.
4206         (Sized_incr_relobj::local_symbol_count_): New data member.
4207         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4208         (Sized_incr_relobj::local_symbol_index_): New data member.
4209         (Sized_incr_relobj::local_symbol_offset_): New data member.
4210         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4211         (Sized_incr_relobj::local_symbols_): New data member.
4212         * object.h (Relobj::output_local_symbol_count): New function.
4213         (Relobj::local_symbol_offset): New function.
4214         (Relobj::do_output_local_symbol_count): New function.
4215         (Relobj::do_local_symbol_offset): New function.
4216         (Sized_relobj::do_output_local_symbol_count): New function.
4217         (Sized_relobj::do_local_symbol_offset): New function.
4218
4219 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4220
4221         * descriptors.cc (set_close_on_exec): New function.
4222         (Descriptors::open): Use set_close_on_exec.
4223         * output.cc (S_ISLNK): Define if not defined.
4224
4225 2011-04-22 Cary Coutant  <ccoutant@google.com>
4226
4227         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4228         global symbol map.
4229         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4230         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4231         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4232         relocations.
4233         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4234         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4235         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4236         * incremental.h
4237         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4238         function.
4239         (Incremental_binary::apply_incremental_relocs): New function.
4240         (Incremental_binary::do_apply_incremental_relocs): New function.
4241         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4242         data member.
4243         (Sized_incremental_binary::add_global_symbol): New function.
4244         (Sized_incremental_binary::global_symbol): New function.
4245         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4246         (Sized_incremental_binary::symbol_map_): New data member.
4247         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4248         * target.h (Sized_target::apply_relocation): New function.
4249         * target-reloc.h (apply_relocation): New function.
4250         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4251
4252 2011-04-22  Doug Kwan  <dougkwan@google.com>
4253
4254         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4255         flag of a SHT_ARM_EXIDX section.
4256         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4257         * testsuite/Makefile.in: Regenerate.
4258         * testsuite/arm_exidx_test.s: New file.
4259         * testsuite/arm_exidx_test.sh: Same.
4260
4261 2011-04-20 Cary Coutant  <ccoutant@google.com>
4262
4263         PR gold/12689
4264         * archive.h (Incremental_archive_entry::Archive_member):
4265         Initialize arg_serial_ (second constructor).
4266
4267 2011-04-17  Ian Lance Taylor  <iant@google.com>
4268
4269         * object.cc (Relocate_info::location): Simplify location string.
4270         * errors.cc (Errors::error_at_location): Don't print program
4271         name.
4272         (Errors::warning_at_location): Likewise.
4273         (Errors::undefined_symbol): Likewise.
4274         * testsuite/debug_msg.sh: Update accordingly.
4275
4276 2011-04-14 Cary Coutant  <ccoutant@google.com>
4277
4278         * gold/layout.cc (Layout::symtab_section_offset): New function.
4279         * gold/layout.h (Layout::symtab_section_offset): New function.
4280         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4281
4282 2011-04-12  Ian Lance Taylor  <iant@google.com>
4283
4284         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4285         with MREMAP_MAYMOVE.
4286         * output.h (class Output_file): Add map_is_allocated_ field.
4287         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4288         not available, provide stubs.  If mremap is not available, #define
4289         it to gold_mremap.
4290         (MREMAP_MAYMOVE): Define if not defined.
4291         (Output_file::Output_file): Initialize map_is_allocated_.
4292         (Output_file::resize): Check map_is_allocated_.
4293         (Output_file::map_anonymous): If mmap fails, use malloc.
4294         (Output_file::unmap): Don't do anything for an anonymous map.
4295         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4296         is not available, provide stubs.
4297         (File_read::View::~View): Use free rather than delete[].
4298         (File_read::make_view): Use malloc rather than new[].  If mmap
4299         fails, use malloc.
4300         (File_read::find_or_make_view): Use malloc rather than new[].
4301         * gold.h: Remove HAVE_REMAP code.
4302         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4303         exists.  Rename mremap to gold_mremap.  If mmap is not available
4304         don't do anything.
4305         * configure, config.in: Rebuild.
4306
4307 2011-04-11  Ian Lance Taylor  <iant@google.com>
4308
4309         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4310         initialize local variable v.
4311
4312 2011-04-11  Cary Coutant  <ccoutant@google.com>
4313
4314         * archive.cc (Archive::include_member): Adjust call to
4315         report_object.
4316         (Add_archive_symbols::run): Track argument serial numbers.
4317         (Lib_group::include_member): Likewise.
4318         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4319         * archive.h (Incremental_archive_entry::Archive_member):
4320         Initialize arg_serial_.
4321         (Archive_member::arg_serial_): New data member.
4322         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4323         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4324         incremental link.
4325         (Sized_dynobj::do_for_all_local_got_entries): New function.
4326         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4327         function.
4328         * fileread.cc (get_mtime): New function.
4329         * fileread.h (get_mtime): New function.
4330         * gold.cc (queue_initial_tasks): Check for incremental update.
4331         (process_incremental_input): New function.
4332         (queue_middle_tasks): Don't force valid target for incremental
4333         update.
4334         * incremental-dump.cc (find_input_containing_global): Adjust
4335         size of symbol info entry.
4336         (dump_incremental_inputs): Dump argument serial number and
4337         in_system_directory flag; bias shndx by 1; print symbol names
4338         when dumping per-file symbol lists; use new symbol info readers.
4339         * incremental.cc
4340         (Output_section_incremental_inputs:update_data_size): New function.
4341         (Sized_incremental_binary::setup_readers): Setup input readers
4342         for each input file; build maps for files added from libraries
4343         and scripts.
4344         (Sized_incremental_binary::check_input_args): New function.
4345         (Sized_incremental_binary::do_check_inputs): Build map of argument
4346         serial numbers to input arguments.
4347         (Sized_incremental_binary::do_file_has_changed): Rename
4348         do_file_is_unchanged to this; compare file modification times.
4349         (Sized_incremental_binary::do_init_layout): New function.
4350         (Sized_incremental_binary::do_reserve_layout): New function.
4351         (Sized_incremental_binary::do_get_input_reader): Remove.
4352         (Sized_incremental_binary::get_symtab_view): New function.
4353         (Incremental_checker::can_incrementally_link_output_file): Remove.
4354         (Incremental_inputs::report_command_line): Exclude --debug options.
4355         (Incremental_inputs::report_archive_begin): Add parameter; track
4356         argument serial numbers; don't put input file entry for archive
4357         before archive members.
4358         (Incremental_inputs::report_archive_end): Put input file entry
4359         for archive after archive members.
4360         (Incremental_inputs::report_object): Add parameter; track argument
4361         serial numbers and in_system_directory flag.
4362         (Incremental_inputs::report_script): Add parameter; track argument
4363         serial numbers.
4364         (Output_section_incremental_inputs::set_final_data_size): Adjust
4365         size of symbol info entry; check for forwarding symbols.
4366         (Output_section_incremental_inputs::write_input_files): Write
4367         in_system_directory flag and argument serial number.
4368         (Output_section_incremental_inputs::write_info_blocks): Map section
4369         indices between incremental info and original input file; store
4370         input section index for each symbol.
4371         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4372         change operator() to visit().
4373         (class Global_got_offset_visitor): Likewise.
4374         (class Global_symbol_visitor_got_plt):
4375         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4376         classes.
4377         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4378         (Sized_incr_relobj::do_read_symbols): New function.
4379         (Sized_incr_relobj::do_layout): New function.
4380         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4381         (Sized_incr_relobj::do_add_symbols): New function.
4382         (Sized_incr_relobj::do_should_include_member): New function.
4383         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4384         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4385         (Sized_incr_relobj::do_section_size): New function.
4386         (Sized_incr_relobj::do_section_name): New function.
4387         (Sized_incr_relobj::do_section_contents): New function.
4388         (Sized_incr_relobj::do_section_flags): New function.
4389         (Sized_incr_relobj::do_section_entsize): New function.
4390         (Sized_incr_relobj::do_section_address): New function.
4391         (Sized_incr_relobj::do_section_type): New function.
4392         (Sized_incr_relobj::do_section_link): New function.
4393         (Sized_incr_relobj::do_section_info): New function.
4394         (Sized_incr_relobj::do_section_addralign): New function.
4395         (Sized_incr_relobj::do_initialize_xindex): New function.
4396         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4397         (Sized_incr_relobj::do_read_relocs): New function.
4398         (Sized_incr_relobj::do_gc_process_relocs): New function.
4399         (Sized_incr_relobj::do_scan_relocs): New function.
4400         (Sized_incr_relobj::do_count_local_symbols): New function.
4401         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4402         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4403         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4404         (Sized_incr_relobj::do_relocate): New function.
4405         (Sized_incr_relobj::do_set_section_offset): New function.
4406         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4407         (Sized_incr_dynobj::do_read_symbols): New function.
4408         (Sized_incr_dynobj::do_layout): New function.
4409         (Sized_incr_dynobj::do_add_symbols): New function.
4410         (Sized_incr_dynobj::do_should_include_member): New function.
4411         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4412         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4413         (Sized_incr_dynobj::do_section_size): New function.
4414         (Sized_incr_dynobj::do_section_name): New function.
4415         (Sized_incr_dynobj::do_section_contents): New function.
4416         (Sized_incr_dynobj::do_section_flags): New function.
4417         (Sized_incr_dynobj::do_section_entsize): New function.
4418         (Sized_incr_dynobj::do_section_address): New function.
4419         (Sized_incr_dynobj::do_section_type): New function.
4420         (Sized_incr_dynobj::do_section_link): New function.
4421         (Sized_incr_dynobj::do_section_info): New function.
4422         (Sized_incr_dynobj::do_section_addralign): New function.
4423         (Sized_incr_dynobj::do_initialize_xindex): New function.
4424         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4425         (make_sized_incremental_object): New function.
4426         (Incremental_library::copy_unused_symbols): New function.
4427         (Incremental_library::do_for_all_unused_symbols): New function.
4428         * incremental.h (enum Incremental_input_flags): New type.
4429         (class Incremental_checker): Remove.
4430         (Incremental_input_entry::Incremental_input_entry): Add argument
4431         serial number.
4432         (Incremental_input_entry::arg_serial): New function.
4433         (Incremental_input_entry::set_is_in_system_directory): New function.
4434         (Incremental_input_entry::is_in_system_directory): New function.
4435         (Incremental_input_entry::arg_serial_): New data member.
4436         (Incremental_input_entry::is_in_system_directory_): New data member.
4437         (class Script_info): Move here from script.h.
4438         (Script_info::Script_info): Add filename parameter.
4439         (Script_info::filename): New function.
4440         (Script_info::filename_): New data member.
4441         (Incremental_script_entry::Incremental_script_entry): Add argument
4442         serial number.
4443         (Incremental_object_entry::Incremental_object_entry): Likewise.
4444         (Incremental_object_entry::add_input_section): Build list of input
4445         sections with map to original shndx.
4446         (Incremental_object_entry::get_input_section_index): New function.
4447         (Incremental_object_entry::shndx_): New data member.
4448         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4449         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4450         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4451         serial number.
4452         (Incremental_inputs::report_archive_begin): Likewise.
4453         (Incremental_inputs::report_object): Likewise.
4454         (Incremental_inputs::report_script): Likewise.
4455         (class Incremental_global_symbol_reader): New class.
4456         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4457         and store flags and input file type.
4458         (Incremental_input_entry_reader::arg_serial): New function.
4459         (Incremental_input_entry_reader::type): Extract type from flags.
4460         (Incremental_input_entry_reader::is_in_system_directory): New function.
4461         (Incremental_input_entry_reader::get_input_section_count): Call
4462         accessor function for type.
4463         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4464         function for type; adjust size of global symbol entry.
4465         (Incremental_input_entry_reader::get_global_symbol_count): Call
4466         accessor function for type.
4467         (Incremental_input_entry_reader::get_object_count): Likewise.
4468         (Incremental_input_entry_reader::get_object_offset): Likewise.
4469         (Incremental_input_entry_reader::get_member_count): Likewise.
4470         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4471         (Incremental_input_entry_reader::get_member_offset): Likewise.
4472         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4473         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4474         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4475         (Incremental_input_entry_reader::get_global_symbol_reader): New
4476         function.
4477         (Incremental_input_entry_reader::get_output_symbol_index): New
4478         function.
4479         (Incremental_input_entry_reader::type_): Remove.
4480         (Incremental_input_entry_reader::flags_): New data member.
4481         (Incremental_inputs_reader::input_file_offset): New function.
4482         (Incremental_inputs_reader::input_file_index): New function.
4483         (Incremental_inputs_reader::input_file): Call input_file_offset.
4484         (Incremental_inputs_reader::input_file_at_offset): New function.
4485         (Incremental_relocs_reader::get_r_type): Reformat.
4486         (Incremental_relocs_reader::get_r_shndx): Reformat.
4487         (Incremental_relocs_reader::get_r_offset): Reformat.
4488         (Incremental_relocs_reader::data): New function.
4489         (Incremental_binary::Incremental_binary): Initialize new data members.
4490         (Incremental_binary::check_inputs): Add cmdline parameter.
4491         (Incremental_binary::file_is_unchanged): Remove.
4492         (Input_reader::arg_serial): New function.
4493         (Input_reader::get_unused_symbol_count): New function.
4494         (Input_reader::get_unused_symbol): New function.
4495         (Input_reader::do_arg_serial): New function.
4496         (Input_reader::do_get_unused_symbol_count): New function.
4497         (Input_reader::do_get_unused_symbol): New function.
4498         (Incremental_binary::input_file_count): New function.
4499         (Incremental_binary::get_input_reader): Change signature to use
4500         index instead of filename.
4501         (Incremental_binary::file_has_changed): New function.
4502         (Incremental_binary::get_input_argument): New function.
4503         (Incremental_binary::get_library): New function.
4504         (Incremental_binary::get_script_info): New function.
4505         (Incremental_binary::init_layout): New function.
4506         (Incremental_binary::reserve_layout): New function.
4507         (Incremental_binary::output_file): New function.
4508         (Incremental_binary::do_check_inputs): New function.
4509         (Incremental_binary::do_file_is_unchanged): Remove.
4510         (Incremental_binary::do_file_has_changed): New function.
4511         (Incremental_binary::do_init_layout): New function.
4512         (Incremental_binary::do_reserve_layout): New function.
4513         (Incremental_binary::do_input_file_count): New function.
4514         (Incremental_binary::do_get_input_reader): Change signature.
4515         (Incremental_binary::input_args_map_): New data member.
4516         (Incremental_binary::library_map_): New data member.
4517         (Incremental_binary::script_map_): New data member.
4518         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4519         new data members.
4520         (Sized_incremental_binary::output_section): New function.
4521         (Sized_incremental_binary::inputs_reader): Add const.
4522         (Sized_incremental_binary::symtab_reader): Add const.
4523         (Sized_incremental_binary::relocs_reader): Add const.
4524         (Sized_incremental_binary::got_plt_reader): Add const.
4525         (Sized_incremental_binary::get_symtab_view): New function.
4526         (Sized_incremental_binary::Inputs_reader): New typedef.
4527         (Sized_incremental_binary::Input_entry_reader): New typedef.
4528         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4529         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4530         (Sized_incremental_binary::do_file_has_changed): New function.
4531         (Sized_incremental_binary::do_init_layout): New function.
4532         (Sized_incremental_binary::do_reserve_layout): New function.
4533         (Sized_input_reader::Inputs_reader): Remove.
4534         (Sized_input_reader::Input_entry_reader): Remove.
4535         (Sized_input_reader::do_arg_serial): New function.
4536         (Sized_input_reader::do_get_unused_symbol_count): New function.
4537         (Sized_input_reader::do_get_unused_symbol): New function.
4538         (Sized_incremental_binary::do_input_file_count): New function.
4539         (Sized_incremental_binary::do_get_input_reader): Change signature;
4540         use index instead of filename.
4541         (Sized_incremental_binary::section_map_): New data member.
4542         (Sized_incremental_binary::input_entry_readers_): New data member.
4543         (class Sized_incr_relobj): New class.
4544         (class Sized_incr_dynobj): New class.
4545         (make_sized_incremental_object): New function.
4546         (class Incremental_library): New class.
4547         * layout.cc (Free_list::num_lists): New static data member.
4548         (Free_list::num_nodes): New static data member.
4549         (Free_list::num_removes): New static data member.
4550         (Free_list::num_remove_visits): New static data member.
4551         (Free_list::num_allocates): New static data member.
4552         (Free_list::num_allocate_visits): New static data member.
4553         (Free_list::init): New function.
4554         (Free_list::remove): New function.
4555         (Free_list::allocate): New function.
4556         (Free_list::dump): New function.
4557         (Free_list::print_stats): New function.
4558         (Layout_task_runner::run): Resize output file for incremental updates.
4559         (Layout::Layout): Initialize new data members.
4560         (Layout::set_incremental_base): New function.
4561         (Layout::init_fixed_output_section): New function.
4562         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4563         incremental updates.
4564         (Layout::create_gold_note): Do not create gold note section for
4565         incremental updates.
4566         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4567         for incremental updates.
4568         (Layout::set_section_offsets): For incremental updates, allocate space
4569         from free list.
4570         (Layout::create_symtab_sections): Layout with offsets relative to
4571         start of section; for incremental updates, allocate space from free
4572         list.
4573         (Layout::create_shdrs): For incremental updates, allocate space from
4574         free list.
4575         (Layout::finish_dynamic_section): For incremental updates, do not
4576         check --as-needed (fixed in subsequent patch).
4577         * layout.h (class Free_list): New class.
4578         (Layout::set_incremental_base): New function.
4579         (Layout::incremental_base): New function.
4580         (Layout::init_fixed_output_section): New function.
4581         (Layout::allocate): New function.
4582         (Layout::incremental_base_): New data member.
4583         (Layout::free_list_): New data member.
4584         * main.cc (main): Print Free_list statistics.
4585         * object.cc (Relobj::finalize_incremental_relocs): Add
4586         clear_counts parameter; clear counts only when clear_counts is set.
4587         (Sized_relobj::Sized_relobj): Initialize new base class.
4588         (Sized_relobj::do_layout): Don't report special sections.
4589         (Sized_relobj::do_for_all_local_got_entries): New function.
4590         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4591         symtab_off to all symbol table offsets.
4592         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4593         * object.h (class Got_offset_list): Move to top of file.
4594         (Object::Object): Allow case where input_file == NULL.
4595         (Object::~Object): Likewise.
4596         (Object::input_file): Assert that input_file != NULL.
4597         (Object::lock): Allow case where input_file == NULL.
4598         (Object::unlock): Likewise.
4599         (Object::is_locked): Likewise.
4600         (Object::token): Likewise.
4601         (Object::release): Likewise.
4602         (Object::is_incremental): New function.
4603         (Object::get_mtime): New function.
4604         (Object::for_all_local_got_entries): New function.
4605         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4606         (Object::set_is_in_system_directory): New function.
4607         (Object::is_in_system_directory): New function.
4608         (Object::do_is_incremental): New function.
4609         (Object::do_get_mtime): New function.
4610         (Object::do_for_all_local_got_entries): New function.
4611         (Object::is_in_system_directory_): New data member.
4612         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4613         (class Sized_relobj_base): New class.
4614         (class Sized_relobj): Derive from Sized_relobj_base.
4615         (class Sized_relobj::Symbols): Redeclare from base class.
4616         (class Sized_relobj::local_got_offset_list): Remove.
4617         (class Sized_relobj::Output_sections): Redeclare from base class.
4618         (class Sized_relobj::do_for_all_local_got_entries): New function.
4619         (class Sized_relobj::write_local_symbols): Add offset parameter.
4620         (class Sized_relobj::local_symbol_offset_): Update comment.
4621         (class Sized_relobj::local_dynsym_offset_): Update comment.
4622         * options.cc (Input_arguments::add_file): Remove const.
4623         * options.h (Input_file_argument::Input_file_argument):
4624         Initialize arg_serial_ (all constructors).
4625         (Input_file_argument::set_arg_serial): New function.
4626         (Input_file_argument::arg_serial): New function.
4627         (Input_file_argument::arg_serial_): New data member.
4628         (Input_arguments::Input_arguments): Initialize file_count_.
4629         (Input_arguments::add_file): Remove const.
4630         (Input_arguments::number_of_input_files): New function.
4631         (Input_arguments::file_count_): New data member.
4632         (Command_line::number_of_input_files): Call
4633         Input_arguments::number_of_input_files.
4634         * output.cc (Output_segment_headers::Output_segment_headers):
4635         Set current size.
4636         (Output_section::Input_section::current_data_size): New function.
4637         (Output_section::Output_section): Initialize new data members.
4638         (Output_section::add_input_section): Don't do merge sections for
4639         an incremental link; allocate space from free list for an
4640         incremental update.
4641         (Output_section::add_output_section_data): Allocate space from
4642         free list for an incremental update.
4643         (Output_section::update_data_size): New function.
4644         (Output_section::set_fixed_layout): New function.
4645         (Output_section::reserve): New function.
4646         (Output_segment::set_section_addresses): Remove const.
4647         (Output_segment::set_section_list_addresses): Remove const; allocate
4648         space from free list for an incremental update.
4649         (Output_segment::set_offset): Adjust size of RELRO segment for an
4650         incremental update.
4651         * output.h (Output_data::current_data_size): Move here from
4652         child classes.
4653         (Output_data::pre_finalize_data_size): New function.
4654         (Output_data::update_data_size): New function.
4655         (Output_section_headers::update_data_size): new function.
4656         (Output_section_data_build::current_data_size): Move to Output_data.
4657         (Output_data_strtab::update_data_size): New function.
4658         (Output_section::current_data_size): Move to Output_data.
4659         (Output_section::set_fixed_layout): New function.
4660         (Output_section::has_fixed_layout): New function.
4661         (Output_section::reserve): New function.
4662         (Output_section::update_data_size): New function.
4663         (Output_section::has_fixed_layout_): New data member.
4664         (Output_section::free_list_): New data member.
4665         (Output_segment::set_section_addresses): Remove const.
4666         (Output_segment::set_section_list_addresses): Remove const.
4667         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4668         New function.
4669         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4670         New function.
4671         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4672         parameter when calling Add_symbols constructor; store argument
4673         serial number for members of a lib group.
4674         (Add_symbols::locks): Allow case where token == NULL.
4675         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4676         (Read_member::~Read_member): New function.
4677         (Read_member::is_runnable): New function.
4678         (Read_member::locks): New function.
4679         (Read_member::run): New function.
4680         (Check_script::~Check_script): New function.
4681         (Check_script::is_runnable): New function.
4682         (Check_script::locks): New function.
4683         (Check_script::run): New function.
4684         (Check_library::~Check_library): New function.
4685         (Check_library::is_runnable): New function.
4686         (Check_library::locks): New function.
4687         (Check_library::run): New function.
4688         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4689         (Add_symbols::library_): New data member.
4690         (class Read_member): New class.
4691         (class Check_script): New class.
4692         (class Check_library): New class.
4693         * reloc.cc (Read_relocs::is_runnable): Allow case where
4694         token == NULL.
4695         (Read_relocs::locks): Likewise.
4696         (Scan_relocs::locks): Likewise.
4697         (Relocate_task::locks): Likewise.
4698         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4699         to clear counters.
4700         (Sized_relobj::incremental_relocs_scan): Fix comment.
4701         (Sized_relobj::do_relocate): Pass output file offset to
4702         write_local_symbols.
4703         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4704         from class declaration.
4705         * script.cc (read_input_script): Allocate Script_info; pass
4706         argument serial number to report_script.
4707         * script.h (class Script_info): Move to incremental.h.
4708         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4709         * symtab.h (Symbol_table::add_from_incrobj): New function.
4710         (Symbol_table::set_file_offset): New function.
4711
4712 2011-04-05  Cary Coutant  <ccoutant@google.com>
4713
4714         * incremental-dump.cc (dump_incremental_inputs): Change signature
4715         to take a Sized_incremental_binary; change caller.  Use readers
4716         in Sized_incremental_binary.
4717         * incremental.cc
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::do_check_inputs): Check
4722         has_incremental_info_ flag; move setup code to setup_readers;
4723         use input readers.
4724         (Sized_incremental_binary::do_file_is_unchanged): New function.
4725         (Sized_incremental_binary::do_get_input_reader): New function.
4726         * incremental.h (class Incremental_binary): Move to end of file.
4727         (Incremental_binary::file_is_unchanged): New function.
4728         (Incremental_binary::do_file_is_unchanged): New function.
4729         (Incremental_binary::Input_reader): New class.
4730         (Incremental_binary::get_input_reader): New function.
4731         (class Sized_incremental_binary): Move to end of file.
4732         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4733         input section reader classes.
4734         (Sized_incremental_binary::has_incremental_info): New function.
4735         (Sized_incremental_binary::inputs_reader): New function.
4736         (Sized_incremental_binary::symtab_reader): New function.
4737         (Sized_incremental_binary::relocs_reader): New function.
4738         (Sized_incremental_binary::got_plt_reader): New function.
4739         (Sized_incremental_binary::do_file_is_unchanged): New function.
4740         (Sized_incremental_binary::Sized_input_reader): New class.
4741         (Sized_incremental_binary::get_input_reader): New function.
4742         (Sized_incremental_binary::find_incremental_inputs_sections):
4743         Rename do_find_incremental_inputs_sections to this.
4744         (Sized_incremental_binary::setup_readers): New function.
4745         (Sized_incremental_binary::has_incremental_info_): New data member.
4746         (Sized_incremental_binary::inputs_reader_): New data member.
4747         (Sized_incremental_binary::symtab_reader_): New data member.
4748         (Sized_incremental_binary::relocs_reader_): New data member.
4749         (Sized_incremental_binary::got_plt_reader_): New data member.
4750         (Sized_incremental_binary::current_input_file_): New data member.
4751
4752 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4753
4754         PR gold/12640
4755         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4756         violation.
4757
4758 2011-03-30  Cary Coutant  <ccoutant@google.com>
4759
4760         * archive.cc (Archive::include_member): Adjust call to report_object.
4761         (Add_archive_symbols::run): Add script_info to call to
4762         report_archive_begin.
4763         (Lib_group::include_member): Adjust call to report_object.
4764         (Add_lib_group_symbols::run): Adjust call to report_object.
4765         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4766         blocks.  Add object count for script input files.
4767         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4768         script_info parameter; change all callers.
4769         (Incremental_inputs::report_object): Add script_info parameter;
4770         change all callers.
4771         (Incremental_inputs::report_script): Store backpointer to
4772         incremental info entry.
4773         (Output_section_incremental_inputs::set_final_data_size): Record
4774         additional information for scripts.
4775         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4776         * incremental.h (Incremental_script_entry::add_object): New function.
4777         (Incremental_script_entry::get_object_count): New function.
4778         (Incremental_script_entry::get_object): New function.
4779         (Incremental_script_entry::objects_): New data member; adjust
4780         constructor.
4781         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4782         (Incremental_inputs::report_object): Add script_info parameter.
4783         (Incremental_inputs_reader::get_object_count): New function.
4784         (Incremental_inputs_reader::get_object_offset): New function.
4785         * options.cc (Input_arguments::add_file): Return reference to
4786         new input argument.
4787         * options.h (Input_argument::set_script_info): New function.
4788         (Input_argument::script_info): New function.
4789         (Input_argument::script_info_): New data member; adjust all
4790         constructors.
4791         (Input_file_group::add_file): Return reference to new input argument.
4792         (Input_file_lib::add_file): Likewise.
4793         (Input_arguments::add_file): Likewise.
4794         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4795         * script.cc (Parser_closure::Parser_closure): Add script_info
4796         parameter; adjust all callers.
4797         (Parser_closure::script_info): New function.
4798         (Parser_closure::script_info_): New data member.
4799         (read_input_script): Report scripts earlier to incremental info.
4800         (script_add_file): Set script_info in Input_argument.
4801         (script_add_library): Likewise.
4802         * script.h (Script_options::Script_info): Rewrite class.
4803
4804 2011-03-29  Cary Coutant  <ccoutant@google.com>
4805
4806         * archive.cc (Library_base::should_include_member): Move
4807         method here from class Archive.
4808         (Archive::Archive): Initialize base class.
4809         (Archive::should_include_member): Move to base class.
4810         (Archive::do_for_all_unused_symbols): New function.
4811         (Add_archive_symbols::run): Remove redundant access to
4812         incremental_inputs.
4813         (Lib_group::Lib_group): Initialize base class.
4814         (Lib_group::do_filename): New function.
4815         (Lib_group::include_member): Pass pointer to Lib_group to
4816         report_object.
4817         (Lib_group::do_for_all_unused_symbols): New function.
4818         (Add_lib_group_symbols::run): Report archive information for
4819         incremental links.
4820         * archive.h (class Library_base): New base class.
4821         (class Archive): Derive from Library_base.
4822         (Archive::filename): Move to base class.
4823         (Archive::set_incremental_info): Likewise.
4824         (Archive::incremental_info): Likewise.
4825         (Archive::Should_include): Likewise.
4826         (Archive::should_include_member): Likewise.
4827         (Archive::Armap_entry): Remove.
4828         (Archive::Unused_symbol_iterator): Remove.
4829         (Archive::unused_symbols_begin): Remove.
4830         (Archive::unused_symbols_end): Remove.
4831         (Archive::do_filename): New function.
4832         (Archive::do_get_mtime): New function.
4833         (Archive::do_for_all_unused_symbols): New function.
4834         (Archive::task_): Move to base class.
4835         (Archive::incremental_info_): Likewise.
4836         (class Lib_group): Derive from Library_base.
4837         (Lib_group::do_filename): New function.
4838         (Lib_group::do_get_mtime): New function.
4839         (Lib_group::do_for_all_unused_symbols): New function.
4840         (Lib_group::task_): Move to base class.
4841         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4842         function.
4843         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4844         function.
4845         * incremental.cc (Incremental_inputs::report_archive_begin):
4846         Use Library_base; call library's get_mtime; add incremental inputs
4847         entry before members.
4848         (class Unused_symbol_visitor): New class.
4849         (Incremental_inputs::report_archive_end): Use Library_base; use
4850         visitor class to record unused symbols; don't add incremental inputs
4851         entry after members.
4852         (Incremental_inputs::report_object): Use Library_base.
4853         * incremental.h
4854         (Incremental_archive_entry::Incremental_archive_entry): Remove
4855         unused Archive parameter.
4856         (Incremental_inputs::report_archive_begin): Use Library_base.
4857         (Incremental_inputs::report_archive_end): Likewise.
4858         (Incremental_inputs::report_object): Likewise.
4859         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4860         function.
4861         * object.h (Object::for_all_global_symbols): New function.
4862         (Object::do_for_all_global_symbols): New function.
4863         (Sized_relobj::do_for_all_global_symbols): New function.
4864         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4865         function.
4866         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4867         function.
4868
4869 2011-03-27  Ian Lance Taylor  <iant@google.com>
4870
4871         * archive.cc (Archive::interpret_header): Return -1 if something
4872         goes wrong.  Change callers accordingly.
4873
4874 2011-03-25  Cary Coutant  <ccoutant@google.com>
4875
4876         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4877         * testsuite/Makefile.in: Regenerate.
4878
4879 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4880
4881         * plugin.cc (get_view): New.
4882         (Plugin::load): Pass get_view to the plugin.
4883         (Plugin_manager::get_view): New.
4884
4885 2011-03-21  Ian Lance Taylor  <iant@google.com>
4886
4887         * testsuite/final_layout.sh: Rewrite to not use dc.
4888         * testsuite/relro_test.sh: Fail if dc is not present.
4889
4890 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4891
4892         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4893         Change == to -eq.
4894         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4895         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4896         Change == to -eq.
4897         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4898         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4899
4900 2011-03-14  Ian Lance Taylor  <iant@google.com>
4901
4902         * script-sections.cc (Sort_output_sections::script_compare):
4903         Rename from is_before, change return type.
4904         (Sort_output_sections::operator()): Adjust accordingly.
4905
4906 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4907
4908         PR gold/12572
4909         * testsuite/odr_violation2.cc: Add comment to make all error line
4910         numbers double digits.
4911         * testsuite/debug_msg.sh: Adjust expected errors.
4912
4913 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4914
4915         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4916         but mark earlier ones as non-canonical
4917         (offset_to_iterator): Update search target and example
4918         (do_addr2line): Return extra lines in a vector*
4919         (format_file_lineno): Extract from do_addr2line
4920         (one_addr2line): Add vector* out-param
4921         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4922         when a lineno entry appeared last for its instruction
4923         (Dwarf_line_info): Add vector* out-param
4924         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4925         * symtab.cc (Odr_violation_compare): Include the lineno in the
4926         comparison again.
4927         (linenos_from_loc): New. Combine the canonical line for an
4928         address with its other lines.
4929         (True_if_intersect): New. Helper functor to make
4930         std::set_intersection a query.
4931         (detect_odr_violations): Compare sets of lines instead of just
4932         one line for each function. This became less deterministic, but
4933         has fewer false positives.
4934         * symtab.h: Declarations.
4935         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4936         mix an optimized and non-optimized object in the same binary
4937         (odr_violation2.so): Same.
4938         * testsuite/Makefile.in: Regenerate from Makefile.am.
4939         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4940         * testsuite/debug_msg.sh: Update line numbers and add
4941         assertions.
4942         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4943         non-optimized context.
4944         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4945         isn't inlined, and use OdrDerived in an optimized context.
4946         * testsuite/odr_header1.h: Defines OdrDerived, where
4947         optimization will change the
4948         first-instruction-in-the-destructor's file and line number.
4949         * testsuite/odr_header2.h: Defines OdrBase.
4950
4951 2011-03-09  Ian Lance Taylor  <iant@google.com>
4952
4953         * fileread.cc (File_read::clear_views): Don't delete the whole
4954         file view.
4955
4956 2011-03-08  Ian Lance Taylor  <iant@google.com>
4957
4958         PR gold/12525
4959         * fileread.cc: #include <climits>.
4960         (GOLD_IOV_MAX): Define.
4961         (File_read::read_multiple): Limit number of entries by iov_max.
4962         * fileread.h (class File_read): Always set max_readv_entries to
4963         128.
4964
4965 2011-03-07  Ian Lance Taylor  <iant@google.com>
4966
4967         PR gold/12525
4968         * options.h (class General_options): Add -dy and -dn.
4969
4970 2011-03-02  Cary Coutant  <ccoutant@google.com>
4971
4972         * testsuite/script_test_9.t: Add TLS segment.
4973
4974 2011-03-02  Simon Baldwin  <simonb@google.com>
4975
4976         * configure.ac: Add check for gnu_indirect_function support in
4977         the toolchain building binutils.
4978         * configure: Rebuild.
4979
4980 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4981
4982         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4983         plugin only symbols.
4984         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4985         in plugin files as not needed in the symbol table.
4986
4987 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4988
4989         * output.cc (Output_section::add_input_section): Delay fill
4990         generation for section ordering.
4991
4992 2011-02-09  Ian Lance Taylor  <iant@google.com>
4993
4994         PR gold/12316
4995         * object.h (class Sized_relobj): Remove clear_local_symbols.
4996         * reloc.cc (Sized_relobj::do_relocate): Don't call
4997         clear_local_symbols.
4998
4999 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5000
5001         * plugin.cc (is_visible_from_outside): Return true for symbols
5002         in the -u option.
5003
5004 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5005
5006         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5007         filename.
5008
5009 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5010
5011         * icf.h (is_section_foldable_candidate): Change type of parameter
5012         to std::string.
5013         * icf.cc (Icf::find_identical_sections): Change type of local variable
5014         section_name to be std::string.
5015         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5016
5017 2011-01-25  Ian Lance Taylor  <iant@google.com>
5018
5019         * script.cc (script_add_extern): Rewrite to use
5020         add_symbol_reference.
5021
5022 2011-01-25  Doug Kwan  <dougkwan@google.com>
5023
5024         * icf.cc (get_section_contents): Always lock section's object.
5025
5026 2011-01-24  Ian Lance Taylor  <iant@google.com>
5027
5028         * options.h (class General_options): Accept
5029         --no-detect-odr-violations.
5030
5031 2011-01-24  Ian Lance Taylor  <iant@google.com>
5032
5033         * version.cc (version_string): Bump to 1.11.
5034
5035 2011-01-24  Ian Lance Taylor  <iant@google.com>
5036
5037         * plugin.cc (class Plugin_rescan): Define new class.
5038         (Plugin_manager::claim_file): Set any_claimed_.
5039         (Plugin_manager::save_archive): New function.
5040         (Plugin_manager::save_input_group): New function.
5041         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5042         necessary.
5043         (Plugin_manager::new_undefined_symbol): New function.
5044         (Plugin_manager::rescan): New function.
5045         (Plugin_manager::rescannable_defines): New function.
5046         (Plugin_manager::add_input_file): Set any_added_.
5047         * plugin.h (class Plugin_manager): define new fields rescannable_,
5048         undefined_symbols_, any_claimed_, and any_added_.  Declare
5049         Plugin_rescan as friend.  Declare new functions.
5050         (Plugin_manager::Rescannable): Define type.
5051         (Plugin_manager::Rescannable_list): Define type.
5052         (Plugin_manager::Undefined_symbol_list): Define type.
5053         (Plugin_manager::Plugin_manager): Initialize new fields.
5054         * archive.cc (Archive::defines_symbol): New function.
5055         (Add_archive_symbols::run): Pass archive to plugins if any.
5056         * archive.h (class Archive): Declare defines_symbol.
5057         * readsyms.cc (Input_group::~Input_group): New function.
5058         (Finish_group::run): Pass input_group to plugins if any.
5059         * readsyms.h (class Input_group): Declare destructor.
5060         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5061         any.
5062
5063 2011-01-10  Ian Lance Taylor  <iant@google.com>
5064
5065         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5066         section as relro.
5067         (Layout::set_segment_offsets): Reset increase_relro before calling
5068         set_section_addresses a second time.
5069
5070 2011-01-04  Cary Coutant  <ccoutant@google.com>
5071
5072         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5073         sections before NOBITS sections.
5074
5075 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5076
5077         * version.cc (print_version): Update copyright to 2011.
5078
5079 2010-12-23  Cary Coutant  <ccoutant@google.com>
5080
5081         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5082         of OS to this->add.  Add OD parameter to second form of the function.
5083
5084 2010-12-20  Ian Lance Taylor  <iant@google.com>
5085
5086         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5087         second of two consecutive entries with same offset.
5088
5089 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5090
5091         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5092         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5093         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5094         to avoid unneeded links against $(LDADD).
5095         * testsuite/Makefile.in: Regenerate.
5096
5097 2010-12-15  Ian Lance Taylor  <iant@google.com>
5098
5099         PR gold/12324
5100         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5101         for R_X86_64_32 and R_X86_64_PC32.
5102         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5103         ver_matching_def_pic.o.
5104         (ver_matching_def_pic.o): New target.
5105
5106 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5107
5108         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5109         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5110         Move definition before File_read::View member definitions.
5111         (File_read::View::~View): Initialize and hold lock before
5112         updating current_mapped_bytes.
5113
5114 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5115
5116         * dwarf_reader.cc: Remove outdated comment.
5117         * gold-threads.cc: Fix typo in error message.
5118         * archive.cc: Fix typos in comments.
5119         * archive.h: Likewise.
5120         * arm-reloc-property.cc: Likewise.
5121         * arm-reloc-property.h: Likewise.
5122         * arm-reloc.def: Likewise.
5123         * arm.cc: Likewise.
5124         * attributes.h: Likewise.
5125         * cref.cc: Likewise.
5126         * ehframe.cc: Likewise.
5127         * fileread.h: Likewise.
5128         * gold.h: Likewise.
5129         * i386.cc: Likewise.
5130         * icf.cc: Likewise.
5131         * incremental.h: Likewise.
5132         * int_encoding.cc: Likewise.
5133         * layout.h: Likewise.
5134         * main.cc: Likewise.
5135         * merge.h: Likewise.
5136         * object.cc: Likewise.
5137         * object.h: Likewise.
5138         * options.cc: Likewise.
5139         * readsyms.cc: Likewise.
5140         * reduced_debug_output.cc: Likewise.
5141         * reloc.cc: Likewise.
5142         * script-sections.cc: Likewise.
5143         * sparc.cc: Likewise.
5144         * symtab.h: Likewise.
5145         * target-reloc.h: Likewise.
5146         * target.cc: Likewise.
5147         * target.h: Likewise.
5148         * timer.cc: Likewise.
5149         * timer.h: Likewise.
5150         * x86_64.cc: Likewise.
5151
5152 2010-12-09  Cary Coutant  <ccoutant@google.com>
5153
5154         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5155         stack.
5156         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5157         parameter; change all callers.
5158         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5159         * options.h (warn_execstack): New option.
5160
5161 2010-12-07  Doug Kwan  <dougkwan@google.com>
5162
5163         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5164         like function call relocations.
5165
5166 2010-12-07  Ian Lance Taylor  <iant@google.com>
5167
5168         * archive.cc (Archive::get_elf_object_for_member): Permit
5169         punconfigured to be NULL.
5170         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5171         (Archive::include_member): Pass NULL to get_elf_object_for_member
5172         if we searched for the archive and this is the first included
5173         object.
5174
5175 2010-12-01  Ian Lance Taylor  <iant@google.com>
5176
5177         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5178         track_relocs_type_ field.
5179         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5180         Set track_relocs_type_.
5181         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5182         contents when using RELA relocs.
5183         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5184         reloc_map_.
5185         * reloc.cc (Track_relocs::next_addend): New function.
5186         * reloc.h (class Track_relocs): Declare next_addend.
5187
5188 2010-12-01  Ian Lance Taylor  <iant@google.com>
5189
5190         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5191         virtual destructor.
5192
5193 2010-12-01  Ian Lance Taylor  <iant@google.com>
5194
5195         * README: Update compilers known to work and fail.
5196
5197 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5198
5199         * configure.in: For --enable-gold, handle value `default' instead of
5200         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5201         not the default.
5202         * configure: Regenerate.
5203
5204 2010-11-18  Doug Kwan  <dougkwan@google.com>
5205
5206         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5207         and right_alignment to be zero.  Store result alignment only if it is
5208         greater than existing alignment.
5209
5210 2010-11-16  Cary Coutant  <ccoutant@google.com>
5211
5212         PR gold/12220
5213         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5214         Check for ".zdebug_line".
5215
5216 2010-11-16  Doug Kwan  <dougkwan@google.com>
5217             Cary Coutant  <ccoutant@google.com>
5218
5219         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5220         by reference; adjust all callers.
5221         * output.cc (Output_segment::set_section_addresses): Adjust references
5222         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5223         list is empty.
5224         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5225         end at page boundary.
5226
5227 2010-11-16  Cary Coutant  <ccoutant@google.com>
5228
5229         PR gold/12220
5230         * layout.cc (Layout::choose_output_section): Transform names of
5231         compressed sections even when using a script with a SECTIONS clause.
5232         (Layout::output_section_name): Remove code to transform
5233         compressed debug section names.
5234         * output.cc (Output_section::add_input_section): Use uncompressed
5235         section size when tracking input sections.
5236
5237 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5238
5239         * symtab.h (Symbol::NON_PIC_REF): Remove.
5240         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5241         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5242         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5243         (Symbol::use_plt_offset): Take a flags argument and pass it
5244         directly to needs_dynamic_reloc.  Restrict check for undefined
5245         weak symbols to function calls.
5246         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5247         (Target_arm::Scan::global): Use it.
5248         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5249         (Target_arm::Relocate::relocate): Likewise.
5250         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5251         parameter with an r_type parameter.  Use get_reference_flags
5252         to get the flags.
5253         (Target_arm::Relocate::relocate): Update accordingly.
5254         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5255         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5256         (Target_i386::Scan::global): Likewise.
5257         (Target_i386::Relocate::relocate): Likewise.
5258         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5259         parameter with an r_type parameter.  Use get_reference_flags
5260         to get the flags.
5261         (Target_i386::Relocate::relocate): Update accordingly.
5262         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5263         (Target_powerpc::Scan::global): Use it.
5264         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5265         (Target_powerpc::Relocate::relocate): Likewise.
5266         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5267         (Target_sparc::Scan::global): Use it.
5268         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5269         (Target_sparc::Relocate::relocate): Likewise.
5270         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5271         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5272         (Target_x86_64::Scan::global): Likewise.
5273         (Target_x86_64::Relocate::relocate): Likewise.
5274
5275 2010-11-08  Doug Kwan  <dougkwan@google.com>
5276             Cary Coutant  <ccoutant@google.com>
5277
5278         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5279         (Arm_exidx_merge_section::section_contents_): New data member.
5280         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5281         (Arm_input_section::~Arm_input_section): De-allocate memory.
5282         (Arm_input_section::original_contents_): New data member.
5283         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5284         in parameters instead of calling Object::section_contents without
5285         locking.
5286         (Arm_output_section::group_section): New parameter TASK.  Pass it
5287         to callees that need locking objects.
5288         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5289         to lock EXIDX input sections.  Fix a formatting issue.  Call
5290         Arm_exidx_merged_section::build_contents to create merged section
5291         contents.
5292         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5293         to lock object of stub table owner.
5294         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5295         TEXT_SIZE to initialize data member TEXT_SIZE_.
5296         (Arm_exidx_input_section::addralign): Fix typo in comment.
5297         (Arm_exidx_input_section::text_size): New method.
5298         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5299         that require locking objects.  Lock objects before scanning for stubs
5300         and updating local symbols.
5301         (Arm_input_section<big_endian>::init): Copy contents of original
5302         input section.
5303         (Arm_input_section<big_endian>::do_write): Use saved contents of
5304         original input section instead of calling Object::section_contents
5305         without locking.
5306         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5307         size without calling Object::section_size().
5308         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5309         for size.  Allocate a buffer for merged EXIDX entries.
5310         (Arm_exidx_merged_section::build_contents): New method.
5311         (Arm_exidx_merged_section::do_write): Move merge section contents
5312         building code to Arm_exidx_merged_section::build_contetns.  Write
5313         out contetns in buffer instead of building it on the fly.
5314         (Arm_relobj::make_exidx_input_section): Also pass text section size
5315         to Arm_exidx_input_section constructor.
5316         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5317         (Arm_dynobj::do_read_symbols): Fix memory leak.
5318         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5319         * target.h: (class Task): Add forward declaration.
5320         (Target::relax): Add new parameter TASK and pass it to
5321         Target::do_relax().
5322         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5323
5324 2010-11-05  Cary Coutant  <ccoutant@google.com>
5325
5326         PR gold/10708
5327         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5328         object when reading from the file.
5329         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5330         second layout pass.
5331         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5332         when reading section contents.
5333         (get_section_contents): Likewise.
5334         (icf::find_identical_sections): Likewise.
5335         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5336         object when reading from the file.
5337         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5338         the object when doing deferred section layout.
5339
5340 2010-11-03  Nick Clifton  <nickc@redhat.com>
5341
5342         PR gold/12001
5343         * script.h (class Symbol_assignment: name): New member.  Returns
5344         the name of the symbol.
5345         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5346         Returns true if the given symbol name is on the list of
5347         assignments wating to be processed.
5348         * archive.cc (should_incldue_member): If the symbol is undefined,
5349         check to see if it is on the list of symbols pending assignment.
5350
5351 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5352
5353         * script-sections.cc (Script_sections::find_memory_region): Check
5354         for a NULL output section pointer.
5355
5356 2010-10-29  Doug Kwan  <dougkwan@google.com>
5357
5358         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5359         Output_section::add_relaxed_input_section.
5360         * output.cc (Output_section::add_relaxed_input_section): Add new
5361         arguments LAYOUT and NAME.  Set section order index.
5362         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5363         Copy section order index.
5364         * output.h (Output_section::add_relaxed_input_section): Add new
5365         arguments LAYOUT and NAME.
5366
5367 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5368
5369         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5370         NATIVE_OR_CROSS_LINKER.
5371         * testsuite/Makefile.in: Regenerate.
5372
5373 2010-10-20  Doug Kwan  <dougkwan@google.com>
5374
5375         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5376         without SHF_LINK_ORDER flags.
5377         * layout.cc (Layout::choose_output_section): Do not filter
5378         SHF_LINK_ORDER flag in a relocatable link.
5379
5380 2010-10-17  Cary Coutant  <ccoutant@google.com>
5381
5382         * output.h (Output_segment::set_section_addresses): Change function
5383         signature.  Update all callers.
5384         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5385         sections.
5386         (Output_segment::set_section_addresses): Align after last TLS
5387         section.  Add padding before last relro section instead of after.
5388
5389 2010-10-17  Doug Kwan  <dougkwan@google.com>
5390
5391         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5392         GOT output section to be writable.
5393
5394 2010-10-14  Cary Coutant  <ccoutant@google.com>
5395
5396         * debug.h (DEBUG_INCREMENTAL): New flag.
5397         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5398         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5399         mode.
5400         * incremental.cc (report_command_line): Ignore all forms of
5401         --incremental.
5402         * layout.cc (Layout::Layout): Check parameters for incremental link
5403         mode.
5404         * options.cc (General_options::parse_incremental): New function.
5405         (General_options::parse_no_incremental): New function.
5406         (General_options::parse_incremental_full): New function.
5407         (General_options::parse_incremental_update): New function.
5408         (General_options::incremental_mode_): New data member.
5409         (General_options::finalize): Check incremental_mode_.
5410         * options.h (General_options): Update help text for --incremental.
5411         Add --no-incremental, --incremental-full, --incremental-update.
5412         (General_options::Incremental_mode): New enum type.
5413         (General_options::incremental_mode): New function.
5414         (General_options::incremental_mode_): New data member.
5415         * parameters.cc (Parameters::incremental_mode_): New data member.
5416         (Parameters::set_options): Set incremental_mode_.
5417         (Parameters::set_incremental_full): New function.
5418         (Parameters::incremental): New function.
5419         (Parameters::incremental_update): New function.
5420         (set_parameters_incremental_full): New function.
5421         * parameters.h (Parameters::set_incremental_full): New function.
5422         (Parameters::incremental): New function.
5423         (Parameters::incremental_update): New function.
5424         (Parameters::incremental_mode_): New data member.
5425         (set_parameters_incremental_full): New function.
5426         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5427         incremental link mode.
5428         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5429         (Sized_relobj::do_relocate_sections): Likewise.
5430         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5431         option.
5432         * testsuite/Makefile.in: Regenerate.
5433         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5434
5435 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5436
5437         * script-sections.h (class Script_sections): Make
5438         Sections_elements typedef public.
5439         * script-sections.cc (class Sort_output_sections): Add elements_
5440         field.  Add constructor which sets it; change all callers.
5441         (Sort_output_sections::is_before): New function.
5442         (Sort_output_sections::operator()): Call is_before.
5443         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5444         conditional.
5445         * testsuite/script_test_10.sh: New test. Test script section
5446         order.
5447         * testsuite/script_test_10.t: Likewise.
5448         * testsuite/script_test_10.s: Likewise.
5449         * testsuite/Makefile.am: Wrap the cross linker tests and the
5450         common tests into NATIVE_OR_CROSS_LINKER.
5451         (check_SCRIPTS): Add script_test_10.sh.
5452         (check_DATA): Add script_test_10.stdout.
5453         (script_test_10.o, script_test_10): New targets.
5454         (script_test_10.stdout): New target.
5455         * configure, testsuite/Makefile.in: Regenerate.
5456
5457 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5458
5459         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5460         error for the deprecated relocations.
5461         (Target_arm::Scan::global): Likewise.
5462         (Target_arm::Relocate::relocate): Likewise.
5463
5464 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5465
5466         * fileread.cc (Input_file::find_file): Initialize *found_name
5467         and *namep when using the fallback search for case 4.
5468
5469 2010-10-11  Cary Coutant  <ccoutant@google.com>
5470
5471         * options.h (class General_options): Redefine -z lazy as an alias for
5472         the negation of -z now.
5473
5474 2010-10-11  Ian Lance Taylor  <iant@google.com>
5475
5476         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5477         binding.
5478
5479 2010-10-06  Nick Clifton  <nickc@redhat.com>
5480
5481         * script-sections.cc(class Memory_region): Remove
5482         current_lma_offset_ field.  Rename current_vma_offset_ to
5483         current_offset_.  Add last_section_ field.
5484         (Memory_region::get_current_vma_address): Rename to
5485         get_current_address.
5486         (Memory_region::get_current_lma_address): Delete.
5487         (Memory_region::increment_vma_offset): Rename to
5488         increment_offset.
5489         (Memory_region::increment_lma_offset): Delete.
5490         (Memory_region::attributes_compatible): New method.  Returns
5491         true if the provided section is compatible with the region.
5492         (Memory_region::get_last_section): New method.  Returns the last
5493         section to use the region.
5494         (Memory_region::set_last_section): New method.  Stores the last
5495         section to use the region.
5496         (Script_sections::block_in_region): New method.  Returns true if
5497         a block of memory is contained within a region.
5498         (Script_sections::find_memory_region): New method.  Locates a
5499         memory region to be used to set a VMA or LMA address.
5500         (Output_section_definition::set_section_addresses): Add code to
5501         check for addresses set by memory regions.
5502         (Output_segment::set_section_addresses): Remove memory region
5503         walking code.
5504         (Script_sections::create_segment): Add a warning if a header
5505         segment is created outside of any region.
5506         * script-sections.h (class Script_sections): Add prototypes for
5507         find_memory_region and block_in_region methods.
5508         * testsuite/memory_test.s: Use .long instead of .word.
5509         * testsuite/memory_test.t: Add some more output sections.
5510         * testsuite/memory_test.sh: Update expected output.
5511
5512 2010-10-02  Doug Kwan  <dougkwan@google.com>
5513
5514         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5515         defintion to symtab.h
5516         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5517         declaration to defintion.
5518
5519 2010-10-01  Nick Clifton  <nickc@redhat.com>
5520
5521         * expression.cc (eval): Replace dummy argument with NULL.
5522         (eval_maybe_dot): Check for a NULL result section pointer.
5523         (Symbol_expression::value): Likewise.
5524         (Dot_expression::value): Likewise.
5525         (BINARY_EXPRESSION): Likewise.
5526         (Max_expression::value): Likewise.
5527         (Min_expression::value): Likewise.
5528         (Absolute_expression::value): Likewise.
5529         (Addr_expression::value_from_output_section): Likewise.
5530         (Loaddddr_expression::value_from_output_section): Likewise.
5531         (Segment_start_expression::value): Likewise.
5532         * script-sections.cc
5533         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5534         argument with NULL.
5535         (Sections_elememt_dot_assignment::set_section_addresses):
5536         Likewise.
5537         (Output_data_expression::do_write_to_buffer): Likewise.
5538         (Output_section_definition::finalize_symbols): Likewise.
5539         (Output_section_definition::set_section_addresses): Likewise.
5540
5541 2010-09-30  Doug Kwan  <dougkwan@google.com>
5542
5543         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5544
5545 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5546
5547         * target.h (Target::can_icf_inline_merge_sections): New virtual
5548         function.
5549         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5550         virtual function.
5551         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5552         virtual function.
5553         * icf.cc (get_section_contents): Inline merge sections only when
5554         target allows it.
5555
5556 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5557
5558         * configure: Regenerate.
5559
5560 2010-09-17  Ian Lance Taylor  <iant@google.com>
5561
5562         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5563         * testsuite/Makefile.am (memory_test.o): New target.
5564         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5565         memory_test.t.
5566         * testsuite/Makefile.in: Rebuild.
5567
5568 2010-09-17  Doug Kwan  <dougkwan@google.com>
5569
5570         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5571         defintion if relocation uses GOT entries of the symbol.
5572         * testsuite/icf_safe_test.sh: Fix test.
5573         * testsuite/icf_safe_so_test.sh: Fix test.
5574
5575 2010-09-16  Cary Coutant  <ccoutant@google.com>
5576
5577         * script_sections.cc (class Memory_region): Remove "NULL" from
5578         vector initializations.
5579
5580 2010-09-15  Cary Coutant  <ccoutant@google.com>
5581
5582         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5583         Resolve forwarding symbols.
5584
5585 2010-09-15  Doug Kwan  <dougkwan@google.com>
5586
5587         * gold/testsuite/script_test_3.t: Add ARM special sections.
5588         * gold/testsuite/script_test_4.t: Same.
5589         * gold/testsuite/script_test_5.t: Same.
5590         * gold/testsuite/script_test_6.t: Same.
5591         * gold/testsuite/script_test_7.t: Same.
5592         * gold/testsuite/script_test_7.t: Same.
5593         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5594
5595 2010-09-14  Cary Coutant  <ccoutant@google.com>
5596
5597         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5598         (Target_x86_64::Relocate::relocate_tls): Replace check for
5599         saw_tls_block_reloc_ with test for executable section.
5600
5601 2010-09-12  Cary Coutant  <ccoutant@google.com>
5602
5603         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5604         position-independent executables to shared libraries need dynamic
5605         relocations.
5606         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5607         position-independent executables.
5608         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5609         * testsuite/Makefile.in: Regenerate.
5610
5611 2010-09-10  Nick Clifton  <nickc@redhat.com>
5612
5613         PR gold/11997
5614         * testsuite/memory_test.t: Discard any sections that are not
5615         needed.
5616
5617 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5618
5619         PR gold/11996
5620         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5621         "This::" to work around a bug in gcc 4.2.
5622
5623         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5624
5625 2010-09-09  Rafael Espindola  <espindola@google.com>
5626
5627         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5628         sections with different PF_X flags in the same segment.
5629         (Layout::find_first_load_seg): Search all segments to find the first
5630         one.
5631         * options.h (rosegment): New.
5632
5633 2010-09-08  Rafael Espindola  <espindola@google.com>
5634
5635         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5636
5637 2010-09-08  Doug Kwan  <dougkwan@google.com>
5638
5639         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5640         (Arm_relobj::do_relocate_sections): Add new parameter for output
5641         file to match the parent.
5642         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5643         of local symbols instead of input values.  Update code to track
5644         changes in gold::relocate_section.
5645         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5646         (Sized_relobj::compute_final_local_value_internal): New methods.
5647         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5648         body into private version of Sized_relobj::compute_final_local_value.
5649         Call the inline method.
5650         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5651         merged symbol value if there is one.
5652         (Symbol_value::has_output_value): New method defintiion.
5653         (Sized_relobj::Compute_final_local_value_status): New enum type.
5654         (Sized_relobj::compute_final_local_value): New methods.
5655         (Sized_relobj::compute_final_local_value_internal): New methods.
5656         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5657         and arm_cortex_a8.sh.
5658         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5659         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5660         New tests.
5661         * Makefile.in: Regenerate.
5662         * testsuite/arm_bl_out_of_range.s: Update test.
5663         * testsuite/thumb_bl_out_of_range.s: Ditto.
5664         * testsuite/thumb_blx_out_of_range.s: Ditto.
5665         * testsuite/arm_branch_out_of_range.sh: New file.
5666         * testsuite/arm_cortex_a8.sh: Ditto.
5667         * testsuite/arm_cortex_a8_b.s: Ditto.
5668         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5669         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5670         * testsuite/arm_cortex_a8_bl.s: Ditto.
5671         * testsuite/arm_cortex_a8_blx.s: Ditto.
5672         * testsuite/arm_cortex_a8_local.s: Ditto.
5673         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5674         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5675
5676 2010-09-08  Rafael Espindola  <espindola@google.com>
5677
5678         * Makefile.am (memory_test.stdout): Run readelf with -W.
5679         * Makefile.in: Regenerate.
5680         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5681         64 bit output.
5682
5683 2010-09-08  Rafael Espindola  <espindola@google.com>
5684
5685         * script-sections.cc (Script_sections::add_memory_region): Convert
5686         field precision to int.
5687         * script.cc (script_set_section_region, script_set_section_region):
5688         Convert field precision to int.
5689
5690 2010-09-08  Rafael Espindola  <espindola@google.com>
5691
5692         * arm.cc (do_finalize_sections): Create the __exidx_start and
5693         __exdix_end symbols even when the section is missing.
5694
5695 2010-09-08  Nick Clifton  <nickc@redhat.com>
5696
5697         * README: Remove claim that MEMORY is not supported.
5698         * expression.cc (script_exp_function_origin)
5699         (script_exp_function_length): Move from here to ...
5700         * script.cc: ... here.
5701         (script_set_section_region, script_add_memory)
5702         (script_parse_memory_attr, script_include_directive): New
5703         functions.
5704         * script-sections.cc
5705         (class Memory_region): New class.
5706         (class Output_section_definition): Add set_memory_region,
5707         set_section_vma, set_section_lma and get_section_name methods.
5708         (class Script_Sections): Add add_memory_region,
5709         find_memory_region, find_memory_region_origin,
5710         find_memory_region_length and set_memory_region methods.
5711         Have set_section_addresses method walk the list of set memory
5712         regions.
5713         Extend the print methos to display memory regions.
5714         * script-sections.h: Add prototypes for new methods.
5715         Add enum for MEMORY region attributes.
5716         * yyscript.y: Add support for parsing MEMORY regions.
5717         * script-c.h: Add prototypes for new functions.
5718         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5719         * testsuite/Makefile.in: Regenerate.
5720         * testsuite/memory_test.sh: New script.
5721         * testsuite/memory_test.s: New assembler source file.
5722         * testsuite/memory_test.t: New linker script.
5723
5724 2010-08-27  Doug Kwan  <dougkwan@google.com>
5725
5726         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5727         reference override an existing dynamic weak reference.
5728         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5729         * testsuite/Makefile.in: Regenerate.
5730         * testsuite/dyn_weak_ref.sh: New file.
5731         * testsuite/dyn_weak_ref_1.c: Ditto.
5732         * testsuite/dyn_weak_ref_2.c: Ditto.
5733
5734 2010-08-27  Ian Lance Taylor  <iant@google.com>
5735
5736         * incremental.h (class Incremental_input_entry): Add virtual
5737         destructor.
5738
5739 2010-08-27  Ian Lance Taylor  <iant@google.com>
5740
5741         * testsuite/start_lib_test_3.c: Mark t3 as used.
5742
5743 2010-08-27  Nick Clifton  <nickc@redhat.com>
5744
5745         * options.cc (version_script): Fix small typo in previous
5746         whitespace tidyup.
5747
5748 2010-08-25  Nick Clifton  <nickc@redhat.com>
5749
5750         * archive.cc: Formatting fixes: Remove whitespace between
5751         typename and following asterisk.  Remove whitespace between
5752         function name and opening parenthesis.
5753         * archive.h: Likewise.
5754         * arm.cc: Likewise.
5755         * attributes.cc: Likewise.
5756         * attributes.h: Likewise.
5757         * common.cc: Likewise.
5758         * copy-relocs.cc: Likewise.
5759         * dirsearch.h: Likewise.
5760         * dynobj.cc: Likewise.
5761         * ehframe.cc: Likewise.
5762         * ehframe.h: Likewise.
5763         * expression.cc: Likewise.
5764         * fileread.cc: Likewise.
5765         * fileread.h: Likewise.
5766         * gc.h: Likewise.
5767         * gold-threads.cc: Likewise.
5768         * gold.cc: Likewise.
5769         * i386.cc: Likewise.
5770         * icf.h: Likewise.
5771         * incremental-dump.cc: Likewise.
5772         * incremental.cc: Likewise.
5773         * layout.cc: Likewise.
5774         * layout.h: Likewise.
5775         * main.cc: Likewise.
5776         * merge.cc: Likewise.
5777         * merge.h: Likewise.
5778         * object.cc: Likewise.
5779         * object.h: Likewise.
5780         * options.cc: Likewise.
5781         * options.h: Likewise.
5782         * output.cc: Likewise.
5783         * output.h: Likewise.
5784         * plugin.cc: Likewise.
5785         * plugin.h: Likewise.
5786         * powerpc.cc: Likewise.
5787         * reloc.cc: Likewise.
5788         * script-c.h: Likewise.
5789         * script-sections.cc: Likewise.
5790         * script.cc: Likewise.
5791         * stringpool.cc: Likewise.
5792         * symtab.cc: Likewise.
5793         * symtab.h: Likewise.
5794         * target.cc: Likewise.
5795         * timer.cc: Likewise.
5796         * timer.h: Likewise.
5797         * version.cc: Likewise.
5798         * x86_64.cc: Likewise.
5799
5800 2010-08-24  Nick Clifton  <nickc@redhat.com>
5801
5802         PR 11899
5803         * layout.cc (segment_precedes): Sort segments by their physical
5804         addresses, if they have been set.
5805
5806 2010-08-23  Cary Coutant  <ccoutant@google.com>
5807
5808         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5809         symbols data.
5810         (Lib_group::include_member): Unlock object after deleting its
5811         symbols data.
5812         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5813         the bug fixed here.
5814
5815 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5816             Cary Coutant  <ccoutant@google.com>
5817
5818         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5819         constructor, and set_blocker.
5820         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5821         readsyms_blocker_.
5822         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5823         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5824         * testsuite/Makefile.am (start_lib_test): New test case.
5825         * testsuite/Makefile.in: Regenerate.
5826         * testsuite/start_lib_test_main.c: New file.
5827         * testsuite/start_lib_test_1.c: New file.
5828         * testsuite/start_lib_test_2.c: New file.
5829         * testsuite/start_lib_test_3.c: New file.
5830
5831 2010-08-19  Ian Lance Taylor  <iant@google.com>
5832
5833         * Makefile.in: Rebuild with automake 1.11.1.
5834         * aclocal.m4: Likewise.
5835         * testsuite/Makefile.in: Likewise.
5836
5837 2010-08-19  Ian Lance Taylor  <iant@google.com>
5838
5839         PR 10893
5840         * i386.cc (class Output_data_plt_i386): Update declarations.
5841         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5842         local_ifuncs_ fields.
5843         (Target_i386::do_plt_section_for_global): New function.
5844         (Target_i386::do_plt_section_for_local): New function.
5845         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5846         parameter; change all callers.  Initialize global_ifuncs_ and
5847         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5848         __rel_iplt_end.
5849         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5850         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5851         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5852         symbols.
5853         (Target_i386::make_plt_section): New function, broken out of
5854         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5855         (Target_i386::make_plt_entry): Call make_plt_section.
5856         (Target_i386::make_local_ifunc_plt_entry): New function.
5857         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5858         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5859         R_386_IRELATIVE to switch.
5860         (Target_i386::Scan::global): Likewise.
5861         (Target_i386::Relocate::relocate): Likewise.
5862         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5863         switch.
5864         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5865         (Target_x86_64::do_plt_section_for_global): New function.
5866         (Target_x86_64::do_plt_section_for_local): New function.
5867         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5868         parameter; change all callers.  If doing a static link define
5869         __rela_iplt_start and __rela_iplt_end.
5870         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5871         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5872         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5873         to point to .plt.
5874         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5875         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5876         switch.
5877         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5878         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5879         R_X86_64_IRELATIVE to switch.
5880         (Target_x86_64::Scan::global): Likewise.
5881         (Target_x86_64::Relocate::relocate): Likewise.
5882         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5883         switch.
5884         * target.h (class Target): Add plt_section_for_global and
5885         plt_section_for_local functions.  Add do_plt_section_for_global
5886         and do_plt_section_for_local virtual functions.
5887         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5888         clarifying comments.
5889         (Symbol::use_plt_offset): Handle IFUNC symbol.
5890         * object.cc (Sized_relobj::Sized_relobj): Initialize
5891         local_plt_offsets_.
5892         (Sized_relobj::local_has_plt_offset): New function.
5893         (Sized_relobj::local_plt_offset): New function.
5894         (Sized_relobj::set_local_plt_offset): New function.
5895         (Sized_relobj::do_count): Handle IFUNC symbol.
5896         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5897         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5898         is_ifunc_symbol functions.
5899         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5900         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5901         local_plt_offsets_ field.
5902         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5903         * output.h (class Output_section_data): Add non-const
5904         output_section function.
5905         (class Output_data_got): Update declarations.
5906         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5907         Add use_plt_offset parameter to global and local constructors.
5908         Change all callers.  Change local_sym_index_ field to 31 bits.
5909         Change GSYM_CODE and CONSTANT_CODE accordingly.
5910         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5911         doing a static link don't set sh_link field.
5912         (Output_data_got::Got_entry::write): Use PLT offset if
5913         appropriate.
5914         (Output_data_got::add_global_plt): New function.
5915         (Output_data_got::add_local_plt): New function.
5916         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5917         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5918         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5919         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5920         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5921         IFUNC conditional.
5922         * testsuite/ifunc-sel.h: New file.
5923         * testsuite/ifuncmain1.c: New file.
5924         * testsuite/ifuncmain1vis.c: New file.
5925         * testsuite/ifuncmod1.c: New file.
5926         * testsuite/ifuncdep2.c: New file.
5927         * testsuite/ifuncmain2.c: New file.
5928         * testsuite/ifuncmain3.c: New file.
5929         * testsuite/ifuncmod3.c: New file.
5930         * testsuite/ifuncmain4.c: New file.
5931         * testsuite/ifuncmain5.c: New file.
5932         * testsuite/ifuncmod5.c: New file.
5933         * testsuite/ifuncmain6pie.c: New file.
5934         * testsuite/ifuncmod6.c: New file.
5935         * testsuite/ifuncmain7.c: New file.
5936         * configure, testsuite/Makefile.in: Rebuild.
5937
5938 2010-08-18  Ian Lance Taylor  <iant@google.com>
5939
5940         * incremental.cc
5941         (Output_section_incremental_inputs::write_input_files): Add cast
5942         to avoid signed/unsigned comparison warning.
5943         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5944
5945 2010-08-12  Cary Coutant  <ccoutant@google.com>
5946
5947         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5948
5949 2010-08-13  Ian Lance Taylor  <iant@google.com>
5950
5951         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5952
5953 2010-08-12  Cary Coutant  <ccoutant@google.com>
5954             Doug Kwan  <dougkwan@google.com>
5955
5956         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5957         defintion overrides non-weak undef, remember that the original undef
5958         is not weak.
5959         * symtab.cc (Symbol_table::sized_write_global): For undef without
5960         an original weak binding, set binding to global in output.
5961         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5962         * testsuite/Makefile.in: Regenerate.
5963         * testsuite/strong_ref_weak_def.sh: New file.
5964         * testsuite/strong_ref_weak_def_1.c: Ditto.
5965         * testsuite/strong_ref_weak_def_2.c: Ditto.
5966
5967 2010-08-12  Cary Coutant  <ccoutant@google.com>
5968
5969         * testsuite/incremental_test.sh: Rewrite.
5970         * testsuite/incremental_test_1.c: Rewrite.
5971         * testsuite/incremental_test_2.c: Rewrite.
5972
5973 2010-08-12  Cary Coutant  <ccoutant@google.com>
5974
5975         * arm.cc (Target_arm::got_size): Add const.
5976         (Target_arm::got_entry_count): New function.
5977         (Target_arm::plt_entry_count): New function.
5978         (Target_arm::first_plt_entry_offset): New function.
5979         (Target_arm::plt_entry_size): New function.
5980         (Output_data_plt_arm::entry_count): New function.
5981         (Output_data_plt_arm::first_plt_entry_offset): New function.
5982         (Output_data_plt_arm::get_plt_entry_size): New function.
5983         * i386.cc (Target_i386::got_size): Add const.
5984         (Target_i386::got_entry_count): New function.
5985         (Target_i386::plt_entry_count): New function.
5986         (Target_i386::first_plt_entry_offset): New function.
5987         (Target_i386::plt_entry_size): New function.
5988         (Output_data_plt_i386::entry_count): New function.
5989         (Output_data_plt_i386::first_plt_entry_offset): New function.
5990         (Output_data_plt_i386::get_plt_entry_size): New function.
5991         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5992         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5993         * incremental.cc: Include target.h.
5994         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5995         parameter.  Adjust all callers.  Find incremental_got_plt section.
5996         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5997         section.
5998         (Output_section_incremental_inputs::set_final_data_size): Calculate
5999         size of incremental_got_plt section.
6000         (Output_section_incremental_inputs::do_write): Write the
6001         incremental_got_plt section.
6002         (Got_plt_view_info): New struct.
6003         (Local_got_offset_visitor): New class.
6004         (Global_got_offset_visitor): New class.
6005         (Global_symbol_visitor_got_plt): New class.
6006         (Output_section_incremental_inputs::write_got_plt): New function.
6007         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6008         Add parameter.  Adjust all callers.
6009         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6010         (Incremental_inputs::got_plt_section): New function.
6011         (Incremental_inputs::got_plt_section_): New data member.
6012         (Incremental_got_plt_reader): New class.
6013         * layout.cc (Layout::create_incremental_info_sections): Add the
6014         incremental_got_plt section.
6015         * object.h (Got_offset_list::get_list): New function.
6016         (Got offset_list::for_all_got_offsets): New function.
6017         (Sized_relobj::local_got_offset_list): New function.
6018         * powerpc.cc (Target_powerpc::got_size): Add const.
6019         (Target_powerpc::got_entry_count): New function.
6020         (Target_powerpc::plt_entry_count): New function.
6021         (Target_powerpc::first_plt_entry_offset): New function.
6022         (Target_powerpc::plt_entry_size): New function.
6023         (Output_data_plt_powerpc::entry_count): New function.
6024         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6025         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6026         * sparc.cc (Target_sparc::got_size): Add const.
6027         (Target_sparc::got_entry_count): New function.
6028         (Target_sparc::plt_entry_count): New function.
6029         (Target_sparc::first_plt_entry_offset): New function.
6030         (Target_sparc::plt_entry_size): New function.
6031         (Output_data_plt_sparc::entry_count): New function.
6032         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6033         (Output_data_plt_sparc::get_plt_entry_size): New function.
6034         * symtab.h (Symbol::got_offset_list): New function.
6035         (Symbol_table::for_all_symbols): New function.
6036         * target.h (Sized_target::got_entry_count): New function.
6037         (Sized_target::plt_entry_count): New function.
6038         (Sized_target::plt_entry_size): New function.
6039         * x86_64.cc (Target_x86_64::got_size): Add const.
6040         (Target_x86_64::got_entry_count): New function.
6041         (Target_x86_64::plt_entry_count): New function.
6042         (Target_x86_64::first_plt_entry_offset): New function.
6043         (Target_x86_64::plt_entry_size): New function.
6044         (Output_data_plt_x86_64::entry_count): New function.
6045         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6046         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6047
6048 2010-08-12  Cary Coutant  <ccoutant@google.com>
6049
6050         * archive.cc: Include incremental.h.
6051         (Archive::Archive): Initialize incremental_info_.
6052         (Archive::include_member): Record archive members in incremental info.
6053         (Add_archive_symbols::run): Record begin and end of an archive in
6054         incremental info.
6055         (Lib_group::include_member): Record objects in incremental info.
6056         * archive.h (Incremental_archive_entry): Forward declaration.
6057         (Archive::set_incremental_info): New member function.
6058         (Archive::incremental_info): New member function.
6059         (Archive::Unused_symbol_iterator): New class.
6060         (Archive::unused_symbols_begin): New member function.
6061         (Archive::unused_symbols_end): New member function.
6062         (Archive::incremental_info_): New data member.
6063         * incremental-dump.cc (find_input_containing_global): New function.
6064         (dump_incremental_inputs): Dump new incremental info sections.
6065         * incremental.cc: Include symtab.h.
6066         (Output_section_incremental_inputs): New class.
6067         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6068         new incremental info sections.
6069         (Sized_incremental_binary::do_check_inputs): Likewise.
6070         (Incremental_inputs::report_archive): Remove.
6071         (Incremental_inputs::report_archive_begin): New function.
6072         (Incremental_inputs::report_archive_end): New function.
6073         (Incremental_inputs::report_object): New function.
6074         (Incremental_inputs::finalize_inputs): Remove.
6075         (Incremental_inputs::report_input_section): New function.
6076         (Incremental_inputs::report_script): Rewrite.
6077         (Incremental_inputs::finalize): Do nothing but finalize string table.
6078         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6079         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6080         (Incremental_inputs::create_data_sections): New function.
6081         (Incremental_inputs::relocs_entsize): New function.
6082         (Output_section_incremental_inputs::set_final_data_size): New function.
6083         (Output_section_incremental_inputs::do_write): New function.
6084         (Output_section_incremental_inputs::write_header): New function.
6085         (Output_section_incremental_inputs::write_input_files): New function.
6086         (Output_section_incremental_inputs::write_info_blocks): New function.
6087         (Output_section_incremental_inputs::write_symtab): New function.
6088         * incremental.h (Incremental_script_entry): Forward declaration.
6089         (Incremental_object_entry): Forward declaration.
6090         (Incremental_archive_entry): Forward declaration.
6091         (Incremental_inputs): Forward declaration.
6092         (Incremental_inputs_header_data): Remove.
6093         (Incremental_inputs_header): Remove.
6094         (Incremental_inputs_header_write): Remove.
6095         (Incremental_inputs_entry_data): Remove.
6096         (Incremental_inputs_entry): Remove.
6097         (Incremental_inputs_entry_write): Remove.
6098         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6099         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6100         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6101         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6102         Likewise.
6103         (Incremental_input_entry): New class.
6104         (Incremental_script_entry): New class.
6105         (Incremental_object_entry): New class.
6106         (Incremental_archive_entry): New class.
6107         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6108         (Incremental_inputs::report_inputs): Remove.
6109         (Incremental_inputs::report_archive): Remove.
6110         (Incremental_inputs::report_archive_begin): New function.
6111         (Incremental_inputs::report_archive_end): New function.
6112         (Incremental_inputs::report_object): Change prototype.
6113         (Incremental_inputs::report_input_section): New function.
6114         (Incremental_inputs::report_script): Change prototype.
6115         (Incremental_inputs::get_reloc_count): New function.
6116         (Incremental_inputs::set_reloc_count): New function.
6117         (Incremental_inputs::create_data_sections): New function.
6118         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6119         (Incremental_inputs::inputs_section): New function.
6120         (Incremental_inputs::symtab_section): New function.
6121         (Incremental_inputs::relocs_section): New function.
6122         (Incremental_inputs::get_stringpool): Add const.
6123         (Incremental_inputs::command_line): Add const.
6124         (Incremental_inputs::inputs): Remove.
6125         (Incremental_inputs::command_line_key): New function.
6126         (Incremental_inputs::input_file_count): New function.
6127         (Incremental_inputs::input_files): New function.
6128         (Incremental_inputs::relocs_entsize): New function.
6129         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6130         (Incremental_inputs::finalize_inputs): Remove.
6131         (Incremental_inputs::Input_info): Remove.
6132         (Incremental_inputs::lock_): Remove.
6133         (Incremental_inputs::inputs_): Change type.
6134         (Incremental_inputs::inputs_map_): Remove.
6135         (Incremental_inputs::current_object_entry_): New data member.
6136         (Incremental_inputs::inputs_section_): New data member.
6137         (Incremental_inputs::symtab_section_): New data member.
6138         (Incremental_inputs::relocs_section_): New data member.
6139         (Incremental_inputs::reloc_count_): New data member.
6140         (Incremental_inputs_reader): New class.
6141         (Incremental_symtab_reader): New class.
6142         (Incremental_relocs_reader): New class.
6143         * layout.cc (Layout::finalize): Move finalization of incremental info
6144         and creation of incremental info sections to follow finalization of
6145         symbol table.  Set offsets for postprocessing sections.
6146         (Layout::create_incremental_info_sections): Call
6147         Incremental_inputs::create_data_sections.  Add incremental symtab
6148         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6149         sections to layout after input sections.
6150         * layout.h (struct Timespec): Forward declaration.
6151         (Layout::incremental_inputs): Add const.
6152         (Layout::create_incremental_info_sections): Add parameter.
6153         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6154         * object.cc: Include incremental.h.
6155         (Relobj::finalize_incremental_relocs): New function.
6156         (Sized_relobj::do_layout): Record input sections in incremental info.
6157         * object.h (Object::output_section): New function.
6158         (Object::output_section_offset): Moved from Relobj.
6159         (Object::get_incremental_reloc_base): New function.
6160         (Object::get_incremental_reloc_count): New function.
6161         (Object::do_output_section): New function.
6162         (Object::do_output_section_offset): Moved from Relobj.
6163         (Object::do_get_incremental_reloc_base): New function.
6164         (Object::do_get_incremental_reloc_count): New function.
6165         (Object::Object): Initialize new data members.
6166         (Relobj::output_section): Renamed do_output_section and moved to
6167         protected.
6168         (Relobj::output_section_offset): Moved to Object.
6169         (Relobj::do_get_incremental_reloc_base): New function.
6170         (Relobj::do_get_incremental_reloc_count): New function.
6171         (Relobj::allocate_incremental_reloc_counts): New function.
6172         (Relobj::count_incremental_reloc): New function.
6173         (Relobj::finalize_incremental_relocs): New function.
6174         (Relobj::next_incremental_reloc_index): New function.
6175         (Relobj::reloc_counts_): New data member.
6176         (Relobj::reloc_bases_): New data member.
6177         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6178         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6179         (Sized_relobj::incremental_relocs_scan): New function.
6180         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6181         (Sized_relobj::incremental_relocs_write): New function.
6182         (Sized_relobj::incremental_relocs_write_reltype): New function.
6183         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6184         incremental link.
6185         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6186         archives and object files elsewhere.
6187         (Add_symbols::run): Report object files here.
6188         (Finish_group::run): Report end of archive at end of group.
6189         * reloc.cc: Include layout.h, incremental.h.
6190         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6191         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6192         (Sized_relobj::incremental_relocs_scan): New function.
6193         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6194         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6195         (Sized_relobj::incremental_relocs_write): New function.
6196         (Sized_relobj::incremental_relocs_write_reltype): New function.
6197         * script.cc (read_input_script): Rewrite test for incremental link.
6198         Change call to Incremental_inputs::report_script.
6199         * symtab.h (Symbol_table::first_global_index): New function.
6200         (Symbol_table::output_count): New function.
6201
6202 2010-08-12  Doug Kwan  <dougkwan@google.com>
6203
6204         * arm.cc (Target_arm::merge_object_attributes): Check command line
6205         options --no-wchar-size-warning and --no-enum-size-warning.
6206         * options.h (General_options): Add ld-compatible options
6207         --no-enum-size-warning and --no-wchar-size-warning.
6208
6209 2010-08-04  Ian Lance Taylor  <iant@google.com>
6210
6211         * x86_64.cc (Target_x86_64::Scan::local): Use
6212         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6213         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6214         (Target_x86_64::Scan::global): Likewise.
6215         (Target_x86_64::Relocate::relocate): Likewise.
6216         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6217         Likewise.
6218
6219 2010-08-03  Cary Coutant  <ccoutant@google.com>
6220
6221         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6222         to reserve space in merged_strings vector. Keep total input size
6223         for stats.
6224         (Output_merge_string::do_print_merge_stats): Print total input size.
6225         * merge.h (Output_merge_string): Add input_size_ field.
6226         * stringpool.cc (Stringpool_template::string_length): Move
6227         implementations out of Stringpool_template class and place in
6228         stringpool.h.
6229         * stringpool.h (string_length): Move out of Stringpool_template.
6230
6231 2010-08-03  Ian Lance Taylor  <iant@google.com>
6232
6233         PR 11712
6234         * layout.cc (relaxation_loop_body): If address of load segment is
6235         set, adjust address to include headers if possible.
6236
6237 2010-08-03  Ian Lance Taylor  <iant@google.com>
6238
6239         * version.cc (version_string): Bump to 1.10.
6240
6241 2010-08-03  Ian Lance Taylor  <iant@google.com>
6242
6243         PR 11805
6244         * layout.h (enum Output_section_order): Define.
6245         (class Layout): Update declarations.
6246         * layout.cc (Layout::get_output_section): Add order parameter.
6247         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6248         is_first_non_relro parameters.  Change all callers.
6249         (Layout::choose_output_section): Likewise.
6250         (Layout::add_output_section_data): Likewise.
6251         (Layout::make_output_section): Likewise.  Set order.
6252         (Layout::default_section_order): New function.
6253         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6254         * output.cc (Output_section::Output_section): Initialize order_.
6255         Don't initialize deleted fields.
6256         (Output_segment::Output_segment): Don't initialize deleted
6257         fields.
6258         (Output_segment::add_output_section_to_load): New function
6259         replacing add_output_section.  Change all callers to call this or
6260         add_output_section_to_nonload.
6261         (Output_segment::add_output_section_to_nonload): New function.
6262         (Output_segment::remove_output_section): Rewrite.
6263         (Output_segment::add_initial_output_data): Likewise.
6264         (Output_segment::has_any_data_sections): Likewise.
6265         (Output_segment::is_first_section_relro): Likewise.
6266         (Output_segment::maximum_alignment): Likewise.
6267         (Output_segment::has_dynamic_reloc): New function replacing
6268         dynamic_reloc_count.  Change all callers.
6269         (Output_segment::has_dynamic_reloc_list): New function replacing
6270         dynamic_reloc_count_list.  Change all callers.
6271         (Output_segment::set_section_addresses): Rewrite.
6272         (Output_segment::set_offset): Rewrite.
6273         (Output_segment::find_first_and_last_list): Remove.
6274         (Output_segment::set_tls_offsets): Rewrite.
6275         (Output_segment::first_section_load_address): Likewise.
6276         (Output_segment::output_section_count): Likewise.
6277         (Output_segment::section_with_lowest_load_address): Likewise.
6278         (Output_segment::write_section_headers): Likewise.
6279         (Output_segment::print_sections_to_map): Likewise.
6280         * output.h (class Output_data): Remove dynamic_reloc_count_
6281         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6282         (Output_data::add_dynamic_reloc): Rewrite.
6283         (Output_data::has_dynamic_reloc): New function.
6284         (Output_data::dynamic_reloc_count): Remove.
6285         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6286         is_last_relro_, is_first_non_relro_, is_interp_,
6287         is_dynamic_linker_section_ fields.  Add order and set_order
6288         functions.  Remove is_relro_local, set_is_relro_local,
6289         is_last_relro, set_is_last_relro, is_first_non_relro,
6290         set_is_first_non_relro functions, is_interp, set_is_interp,
6291         is_dynamic_linker_section, and set_is_dynamic_linker_section
6292         functions.
6293         (class Output_segment): Change Output_data_list from std::list to
6294         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6295         output_bss_ fields.  Update declarations.
6296
6297 2010-08-02  Ian Lance Taylor  <iant@google.com>
6298
6299         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6300         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6301         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6302
6303 2010-08-02  Ian Lance Taylor  <iant@google.com>
6304
6305         PR 11855
6306         * script.cc (Script_options::Script_options): Initialize
6307         symbol_definitions_ and symbol_references_.
6308         (Script_options::add_symbol_assignment): Update
6309         symbol_definitions_ and symbol_references_.
6310         (Script_options::add_symbol_reference): New function.
6311         (script_symbol): New function.
6312         * script.h (class Script_options): Add symbol_definitions_ and
6313         symbol_references_ fields.
6314         (Script_options::referenced_const_iterator): New type.
6315         (Script_options::referenced_begin): New function.
6316         (Script_options::referenced_end): New function.
6317         (Script_options::is_referenced): New function.
6318         (Script_options::any_unreferenced): New function.
6319         * script-c.h (script_symbol): Declare.
6320         * yyscript.y (exp): Call script_symbol.
6321         * symtab.cc: Include "script.h".
6322         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6323         Change all callers.  Check symbols referenced by scripts.
6324         (Symbol_table::add_undefined_symbols_from_command_line): Add
6325         layout parameter.  Change all callers.
6326         (Symbol_table::do_add_undefined_symbols_from_command_line):
6327         Likewise.  Break out loop body.  Check symbols referenced by
6328         scripts.
6329         (Symbol_table::add_undefined_symbol_from_command_line): New
6330         function broken out of
6331         do_add_undefined_symbols_from_command_line.
6332         * symtab.h (class Symbol_table): Update declarations.
6333         * archive.cc: Include "layout.h".
6334         (Archive::should_include_member): Add layout parameter.  Change
6335         all callers.  Check for symbol mentioned in expression.
6336         * archive.h (class Archive): Update declaration.
6337         * object.cc (Sized_relobj::do_should_include_member): Add layout
6338         parameter.
6339         * object.h (Object::should_include_member): Add layout parameter.
6340         Change all callers.
6341         (Object::do_should_include_member): Add layout parameter.
6342         (class Sized_relobj): Update declaration.
6343         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6344         parameter.
6345         * dynobj.h (class Sized_dynobj): Update declaration.
6346         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6347         layout parameter.
6348         * plugin.h (class Sized_pluginobj): Update declaration.
6349
6350 2010-08-02  Ian Lance Taylor  <iant@google.com>
6351
6352         PR 11866
6353         * output.cc (Output_segment::set_offset): Search for the first and
6354         last sections rather than assuming that the list is in order.
6355         (Output_segment::find_first_and_last_list): New function.
6356         * output.h (class Output_segment): Update declarations.
6357         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6358         (relro_strip_test_SOURCES): New variable.
6359         (relro_strip_test_DEPENDENCIES): New variable.
6360         (relro_strip_test_LDFLAGS): New variable.
6361         (relro_strip_test_LDADD): New variable.
6362         (relro_strip_test.so): New target.
6363
6364 2010-08-02  Ian Lance Taylor  <iant@google.com>
6365
6366         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6367         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6368         (Target_i386::got_tlsdesc_section): New function.
6369         (Target_i386::got_section): Create space for GOT entries for
6370         TLSDESC relocations.
6371         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6372         R_386_TLS_GOTDESC.
6373         (Target_i386::Scan::global): Likewise.
6374         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6375         using TLSDESC GOT.
6376         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6377         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6378         (Target_x86_64::got_tlsdesc_section): New function.
6379         (Target_x86_64::got_section): Create space for GOT entries for
6380         TLSDESC relocations.
6381         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6382         R_386_TLS_GOTDESC.
6383         (Target_x86_64::Scan::global): Likewise.
6384         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6385         using TLSDESC GOT.
6386
6387 2010-08-02  Ian Lance Taylor  <iant@google.com>
6388
6389         * testsuite/final_layout.sh: Use dc to convert from hex to
6390         decimal.
6391
6392 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6393
6394         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6395         paramter to the call to gold::gc_process_relocs.
6396         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6397         paramter to the call to gold::gc_process_relocs.
6398         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6399         parameter to the call to gold::gc_process_relocs.
6400         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6401         template parameter to the call to gold::gc_process_relocs.
6402         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6403         paramter to the call to gold::gc_process_relocs.
6404         * gc.h (get_embedded_addend_size): New function.
6405         (gc_process_relocs): Save the size of the reloc for use by ICF.
6406         * icf.cc (get_section_contents): Get the addend from the text section
6407         for SHT_REL relocation sections.
6408         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6409         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6410         * int_encoding.h (read_from_pointer): New overloaded function.
6411         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6412         * testsuite/icf_sht_rel_addend_test.sh: New file.
6413         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6414         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6415
6416 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6417
6418         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6419         * Makefile.in: Regenerate.
6420         * testsuite/Makefile.in: Regenerate.
6421
6422 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6423
6424         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6425         * gold/testsuite/debug_msg.cc: Likewise.
6426         * gold/testsuite/odr_violation1.cc
6427         * gold/testsuite/odr_violation2.cc
6428
6429 2010-07-21  Cary Coutant  <ccoutant@google.com>
6430
6431         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6432         string, and length fields.
6433         (Output_merge_string::Merged_strings_list): New type.
6434         (Output_merge_string::Merged_strings_lists): New typedef.
6435         (Output_merge_string): Replace merged_strings_ with
6436         merged_strings_lists_.
6437         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6438         Merged_strings_list per input object and section.  Don't store pointer
6439         to the string.  Don't store length with each merged string entry.
6440         (Output_merge_string::finalize_merged_data): Loop over list of merged
6441         strings lists.  Recompute length of each merged string.
6442
6443 2010-07-15  Cary Coutant  <ccoutant@google.com>
6444
6445         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6446         here.
6447
6448 2010-07-14  Ian Lance Taylor  <iant@google.com>
6449
6450         * descriptors.cc (Descriptors::open): Report correct name in error
6451         message.
6452
6453 2010-07-13  Doug Kwan  <dougkwan@google.com>
6454
6455         * arm.cc (Arm_input_section::Arm_input_section): For a
6456         SHT_ARM_EXIDX section, always keeps the input sections.
6457         (Arm_input_section::set_exidx_section_link): New method.
6458         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6459         has_errors_ to false.
6460         (Arm_exidx_input_section::has_errors,
6461         Arm_exidx_input_section::set_has_errors): New methods.
6462         (Arm_exidx_input_section::has_errors_): New data member.
6463         (Arm_relobj::get_exidx_shndx_list): New method.
6464         (Arm_output_section::append_text_sections_to_list): Do not skip
6465         section without SHF_EXECINSTR.
6466         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6467         errors.
6468         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6469         section header.  Make error messages more verbose.  Check for
6470         a non-executable section linked to an EXIDX section.
6471         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6472         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6473         check that there is no deferred EXIDX section if we exit early.
6474         Instead of not making an EXIDX section in case of an error, make one
6475         and set the has_errors flag of it.
6476         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6477         in a relocatable link.
6478         (Target_arm::do_relax): Look for the EXIDX output section instead of
6479         assuming that it is called .ARM.exidx.
6480         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6481         section list.  Do not check for SHF_EXECINSTR section flags but
6482         skip any input section with errors.
6483         * output.cc (Output_section::Output_section): Initialize
6484         always_keeps_input_sections_ to false.
6485         (Output_section::add_input_section): Check for
6486         always_keeps_input_sections_.
6487         *  output.h (Output_section::always_keeps_input_sections,
6488         Output_section::set_always_keeps_input_sections): New methods.
6489         (Output_section::always_keeps_input_sections): New data member.
6490
6491 2010-07-13  Rafael Espindola  <espindola@google.com>
6492
6493         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6494         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6495
6496 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6497             Ian Lance Taylor  <iant@google.com>
6498
6499         * output.h (Output_section_lookup_maps::add_merge_section):
6500         Correct check of whether value was inserted.
6501         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6502         (Output_section_lookup_maps::add_relaxed_input_section):
6503         Likewise.
6504         * arm.cc (Target_arm::got_section): Remove used local os.
6505         * i386.cc (Target_i386::got_section): Likewise.
6506         * x86_64.cc (Target_x86_64::got_section): Likewise.
6507         * sparc.cc (Target_sparc::got_section): Likewise.
6508         (Target_sparc::relocate): Remove unused local have_got_offset.
6509         * powerpc.cc (Target_powerpc::relocate): Likewise.
6510
6511 2010-07-13  Ian Lance Taylor  <iant@google.com>
6512
6513         * compressed_output.cc (zlib_decompress): Fix signature in
6514         !HAVE_ZLIB_H case.
6515
6516         * archive.cc (Archive::include_member): Unlock an external member
6517         of a thin archive.  Don't bother to delete an object we know is
6518         NULL.
6519
6520 2010-07-12  Cary Coutant  <ccoutant@google.com>
6521
6522         * compressed_output.cc (zlib_decompress): New function.
6523         (get_uncompressed_size): New function.
6524         (decompress_input_section): New function.
6525         * compressed_output.h (get_uncompressed_size): New function.
6526         (decompress_input_section): New function.
6527         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6528         Handle compressed debug sections.
6529         * layout.cc (is_compressed_debug_section): New function.
6530         (Layout::output_section_name): Map compressed section names to
6531         canonical names.
6532         * layout.h (is_compressed_debug_section): New function.
6533         (is_debug_info_section): Recognize compressed debug sections.
6534         * merge.cc: Include compressed_output.h.
6535         (Output_merge_data::do_add_input_section): Handle compressed
6536         debug sections.
6537         (Output_merge_string::do_add_input_section): Handle compressed
6538         debug sections.
6539         * object.cc: Include compressed_output.h.
6540         (Sized_relobj::Sized_relobj): Initialize new data members.
6541         (build_compressed_section_map): New function.
6542         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6543         * object.h (Object::section_is_compressed): New method.
6544         (Object::do_section_is_compressed): New method.
6545         (Sized_relobj::Compressed_section_map): New type.
6546         (Sized_relobj::do_section_is_compressed): New method.
6547         (Sized_relobj::compressed_sections_): New data member.
6548         * output.cc (Output_section::add_input_section): Handle compressed
6549         debug sections.
6550         * reloc.cc: Include compressed_output.h.
6551         (Sized_relobj::write_sections): Handle compressed debug sections.
6552
6553 2010-07-08  Cary Coutant  <ccoutant@google.com>
6554
6555         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6556         weak when resolving to a dynamic def.
6557         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6558         for weak undef/dynamic def cases. Adjust callers.
6559         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6560         undef_binding_weak_.
6561         (Symbol_table::sized_write_globals): Adjust symbol binding.
6562         (Symbol_table::sized_write_symbol): Add binding parameter.
6563         * symtab.h (Symbol::set_undef_binding): New method.
6564         (Symbol::is_undef_binding_weak): New method.
6565         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6566         (Symbol_table::should_override): Add new parameter.
6567         (Symbol_table::sized_write_symbol): Add new parameter.
6568
6569         * testsuite/weak_undef_file1.cc: Add new test case.
6570         * testsuite/weak_undef_file2.cc: Fix header comment.
6571         * testsuite/weak_undef_test.cc: Add new test case.
6572
6573 2010-06-29  Doug Kwan  <dougkwan@google.com>
6574
6575         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6576         Initialize USE_SYMBOL_.
6577         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6578         definition.
6579         (Arm_reloc_property::uses_symbol_): New data member declaration.
6580         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6581         uses symbol value and symbol is undefined but not weakly undefined.
6582
6583 2010-06-28  Rafael Espindola  <espindola@google.com>
6584
6585         * plugin.cc (Plugin::load): Use dlerror.
6586
6587 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6588
6589         * symtab.cc (detect_odr_violations): When reporting an ODR
6590         violation, report an object where the symbol is defined.
6591
6592 2010-06-25  Doug Kwan  <dougkwan@google.com>
6593
6594         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6595         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6596         definition.
6597         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6598         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6599         target hook to detect function points.
6600         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6601         * icf.h (Icf::check_section_for_function_pointers): Change type of
6602         parameter SECTION_NAME to const reference to std::string.  Use
6603         target hook to determine if section may have unsafe pointers.
6604         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6605         method definition.
6606
6607 2010-06-21  Rafael Espindola  <espindola@google.com>
6608
6609         * fileread.cc (Input_file::find_fie): New
6610         (Input_file::open): Use Input_file::find_fie.
6611         * fileread.h (Input_file::find_fie): New
6612         * plugin.cc (set_extra_library_path): New.
6613         (Plugin::load): Add set_extra_library_path to the transfer vector.
6614         (Plugin_manager::set_extra_library_path): New.
6615         (Plugin_manager::add_input_file): Use the extra search path if set.
6616         (set_extra_library_path(): New.
6617         * plugin.h (Plugin_manager): Add set_extra_library_path and
6618         extra_search_path_.
6619
6620 2010-06-19  Cary Coutant  <ccoutant@google.com>
6621
6622         * layout.cc (gdb_sections): Add .debug_types.
6623         (lines_only_debug_sections): Likewise.
6624
6625 2010-06-18  Rafael Espindola  <espindola@google.com>
6626
6627         * plugin.cc (add_input_file,add_input_library)
6628         (Plugin_manager::add_input_file): Make filename arguments const.
6629         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6630         const.
6631
6632 2010-06-16  Doug Kwan  <dougkwan@google.com>
6633
6634         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6635         .ARM.attributes section if we have not merged any input
6636         attributes sections.
6637
6638 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6639
6640         * arm.cc: Allow combining objects with no EABI version
6641         information.
6642
6643 2010-06-15  Rafael Espindola  <espindola@google.com>
6644
6645         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6646
6647 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6648
6649         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6650         (struct iovec): Correct !HAVE_READV definition.
6651
6652 2010-06-10  Cary Coutant  <ccoutant@google.com>
6653
6654         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6655         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6656         reloc sections.
6657         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6658
6659         PR 11683
6660         * symtab.h (Symbol::is_placeholder): New member function.
6661         * target-reloc.h (relocate_section): Check for placeholder symbols.
6662
6663         * testsuite/Makefile.am (plugin_test_8): New test.
6664         (plugin_test_9): New test.
6665         * testsuite/Makefile.in: Regenerate.
6666
6667 2010-06-09  Nick Clifton  <nickc@redhat.com>
6668
6669         * yyscript.y (input_list_element): Allow strings prefixed with
6670         the '-' character.  Treat these as libraries.
6671         * script.cc (script_add_library): New function.  Adds a library
6672         specified by "-l<name>" found in an input script.
6673         * script-c.h: Add prototype for script_add_library.
6674
6675 2010-06-07  Doug Kwan  <dougkwan@google.com>
6676
6677         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6678         Restrict stub-group size to be within long conditional branch
6679         range when working around cortex-A8 erratum.
6680
6681 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6682
6683         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6684         #ifdef typo.
6685
6686 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6687
6688         PR gold/11658
6689         * output.cc
6690         (Output_section::Input_section_sort_entry::compare_section_ordering):
6691         Change to return non-zero correctly.
6692         (Output_section::Input_section_sort_section_order_index_compare
6693         ::operator()): Change to fix ambiguity in comparisons.
6694
6695 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6696
6697         * gold.h (is_wildcard_string): New function.
6698         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6699         (Layout::layout_eh_frame): Ditto.
6700         (Layout::find_section_order_index): New method.
6701         (Layout::read_layout_from_file): New method.
6702         * layout.h (Layout::find_section_order_index): New method.
6703         (Layout::read_layout_from_file): New method.
6704         (Layout::input_section_position_): New private member.
6705         (Layout::input_section_glob_): New private member.
6706         * main.cc (main): Call read_layout_from_file here.
6707         * options.h (--section-ordering-file): New option.
6708         * output.cc (Output_section::input_section_order_specified_): New
6709         member.
6710         (Output_section::Output_section): Initialize new member.
6711         (Output_section::add_input_section): Add new parameter.
6712         Keep input sections when --section-ordering-file is used.
6713         (Output_section::set_final_data_size): Sort input sections when
6714         section ordering file is specified.
6715         (Output_section::Input_section_sort_entry): Add new parameter.
6716         Check sorting type.
6717         (Output_section::Input_section_sort_entry::compare_section_ordering):
6718         New method.
6719         (Output_section::Input_section_sort_compare::operator()): Change to
6720         consider section_order_index.
6721         (Output_section::Input_section_sort_init_fini_compare::operator()):
6722         Change to consider section_order_index.
6723         (Output_section::Input_section_sort_section_order_index_compare
6724         ::operator()): New method.
6725         (Output_section::sort_attached_input_sections): Change to sort
6726         according to section order when specified.
6727         (Output_section::add_input_section<32, true>): Add new parameter.
6728         (Output_section::add_input_section<64, true>): Add new parameter.
6729         (Output_section::add_input_section<32, false>): Add new parameter.
6730         (Output_section::add_input_section<64, false>): Add new parameter.
6731         * output.h (Output_section::add_input_section): Add new parameter.
6732         (Output_section::input_section_order_specified): New
6733         method.
6734         (Output_section::set_input_section_order_specified): New method.
6735         (Input_section::Input_section): Initialize section_order_index_.
6736         (Input_section::section_order_index): New method.
6737         (Input_section::set_section_order_index): New method.
6738         (Input_section::section_order_index_): New member.
6739         (Input_section::Input_section_sort_section_order_index_compare): New
6740         struct.
6741         (Output_section::input_section_order_specified_): New member.
6742         * script-sections.cc (is_wildcard_string): Delete and move modified
6743         method to gold.h.
6744         (Output_section_element_input::Output_section_element_input): Modify
6745         call to is_wildcard_string.
6746         (Output_section_element_input::Input_section_pattern
6747         ::Input_section_pattern): Ditto.
6748         (Output_section_element_input::Output_section_element_input): Ditto.
6749         * testsuite/Makefile.am (final_layout): New test case.
6750         * testsuite/Makefile.in: Regenerate.
6751         * testsuite/final_layout.cc: New file.
6752         * testsuite/final_layout.sh: New file.
6753
6754 2010-06-01  Rafael Espindola  <espindola@google.com>
6755
6756         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6757
6758 2010-06-01  Rafael Espindola  <espindola@google.com>
6759
6760         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6761         visibility of symbols.
6762
6763 2010-05-27  Doug Kwan  <dougkwan@google.com>
6764
6765         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6766         from start of output section instead of address for a local symbol
6767         in a merged or relaxed section when doing a relocatable link.
6768
6769 2010-05-26  Rafael Espindola  <espindola@google.com>
6770
6771         PR 11604
6772         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6773         adding sections the garbage collector removed.
6774         * gold/testsuite/Makefile.am: Add test.
6775         * gold/testsuite/Makefile.in: Regenerate.
6776         * gold/testsuite/plugin_test_7.sh: New.
6777         * gold/testsuite/plugin_test_7_1.c: New.
6778         * gold/testsuite/plugin_test_7_2.c: New.
6779
6780 2010-05-26  Rafael Espindola  <espindola@google.com>
6781
6782         * script-sections.cc (Output_section_definition::set_section_addresses):
6783         Check for --section-start.
6784
6785 2010-05-26  Doug Kwan  <dougkwan@google.com>
6786
6787         * arm.cc (Arm_scan_relocatable_relocs): New class.
6788         (Target_arm::relocate_special_relocatable): New method.
6789         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6790         (Arm_relocate_functions::thumb_branch_common): Same.
6791         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6792         instead of Default_scan_relocatable_relocs.
6793         * target-reloc.h (relocate_for_relocatable): Let target handle
6794         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6795         * target.h (Sized_target::relocate_special_relocatable): New method.
6796
6797 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6798
6799         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6800
6801 2010-05-23  Doug Kwan  <dougkwan@google.com>
6802
6803         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6804         instead of a cast.
6805         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6806         with a direct branch, not a conditional branch, to a stub.
6807         * merge.cc (Output_merge_base::record_input_section): New method
6808         defintion.
6809         (Output_merge_data::do_add_input_section): Record input section if
6810         keeps-input-sections flag is set.
6811         (Output_merge_string::do_add_input_section): Ditto.
6812         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6813         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6814         INPUT_SECTIONS_.
6815         (Output_merge_base::keeps_input_sections,
6816         Output_merge_base::set_keeps_input_sections,
6817         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6818         method definitions.
6819         (Output_merge_base::Input_sections): New type declaration.
6820         (Output_merge_base::input_sections_begin,
6821         Output_merge_base::input_sections_end,
6822         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6823         (Output_merge_base::bool keeps_input_sections_,
6824         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6825         Output_merge_base::input_sections_): New data members.
6826         (Output_merge_data::do_set_keeps_input_sections): New method
6827         defintion.
6828         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6829         * output.cc (Output_section::Input_section::relobj): Move method
6830         defintion from class declaration to here and handle merge sections.
6831         (Output_section::Input_section::shndx): Ditto.
6832         (Output_section::Output_section): Remove initializations of removed
6833         data members and initialize new data member LOOKUP_MAPS_.
6834         (Output_section::add_input_section): Set keeps-input-sections flag
6835         for a newly created merge output section as appropriate.  Adjust code
6836         to use Output_section_lookup_maps class.
6837         (Output_section::add_relaxed_input_section): Adjst code for lookup
6838         maps code refactoring.
6839         (Output_section::add_merge_input_section): Add a new parameter
6840         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6841         class.  If adding input section to a newly created merge output
6842         section fails, remove the new merge section.
6843         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6844         Adjust code for use of the Output_section_lookup_maps class.
6845         (Output_section::find_merge_section): Ditto.
6846         (Output_section::build_lookup_maps): New method defintion.
6847         (Output_section::find_relaxed_input_section): Adjust code to use
6848         Output_section_lookup_maps class.
6849         (Output_section::get_input_sections): Export merge sections.  Adjust
6850         code to use Output_section_lookup_maps class.
6851         (Output_section:::add_script_input_section): Adjust code to use
6852         Output_section_lookup_maps class.  Update lookup maps for merge
6853         sections also.
6854         (Output_section::discard_states): Use Output_section_lookup_maps.
6855         (Output_section::restore_states): Same.
6856         * output.h (Merge_section_properties): Move class defintion out of
6857         Output_section.
6858         (Output_section_lookup_maps): New class.
6859         (Output_section::Input_section::is_merge_section): New method
6860         defintion.
6861         (Output_section::Input_section::relobj): Move defintion out of class
6862         defintion.  Declare method only.
6863         (Output_section::Input_section::shndx): Ditto.
6864         (Output_section::Input_section::output_merge_base): New method defintion.
6865         (Output_section::Input_section::u2_.pomb): New union field.
6866         (Output_section::Merge_section_by_properties_map,
6867         Output_section::Output_section_data_by_input_section_map,
6868         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6869         Remove types.
6870         (Output_section::add_merge_input_section): Add new parameter
6871         KEEPS_INPUT_SECTIONS.
6872         (Output_section::build_lookup_maps): New method declaration.
6873         (Output_section::merge_section_map_,
6874         Output_section::merge_section_by_properties_map_,
6875         Output_section::relaxed_input_section_map_,
6876         Output_section::is_relaxed_input_section_map_valid_): Remove data
6877         members.
6878         (Output_section::lookup_maps_): New data member.
6879
6880 2010-05-21  Doug Kwan  <dougkwan@google.com>
6881
6882         PR gold/11619
6883         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6884         avoid a compilation error.
6885
6886 2010-05-19  Rafael Espindola  <espindola@google.com>
6887
6888         * script-sections.cc (Output_section_definition::allocate_to_segment):
6889         Update the phdrs_list even when the output section is NULL.
6890         * testsuite/Makefile.am: Add test.
6891         * testsuite/Makefile.in: Regenerate.
6892         * testsuite/script_test_9.cc: New.
6893         * testsuite/script_test_9.sh: New.
6894         * testsuite/script_test_9.t: New.
6895
6896 2010-05-19  Doug Kwan  <dougkwan@google.com>
6897
6898         * arm.cc (Arm_input_section::original_size): New method.
6899         (Arm_input_section::do_addralign): Add a cast.
6900         (Arm_input_section::do_output_offset): Remove static cast.
6901         (Arm_input_section::original_addralign,
6902          Arm_input_section::original_size_): Change type to uint32_t.
6903         (Arm_input_section::init): Add safe casts for section alignment
6904         and size.
6905         (Arm_input_section::set_final_data_size): Do not set address and
6906         offset of stub table.
6907         (Arm_output_section::fix_exidx_coverage): Change use of of
6908         Output_section::Simple_input_section to that of
6909         Output_section::Input_section.
6910         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6911         except for the first pass.
6912         * output.cc (Output_section::get_input_sections): Change type of
6913         input_sections to std::list<Input_section>.
6914         (Output_section::add_script_input_section): Rename from
6915         Output_section::add_simple_input_section.  Change type of SIS
6916         parameter from Simple_input_section to Input_section.
6917         * output.h (Output_section::Simple_input_section): Remove class.
6918         (Output_section::Input_section): Change class visibility to public.
6919         (Output_section::Input_section::addralign): Use stored alignments
6920         for special input sections if set.
6921         (Output_section::Input_section::set_addralign): New method.
6922         (Output_section::get_input_sections): Change parameter type from
6923         list of Simple_input_section to list of Input_section.
6924         (Output_section::add_script_input_section): Rename from
6925         Output_section::add_simple_input_section. Change first parameter's
6926         type from Simple_input_section to Input_section and remove the
6927         second and third parameters.
6928         * script-sections.cc (Input_section::Input_section_list): Change
6929         type to list of Output_section::Input_section/
6930         (Input_section_info::Input_section_info): Change parameter type of
6931         INPUT_SECTION to Output_section::Input_section.
6932         (Input_section_info::input_section): Change return type.
6933         (Input_section_info::input_section_): Change type to
6934         Output_section::Input_section.
6935         (Output_section_element_input::set_section_addresses): Adjust code
6936         to use Output_section::Input_section instead of
6937         Output_section::Simple_input_section.  Adjust code for renaming
6938         of Output_section::add_simple_input_section.
6939         (Orphan_output_section::set_section_addresses): Ditto.
6940
6941 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6942
6943         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6944         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6945
6946 2010-05-18  Rafael Espindola  <espindola@google.com>
6947
6948         * options.cc (General_options::finalize): Handle -nostdlib.
6949         * options.h (nostdlib): New option.
6950         * script.cc (script_add_search_dir): Handle -nostdlib.
6951
6952 2010-05-12  Doug Kwan  <dougkwan@google.com>
6953
6954         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6955         attributes section only if there no attributes section after merging.
6956         (Target_arm::merge_object_attributes): Move value of
6957         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6958         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6959         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6960         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6961         and arm_attr_merge_7.stdout.
6962         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6963         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6964         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6965         arm_attr_merge_7b.o): New rules.
6966         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6967         arm_attr_merge_7
6968         * testsuite/Makefile.in: Regenerate.
6969         * testsuite/arm_attr_merge.sh: New file.
6970         * testsuite/arm_attr_merge_[67][ab].s: Same.
6971
6972 2010-05-05  Nick Clifton  <nickc@redhat.com>
6973
6974         * po/es.po: Updated Spanish translation.
6975
6976 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6977
6978         * Makefile.am (install-exec-local): Properly install gold as
6979         default cross linker.
6980         * Makefile.in: Regenerated.
6981
6982 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6983             Nick Clifton  <nickc@redhat.com>
6984
6985         * configure.ac (install_as_default): Define and set to false
6986         unless --enable-gold or --enable-gold=both/gold has been
6987         specified.
6988         * configure: Regenerate.
6989
6990         * Makefile.am (install-exec-local): Install the executable as
6991         'ld.gold'.  If install_as_default is true then also install it as
6992         'ld'.
6993         * Makefile.in: Regenerated.
6994
6995 2010-04-24  Ian Lance Taylor  <iant@google.com>
6996
6997         * layout.cc (Layout::layout_reloc): In relocatable link don't
6998         combine reloc sections for grouped sections.
6999
7000 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7001
7002         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7003         sections that are not ordinary to icf.
7004         * icf.cc (get_section_contents): Handle relocation pointing to section
7005         with no object or shndx information.
7006         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7007         * testsuite/Makefile.in: Regenerate.
7008         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7009         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7010
7011 2010-04-22  Ian Lance Taylor  <iant@google.com>
7012
7013         * expression.cc (Expression::Expression_eval_info): Add
7014         result_alignment_pointer field.
7015         (Expression::eval_with_dot): Add result_alignment_pointer
7016         parameter.  Change all callers.
7017         (Expression::eval_maybe_dot): Likewise.
7018         (class Binary_expression): Add alignment_pointer parameter to
7019         left_value and right_value.  Change all callers.
7020         (BINARY_EXPRESSION): Set result alignment.
7021         (class Trinary_expression): Add alignment_pointer parameter to
7022         arg2_value and arg3_value.  Change all callers.
7023         (Trinary_cond::value): Set result alignment.
7024         (Max_expression::value, Min_expression::value): Likewise.
7025         (Align_expression::value): Likewise.
7026         * script-sections.cc (class Sections_element): Add dot_alignment
7027         parameter to set_section_addresses virtual function.  Update
7028         instantiations.
7029         (class Output_section_element): Likewise.
7030         (Script_sections::create_segments): Add dot_alignment parameter.
7031         Change all callers.
7032         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7033         (Script_sections::set_phdrs_clause_addresses): Likewise.
7034         * script-sections.h: Update declarations.
7035         * script.h: Update declarations.
7036         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7037         min_p_align.
7038         * testsuite/script_test_3.t: Set large alignment.
7039         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7040         segment has expected alignment.
7041
7042 2010-04-22  Nick Clifton  <nickc@redhat.com>
7043
7044         * po/gold.pot: Updated by the Translation project.
7045         * po/vi.po: Updated Vietnamese translation.
7046
7047 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7048
7049         * testsuite/Makefile.am (check_PROGRAMS): Add
7050         icf_virtual_function_folding_test.
7051         * testsuite/Makefile.in: Regenerated.
7052
7053 2010-04-15  Andrew Haley  <aph@redhat.com>
7054
7055         * options.h (merge_exidx_entries): New option.
7056         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7057         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7058         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7059         (Target_arm::merge_exidx_entries): New function.
7060         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7061         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7062         to Arm_exidx_fixup constructor.
7063         Add new arg, merge_exidx_entries.
7064         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7065         Arm_output_section::fix_exidx_coverage.
7066
7067 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7068
7069         * icf.cc (get_section_contents): Check for preemptible functions.
7070         Ignore addend when appropriate.
7071         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7072         section folded.
7073         (add_from_relobj): Check for section folded.
7074         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7075         * symtab.h (should_add_dynsym_entry): Add new parameter.
7076         * target-reloc.h (scan_relocs): Check for section folded.
7077         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7078         Check reloc types for function pointers in shared objects.
7079         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7080         case.
7081         (icf_preemptible_functions_test): New test case.
7082         (icf_string_merge_test): New test case.
7083         * testsuite.Makefile.in: Regenerate.
7084         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7085         bar_glob.  Refactor code.
7086         * testsuite/icf_preemptible_functions_test.cc: New file.
7087         * testsuite/icf_preemptible_functions_test.sh: New file.
7088         * testsuite/icf_string_merge_test.cc: New file.
7089         * testsuite/icf_string_merge_test.sh: New file.
7090         * testsuite/icf_virtual_function_folding_test.cc: New file.
7091         * testsuite/icf_virtual_function_folding_test.sh: New file.
7092
7093 2010-04-14  Doug Kwan  <dougkwan@google.com>
7094
7095         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7096         for local symbol recounting if we remove a section due to ICF.
7097         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7098         there are no regular objects in input.
7099
7100 2010-04-13  Doug Kwan  <dougkwan@google.com>
7101
7102         * arm.cc (Arm_input_section::set_final_data_size): Compute
7103         accurate final data size instead of using current data size.
7104
7105 2010-04-09  Doug Kwan  <dougkwan@google.com>
7106
7107         * layout.cc (Layout::choose_output_section): Handle script section
7108         types.
7109         (Layout::make_output_section_for_script): Add section type parameter.
7110         Handle script section types.
7111         * layout.h (Layout::make_output_section_for_script): Add section
7112         type parameter.
7113         * output.cc (Output_section::Output_section): Initialize data member
7114         is_noload_.
7115         (Output_section::do_reset_address_and_file_offset): Do not set address
7116         to 0 if section is a NOLOAD section.
7117         * output.h (Output_section::is_noload): New method.
7118         (Output_section::set_is_noload): Ditto.
7119         (Output_section::is_noload_): New data member.
7120         * script-c.h (Script_section_type): New enum type.
7121         (struct Parser_output_section_header): Add new file section_type.
7122         * script-sections.cc (Sections_element::output_section_name): Add
7123         parameter for returning script section type.
7124         (Output_section_definition::output_section_name): Ditto.
7125         (Output_section_definition::section_type)P; New method.
7126         (Output_section_definiton::script_section_type_name): Ditto.
7127         (Output_section_definition::script_section_type_): New data member.
7128         (Output_section_definition::Output_section_definition): Initialize
7129         data member Output_section_definition::script_section_type_.
7130         (Output_section_definition::create_sections): Pass script section type
7131         to Layout::make_output_section_for_script.
7132         (Output_section_definition::output_section_name): Return script
7133         section type to caller.
7134         (Output_section_definition::set_section_address): Do not advance
7135         dot value and load address if section type is NOLOAD.  Set address
7136         of NOLOAD sections regardless of section flags.
7137         (Output_section_definition::print): Print section type if it is
7138         not SCRIPT_SECTION_TYPE_NONE.
7139         (Output_section_definition::section_type): New method.
7140         (Output_section_definition::script_section_type_name): Ditto.
7141         (Script_sections::output_section_name): Add new parameter
7142         PSECTION_TYPE for returning script section type.  Pass it to
7143         section elements.  Handle discard sections.
7144         (Sort_output_sections::operator()): Handle NOLOAD sections.
7145         * script-sections.h (Script_sections::Section_type): New enum type.
7146         (Script_sections::output_section_name): Add a new parameter for
7147         returning script section type.
7148         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7149         INFO and NOLOAD.
7150         * yyscript.y (union): Add new field SECTION_TYPE.
7151         (COPY, DSECT, INFO, NOLOAD): New tokens.
7152         (opt_address_and_section_type): Change type to output_section_header.
7153         (section_type): New non-terminal
7154         (section_header): Handle section type.
7155         (opt_address_and_section_type): Return section type value.
7156
7157 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7158
7159         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7160         * testsuite/plugin_common_test_2.c (foo): Likewise.
7161
7162 2010-04-08  Doug Kwan  <dougkwan@google.com>
7163
7164         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7165         Output_merge_data.
7166         * output.cc (Output_section::add_merge_input_section): Simplify
7167         code and return status of Output_merge_base::add_input_section.
7168         Update merge section map only if Output_merge_base::add_input_section
7169         returns true.
7170
7171 2010-04-07  Doug Kwan  <dougkwan@google.com>
7172
7173         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7174         if section is marked as containing instructions but has no mapping
7175         symbols.
7176         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7177         correct section index.
7178         (Arm_relobj::find_linked_text_section): Ditto.
7179
7180 2010-04-07  Cary Coutant  <ccoutant@google.com>
7181
7182         * archive.cc (include_member): Destroy Read_symbols_data object before
7183         releasing file.
7184         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7185         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7186         (Read_symbols_data::~Read_symbols_data) New destructor.
7187         (Section_relocs::Section_relocs) New constructor.
7188         (Section_relocs::~Section_relocs) New destructor.
7189         (Read_relocs_data::Read_relocs_data) New constructor.
7190         (Read_relocs_data::~Read_relocs_data) New destructor.
7191         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7192         pointers to NULL after deleting.
7193
7194 2010-04-07  Doug Kwan  <dougkwan@google.com>
7195
7196         * arm.cc: Replace "endianity" with "endianness" in comments.
7197         (Arm_exidx_cantunwind): Ditto.
7198         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7199         (Arm_relobj::merge_flags_and_attributes): New method.
7200         (Arm_relobj::merge_flags_and_attributes_): New data member.
7201         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7202         (Arm_relobj::scan_sections_for_stubs): Ditto.
7203         (Arm_relobj::do_read_symbols): Check to see if we really want to
7204         merge processor-specific flags and attributes.  Exit early if
7205         an object is empty except for section names and the undefined symbol.
7206         (Target_arm::do_finalize_sections): Move check for ELF format to
7207         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7208         attributes from a regular object only when we have determined that
7209         it is aapropriate.  Do not create an .ARM.attributes section in
7210         output if there is no regular input object.
7211         (Target_arm::merge_processor_specific_flags): Check
7212         --warn-mismatch before printing any error.
7213         (Target_arm::merge_object_attributes): Ditto.
7214         * gold.cc (queue_middle_tasks): Handle the case in which there is
7215         no regular object in input.
7216         * options.cc (General_options::parse_EB): New method.
7217         (General_options::parse_EL): Same.
7218         (General_options::General_options): Initialize endianness_.
7219         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7220         New options.
7221         (General_options::Endianness): New enum.
7222         (General_options::endianness): New method.
7223         (General_options::endianness_): New data member.
7224         * parameters.cc (Parameters::set_options): Check target endianness.
7225         (Parameters::set_target_once): Ditto.
7226         (Parameters::check_target_endianness): New method.
7227         (parameters_force_valid_target): If either -EL or -EB is specified,
7228         use it to define endianness of default target.
7229         * parameters.h (Parameters::check_target_endianness): New method
7230         declaration.
7231         * target.h (class Target): Change "endianity" to "endianness"
7232         in comments.
7233
7234 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7235
7236         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7237         * configure: Regenerate.
7238         * Makefile.in: Regenerate.
7239         * testsuite/Makefile.in: Regenerate.
7240
7241 2010-04-06  Cary Coutant  <ccoutant@google.com>
7242
7243         gcc PR lto/42757
7244         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7245         prevailing definitions of common symbols.
7246         * testsuite/plugin_test_6.sh: New test case.
7247         * testsuite/plugin_common_test_1.c: New test case.
7248         * testsuite/plugin_common_test_2.c: New test case.
7249         * testsuite/Makefile.am (plugin_test_6): New test case.
7250         * testsuite/Makefile.in: Regenerate.
7251
7252 2010-04-06  Nick Clifton  <nickc@redhat.com>
7253
7254         * po/vi.po: New Vietnamese translation.
7255
7256 2010-03-30  Doug Kwan  <dougkwan@google.com>
7257
7258         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7259
7260 2010-03-25  Doug Kwan  <dougkwan@google.com>
7261
7262         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7263         to avoid a conversion warning on a 32-bit host.
7264
7265 2010-03-24  Ian Lance Taylor  <iant@google.com>
7266
7267         * testsuite/script_test_3.t: Add a TLS segment.
7268         * testsuite/Makefile.am (check_PROGRAMS): Add
7269         tls_phdrs_script_test.
7270         (tls_phdrs_script_test_SOURCES): Define.
7271         (tls_phdrs_script_test_DEPENDENCIES): Define.
7272         (tls_phdrs_script_test_LDFLAGS): Define.
7273         (tls_phdrs_script_test_LDADD): Define.
7274         * testsuite/Makefile.in: Rebuild.
7275
7276 2010-03-23  Cary Coutant  <ccoutant@google.com>
7277
7278         * fileread.cc (find_or_make_view): Fix comment.
7279
7280 2010-03-23  Ian Lance Taylor  <iant@google.com>
7281
7282         * script-sections.cc (class Orphan_section_placement): Define
7283         PLACE_TLS and PLACE_TLS_BSS.
7284         (Orphan_section_placement::Orphan_section_placement): Initialize
7285         new places.
7286         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7287         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7288         (tls_script_test_SOURCES): Define.
7289         (tls_script_test_DEPENDENCIES): Define.
7290         (tls_script_test_LDFLAGS): Define.
7291         (tls_script_test_LDADD): Define.
7292         * testsuite/Makefile.in: Rebuild.
7293
7294 2010-03-22  Doug Kwan  <dougkwan@google.com>
7295
7296         * arm.cc (Arm_relocate_functions::abs8,
7297         Arm_relocate_functions::abs16): Use correct check for overflow
7298         specified in the ARM ELF specs.
7299         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7300         target of a BLX instruction specially.
7301         (Reloc_stub::stub_type_for_reloc): Ditto.
7302         (Relocate::relocate): Use symbolic names instead of numeric relocation
7303         codes to report error.
7304         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7305         workaround.
7306         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7307         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7308         thumb2_blx_out_of_range.stdout
7309         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7310         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7311         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7312         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7313         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7314         thumb2_blx_in_range, thumb2_blx_in_range.o,
7315         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7316         thumb2_blx_out_of_range.o): New rules.
7317         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7318         thumb2_blx_in_range and thumb2_blx_out_of_range.
7319         * testsuite/Makefile.in: Regenerate.
7320         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7321         * testsuite/thumb_blx_in_range.s: New file.
7322         * testsuite/thumb_blx_out_of_range.s: New file.
7323
7324 2010-03-22  Rafael Espindola  <espindola@google.com>
7325
7326         * archive.cc (Should_include): Move to archive.h.
7327         (should_include_member): Make it a member of Archive.
7328         (Lib_group): New.
7329         (Add_lib_group_symbols): New.
7330         * archive.h: Include options.h.
7331         (Archive_member): Moved from Archive.
7332         (Should_include): Moved from archive.cc.
7333         (Lib_group): New.
7334         (Add_lib_group_symbols): New.
7335         * dynobj.cc (do_should_include_member): New.
7336         * dynobj.h (do_should_include_member): New.
7337         * gold.cc (queue_initial_tasks): Update call to queue.
7338         * main.cc (main): Print lib group stats.
7339         * object.cc (do_should_include_member): New.
7340         * object.h: Include archive.h.
7341         (Object::should_include_member): New.
7342         (Object::do_should_include_member): New.
7343         (Sized_relobj::do_should_include_member): New.
7344         * options.cc (General_options::parse_start_lib): New.
7345         (General_options::parse_end_lib): New.
7346         (Input_arguments::add_file): Handle lib groups.
7347         (Input_arguments::start_group): Check we are not in a lib.
7348         (Input_arguments::start_lib): New.
7349         (Input_arguments::end_lib): New.
7350         * options.h (General_options): Add start_lib and end_lib.
7351         (Input_argument::lib_): New.
7352         (Input_argument::lib): New.
7353         (Input_argument::is_lib): New.
7354         (Input_file_lib): New.
7355         (Input_arguments::in_lib_): New.
7356         (Input_arguments::in_lib): New.
7357         (Input_arguments::start_lib): New.
7358         (Input_arguments::end_lib_): New.
7359         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7360         in unused members as preempted.
7361         (Sized_pluginobj::do_should_include_member): New.
7362         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7363         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7364         return the blocker.
7365         (Read_symbols::do_whole_lib_group): New.
7366         (Read_symbols::do_lib_group): New.
7367         (Read_symbols::do_read_symbols): Handle lib groups.
7368         (Read_symbols::get_name): Handle lib groups.
7369         * readsyms.h (Read_symbols): Add an archive member pointer.
7370         (Read_symbols::do_whole_lib_group): New.
7371         (Read_symbols::do_lib_group): New.
7372         (Read_symbols::member_): New.
7373         * script.cc (read_input_script): Update call to queue_soon.
7374
7375 2010-03-19  Doug Kwan  <dougkwan@google.com>
7376
7377         * arm.cc (Stub_table::Stub_table): Initialize new data members
7378         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7379         (Stub_table::add_reloc_stub): Assign stub offset and update
7380         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7381         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7382         New data members.
7383         (Stub_table::update_data_size_and_addralign): Use
7384         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7385         instead of going over all reloc stubs.
7386         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7387         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7388         Stringpool_template::offset_ to size of Stringpool_char.
7389         (Stringpool_template::new_key_offset): Remove code to initialize
7390         Stringpool_template::offset_.
7391         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7392         Stringpool_template::offset_ to zero.
7393
7394 2010-03-15  Doug Kwan  <dougkwan@google.com>
7395
7396         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7397         offset_.
7398         (Stringpool_template::new_key_offset): New method.
7399         (Stringpool_template::add_string): Assign offsets when adding new
7400         strings.
7401         (Stringpool_template::set_string_offsets): Do not set string offsets
7402         when not optimizing.
7403         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7404         member size_.
7405         (Chunked_vector::clear): Clear size_.
7406         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7407         (Chunked_vector::size): Return size_.
7408         (Chunked_vector::push_back): Use size_ to find insert position.
7409         (Chunked_vector::size_): New data member.
7410         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7411         (Stringpool_template::new_key_offset): New method declaration.
7412         (Stringpool_template::offset_): New data member.
7413
7414 2010-03-15   Rafael Espindola  <espindola@google.com>
7415
7416         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7417         Add_symbols' constructor.
7418         * readsyms.h (Add_symbols): Remove the input_group member.
7419
7420 2010-03-10  Ian Lance Taylor  <iant@google.com>
7421
7422         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7423         target to ask whether a reference to a symbol requires a stack
7424         split.
7425         * target.h (Target::is_call_to_non_split): New function.
7426         (Target::do_is_call_to_non_split): Declare virtual function.
7427         * target.cc: Include "symtab.h".
7428         (Target::do_is_call_to_non_split): New function.
7429         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7430
7431 2010-03-10  Cary Coutant  <ccoutant@google.com>
7432
7433         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7434         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7435         (File_read::open[2]): Add whole_file_view_ to list of views.
7436         (File_read::make_view): Remove test of whole_file_view_.
7437         (File_read::find_or_make_view): Create whole_file_view_ if
7438         necessary.
7439         (File_read::clear_views): Replace bool parameter with enum;
7440         adjust all callers.  Don't delete views with permanent data;
7441         do delete cached views and views from archives if
7442         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7443         if clearing the corresponding view.
7444         * fileread.h (File_read::Clear_views_mode): New enum.
7445         (File_read::View::is_permanent_view): New method.
7446         (File_read::clear_views): Replace bool parameter
7447         with enum; adjust all callers.
7448         * options.h (General_options): Change keep_files_mapped option;
7449         add map_whole_files.
7450         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7451         releasing the file.
7452         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7453         the file.
7454
7455 2010-03-10  David S. Miller  <davem@davemloft.net>
7456
7457         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7458
7459 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7460
7461         * icf.cc (get_section_contents): Add '@' marker after processing the
7462         merge reloc.
7463
7464 2010-03-08  Doug Kwan  <dougkwan@google.com>
7465
7466         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7467         due to a conversion warning.
7468         (Arm_relobj::update_output_local_symbol_count): Check for local
7469         symbol with unset output index.
7470
7471 2010-03-05  Ian Lance Taylor  <iant@google.com>
7472
7473         * options.h (class General_options): Add --spare-dynamic-tags.
7474         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7475         --spare-dynamic-tags.
7476
7477 2010-03-05  Ian Lance Taylor  <iant@google.com>
7478
7479         * incremental.cc: Include "libiberty.h".
7480
7481 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7482
7483         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7484         function, is_info_ member.
7485         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7486         (Versions::Versions): Update caller.
7487         (Versions::define_base_version): Likewise.
7488         (Versions::add_def): Likewise.
7489
7490 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7491
7492         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7493         (Scan::possible_function_pointer_reloc): New function.
7494         (Scan::local_reloc_may_be_function_pointer): Change to call
7495         possible_function_pointer_reloc.
7496         (Scan::global_reloc_may_be_function_pointer): Ditto.
7497         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7498         relocations in ".data.rel.ro._ZTV" section.
7499         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7500         * testsuite/icf_safe_so_test.cc: Ditto.
7501         * testsuite/icf_safe_test.cc: Ditto.
7502         * testsuite/icf_safe_test.sh: Ditto.
7503
7504 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7505             Ian Lance Taylor  <iant@google.com>
7506
7507         * target-reloc.h (relocate_section): Check the symbol table index
7508         for -1U before setting the local symbol index.
7509         (scan_relocatable_relocs): If copying the relocation, record that
7510         the local symbol is required.
7511         * object.h (Symbol_value::is_output_symtab_index_set): New
7512         function.
7513         (Symbol_value::may_be_discarded_from_output_symtab): New
7514         function.
7515         (Symbol_value::has_output_symtab_entry): New function.
7516         (Symbol_value::needs_output_symtab_entry): Remove.
7517         (Symbol_value::output_symtab_index): Make sure the symbol index is
7518         set.
7519         (Symbol_value::set_output_symtab_index): Make sure the symbol
7520         index is not set.  Make sure the new index is valid.
7521         (Symbol_value::set_must_have_output_symtab_entry): New function.
7522         (Symbol_value::has_output_dynsym_entry): New function.
7523         (Symbol_value::set_output_dynsym_index): Make sure the new index
7524         is valid.
7525         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7526         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7527         local symbol if permitted.
7528         (Sized_relobj::do_finalize_local_symbols): Call
7529         is_output_symtab_index_set rather than needs_output_symtab_entry.
7530         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7531         rather than needs_output_symtab_entry.  Call
7532         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7533         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7534         is_output_symtab_index_set rather than needs_output_symtab_entry.
7535         * testsuite/discard_locals_relocatable_test.c: New file.
7536         * testsuite/discard_locals_test.sh: Test -r.
7537         * testsuite/Makefile.am (check_DATA): Add
7538         discard_locals_relocatable_test1.syms,
7539         discard_local_relocatable_test2.syms.
7540         (MOSTLYCLEANFILES): Likewise.  Also add
7541         discard_locals_relocatable_test1.lout and
7542         discard_locals_relocatable_test2.out.
7543         (discard_locals_relocatable_test1.syms): New target.
7544         (discard_locals_relocatable_test.o): New target.
7545         (discard_locals_relocatable_test1.out): New target.
7546         (discard_locals_relocatable_test2.syms): New target.
7547         (discard_locals_relocatable_test2.out): New target.
7548         (various): Add missing ../ld-new dependencies.
7549         * testsuite/Makefile.in: Rebuild.
7550
7551 2010-03-03  Nick Clifton  <nickc@redhat.com>
7552
7553         * po/fi.po: New Finnish translation.
7554
7555 2010-03-01  Doug Kwan  <dougkwan@google.com>
7556
7557         * layout.cc (Layout::Layout): Force section types of .init_array*,
7558         .preinit_array* and .fini_array* sections.
7559         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7560         Fix check of return value of std::string::find.().
7561         (Output_section::Input_section_sort_compare::operator()): Remove
7562         comment about .init_array.
7563         (Output_section::Input_section_sort_init_fini_compare::operator()):
7564         New method.
7565         (Output_section::sort_attached_input_sections): Handle .init_array
7566         and .fini_array specially.
7567         * output.h (Output_section::Inut_section_sort_compare): Update
7568         comment.
7569         (Output_section::Input_section_sort_init_fini_compare): New struct.
7570
7571 2010-02-26  Doug Kwan  <dougkwan@google.com>
7572
7573         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7574         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7575         * testsuite/debug_msg.sh: Avoid matching source line number for
7576         use of global variable undef_int.
7577
7578 2010-02-26  Doug Kwan  <dougkwan@google.com>
7579
7580         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7581         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7582         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7583         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7584         * options.cc (General_options::General_options): Initialize member
7585         fix_v4bx_.
7586         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7587         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7588         and rm_no_fix_v4bx.stdout
7589         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7590         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7591         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7592         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7593         and arm_no_fix_v4bx.
7594         * Makefile.in: Regenerate.
7595         * testsuite/arm_fix_v4bx.s: New file.
7596         * testsuite/arm_fix_v4bx.sh: Ditto.
7597
7598 2010-02-24  Doug Kwan  <dougkwan@google.com>
7599
7600         * arm.cc (Target_arm::got_section): Make the .got section the first
7601         non RELRO section in the data segment.
7602         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7603         suffixes of section names.
7604
7605 2010-02-24  Doug Kwan  <dougkwan@google.com>
7606
7607         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7608         flags and attributes merging if an input file is a binary file.
7609         * fileread.cc (Input_file::open): Record format of original file.
7610         * fileread.h (Input_file::Format): New enum type.
7611         (Input_file::Input_file): Initialize data member format_.
7612         (Input_file::format): New method definition.
7613         (Input_file::format_):: New data member.
7614
7615 2010-02-24  Doug Kwan  <dougkwan@google.com>
7616
7617         * arm.cc (Arm_output_data_got): New class.
7618         (ARM_TCB_SIZE): New constant
7619         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7620         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7621         If user uses a script with a SECTIONS clause, issue only a warning
7622         for a misplaced EXIDX input section.  Otherwise, issue an error.
7623         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7624         garbage collection.
7625         (Target_arm::got_mode_index_entry): Handle static linking.
7626         (Target_arm::Scan::local): Ditto.
7627         (Target_arm::Scan::global): Ditto.
7628         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7629         all incorrectly implemented relocations.
7630         (Target_arm::fix_exidx_coverage): Pass layout to
7631         Arm_output_section::fix_exidx_coverage.
7632         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7633         from ".ARM.exidx." and ".ARM.extab.".
7634
7635 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7636
7637         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7638         section if it does not already exist.
7639         * attributes.cc (Attributes_section_data::Attributes_section_data):
7640         Don't crash if size is zero.
7641
7642 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7643             Ian Lance Taylor  <iant@google.com>
7644
7645         * gold.cc (queue_middle_tasks): If no input files were opened,
7646         exit.
7647         * workqueue.h (Task_function::Task_function): Assert that there is
7648         a blocker.
7649
7650 2010-02-22  Doug Kwan  <dougkwan@google.com>
7651
7652         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7653         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7654         types to avoid warnings due to different uint64_t implementations
7655         on different hosts.
7656
7657 2010-02-21  Doug Kwan  <dougkwan@google.com>
7658
7659         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7660         handling of the maximum backward branch offset.
7661         (Arm_relocate_functions::thumb_branch_common): Ditto.
7662         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7663         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7664         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7665         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7666         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7667         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7668         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7669         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7670         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7671         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7672         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7673         thumb2_bl_out_of_range.o): New rules.
7674         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7675         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7676         thumb2_bl_out_of_range
7677         * testsuite/Makefile.in: Regenerate.
7678         * testsuite/arm_bl_in_range.s: New file.
7679         * testsuite/arm_bl_out_of_range.s: Ditto.
7680         * testsuite/arm_branch_in_range.sh: Ditto.
7681         * testsuite/arm_branch_range.t: Ditto.
7682         * testsuite/thumb2_branch_range.t: Ditto.
7683         * testsuite/thumb_bl_in_range.s: Ditto.
7684         * testsuite/thumb_bl_out_of_range.s: Ditto.
7685         * testsuite/thumb_branch_range.t: Ditto.
7686
7687 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7688
7689         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7690         Add reloc offset information.
7691         * icf.cc (get_section_contents): Change iterators to point to the new
7692         vectors. Add reloc offset information to the contents.
7693         * icf.h (Icf::Sections_reachable_info): New typedef.
7694         (Icf::Sections_reachable_list): New typedef.
7695         (Icf::Offset_info): New typedef.
7696         (Icf::Reloc_info): New struct typedef.
7697         (Icf::Reloc_info_list): New typedef.
7698         (Icf::symbol_reloc_list): Delete method.
7699         (Icf::addend_reloc_list): Delete method.
7700         (Icf::section_reloc_list): Delete method.
7701         (Icf::reloc_info_list): New method.
7702         (Icf::reloc_info_list_): New member.
7703
7704 2010-02-19  Doug Kwan  <dougkwan@google.com>
7705
7706         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7707         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7708         * arm.cc (Arm_relocation_functions): New forward declaration.
7709         (Target_arm::Target_arm): Initialize new data members
7710         got_mod_index_offset_ and tls_base_symbol_defined_.
7711         (Target_arm::Relocate::relocate_tls): New method.
7712         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7713          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7714         New methods.
7715         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7716         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7717         (Target_arm::got_mod_index_offset_,
7718         Target_arm::tls_base_symbol_defined_): New data members.
7719         (Target_arm::Scan::local, Target::Scan::global,
7720         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7721         relocations.
7722
7723 2010-02-18  Doug Kwan  <dougkwan@google.com>
7724
7725         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7726         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7727         text section as a parameter becuase some broken tools may not set
7728         the link in section header.
7729         (Target_arm::has_got_section): New method.
7730         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7731         without any mapping symbol as data only.  Remove warning.
7732         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7733         link in its section header, try to discover the link by inspecting the
7734         REL31 relocation at the beginning of the section.
7735         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7736         in error message.
7737         (Target_arm::Scan::global): Treat any reference to the symbol
7738         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7739
7740 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7741
7742         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7743         (Scan::global_reloc_may_be_function_pointer): New function.
7744         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7745         (Scan::global_reloc_may_be_function_pointer): New function.
7746         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7747         (Scan::global_reloc_may_be_function_pointer): New function.
7748         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7749         (Scan::global_reloc_may_be_function_pointer): New function.
7750         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7751         (Scan::global_reloc_may_be_function_pointer): New function.
7752         (Scan::possible_function_pointer_reloc): New function.
7753         (Target_x86_64::can_check_for_function_pointers): New function.
7754         * gc.h (gc_process_relocs): Scan relocation types to determine if
7755         function pointers were taken for targets that support it.
7756         * icf.cc (Icf::find_identical_sections): Include functions for
7757         folding in safe ICF whose pointer is not taken.
7758         * icf.h (Secn_fptr_taken_set): New typedef.
7759         (fptr_section_id_): New member.
7760         (section_has_function_pointers): New function.
7761         (set_section_has_function_pointers): New function.
7762         (check_section_for_function_pointers): New function.
7763         * options.h: Fix comment for safe ICF option.
7764         * target.h (can_check_for_function_pointers): New function.
7765         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7766         Modify icf_safe_test for X86-64.
7767         * testsuite/Makefile.in: Regenerate.
7768         * testsuite/icf_safe_so_test.cc: New file.
7769         * testsuite/icf_safe_so_test.sh: New file.
7770         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7771         (main): Change to take pointer to function kept_func_3.
7772         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7773         folding is done correctly for X86-64.
7774
7775 2010-02-12  David S. Miller  <davem@davemloft.net>
7776
7777         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7778         is_symbolless parameter.
7779         (Output_reloc<SHT_REL>::is_symbolless): New.
7780         (Output_reloc<SHT_REL>::is_symbolless_): New.
7781         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7782         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7783         (Output_reloc<SHT_RELA>::is_symbolless): New.
7784         (Output_data_reloc::add_global): Handle is_symbolless.
7785         (Output_data_reloc::add_global_relative): Likewise.
7786         (Output_data_reloc::add_local): Likewise.
7787         (Output_data_reloc::add_local_relative): Likewise.
7788         (Output_data_reloc::add_symbolless_global_addend): New.
7789         (Output_data_reloc::add_symbolless_local_addend): New.
7790         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7791         is_symbolless.
7792         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7793         instead of ->is_relative_
7794         (Output_reloc::write): Likewise.
7795         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7796         (Output_reloc::write_rel): Simplify.
7797
7798         * sparc.cc (Target_sparc::Scan::local): Use
7799         ->add_symbolless_local_addend as needed.
7800         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7801         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7802         based upon relocation offset.
7803
7804 2010-02-11  Doug Kwan  <dougkwan@google.com>
7805
7806         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7807         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7808         beginning of function.
7809         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7810         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7811         parameter is_32bit in calls to should_apply_static_reloc.
7812         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7813         (check_DATA): Add arm_abs_global.stdout.
7814         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7815         arm_abs_global.stdout): New rules.
7816         (MOSTLLYCLEANFILES): Add arm_abs_global
7817         * Makefile.in: Regenerate.
7818         * testsuite/arm_abs_global.s: New file.
7819         * testsuite/arm_abs_global.sh: Ditto.
7820         * testsuite/arm_abs_lib.s: Ditto.
7821
7822 2010-02-11  Ian Lance Taylor  <iant@google.com>
7823
7824         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7825         Read_relocs task.
7826         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7827         Allocate_commons_task first.
7828         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7829         task, rather than symtab_lock_.
7830         (Gc_process_relocs::~Gc_process_relocs): New function.
7831         (Gc_process_relocs::is_runnable): Check this_blocker_.
7832         (Gc_process_relocs::locks): Use next_blocker_ rather than
7833         blocker_.
7834         (Scan_relocs::~Scan_relocs): New function.
7835         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7836         symtab_lock_.
7837         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7838         next_blocker_.
7839         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7840         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7841         constructor accordingly.
7842         (class Gc_process_relocs): Likewise.
7843         (class Scan_relocs): Likewise.
7844         * common.h (class Allocate_commons_task): Remove symtab_lock_
7845         field, and corresponding constructor parameter.
7846         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7847         symtab_lock_.
7848         (Allocate_commons_task::locks): Likewise.
7849
7850 2010-02-11  Ian Lance Taylor  <iant@google.com>
7851
7852         * gold-threads.h (class Once): Define.
7853         (class Initialize_lock): Rewrite as child of Once.
7854         * gold-threads.cc (class Once_initialize): Define.
7855         (once_pointer_control): New static variable.
7856         (once_pointer, once_arg): New static variables.
7857         (c_run_once): New static function.
7858         (Once::Once, Once::run_once, Once::internal_run): New functions.
7859         (class Initialize_lock_once): Remove.
7860         (initialize_lock_control): Remove.
7861         (initialize_lock_pointer): Remove.
7862         (initialize_lock_once): Remove.
7863         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7864         (Initialize_lock::initialize): Rewrite.
7865         (Initialize_lock::do_run_once): New function.
7866         * archive.cc (Archive::interpret_header): Only clear name if it is
7867         not already empty.
7868         * fileread.cc: Include "gold-threads.h"
7869         (file_counts_lock): New static variable.
7870         (file_counts_initialize_lock): Likewise.
7871         (File_read::release): Only increment counts when using --stats.
7872         Use a lock around the increment.
7873         * parameters.cc (class Set_parameters_target_once): Define.
7874         (set_parameters_target_once): New static variable.
7875         (Parameters::Parameters): Move here from parameters.h.
7876         (Parameters::set_target): Rewrite.
7877         (Parameters::set_target_once): New function.
7878         (Parameters::clear_target): Move here and rewrite.
7879         * parameters.h (class Parameters): Update declarations.  Add
7880         set_parameters_target_once_ field.
7881         (Parameters::Parameters): Move to parameters.cc.
7882         (Parameters::clear_target): Likewise.
7883         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7884         task.
7885         (Start_group::~Start_group): New function.
7886         (Start_group::is_runnable): New function.
7887         (Start_group::locks, Start_group::run): New functions.
7888         (Finish_group::run): Change saw_undefined to size_t.
7889         * readsyms.h (class Start_group): Define.
7890         (class Finish_group): Change saw_undefined_ field to size_t.
7891         (Finish_group::Finish_group): Remove saw_undefined and
7892         this_blocker parameters.  Change all callers.
7893         (Finish_group::set_saw_undefined): New function.
7894         (Finish_group::set_blocker): New function.
7895         * symtab.h (class Symbol_table): Change saw_undefined to return
7896         size_t.  Change saw_undefined_ field to size_t.
7897         * target-select.cc (Set_target_once::do_run_once): New function.
7898         (Target_selector::Target_selector): Initialize set_target_once_
7899         field.  Don't initialize lock_ and initialize_lock_ fields.
7900         (Target_selector::instantiate_target): Rewrite.
7901         (Target_selector::set_target): New function.
7902         * target-select.h (class Set_target_once): Define.
7903         (class Target_selector): Update declarations.  Make
7904         Set_target_once a friend.  Remove lock_ and initialize_lock_
7905         fields.  Add set_target_once_ field.
7906
7907 2010-02-10  Ian Lance Taylor  <iant@google.com>
7908
7909         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7910         queueing any tasks.
7911         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7912         (queue_middle_tasks): Add all blockers before queueing any tasks.
7913         (queue_final_tasks): Likewise.
7914         * token.h (Task_token::add_blockers): New function.
7915         * object.h (Input_objects::number_of_relobjs): New function.
7916
7917 2010-02-10  Ian Lance Taylor  <iant@google.com>
7918
7919         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7920         shared, not if not position independent.
7921         * x86_64.cc (Relocate::relocate_tls): Likewise.
7922         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7923         (tls_pie_pic_test): New target.
7924         * testsuite/Makefile.in: Rebuild.
7925
7926         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7927         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7928         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7929         * testsuite/Makefile.in: Rebuild.
7930
7931 2010-02-09  David S. Miller  <davem@davemloft.net>
7932
7933         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7934         R_SPARC_RELATIVE using ->add_local_relative().
7935         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7936
7937         * output.h (Output_data_dynamic::add_section_size): New method
7938         that takes two Output_data objects.
7939         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7940         entry param.  Handle it in initializers.
7941         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7942         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7943         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7944         arg.
7945         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7946         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7947         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7948         for dynrel_includes_plt.
7949         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7950         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7951         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7952         before .rela.plt
7953         (Target_sparc::do_finalize_sections): Update to pass true for
7954         dynrel_includes_plt.
7955         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7956         output before .rela.plt
7957         (Target_powerpc::do_finalize_sections): Update to pass true for
7958         dynrel_includes_plt when 32-bit.
7959
7960 2010-02-08  Doug Kwan  <dougkwan@google.com>
7961
7962         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7963         method.
7964         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7965         Arm_relobj::scan_section_for_cortex_a8_stubs,
7966         Arm_relobj::do_relocation_section): Instead of calling
7967         Output_section::output_address, use faster
7968         Arm_relobj::simple_input_section_output_address.
7969
7970 2010-02-08  David S. Miller  <davem@davemloft.net>
7971
7972         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7973         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7974         relocation helper function.
7975
7976         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7977         just like R_SPARC_GOT{10,13,22}.
7978         (Target_sparc::Scan::local): Likewise.
7979         (Target_sparc::Relocate:relocate): Likewise.
7980
7981 2010-02-06  Ian Lance Taylor  <iant@google.com>
7982
7983         * configure.ac: Rewrite targetobjs duplicate removal code to use
7984         only shell constructs.
7985         * configure: Rebuild.
7986
7987 2010-02-05  Doug Kwan  <dougkwan@google.com>
7988
7989         PR 11247
7990         * arm.cc (Arm_relobj::section_is_scannable): New method.
7991         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7992         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7993
7994 2010-02-04  Doug Kwan  <dougkwan@google.com>
7995
7996         PR 11247
7997         * arm-reloc-property.cc (cstdio): Include.
7998         * configure.ac (targetobjs): Remove duplicates.
7999         * configure: Regenerate.
8000         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8001         big and little endian version for a given address size.
8002
8003 2010-02-03  Doug Kwan  <dougkwan@google.com>
8004
8005         * arm-reloc-property.cc
8006         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8007         definition.
8008         * arm-reloc-property.h
8009         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8010         New method definition.
8011         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8012         declaration.
8013         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8014         overflow to N.
8015         (GOT_PREL): Change implemented to Y.
8016         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8017         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8018         (Arm_relocate_functions::movw_abs_nc): Remove method.
8019         (Arm_relocate_functions::movt_abs): Ditto.
8020         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8021         (Arm_relocate_functions::thm_movt_abs): Ditto.
8022         (Arm_relocate_functions::movw_rel_nc): Ditto.
8023         (Arm_relocate_functions::movw_rel): Ditto.
8024         (Arm_relocate_functions::movt_rel): Ditto.
8025         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8026         (Arm_relocate_functions:thm_movw_rel): Ditto.
8027         (Arm_relocate_functions:thm_movt_rel): Ditto.
8028         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8029         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8030         New method definitions.
8031         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8032         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8033         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8034         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8035         (Target_arm::Relocate::relocate): Check for non-static or
8036         unimplemented relocation code and exit early.  Change calls to
8037         Target_arm::reloc_uses_thumb_bit and
8038         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8039         instead.  Refactor code to handle similar relocations to increase
8040         code sharing.  Remove check for unsupported relocation code in switch
8041         statement.
8042         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8043         relocation property table to find out size.  Change error message to
8044         print out the name of a relocation code instead of the numeric value.
8045         (Target_arm::scan_reloc_for_stub): Use relocation property table
8046         instead of calling Target_arm::reloc_uses_thumb_bit().
8047
8048 2010-02-02  Doug Kwan  <dougkwan@google.com>
8049
8050         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8051         types of relaxed input section.
8052
8053 2010-02-02  Doug Kwan  <dougkwan@google.com>
8054
8055         * Makefile.am (HFILES): Add arm-reloc-property.h.
8056         (DEFFILES): New.
8057         (TARGETSOURCES): Add arm-reloc-property.cc
8058         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8059         (libgold_a_SOURCES): $(DEFFILES)
8060         * Makefile.in: Regenerate.
8061         * arm-reloc-property.cc: New file.
8062         * arm-reloc-property.h: New file.
8063         * arm-reloc.def: New file.
8064         * arm.cc: Update comments.
8065         (arm-reloc-property.h): New included header.
8066         (arm_reloc_property_table): New global variable.
8067         (Target_arm::do_select_as_default_target): New method definition.
8068         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8069         arm-reloc-property to targ_extra_obj.
8070         * parameters.cc (set_parameters_target): Call
8071         Target::select_as_default_target().
8072         * target.h (Target::select_as_default_target): New method definition.
8073         (Target::do_select_as_default_target): Same.
8074
8075 2010-02-01  Doug Kwan  <dougkwan@google.com>
8076
8077         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8078         first_output_text_section_.
8079         (Arm_exidx_fixup::first_output_text_section): New method definition.
8080         (Arm_exidx_fixup::first_output_text_section_): New data member.
8081         (Arm_exidx_fixup::process_exidx_section): Record the first text
8082         output section seen.
8083         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8084         and entsize in output section header.
8085
8086 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8087
8088         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8089         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8090         (Arm_relocate_functions::thm_alu11): New Method.
8091         (Arm_relocate_functions::thm_pc8): New Method.
8092         (Arm_relocate_functions::thm_pc12): New Method.
8093         (Target_arm::Scan::local): Handle the relocations.
8094         (Target_arm::Scan::global): Likewise.
8095         (Target_arm::Relocate::relocate): Likewise.
8096         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8097
8098 2010-01-29  Doug Kwan  <dougkwan@google.com>
8099
8100         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8101         of relocation types as ld.
8102
8103 2010-01-29  Doug Kwan  <dougkwan@google.com>
8104
8105         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8106         to public.
8107         (Arm_relocate_functions::thumb_branch_common): Ditto.
8108         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8109         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8110         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8111         Arm_relocate_functions::jump24): Remove.
8112         (Target_arm::Relocate::relocate): Adjust code to call
8113         Arm_relocation_functions::arm_branch_common and
8114         Arm_relocation_functions::thumb_branch_common instead of their removed
8115         wrappers.  Merge switch-cases together to reduce source code size.
8116
8117 2010-01-29  Doug Kwan  <dougkwan@google.com>
8118
8119         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8120         output_local_symbol_count_needs_update_.
8121         (Arm_relobj::output_local_symbol_count_needs_update,
8122          Arm_relobj::set_output_local_symbol_count_needs_update,
8123          Arm_relobj::update_output_local_symbol_count): New methods.
8124         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8125         member.
8126         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8127         of pointed function as in a R_ARM_PREL31 relocation.
8128         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8129         for output local symbol count updating.
8130         (Target_arm::do_relax): Update output local symbol counts in objects
8131         if necessary.
8132         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8133
8134 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8135
8136         * arm.cc: Added support for the ARM relocations:
8137         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8138         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8139         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8140         movw_prel_nc).
8141         (Arm_relocate_functions::movw_rel): New method.
8142         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8143         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8144         thm_movw_prel_nc).
8145         (Arm_relocate_functions::thm_movw_rel): New method.
8146         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8147         thm_movt_prel).
8148         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8149         relocations.
8150         (Target_arm::Scan::global): Likewise.
8151         (Target_arm::Relocate::relocate): Likewise.
8152         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8153         Likewise.
8154
8155 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8156
8157         * arm.cc: Added support for ARM group relocations.
8158         (Target_arm::reloc_needs_sym_origin): New method.
8159         (Arm_relocate_functions::calc_grp_kn): New method.
8160         (Arm_relocate_functions::calc_grp_residual): New method.
8161         (Arm_relocate_functions::calc_grp_gn): New method.
8162         (Arm_relocate_functions::arm_grp_alu): New Method.
8163         (Arm_relocate_functions::arm_grp_ldr): New Method.
8164         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8165         (Arm_relocate_functions::arm_grp_ldc): New Method.
8166         (Target_arm::Scan::local): Handle the ARM group relocations.
8167         (Target_arm::Scan::global): Likewise.
8168         (Target_arm::Relocate::relocate): Likewise.
8169         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8170         Likewise.
8171
8172 2010-01-26  Doug Kwan  <dougkwan@google.com>
8173
8174         * arm.cc (set): Include.
8175         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8176         pointer type.
8177         (Arm_output_section::Text_section_list): New type.
8178         (Arm_output_section::append_text_sections_to_list): New method.
8179         (Arm_output_section::fix_exidx_coverage): Ditto.
8180         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8181         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8182         Relobj::set_section_offset() instead of
8183         Sized_relobj::invalidate_section_offset().
8184         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8185         parameter for section headers. Ignore relocation sections for
8186         unallocated sections and EXIDX sections.
8187         (Target_arm::fix_exidx_coverage): New method.
8188         (Target_arm::output_section_address_less_than): New type.
8189         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8190         linked text section instead of the EXIDX section.
8191         (Arm_output_section::create_stub_group): Add an assertion to check
8192         that this is not an EXIDX output section.
8193         (Arm_output_section::append_text_sections_to_list): New method.
8194         (Arm_output_section::fix_exidx_coverage): Ditto.
8195         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8196         Arm_relobj::section_needs_reloc_stub_scanning.
8197         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8198         first pass.
8199         (Target_arm::fix_exidx_coverage): New method.
8200         * object.h (Relobj::set_output_section): New method.
8201         (Sized_relobj::invalidate_section_offset): Remove method.
8202         (Sized_relobj::do_invalidate_section_offset): Remove method.
8203         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8204
8205 2010-01-25  Doug Kwan  <dougkwan@google.com>
8206
8207         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8208         Fix warning due to signed and unsigned comparison on a 32-bit host.
8209
8210 2010-01-22  Doug Kwan  <dougkwan@google.com>
8211
8212         * arm.cc (Target_arm::do_relax): Record an output section for section
8213         offset adjustment it contains any stub table that has changed.
8214         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8215         offsets in an output section if necessary.
8216         * output.cc (Output_section::Output_section): Initialize
8217         section_offsets_need_adjustments_.
8218         (Output_section::add_input_section_for_script): Renamed to
8219         Output_section::add_simple_input_section.
8220         (Output_section::save_states): Add a comment.
8221         (Output_section::discard_states): New method defintion.
8222         (Output_section::adjust_section_offsets): Same.
8223         * output.h (Output_section::add_input_section_for_script): Renamed to
8224         Output_section::add_simple_input_section.
8225         (Output_section::discard_states): New method declaration.
8226         (Output_section::adjust_section_offsets): Same.
8227         (Output_section::section_offsets_need_adjustment,
8228         Output_section::set_section_offsets_need_adjustment): New method
8229         definitions.
8230         (Output_section::section_offsets_need_adjustment_): New data member.
8231         * script-sections.cc
8232         (Output_section_element_input::set_section_address): Adjust code for
8233         renaming of Output_section::add_input_section_for_script.
8234         (Orphan_output_section::set_section_address): Same.
8235
8236 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8237
8238         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8239         Fix_v4bx enum values .
8240         * gold/options.h (General_options): New option definitions.
8241         (General_options::fix_v4bx): New method.
8242         (General_options::Fix_v4bx): New enum.
8243         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8244         (General_options::parse_fix_v4bx_interworking): New method.
8245
8246 2010-01-22  Doug Kwan  <dougkwan@google.com>
8247
8248         * arm.cc (Arm_exidx_fixup): New class.
8249
8250 2010-01-21  Doug Kwan  <dougkwan@google.com>
8251
8252         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8253         classes.
8254         (Arm_exidx_section_offset_map): New type.
8255
8256 2010-01-21  Doug Kwan  <dougkwan@google.com>
8257
8258         * arm.cc (Arm_exidx_input_section): New class.
8259         (Arm_relobj::exidx_input_section_by_link,
8260         Arm_relobj::exidx_input_section_by_shndx,
8261         Arm_relobj::make_exidx_input_section): New methods.
8262         (read_arm_attributes_section): Remove.
8263         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8264         information about them.
8265         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8266         to here.
8267
8268 2010-01-20  Doug Kwan  <dougkwan@google.com>
8269
8270         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8271         Input_section_specifier to Section_id.
8272         (Target_arm::new_arm_input_section: Adjust code for change of key
8273         type.
8274         (Target_arm::find_arm_input_section): Ditto.
8275         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8276         (Section_id): Remove.
8277         (Garbage_collection::Section_id_hash): Remove.
8278         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8279         (Section_id): Remove.
8280         (Icf::Section_id_hash): Remove.
8281         * object.h (Section_id, Const_section_id, Section_id_hash,
8282         Const_section_id_hash): New type definitions.
8283         * output.cc (Output_section::add_relaxed_input_section): Change to
8284         use Const_section_id instead of Input_section_specifier as key type.
8285         (Output_section::add_merge_input_section): Ditto.
8286         (Output_section::build_relaxation_map): Change to use Section_id
8287         instead of Input_section_specifier as key type.
8288         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8289         Ditto.
8290         (Output_section::convert_input_sections_to_relaxed_sections): Change
8291         to use Const_section_id instead of Input_section_specifier as key type.
8292         (Output_section::find_merge_section): Ditto.
8293         (Output_section::find_relaxed_input_section): Ditto.
8294         * output.h (Input_section_specifier): Remove class.
8295         (Output_section::Output_section_data_by_input_section_map): Change
8296         key type to Const_section_id.
8297         (Output_section::Output_relaxed_input_section_by_input_section_map):
8298         Ditto.
8299         (Output_section::Relaxation_map): Change key type to Section_id.
8300
8301 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8302
8303         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8304         (class Arm_v4bx_stub): New class.
8305         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8306         (Stub_factory::make_arm_v4bx_stub): New method.
8307         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8308         (Stub_table::empty): Handle v4bx stubs.
8309         (Stub_table::add_arm_v4bx_stub): New method.
8310         (Stub_table::find_arm_v4bx_stub): New method.
8311         (Arm_relocate_functions::v4bx): New method.
8312         (Target_arm::fix_v4bx): New method.
8313         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8314         (Stub_table::relocate_stubs): Likewise.
8315         (Stub_table::do_write): Likewise.
8316         (Stub_table::update_data_size_and_addralign): Likewise.
8317         (Stub_table::finalize_stubs):  Likewise.
8318         (Target_arm::Scan::local): Likewise.
8319         (Target_arm::Scan::global): Likewise.
8320         (Target_arm::do_finalize_sections): Likewise.
8321         (Target_arm::Relocate::relocate): Likewise.
8322         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8323         Likewise.
8324         (Target_arm::scan_reloc_for_stub): Likewise.
8325         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8326
8327 2010-01-19  Ian Lance Taylor  <iant@google.com>
8328
8329         * output.cc (Output_section_headers::do_sized_write): Write large
8330         segment count to sh_info field.
8331         (Output_file_header::do_sized_write): For large segment count,
8332         write PN_XNUM to e_phnum field.
8333
8334 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8335
8336         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8337         (Arm_relocate_functions::thm_jump8): New function.
8338         (Arm_relocate_functions::thm_jump11): New function.
8339         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8340         R_ARM_THM_JUMP11.
8341         (Target_arm::Scan::global): Likewise.
8342         (Target_arm::Relocate::relocate): Likewise.
8343         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8344         Likewise.
8345
8346 2010-01-14  Doug Kwan  <dougkwan@google.com>
8347
8348         * arm.cc (map, utility): Include headers.
8349         (Target_arm::apply_cortex_a8_workaround): New method.
8350         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8351         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8352         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8353         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8354         the --[no-]fix-cortex-a8 command line options.
8355         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8356         (Target_arm::relocate_stub): Use addend in instruction template.
8357         * options.h (DEFINE_bool): Set the user-set flag.
8358         (General_options): Add --[no-]-fix-cortex options.
8359         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8360         : Update fast look-up map after conversion.
8361
8362 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8363
8364         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8365         in the first pass of do_layout.
8366
8367 2010-01-13  Doug Kwan  <dougkwan@google.com>
8368
8369         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8370         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8371         apparent compiler problem of not folding static constant integral
8372         data members of elfcpp::Elf_sizes<32>.
8373
8374 2010-01-13  Doug Kwan  <dougkwan@google.com>
8375
8376         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8377         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8378         Arm_relobj::scan_section_for_cortex_a8_erratum,
8379         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8380         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8381         sections to scan for relocation stubs into a new method
8382         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8383         relocation and Cortex-A8 stub scanning.
8384         (Target_arm::do_relax): Force stubs to be after stubbed sections
8385         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8386         the beginning of a new relaxation pass.  Update a comment.
8387         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8388
8389 2010-01-12  Ian Lance Taylor  <iant@google.com>
8390
8391         * target-reloc.h (visibility_error): New inline function.
8392         (relocate_section): Call visibility_error.
8393         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8394         (MOSTLYCLEANFILES): Likewise.
8395         (protected_4_pic.o, protected_3.err): New targets.
8396         * testsuite/protected_4.cc: New file.
8397
8398 2010-01-12  Doug Kwan  <dougkwan@google.com>
8399
8400         * arm.cc (Cortex_a8_reloc): New class.
8401         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8402         and cortex_a8_relocs_info_.
8403         (Target_arm::fix_cortex_a8): New method definition.
8404         (Target_arm::Cortex_a8_relocs_info): New type.
8405         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8406         New data member declarations.
8407         (Target_arm::scan_reloc_for_stub): Record information about
8408         relocations for THUMB branches that might be exempted from the
8409         Cortex-A8 workaround.
8410         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8411         at the beginning of a relaxation pass.
8412
8413 2010-01-12  Doug Kwan  <dougkwan@google.com>
8414
8415         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8416         (Arm_relobj::Mapping_symbol_position,
8417          Arm_reloj::Mapping_symbol_position_less,
8418          Arm_relobj::Mapping_symbols_info): New types.
8419         (Target_arm::is_mapping_symbol_name): New method definition.
8420         (Arm_relobj::do_count_local_symbols): Save information about mapping
8421         symbols.
8422
8423 2010-01-11  Doug Kwan  <dougkwan@google.com>
8424
8425         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8426         Arm_relocate_functions::thumb32_branch_upper,
8427         Arm_relocate_functions::thumb32_branch_lower,
8428         Arm_relocate_functions::thumb32_cond_branch_offset,
8429         Arm_relocate_functions::thumb32_cond_branch_upper,
8430         Arm_relocate_functions::thumb32_cond_branch_lower,
8431         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8432         branch offset encoding.
8433         (Arm_relocate_functions::thumb_branch_common): Use new branch
8434         offset encoding methods to avoid code duplication.
8435         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8436         (Stub_addend_reader::operator()): Use new branch encoding method
8437         to avoid code duplication.
8438
8439 2010-01-11  Doug Kwan  <dougkwan@google.com>
8440
8441         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8442         (Target_arm::do_finalize_sections): Define special EXIDX section
8443         symbols only if referenced.
8444         * gc.h (Garbage_collection::add_reference): New method.
8445         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8446         code duplication.
8447
8448 2010-01-11  Ian Lance Taylor  <iant@google.com>
8449
8450         * script.cc (Version_script_info::build_expression_list_lookup):
8451         Change complaing about duplicate wildcard match from error to
8452         warning.
8453
8454         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8455         of 2009-12-30.
8456         (Version_script_info::Version_script_info): Initialize globs_,
8457         default_version_, default_is_global_, and exact_.  Don't
8458         initialize globals_ or locals_.
8459         (Version_script_info::build_lookup_tables): Build local symbols
8460         first.
8461         (Version_script_info::unquote): New function.
8462         (Version_script_info::add_exact_match): New function.
8463         (Version_script_info::build_expression_list_lookup): Remove lookup
8464         parameter.  Add is_global parameter.  Change all callers.  Handle
8465         wildcard pattern specially.  Unquote pattern.  Call
8466         add_exact_match.
8467         (Version_script_info::get_name_to_match): New function.
8468         (Version_script_info::get_symbol_version): New function.
8469         (Version_script_info::get_symbol_version_helper): Remove.
8470         (Version_script_info::check_unmatched_names): Call unquote.
8471         * script.h (class Version_script_info): Change get_symbol_version
8472         to be non-inline and add is_global parameter; change all callers.
8473         Rewrite symbol_is_local.  Update declarations.  Define struct
8474         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8475         Remove globals_ and locals_ members.  Add exact_, globs_,
8476         default_version_, is_global_.
8477         (Version_script_info::Glob): Remove pattern, add expression and
8478         is_global.  Update constructor.  Change all callers.
8479         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8480         default version.
8481         (Versions::symbol_section_contents): If a symbol is undefined, or
8482         defined in a dynamic object, set the version index to
8483         VER_NDX_LOCAL.
8484         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8485         symbol_is_local.
8486         (Symbol_table::add_from_pluginobj): Likewise.
8487         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8488
8489 2010-01-11  Doug Kwan  <dougkwan@google.com>
8490
8491         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8492         (incremental_dump_LDADD): Add linking option for libintl.
8493         * Makefile.in: Regenerate.
8494
8495 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8496
8497         PR gold/11144
8498         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8499         instead of -Ds.
8500         * testsuite/Makefile.in: Regenerated.
8501
8502 2010-01-10  Doug Kwan  <dougkwan@google.com>
8503
8504         * options.h (DEFINE_var): Use parentheses around argument varname__
8505         in macro body to avoid any unintended subsequent substitutions.
8506
8507 2010-01-10  Ian Lance Taylor  <iant@google.com>
8508
8509         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8510         candidates before doing symbol resolution.
8511
8512         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8513         ODR candidates if only one is weak.
8514
8515 2010-01-08  Ian Lance Taylor  <iant@google.com>
8516
8517         * script.cc (Version_script_info::build_expression_list_lookup):
8518         Don't warn about ambiguous version, just record the ambiguity.
8519         (Version_script_info::get_symbol_version_helper): Give error if
8520         version is ambiguous.
8521
8522 2010-01-08  Doug Kwan  <dougkwan@google.com>
8523
8524         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8525         prev_data_size_ and prev_addralign_.  Remove initializer for
8526         deleted data member has_been_changed_.
8527         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8528         to determine if the table is empty.
8529         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8530         Remove.
8531         (Stub_table::add_reloc_stub): Define method in class definition
8532         instead of just declaring it there.
8533         (Stub_table::add_cortex_a8_stub): New method definition.
8534         (Stub_table::update_data_size_and_addralign): Ditto.
8535         (Stub_table::finalize_stubs): Ditto.
8536         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8537         (Stub_table::do_addralign_): Return address alignment in the
8538         (Stub_table::do_reset_address_and_file_offset): Define method in
8539         class definition instead of declaring it there.  Set current data
8540         size to be the data size of the previous pass.
8541         (Stub_table::set_final_data_size): Use current data size as the
8542         final data size.
8543         (Stub_table::relocate_stub): Change parameter type of stub from
8544         Reloc_stub pointer to Stub pointer.
8545         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8546         (Stub_table::Cortex_a8_stub_list): New typedef.
8547         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8548          Stub_table::prev_addralign_): New data member.
8549         (Arm_relobj::Arm_relobj): Initialize data member
8550         section_has_cortex_a8_workaround_.
8551         (Arm_relobj::section_has_cortex_a8_workaround,
8552          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8553          definitions.
8554         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8555         declarations.
8556         (Target_arm::relocate_stub): Change parameter type of stub from
8557         Reloc_stub pointer to Stub pointer.
8558         (Insn_template::size, Insn_template::alignment): Handle
8559         THUMB16_SPECIAL_TYPE.
8560         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8561          Stub_table::update_data_size_and_addralign,
8562          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8563         definitions.
8564         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8565         (Stub_table::do_write): Ditto.
8566         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8567
8568 2010-01-08  Ian Lance Taylor  <iant@google.com>
8569
8570         PR 11108
8571         * symtab.h (class Symbol): Remove fields is_target_special_ and
8572         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8573         (Symbol::is_defined_in_discarded_section): New function.
8574         (Symbol::set_is_defined_in_discarded_section): New function.
8575         (Symbol::has_plt_offset): Rewrite.
8576         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8577         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8578         Don't initialize is_target_special_ or has_plt_offset_.
8579         Initialize is_defined_in_discarded_section_.
8580         (Symbol_table::add_from_relobj): If appropriate, set
8581         is_defined_in_discarded_section.
8582         * resolve.cc (Symbol::override_base_with_special): Don't test
8583         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8584         * target-reloc.h (relocate_section): Do special handling for
8585         symbols defined in discarded sections for global symbols as well
8586         as local symbols.
8587
8588 2010-01-08  Ian Lance Taylor  <iant@google.com>
8589
8590         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8591         the SHT_SYMTAB case.
8592
8593 2010-01-08  Ian Lance Taylor  <iant@google.com>
8594
8595         * object.cc (Sized_relobj::do_layout): Don't get confused if
8596         layout_eh_frame returns NULL.
8597
8598 2010-01-08  Ian Lance Taylor  <iant@google.com>
8599
8600         PR 11084
8601         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8602         dynamic symbol table, use the normal symbol table.
8603         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8604         symbol table.
8605
8606 2010-01-08  Ian Lance Taylor  <iant@google.com>
8607
8608         PR 11072
8609         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8610         sections.
8611
8612 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8613
8614         * version.cc (print_version): Change to "Copyright 2010".
8615
8616 2010-01-08  Ian Lance Taylor  <iant@google.com>
8617
8618         PR 10287
8619         PR 11063
8620         * i386.cc (class Target_i386): Change return type of plt_section
8621         to be non-const.
8622         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8623         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8624         tls_desc_rel_ field.
8625         (Output_data_plt_i386::rel_tls_desc): New function.
8626         (Target_i386::rel_tls_desc_section): New function.
8627         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8628         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8629         R_386_TLS_DESC reloc in rel_tls_desc_section.
8630         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8631         Define struct Tlsdesc_info.
8632         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8633         (Target_x86_64::do_reloc_symbol_index): New function.
8634         (Target_x86_64::add_tlsdesc_info): New function.
8635         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8636         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8637         tlsdesc_rel_ field.
8638         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8639         all callers.
8640         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8641         (Target_x86_64::rela_tlsdesc_section): New function.
8642         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8643         handling.
8644         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8645         (Target_x86_64::do_reloc_addend): New function.
8646         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8647         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8648         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8649         (Output_reloc::type): New function.
8650         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8651         (Output_reloc::is_target_specific): New function.
8652         (Output_reloc::target_arg): New function.
8653         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8654         absolute relocs and target specific relocs.
8655         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8656         add_target_specific.
8657         (class Output_data_reloc) [SHT_RELA]: Likewise.
8658         * output.cc (Output_reloc::Output_reloc): Add four new versions
8659         for absolute relocs and target specific relocs.
8660         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8661         (Output_reloc::get_symbol_index): Likewise.
8662         (Output_reloc::local_section_offset): Check that local_sym_index_
8663         is not TARGET_CODE or 0.
8664         (Output_reloc::symbol_value): Likewise.
8665         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8666         reloc.
8667         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8668         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8669         functions.
8670         * layout.cc (add_target_dynamic_tags): Use output section for
8671         DT_PLTRELSZ and DT_JMPREL.
8672
8673 2010-01-07  Ian Lance Taylor  <iant@google.com>
8674
8675         PR 11061
8676         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8677         function.
8678         (class Output_data_reloc_generic): Define.
8679         (class Output_data_reloc_base): Change base class to
8680         Output_data_reloc_generic.  Change add() method to call
8681         bump_relative_reloc_count for a relative reloc.  Remove
8682         sort_relocs_ field.
8683         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8684         to sort_relocs().
8685         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8686         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8687         appropriate.
8688         * layout.h (class Layout): Update declaration.
8689
8690 2010-01-07  Ian Lance Taylor  <iant@google.com>
8691
8692         * output.h (class Output_data): Add const version of
8693         output_section and do_output_section.
8694         (class Output_section_data): Add const version of
8695         do_output_section.
8696         (class Output_section): Likewise.
8697         * layout.cc (Layout::add_target_dynamic_tags): New function.
8698         * layout.h (class Layout): Update declarations.
8699         * arm.cc (Target_arm::do_finalize_sections): Use
8700         add_target_dynamic_tags.
8701         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8702         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8703         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8704         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8705
8706 2010-01-07  Ian Lance Taylor  <iant@google.com>
8707
8708         PR 11042
8709         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8710         object as needed.
8711
8712 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8713             Ian Lance Taylor  <iant@google.com>
8714
8715         PR 11019
8716         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8717         Xindex::read_symtab_xindex.
8718
8719 2010-01-07  Doug Kwan  <dougkwan@google.com>
8720
8721         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8722         (Insn_template::thumb16_bcond_insn): New method declaration.
8723         (Insn_template): Fix spelling.
8724         (Stub::thumb16_special): New method declaration.
8725         (Stub::do_write): Define virtual method which was previously pure
8726         virtual.
8727         (Stub::do_thumb16_special): New method declaration.
8728         (Stub::do_fixed_endian_write): New template member.
8729         (Reloc_stub::do_write): Remove.
8730         (Reloc_stub::do_fixed_endian_write): Remove.
8731         (Cortex_a8_stub): New class definition.
8732         (Stub_factory::make_cortex_a8_stub): New method definition.
8733         (Stub_factory::Stub_factory): Add missing static storage class
8734         qualifier for elf32_arm_stub_a8_veneer_blx.
8735
8736 2010-01-07  Ian Lance Taylor  <iant@google.com>
8737
8738         PR 10980
8739         * options.h (class General_options): Add --warn-unresolved-symbols
8740         and --error-unresolved-symbols.
8741         * errors.cc (Errors::undefined_symbol): Implement
8742         --warn-unresolved-symbols.
8743
8744         * options.h (class General_options): Add -z text and -z textoff.
8745         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8746
8747 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8748
8749         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8750         (Garbage_collection::cident_sections): New function.
8751         (Garbage_collection::add_cident_section): New function.
8752         (Garbage_collection::cident_sections_): New member.
8753         (gc_process_relocs): Add references to sections whose names are C
8754         identifiers.
8755         * gold.h (cident_section_start_prefix): New constant.
8756         (cident_section_stop_prefix): New constant.
8757         (is_cident): New function.
8758         * layout.cc (Layout::define_section_symbols): Replace string constants
8759         with the newly defined constants.
8760         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8761         C identifiers.
8762         * testsuite/Makefile.am: Add gc_orphan_section_test.
8763         * testsuite/Makefile.in: Regenerate.
8764         * testsuite/gc_orphan_section_test.cc: New file.
8765         * testsuite/gc_orphan_section_test.sh: New file.
8766
8767 2010-01-06  Ian Lance Taylor  <iant@google.com>
8768
8769         PR 10980
8770         * options.h (class General_options): Add --warn-shared-textrel.
8771         * layout.cc (Layout::finish_dynamic_section): Implement
8772         --warn-shared-textrel.
8773
8774         PR 10980
8775         * options.h (class General_options): Add --warn-multiple-gp.
8776
8777 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8778
8779         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8780         $(THREADSLIB) and $(LIBDL).
8781         * Makefile.in: Rebuild.
8782
8783 2010-01-06  Ian Lance Taylor  <iant@google.com>
8784
8785         PR 10980
8786         * options.cc (General_options::parse_section_start): New function.
8787         (General_options::section_start): New function.
8788         (General_options::General_options): Initialize all members.
8789         * options.h: Include <map>
8790         (class General_options): Add --section-start.  Add section_starts_
8791         member.
8792         * layout.cc (Layout::attach_allocated_section_to_segment): If
8793         --section-start was used, set the address of the segment.  Remove
8794         local sort_sections.
8795         (Layout::relaxation_loop_body): If the address of the load segment
8796         has been set by --section-start, don't use it.
8797         * output.h (Output_segment::update_flags_for_output_section): New
8798         function.
8799         * output.cc (Output_segment::add_output_section): Call
8800         update_flags_for_output_section.
8801
8802 2010-01-05  Ian Lance Taylor  <iant@google.com>
8803
8804         PR 10980
8805         * options.h (class General_options): Add --undefined-version.
8806         * script.cc (struct Version_expression): Add was_matched_by_symbol
8807         field.
8808         (Version_script_info::matched_symbol): New function.
8809         (Version_script_info::get_symbol_version_helper): Call
8810         matched_symbol.
8811         (Version_script_info::check_unmatched_names): New function.
8812         * script.h (class Version_script_info): Update declarations.
8813         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8814
8815         * options.h (class General_options): Use DEFINE_bool_alias for
8816         allow_multiple_definition.
8817         * resolve.cc (Symbol_table::should_override): Don't test
8818         allow_multiple_definition.
8819
8820         PR 10980
8821         * options.h (class General_options): Add --cref.
8822         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8823         until after printing cref table.
8824         * cref.cc: Include "symtab.h".
8825         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8826         (Cref_table_compare::operator()): New function.
8827         (Cref_inputs::gather_cref): New function.
8828         (filecol): New static const.
8829         (Cref_inputs::print_cref): New function.
8830         (Cref::print_cref): New function.
8831         * cref.h: Include <cstdio>.
8832         (class Cref): Update declarations.
8833         * mapfile.h (Mapfile::file): New function.
8834         * object.h (class Object): Define Symbols.  Declare virtual
8835         do_get_global_symbols.
8836         (Object::get_global_symbols): New function.
8837         * object.cc (Input_objects::add_object): Pass object to cref_ if
8838         --cref.
8839         (Input_objects::archive_start): Likewise.
8840         (Input_objects::archive_stop): Likewise.
8841         (Input_objects::print_cref): New function.
8842         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8843         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8844         --cref.
8845         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8846         function.
8847         * plugin.h (class Sized_pluginobj): Update declarations.
8848
8849 2010-01-05  Ian Lance Taylor  <iant@google.com>
8850
8851         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8852         to is_default_version.  Rename insdef to insdefault.
8853         (Symbol_table::add_from_relobj): Rename def to is_default_version
8854         and local to is_forced_local.
8855         (Symbol_table::add_from_pluginobj): Likewise.
8856         (Symbol_table::add_from_dynobj): Likewise.
8857         (Symbol_table::define_special_symbol): Rename insdef to
8858         insdefault.
8859
8860 2010-01-04  Ian Lance Taylor  <iant@google.com>
8861
8862         PR 10980
8863         * options.h (class General_options): Add
8864         --allow-multiple-definition and -z muldefs.
8865         * resolve.cc (Symbol_table::should_override): Don't warn about a
8866         multiple symbol definition if --allow-multiple-definition or -z
8867         muldefs.
8868
8869         PR 10980
8870         * options.h (class General_options): Add --add-needed and
8871         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8872         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8873         error if --copy-dt-needed-entries aka --add-needed is used and
8874         would cause a change in behaviour.
8875
8876         PR 10980
8877         * options.h (class General_options): Add -G as a short version of
8878         --shared.  Add no-op options -assert, -g, and -i.
8879
8880 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8881
8882         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8883         check for .text or .gnu.linkonce.t sections.
8884         * icf.cc (Icf::find_identical_sections): Ditto.
8885         Change the detection for mangled function name within the section
8886         name.
8887         * icf.h (is_section_foldable_candidate): New function.
8888
8889 2009-12-30  Ian Lance Taylor  <iant@google.com>
8890
8891         PR 10980
8892         * options.h (class General_options): Permit two dashes with
8893         --retain-symbols-file.
8894
8895 2009-12-30  Ian Lance Taylor  <iant@google.com>
8896
8897         PR 10979
8898         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8899         don't put the file header and segment headers in the text
8900         segment.
8901
8902         PR 10979
8903         * common.cc (Sort_commons::operator()): Stabilize sort when both
8904         entries are NULL.
8905         (Symbol_table::do_allocate_commons_list): When allocating common
8906         symbols, skip a symbol which is no longer common.
8907         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8908         an object before checking its type.
8909         * testsuite/common_test_2.c: New file.
8910         * testsuite/common_test_3.c: New file.
8911         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8912         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8913         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8914         (common_test_2_pic.o, common_test_2.so): New targets.
8915         (common_test_3_pic.o, common_test_3.so): New targets.
8916         * testsuite/Makefile.in: Rebuild.
8917
8918         PR 10979
8919         * script.cc (read_input_script): If we see a new SECTIONS clause,
8920         and we have added an input section, give an error.
8921         * layout.h (class Layout): Add have_added_input_section function.
8922         Add have_added_input_section_ field.
8923         * layout.cc (Layout::Layout): Initialize
8924         have_added_input_section_.
8925         (Layout::layout): Set have_added_input_section_.
8926         (Layout::layout_eh_frame): Likewise.
8927
8928 2009-12-30  Ian Lance Taylor  <iant@google.com>
8929
8930         PR 10931
8931         * options.h (class General_options): Add --sort-common option.
8932         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8933         * common.cc (Sort_common): Add sort_order parameter to
8934         constructor.  Add sort_order_ field.
8935         (Sort_commons::operator): Check sort_order_.
8936         (Symbol_table::allocate_commons): Determine the sort order.
8937         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8938         Change all callers.
8939         (Symbol_table::do_allocate_commons_list): Likewise.
8940
8941 2009-12-30  Ian Lance Taylor  <iant@google.com>
8942
8943         PR 10916
8944         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8945         symbols from this object, don't change the visibility of an
8946         undefined symbol.
8947         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8948
8949 2009-12-30  Ian Lance Taylor  <iant@google.com>
8950
8951         PR 10861
8952         * script.h (class Version_script_info): Define Language enum.
8953         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8954         new fields globals_, locals_, and is_finalized_.
8955         * script.cc: Various formatting fixes.
8956         (class Parser_closure): Change language_stack_ from a vector of
8957         std::string to one of Version_script_info::Language.  Adjust all
8958         uses accordingly.
8959         (class Lazy_demangler): Remove.
8960         (struct Version_expression): Change language from std::string to
8961         Version_script_info::Language.
8962         (Version_script_info::Version_script_info): New function.
8963         (Version_script_info::~Version_script_info): Don't call clear.
8964         (Version_script_info::finalize): New function.
8965         (Version_script_info::build_lookup_tables): New function.
8966         (Version_script_info::build_expression_list_lookup): New
8967         function.
8968         (Version_script_info::get_symbol_version_helper): Rewrite to use
8969         lookup tables.
8970         (Version_script_info::print_expression_list): Adjust to use
8971         Version_script_info::Language.
8972         (script_push_lex_into_version_mode): Check that the version script
8973         has not been finalized.
8974         (version_script_push_lang): Change language string to
8975         Version_script_info::Language.
8976         * options.cc (Command_line::version_script): New function.
8977         * options.h (class General_options): Add finalize_dynamic_list
8978         function.  Change version_script from declaration to definition.
8979         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8980         * testsuite/version_script.map: Remove duplicate def of foo.
8981         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8982         version_script.map.
8983         * testsuite/Makefile.in: Rebuild.
8984
8985 2009-12-30  Ian Lance Taylor  <iant@google.com>
8986
8987         PR 10843
8988         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8989         if the input symbol index is 0, make the output symbol index 0.
8990
8991 2009-12-30  Ian Lance Taylor  <iant@google.com>
8992
8993         PR 10670
8994         * options.h (class General_options): Add -x/--discard-all.
8995         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8996         --discard-all.  If the local symbol needs a dynamic entry, check
8997         that before handling --discard-locals.
8998
8999 2009-12-30  Ian Lance Taylor  <iant@google.com>
9000
9001         PR 10450
9002         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9003         flags to PF_R.
9004         (Output_segment::add_output_section): Don't change the flags if
9005         the type is PT_TLS.
9006
9007         PR 10450
9008         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9009         GNU hash table if they need a dynamic value.  Otherwise, don't add
9010         them if they are defined in a dynamic object or are forced local.
9011
9012 2009-12-29  Ian Lance Taylor  <iant@google.com>
9013
9014         PR 10450
9015         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9016         .gnu.hash table for a 32-bit target.
9017
9018         PR 10450
9019         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9020         regular and a dynamic object only needs a dynamic symbol table
9021         entry if it is externally visible.
9022
9023         PR 10450
9024         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9025         constructor.  Add global_offset_table_ field.
9026         (Target_i386::got_section): Set global_offset_table_.
9027         (Target_i386::do_finalize_sections): Set global_offset_table_
9028         size.
9029         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9030         in constructor.  Add global_offset_table_ field.
9031         (Target_x86_64::got_section): Set global_offset_table_.
9032         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9033         size.
9034
9035         * layout.cc (Layout::Layout): Initialize increase_relro_.
9036         (Layout::get_output_section): Add is_relro, is_last_relro, and
9037         is_first_non_relro parameters.  Change all callers.
9038         (Layout::choose_output_section): Likewise.
9039         (Layout::add_output_section_data): Likewise.
9040         (Layout::make_output_section): Likewise.
9041         (Layout::set_segment_offsets): Clear increase_relro when using a
9042         linker script.
9043         * layout.h (class Layout): Add increase_relro method.  Add
9044         increase_relro_ field.  Update declarations.
9045         * output.cc (Output_section::Output_section): Initialize
9046         is_last_relro_ and is_first_non_relro_.
9047         (Output_segment::add_output_section): Group relro sections is
9048         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9049         (Output_segment::maximum_alignment): Remove relro handling.
9050         (Output_segment::set_section_addresses): Add increase_relro
9051         parameter.  Change all callers.  Add initial alignment to align
9052         relro sections on separate page.  Remove old relro handling.
9053         (Output_segment::set_section_list_addresses): Remove in_relro
9054         parameter.  Change all callers.
9055         (Output_segment::set_offset): Add increase parameter.  Change all
9056         callers.  Remove old relro handling.
9057         * output.h (class Output_section): Add new methods: is_last_relro,
9058         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9059         Add is_last_relro_ and is_first_non_relro_ fields.
9060         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9061         Create separate .got.plt section.  Call increase_relro.
9062         * x86_64.cc (Target_x86_64::got_section): Likewise.
9063         * testsuite/relro_script_test.t: Add .got.plt.
9064
9065         PR 10450
9066         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9067         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9068         (Layout::finalize): Call set_dynamic_symbol_size.
9069         (Layout::set_dynamic_symbol_size): New function.
9070         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9071         set_dynamic_symbol_size.
9072
9073         PR 10450
9074         * output.h (class Output_section): Add is_entsize_zero_ field.
9075         * output.cc (Output_section::Output_section): Initialize
9076         is_entsize_zero_.
9077         (Output_section::set_entsize): If two different entsizes are
9078         requested, force it to zero.
9079         (Output_section::add_input_section): Set flags for .debug_str
9080         before updating section flags.  Set entsize.
9081         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9082         and SHF_STRING if all input sections have those flags.
9083
9084 2009-12-29   Rafael Espindola  <espindola@google.com>
9085
9086         * main.cc (main): Fix the sys time reporting.
9087         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9088         reporting.
9089
9090 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9091
9092         * options.cc (General_options::parse_version): Allow -v to exit
9093         without an error if there is nothing to link.
9094
9095 2009-12-29  Ian Lance Taylor  <iant@google.com>
9096
9097         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9098         using a version of gcc before 4.1.
9099         * configure: Rebuild.
9100
9101 2009-12-28  Chris Demetriou  <cgd@google.com>
9102
9103         * attributes.cc (Output_attributes_section_data::do_write): Use
9104         std::vector::front rather than std::vector::data.
9105
9106 2009-12-28  Ian Lance Taylor  <iant@google.com>
9107
9108         * symtab.h (class Symbol_table): Add enum Defined.
9109         * resolve.cc (Symbol_table::should_override): Add defined
9110         parameter.  Change all callers.  Test whether object is NULL
9111         before calling a method on it.
9112         (Symbol_table::report_resolve_problem): Add defined parameter.
9113         Change all callers.
9114         (Symbol_table::should_override_with_special): Likewise.
9115         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9116         parameter.  Change all callers.
9117         (Symbol_table::do_define_in_output_data): Likewise.
9118         (Symbol_table::define_in_output_segment): Likewise.
9119         (Symbol_table::do_define_in_output_segment): Likewise.
9120         (Symbol_table::define_as_constant): Likewise.
9121         (Symbol_table::do_define_as_constant): Likewise.
9122         * script.h (class Symbol_assignment): Add is_defsym parameter to
9123         constructor; change all callers.
9124         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9125         parameter.  Change all callers.  Add is_defsym_ field.
9126         (class Parser_closure): Add parsing_defsym parameter to
9127         constructor; change all callers.  Add parsing_defsym accessor
9128         function.  Add parsing_defsym_ field.
9129
9130 2009-12-28  Ian Lance Taylor  <iant@google.com>
9131
9132         * gold.cc (queue_middle_tasks): Fix formatting.
9133         * object.cc (Relobj::is_section_name_included): Likewise.
9134
9135 2009-12-23  Ian Lance Taylor  <iant@google.com>
9136
9137         * i386.cc (Target_i386::do_calls_non_split): Recognize
9138         -fsplit-stack prologue for a function with a static chain.
9139         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9140         -fsplit-stack prologue when using %r11.
9141
9142 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9143
9144         * options.cc (General_options::parse_version): Make -v continue and do
9145         the link like GNU ld does.
9146
9147 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9148
9149         * Makefile.am (CCFILES): Add timer.cc.
9150         (HFILES): Add timer.h.
9151         * configure.ac: Check for sysconf and times.
9152         * main.cc: include timer.h.
9153         (main): Use Timer instead of get_run_time.
9154         * timer.cc: New.
9155         * timer.h: New.
9156         * workqueue.cc: include timer.h.
9157         (Workqueue::find_and_run_task):
9158         Report user, sys and wall time.
9159         * Makefile.in: Regenerate.
9160         * config.in: Regenerate.
9161         * configure: Regenerate.
9162
9163 2009-12-16  Doug Kwan  <dougkwan@google.com>
9164
9165         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9166         sections.
9167         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9168         relaxed input sections.
9169         * output.cc (Output_section::find_relaxed_input_section): Change
9170         return type to Output_relaxed_input_section pointer.  Adjust code
9171         for new type of relaxed_input_section_map_.
9172         * output.h (Output_section::find_relaxed_input_section): Change
9173         return type to Output_relaxed_input_section pointer.
9174         (Output_section::Output_relaxed_input_section_by_input_section_map):
9175         New type.
9176         (Output_section::relaxed_input_section_map_): Change type to
9177         Output_section::Output_relaxed_input_section_by_input_section_map.
9178         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9179         input section.
9180
9181 2009-12-15  Ian Lance Taylor  <iant@google.com>
9182
9183         * layout.cc (Layout::create_shstrtab): Only write out after input
9184         sections if we are compressing debug sections.
9185
9186 2009-12-15  Ian Lance Taylor  <iant@google.com>
9187
9188         * archive.cc (Archive::add_symbols): Only look up a symbol without
9189         a version if there is, in fact, a version.
9190
9191 2009-12-14  Ian Lance Taylor  <iant@google.com>
9192
9193         Revert -Wshadow changes, all changes from:
9194         2009-12-11  Doug Kwan  <dougkwan@google.com>
9195         2009-12-11  Nick Clifton  <nickc@redhat.com>
9196         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9197
9198 2009-12-11  Doug Kwan  <dougkwan@google.com>
9199
9200         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9201         due to -Wshadow.
9202         * attributes.cc (Object_attribute::size): Ditto.
9203         (Attributes_section_data::size): Ditto.
9204         (Attributes_section_data::Attributes_section_data): Ditto.
9205         (Output_attributes_section_data::do_write): Ditto.
9206         * attributes.h (Object_attribute::set_type): Ditto.
9207         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9208
9209 2009-12-11  Nick Clifton  <nickc@redhat.com>
9210
9211         * archive.cc: Fix shadowed variable warnings.
9212         * arm.cc: Likewise.
9213         * compressed_output.cc: Likewise.
9214         * compressed_output.h: Likewise.
9215         * configure: Likewise.
9216         * dwarf_reader.cc: Likewise.
9217         * dynobj.cc: Likewise.
9218         * dynobj.h: Likewise.
9219         * ehframe.cc: Likewise.
9220         * ehframe.h: Likewise.
9221         * errors.cc: Likewise.
9222         * expression.cc: Likewise.
9223         * fileread.cc: Likewise.
9224         * fileread.h: Likewise.
9225         * freebsd.h: Likewise.
9226         * i386.cc: Likewise.
9227         * icf.cc: Likewise.
9228         * incremental.h: Likewise.
9229         * layout.cc: Likewise.
9230         * layout.h: Likewise.
9231         * mapfile.cc: Likewise.
9232         * merge.cc: Likewise.
9233         * merge.h: Likewise.
9234         * object.cc: Likewise.
9235         * object.h: Likewise.
9236         * options.h: Likewise.
9237         * output.cc: Likewise.
9238         * output.h: Likewise.
9239         * parameters.cc: Likewise.
9240         * plugin.cc: Likewise.
9241         * powerpc.cc: Likewise.
9242         * reduced_debug_output.cc: Likewise.
9243         * reduced_debug_output.h: Likewise.
9244         * reloc.cc: Likewise.
9245         * reloc.h: Likewise.
9246         * resolve.cc: Likewise.
9247         * script-sections.cc: Likewise.
9248         * script.cc: Likewise.
9249         * script.h: Likewise.
9250         * sparc.cc: Likewise.
9251         * symtab.cc: Likewise.
9252         * symtab.h: Likewise.
9253         * target-select.cc: Likewise.
9254         * target-select.h: Likewise.
9255         * token.h: Likewise.
9256         * workqueue.cc: Likewise.
9257         * workqueue.h: Likewise.
9258         * x86_64.cc: Likewise.
9259
9260 2009-12-10  Doug Kwan  <dougkwan@google.com>
9261
9262         * arm.cc (attributes.h): New include.
9263         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9264         (Arm_relobj::~Arm_relobj): Delete object pointed by
9265         attributes_section_data_.
9266         (Arm_relobj::attributes_section_data): New method definition.
9267         (Arm_relobj::attributes_section_data_): New data member declaration.
9268         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9269         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9270         attributes_section_data_.
9271         (Arm_dynobj::attributes_section_data): New method definition.
9272         (Arm_dynobj::attributes_section_data_): New data member declaration.
9273         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9274         initialization value of may_use_blx_ to false.
9275         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9276         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9277         object attributes to compute results instead of hard-coding.
9278         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9279         Target_arm::get_secondary_compatible_arch,
9280         Target_arm::set_secondary_compatible_arch
9281         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9282         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9283         New method declarations.
9284         (Target_arm::get_aeabi_object_attribute): New method definition.
9285         (Target_arm::attributes_section_data_): New data member declaration.
9286         (read_arm_attributes_section): New template definition.
9287         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9288         (Arm_dynobj::do_read_symbols): Ditto.
9289         (Target_arm::do_finalize_sections): Merge attributes sections from
9290         input.  Check for BLX use after attributes section merging.
9291         Fix __exidx_start and __exidx_end visibility.  Create an
9292         .ARM.attributes section if necessary.
9293         (Target_arm::get_secondary_compatible_arch,
9294         Target_arm::set_secondary_compatible_arch,
9295         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9296         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9297         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9298         New method definitions.
9299
9300 2009-12-09  Ian Lance Taylor  <iant@google.com>
9301
9302         * plugin.cc (Plugin::load): Don't cast from void* to a function
9303         pointer.
9304
9305 2009-12-09  Ian Lance Taylor  <iant@google.com>
9306
9307         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9308         information fields.
9309
9310 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9311
9312         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9313         Replace two_file_shared_1.so with two_file_shared_2.so.
9314         * testsuite/Makefile.in: Regenerated.
9315
9316 2009-12-08  Doug Kwan  <dougkwan@google.com>
9317
9318         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9319         (HFILES): Add attributes.h and int_encoding.h.
9320         * Makefile.in: Regenerate.
9321         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9322         function definitions to int_encoding.cc
9323         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9324         prototypes to int_encoding.h
9325         * reduced_debug_output.cc (int_encoding.h): New include.
9326         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9327         function definitions to int_encoding.cc
9328         (insert_into_vector, read_from_pointer): Move template definitions to
9329         int_encoding.h
9330         * attributes.cc: New file.
9331         * attributes.h: New file.
9332         * int_encoding.cc: New file.
9333         * int_encoding.h: New file.
9334
9335 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9336
9337         PR gold/11055
9338         * incremental-dump.cc (dump_incremental_inputs): New.
9339         (main): Use dump_incremental_inputs.
9340
9341 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9342
9343         PR gold/10893
9344         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9345         checking elfcpp::STT_FUNC.
9346         (Target_i386::Relocate::relocate): Likewise.
9347         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9348
9349         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9350         symbols from shared libraries into normal FUNC symbols.
9351
9352         * symtab.h (Symbol): Add is_func and use it.
9353
9354 2009-12-05  Doug Kwan  <dougkwan@google.com>
9355
9356         * arm.cc (Target_arm::arm_info): Initialize new fields
9357         attributes_section and attributes_vendor.
9358         * i386.cc (Target_i386::i386_info): Same.
9359         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9360         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9361         fields attributes_section and attributes_vendor.
9362         * sparc.cc (Target_sparc::sparc_info): Same.
9363         * target.h (Target::attributes_section, Target::attributes_vendor,
9364         Target::is_attributes_section, Target::attribute_arg_type,
9365         Target::attributes_order): New method definitions.
9366         (Target::Target_info::attributes_section,
9367         Target::Target_info::attributes_vendor): New fields.
9368         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9369         virtual method definitions.
9370         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9371         attributes_section and attributes_vendor.
9372         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9373
9374 2009-12-05  Doug Kwan  <dougkwan@google.com>
9375
9376         * arm.cc: Update comments about interworking and stub generation.
9377         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9378         considered as non-PIC.
9379         (Arm_relocate_functions::base_abs): Fix formatting.
9380         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9381         of function to use GOT entry address instead of offset.
9382         (Target_arm::Scan::global): Issue an error if a symbol would need a
9383         PLT does not get one because it is untyped.  Remove code to create
9384         dynamic symbols for relative branches.
9385         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9386         takes unsigned integer instead of boolean.
9387
9388 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9389
9390         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9391         (two_file_test_LDADD): Likewise.
9392         (common_test_1_LDADD): Likewise.
9393         (exception_test_LDADD) Likewise.
9394         (weak_test_LDADD): Likewise.
9395         (many_sections_test_LDADD): Likewise.
9396         (initpri1_LDADD): Likewise.
9397         (script_test_1_LDADD): Likewise.
9398         (script_test_2_LDADD): Likewise.
9399         (justsyms_LDADD): Likewise.
9400         (binary_test_LDADD): Likewise.
9401         (large_LDADD): Likewise.
9402         * testsuite/Makefile.in: Regenerated.
9403
9404 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9405
9406         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9407         (Symbol_table::override_with_special): Likewise.
9408         (Symbol_table::add_from_object): Likewise.
9409
9410 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9411
9412         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9413         Don't set the data_offset twice.
9414
9415 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9416
9417         * testsuite/Makefile.in: Regenerate.
9418
9419 2009-12-03  Doug Kwan  <dougkwan@google.com>
9420
9421         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9422         (Target_arm::do_finalize_sections): Add parameter for symbol table
9423         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9424         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9425         parameter for symbol table pointer.
9426         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9427         an additional parameter for a pointer to symbol table.
9428         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9429         parameter for a symbol table pointer.
9430         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9431         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9432         Ditto.
9433         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9434         parameter for a symbol table pointer.
9435
9436 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9437
9438         * incremental.cc (Incremental_inputs_header)
9439         (Incremental_inputs_header_write, Incremental_inputs_entry)
9440         (Incremental_inputs_entry_write): Move ...
9441         * incremental.h (Incremental_inputs_header)
9442         (Incremental_inputs_header_write, Incremental_inputs_entry)
9443         (Incremental_inputs_entry_write): here.
9444
9445 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9446
9447         * incremental.cc (make_sized_incremental_binary): Set the target.
9448         Error if it is incompatible.
9449         * output.h (Output_file): Add filename method.
9450
9451 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9452
9453         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9454         from the get_* methods.
9455
9456 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9457
9458         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9459         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9460         Write 0 for the data_offset of scripts.
9461
9462 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9463
9464         * testsuite/Makefile.am: Add the incremental_test.sh test.
9465         * testsuite/incremental_test.sh: New.
9466         * testsuite/incremental_test_1.c: New.
9467         * testsuite/incremental_test_2.c: New.
9468
9469 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9470
9471         * incremental-dump.cc (main): Fix typos.
9472
9473 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9474
9475         PR gold/11025
9476         * incremental-dump.cc (main): Use llu to print 64 bit values.
9477
9478 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9479             H.J. Lu  <hongjiu.lu@intel.com>
9480
9481         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9482         $(LIBDL).
9483         (incremental_dump_LDADD): Likewise.
9484         * Makefile.in: Regenerated.
9485
9486 2009-11-25  Doug Kwan  <dougkwan@google.com>
9487
9488         Revert:
9489
9490         2009-11-25  Doug Kwan  <dougkwan@google.com>
9491
9492                 * arm.cc (Target_arm::Target_arm): Move method definition
9493                 outside of class definition.  Add code to handle
9494                 --target1-rel, --target1-abs and --target2= options.
9495                 (Target_arm::get_reloc_reloc_type): Change method to be
9496                 non-static and const.
9497                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9498                 New data member declaration.
9499                 (Target_arm::Scan::local, Target_arm::Scan::global,
9500                 Target_arm::Relocate::relocate,
9501                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9502                 Adjust call to Target_arm::get_real_reloc_type.
9503                 (Target_arm::get_real_reloc_type): Use command line options
9504                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9505                 * options.h (--target1-rel, --target1-abs, --target2): New
9506                 ARM-only options.
9507
9508 2009-11-25  Doug Kwan  <dougkwan@google.com>
9509
9510         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9511         class definition.  Add code to handle --target1-rel, --target1-abs
9512         and --target2= options.
9513         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9514         and const.
9515         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9516         member declaration.
9517         (Target_arm::Scan::local, Target_arm::Scan::global,
9518         Target_arm::Relocate::relocate,
9519         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9520         call to Target_arm::get_real_reloc_type.
9521         (Target_arm::get_real_reloc_type): Use command line options to
9522         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9523         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9524         options.
9525
9526 2009-11-25  Doug Kwan  <dougkwan@google.com>
9527
9528         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9529         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9530         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9531         formatting.
9532         (Arm_relocate_functions::thm_call): Replace body with a call to
9533         Arm_relocate_functions::thumb_branch_common.
9534         (Arm_relocate_functions::thm_jump24,
9535         Arm_relocate_functions::thm_xpc22): New method definitions.
9536         (Arm_relocate_functions::thumb_branch_common): New method definition.
9537         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9538         operator.
9539         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9540         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9541
9542 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9543
9544         * Makefile.am: Build incremental-dump
9545         * Makefile.in: Regenerate.
9546         * incremental-dump.cc: New.
9547         * incremental.cc (Incremental_inputs_header_data,
9548         Incremental_inputs_entry_data): Move to incremental.h
9549         * incremental.h: (Incremental_inputs_header_data,
9550         Incremental_inputs_entry_data): Move from incremental.cc
9551
9552 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9553
9554         * incremental.cc (Incremental_inputs_header,
9555         Incremental_inputs_header_write, Incremental_inputs_entry,
9556         Incremental_inputs_entry_write): Add a typedef with the data type.
9557
9558 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9559
9560         * incremental.cc (Incremental_inputs_header,
9561         Incremental_inputs_header_write, Incremental_inputs_entry,
9562         Incremental_inputs_entry_write): Update comment about which
9563         type has the filed descriptions.
9564
9565 2009-11-15  Doug Kwan  <dougkwan@google.com>
9566
9567         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9568         (Arm_relocate_functions::arm_branch_common): Change method defintion
9569         in class definition to a method declaration and update list of formal
9570         parameters.
9571         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9572         Arm_relocation_functions::jump24): Adjust call to
9573         Arm_relocate_functions::arm_branch_common.  Update list of formal
9574         parameters.
9575         (Arm_relocate_functions::xpc25): New method definition.
9576         (Arm_relocate_functions::arm_branch_common): Move method defintion
9577         out from class definition.  Use stubs for mode-switching and extending
9578         branch ranges.
9579         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9580         specially.  Change code to enable use of stubs in ARM branches.
9581
9582 2009-11-10  Doug Kwan  <dougkwan@google.com>
9583
9584         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9585         in method declaration.
9586         (Target_arm::relocate_stub): New method declaration.
9587         (Target_arm::default_target): Change to return a pointer instead of
9588         a const reference.
9589         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9590         Target_arm::default_target.
9591         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9592         method definition.
9593         (Target_arm::relocate_section): Adjust view.
9594         (Target_arm::relocate_stub): New method definition.
9595
9596 2009-11-10  Doug Kwan  <dougkwan@google.com>
9597
9598         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9599         a format warning.
9600         * incremental.cc (open_incremental_binary): Initialized local
9601         variables to avoid warnings.
9602         * object.cc (make_elf_object): Ditto.
9603         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9604         a format warning.
9605
9606 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9607
9608         PR gold/10930
9609         * testsuite/plugin_test.c: Include "config.h".
9610
9611 2009-11-09  Doug Kwan  <dougkwan@google.com>
9612
9613         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9614         (arm_symbol_value): Remove.
9615         (Arm_relocate_functions::arm_branch_common,
9616         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9617         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9618         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9619         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9620         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9621         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9622         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9623         Arm_relocate_functions::thm_mobw_abs_nc,
9624         Arm_relocate_functions::thm_mov_abs,
9625         Arm_relocate_functions::movw_prel_nc,
9626         Arm_relocate_functions::thm_movt_abs,
9627         Arm_relocate_functions::movt_prel,
9628         Arm_relocate_functions::thm_movw_prel_nc,
9629         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9630         (Target_arm::Relocate::relocate): Only decompose address into two
9631         parts if relocation type uses the thumb-bit and pass the actual
9632         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9633         calls to methods in Arm_relocate_functions for this change.
9634
9635 2009-11-08  Ian Lance Taylor  <iant@google.com>
9636
9637         PR 10925
9638         * reloc.cc: Instantiate
9639         Sized_relobj::initialize_input_to_output_maps and
9640         Sized_relobj:free_input_to_output_maps.
9641
9642 2009-11-06  Ian Lance Taylor  <iant@google.com>
9643
9644         PR 10876
9645         * defstd.cc (in_segment): Set only_if_ref true for "end".
9646
9647 2009-11-06  Doug Kwan  <dougkwan@google.com>
9648
9649         * arm.cc (class Reloc_stub): Correct a comment.
9650         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9651         (Target_arm::scan_section_for_stubs): New method declaration.
9652         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9653         Change methods from private to protected.
9654         (Target_arm::do_may_relax): New method definition.
9655         (Target_arm::do_relax, Target_arm::group_sections,
9656         Target_arm::scan_reloc_for_stub,
9657         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9658         (Target_arm::arm_input_section_map_): New data member declaration.
9659         (Target_arm::scan_reloc_for_stub,
9660         Target_arm::scan_reloc_section_for_stubs,
9661         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9662         Target_arm::do_relax): New method definitions.
9663
9664 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9665
9666         * configure.ac: Check for (struct stat)::st_mtim
9667         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9668         * config.in: Regenerate.
9669         * configure: Regenerate.
9670
9671 2009-11-05  Ian Lance Taylor  <iant@google.com>
9672
9673         PR 10910
9674         * output.cc (Output_segment::add_output_section): Add missing
9675         return statement.
9676
9677 2009-11-04  Ian Lance Taylor  <iant@google.com>
9678
9679         PR 10880
9680         * object.h (class Object): Add is_needed and set_is_needed
9681         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9682         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9683         defined in a dynamic object and referenced by a regular object,
9684         set is_needed for the dynamic object.
9685         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9686         if the file is marked with as_needed and it is not needed.
9687
9688 2009-11-04  Ian Lance Taylor  <iant@google.com>
9689
9690         PR 10887
9691         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9692         tags if data is discarded by linker script.
9693         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9694         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9695         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9696         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9697
9698 2009-11-04  Ian Lance Taylor  <iant@google.com>
9699
9700         * layout.cc (Layout::get_output_section): Add is_interp and
9701         is_dynamic_linker_section parameters.  Change all callers.
9702         (Layout::choose_output_section): Likewise.
9703         (Layout::make_output_section): Likewise.
9704         (Layout::add_output_section_data): Add is_dynamic_linker_section
9705         parameter.  Change all callers.
9706         * layout.h (class Layout): Update declarations.
9707         * output.h (class Output_section): Add is_interp, set_is_interp,
9708         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9709         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9710         generate_code_fills_at_write_ to a bitfield.
9711         * output.cc (Output_section::Output_sections): Initialize new
9712         fields.
9713         (Output_segment::add_output_section): Add do_sort parameter.
9714         Change all callers.
9715
9716 2009-11-03  Ian Lance Taylor  <iant@google.com>
9717
9718         PR 10860
9719         * options.h (class General_options): Add --warn-common.
9720         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9721         merging two common symbols.
9722         (Symbol_table::should_override): Handle --warn-common when merging
9723         a common symbol with a defined symbol.  Use report_resolve_problem
9724         for multiple definitions.
9725         (Symbol_table::report_resolve_problem): New function.
9726         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9727
9728 2009-11-03  Doug Kwan  <dougkwan@google.com>
9729
9730         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9731         stub_factory_.
9732         (Target_arm::stub_factory): New method definition.
9733         (Target_arm::new_arm_input_section,
9734         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9735         Target_arm::reloc_uses_thumb_bit): New method declarations.
9736         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9737         New type definitions.
9738         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9739         member declarations.
9740         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9741         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9742         New method definitions.
9743
9744 2009-11-03  Ian Lance Taylor  <iant@google.com>
9745
9746         * options.h (class General_options): Add --warn_constructors.
9747
9748 2009-11-03  Ian Lance Taylor  <iant@google.com>
9749
9750         PR 10893
9751         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9752         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9753
9754 2009-11-03  Ian Lance Taylor  <iant@google.com>
9755
9756         PR 10895
9757         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9758         --msgid-bugs-address.
9759         (install-pdf): New target.
9760         (install-data_yes): Look up one directory to find mkinstalldirs.
9761
9762 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9763
9764         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9765         tree.
9766
9767 2009-10-30  Doug Kwan  <dougkwan@google.com>
9768
9769         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9770
9771 2009-10-30  Doug Kwan  <dougkwan@google.com>
9772
9773         * arm.cc (Stub_addend_reader): New struct template definition
9774         and partial specializations.
9775         (Stub_addend_reader::operator()): New method definition for a
9776         partially specialized template.
9777
9778 2009-10-30  Doug Kwan  <dougkwan@google.com>
9779
9780         * arm.cc (Arm_relobj::processor_specific_flags): New method
9781         definition.
9782         (Arm_relobj::do_read_symbols): New method declaration.
9783         (Arm_relobj::processor_specific_flags_): New data member declaration.
9784         (Arm_dynobj): New class definition.
9785         (Target_arm::do_finalize_sections): Add input_objects parameter.
9786         (Target_arm::do_adjust_elf_header): New method declaration.
9787         (Target_arm::are_eabi_versions_compatible,
9788         (Target_arm::merge_processor_specific_flags): New method declaration.
9789         (Target_arm::do_make_elf_object): New overloaded method definitions
9790         and declaration.
9791         (Arm_relobj::do_read_symbols): New method definition.
9792         (Arm_dynobj::do_read_symbols): Ditto.
9793         (Target_arm::do_finalize_sections): Add input_objects parameters.
9794         Merge processor-specific flags from all input objects.
9795         (Target_arm::are_eabi_versions_compatible,
9796         Target_arm::merge_processor_specific_flags,
9797         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9798         New method definitions.
9799         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9800         Input_objects pointer type parameter.
9801         * layout.cc (Layout::finalize): Pass input objects to target's.
9802         finalize_sections function.
9803         * output.cc (Output_file_header::do_sized_write): Set ELF file
9804         header's processor-specific flags.
9805         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9806         Input_objects pointer type parameter.
9807         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9808         * target.h (Input_objects): New forward class declaration.
9809         (Target::processor_specific_flags,
9810         Target::are_processor_specific_flags_sect): New method definitions.
9811         (Target::finalize_sections): Add input_objects parameter.
9812         (Target::Target): Initialize processor_specific_flags_ and
9813         are_processor_specific_flags_set_.
9814         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9815         parameter.
9816         (Target::set_processor_specific_flags): New method definition.
9817         (Target::processor_specific_flags_,
9818         Target::are_processor_specific_flags_set_): New data member
9819         declarations.
9820         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9821         Input_objects pointer type parameter.
9822
9823 2009-10-30  Doug Kwan  <dougkwan@google.com>
9824
9825         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9826
9827 2009-10-28  Ian Lance Taylor  <iant@google.com>
9828
9829         * object.h (class Relobj): Drop options parameter from
9830         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9831         do_scan_relocs, do_relocate.  Change all callers.
9832         (class Sized_relobj): Drop options parameters from
9833         do_gc_process_relocs, do_scan_relocs, do_relocate,
9834         do_relocate_sections, relocate_sections, emit_relocs_scan,
9835         emit_relocs_scan_reltype.  Change all callers.
9836         (struct Relocate_info): Remove options field and all references to
9837         it.
9838         * reloc.h (class Read_relocs): Remove options constructor
9839         parameter and options_ field.  Change all callers.
9840         (class Gc_process_relocs, class Scan_relocs): Likewise.
9841         (class Relocate_task): Likewise.
9842         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9843         all callers.
9844         (scan_relocatable_relocs): Likewise.
9845         * target.h (class Sized_target): Remove options parameter from
9846         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9847         all callers.
9848         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9849         callers.
9850         * arm.cc: Update functions to remove options parameters.
9851         * i386.cc: Likewise.
9852         * powerpc.cc: Likewise.
9853         * sparc.cc: Likewise.
9854         * x86_64.cc: Likewise.
9855         * testsuite/testfile.cc: Likewise.
9856
9857 2009-10-28  Doug Kwan  <dougkwan@google.com>
9858
9859         * arm.cc (Arm_relobj): New class definition.
9860         (Arm_relobj::scan_sections_for_stubs,
9861         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9862         New method definitions.
9863
9864 2009-10-28  Cary Coutant  <ccoutant@google.com>
9865
9866         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9867         (Plugin::cleanup_done_): New member.
9868         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9869         (Plugin_manager::cleanup_done_): Remove.
9870         (Plugin_manager::add_input_file): Edit error message.
9871         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9872         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9873
9874 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9875
9876         * fileread.cc: (File_read::View::~View): Use the new
9877         data_ownership_ filed.
9878         (File_read::~File_read): Dispose the new whole_file_view_.
9879         (File_read::open): Mmap the whole file if needed.
9880         (File_read::open): Use whole_file_view_ instead of contents_.
9881         (File_read::find_view): Use whole_file_view_ if applicable.
9882         (File_read::do_read): Use whole_file_view_ instead of contents_.
9883         (File_read::make_view): Use whole_file_view_ instead of contents_,
9884         update File_read::View::View call.
9885         (File_read::find_or_make_view): Update File_read::View::View
9886         call.
9887         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9888         remove contents_
9889         (File_read::View::Data_ownership): New enum.
9890         (File_read::View::View): Replace bool mapped_ with Data_ownership
9891         argument.
9892         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9893         (File_read::View::data_ownership_): New field.
9894         (File_read::contents_): Remove (replaced by whole_file_view_).
9895         (File_read::whole_file_view_): New field.
9896         * options.h (class General_options): Add --keep-files-mapped.
9897
9898 2009-10-27  Cary Coutant  <ccoutant@google.com>
9899
9900         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9901         * testsuite/Makefile.am (plugin_test_5): New test case.
9902         * testsuite/Makefile.in: Regenerate.
9903
9904 2009-10-25  Doug Kwan  <dougkwan@google.com>
9905
9906         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9907         from private to protected to allow access by child class.
9908         (Sized_relobj::do_relocate_sections): New method declaration.
9909         (Sized_relobj::relocate_sections): Virtualize.
9910         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9911         Sized_relobj::relocate_sections.  Instantiate template explicitly
9912         for different target sizes and endianity.
9913
9914 2009-10-24  Doug Kwan  <dougkwan@google.com>
9915
9916         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9917         (Arm_input_section::as_arm_input_section): New method.
9918         (Arm_output_section): New class definition.
9919         (Arm_output_section::create_stub_group,
9920         Arm_output_section::group_sections): New method definitions.
9921
9922 2009-10-22  Doug Kwan  <dougkwan@google.com>
9923
9924         * arm.cc (Arm_input_section): New class definition.
9925         (Arm_input_section::init, Arm_input_section:do_write,
9926         Arm_input_section::set_final_data_size,
9927         Arm_input_section::do_reset_address_and_file_offset): New method
9928         definitions.
9929
9930 2009-10-21  Doug Kwan  <dougkwan@google.com>
9931
9932         * arm.cc (Stub_table, Arm_input_section): New forward class
9933         declarations.
9934         (Stub_table): New class defintion.
9935         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9936         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9937         New method definition.
9938
9939 2009-10-21  Doug Kwan  <dougkwan@google.com>
9940
9941         * arm.cc: Update copyright comments.
9942         (Target_arm): New forward class template declaration.
9943         (Arm_address): New type.
9944         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9945         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9946         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9947         constants.
9948         (Insn_template): Same.
9949         (DEF_STUBS): New macro.
9950         (Stub_type): New enum type.
9951         (Stub_template): New class definition.
9952         (Stub): Same.
9953         (Reloc_stub): Same.
9954         (Stub_factory): Same.
9955         (Target_arm::Target_arm): Initialize may_use_blx_ and
9956         should_force_pic_veneer_.
9957         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9958         Target_arm::should_force_pic_veneer,
9959         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9960         Target_arm::using_thumb_only, Target_arm:;default_target): New
9961         method defintions.
9962         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9963         New data member declarations.
9964         (Insn_template::size, Insn_template::alignment): New method defintions.
9965         (Stub_template::Stub_template): New method definition.
9966         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9967         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9968         (Stub_factory::Stub_factory): New method definition.
9969         * gold.h (string_hash): New template.
9970         * output.h (Input_section_specifier::hash_value): Use
9971         gold::string_hash.
9972         (Input_section_specifier::string_hash): Remove.
9973         * stringpool.cc (Stringpool_template::string_hash): Use
9974         gold::string_hash.
9975
9976 2009-10-20  Doug Kwan  <dougkwan@google.com>
9977
9978         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9979         symbols of relaxed input sections.
9980         * output.h (Output_section::find_relaxed_input_section): Make
9981         method public.
9982
9983 2009-10-16  Doug Kwan  <dougkwan@google.com>
9984
9985         * dynobj.cc (Versions::Versions): Initialize version_script_.
9986         Only insert base version symbol definition for a shared object
9987         if version script defines any version versions.
9988         (Versions::define_base_version): New method definition.
9989         (Versions::add_def): Check that base version is not needed.
9990         (Versions::add_need): Define base version lazily.
9991         * dynobj.h (Versions::define_base_version): New method declaration.
9992         (Versions::needs_base_version_): New data member declaration.
9993         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9994         (check_DATA): Add no_version_test.stdout.
9995         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9996         New make rules.
9997         * testsuite/Makefile.in: Regenerate.
9998         * testsuite/no_version_test.c: New file.
9999         * testsuite/no_version_test.sh: Ditto.
10000
10001 2009-10-16  Doug Kwan  <dougkwan@google.com>
10002
10003         * expression.cc (class Segment_start_expression): New class definition.
10004         (Segment_start_expression::value): New method definition.
10005         (script_exp_function_segment_start): Return a new
10006         Segment_start_expression.
10007         * gold/script-c.h (script_saw_segment_start_expression): New function
10008         prototype.
10009         * script-sections.cc (Script_sections::Script_sections): Initialize
10010         SAW_SEGMENT_START_EXPRESSION_ to false.
10011         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10012         and -Tbbs options to specify section addresses if given in
10013         command line and no SEGMENT_START expression is seen in a script.
10014         * script-sections.h (Script_sections::saw_segment_start_expression,
10015         Script_sections::set_saw_segment_start_expression): New method
10016         definition.
10017         (Script_sections::saw_segment_start_expression_): New data member
10018         declaration.
10019         * script.cc (script_saw_segment_start_expression): New function.
10020         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10021         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10022         script_test_7.sh and script_test_8.sh.
10023         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10024         script_test_8.stdout.
10025         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10026         (script_test_6, script_test_6.stdout, script_test_7,
10027         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10028         * Makefile.in: Regenerate.
10029         * testsuite/script_test_6.sh: New file.
10030         * testsuite/script_test_6.t: Same.
10031         * testsuite/script_test_7.sh: Same.
10032         * testsuite/script_test_7.t: Same.
10033         * testsuite/script_test_8.sh: Same.
10034
10035 2009-10-16  Doug Kwan  <dougkwan@google.com>
10036
10037         * output.cc (Output_segment::set_section_list_address): Cast
10038         expressions to unsigned long long type to avoid format warnings.
10039
10040 2009-10-15  Ian Lance Taylor  <iant@google.com>
10041
10042         * script.cc (Script_options::add_symbol_assignment): Always add a
10043         dot assignment to script_sections_.
10044         * script-sections.cc (Script_sections::add_dot_assignment):
10045         Initialize if necessary.
10046
10047         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10048         program headers with no load segment if there is a linker script.
10049
10050         * layout.cc (Layout::set_segment_offsets): Align the file offset
10051         to the segment aligment for -N or -n with no load segment.
10052         * output.cc (Output_segment::add_output_section): Don't crash if
10053         the first section is a TLS section.
10054         (Output_segment::set_section_list_addresses): Print an error
10055         message if the address moves backward in a linker script.
10056         * script-sections.cc
10057         (Output_section_element_input::set_section_addresses): Don't
10058         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10059         (Orphan_output_section::set_section_addresses): Likewise.
10060
10061 2009-10-15  Doug Kwan  <dougkwan@google.com>
10062
10063         * layout.cc (Layout::finish_dynamic_section): Generate tags
10064         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10065         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10066         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10067
10068 2009-10-14  Ian Lance Taylor  <iant@google.com>
10069
10070         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10071         fields.
10072         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10073         data_shdr fields of relinfo.
10074         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10075         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10076         R_386_TLS_LDO_32, adjust based on section flags.
10077         (Target_i386::Relocate::fix_up_ldo): Remove.
10078
10079 2009-10-13  Ian Lance Taylor  <iant@google.com>
10080
10081         Add support for -pie.
10082         * options.h (class General_options): Add -pie and
10083         --pic-executable.
10084         (General_options::output_is_position_independent): Test -pie.
10085         (General_options::output_is_executable): Return true if not shared
10086         and not relocatable.
10087         (General_options::output_is_pie): Remove.
10088         * options.cc (General_options::finalize): Reject incompatible uses
10089         of -pie.
10090         * gold.cc (queue_middle_tasks): A -pie link is not static.
10091         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10092         * symtab.cc (Symbol::final_value_is_known): Return false if
10093         output_is_position_independent.
10094         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10095         output_is_position_independent.
10096         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10097         output_is_position_independent.
10098         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10099         output_is_position_independent.
10100         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10101         two_file_pie_test.
10102         (basic_pie_test.o, basic_pie_test): New targets.
10103         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10104         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10105         (two_file_pie_test): New target.
10106         * testsuite/Makefile.in: Rebuild.
10107         * README: Remove note saying that -pie is not supported.
10108
10109 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10110
10111         * options.h (class General_options): Add -init and -fini.
10112         * layout.cc (Layout::finish_dynamic_section): Emit
10113         given init and fini functions.
10114
10115 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10116
10117         * gc.h (gc_process_relocs): Check if icf is enabled using new
10118         function.
10119         * gold.cc (queue_initial_tasks): Likewise.
10120         (queue_middle_tasks): Likewise.
10121         * object.cc (do_layout): Likewise.
10122         * symtab.cc (is_section_folded): Likewise.
10123         * main.cc (main): Likewise.
10124         * reloc.cc (Read_relocs::run): Likewise.
10125         (Sized_relobj::do_scan_relocs): Likewise.
10126         * icf.cc (is_function_ctor_or_dtor): New function.
10127         (Icf::find_identical_sections): Check if function is ctor or dtor when
10128         safe icf is chosen.
10129         * options.h (General_options::icf): Change option to be an enum.
10130         (Icf_status): New enum.
10131         (icf_enabled): New method.
10132         (icf_safe_folding): New method.
10133         (set_icf_status): New method.
10134         (icf_status_): New variable.
10135         * (options.cc) (General_options::finalize): Set icf_status_.
10136         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10137         icf_test and icf_keep_unique_test to use the --icf enum flag.
10138         * testsuite/icf_safe_test.sh: New file.
10139         * testsuite/icf_safe_test.cc: New file.
10140
10141 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10142
10143         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10144         includes to gc.h and icf.h.
10145         * arm.cc: Include gc.h.
10146         * gold.cc: Likewise.
10147         * i386.cc: Likewise.
10148         * powerpc.cc: Likewise.
10149         * sparc.cc: Likewise.
10150         * x86_64.cc: Likewise.
10151         * gc.h: Include icf.h.
10152
10153 2009-10-11  Ian Lance Taylor  <iant@google.com>
10154
10155         * plugin.cc: Include "gold.h" before other header files.
10156
10157 2009-10-10  Chris Demetriou  <cgd@google.com>
10158
10159         * options.h (Input_file_argument::Input_file_type): New enum.
10160         (Input_file_argument::is_lib_): Replace with...
10161         (Input_file_argument::type_): New member.
10162         (Input_file_argument::Input_file_argument): Take Input_file_type
10163         'type' rather than boolean 'is_lib' as second argument.
10164         (Input_file_argument::is_lib): Use type_.
10165         (Input_file_argument::is_searched_file): New function.
10166         (Input_file_argument::may_need_search): Handle is_searched_file.
10167         * options.cc (General_options::parse_library): Support -l:filename.
10168         (General_options::parse_just_symbols): Update for Input_file_argument
10169         changes.
10170         (Command_line::process): Likewise.
10171         * archive.cc (Archive::get_file_and_offset): Likewise.
10172         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10173         * script.cc (read_script_file, script_add_file): Likewise.
10174         * fileread.cc (Input_file::Input_file): Likewise.
10175         (Input_file::will_search_for): Handle is_searched_file.
10176         (Input_file::open): Likewise.
10177         * readsyms.cc (Read_symbols::get_name): Likewise.
10178         * testsuite/Makefile.am (searched_file_test): New test.
10179         * testsuite/Makefile.in: Regenerate.
10180         * testsuite/searched_file_test.cc: New file.
10181         * testsuite/searched_file_test_lib.cc: New file.
10182
10183 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10184             Ian Lance Taylor  <iant@google.com>
10185
10186         * descriptor.cc: Include <cstdio> and "binary-io.h".
10187         (Descriptors::open): Open the files in binary mode always.
10188         * script.cc (Lex::get_token): Treat \r as whitespace.
10189
10190 2009-10-09  Ian Lance Taylor  <iant@google.com>
10191
10192         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10193
10194 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10195             Ian Lance Taylor  <iant@google.com>
10196
10197         * configure.ac: Check for readv function also.
10198         * fileread.cc (readv): Define if not HAVE_READV.
10199         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10200         does not exist.
10201         * config.in: Regenerate.
10202         * configure: Regenerate.
10203
10204 2009-10-09  Doug Kwan  <dougkwan@google.com>
10205
10206         * layout.cc (Layout::make_output_section): Call target hook to make
10207         ordinary output section.
10208         (Layout::finalize): Adjust parameter list of call the
10209         Target::may_relax().
10210         * layout.h (class Layout::section_list): New method.
10211         * merge.h (Output_merge_base::entsize): Change visibility to public.
10212         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10213         New methods.
10214         (Output_merge_string::do_is_string): New method.
10215         * object.cc (Sized_relobj::do_setup): renamed from
10216         Sized_relobj::set_up.
10217         * object.h (Sized_relobj::adjust_shndx,
10218         Sized_relobj::initializ_input_to_output_maps,
10219         Sized_relobj::free_input_to_output_maps): Change visibilities to
10220         protected.
10221         (Sized_relobj::setup): Virtualize.
10222         (Sized_relobj::do_setup): New method declaration.
10223         (Sized_relobj::invalidate_section_offset,
10224         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10225         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10226         * options.cc (parse_int): New function.
10227         * options.h (parse_int): New declaration.
10228         (DEFINE_int): New macro.
10229         (stub_group_size): New option.
10230         * output.cc (Output_section::Output_section): Initialize memebers
10231         merge_section_map_, merge_section_by_properties_map_,
10232         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10233         (Output_section::add_input_section): Handled deferred code-fill
10234         generation and remove an old comment.
10235         (Output_section::add_relaxed_input_section): New method definition.
10236         (Output_section::add_merge_input_section): Use merge section by
10237         properties map to speed to search.  Update merge section maps
10238         as appropriate.
10239         (Output_section::build_relaxation_map): New method definition.
10240         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10241         Same.
10242         (Output_section::relax_input_section): Renamed to
10243         Output_section::convert_input_sections_to_relaxed_sections and change
10244         interface to take a vector of pointers to relaxed sections.
10245         (Output_section::find_merge_section,
10246         Output_section::find_relaxed_input_section): New method definitions.
10247         (Output_section::is_input_address_mapped,
10248         Output_section::output_offset, Output_section::output_address):
10249         Use output section data maps to speed up searching.
10250         (Output_section::find_starting_output_address): Add comments.
10251         (Output_section::do_write,
10252         Output_section::write_to_postprocessing_buffer): Do code-fill
10253         generation as appropriate.
10254         (Output_section::get_input_sections): Invalidate relaxed input section
10255         map.
10256         (Output_section::restore_states): Adjust type of checkpoint .
10257         Invalidate relaxed input section map.
10258         * output.h (Output_merge_base): New class declaration.
10259         (Input_section_specifier): New class defintion.
10260         (class Output_relaxed_input_section) Change base class to
10261         Output_section_data_build.
10262         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10263         base class initializer.
10264         (Output_section::add_relaxed_input_section): New method declaration.
10265         (Output_section::Input_section): Change visibility to protected.
10266         (Output_section::Input_section::relobj,
10267         Output_section::Input_section::shndx): Handle relaxed input sections.
10268         Output_section::input_sections) Change visibility to protected.  Also
10269         define overload to return a non-const pointer.
10270         (Output_section::Merge_section_properties): New class defintion.
10271         (Output_section::Merge_section_by_properties_map,
10272         Output_section::Output_section_data_by_input_section_map,
10273         Output_section::Relaxation_map): New types.
10274         (Output_section::relax_input_section): Rename method to
10275         Output_section::convert_input_sections_to_relaxed_sections and change
10276         interface to take a vector of relaxed section pointers.
10277         (Output_section::find_merge_section,
10278         Output_section::find_relaxed_input_section,
10279         Output_section::build_relaxation_map,
10280         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10281         New method declarations.
10282         (Output_section::merge_section_map_
10283         Output_section::merge_section_by_properties_map_,
10284         Output_section::relaxed_input_section_map_,
10285         Output_section::is_relaxed_input_section_map_valid_,
10286         Output_section::generate_code_fills_at_write_): New data members.
10287         * script-sections.cc
10288         (Output_section_element_input::set_section_addresses): Call
10289         current_data_size and addralign methods of relaxed input sections.
10290         (Orphan_output_section::set_section_addresses): Call current_data_size
10291         and addralign methods of relaxed input sections.
10292         * symtab.cc (Symbol_table::compute_final_value): Extract template
10293         from the body of Symbol_table::sized_finalize_symbol.
10294         (Symbol_table::sized_finalized_symbol): Call
10295         Symbol_table::compute_final_value.
10296         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10297         (Symbol_table::compute_final_value): New templated method declaration.
10298         * target.cc (Target::do_make_output_section): New method defintion.
10299         * target.h (Target::make_output_section): New method declaration.
10300         (Target::relax): Add more parameters for input objects, symbol table
10301         and layout.  Adjust call to do_relax.
10302         (Target::do_make_output_section): New method declaration.
10303         (Target::do_relax): Add parameters for input objects, symbol table
10304         and layout.
10305
10306 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10307
10308         * pread.c: Include stdio.h.
10309
10310 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10311
10312         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10313         defined.
10314
10315 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10316
10317         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10318         Change read_shndx type to unsigned int.
10319         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10320         int.
10321         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10322         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10323         Change read_shndx type to unsigned int.
10324         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10325         int.
10326         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10327         * layout.cc (Layout::create_symtab_sections): Cast the result of
10328         local_symcount * symsize to off_t in the gold_assert.
10329
10330 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10331
10332         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10333         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10334         R_ARM_BASE_ABS.
10335         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10336         (Arm_relocate_functions::thm_abs5): New function.
10337         (Arm_relocate_functions::abs12): New function.
10338         (Arm_relocate_functions::abs16): New function.
10339         (Arm_relocate_functions::base_abs): New function.
10340         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10341         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10342         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10343         R_ARM_BASE_ABS.
10344         (Scan::global): Likewise.
10345         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10346         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10347         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10348         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10349         R_ARM_BASE_ABS.
10350
10351 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10352
10353         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10354         (Arm_relocate_functions::movt_prel): New function.
10355         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10356         (Arm_relocate_functions::thm_movt_prel): New function.
10357         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10358         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10359         (Scan::global, Relocate::relocate): Likewise.
10360         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10361
10362 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10363
10364         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10365         Incremental_checker.
10366         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10367         unsigned int.
10368         (class Incremental_inputs_header): New class.
10369         (Incremental_inputs_header_writer): Edit comment.
10370         (Incremental_inputs_entry): New class.
10371         (Incremental_inputs_entry_writer): Edit comment.
10372         (Sized_incremental_binary::do_find_incremental_inputs_section):
10373         Add *strtab_shndx parameter, fill it.
10374         (Sized_incremental_binary::do_check_inputs): New method.
10375         (Incremental_checker::can_incrementally_link_output_file): Use
10376         Sized_incremental_binary::check_inputs.
10377         (Incremental_inputs::report_command_line): Save command line in
10378         command_line_.
10379         * incremental.h:
10380         (Incremental_binary::find_incremental_inputs_section): New
10381         method.
10382         (Incremental_binary::do_find_incremental_inputs_section): Add
10383         strtab_shndx parameter.
10384         (Incremental_binary::do_check_inputs): New pure virtual method.
10385         (Sized_incremental_binary::do_check_inputs): Declare.
10386         (Incremental_checker::Incremental_checker): Add incremental_inputs
10387         parameter, use it to initialize incremental_inputs_.
10388         (Incremental_checker::incremental_inputs_): New field.
10389         (Incremental_checker::command_line): New method.
10390         (Incremental_checker::inputs): New method.
10391         (Incremental_checker::command_line_): New field.
10392
10393 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10394
10395         * incremental.cc: Include <cstdarg> and "target-select.h".
10396         (vexplain_no_incremental): New function.
10397         (explain_no_incremental): New function.
10398         (Incremental_binary::error): New method.
10399         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10400         method.
10401         (make_sized_incremental_binary): New function.
10402         (open_incremental_binary): New function.
10403         (can_incrementally_link_file): Add checks if output is ELF and has
10404         inputs section.
10405         * incremental.h: Include "elfcpp_file.h" and "output.h".
10406         (Incremental_binary): New class.
10407         (Sized_incremental_binary): New class.
10408         (open_incremental_binary): Declare.
10409         * object.cc (is_elf_object): Use
10410         elfcpp::Elf_recognizer::is_elf_file.
10411         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10412         * output.h (Output_file::filesize): New method.
10413
10414 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10415
10416         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10417         New function.
10418         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10419         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10420         function.
10421         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10422         function.
10423         (Arm_relocate_functions::movw_abs_nc): New function.
10424         (Arm_relocate_functions::movt_abs): New function.
10425         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10426         (Arm_relocate_functions::thm_movt_abs): New function.
10427         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10428         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10429         (Scan::global): Likewise.
10430         (Relocate::relocate): Likewise.
10431         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10432
10433 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10434
10435         * arm.cc (Arm_relocate_functions::got_prel) New function.
10436         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10437         (Relocate::relocate): Likewise.
10438         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10439
10440 2009-10-06  Ian Lance Taylor  <iant@google.com>
10441
10442         * options.h (class General_options): Define
10443         split_stack_adjust_size parameter.
10444         * object.h (class Object): Add uses_split_stack_ and
10445         has_no_split_stack_ fields.  Add uses_split_stack and
10446         has_no_split_stack accessor functions.  Declare
10447         handle_split_stack_section.
10448         (class Reloc_symbol_changes): Define.
10449         (class Sized_relobj): Define Function_offsets.  Declare
10450         split_stack_adjust, split_stack_adjust_reltype, and
10451         find_functions.
10452         * object.cc (Object::handle_split_stack_section): New function.
10453         (Sized_relobj::do_layout): Call handle_split_stack_section.
10454         * dynobj.cc (Sized_dynobj::do_layout): Call
10455         handle_split_stack_section.
10456         * reloc.cc (Sized_relobj::relocate_sections): Call
10457         split_stack_adjust for executable sections in split_stack
10458         objects.  Pass reloc_map to relocate_section.
10459         (Sized_relobj::split_stack_adjust): New function.
10460         (Sized_relobj::split_stack_adjust_reltype): New function.
10461         (Sized_relobj::find_functions): New function.
10462         * target-reloc.h: Include "object.h".
10463         (relocate_section): Add reloc_symbol_changes parameter.  Change
10464         all callers.
10465         * target.h (class Target): Add calls_non_split method.  Declare
10466         do_calls_non_split virtual method.  Declare match_view and
10467         set_view_to_nop.
10468         * target.cc: Include "elfcpp.h".
10469         (Target::do_calls_non_split): New function.
10470         (Target::match_view): New function.
10471         (Target::set_view_to_nop): New function.
10472         * gold.cc (queue_middle_tasks): Give an error if mixing
10473         split-stack and non-split-stack objects with -r.
10474         * i386.cc (Target_i386::relocate_section): Add
10475         reloc_symbol_changes parameter.
10476         (Target_i386::do_calls_non_split): New function.
10477         * x86_64.cc (Target_x86_64::relocate_section): Add
10478         reloc_symbol_changes parameter.
10479         (Target_x86_64::do_calls_non_split): New function.
10480         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10481         parameter.
10482         * powerpc.cc (Target_powerpc::relocate_section): Add
10483         reloc_symbol_changes parameter.
10484         * sparc.cc (Target_sparc::relocate_section): Add
10485         reloc_symbol_changes parameter.
10486         * configure.ac: Call AM_CONDITIONAL for the default target.
10487         * configure: Rebuild.
10488         * testsuite/Makefile.am (TEST_AS): New variable.
10489         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10490         (check_DATA): Add split_i386 and split_x86_64 files.
10491         (SPLIT_DEFSYMS): Define.
10492         (split_i386_[1234n].o): New targets.
10493         (split_i386_[124]): New targets.
10494         (split_i386_[1234r].stdout): New targets.
10495         (split_x86_64_[1234n].o): New targets.
10496         (split_x86_64_[124]): New targets.
10497         (split_x86_64_[1234r].stdout): New targets.
10498         (MOSTLYCLEANFILES): Add new executables.
10499         * testsuite/split_i386.sh: New file.
10500         * testsuite/split_x86_64.sh: New file.
10501         * testsuite/split_i386_1.s: New file.
10502         * testsuite/split_i386_2.s: New file.
10503         * testsuite/split_i386_3.s: New file.
10504         * testsuite/split_i386_4.s: New file.
10505         * testsuite/split_i386_n.s: New file.
10506         * testsuite/split_x86_64_1.s: New file.
10507         * testsuite/split_x86_64_2.s: New file.
10508         * testsuite/split_x86_64_3.s: New file.
10509         * testsuite/split_x86_64_4.s: New file.
10510         * testsuite/split_x86_64_n.s: New file.
10511         * testsuite/testfile.cc (Target_test): Update relocation_section
10512         function.
10513         * testsuite/Makefile.in: Rebuild.
10514
10515 2009-10-06  Ian Lance Taylor  <iant@google.com>
10516
10517         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10518         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10519         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10520         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10521         the address on ldo_addrs_.
10522         (Target_i386::Relocate::fix_up_ldo): New function.
10523
10524 2009-10-06   Rafael Espindola  <espindola@google.com>
10525
10526         * plugin.cc (add_input_library): New.
10527         (Plugin::load): Add add_input_library to tv.
10528         (Plugin_manager::add_input_file): Add the is_lib argument.
10529         (add_input_file): Update call to Plugin_manager::add_input_file.
10530         (add_input_library): New.
10531         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10532
10533 2009-09-30  Doug Kwan  <dougkwan@google.com>
10534
10535         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10536         symbol and call Symbol::may_need_copy_reloc to determine if
10537         a copy reloc is needed.
10538         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10539         nocopyreloc is given in command line.
10540         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10541         given in command line.
10542         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10543         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10544         of the removed Target_i386::may_need_copy_reloc.
10545         * options.h (copyreloc): New option with default value false.
10546         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10547         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10548         instead of the removed Target_powerpc::may_need_copy_reloc.
10549         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10550         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10551         instead of the removed Target_sparc::may_need_copy_reloc.
10552         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10553         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10554         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10555         instead of the removed Target_x86_64::may_need_copy_reloc.
10556
10557 2009-09-30  Ian Lance Taylor  <iant@google.com>
10558
10559         * object.h (class Object): Remove target_ field, and target,
10560         sized_target, and set_target methods.
10561         (Object::sized_target): Remove.
10562         (class Sized_relobj): Update declarations.  Remove sized_target.
10563         * object.cc (Sized_relobj::setup): Remove target parameter.
10564         Change all callers.
10565         (Input_objects::add_object): Don't do anything with the target.
10566         (make_elf_sized_object): Add punconfigured parameter.  Change all
10567         callers.  Set or test parameter target.
10568         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10569         Change all callers.
10570         * parameters.cc (Parameters::set_target): Change parameter type to
10571         be non-const.
10572         (Parameters::default_target): Remove.
10573         (set_parameters_target): Change parameter type to be non-const.
10574         (parameters_force_valid_target): New function.
10575         (parameters_clear_target): New function.
10576         * parameters.h (class Parameters): Update declarations.  Remove
10577         default_target method.  Add sized_target and clear_target
10578         methods.  Change target_ to be non-const.
10579         (set_parameters_target): Update declaration.
10580         (parameters_force_valid_target): Declare.
10581         (parameters_clear_target): Declare.
10582         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10583         as NULL if we aren't searching.
10584         (Add_symbols::run): Don't check for compatible target.
10585         * fileread.cc (Input_file::open_binary): Call
10586         parameters_force_valid_target.
10587         * gold.cc (queue_middle_tasks): Likewise.
10588         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10589         set_target on object.
10590         * dynobj.h (class Sized_dynobj): Update declarations.
10591         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10592         make_elf_object returns NULL.
10593         (Archive::include_member): Don't check whether object target is
10594         compatible.
10595         * output.cc (Output_section::add_input_section): Get target from
10596         parameters.
10597         (Output_section::relax_input_section): Likewise.
10598         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10599         parameters.
10600         (Sized_relobj::do_scan_relocs): Likewise.
10601         (Sized_relobj::relocate_sections): Likewise.
10602         * resolve.cc (Symbol_table::resolve): Likewise.
10603         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10604         parameter.  Change all callers.
10605         (Symbol_table::add_from_object): Get target from parameters.
10606         (Symbol_table::add_from_relobj): Don't check object target.
10607         (Symbol_table::add_from_dynobj): Likewise.
10608         (Symbol_table::define_special_symbol): Get target from
10609         parameters.
10610         * symtab.h (class Symbol_table): Update declaration.
10611         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10612         parameter.  Change all callers.  Clear parameter target.
10613         (Binary_test): Test target here.
10614         * testsuite/object_unittest.cc (gold_testsuite): Remove
10615         target_test_pointer parameter.  Change all callers.
10616         (Object_test): Test target here.
10617
10618 2009-09-26  Ian Lance Taylor  <iant@google.com>
10619
10620         * testsuite/initpri1.c: Don't try to use constructor priorities if
10621         compiling with gcc before 4.3.
10622
10623 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10624
10625         * testsuite/retain_symbols_file_test.sh (check_present): Change
10626         output file name to retain_symbols_file_test.stdout.
10627         (check_absent): Likewise.
10628
10629 2009-09-18  Craig Silverstein  <csilvers@google.com>
10630
10631         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10632         * options.cc: Include <cerrno> and <fstream>.
10633         (General_options::finalize): Parse -retain-symbols-file tag.
10634         * options.h: New flag.
10635         (General_options): New method should_retain_symbol, new
10636         variable symbols_to_retain.
10637         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10638         should_retain_symbol map.
10639         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10640         * testsuite/Makefile.in: Regenerate.
10641         * testsuite/retain_symbols_file_test.sh: New file.
10642
10643 2009-09-18  Nick Clifton  <nickc@redhat.com>
10644
10645         * po/es.po: Updated Spanish translation.
10646
10647 2009-09-17  Doug Kwan  <dougkwan@google.com>
10648
10649         * debug.h (DEBUG_RELAXATION): New constant.
10650         (DEBUG_ALL): Add DEBUG_RELAXATION.
10651         (debug_string_to_enum): Add relaxation debug option.
10652         * layout.cc
10653         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10654         Layout::Relaxation_debug_check::read_sections,
10655         Layout::Relaxation_debug_check::read_sections): New method definitions.
10656         (Layout::Layout): Initialize data members
10657         record_output_section_data_from_scrips_,
10658         script_output_section_data_list_ and relaxation_debug_check_.
10659         (Layout::save_segments, Layout::restore_segments,
10660         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10661         Layout::relaxation_loop_body): New method definitions.
10662         (Layout::finalize): Support relaxation.  Move section layout code to
10663         Layout::relaxation_loop_body.
10664         (Layout::set_asection_address_from_script): Move code for orphan
10665         section placement out.
10666         (Layout::place_orphan_sections_in_script): New method definition.
10667         * layout.h (Output_segment_headers, Output_file_header):
10668         New forward class declarations.
10669         (Layout::~Layout): Define.
10670         (Layout::new_output_section_data_from_script): New method definition.
10671         (Layout::place_orphan_sections_in_script): New method declaration.
10672         (Layout::Segment_states): New type declaration.
10673         (Layout::save_segments, Layout::restore_segments,
10674         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10675         Layout::relaxation_loop_body): New method declarations.
10676         (Layout::Output_section_data_list): New type declaration.
10677         (Layout::Relaxation_debug_check): New class definition.
10678         (Layout::record_output_section_data_from_script_,
10679         Layout::script_output_section_data_list_, Layout::segment_states_,
10680         Layout::relaxation_debug_check_): New data members.
10681         * output.cc: (Output_section_headers::do_size): New method definition.
10682         (Output_section_headers::Output_section_headers): Move size
10683         computation to Output_section_headers::do_size.
10684         (Output_segment_headers::do_size): New method definition.
10685         (Output_file_header::Output_file_header): Move size computation to
10686         Output_file_header::do_size and call it.
10687         (Output_file_header::do_size): New method definition.
10688         (Output_data_group::Output_data_group): Adjust call to
10689         Output_section_data.
10690         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10691         (Output_symtab_xindex::do_write): Add array bound check.
10692         (Output_section::Input_section::print_to_mapfile): Handle
10693         RELAXED_INPUT_SECTION_CODE.
10694         (Output_section::Output_section): Initialize data member checkpoint_.
10695         (Output_section::~Output_section): Delete checkpoint object pointed
10696         by checkpoint_.
10697         (Output_section::add_input_section): Always add an Input_section if
10698         relaxing.
10699         (Output_section::add_merge_input_section): Add assert.
10700         (Output_section::relax_input_section): New method definition.
10701         (Output_section::set_final_data_size): Set load address to zero for
10702         an unallocated section.
10703         (Output_section::do_address_and_file_offset_have_reset_values):
10704         New method definition.
10705         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10706         Handle relaxed input section.
10707         (Output_section::sort_attached_input_sections): Checkpoint input
10708         section list lazily.
10709         (Output_section::get_input_sections): Change type of input_sections to
10710         list of Simple_input_section pointers.  Checkpoint input section list
10711         lazily.  Also handle relaxed input sections.
10712         (Output_section::add_input_section_for_script): Take a reference to
10713         a Simple_input_section object instead of Relobj pointer and section
10714         index as parameter.  Handle relaxed input sections.
10715         (Output_section::save_states, Output_section::restore_states): New
10716         method definitions.
10717         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10718         (Output_data::is_data_size_fixed): New method definition.
10719         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10720         if it is fixed.
10721         (Output_data::address_and_file_offset_have_reset_values): New method
10722         definition.
10723         (Output_data::do_address_and_file_offset_have_reset_values): New method
10724         definition.
10725         (Output_data::set_data_size): Check that data size is not fixed.
10726         (Output_data::fix_data_size): New method definition.
10727         (Output_data::is_data_size_fixed_): New data member.
10728         (Output_section_headers::set_final_data_size): New method definition.
10729         (Output_section_headers::do_size): New method declaration.
10730         (Output_segment_headers::set_final_data_size): New method definition.
10731         (Output_segment_headers::do_size): New method declaration.
10732         (Output_file_header::set_final_data_size)::New method definition.
10733         (Output_file_header::do_size)::New method declaration.
10734         (Output_section_data::Output_section_data): Add new parameter
10735         is_data_size_fixed and use it to fix data size.
10736         (Output_data_const::Output_data_const): Adjust call to base class
10737         constructor and fix data size.
10738         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10739         base class constructor and fix data size.
10740         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10741         base class constructor and fix data size.
10742         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10743         class constructor and fix data size.
10744         (Output_data_group::set_final_data_size): New method definition.
10745         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10746         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10747         class constructor and fix data size.
10748         (Output_relaxed_input_section): New class definition.
10749         (Output_section::Simple_input_section): New class definition.
10750         (Output_section::get_input_sections): Adjust parameter list.
10751         (Output_section::add_input_section_for_script): Same.
10752         (Output_section::save_states, Output_section::restore_states,
10753         Output_section::do_address_and_file_offset_have_reset_values,
10754         (Output_section::Input_section::Input_section): Handle
10755         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10756         Output_relaxed_input_section.
10757         (Output_section::Input_section::is_input_section,
10758         Output_section::Input_section::set_output_section): Handle relaxed
10759         input section.
10760         (Output_section::Input_section::is_relaxed_input_section,
10761         Output_section::Input_section::output_section_data,
10762         Output_section::Input_section::relaxed_input_section): New method
10763         definitions.
10764         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10765         value.
10766         (Output_section::Input_section::u1_): Update comments.
10767         (Output_section::Input_section::u2_): Add new union member poris.
10768         (Output_section::Checkpoint_output_section): New classs definition.
10769         (Output_section::relax_input_section): New method declaration.
10770         (Output_section::checkpoint_): New data member.
10771         (Output_segment): Update comments.
10772         (Output_segment::Output_segment): Un-privatize copy constructor.
10773         (Output_segment::operator=): Un-privatize.
10774         * script-sections.cc (Output_section_element::Input_section_list):
10775         Change element type to Output_section::Simple_input_section.
10776         (Output_section_element_dot_assignment::set_section_addresses):
10777         Register output section data for relaxation clean up.
10778         (Output_data_exression::Output_data_expression): Adjust call to base
10779         constructor to fix data size.
10780         (Output_section_element_data::set_section_addresses): Register
10781         Output_data_expression object for relaxation clean up.
10782         (struct Input_section_info): Replace Relobj pointer and section index
10783         pair with Output_section::Simple_input_section and Convert struct to a
10784         class.
10785         (Input_section_sorter::operator()): Adjust access to
10786         Input_section_info data member to use accessors.
10787         (Output_section_element_input::set_section_addresses): Use layout
10788         parameter.  Adjust code to use Output_section::Simple_input_section
10789         and Input_secction_info classes.  Register filler for relaxation
10790         clean up.
10791         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10792         and section index pair with Output_section::Simple_input_section
10793         class.  Adjust code accordingly.
10794         (Phdrs_element::release_segment): New method definition.
10795         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10796         segment list.
10797         (Script_sections::release_segments): New method definition.
10798         * gold/script-sections.h (Script_sections::release_segments): New
10799         method declaration.
10800         * gold/target.h (Target::may_relax, Target::relax,
10801         Target::do_may_relax, Target::do_relax): New method definitions.
10802
10803 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10804
10805         * arm.cc (has_signed_unsigned_overflow): New function.
10806         (Arm_relocate_functions::abs8): New function.
10807         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10808         (Target_arm::Scan::global): Likewise.
10809         (Target_arm::relocate::relocate): Likewise.
10810         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10811         Likewise.
10812
10813 2009-09-16  Cary Coutant  <ccoutant@google.com>
10814
10815         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10816         * testsuite/Makefile.in: Regenerate.
10817
10818 2009-09-11  Nick Clifton  <nickc@redhat.com>
10819
10820         * po/gold.pot: Updated by the Translation project.
10821
10822 2009-09-08  Cary Coutant  <ccoutant@google.com>
10823
10824         * output.cc (Output_file::open): Add execute permission to empty file.
10825         * testsuite/Makefile.am (permission_test): New test.
10826         * testsuite/Makefile.in: Regenerate.
10827
10828 2009-09-02  Ian Lance Taylor  <iant@google.com>
10829
10830         * output.cc (Output_file::resize): Call map_no_anonymous rather
10831         than map.
10832
10833 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10834
10835         * gold.cc: Include "incremental.h".
10836         (queue_initial_tasks): Call Incremental_checker methods.
10837         * incremental.cc: Include "output.h".
10838         (Incremental_checker::can_incrementally_link_output_file): New
10839         method.
10840         * incremental.h (Incremental_checker): New class.
10841
10842         * output.cc (Output_file::open_for_modification): New method.
10843         (Output_file::map_anonymous): Changed return type to bool.  Record
10844         map in base_ field.
10845         (Output_file::map_no_anonymous): New method, broken out of map.
10846         (Output_file::map): Use map_no_anonymous and map_anonymous.
10847         * output.h (class Output_file): Update declarations.
10848
10849 2009-08-24  Cary Coutant  <ccoutant@google.com>
10850
10851         * options.h (Command_line::Pre_options): New class.
10852         (Command_line::pre_options): New member.
10853         * options.cc (gold::options::ready_to_register): New variable.
10854         (One_option::register_option): Do nothing if not registering options.
10855         Assert if same short option registered twice.
10856         (General_options::General_options): Turn off option registration when
10857         done constructing.
10858         (Command_line::Pre_options::Pre_options): New constructor.
10859
10860 2009-08-24  Cary Coutant  <ccoutant@google.com>
10861
10862         * options.h (General_options::no_keep_memory): Remove incorrect
10863         short option.
10864
10865 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10866
10867         * Makefile.am (am__skiplex, am__skipyacc): New.
10868         * Makefile.in: Regenerate.
10869
10870 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10871
10872         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10873         (INCLUDES): ... this.
10874         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10875         (AM_CPPFLAGS): Renamed from ...
10876         (INCLUDE): ... this.
10877         * Makefile.in, testsuite/Makefile.in: Regenerate.
10878
10879         * Makefile.in: Regenerate.
10880         * aclocal.m4: Likewise.
10881         * config.in: Likewise.
10882         * configure: Likewise.
10883         * testsuite/Makefile.in: Likewise.
10884
10885         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10886         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10887         * Makefile.in: Regenerate.
10888         * testsuite/Makefile.in: Regenerate.
10889
10890 2009-08-19  Cary Coutant  <ccoutant@google.com>
10891
10892         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10893         symbols in shared libraries overridden by hidden or internal symbols
10894         in the main program.
10895
10896 2009-08-19  Chris Demetriou  <cgd@google.com>
10897
10898         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10899         checking source file names in error messages.
10900
10901 2009-08-18  Doug Kwan  <dougkwan@google.com>
10902
10903         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10904         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10905         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10906         an elfcpp::Ehdr as parameter.
10907         * object.cc (Object::set_target): Remove the version that looks up
10908         a target and sets it.
10909         (Sized_relobj::setup): Take a Target object instead of
10910         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10911         (make_elf_sized_object): Find target and ask target to
10912         make an ELF object.
10913         * object.h: (Object::set_target): Remove the version that looks up
10914         a target and sets it.
10915         (Sized_relobj::setup): Take a Target object instead of
10916         an elfcpp:Ehdr as parameter.
10917         * target.cc: Include dynobj.h.
10918         (Target::do_make_elf_object_implementation): New.
10919         (Target::do_make_elf_object): New.
10920         * target.h (Target::make_elf_object): New template declaration.
10921         (Target::do_make_elf_object): New method declarations.
10922         (Target::do_make_elf_object_implementation): New template declaration.
10923
10924 2009-08-14  Ian Lance Taylor  <iant@google.com>
10925
10926         * gold.h (FUNCTION_NAME): Define.
10927         (gold_unreachable): Use FUNCTION_NAME.
10928
10929 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10930
10931         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10932         symbol in the --keep-unique list is not found.
10933
10934 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10935
10936         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10937         been maked as --keep-unique.
10938         (Icf::unfold_section): New function.
10939         * icf.h (Icf::unfold_section): New function.
10940         * options.h (General_options::keep_unique): New option.
10941         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10942         * testsuite/Makefile.in: Regenerate.
10943         * testsuite/icf_keep_unique_test.sh: New file.
10944         * testsuite/icf_keep_unique_test.cc: New file.
10945
10946 2009-08-12  Cary Coutant  <ccoutant@google.com>
10947
10948         PR 10471
10949         * resolve.cc (Symbol_table::resolve): Check for references from
10950         dynamic objects to hidden and internal symbols.
10951         * testsuite/Makefile.am (hidden_test.sh): New test.
10952         * testsuite/Makefile.in: Regenerate.
10953         * testsuite/hidden_test.sh: New script.
10954         * testsuite/hidden_test_1.c: New test source.
10955         * testsuite/hidden_test_main.c: New test source.
10956
10957 2009-08-11  Doug Kwan  <dougkwan@google.com>
10958
10959         * arm.cc: Update comments.
10960         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10961         segment to locate the .ARM.exidx section if present.
10962
10963 2009-08-09  Doug Kwan  <dougkwan@google.com>
10964
10965         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10966         patch.
10967
10968 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10969         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10970         compiler warnings.
10971
10972 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10973
10974         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10975         valid tls_segment only for non-debug-section relocations.
10976         * testsuite/Makefile.am: Add gc_tls_test.
10977         * testsuite/Makefile.in: Regenerate.
10978         * testsuite/gc_tls_test.cc: New file.
10979         * testsuite/gc_tls_test.sh: New file.
10980
10981 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10982
10983         * icf.cc: New file.
10984         * icf.h: New file.
10985         * Makefile.am (CCFILES): Add icf.cc.
10986         (HFILES): Add icf.h
10987         * Makefile.in: Regenerate.
10988         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10989         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10990         section, symbol and addend information for the relocs.
10991         * gold.cc (queue_middle_tasks): Call identical code folding.
10992         * gold.h: Add defines for multimap.
10993         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10994         to the call of finalize_local_symbols.
10995         * main.cc (main): Create object of class Icf.
10996         * object.cc (Sized_relobj::do_layout): Allow this function to be
10997         called twice during icf.
10998         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10999         to sections marked as identical by icf.
11000         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11001         when available.
11002         (Sized_relobj::do_section_entsize): New function.
11003         * object.h (Object::section_entsize): New function.
11004         (Object::do_section_entsize): New pure virtual function.
11005         (Relobj::finalize_local_symbols): Add new parameter.
11006         (Relobj::do_section_entsize): New function.
11007         * options.h (General_options::icf): New option.
11008         (General_options::icf_iterations): New option.
11009         (General_options::print_icf_sections): New option.
11010         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11011         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11012         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11013         icf.
11014         * symtab.cc (Symbol_table::is_section_folded): New function.
11015         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11016         to sections marked as identical by icf.
11017         * symtab.h (Symbol_table::set_icf): New function.
11018         (Symbol_table::icf): New function.
11019         (Symbol_table::is_section_folded): New function.
11020         (Symbol_table::icf_): New data member.
11021         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11022         * testsuite/Makefile.am: Add commands to build icf_test.
11023         * testsuite/Makefile.in: Regenerate.
11024         * testsuite/icf_test.sh: New file.
11025         * testsuite/icf_test.cc: New file.
11026
11027 2009-07-24  Chris Demetriou  <cgd@google.com>
11028
11029         * layout.cc (is_compressible_debug_section): Fix incorrect
11030         comment about compressed section names.
11031
11032 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11033
11034         PR 10419
11035         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11036
11037 2009-07-16  Ian Lance Taylor  <iant@google.com>
11038
11039         PR 10400
11040         * layout.h: #include <map>.
11041         (class Kept_section): Change from struct to class.  Add accessors
11042         and setters.  Add section size to Comdat_group mapping.  Change
11043         Comdat_group to std::map.  Add is_comdat_ field.  Add
11044         linkonce_size field in union.
11045         (class Layout): Update declaration of find_or_add_kept_section.
11046         Don't declare find_kept_object.
11047         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11048         parameter.  Add object, shndx, is_comdat, and is_group_name
11049         parameters.  Change all callers.  Adjust for new Kept_section.
11050         (Layout::find_kept_object): Remove.
11051         * object.cc (Sized_relobj::include_section_group): Update use of
11052         Kept_section.  Rename secnum to shndx.  Only record
11053         Kept_comdat_section if sections are the same size.
11054         (Sized_relobj::include_linkonce_section): Update use of
11055         Kept_section.  Only record Kept_comdat_section if sections are the
11056         same size.  Set size of linkonce section.
11057         (Sized_relobj::map_to_kept_section): Update call to
11058         get_kept_comdat_section.
11059         * object.h (class Sized_relobj): Rename fields in
11060         Kept_comdat_section to drop trailing underscores; change object
11061         field to Relobj*.  Change Kept_comdat_section_table to store
11062         struct rather than pointer.
11063         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11064         Add kept_object and kept_shndx parameters.  Change all callers.
11065         (Sized_relobj::get_kept_comdat_section): Change return type to
11066         bool.  Add kept_object and kept_shndx parameters.  Change all
11067         callers.
11068         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11069         Layout::find_or_add_kept_section.
11070
11071 2009-07-09  Ian Lance Taylor  <iant@google.com>
11072
11073         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11074         Reserve space in the hash table.
11075
11076 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11077
11078         * fileread.cc (File_read::get_mtime): New method.
11079         * fileread.h (Timespec): New structure.
11080         (File_read::get_mtime): New method.
11081         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11082         Renamed from timestamp_nsec.
11083         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11084         Elf_Xword.
11085         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11086         timestamp_nsec.
11087         (Incremental_inputs::report_archive): Save mtime; style fix.
11088         (Incremental_inputs::report_obejct): Save mtime; style fix.
11089         (Incremental_inputs::report_script): Save mtime; style fix.
11090         (Incremental_inputs::finalize_inputs): Style fix.
11091         (Incremental_inputs::finalize): Style fix.
11092         (Incremental_inputs::create_input_section_data): Store inputs
11093         mtime.
11094         * incremental.h (Incremental_inputs::report_script): Add mtime
11095         argument.
11096         (Incremental_inputs::Input_info::Input_info): Intialize only one
11097         union member.
11098         (Incremental_inputs::Input_info::archive): Move to nameless
11099         union.
11100         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11101         (Incremental_inputs::Input_info::script): Move to nameless union.
11102         (Incremental_inputs::mtime): New field.
11103         * script.cc (read_input_script): Pass file mtime to
11104         Incremental_input.
11105         * script.h (Script_info::inputs): Style fix.
11106
11107 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11108
11109         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11110         instead of 32.
11111
11112 2009-06-24  Ian Lance Taylor  <iant@google.com>
11113
11114         PR 10156
11115         * layout.cc (Layout::choose_output_section): If we find an
11116         existing section, update the flags.
11117         (Layout::create_notes): New function, broken out of
11118         Layout::finalize.
11119         (Layout::finalize): Don't create note sections.
11120         (Layout::create_note): Don't crash if linker script discards
11121         section.
11122         (Layout::create_gold_note): Likewise.
11123         (Layout::create_build_id): Likewise.  Don't set
11124         after_input_sections on the section.
11125         (Layout::create_executable_stack_info): Remove target parameter.
11126         Change caller.
11127         * layout.h (class Layout): Declare create_notes.  Update
11128         declaration of create_executable_stack_info.
11129         * gold.cc (queue_middle_tasks): Call create_notes.
11130         * output.cc (Output_section::update_flags_for_input_section): Move
11131         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11132         invalid.
11133         * output.h (Output_data::mark_address_invalid): New function.
11134         (class Output_section): Only declare, not define,
11135         update_flags_for_input_section.  Remove set_flags.
11136
11137 2009-06-24  Ian Lance Taylor  <iant@google.com>
11138
11139         * script-sections.cc (Output_section_definition::
11140         set_section_addresses): Rename shadowing local load_address to
11141         laddr.
11142
11143 2009-06-24  Ian Lance Taylor  <iant@google.com>
11144
11145         PR 10244
11146         * reloc.cc (relocate_sections): Skip empty relocation sections.
11147
11148 2009-06-23  Ian Lance Taylor  <iant@google.com>
11149
11150         PR 10156
11151         * layout.cc (Layout::create_note): Use choose_output_section
11152         rather than make_output_section.
11153
11154 2009-06-23  Ian Lance Taylor  <iant@google.com>
11155
11156         PR 10237
11157         * options.cc (General_options::parse_V): Set printed_version_.
11158         (General_options::General_options): Initialize printed_version_.
11159         * options.h (class General_options): Add printed_version_ field.
11160         * gold.cc (queue_initial_tasks): If there are no input files,
11161         don't give a fatal error if we printed the version information.
11162         (queue_middle_tasks): If using -r with a shared object, give a
11163         fatal error rather than an ordinary error.
11164
11165 2009-06-23  Ian Lance Taylor  <iant@google.com>
11166
11167         PR 10219
11168         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11169         (Layout::make_output_section): Set have_stabstr_section_ if we see
11170         a .stab*str section.
11171         (Layout::finalize): Call link_stabs_sections.
11172         (Layout::link_stabs_sections): New file.
11173         * layout.h (class Layout): Add have_stabstr_section_ field.
11174         Declare link_stabs_sections.
11175
11176 2009-06-23  Doug Kwan  <dougkwan@google.com>
11177
11178         * Makefile.am (libgold_a_LIBADD): New.
11179         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11180         * Makefile.in: Regenerate.
11181         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11182         * configure: Regenerate.
11183         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11184         * fileread.cc: Include sys/state.h
11185         * gold.h: Declare memmem and strndup if found missing.
11186         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11187
11188 2009-06-23  Ian Lance Taylor  <iant@google.com>
11189
11190         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11191         * configure: Rebuild.
11192
11193 2009-06-23  Ian Lance Taylor  <iant@google.com>
11194
11195         PR 10147
11196         * object.cc (Object::section_contents): Don't try to get a view if
11197         the section has length zero.
11198         (Object::handle_gnu_warning_section): If the section is empty, use
11199         the name of the section as the warning.
11200
11201 2009-06-23  Ian Lance Taylor  <iant@google.com>
11202
11203         PR 10133
11204         * stringpool.h (class Stringpool_template): Add optimize_ field.
11205         (Stringpool_template::set_optimize): New function.
11206         * stringpool.cc (Stringpool_template::Stringpool_template):
11207         Initialize optimize_ field.
11208         (Stringpool_template::set_string_offsets): Test local optimize
11209         fild rather than parameter.
11210         * layout.cc (Layout::Layout): Call set_optimize on the section
11211         name stringpool.
11212
11213 2009-06-22  Ian Lance Taylor  <iant@google.com>
11214
11215         PR 10030
11216         * yyscript.y: Parse TARGET.
11217         * script.cc (script_set_target): New function.
11218         * script-c.h (script_set_target): Declare.
11219         * options.cc (General_options::string_to_object_format): Rename
11220         from string_to_object_format in anonymous namespace.  Change
11221         callers.
11222         * options.h (class General_options): Declare
11223         string_to_object_format.
11224
11225 2009-06-22  Ian Lance Taylor  <iant@google.com>
11226
11227         * script-sections.cc (Script_sections::create_segments): Don't put
11228         program headers in a PT_LOAD segment if -n or -N.
11229
11230 2009-06-22  Ian Lance Taylor  <iant@google.com>
11231
11232         PR 10141
11233         * options.h (class General_options): Add -z lazy and -z now.  Sort
11234         -z options into alphabetical order.
11235         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11236
11237 2009-06-21  Ian Lance Taylor  <iant@google.com>
11238
11239         * layout.cc (Layout::make_output_section): Call
11240         Target::new_output_section.
11241         (Layout::attach_allocated_section_to_segment): Put large section
11242         sections in a separate load segment with the large segment flag
11243         set.
11244         (Layout::segment_precedes): Sort large data segments after other
11245         load segments.
11246         (align_file_offset): New static function.
11247         (Layout::set_segment_offsets): Use align_file_offset.
11248         * output.h (class Output_section): Add is_small_section_ and
11249         is_large_section_ fields.
11250         (Output_section::is_small_section): New function.
11251         (Output_section::set_is_small_section):  New function.
11252         (Output_section::is_large_section): New function.
11253         (Output_section::set_is_large_section): New function.
11254         (Output_section::is_large_data_section): New function.
11255         (class Output_segment): Add is_large_data_segment_ field.
11256         (Output_segment::is_large_data_segment): New function.
11257         (Output_segment::set_is_large_data_segment): New function.
11258         * output.cc (Output_section::Output_section): Initialize new
11259         fields.
11260         (Output_segment::Output_segment): Likewise.
11261         (Output_segment::add_output_section): Add assertion that large
11262         data sections always go in large data segments.  Force small data
11263         sections to the end of the list of data sections.  Force small BSS
11264         sections to the start of the list of BSS sections.  For large BSS
11265         sections to the end of the list of BSS sections.
11266         * symtab.h (class Symbol): Declare is_common_shndx.
11267         (Symbol::is_defined): Check Symbol::is_common_shndx.
11268         (Symbol::is_common): Likewise.
11269         (class Symbol_table): Define enum Commons_section_type.  Update
11270         declarations.  Add small_commons_ and large_commons_ fields.
11271         * symtab.cc (Symbol::is_common_shndx): New function.
11272         (Symbol_table::Symbol_table): Initialize new fields.
11273         (Symbol_table::add_from_object): Put small and large common
11274         symbols in the right list.
11275         (Symbol_table::sized_finalized_symbol): Check
11276         Symbol::is_common_shndx.
11277         (Symbol_table::sized_write_globals): Likewise.
11278         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11279         common symbol lists.  Don't call do_allocate_commons_list if the
11280         list is empty.
11281         (Symbol_table::do_allocate_commons_list): Remove is_tls
11282         parameter.  Add comons_section_type parameter.  Change all
11283         callers.  Handle small and large common symbols.
11284         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11285         Symbol::is_common_shndx.
11286         * resolve.cc (symbol_to_bits): Likewise.
11287         * target.h (Target::small_common_shndx): New function.
11288         (Target::small_common_section_flags): New function.
11289         (Target::large_common_shndx): New function.
11290         (Target::large_common_section_flags): New function.
11291         (Target::new_output_section): New function.
11292         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11293         small_common_section_flags, and large_common_section_flags
11294         fields.
11295         (Target::do_new_output_section): New virtual function.
11296         * arm.cc (Target_arm::arm_info): Initialize new fields.
11297         * i386.cc (Target_i386::i386_info): Likewise.
11298         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11299         Likewise.
11300         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11301         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11302         (Target_x86_64::do_new_output_section): New function.
11303         * configure.ac: Define conditional MCMODEL_MEDIUM.
11304         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11305         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11306         (large_LDFLAGS): Define.
11307         * testsuite/large.c: New file.
11308         * testsuite/testfile.cc (Target_test::test_target_info):
11309         Initialize new fields.
11310         * configure, testsuite/Makefile.in: Rebuild.
11311
11312 2009-06-05  Doug Kwan  <dougkwan@google.com>
11313
11314         * Makefile.am (CCFILES): Add target.cc.
11315         * Makefile.in: Regenerate.
11316         * i386.cc (class Target_i386): Define new virtual method to
11317         override do_is_local_label_name in parent.
11318         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11319         local symbols if --discard-locals or -X is given.
11320         * options.h (class General_options): Declare new options
11321         '--discard-locals' and '-X' for discarding locals.
11322         * target.h (class Target): Define new methods is_local_label_name.
11323         Declare new virtual method do_is_local_label_name.
11324         * target.cc: New file.
11325         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11326         (check_SCRIPTS): Add discard_locals_test.sh.
11327         (check_DATA): Add discard_local_tests.syms.
11328         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11329         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11330         * testsuite/Makefile.in: Regenerate.
11331         * testsuite/discard_locals_test.c: New file.
11332         * testsuite/discard_locals_test.sh: Same.
11333
11334 2009-06-05  Doug Kwan  <dougkwan@google.com>
11335
11336         * object.cc (Sized_relobj::Sized_relobj): Initialize
11337         discarded_eh_frame_shndx_ to -1U.
11338         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11339         section.
11340         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11341         a discarded .eh_frame section.
11342         (Sized_relobj::do_finalize_local_symbols): Ditto.
11343         * object.h (class Sized_relobj): Declare new member
11344         discarded_eh_frame_shndx_.
11345         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11346         (local_labels_test.o, local_labels_test): New rules.
11347         * testsuite/Makefile.in: Regenerate.
11348
11349 2009-06-04  Doug Kwan  <dougkwan@google.com>
11350
11351         * layout.cc (Layout::section_name_mapping): Add mapping for
11352         special ARM sections.
11353
11354 2009-06-03  Doug Kwan  <dougkwan@google.com>
11355
11356         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11357         (utils::has_overflow): Same.
11358
11359 2009-06-03  Ian Lance Taylor  <iant@google.com>
11360
11361         * layout.cc (Layout::section_name_mapping): New array, replacing
11362         Layout::linkonce_mapping.
11363         (Layout::section_name_mapping_count): New variable, replacing
11364         Layout::linkonce_mapping_count.
11365         (Layout::linkonce_output_name): Remove.
11366         (Layout::output_section_name): Rewrite.
11367         * layout.h (class Layout): Rename Linkonce_mapping to
11368         Section_name_mapping, linkonce_mapping to section_name_mapping,
11369         linkonce_mapping_count to section_name_mapping_count.  Don't
11370         declare linkonce_output_name.
11371
11372 2009-06-03  Doug Kwan  <dougkwan@google.com>
11373
11374         * gold/arm.cc (namespace utils): New.
11375         (Target_arm::reloc_is_non_pic): Define new method.
11376         (class Arm_relocate_functions): New.
11377         (Target_arm::Relocate::relocate): Handle relocation types used by
11378         Android.
11379
11380 2009-06-03  Ian Lance Taylor  <iant@google.com>
11381
11382         * arm.cc (Target_arm::scan::global): Use || instead of |.
11383
11384 2009-06-02  Doug Kwan  <dougkwan@google.com>
11385
11386         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11387         issued_non_pic_error_.
11388         (class Target_arm::Scan): Declare new method check_non_pic.
11389         Define new method symbol_needs_plt_entry.
11390         Declare new data member issued_non_pic_error_.
11391         (class Target_arm::Relocate): Declare new method
11392         should_apply_static_reloc.
11393         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11394         (Target_arm::Scan::check_non_pic): Define new method.
11395         (Target_arm::Scan::local): Handle a small subset of reloc types used
11396         by Android.
11397         (Target_arm::Scan::local): Same.
11398         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11399
11400 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11401
11402         * incremental.cc (Incremental_inputs::report_command_line): Filter
11403         out --incremental-* options.
11404
11405 2009-05-29  Doug Kwan  <dougkwan@google.com>
11406
11407         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11408         template class.
11409         (class Target_arm): Update comment.
11410         (Target_arm::Target_arm): Initialize new data members GOT_,
11411         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11412         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11413         and Target_arm::rel_dyn_section.
11414         Declare new_enum Target_arm::Got_type.
11415         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11416         and DYNBSS_.
11417         Update commments for member do_dynsym_value.
11418         (Target_arm::got_size, Target_arm::plt_section,
11419         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11420         new methods inside class defintion.
11421         (Target_arm::got_section): Define new method.
11422         (Target_arm::rel_dyn_section): Same.
11423         (Output_data_plt_arm): New template class.
11424         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11425         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11426         (Output_data_plt_arm::add_entry): Same.
11427         (Output_data_plt_arm::first_plt_entry): Define new
11428         static data member for PLT instruction template.
11429         (Output_data_plt_arm::plt_entry): Same.
11430         (Output_data_plt_arm::do_write): Define new method.
11431         (Target_arm::make_plt_entry): Same.
11432         (Target_arm::do_finalize_sections): Same.
11433         (Target_arm::do_dynsym_value): Same.
11434
11435 2009-05-28  Doug Kwan  <dougkwan@google.com>
11436
11437         * Makefile.am (TARGETSOURCES): Add arm.cc.
11438         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11439         * Makefile.in: Regenerate.
11440         * arm.cc: New file.
11441         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11442
11443 2009-05-26  Doug Kwan  <dougkwan@google.com>
11444
11445         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11446         (General_options::check_excluded_libs): Strip off directories in
11447         archive name before matching like GNU ld does.
11448         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11449         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11450         (exclude_libs_test_LDFLAGS): Add linker option
11451         -Wl,--exclude-libs,libexclude_libs_test_3
11452         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11453         an explicit archive without using -l.
11454         (alt/libexclude_libs_test_3.a): New make rule.
11455         * testsuite/Makefile.in: Regenerate.
11456         * testsuite/exclude_libs_test.c : Declare lib3_default().
11457         (main): Call it.
11458         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11459         * exclude_libs_test_3.c: New file.
11460
11461 2009-05-26  Nick Clifton  <nickc@redhat.com>
11462
11463         * po/id.po: New Indonesian translation.
11464         * po/gold.pot: Updated template file.
11465
11466 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11467
11468         * testsuite/Makefile.am: Add -ffunction-sections to compile
11469         gc_comdat_test files.  Add -Wl,--gc-sections to build
11470         gc_comdat_test.
11471         * testsuite/Makefile.in: Regenerate.
11472         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11473
11474 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11475
11476         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11477         kept comdat section was garbage collected.
11478         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11479         * testsuite/Makefile.in: Regenerate.
11480         * testsuite/gc_comdat_test.sh: New file.
11481         * testsuite/gc_comdat_test_1.cc: New file.
11482         * testsuite/gc_comdat_test_2.cc: New file.
11483
11484 2009-05-19  Doug Kwan  <dougkwan@google.com>
11485
11486         * archive.cc (Archive::Archive): Move constructor from archive.h
11487         to here.  Initialize no_export_.
11488         (Archive::get_elf_object_for_member): Set no_export flag of object.
11489         * archive.h (Archive::Archive): Move constructor body to
11490         archive.cc.
11491         (Archive::no_export): New method.
11492         (Archive::no_export_): New field.
11493         * object.h (Object::Object): Initialize no_export_ to false.
11494         (Object::no_export, Object::set_no_export): New methods.
11495         (Object::no_export_): New field.
11496         * options.cc (General_options::parse_exclude_libs): New method.
11497         (General_options::check_excluded_libs) Same.
11498         * options.h (exclude_libs): New option.
11499         (General_options::check_excluded_libs): New method declaration.
11500         (General_options::excluded_libs_): New field.
11501         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11502         default or protected visibility if an object has no-export flag set.
11503         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11504         (check_SCRIPTS): Add exclude_libs_test.sh.
11505         (check_DATA): Add exclude_libs_test.syms.
11506         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11507         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11508         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11509         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11510         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11511         libexclude_libs_test_2.a): New rules.
11512         * testsuite/Makefile.in: Regenerate.
11513         * testsuite/exclude_libs_test.c: New file.
11514         * testsuite/exclude_libs_test.sh: Ditto.
11515         * testsuite/exclude_libs_test_1.c: Ditto.
11516         * testsuite/exclude_libs_test_2.c: Ditto.
11517
11518 2009-05-15  Ian Lance Taylor  <iant@google.com>
11519
11520         * configure.ac: Check for declarations for cases where libiberty.h
11521         checks HAVE_DECL_xxx.
11522         * configure, config.in: Rebuild.
11523
11524 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11525
11526         * gold.h (Incremental_argument_list): Remove (invalid) forward
11527         declaration.
11528         * incremental.cc (Incremental_inputs::report_achive): New method.
11529         (Incremental_inputs::report_object): New method.
11530         (Incremental_inputs::report_script): New method.
11531         (Incremental_inputs::finalize_inputs): New method.
11532         (Incremental_inputs::finalize): Call finalize_inputs().
11533         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11534         Create inputs entries.
11535         * incremental.h (Incremental_input_type): New enum.
11536         (Incremental_inputs::Incremental_input): Initialize new fields.
11537         (Incremental_inputs::report_inputs): New method.
11538         (Incremental_inputs::report_achive): New method.
11539         (Incremental_inputs::report_object): New method.
11540         (Incremental_inputs::report_script): New method.
11541         (Incremental_inputs::finalize_inputs): New method.
11542         (Incremental_inputs::Input_info): New struct.
11543         (Incremental_inputs::Input_info_map): New typedef.
11544         (Incremental_inputs::lock_): New field.
11545         (Incremental_inputs::Inputs_): New field.
11546         (Incremental_inputs::Inputs_map): New field.
11547         * main.cc (main): Call Incremental_input::report_inputs.
11548         * options.h (Input_argument_list): Typedef moved from
11549         Input_arguments.
11550         (Input_file_group::Files): Remove, use ::Input_argument_list.
11551         (Input_file_group::Input_argument_list): Remove, use
11552         ::Input_argument_list.
11553         * plugin.cc (Plugin_manager::add_input_file): Add error in
11554         incremental build.
11555         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11556         functions.
11557         * script.cc (read_input_script): Call
11558         Incremental_input::report_script.
11559         * script.h (Script_info): New class.
11560
11561 2009-04-27  Ian Lance Taylor  <iant@google.com>
11562
11563         * x86_64.cc (do_adjust_output_section): Set entsize to
11564         plt_entry_size.
11565
11566 2009-04-23  Elliott Hughes  <enh@google.com>
11567
11568         * output.cc (Output_file::close): After short writes, continue
11569         writing from the correct offset in the buffer being written.
11570
11571 2009-04-23  Chris Demetriou  <cgd@google.com>
11572
11573         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11574         * configure: Regenerate.
11575         * config.in: Regenerate.
11576         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11577         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11578
11579 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11580
11581         * incremental.cc (Incremental_inputs_header_data): Renamed from
11582         Incremental_input_header_data.
11583         (Incremental_inputs_header_data::data_size): New field.
11584         (Incremental_inputs_header_data::put_input_file_count): Renamed
11585         from input_file_count.
11586         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11587         from command_line_offset.
11588         (Incremental_inputs_header_data::put_reserved): Renamed from
11589         put_reserved.
11590         (Incremental_inputs_entry_data): Renamed from
11591         Incremental_input_entry_data.
11592         (Incremental_inputs_entry_data::data_size): New field.
11593         (Incremental_inputs::report_command_line): New method.
11594         (Incremental_inputs::finalize): New method.
11595         (Incremental_inputs::create_incremental_inputs_data): New method.
11596         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11597         * incremental.h: New file.
11598         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11599         (Layout::finalize): Create incremental inputs section in
11600         incremental builds.
11601         (Layout::create_incremental_info_sections): New method.
11602         * layout.h (Layout::incremental_inputs): New method.
11603         (Layout::create_incremental_info_sections): New method.
11604         (Layout::incremental_inputs_): New field.
11605         * main.cc (main): Notify Incremental_input of the command line.
11606
11607 2009-04-01  Ian Lance Taylor  <iant@google.com>
11608             Mikolaj Zalewski  <mikolajz@google.com>
11609
11610         * gold.h (reserve_unordered_map): Define, three versions, one for
11611         each version of Unordered_map.
11612         * layout.cc (Layout::Layout): Remove options parameter.  Add
11613         number_of_input_files parameter.  Don't initialize options_.
11614         Initialize number_of_input_files_ and resized_signatures_.  Move
11615         sections_are_attached_.
11616         (Layout::layout_group): Reserve space for group_signatures_.
11617         (Layout::find_or_add_kept_section): Change name parameter to be a
11618         reference.  Resize signatures_ map when it gets large enough.
11619         (Layout::layout_eh_frame): Use parameters->options() instead of
11620         this->options_.
11621         (Layout::make_output_section): Likewise.
11622         (Layout::attach_allocated_section_to_segment): Likewise.
11623         (Layout::finalize, Layout::create_executable_stack): Likewise.
11624         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11625         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11626         * layout.h (class Layout): Update declarations.  Remove options_
11627         field.  Add number_of_input_files_ and resized_signatures_
11628         fields.  Move sections_are_attached_ field.
11629         * main.cc (main): Pass number of input files to Layout
11630         constructor.  Don't pass options.
11631
11632 2009-03-30  Ian Lance Taylor  <iant@google.com>
11633
11634         * ffsll.c (ffsll): Correct implementation.
11635
11636 2009-03-27  Ian Lance Taylor  <iant@google.com>
11637
11638         * ffsll.c: New file.
11639         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11640         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11641         * ftruncate.c (ftruncate): Declare before definition.
11642         * mremap.c (mremap): Likewise.
11643         * pread.c (pread): Likewise.
11644         * configure, Makefile.in, config.in: Rebuild.
11645
11646         * mremap.c: New file.
11647         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11648         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11649         (mremap): Declare if HAVE_MREMAP is not defined.
11650         * configure, Makefile.in, config.in: Rebuild.
11651
11652 2009-03-27  Cary Coutant  <ccoutant@google.com>
11653
11654         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11655         position independent.
11656         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11657         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11658
11659 2009-03-24  Cary Coutant  <ccoutant@google.com>
11660
11661         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11662         an executable.
11663         (needs_dynamic_reloc): Likewise.
11664
11665 2009-03-24  Ian Lance Taylor  <iant@google.com>
11666
11667         * yyscript.y (file_cmd): Recognize EXTERN.
11668         (extern_name_list, extern_name_list_body): New nonterminals.
11669         * script.cc (script_add_extern): Define.
11670         * script-c.h (script_add_extern): Declare.
11671
11672 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11673
11674         * object.cc (is_elf_object): Define.
11675         * object.h (is_elf_object): Declare.
11676         * archive.cc (Archive::get_elf_object_for_member): Call
11677         is_elf_object.
11678         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11679
11680 2009-03-24  Elliott Hughes  <enh@google.com>
11681
11682         * output.cc (Output_file::map_anonymous): Define.
11683         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11684         try an anonymous one.  Report the size if the mmap fails.
11685         * output.h (class Output_file): Declare map_anonymous.
11686
11687 2009-03-24  Ian Lance Taylor  <iant@google.com>
11688
11689         * target-select.cc (instantiate_target): Don't acquire the lock if
11690         the instantiated_target_ field has already been set.
11691
11692 2009-03-23  Ian Lance Taylor  <iant@google.com>
11693
11694         * gold-threads.h (class Initialize_lock): Define.
11695         * gold-threads.cc (class Initialize_lock_once): Define.
11696         (initialize_lock_control): New static variable.
11697         (initialize_lock_pointer): New static variable.
11698         (initialize_lock_once): New static function.
11699         (Initialize_lock::Initialize_lock): Define.
11700         (Initialize_lock::initialize): Define.
11701         * target-select.h: Include "gold-threads.h".
11702         (class Target_selector): Add lock_ and initialize_lock_ fields.
11703         Don't define instantiate_target, just declare it.
11704         * target-select.cc (Target_selector::Target_selector): Initialize
11705         new fields.
11706         (Target_selector::instantiate_target): Define.
11707         * descriptors.h: Include "gold-threads.h".
11708         (class Descriptors): Add initialize_lock_ field.
11709         * descriptors.cc (Descriptors::Descriptors): Initialize new
11710         field.
11711         (Descriptors::open): Use initialize_lock_ field
11712         * errors.h (class Errors): Add initialize_lock_ field.
11713         * errors.cc (Errors::Errors): Initialize new field.
11714         (Errors::initialize_lock): Use initialize_lock_ field.
11715         * powerpc.cc (class Target_selector_powerpc): Remove
11716         instantiated_target_ field.  In do_recognize call
11717         instantiate_target rather than do_instantiate_target.  In
11718         do_instantiate_target just allocate a new target.
11719         * sparc.cc (class Target_selector_sparc): Likewise.
11720
11721         * freebsd.h: New file.
11722         * i386.cc: Include "freebsd.h".
11723         (Target_i386): Derive from Target_freebsd rather than
11724         Sized_target.
11725         (Target_selector_i386): Derive from Target_selector_freebsd rather
11726         than Target_selector.
11727         * x86_64.cc: Include "freebsd.h".
11728         (Target_x86_64): Derive from Target_freebsd rather than
11729         Sized_target.
11730         (Target_selector_x86_64): Derive from Target_selector_freebsd
11731         rather than Target_selector.
11732         * target.h (class Target): Add adjust_elf_header and
11733         do_adjust_elf_header.
11734         * output.cc (Output_file_header:: do_sized_write): Call target
11735         adjust_elf_header routine.
11736         * configure.tgt: Set targ_osabi.
11737         * configure.ac: Define GOLD_DEFAULT_OSABI.
11738         * parameters.cc (Parameters::default_target): Pass
11739         GOLD_DEFAULT_OSABI to select_target.
11740         * target-select.h (class Target_selector): Make instantiate_target
11741         protected rather than private.
11742         * Makefile.am (HFILES): Add freebsd.h.
11743         * configure, Makefile.in, config.in: Rebuild.
11744
11745         * merge.cc (do_add_input_section): Correct pend value.  Change
11746         message about last entry not being null terminated from error to
11747         warning.
11748
11749 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11750
11751         * incremental.cc: New file.
11752         * Makefile.am (CCFILES): Add incremental.cc.
11753         * Makefile.in: Rebuild.
11754
11755 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11756
11757         * layout.cc (Layout::output_section_name): Preserve names
11758         of '.note.' sections.
11759
11760 2009-03-19  Ian Lance Taylor  <iant@google.com>
11761
11762         * descriptors.cc (Descriptors::open): Check that the options are
11763         valid before using them.
11764
11765 2009-03-18  Ian Lance Taylor  <iant@google.com>
11766
11767         * script-sections.h: Include <list>.
11768         (class Script_sections): Change Sections_elements from std::vector
11769         to std::list.  Typedef public Elements_iterator.  Add
11770         orphan_section_placement_, data_segment_align_start_, and
11771         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11772         field.
11773         * script-sections.cc (class Orphan_section_placement): New class.
11774         (class Sections_element): Add virtual functions is_relro and
11775         orphan_section_init.  Remove virtual function place_orphan_here.
11776         (class Output_section_definition): Add is_relro and
11777         orphan_section_init.  Remove place_orphan_here.
11778         (class Orphan_output_section): Likewise.
11779         (Script_sections::Script_sections): Update for field changes.
11780         (Script_sections::data_segment_align): Set saw_data_segment_align_
11781         and data_segment_align_start_, not data_segment_align_index.
11782         (Script_sections::data_segment_relro_end): Check
11783         saw_data_segment_align_.  Use data_segment_align_start_ rather
11784         than data_segment_align_index_.
11785         (Script_sections::place_orphan): Rewrite to use
11786         Orphan_section_placement.
11787
11788 2009-03-17  Ian Lance Taylor  <iant@google.com>
11789
11790         * archive.cc (Archive::add_symbols): Check for a version attached
11791         to the symbol name in the archive map.
11792         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11793         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11794         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11795         (ver_test_11.a): New target.
11796         * testsuite/Makefile.in: Rebuild.
11797
11798         * configure.ac: Check for chsize and posix_fallocate.  Replace
11799         ftruncate.
11800         * ftruncate.c: New file, from gnulib.
11801         * output.cc (posix_fallocate): Define dummy version if not
11802         HAVE_POSIX_FALLOCATE.
11803         (Output_file::map): Call posix_fallocate rather than lseek and
11804         write.
11805         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11806         * configure, Makefile.in, config.in: Rebuild.
11807
11808 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11809
11810         * layout.h (Layout::create_note): Add section_name parameter.
11811         * layout.cc (Layout::create_note): Likewise.
11812         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11813
11814 2009-03-17  Ian Lance Taylor  <iant@google.com>
11815
11816         * descriptors.cc: Include "options.h".
11817         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11818         (Descriptors::open): Always use O_CLOEXEC when opening a new
11819         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11820         then set FD_CLOEXEC.
11821
11822         * sparc.cc (class Target_sparc): Add has_got_section.
11823         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11824         make sure we have a GOT section.
11825
11826         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11827         (Target_sparc::Scan::local): Likewise.
11828         (Target_sparc::Scan::global): Likewise.
11829         (Target_sparc::Relocate::relocate): Likewise.
11830         (Target_sparc::Relocate::relocate_tls): Likewise.
11831
11832         * symtab.cc (Symbol_table::define_default_version): New function,
11833         broken out of add_from_object.
11834         (Symbol_table::add_from_object): Call define_default_version.
11835         (Symbol_table::define_special_symbol): Add resolve_oldsym
11836         parameter.  Change all callers.  If the version for a symbol comes
11837         from a version script, resolve it with the symbol with the same
11838         name with no version.  Also add the symbol without a version if
11839         appropriate.
11840         (do_define_in_output_data): If resolving with oldsym, don't delete
11841         sym.
11842         (do_define_in_output_segment): Likewise.
11843         (do_define_as_constant): Likewise.
11844         * symtab.h (class Symbol_table): Update declarations.
11845
11846 2009-03-13  Ian Lance Taylor  <iant@google.com>
11847
11848         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11849         (Read_symbols::requeue): New function.
11850         (Read_symbols::do_read_symbols): If make_elf_object fails because
11851         the target type is not configured, and the file was searched for,
11852         issue a warning and retry with the next directory.
11853         (Add_symbols::run): If the file has an incompatible format, and
11854         it was searched for, requeue the Read_symbols task.  On error,
11855         release the object.
11856         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11857         dirindex parameter to constructor.  Change all callers.  Declare
11858         incompatible_warning and requeue.
11859         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11860         input_argument_ and input_group_ fields.  Add them to
11861         constructor.  Change all callers.
11862         (class Read_script): Add dirindex_ field.  Add it to constructor.
11863         Change all callers.
11864         * archive.cc (Archive::setup): Remove input_objects parameter.
11865         Change all callers.
11866         (Archive::get_file_and_offset): Likewise.
11867         (Archive::read_all_symbols): Likewise.
11868         (Archive::read_symbols): Likewise.
11869         (Archive::get_elf_object_for_member): Remove input_objects
11870         parameter.  Add punconfigured parameter.  Change all callers.
11871         (Archive::add_symbols): Change return type to bool.  Check return
11872         value of include_member.
11873         (Archive::include_all_members): Likewise.
11874         (Archive::include_member): Change return type to bool.  Return
11875         false if first included object has incompatible target.  Set
11876         included_member_ field.
11877         (Add_archive_symbols::run): If add_symbols returns false, requeue
11878         Read_symbols task.
11879         * archive.h (class Archive): Add included_member_ field.
11880         Initialize it in constructor.  Add input_file and searched_for
11881         methods.  Update declarations.
11882         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11883         input_argument_ fields.  Add them to constructor.  Change all
11884         callers.
11885         * script.cc: Include "target-select.h".
11886         (class Parser_closure): Add skip_on_incompatible_target_ and
11887         found_incompatible_target_ fields.  Add
11888         skip_on_incompatible_target parameter to constructor.  Change all
11889         callers.  Add methods skip_on_incompatible_target,
11890         clear_skip_on_incompatible_target, found_incompatible_target, and
11891         set_found_incompatible_target.
11892         (read_input_script): Add dirindex parameter.  Change all callers.
11893         If parser finds an incompatible target, requeue Read_symbols
11894         task.
11895         (script_set_symbol): Clear skip_on_incompatible_target in
11896         closure.
11897         (script_add_assertion, script_parse_option): Likewise.
11898         (script_start_sections, script_add_phdr): Likewise.
11899         (script_check_output_format): New function.
11900         * script.h (read_input_script): Update declaration.
11901         * script-c.h (script_check_output_format): Declare.
11902         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11903         (ignore_cmd): Remove OUTPUT_FORMAT.
11904         * fileread.cc (Input_file::Input_file): Add explicit this.
11905         (Input_file::will_search_for): New function.
11906         (Input_file::open): Add pindex parameter.  Change all callers.
11907         * fileread.h (class Input_file): Add input_file_argument method.
11908         Declare will_search_for.  Update declarations.
11909         * object.cc (make_elf_object): Add punconfigured parameter.
11910         Change all callers.
11911         * object.h (class Object): Make input_file public.  Add
11912         searched_for method.
11913         (make_elf_object): Update declaration.
11914         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11915         restart search.
11916         * dirsearch.h (class Dirsearch): Update declaration.
11917         * options.h (class General_options): Add --warn-search-mismatch.
11918         * parameters.cc (Parameters::is_compatible_target): New function.
11919         * parameters.h (class Parameters): Declare is_compatible_target.
11920         * workqueue.cc (Workqueue::add_blocker): New function.
11921         * workqueue.h (class Workqueue): Declare add_blocker.
11922
11923         * fileread.cc (Input_file::open): Remove options parameter.
11924         Change all callers.
11925         (Input_file::open_binary): Likewise.
11926         * script.cc (read_input_script): Likewise.
11927         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11928         options parameter from constructor.  Change all callers.
11929         (class Read_script): Likewise.
11930         * fileread.h (class Input_file): Update declarations.
11931         * script.h (read_input_script): Update declaration.
11932
11933 2009-03-10  Nick Clifton  <nickc@redhat.com>
11934
11935         * po/es.po: New Spanish translation.
11936
11937 2009-03-06  Cary Coutant  <ccoutant@google.com>
11938
11939         * options.cc (parse_short_option): Keep dash_z from registering itself.
11940
11941 2009-03-03  Ian Lance Taylor  <iant@google.com>
11942
11943         PR 9918
11944         * target-reloc.h (relocate_section): Pass output_section to
11945         relocate.
11946         * i386.cc (Target_i386::should_apply_static_reloc): Add
11947         output_section parameter.  Change all callers.
11948         (Target_i386::Relocate::relocate): Add output_section parameter.
11949         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11950         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11951         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11952         * testsuite/two_file_shared.sh: New script.
11953         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11954         (check_DATA): Add two_file_shared.dbg.
11955         (two_file_shared.dbg): New target.
11956         * testsuite/Makefile.in: Rebuild.
11957
11958 2009-03-01  Ian Lance Taylor  <iant@google.com>
11959
11960         * configure.ac: Check for byteswap.h.
11961         * configure: Rebuild.
11962         * config.in: Rebuild.
11963
11964 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11965
11966         * layout.cc (Layout::find_or_add_kept_section): New function.
11967         (Layout::add_comdat): Removed.
11968         * layout.h (struct Kept_section): Move out of class Layout.
11969         Remove trailing underscores from field names.  Add group_sections
11970         field.  Rename group_ field to is_group.  Change all uses.
11971         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11972         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11973         comdat_groups_ field.
11974         (Sized_relobj::include_section_group): Use
11975         find_or_add_kept_section and Kept_section::group_sections.
11976         (Sized_relobj::include_linkonce_section): Likewise.
11977         * object.cc (class Sized_relobj): Don't define Comdat_group or
11978         Comdat_group_table.  Remove find_comdat_group and
11979         add_comdat_group.  Remove comdat_groups_ field.
11980         * plugin.cc (include_comdat_group): Use
11981         Layout::find_or_add_kept_section.
11982
11983 2009-02-28  Ian Lance Taylor  <iant@google.com>
11984
11985         * README: --gc-sections and map files are now supported.  Document
11986         some build requirements.
11987
11988         PR 6992
11989         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11990         relocatable link set the value of the section symbol to zero.
11991         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11992         relocatable link don't include the section address in the local
11993         symbol value.
11994
11995 2009-02-27  Ian Lance Taylor  <iant@google.com>
11996
11997         PR 6811
11998         * options.h (class Search_directory): Add is_system_directory.
11999         (class General_options): Declare is_in_system_directory.
12000         * options.cc (get_relative_sysroot): Make static.
12001         (get_default_sysroot): Make static.
12002         (General_optoins::is_in_system_directory): New function.
12003         * fileread.cc (Input_file::is_in_system_directory): New function.
12004         * fileread.h (class Input_file): Declare is_in_system_directory.
12005         * object.h (class Object): Add is_in_system_directory.
12006         (class Input_objects): Remove system_library_directory_ field.
12007         * object.cc (Input_objects::add_object): Don't set
12008         system_library_directory_.
12009         (input_objects::found_in_system_library_directory): Remove.
12010         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12011         parameter.  Change all callers.
12012         (Symbol_table::sized_write_globals): Likewise.
12013         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12014         Call Object::is_in_system_directory.
12015         * symtab.h (class Symbol_table): Update declarations.
12016
12017         PR 5990
12018         * descriptors.h (Open_descriptor): Add is_on_stack field.
12019         * descriptors.cc (Descriptors::open): If the descriptor is on the
12020         top of the stack, remove it.  Initialize is_on_stack field.
12021         (Descriptors::release): Only add pod to stack if it is not on the
12022         stack already.
12023         (Descriptors::close_some_descriptor): Clear stack_next and
12024         is_on_stack fields.
12025
12026         PR 7091
12027         * output.cc (Output_section::find_starting_output_address): Rename
12028         from starting_output_address; add PADDR parameter; change return
12029         type.
12030         * output.h (class Output_section): Declare
12031         find_starting_output_address instead of starting_output_address.
12032         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12033         section symbol for which we can't find a merge section.
12034
12035         PR 9836
12036         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12037         hidden or internal, force the symbol to be local.
12038         * resolve.cc (Symbol::override_visibility): Define.
12039         (Symbol::override_base): Use override_visibility.
12040         (Symbol_table::resolve): Likewise.
12041         (Symbol::override_base_with_special): Likewise.
12042         (Symbol_table::override_with_special): If the visibility is hidden
12043         or internal, force the symbol to be local.
12044         * symtab.h (class Symbol): Add set_visibility and
12045         override_visibility.
12046         * testsuite/ver_test_1.sh: New file.
12047         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12048         (check_DATA): Add ver_test_1.syms.
12049         (ver_test_1.syms): New target.
12050         * testsuite/Makefile.in: Rebuild.
12051
12052 2009-02-25  Cary Coutant  <ccoutant@google.com>
12053
12054         * layout.cc (Layout::choose_output_section): Don't rename sections
12055         when using a linker script that has a SECTIONS clause.
12056         * Makefile.in: Regenerate.
12057
12058         * testsuite/Makefile.am (script_test_5.sh): New test case.
12059         * testsuite/Makefile.in: Regenerate.
12060         * testsuite/script_test_5.cc: New file.
12061         * testsuite/script_test_5.sh: New file.
12062         * testsuite/script_test_5.t: New file.
12063
12064 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12065
12066         * archive.cc (Archive::include_member): Update calls to add_symbols.
12067         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12068         the Layout argument.
12069         * dynobj.h (do_add_symbols): Add the Layout argument.
12070         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12071         Layout argument.
12072         * object.h (Object::add_symbols): Add the Layout argument.
12073         (Object::do_add_symbols): Add the Layout argument.
12074         (Sized_relobj::do_add_symbols): Add the Layout argument.
12075         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12076         Unify the two versions.
12077         (Add_plugin_symbols): Remove.
12078         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12079         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12080         (Add_plugin_symbols): Remove.
12081         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12082         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12083         (Add_symbols::run): Make it work with Pulginobj.
12084
12085 2009-02-06  Ian Lance Taylor  <iant@google.com>
12086
12087         * object.cc (Sized_relobj::do_layout): Make info message start
12088         with lower case letter.
12089
12090 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12091
12092         * binary.cc: Fix file comment.
12093
12094         * options.h (enum Incremental_disposition): Define.
12095         (class General_options): Add new options: --incremental,
12096         --incremental_changed, --incremental_unchanged,
12097         --incremental_unknown.  Add incremental_disposition_ and
12098         implicit_incremental_ fields.
12099         (General_options::incremental_disposition): New function.
12100         (class Position_dependent_options): Add incremental_disposition
12101         option.
12102         (Position_dependent_options::copy_from_options): Set incremental
12103         dispositions.
12104         * options.cc (General_options::parse_incremental_changed): New
12105         function.
12106         (General_options::parse_incremental_unchanged): New function.
12107         (General_options::parse_incremental_unknown): New function.
12108         (General_options::General_options): Initialize new fields
12109         incremental_disposition_ and implicit_incremental_.
12110         (General_options::finalize): Check for uasge of --incremental-*
12111         without --incremental.
12112
12113 2009-02-06  Chris Demetriou  <cgd@google.com>
12114
12115         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12116         pointer and to report location as the file name associated with
12117         the symbol.
12118         (gold_undefined_symbol_at_location): New function to replace the
12119         old gold_undefined_symbol functionality.
12120         * target-reloc.h (relocate_section): Update to use
12121         gold_undefined_symbol_at_location.
12122         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12123         Call gold_undefined_symbol function rather than gold_error.
12124         * errors.h (Errors::undefined_symbol): Take location as a
12125         string, rather than calculating it from a relocation.
12126         * errors.cc (Errors::fatal): Print "fatal error:" before the
12127         formatted message.
12128         (Errors::error, Errors::error_at_location): Print "error: "
12129         before the formatted message.
12130         (Errors::undefined_symbol): Take location as a string, rather
12131         than calculating it from a relocation.
12132         (gold_undefined_symbol_at_location): New function akin to
12133         old gold_undefined_symbol, calculates location from relocation.
12134         (gold_undefined_symbol): Change to take only a Symbol pointer
12135         and to report location as the file name associated with the symbol.
12136         * testsuite/debug_msg.sh: Update for changed error messages.
12137         * testsuite/undef_symbol.sh: Likewise.
12138
12139 2009-02-04  Duncan Sands  <baldrick@free.fr>
12140
12141         PR 9812
12142         * reduced_debug_output.h
12143         (Output_reduced_debug_abbrev_section::failed): Use format for
12144         gold_warning.
12145         (Output_reduced_debug_info_section::faild): Likewise.
12146
12147 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12148
12149         * script.cc (Lazy_demangler): New class.
12150         (Version_script_info::get_symbol_version_helper): Demangle a
12151         symbol only once.
12152
12153 2009-01-29  Cary Coutant  <ccoutant@google.com>
12154
12155         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12156         to __tls_get_addr.
12157         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12158
12159 2009-01-28  Ian Lance Taylor  <iant@google.com>
12160
12161         * version.cc (version_string): Bump to 1.9.
12162
12163         * gold.h: Include <cstring> and <stdint.h>.
12164         * version.cc: Include <cstdio>.
12165         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12166         warning.
12167         * reduced_debug_output.cc (insert_into_vector): Rename from
12168         Insert_into_vector; change all callers.  Use Swap_unaligned to
12169         avoid aliasing issue; remove union since it is unnecessary.
12170
12171 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12172
12173         * Makefile.am (CCFILES): Add gc.cc.
12174         (HFILES): Add gc.h.
12175         * Makefile.in: Regenerate.
12176         * gold.cc (Gc_runner): New class.
12177         (queue_initial_tasks): Call garbage collection related tasks
12178         when corresponding options are invoked.
12179         (queue_middle_gc_tasks): New function.
12180         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12181         processed early before laying out sections during garbage collection.
12182         * gold.h (queue_middle_gc_tasks): New function.
12183         (is_prefix_of): Move from "layout.cc".
12184         * i386.cc (Target_i386::gc_process_relocs): New function.
12185         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12186         * main.cc (main): Create object of class "Garbage_collection".
12187         * object.cc (Relobj::copy_symbols_data): New function.
12188         (Relobj::is_section_name_included): New function.
12189         (Sized_relobj::do_layout): Allow this function to be called twice
12190         during garbage collection and defer layout of section during the
12191         first call.
12192         * object.h (Relobj::get_symbols_data): New function.
12193         (Relobj::is_section_name_included): New function.
12194         (Relobj::copy_symbols_data): New function.
12195         (Relobj::set_symbols_data): New function.
12196         (Relobj::get_relocs_data): New function.
12197         (Relobj::set_relocs_data): New function.
12198         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12199         (Relobj::gc_process_relocs): New function.
12200         (Relobj::do_gc_process_relocs): New pure virtual function.
12201         (Relobj::sd_): New data member.
12202         (Sized_relobj::is_output_section_offset_invalid): New function.
12203         (Sized_relobj::do_gc_process_relocs): New function.
12204         * options.h (General_options::gc_sections): Modify to not be a no-op.
12205         (General_options::print_gc_sections): New option.
12206         * plugin.cc (Plugin_finish::run): Remove function call to
12207         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12208         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12209         * reloc.cc (Read_relocs::run): Add task to process relocs and
12210         determine unreferenced sections when doing garbage collection.
12211         (Gc_process_relocs): New class.
12212         (Sized_relobj::do_gc_process_relocs): New function.
12213         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12214         sections that are garbage collected.
12215         * reloc.h (Gc_process_relocs): New class.
12216         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12217         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12218         symbols whose corresponding sections are garbage collected.
12219         (Symbol_table::Symbol_table): Add new parameter for the garbage
12220         collection object.
12221         (Symbol_table::gc_mark_undef_symbols): New function.
12222         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12223         (Symbol_table::gc_mark_dyn_syms): New function.
12224         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12225         as garbage.
12226         (Symbol_table::add_from_object): Likewise.
12227         (Symbol_table::add_from_relobj): When building shared objects, do not
12228         treat externally visible symbols as garbage.
12229         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12230         table information for static and relocatable links.
12231         * symtab.h (Symbol_table::set_gc): New function.
12232         (Symbol_table::gc): New function.
12233         (Symbol_table::gc_mark_undef_symbols): New function.
12234         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12235         (Symbol_table::gc_mark_dyn_syms): New function.
12236         (Symbol_table::gc_): New data member.
12237         * target.h (Sized_target::gc_process_relocs): New pure virtual
12238         function.
12239         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12240         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12241
12242 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12243
12244         * options.h (General_options::gc_sections): Define as a no-op for now.
12245         (General_options::no_keep_memory): Ditto.
12246         (General_options::Bshareable): Define.
12247         * options.cc (General_options::finalize): Honor -Bshareable.
12248
12249 2009-01-20  Andreas Schwab  <schwab@suse.de>
12250
12251         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12252         read the value in the contents, since we don't use it.  Use the
12253         template endianness when writing.
12254         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12255
12256 2009-01-19  Andreas Schwab  <schwab@suse.de>
12257
12258         * configure.tgt (powerpc64-*): Fix targ_obj.
12259
12260 2009-01-15  Ian Lance Taylor  <iant@google.com>
12261
12262         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12263         local symbols when stripping all symbols.
12264
12265 2009-01-14  Cary Coutant  <ccoutant@google.com>
12266
12267         * output.cc (Output_reloc): Add explicit instantiations.
12268
12269 2009-01-14  Cary Coutant  <ccoutant@google.com>
12270
12271         * archive.cc (Archive::get_elf_object_for_member): Remove call
12272         to File_read::claim_for_plugin.
12273         * descriptors.cc (Descriptors::open): Remove reference to
12274         is_claimed.
12275         (Descriptors::claim_for_plugin): Remove.
12276         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12277         (Descriptors::is_claimed): Remove.
12278         (claim_descriptor_for_plugin): Remove.
12279         * fileread.cc (File_read::claim_for_plugin): Remove.
12280         * fileread.h (File_read::claim_for_plugin): Remove.
12281         (File_read::descriptor): Reopen descriptor if necessary.
12282         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12283         (Plugin_manager::all_symbols_read): Add task parameter. Change
12284         all callers.
12285         (Plugin_manager::get_input_file): New function.
12286         (Plugin_manager::release_input_file): New function.
12287         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12288         corresponding data member.
12289         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12290         and pass to base constructor. Change all callers.
12291         (get_input_file, release_input_file): New functions.
12292         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12293         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12294         (Plugin_manager::all_symbols_read): Add task parameter.
12295         (Plugin_manager::get_input_file): New function.
12296         (Plugin_manager::release_input_file): New function.
12297         (Plugin_manager::task_): New data member.
12298         (Pluginobj::Pluginobj): Add filesize parameter.
12299         (Pluginobj::filename): New function.
12300         (Pluginobj::descriptor): New function.
12301         (Pluginobj::filesize): New function.
12302         (Pluginobj::filesize_): New data member.
12303         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12304         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12305         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12306
12307         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12308         with archive libraries.
12309         * testsuite/Makefile.in: Regenerate.
12310         * testsuite/plugin_test.c (struct sym_info): New type.
12311         (get_input_file, release_input_file): New static variables.
12312         (onload): Capture new transfer vector entries.
12313         (claim_file_hook): Stop reading at end of file according to filesize.
12314         Factor out parsing of readelf output into separate function.
12315         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12316         APIs and get the source file name from the symbol table.  Convert
12317         source file name to corresponding object file name.  Print info
12318         message when adding new input files.
12319         (parse_readelf_line): New function.
12320         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12321         * testsuite/plugin_test_2.sh: Likewise.
12322         * testsuite/plugin_test_3.sh: Likewise.
12323         * testsuite/plugin_test_4.sh: New test case.
12324
12325 2009-01-07  Ian Lance Taylor  <iant@google.com>
12326
12327         * version.cc (version_string): Bump to 1.8.
12328
12329 2008-12-23  Cary Coutant  <ccoutant@google.com>
12330
12331         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12332         * plugin.cc (Plugin_manager::finish): Rename as
12333         layout_deferred_objects.  Move cleanup to separate function.
12334         (Plugin_manager::cleanup): New function.
12335         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12336         separately.
12337         * plugin.h (Plugin_manager::finish): Rename as
12338         layout_deferred_objects.
12339         (Plugin_manager::cleanup): New function.
12340         (Plugin_manager::cleanup_done): New field.
12341
12342 2008-12-23  Cary Coutant  <ccoutant@google.com>
12343
12344         * plugin.cc (is_visible_from_outside): New function.
12345         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12346         so we don't return "IR only" status for exported symbols or -r links.
12347
12348         * testsuite/Makefile.am (plugin_test_3): New test case.
12349         * testsuite/Makefile.in: Regenerate.
12350         * testsuite/plugin_test_3.sh: New file.
12351
12352 2008-12-22  Cary Coutant  <ccoutant@google.com>
12353
12354         * object.cc (Sized_relobj::layout_section): New function.
12355         (Sized_relobj::do_layout): Defer layout of input sections until after
12356         plugin has provided replacement files.
12357         (Sized_relobj::do_layout_deferred_sections): New function.
12358         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12359         (Relobj::layout_deferred_sections): New function.
12360         (Relobj::do_layout_deferred_sections): New function.
12361         (Sized_relobj::do_layout_deferred_sections): New function.
12362         (Sized_relobj::layout_section): New function.
12363         (Sized_relobj::Deferred_layout): New structure.
12364         (Sized_relobj::deferred_layout_): New field.
12365         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12366         Change all callers.  Layout deferred sections.
12367         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12368         references.
12369         (Plugin_hook::run): Move code from do_plugin_hook inline.
12370         (Plugin_hook::do_plugin_hook): Remove.
12371         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12372         (Plugin_manager::finish): Renamed, was cleanup.
12373         (Plugin_manager::should_defer_layout): New function.
12374         (Plugin_manager::add_deferred_layout_object): New function.
12375         (Plugin_manager::Deferred_layout_list): New type.
12376         (Plugin_manager::deferred_layout_objects_): New field.
12377         (Plugin_hook::do_plugin_hook): Remove.
12378
12379 2008-12-17  Ian Lance Taylor  <iant@google.com>
12380
12381         * options.h (class General_options): Add --no case for
12382         --export-dynamic.
12383
12384 2008-12-16  Cary Coutant  <ccoutant@google.com>
12385
12386         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12387         vector.
12388         (Plugin_manager::claim_file): Create plugin object even if
12389         plugin did not call the add_symbols callback.
12390         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12391         asking for more symbols than were added.
12392         * testsuite/Makefile.am (plugin_test_1): Add test case with
12393         no global symbols.
12394         (empty.syms): New target.
12395         * testsuite/Makefile.in: Regenerate.
12396         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12397         message. Don't call add_symbols if no globals.
12398         (all_symbols_read_hook): Don't provide replacement for empty
12399         claimed file.
12400
12401 2008-12-12  Ian Lance Taylor  <iant@google.com>
12402
12403         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12404         r_type == 0 for a local symbol with r_sym == 0.
12405         (scan_relocatable_relocs): Pass r_sym to
12406         local_non_section_strategy.
12407         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12408         r_sym parameter.
12409
12410         * configure.ac: Update test for TLS descriptors: they are
12411         supported as of glibc 2.9.
12412         * configure: Rebuild.
12413
12414 2008-12-11  Ian Lance Taylor  <iant@google.com>
12415
12416         PR 7091
12417         * target-reloc.h (Default_scan_relocatable_relocs): For each
12418         function, map r_type == 0 to RELOC_DISCARD.
12419
12420 2008-12-10  Cary Coutant  <ccoutant@google.com>
12421
12422         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12423         object to override a kept COMDAT group from a plugin object.
12424
12425 2008-12-09  Ian Lance Taylor  <iant@google.com>
12426
12427         PR 7088
12428         * yyscript.y (file_cmd): Handle INPUT.
12429
12430         * testsuite/initpri1.c: Change all declarations to be full
12431         prototypes by adding void, to avoid compiler warnings.
12432
12433 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12434
12435         * options.cc (General_options::parse_plugin_opt): New.
12436         (General_options::add_plugin): The argument now is just the filename.
12437         (General_options::add_plugin_option): New.
12438         * options.h (plugin_opt): New.
12439         (add_plugin): Change argument name.
12440         (add_plugin_option): New.
12441         * plugin.cc (Plugin::load): Don't parse the plugin option.
12442         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12443         (Plugin::add_option): New.
12444         (Plugin::args_): Change type.
12445         (Plugin::filename_): New.
12446         (Plugin_manager::add_plugin_option): New.
12447         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12448         * testsuite/Makefile.in: Regenerate.
12449
12450 2008-12-05  Cary Coutant  <ccoutant@google.com>
12451
12452         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12453         Handle --strip-lto-sections option.
12454         * options.h (strip_lto_sections): New option.
12455
12456 2008-12-01  Cary Coutant  <ccoutant@google.com>
12457
12458         * plugin.cc (ld_plugin_message): Change format parameter to const.
12459         Fix mismatch between new[] and delete.
12460
12461 2008-11-14  Cary Coutant  <ccoutant@google.com>
12462
12463         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12464         instead of -1U.
12465
12466 2008-11-05  Craig Silverstein  <csilvers@google.com>
12467
12468         * options.cc (General_options::parse_dynamic_list): New function.
12469         * options.h (General_options): New flags dynamic_list,
12470         dynamic_list_data, dynamic_list_cpp_new, and
12471         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12472         (General_options::in_dynamic_list): New function.
12473         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12474         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12475         (Lex::can_continue_name): Likewise.
12476         (yylex): Likewise.
12477         (read_script_file): New parameter script_options.
12478         (read_dynamic_list): New function.
12479         (Script_options::define_dynamic_list): New function.
12480         (dynamic_list_keyword_parsecodes): New variable.
12481         (dynamic_list_keywords): New variable.
12482         * script.h (Script_options::define_dynamic_list): New function
12483         prototype.
12484         (read_dynamic_list): New function prototype.
12485         * symtab.cc (strprefix): New macro.
12486         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12487         dynamic_list_data, dynamic_list_cpp_new, and
12488         dynamic_list_cpp_typeinfo.
12489         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12490         (dynamic_list_expr): New rule.
12491         (dynamic_list_nodes): Likewise.
12492         (dynamic_list_node): Likewise.
12493         * testsuite/Makefile.am (dynamic_list): New test.
12494         * testsuite/Makefile.in: Regenerated.
12495         * testsuite/dynamic_list.t: New file.
12496         * testsuite/dynamic_list.sh: New file.
12497
12498 2008-11-05  Craig Silverstein  <csilvers@google.com>
12499
12500         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12501         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12502         (t11_last): Likewise.
12503         * testsuite/ver_test_6.c (main): Likewise.
12504
12505 2008-10-07  Cary Coutant  <ccoutant@google.com>
12506
12507         * options.c (General_options::finalize): Add check for -static and
12508         -shared.
12509         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12510         is not empty.
12511
12512 2008-10-02  Cary Coutant  <ccoutant@google.com>
12513
12514         * plugin.cc (make_sized_plugin_object): Fix conditional
12515         compilation to work when not all targets are enabled.
12516
12517 2008-09-29  Cary Coutant  <ccoutant@google.com>
12518
12519         * archive.cc (Archive::get_file_and_offset): Use filename instead
12520         of name to get library path.
12521         (Archive::include_member): Unlock external member of a thin archive.
12522
12523         * testsuite/Makefile.am (TEST_AR): New variable.
12524         (thin_archive_test_1): New test.
12525         (thin_archive_test_2): New test.
12526         * testsuite/Makefile.in: Regenerate.
12527         * testsuite/thin_archive_main.cc: New file.
12528         * testsuite/thin_archive_test_1.cc: New file.
12529         * testsuite/thin_archive_test_2.cc: New file.
12530         * testsuite/thin_archive_test_3.cc: New file.
12531         * testsuite/thin_archive_test_4.cc: New file.
12532
12533 2008-09-29  Cary Coutant  <ccoutant@google.com>
12534
12535         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12536         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12537         instead of -1U.
12538         (Sized_relobj::do_finalize_local_symbols): Likewise.
12539         (Sized_relobj::map_to_kept_section): Likewise.
12540         * object.h (Sized_relobj::invalid_address): New constant.
12541         (Sized_relobj::do_output_section_offset): Check for invalid_address
12542         and return -1ULL.
12543         * output.cc (Output_reloc::local_section_offset): Use constant
12544         invalid_address instead of -1U.
12545         (Output_reloc::get_address): Likewise.
12546         (Output_section::output_address): Change -1U to -1ULL.
12547         * output.h (Output_reloc::invalid_address): New constant.
12548         * reloc.cc (Sized_relobj::write_sections): Use constant
12549         invalid_address instead of -1U.
12550         (Sized_relobj::relocate_sections): Likewise.
12551         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12552         values for merge sections.
12553         * target-reloc.h (relocate_for_relocatable): Use constant
12554         invalid_address instead of -1U.
12555
12556 2008-09-19  Cary Coutant  <ccoutant@google.com>
12557
12558         Add plugin functionality for link-time optimization (LTO).
12559         * configure.ac (plugins): Add --enable-plugins option.
12560         * configure: Regenerate.
12561         * config.in: Regenerate.
12562         * Makefile.am (LIBDL): New variable.
12563         (CCFILES): Add plugin.cc.
12564         (HFILES): Add plugin.h.
12565         (ldadd_var): Add LIBDL.
12566         * Makefile.in: Regenerate.
12567
12568         * archive.cc: Include "plugin.h".
12569         (Archive::setup): Don't preread archive symbols when using a plugin.
12570         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12571         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12572         files.
12573         (Archive::include_member): Add symbols from plugin objects.
12574         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12575         * descriptors.cc (Descriptors::open): Check for file descriptors
12576         abandoned by plugins.
12577         (Descriptors::claim_for_plugin): New function.
12578         * descriptors.h (Descriptors::claim_for_plugin): New function.
12579         (Open_descriptor::is_claimed): New field.
12580         (claim_descriptor_for_plugin): New function.
12581         * fileread.cc (File_read::claim_for_plugin): New function.
12582         * fileread.h (File_read::claim_for_plugin): New function.
12583         (File_read::descriptor): New function.
12584         * gold.cc: Include "plugin.h".
12585         (queue_initial_tasks): Add task to call plugin hooks for generating
12586         new object files.
12587         * main.cc: Include "plugin.h".
12588         (main): Load plugin libraries.
12589         * object.h (Pluginobj): Declare.
12590         (Object::pluginobj): New function.
12591         (Object::do_pluginobj): New function.
12592         (Object::set_target): New function.
12593         * options.cc: Include "plugin.h".
12594         (General_options::parse_plugin): New function.
12595         (General_options::General_options): Initialize plugins_ field.
12596         (General_options::add_plugin): New function.
12597         * options.h (Plugin_manager): Declare.
12598         (General_options): Add --plugin option.
12599         (General_options::has_plugins): New function.
12600         (General_options::plugins): New function.
12601         (General_options::add_plugin): New function.
12602         (General_options::plugins_): New field.
12603         * plugin.cc: New file.
12604         * plugin.h: New file.
12605         * readsyms.cc: Include "plugin.h".
12606         (Read_symbols::do_read_symbols): Check for archive before checking
12607         for ELF file.  Call plugin hooks to claim files.
12608         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12609         from a real object file; force override when processing replacement
12610         files.
12611         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12612         (Symbol::init_base_object): Likewise.
12613         (Symbol::init_base_output_data): Likewise.
12614         (Symbol::init_base_output_segment): Likewise.
12615         (Symbol::init_base_constant): Likewise.
12616         (Symbol::init_base_undefined): Likewise.
12617         (Symbol::output_section): Assert that object is not a plugin.
12618         (Symbol_table::add_from_pluginobj): New function.
12619         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12620         undefined.
12621         (Symbol_table::sized_write_globals): Likewise.
12622         (Symbol_table::add_from_pluginobj): Instantiate template.
12623         * symtab.h (Sized_pluginobj): Declare.
12624         (Symbol::in_real_elf): New function.
12625         (Symbol::set_in_real_elf): New function.
12626         (Symbol::in_real_elf_): New field.
12627         (Symbol_table::add_from_pluginobj): New function.
12628
12629         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12630         (LIBDL): New variable.
12631         (LDADD): Add LIBDL.
12632         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12633         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12634         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12635         (MOSTLYCLEANFILES): Likewise.
12636         * testsuite/Makefile.in: Regenerate.
12637         * testsuite/plugin_test.c: New file.
12638         * testsuite/plugin_test_1.sh: New file.
12639         * testsuite/plugin_test_2.sh: New file.
12640
12641 2008-09-16  Ian Lance Taylor  <iant@google.com>
12642
12643         * target-reloc.h (relocate_section): Check whether a symbol is
12644         defined by the ABI before reporting an undefined symbol error.
12645         * target.h (Target::is_defined_by_abi): Make parameter const.
12646         (Target::do_is_defined_by_abi): Likewise.
12647         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12648         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12649         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12650         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12651         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12652         * testsuite/Makefile.in: Rebuild.
12653
12654         * fileread.cc (make_view): Add casts to avoid warning.
12655
12656 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12657
12658         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12659         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12660
12661 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12662
12663         * options.h (General_options::output_is_executable): New.
12664         (General_options::output_is_pie): New.
12665         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12666         for shared libraries.
12667         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12668
12669 2008-09-11  Chris Demetriou  <cgd@google.com>
12670
12671         * options.h (origin): New -z option.
12672         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12673         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12674         in DT_FLAGS_1.
12675
12676 2008-09-05  Cary Coutant  <ccoutant@google.com>
12677
12678         * fileread.cc (File_read::make_view): Add check for attempt to map
12679         beyond end of file.
12680
12681 2008-09-05  Cary Coutant  <ccoutant@google.com>
12682
12683         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12684         explicit instantiations.
12685
12686 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12687
12688         PR gold/6858
12689         * options.cc (General_options::finalize): Allow undefined symbols
12690         in shlibs if linking -shared.
12691
12692         PR gold/6859
12693         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12694         symbols as not needing a dynsym entry.
12695
12696 2008-08-20  Craig Silverstein  <csilvers@google.com>
12697
12698         * fileread.cc (File_read::open): Do not lock the file unless it
12699         was successfully opened.
12700
12701 2008-08-14  Cary Coutant  <ccoutant@google.com>
12702
12703         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12704         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12705         * testsuite/tls_test.cc (struct int128): 128-bit struct
12706         for testing TLS relocs with non-zero addend.
12707         (v12): New TLS variable.
12708         (t12): New test.
12709         (t_last): Add check for v12.
12710         * testsuite/tls_test.h (t12): New function.
12711         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12712
12713 2008-08-13  Ian Lance Taylor  <iant@google.com>
12714
12715         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12716         set tls_segment_ or relro_segment_.
12717         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12718         when appropriate.
12719         * output.h (Output_section::clear_is_relro): New function.
12720         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12721         sections specially even when output_data_ is empty.
12722         (Output_segment::maximum_alignment): When first section is relro,
12723         only force alignment for PT_LOAD segments.
12724         * script.cc (script_data_segment_align): New function.
12725         (script_data_segment_relro_end): New function.
12726         * script-c.h (script_data_segment_align): Declare.
12727         (script_data_segment_relro_end): Declare.
12728         * script-sections.h (class Script_sections): Declare
12729         data_segment_align and data_segment_relro_end.  Add fields
12730         segment_align_index_ and saw_relro_end_.
12731         * script-sections.cc (class Sections_element): Add set_is_relro
12732         virtual function.  Add new bool* parameter to place_orphan_here.
12733         Add get_output_section virtual function.
12734         (class Output_section_definition): Add set_is_relro.  Add new
12735         bool* parameter to place_orphan_here.  Add get_output_section.
12736         Add is_relro_ field.
12737         (Output_section_definition::Output_section_definition): Initialize
12738         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12739         and is_relro_ fields.
12740         (Output_section_definition::place_orphan_here): Add is_relro
12741         parameter.
12742         (Output_section_definition::set_section_addresses): Set relro for
12743         output section.
12744         (Output_section_definition::alternate_constraint): Likewise.
12745         (class Orphan_output_section): Add new bool* parameter to
12746         place_orphan_here.  Add get_output_section.
12747         (Orphan_output_section::place_orphan_here): Add is_relro
12748         parameter.
12749         (Script_sections::Script_sections): Initialize
12750         data_segment_align_index_ and saw_relro_end_.
12751         (Script_sections::data_segment_align): New function.
12752         (Script_sections::data_segment_relro_end): New function.
12753         (Script_sections::place_orphan): Set or clear is_relro.
12754         (Script_sections::set_section_addresses): Force alignment of first
12755         TLS section.
12756         * yyscript.y (exp): Call script_data_segment_align and
12757         script_data_segment_relro_end.
12758         * testsuite/relro_script_test.t: New file.
12759         * testsuite/relro_test.cc (using_script): Declare.
12760         (t1, t2): Test using_script.
12761         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12762         (relro_script_test_SOURCES): Define.
12763         (relro_script_test_DEPENDENCIES): Define.
12764         (relro_script_test_LDFLAGS): Define.
12765         (relro_script_test_LDADD): Define.
12766         (relro_script_test.so): New target.
12767         * testsuite/Makefile.in: Rebuild.
12768
12769 2008-08-06  Cary Coutant <ccoutant@google.com>
12770
12771         * archive.cc (Archive::total_archives, Archive::total_members)
12772         (Archive::total_members_loaded): New variables.
12773         (Archive::setup): Add parameter.  Add option to preread
12774         archive symbols.
12775         (Archive::read_armap): Add counter.
12776         (Archive::get_file_and_offset): New function.
12777         (Archive::get_elf_object_for_member): New function.
12778         (Archive::read_all_symbols): New function.
12779         (Archive::read_symbols): New function.
12780         (Archive::add_symbols): Add counters.
12781         (Archive::include_all_members): Use armap to find members if it's
12782         already built.
12783         (Archive::include_member): Skip reading symbols if already read.
12784         Factored code into Archive::get_file_and_offset and
12785         Archive::get_elf_object_for_member.  Changed call to
12786         Mapfile::report_include_archive_member.
12787         (Archive::print_stats): New function.
12788         * archive.h: Declare Object and Read_symbols_data classes.
12789         (Archive::Archive): Add initializers for new members.
12790         (Archive::setup): Add parameter.
12791         (Archive::print_stats): New function.
12792         (Archive::total_archives, Archive::total_members)
12793         (Archive::total_members_loaded): New variables.
12794         (Archive::get_file_and_offset): New function.
12795         (Archive::get_elf_object_for_member): New function.
12796         (Archive::read_all_symbols): New function.
12797         (Archive::read_symbols): New function.
12798         (Archive::Archive_member): New class.
12799         (Archive::members_): New member.
12800         (Archive::num_members_): New member.
12801         * main.cc: Include archive.h.
12802         (main): Call Archive::print_stats.
12803         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12804         archive parameter; member_name is now the fully-decorated name.
12805         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12806         * options.h: (General_options): Add --preread-archive-symbols option.
12807         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12808         Archive::setup.
12809
12810 2008-08-04  Ian Lance Taylor  <iant@google.com>
12811
12812         * symtab.h (Symbol::use_plt_offset): New function.
12813         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12814         * powerpc.cc (Relocate::relocate): Likewise.
12815         * sparc.cc (Relocate::relocate): Likewise.
12816         * x86_64.cc (Relocate::relocate): Likewise.
12817         * testsuite/weak_plt.sh: New test.
12818         * testsuite/weak_plt_main.cc: New test.
12819         * testsuite/weak_plt_shared.cc: New test.
12820         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12821         (check_PROGRAMS): Add weak_plt.
12822         (check_DATA): Add weak_plt_shared.so.
12823         (weak_plt_main_pic.o, weak_plt): New targets.
12824         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12825         * testsuite/Makefile.in: Rebuild.
12826
12827         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12828         gcctestdir/ld.
12829         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12830         * testsuite/Makefile.in: Rebuild.
12831
12832 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12833
12834         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12835         * Makefile.in: Regenerate.
12836         * po/POTFILES.in: Regenerate.
12837
12838 2008-07-29  Ian Lance Taylor  <iant@google.com>
12839
12840         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12841         symbols before other symbols.
12842         * testsuite/script_test_2.cc (test_addr): Declare.
12843         (test_addr_alias): Declare.
12844         (main): Check that test_addr and test_addr_alias have the right
12845         values.
12846         * testsuite/script_test_2.t: Define test_addr_alias and
12847         test_addr.
12848
12849 2008-07-24  Ian Lance Taylor  <iant@google.com>
12850
12851         PR 5990
12852         * descriptors.cc: New file.
12853         * descriptors.h: New file.
12854         * gold-threads.h (class Hold_optional_lock): New class.
12855         * fileread.cc: Include "descriptors.h".
12856         (File_read::~File_read): Release descriptor rather than closing
12857         it.
12858         (File_read::open) [file]: Call open_descriptor rather than open.
12859         Set is_descriptor_opened_.
12860         (File_read::open) [memory]: Assert that descriptor is not open.
12861         (File_read::reopen_descriptor): New function.
12862         (File_read::release): Release descriptor.
12863         (File_read::do_read): Make non-const.  Reopen descriptor.
12864         (File_read::read): Make non-const.
12865         (File_read::make_view): Reopen descriptor.
12866         (File_read::do_readv): Likewise.
12867         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12868         Update declarations.
12869         * layout.cc: Include "descriptors.h".
12870         (Layout::create_build_id): Use open_descriptor rather than open.
12871         * output.cc: Include "descriptors.h".
12872         (Output_file::open): Use open_descriptor rather than open.
12873         * archive.cc (Archive::const_iterator): Change Archive to be
12874         non-const.
12875         (Archive::begin, Archive::end): Make non-const.
12876         (Archive::count_members): Likewise.
12877         * archive.h (class Archive): Update declarations.
12878         * object.h (Object::read): Make non-const.
12879         * Makefile.am (CCFILES): Add descriptors.cc.
12880         (HFILES): Add descriptors.h.
12881         * Makefile.in: Rebuild.
12882
12883         PR 6716
12884         * gold.h: Always include <clocale>.  Add Solaris workarounds
12885         following code in binutils/sysdep.h.
12886
12887         PR 6048
12888         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12889         this->eh_frame_hdr_ is NULL before using it.
12890
12891         * dynobj.cc (Versions::Versions): Update comment.
12892
12893         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12894         the base version name.
12895
12896         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12897         array size plus one.
12898         (Stringpool_template::set_string_offsets): Subtract one from key
12899         before using it as an array index.
12900         (Stringpool_template::get_offset_with_length): Likewise.
12901         (Stringpool_template::write_to_buffer): Likewise.
12902         * stringpool.h (Stringpool_template::get_offset_from_key):
12903         Likewise.
12904
12905 2008-07-23  Ian Lance Taylor  <iant@google.com>
12906
12907         PR 6658
12908         * object.h (Merged_symbol_value::value): Do our best to handle a
12909         negative addend.
12910
12911         PR 6647
12912         * script.cc (Version_script_info::get_versions): Don't add empty
12913         version tag to return value.
12914         (Version_script_info::get_symbol_version_helper): Change return
12915         type to bool.  Add pversion parameter.  Change all callers.
12916         (script_register_vers_node): Don't require a non-NULL tag.
12917         * script.h (class Version_script_info): Update declarations.
12918         (Version_script_info::get_symbol_version): Change return type to
12919         bool.  Add version parameter.  Change all callers.
12920         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12921         handling.  Handle an empty version from a version script.
12922         (Symbol_table::define_special_symbol): Likewise.
12923         * testsuite/ver_test_10.script: New file.
12924         * testsuite/ver_test_10.sh: New file.
12925         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12926         (check_DATA): Add ver_test_10.syms.
12927         (ver_test_10.syms, ver_test_10.so): New target.
12928         * testsuite/Makefile.in: Rebuild.
12929
12930 2008-07-23  Simon Baldwin  <simonb@google.com>
12931
12932         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12933         to zero for undefined symbols from dynamic libraries.
12934
12935 2008-07-23  Ian Lance Taylor  <iant@google.com>
12936
12937         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12938         Change all callers.
12939         * symtab.h (class Symbol_table): Update declaration.
12940         * testsuite/ver_test_9.cc: New file.
12941         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12942         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12943         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12944         (ver_test_9.so, ver_test_9.o): New targets.
12945         * testsuite/Makefile.in: Rebuild.
12946
12947 2008-07-22  Ian Lance Taylor  <iant@google.com>
12948
12949         * options.h (class General_options): Define --check-sections.
12950         * layout.cc (Layout::set_segment_offsets): Handle
12951         --check-sections.
12952
12953         * options.h (class General_options): Define -n/--nmagic and
12954         -N/--omagic.
12955         * options.cc (General_options::finalize): For -n/--nmagic or
12956         -N/--omagic, set -static.
12957         * layout.cc (Layout::attach_allocated_section_to_segment): If
12958         -N/--omagic, don't put read-only and read-write sections in
12959         different segments.
12960         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12961         finding a read-only segment.
12962         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12963         don't set the minimum segment alignment to the common page size,
12964         and don't set the file offset to the address modulo the page size.
12965         * script-sections.cc (Script_sections::create_segments): If
12966         -n/--omagic, don't put read-only and read-write sections in
12967         different segments.
12968
12969         * cref.cc: New file.
12970         * cref.h: New file.
12971         * options.h (class General_options): Add --print-symbol-counts.
12972         * main.cc (main): Issue defined symbol report if requested.
12973         * archive.cc (Archive::interpret_header): Make into a const member
12974         function.
12975         (Archive::add_symbols): Call Input_objects::archive_start and
12976         archive_stop.
12977         (Archive::const_iterator): Define new class.
12978         (Archive::begin, Archive::end): New functions.
12979         (Archive::include_all_members): Rewrite to use iterator.
12980         (Archive::count_members): New function.
12981         * archive.h (class Archive): Update declarations.
12982         (Archive::filename): New function.
12983         * object.cc: Include "cref.h".
12984         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12985         (Sized_relobj::do_get_global_symbol_counts): New function.
12986         (Input_objects::add_object): Add object to cross-referencer.
12987         (Input_objects::archive_start): New function.
12988         (Input_objects::archive_stop): New function.
12989         (Input_objects::print_symbol_counts): New function.
12990         * object.h: Declare Cref and Archive.
12991         (Object::get_global_symbol_counts): New function.
12992         (Object::do_get_global_symbol_counts): New pure virtual function.
12993         (class Sized_relobj): Add defined_count_ field.  Update
12994         declarations.
12995         (class Input_objects): Add cref_ field.  Update constructor.
12996         Update declarations.
12997         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12998         defined_count_.
12999         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13000         symbol counts.
13001         (Sized_dynobj::do_get_global_symbol_counts): New function.
13002         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13003         defined_count_.  Update declarations.  Define Symbols typedef.
13004         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13005         parameter.  Change all callers.
13006         (Symbol_table::add_from_dynobj): Add sympointers and defined
13007         parameters.  Change all callers.
13008         * symtab.h (class Symbol_table): Update declarations.
13009         * Makefile.am (CCFILES): Add cref.cc.
13010         (HFILES): Add cref.h.
13011         * Makefile.in: Rebuild.
13012
13013 2008-07-22  Simon Baldwin  <simonb@google.com>
13014
13015         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13016         to zero when writing undefined symbols.
13017
13018 2008-07-22  Ian Lance Taylor  <iant@google.com>
13019
13020         * output.cc (Output_section::add_input_section): Don't try to
13021         merge empty merge sections.
13022
13023 2008-07-21  Craig Silverstein  <csilvers@google.com>
13024
13025         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13026         Include symbol version in error message.
13027
13028 2008-07-20  Chris Demetriou  <cgd@google.com>
13029
13030         * configure.ac (gold_cv_c_random_seed): New configured variable.
13031         (RANDOM_SEED_CFLAGS): New substituted variable.
13032         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13033         * configure: Rebuild.
13034         * Makefile.in: Likewise.
13035         * testsuite/Makefile.in: Likewise.
13036
13037 2008-07-18  Ian Lance Taylor  <iant@google.com>
13038
13039         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13040         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13041         * testsuite/ver_test_main.cc (main): Call t4.
13042         (t4, t4_2a): Define.
13043         * testsuite/ver_test_2.cc (t4_2): Define.
13044         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13045         * testsuite/ver_test_4.cc (t4_2a): Define.
13046         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13047         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13048
13049 2008-07-17  Ian Lance Taylor  <iant@google.com>
13050
13051         * dynobj.cc (Versions::add_def): If we give an error about a
13052         missing version, go ahead and create the version anyhow.
13053
13054 2008-07-10  Ian Lance Taylor  <iant@google.com>
13055
13056         Handle output sections with more than 0x7fffffff bytes.
13057         * object.h (class Relobj): Change map_to_output_ to
13058         output_sections_, and just keep a section pointer.  Change all
13059         uses.  Move comdat group support to Sized_relobj.
13060         (Relobj::is_section_specially_mapped): Remove.
13061         (Relobj::output_section): Remove poff parameter.  Change all
13062         callers.
13063         (Relobj::output_section_offset): New function.
13064         (Relobj::set_section_offset): Rewrite.
13065         (Relobj::map_to_output): Remove.
13066         (Relobj::output_sections): New function.
13067         (Relobj::do_output_section_offset): New pure virtual function.
13068         (Relobj::do_set_section_offset): Likewise.
13069         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13070         group support from Relobj.  Update declarations.
13071         (Sized_relobj::get_output_section_offset): New function.
13072         (Sized_relobj::do_output_section_offset): New function.
13073         (Sized_relobj::do_set_section_offset): New function.
13074         * object.cc (Relobj::output_section_address): Remove.
13075         (Sized_relobj::Sized_relobj): Initialize new fields.
13076         (Sized_relobj::include_section_group): Cast find_kept_object to
13077         Sized_relobj.
13078         (Sized_relobj::include_linkonce_section): Likewise.
13079         (Sized_relobj::do_layout): Use separate arrays for output section
13080         and output offset.
13081         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13082         output_sections.
13083         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13084         output_sections and section_offsets.
13085         (Sized_relobj::write_local_symbols): Likewise.
13086         (map_to_kept_section): Compute output address directly.
13087         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13088         output_sections and section_offsets.
13089         (Sized_relobj::write_sections): Likewise.
13090         (Sized_relobj::relocate_sections): Likewise.
13091         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13092         * output.h (class Output_reloc): Update declarations.  Change
13093         u2_.relobj to Sized_relobj*.
13094         (class Output_data_reloc): Change add functions to use
13095         Sized_relobj*.
13096         * output.cc (Output_reloc::Output_reloc): Change relobj to
13097         Sized_relobj*.
13098         (Output_reloc::local_section_offset): Change return type to
13099         Elf_Addr.  Use get_output_section_offset.
13100         (Output_reloc::get_address): Likewise.
13101         (Output_section::is_input_address_mapped): Don't call
13102         is_section_specially_mapped.
13103         (Output_section::output_offset): Likewise.
13104         (Output_section::output_address): Likewise.
13105         (Output_section::starting_output_address): Likewise.
13106         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13107         parameter to Sized_relobj*.
13108         (Copy_relocs::need_copy_reloc): Likewise.
13109         (Copy_relocs::save): Likewise.
13110         * copy-relocs.h (class Copy_relocs): Update declarations.
13111         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13112         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13113         * target-reloc.h (relocate_for_relocatable): Change
13114         offset_in_output_section type to Elf_Addr.  Change code that uses
13115         it as well.
13116         * layout.cc (Layout::layout): Always set *off.
13117         * mapfile.cc (Mapfile::print_input_section): Use
13118         output_section_offset.
13119         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13120         Sized_relobj*.
13121         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13122         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13123         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13124
13125 2008-07-03  Ian Lance Taylor  <iant@google.com>
13126
13127         * layout.cc (Layout::include_section): Do not discard unrecognized
13128         SHT_STRTAB sections.
13129
13130 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13131
13132         * script.cc (Lex::can_continue_name): Make '?' allowable in
13133         version-script names.
13134         * testsuite/version_script.map: Change glob pattern to use '?'
13135
13136 2008-06-30  Manish Singh  <yosh@gimp.org>
13137
13138         PR 6585
13139         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13140         Correct typo.
13141
13142 2008-06-30  Ian Lance Taylor  <iant@google.com>
13143
13144         PR 6660
13145         PR 6682
13146         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13147         versions]: Don't try to read the value in the contents, since we
13148         don't use it.  Use the template endianness when writing.
13149
13150 2008-06-25  Cary Coutant  <ccoutant@google.com>
13151
13152         * fileread.cc (File_read::make_view): Assert on zero-length view.
13153         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13154         symbol table when there are no symbols to read.
13155
13156 2008-06-23  Craig Silverstein  <csilvers@google.com>
13157
13158         * version.cc (version_string): Bump to 1.7
13159
13160 2008-06-18  Craig Silverstein  <csilvers@google.com>
13161
13162         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13163         constant 0xFFFF to type Valtype.
13164         (Powerpc_relocate_functions::rel16_ha): Likewise.
13165
13166 2008-06-17  Ian Lance Taylor  <iant@google.com>
13167
13168         * output.h (Output_section::Input_section): Initialize p2align_ to
13169         zero for Output_section_data constructors.
13170         (Output_section::Input_section::addralign): If not an input
13171         section, return the alignment of the Output_section_data.
13172         * testsuite/copy_test.cc: New file.
13173         * testsuite/copy_test_1.cc: New file.
13174         * testsuite/copy_test_2.cc: New file.
13175         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13176         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13177         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13178         (copy_test_1_pic.o, copy_test_1.so): New targets.
13179         (copy_test_2_pic.o, copy_test_2.so): New targets.
13180         * testsuite/Makefile.in: Rebuild.
13181
13182         * script-sections.cc (Script_sections::place_orphan): Initialize
13183         local variable exact.
13184
13185 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13186
13187         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13188
13189 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13190             David S. Miller  <davem@davemloft.net>
13191
13192         * powerpc.cc: New file.
13193         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13194         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13195         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13196         * Makefile.in: Rebuild.
13197
13198 2008-06-09  Ian Lance Taylor  <iant@google.com>
13199
13200         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13201         <exception>.
13202         (throwing, orig_terminate): New static variables.
13203         (terminate_handler): New static function.
13204         (t2): Set terminate handler.
13205
13206 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13207
13208         PR 6584
13209         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13210         alignment.
13211
13212 2008-05-30  Cary Coutant  <ccoutant@google.com>
13213
13214         * archive.cc (Archive::include_all_members) Correct to step
13215         over symbol table and extended name table in thin archives.
13216
13217 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13218
13219         PR 6407
13220         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13221         calculation.
13222
13223 2008-05-28  Caleb Howe  <cshowe@google.com>
13224
13225         * reduced_debug_output.cc: New file.
13226         * reduced_debug_output.h: New file.
13227         * options.h (class General_options): Add --strip-debug-non-line.
13228         * options.cc (General_options::finalize): Add strip_debug_non_line
13229         to the strip heirarchy.
13230         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13231         fields.
13232         * layout.cc: Include "reduced_debug_output.h".
13233         (Layout::Layout): Initialize new fields.
13234         (line_only_debug_sections): New static array.
13235         (is_lines_only_debug_sections): New static inline function.
13236         (Layout::include_section): Handle --strip-debug-non-line.
13237         (Layout::make_output_section): If --strip-debug-non-line, build
13238         new output sections for .debug_abbrev and .debug_info.
13239         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13240         gold.  Warn about possible overflow.
13241         (read_signed_LEB_128): Likewise.
13242         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13243         (read_signed_LEB_128): Declare.
13244         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13245         (HFILES): Add reduced_debug_output.h.
13246         * Makefile.in: Rebuild.
13247
13248 2008-05-21  Ian Lance Taylor  <iant@google.com>
13249
13250         * mapfile.cc: New file.
13251         * mapfile.h: New file.
13252         * options.h (class General_options): Add -M/--print-map and -Map.
13253         * options.cc (General_options::finalize): Make -M equivalent to
13254         -Map -.
13255         * main.cc: Include <cstdio> and "mapfile.h".
13256         (main): Open mapfile if requested.
13257         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13258         constructor.  Change caller.
13259         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13260         (queue_middle_tasks): Likewise.
13261         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13262         declarations.
13263         * archive.cc: Include "mapfile.h".
13264         (Archive::add_symbols): Add mapfile parameter.  Change all
13265         callers.  Pass mapfile, symbol, and reason to include_member.
13266         (Archive::include_all_members): Add mapfile parameter.  Change all
13267         callers.
13268         (Archive::include_member): Add mapfile, sym, and why parameters.
13269         Change all callers.  Report inclusion to map file.
13270         * archive.h: Include "fileread.h".
13271         (class Archive): Update declarations.
13272         (Archive::file): New const method.
13273         (class Add_archive_symbols): Add mapfile_ field.  Update
13274         constructor.  Change all callers.
13275         * readsyms.h (class Read_symbols): Likewise.
13276         (class Finish_group): Likewise.
13277         (class Read_script): Likewise.
13278         * common.cc: Include "mapfile.h".
13279         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13280         all callers.
13281         (Symbol_table::do_allocate_commons): Likewise.
13282         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13283         symbol allocation to mapfile.
13284         * common.h (class Allocate_commons_task): Add mapfile_ field.
13285         Update constructor.  Change all callers.
13286         * symtab.h (class Symbol_table): Update declarations.
13287         * layout.cc: Include "mapfile.h".
13288         (Layout_task_runner::run): Print information to mapfile.
13289         (Layout::create_gold_note): Change Output_data_fixed_space to
13290         Output_data_zero_fill.
13291         (Layout::create_build_id): Likewise.
13292         (Layout::print_to_mapfile): New function.
13293         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13294         constructor.  Change caller.
13295         (class Layout): Declare print_to_mapfile.
13296         * output.cc (Output_section::Input_section::print_to_mapfile): New
13297         function.
13298         (Output_section::add_input_section): If producing a map, always
13299         add to input_sections_ list.
13300         (Output_section::do_print_to_mapfile): New function.
13301         (Output_segment::print_sections_to_mapfile): New function.
13302         (Output_segment::print_section_list_to_mapfile): New function.
13303         * output.h: Include "mapfile.h".
13304         (Output_data::print_to_mapfile): New function.
13305         (Output_data::do_print_to_mapfile): New virtual function.
13306         (Output_segment_headers::do_print_to_mapfile): New function.
13307         (Output_file_header::do_print_to_mapfile): New function.
13308         (Output_data_const::do_print_to_mapfile): New function.
13309         (class Output_data_const_buffer): Add map_name_ field.  Update
13310         constructor.  Change all callers.  Add do_print_to_mapfile
13311         function.
13312         (class Output_data_fixed_space): Likewise.
13313         (class Output_data_space): Likewise.
13314         (class Output_data_zero_fill): New class.
13315         (Output_data_strtab::do_print_to_mapfile): New function.
13316         (Output_data_reloc_base::do_print_to_mapfile): New function.
13317         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13318         (Output_data_group::do_print_to_mapfile): New function.
13319         (Output_data_got::do_print_to_mapfile): New function.
13320         (Output_data_dynamic::do_print_to_mapfile): New function.
13321         (Output_symtab_xindex::do_print_to_mapfile): New function.
13322         (class Output_section): Declare do_print_to_mapflie.  Declare
13323         print_to_mapfile in Input_section.
13324         (class Output_segment): Declare new functions.
13325         * object.h (Sized_relobj::symbol_count): New function.
13326         * script-sections.cc
13327         (Output_section_element_dot_assignment::set_section_addresses):
13328         Change Output_data_fixed_space to Output_data_zero_fill.
13329         (Output_data_expression::do_print_to_mapfile): New function.
13330         * script.cc (read_input_script): Add mapfile parameter.  Change
13331         all callers.
13332         * script.h (read_input_script): Update declaration.
13333         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13334         (Eh_frame::do_print_to_mapfile): New function.
13335         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13336         (Output_merge_string::do_print_to_mapfile): New function.
13337         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13338         function.
13339         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13340         function.
13341         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13342         function.
13343         * Makefile.am (CCFILES): Add mapfile.cc.
13344         (HFILES): Add mapfile.h.
13345         * Makefile.in: Rebuild.
13346
13347 2008-05-19  Ian Lance Taylor  <iant@google.com>
13348
13349         * options.h (class General_options): Add -z relro.
13350         * layout.cc (Layout::Layout): Initialize relro_segment_.
13351         (Layout::add_output_section_data): Return the output section.
13352         (Layout::make_output_section): Rcognize relro sections and mark
13353         them appropriately.
13354         (Layout::attach_allocated_section_to_segment): Put relro sections
13355         in a PT_GNU_RELRO segment.
13356         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13357         section as relro.
13358         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13359         PT_TLS segments.
13360         (Layout::linkonce_mapping): Map d.rel.ro.local to
13361         .data.rel.ro.local.
13362         (Layout::output_section_name): Us .data.rel.ro.local for any
13363         section which begins with that.
13364         * layout.h (class Layout): Update add_output_section_data
13365         declaration.  Add relro_segment_ field.
13366         * output.cc (Output_section::Output_section): Initialize is_relro_
13367         and is_relro_local_ fields.
13368         (Output_segment::add_output_section): Group relro sections.
13369         (Output_segment::is_first_section_relro): New function.
13370         (Output_segment::maximum_alignment): If there is a relro section,
13371         align the segment to the common page size.
13372         (Output_segment::set_section_addresses): Track whether we are
13373         looking at relro sections.  If the last section is a relro
13374         section, align to the common page size.
13375         (Output_segment::set_section_list_addresses): Add in_relro
13376         parameter.  Change all callers.  Align to the page size when
13377         moving from relro to non-relro section.
13378         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13379         segment.
13380         * output.h (class Output_section): Add is_relro_ and
13381         is_relro_local_ fields.
13382         (Output_section::is_relro): New function.
13383         (Output_section::set_is_relro): New function.
13384         (Output_section::is_relro_local): New function.
13385         (Output_section::set_is_relro_local): New function.
13386         (class Output_segment): Update declarations.
13387         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13388         * sparc.cc (Target_sparc::got_section): Likewise.
13389         * x86_64.cc (Target_x86_64::got_section): Likewise.
13390         * testsuite/relro_test_main.cc: New file.
13391         * testsuite/relro_test.cc: New file.
13392         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13393         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13394         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13395         (relro_test.so, relro_test_pic.o): New targets.
13396         * testsuite/Makefile.in: Rebuild.
13397
13398 2008-05-16  Ian Lance Taylor  <iant@google.com>
13399
13400         * output.cc (Output_segment::add_output_section): Remove front
13401         parameter.
13402         * output.h (class Output_segment): Remove
13403         add_initial_output_section and overloaded add_output_section.
13404         Update declaration of remaining add_output_section.
13405         * layout.cc (Layout::create_interp): Call add_output_section
13406         rather than add_initial_output_section.
13407         (Layout::finish_dynamic_section): Likewise.
13408
13409         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13410         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13411         know the dynamic type.
13412         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13413         field.  Initialize it in constructor.
13414         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13415         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13416         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13417         reloc.
13418
13419         * output.cc (Output_reloc::get_address): Change return type to
13420         Elf_Addr.
13421         * output.h (class Output_reloc): Update get_address declaration.
13422         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13423         for section addresses.
13424
13425 2008-05-09  Ian Lance Taylor  <iant@google.com>
13426
13427         PR 6493
13428         * gold.cc (gold_nomem): Use return value of write.
13429
13430 2008-05-08  Ian Lance Taylor  <iant@google.com>
13431
13432         * symtab.c (Symbol::init_base_output_data): Add version
13433         parameter.  Change all callers.
13434         (Symbol::init_base_output_segment): Likewise.
13435         (Symbol::init_base_constant): Likewise.
13436         (Symbol::init_base_undefined): Likewise.
13437         (Sized_symbol::init_output_data): Likewise.
13438         (Sized_symbol::init_output_segment): Likewise.
13439         (Sized_symbol::init_constant): Likewise.
13440         (Sized_symbol::init_undefined): Likewise.
13441         (Symbol_table::do_define_in_output_data): If the new symbol has a
13442         version, mark it as the default.
13443         (Symbol_table::do_define_in_output_segment): Likewise.
13444         (Symbol_table::do_define_as_constant): Likewise.
13445         * symtab.h (class Symbol): Update declarations.
13446         (class Sized_symbol): Likewise.
13447         * resolve.cc (Symbol::override_version): New function.
13448         (Symbol::override_base): Call override_version.
13449         (Symbol::override_base_with_special): Likewise.
13450         * testsuite/ver_script_8.script: New file.
13451         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13452         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13453         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13454         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13455
13456 2008-05-06  Ian Lance Taylor  <iant@google.com>
13457
13458         PR 6049
13459         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13460         functions.
13461         (class General_options): Remove existing --undefined, and add
13462         --no-undefined instead.  Add new --undefined as synonym for -u.
13463         * archive.cc (Archive::add_symbols): Check whether symbol was
13464         named with -u.
13465         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13466         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13467         all uses.  Add IS_UNDEFINED.  Update declarations to split
13468         different versions of init_base.  Declare init_base_undefined.
13469         (Symbol::is_defined): Handle IS_UNDEFINED.
13470         (Symbol::is_undefined): Likewise.
13471         (Symbol::is_weak_undefined): Call is_undefined.
13472         (Symbol::is_absolute): Handle IS_CONSTANT.
13473         (class Sized_symbol): Update declarations to split different
13474         versions of init.  Declare init_undefined.
13475         (class Symbol_table): Declare new functions.
13476         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13477         Change all callers.
13478         (Symbol::init_base_output_data): Likewise.
13479         (Symbol::init_base_output_segment): Likewise.
13480         (Symbol::init_base_constant): Likewise.
13481         (Symbol::init_base_undefined): New function.
13482         (Sized_symbol::init_object): Rename from init.  Change all
13483         callers.
13484         (Sized_symbol::init_output_data): Likewise.
13485         (Sized_symbol::init_output_segment): Likewise.
13486         (Sized_symbol::init_constant): Likewise.
13487         (Sized_symbol::init_undefined): New function.
13488         (Symbol_table::add_undefined_symbols_from_command_line): New
13489         function.
13490         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13491         function.
13492         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13493         (Symbol::output_section): Likewise.
13494         (Symbol::set_output_section): Likewise.
13495         (Symbol_table::sized_finalize_symbol): Likewise.
13496         (Symbol_table::sized_write_globals): Likewise.
13497         * resolve.cc (Symbol_table::should_override): Likewise.
13498         (Symbol::override_base_with_special): Likewise.
13499
13500         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13501         symbol, change it to have default visibility.
13502         * testsuite/protected_1.cc: New file.
13503         * testsuite/protected_2.cc: New file.
13504         * testsuite/protected_3.cc: New file.
13505         * testsuite/protected_main_1.cc: New file.
13506         * testsuite/protected_main_2.cc: New file.
13507         * testsuite/protected_main_3.cc: New file.
13508         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13509         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13510         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13511         (protected_1.so): New target.
13512         (protected_1_pic.o, protected_2_pic.o): New targets.
13513         (protected_3_pic.o): New target.
13514         (check_PROGRAMS): Add protected_2.
13515         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13516         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13517         * testsuite/Makefile.in: Rebuild.
13518
13519         * options.h (DEFINE_var): Add set_user_set_##varname__.
13520         (DEFINE_bool_alias): New macro.
13521         (class General_options): Define -Bstatic using DEFINE_bool_alias
13522         rather than DEFINE_special.  Add --undefined as an alias for -z
13523         defs.
13524         * options.cc (General_options::parse_Bstatic): Remove.
13525
13526         * options.h (class General_options): Add --fatal-warnings.
13527         * main.cc (main): Implement --fatal-warnings.
13528         * errors.h (Errors::warning_count): New function.
13529
13530         * options.h (class General_options): Add -Bsymbolic-functions.
13531         * symtab.h (Symbol::is_preemptible): Check for
13532         -Bsymbolic-functions.
13533
13534 2008-05-05  Ian Lance Taylor  <iant@google.com>
13535
13536         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13537         as noVARNAME rather than no-VARNAME.
13538         (class General_options): Add option -z combreloc.
13539         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13540         get_address.
13541         (Output_reloc::sort_before) [SHT_REL]: New function.
13542         (Output_reloc::sort_before) [SHT_RELA]: New function.
13543         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13544         Sort_relocs_comparison.
13545         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13546         parameter.  Change all callers.
13547         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13548         sort_relocs parameter.  Change all callers.
13549         * output.cc (Output_reloc::get_address): New function, broken out
13550         of write_rel.
13551         (Output_reloc::write_rel): Call it.
13552         (Output_reloc::compare): New function.
13553         (Output_data_reloc_base::do_write): Optionally sort relocs.
13554
13555         * configure.ac: If targ_extra_obj is set, link it in.
13556         * configure.tgt: Initialize all variables.
13557         (x86_64*): Set targ_extra_obj and targ_extra_size.
13558         * configure: Rebuild.
13559
13560         * object.cc (Sized_relobj::include_section_group): Adjust section
13561         indexes read from group data.  Build vector to pass to
13562         layout_group.
13563         * layout.cc (Layout::layout_group): Add flags and shndxes
13564         parameters.  Remove contents parameter.  Change caller.  Update
13565         explicit instantiations.
13566         * layout.h (class Layout): Update layout_group declaration.
13567         * output.cc (Output_data_group::Output_data_group): Add flags and
13568         input_shndxes parameters.  Remove contents parameter.  Change
13569         caller.
13570         (Output_data_group::do_write): Change input_sections_ to
13571         input_shndxes_.
13572         * output.h (class Output_data_group): Update constructor
13573         declaration.  Rename input_sections_ to input_shndxes_.
13574         * testsuite/many_sections_test.cc: Add template.
13575
13576 2008-04-30  Cary Coutant  <ccoutant@google.com>
13577
13578         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13579
13580         * layout.cc (Layout::include_section): Refactored check for debug
13581         info section.
13582         (Layout::add_comdat): Add new parameters.  Change type
13583         of signature parameter.  Add object and shndx to signatures table.
13584         (Layout::find_kept_object): New function.
13585         * layout.h: Include <cstring>.
13586         (Layout::is_debug_info_section): New function.
13587         (Layout::add_comdat): Add new parameters.
13588         (Layout::find_kept_object): New function.
13589         (Layout::Kept_section): New struct.
13590         (Layout::Signatures): Change type of map range.
13591         * object.cc (Relobj::output_section_address): New function.
13592         (Sized_relobj::include_section_group): Add new parameters.  Change
13593         calls to Layout::add_comdat.  Change to build table of kept comdat
13594         groups and table mapping discarded sections to kept sections.
13595         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13596         (Sized_relobj::do_layout): Change calls to include_section_group and
13597         include_linkonce_section.
13598         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13599         value to zero when section is discarded.
13600         (Sized_relobj::map_to_kept_section): New function.
13601         * object.h (Relobj::output_section_address): New function.
13602         (Relobj::Comdat_group): New type.
13603         (Relobj::find_comdat_group): New function.
13604         (Relobj::Comdat_group_table): New type.
13605         (Relobj::Kept_comdat_section): New type.
13606         (Relobj::Kept_comdat_section_table): New type.
13607         (Relobj::add_comdat_group): New function.
13608         (Relobj::set_kept_comdat_section): New function.
13609         (Relobj::get_kept_comdat_section): New function.
13610         (Relobj::comdat_groups_): New field.
13611         (Relobj::kept_comdat_sections_): New field.
13612         (Symbol_value::input_value): Update comment.
13613         (Sized_relobj::map_to_kept_section) New function.
13614         (Sized_relobj::include_linkonce_section): Add new parameter.
13615         * target-reloc.h (Comdat_behavior): New type.
13616         (get_comdat_behavior): New function.
13617         (relocate_section): Add code to map a discarded section to the
13618         corresponding kept section when applying a relocation.
13619
13620 2008-04-30  Craig Silverstein  <csilvers@google.com>
13621
13622         * dwarf_reader.cc (next_generation_count): New static var.
13623         (Addr2line_cache_entry): New struct.
13624         (addr2line_cache): New static var.
13625         (Dwarf_line_info::one_addr2line): Added caching.
13626         (Dwarf_line_info::clear_addr2line_cache): New function.
13627         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13628         cache-size parameter.
13629         (Dwarf_line_info::one_addr2line_cache): New function.
13630         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13631         new cache-size argument to one_addr2line(), and clear cache.
13632
13633 2008-04-28  Cary Coutant  <ccoutant@google.com>
13634
13635         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13636         R_386_PC8 relocations.
13637
13638 2008-04-23  Ian Lance Taylor  <iant@google.com>
13639
13640         * object.cc (Sized_relobj::include_section_group): Check for
13641         invalid section group.
13642
13643         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13644         header size.
13645
13646         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13647         than read for file header.
13648         * archive.cc (Archive::include_member): Likewise.
13649
13650 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13651
13652         * aclocal.m4: Regenerate.
13653         * configure: Regenerate.
13654
13655 2008-04-19  Ian Lance Taylor  <iant@google.com>
13656
13657         * version.cc (version_string): Bump to 1.6.
13658
13659         * testsuite/Makefile.am (many_sections_r_test): New target.
13660         (many_sections_r_test_SOURCES): Remove.
13661         (many_sections_r_test_DEPENDENCIES): Remove.
13662         (many_sections_r_test_LDFLAGS): Remove.
13663         (many_sections_r_test_LDADD): Remove.
13664
13665         * object.cc (Sized_relobj::do_add_symbols): Always pass
13666         local_symbol_count_ to add_from_relobj.
13667
13668         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13669         every thousand variables.
13670         * testsuite/Makefile.in: Rebuild.
13671
13672         * object.cc (Xindex::initialize_symtab_xindex): New function.
13673         (Xindex::read_symtab_xindex): New function.
13674         (Xindex::sym_xindex_to_shndx): New function.
13675         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13676         available.
13677         (Sized_relobj::do_initialize_xindex): New function.
13678         (Sized_relobj::do_read_symbols): Adjust section links.
13679         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13680         parameter.  Change all callers.
13681         (Sized_relobj::include_section_group): Adjust section links and
13682         symbol section indexes.
13683         (Sized_relobj::do_layout): Adjust section links.
13684         (Sized_relobj::do_count_local_symbols): Adjust section links and
13685         symbol section indexes.
13686         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13687         ordinary and special symbols.
13688         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13689         dynsym_xindex parameters.  Change all callers.  Adjust section
13690         links.  Use SHN_XINDEX when needed.
13691         (Sized_relobj::get_symbol_location_info): Adjust section links.
13692         Don't get fooled by special symbols.
13693         * object.h (class Xindex): Define.
13694         (class Object): Add xindex_ parameter.  Declare virtual functoin
13695         do_initialize_xindex.
13696         (Object::adjust_sym_shndx): New function.
13697         (Object::set_xindex): New protected function.
13698         (class Symbol_value): Add is_ordinary_shndx_ field.
13699         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13700         (Symbol_value::value): Assert ordinary section.
13701         (Symbol_value::initialize_input_to_output_map): Likewise.
13702         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13703         Change all callers.
13704         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13705         all callers.
13706         (class Sized_relobj): Update declarations.
13707         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13708         parameter.  Change all callers.
13709         (Sized_relobj::adjust_shndx): New function.
13710         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13711         field.
13712         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13713         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13714         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13715         (Sized_dynobj::read_dynsym_section): Adjust section links.
13716         (Sized_dynobj::read_dynamic): Likewise.
13717         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13718         section links.
13719         (Sized_dynobj::do_initialize_xindex): New function.
13720         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13721         do_initialize_xindex.
13722         (Sized_dynobj::adjust_shndx): New function.
13723         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13724         dynsym_xindex_ fields.
13725         (Layout::finalize): Add a call to set_section_indexes before
13726         creating the symtab sections.
13727         (Layout::set_section_indexes): Don't do anything if the section
13728         already has a section index.
13729         (Layout::create_symtab_sections): Add shnum parameter.  Change
13730         caller.  Create .symtab_shndx section if needed.
13731         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13732         caller.
13733         (Layout::allocated_output_section_count): New function.
13734         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13735         needed.
13736         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13737         fields.  Update declarations.
13738         (Layout::symtab_xindex): New function.
13739         (Layout::dynsym_xindex): New function.
13740         (class Write_symbols_task): Add layout_ field.
13741         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13742         Change caller.
13743         * output.cc (Output_section_headers::Output_section_headers): Add
13744         shstrtab_section parameter.  Change all callers.
13745         (Output_section_headers::do_sized_write): Store overflow values
13746         for section count and section string table section index in
13747         section header zero.
13748         (Output_file_header::do_sized_write): Check for overflow of
13749         section count and section string table section index.
13750         (Output_symtab_xindex::do_write): New function.
13751         (Output_symtab_xindex::endian_do_write): New function.
13752         * output.h (class Output_section_headers): Add shstrtab_section_.
13753         Update declarations.
13754         (class Output_symtab_xindex): Define.
13755         (Output_section::has_out_shndx): New function.
13756         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13757         field.
13758         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13759         Change all callers.
13760         (Sized_symbol::init): Likewise.
13761         (Symbol::output_section): Check for ordinary symbol.
13762         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13763         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13764         callers.
13765         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13766         Change all callers.  Simplify handling of symbols from sections
13767         not included in the link.
13768         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13769         distinction.
13770         (Weak_alias_sorter::operator()): Assert that symbols are
13771         ordinary.
13772         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13773         distinction.
13774         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13775         parameters.  Change all callers.
13776         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13777         symbol distinction.  Use SHN_XINDEX when needed.
13778         (Symbol_table::write_section_symbol): Add symtab_xindex
13779         parameter.  Change all callers.
13780         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13781         SHN_XINDEX when needed.
13782         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13783         declarations.
13784         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13785         (Symbol::is_defined): Check is_ordinary.
13786         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13787         (Symbol::is_absolute, Symbol::is_common): Likewise.
13788         (class Sized_symbol): Update declarations.
13789         (class Symbol_table): Update declarations.
13790         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13791         parameters.  Change all callers.
13792         (Sized_symbol::override): Likewise.
13793         (Symbol_table::override): Likewise.
13794         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13795         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13796         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13797         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13798         to be in an ordinary section.
13799         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13800         object and is_ordinary parameters.  Change all callers.
13801         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13802         Change all callers.  Don't add undefined or non-ordinary symbols
13803         to reloc_map_.
13804         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13805         Change all callers.
13806         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13807         declarations.
13808         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13809         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13810         (Sized_relobj::relocate_sections): Likewise.
13811         * target-reloc.h (scan_relocs): Adjust section symbol index.
13812         (scan_relocatable_relocs): Likewise.
13813         * i386.cc (Scan::local): Check for ordinary symbols.
13814         * sparc.cc (Scan::local): Likewise.
13815         * x86_64.cc (Scan::local): Likewise.
13816         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13817         to symbol_section_and_value.
13818         * testsuite/many_sections_test.cc: New file.
13819         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13820         (check_PROGRAMS): Add many_sections_test.
13821         (many_sections_test_SOURCES): Define.
13822         (many_sections_test_DEPENDENCIES): Define.
13823         (many_sections_test_LDFLAGS): Define.
13824         (BUILT_SOURCES): Add many_sections_define.h.
13825         (many_sections_define.h): New target.
13826         (BUILT_SOURCES): Add many_sections_check.h.
13827         (many_sections_check.h): New target.
13828         (check_PROGRAMS): Add many_sections_r_test.
13829         (many_sections_r_test_SOURCES): Define.
13830         (many_sections_r_test_DEPENDENCIES): Define.
13831         (many_sections_r_test_LDFLAGS): Define.
13832         (many_sections_r_test_LDADD): Define.
13833         (many_sections_r_test.o): New target.
13834         * testsuite/Makefile.in: Rebuild.
13835
13836 2008-04-17  Cary Coutant  <ccoutant@google.com>
13837
13838         * errors.cc (Errors::info): New function.
13839         (gold_info): New function.
13840         * errors.h (Errors::info): New function.
13841         * gold.h (gold_info): New function.
13842         * object.cc (Input_objects::add_object): Print trace output.
13843         * options.cc (options::parse_set): New function.
13844         (General_options::parse_wrap): Deleted.
13845         (General_options::General_options): Deleted initializer.
13846         * options.h (options::String_set): New typedef.
13847         (options::parse_set): New function.
13848         (DEFINE_set): New macro.
13849         (General_options::wrap): Changed to use DEFINE_set. Changed
13850         callers of any_wrap_symbols and is_wrap_symbol.
13851         (General_options::trace, General_options::trace_symbol):
13852         New options.
13853         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13854         (General_options::wrap_symbols_): Deleted.
13855         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13856
13857 2008-04-17  David S. Miller  <davem@davemloft.net>
13858
13859         * options.cc (General_options::parse_V): New function.
13860         * options.h: Add entries for -V and -Qy.
13861
13862 2008-04-17  Ian Lance Taylor  <iant@google.com>
13863
13864         * common.cc (Symbol_table::allocate_commons): Remove options
13865         parameter.  Change caller.
13866         (Symbol_table::do_allocate_commons): Remove options parameter.
13867         Change caller.  Just call do_allocate_commons_list twice.
13868         (Symbol_table::do_allocate_commons_list): New function, broken out
13869         of do_allocate_commons.
13870         * common.h (class Allocate_commons_task): Remove options_ field.
13871         Update constructor.
13872         * symtab.cc (Symbol_table::Symbol_table): Initialize
13873         tls_commons_.
13874         (Symbol_table::add_from_object): Put TLS common symbols on
13875         tls_commons_ list.
13876         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13877         which are IN_OUTPUT_DATA.
13878         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13879         allocate_commons and do_allocate_commons declarations.  Declare
13880         do_allocate_commons_list.
13881         * gold.cc (queue_middle_tasks): Update creation of
13882         Allocate_commons_task to not pass options.
13883         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13884         (TLS_TEST_C_FLAGS): New variable.
13885         (tls_test_c_pic.o): New target.
13886         (tls_test_shared.so): Link in tls_test_c_pic.o.
13887         (tls_test_c_pic_ie.o): New target.
13888         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13889         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13890         (tls_test_c.o): New target.
13891         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13892         (tls_pic_test_LDADD): Likewise.
13893         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13894         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13895         (tls_test_c_gnu2.o): New target.
13896         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13897         tls_test_c_gnu2.o.
13898         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13899         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13900         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13901         * testsuite/tls_test.cc: Include "config.h".
13902         (t_last): Call t11_last.
13903         * testsuite/tls_test.h (t11, t11_last): Declare.
13904         * testsuite/tls_test_c.c: New file.
13905         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13906         * configure.ac: Check for OpenMP support.
13907         * configure, config.in, Makefile.in: Rebuild.
13908         * testsuite/Makefile.in: Rebuild.
13909
13910 2008-04-16  Cary Coutant  <ccoutant@google.com>
13911
13912         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13913         (Target_i386::tls_base_symbol_defined_): New field.
13914         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13915         (Target_i386::Scan::global): Likewise.
13916         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13917         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13918         (Target_x86_64::tls_base_symbol_defined_): New field.
13919         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13920         (Target_x86_64::Scan::global): Likewise.
13921
13922 2008-04-16  Cary Coutant  <ccoutant@google.com>
13923
13924         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13925         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13926         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13927         building shared libraries.
13928         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13929         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13930         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13931         * testsuite/Makefile.in: Rebuild.
13932         * testsuite/weak_undef.h: New file.
13933         * testsuite/weak_undef_file1.cc: Add extra test cases.
13934         * testsuite/weak_undef_file2.cc: Likewise.
13935         * testsuite/weak_undef_test.cc: Likewise.
13936
13937 2008-04-16  David S. Miller  <davem@davemloft.net>
13938
13939         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13940         Add issued_non_pic_error_ field.  Declare check_non_pic.
13941         (Target_sparc::Scan::check_non_pic): New function.
13942         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13943         (Target_sparc::Scan::global): Likewise.
13944
13945         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13946         * configure: Rebuild.
13947
13948         * options.h (DEFINE_enable): New macro.
13949         (new_dtags): New enable option.
13950         (initfirst, interpose, loadfltr, nodefaultlib,
13951         nodelete, nodlopen, nodump): New -z options.
13952         * layout.cc (Layout:finish_dynamic_section): If new
13953         dtags enabled, emit DT_RUNPATH.  Also, emit a
13954         DT_FLAGS_1 containing any specified -z flags.
13955
13956 2008-04-16  Ian Lance Taylor  <iant@google.com>
13957
13958         * copy-relocs.cc: New file.
13959         * copy-relocs.h: New file.
13960         * reloc.cc: Remove Copy_relocs code.
13961         * reloc.h: Likewise.
13962         * reloc-types.h (struct Reloc_types) [both versions]: Add
13963         get_reloc_addend_noerror.
13964         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13965         variants of add_global which take an addend which must be zero.
13966         * i386.cc: Include "copy-relocs.h".
13967         (class Target_i386): Change type of copy_relocs_ to variable,
13968         update initializer.
13969         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13970         Change all callers.
13971         (Target_i386::do_finalize_sections): Change handling of
13972         copy_relocs_.
13973         * sparc.cc: Include "copy-relocs.h".
13974         (class Target_sparc): Change type of copy_relocs_ to variable,
13975         update initializer.
13976         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13977         Change all callers.
13978         (Target_sparc::do_finalize_sections): Change handling of
13979         copy_relocs_.
13980         * x86_64.cc: Include "copy-relocs.h".
13981         (class Target_x86_64): Change type of copy_relocs_ to variable,
13982         update initializer.
13983         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13984         class.  Change all callers.
13985         (Target_x86_64::do_finalize_sections): Change handling of
13986         copy_relocs_.
13987         * Makefile.am (CCFILES): Add copy-relocs.cc.
13988         (HFILES): Add copy-relocs.h.
13989
13990         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13991
13992         * testsuite/script_test_4.sh: Permit leading zeroes.
13993
13994 2008-04-15  Ian Lance Taylor  <iant@google.com>
13995
13996         * script-sections.cc (Script_sections::create_segments): Use
13997         header_size_adjustment even when there is enough room for the
13998         headers.
13999         * testsuite/script_test_4.sh: New file.
14000         * testsuite/script_test_4.t: New file.
14001         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14002         (check_DATA): Add script_test_4.stdout.
14003         (MOSTLYCLEANFILES): Likewise.
14004         (script_test_4): New target.
14005         (script_test_4.stdout): New target.
14006         * testsuite/Makefile.in: Rebuild.
14007
14008         * sparc.cc: Add definitions for Output_data_plt_sparc class
14009         constants.
14010
14011 2008-04-14  David S. Miller  <davem@davemloft.net>
14012
14013         * sparc.cc: New file.
14014         * Makefile.am (TARGETSOURCES): Add sparc.cc
14015         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14016         * configure.tgt: Document targ_extra_size and
14017         targ_extra_big_endian.  Add entries for sparc-* and
14018         sparc64-*.
14019         * configure.ac: Handle targ_extra_size and
14020         targ_extra_big_endian.
14021         * Makefile.in: Rebuild.
14022         * configure: Likewise.
14023         * po/POTFILES.in: Likewise.
14024         * po/gold.pot: Likewise.
14025
14026 2008-04-14  Ian Lance Taylor  <iant@google.com>
14027
14028         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14029         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14030         in the name/type/flags to section mapping.  Don't call
14031         allocate_output_section.
14032         (Layout::choose_output_section): Change parameter from adjust_name
14033         to is_input_section.  Don't permit input sections after sections
14034         are attached to segments.  Don't call allocate_output_section.
14035         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14036         not write_enable_output_section.
14037         (Layout::make_output_section): Don't push to
14038         unattached_section_list_ nor call attach_to_segment.  Call
14039         attach_section_to_segment if sections are attached.
14040         (Layout::attach_sections_to_segments): New function.
14041         (Layout::attach_section_to_segment): New function.
14042         (Layout::attach_allocated_section_to_segment): Rename from
14043         attach_to_segment.  Remove flags parameter.
14044         (Layout::allocate_output_section): Remove function.
14045         (Layout::write_enable_output_section): Remove function.
14046         * layout.h (class Layout): Update for above changes.  Add new
14047         field sections_are_attached_.
14048         * output.h (Output_section::update_flags_for_input_section): New
14049         function.
14050         * output.cc (Output_section::add_input_section): Call
14051         update_flags_for_input_section.
14052         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14053
14054 2008-04-11  Cary Coutant  <ccoutant@google.com>
14055
14056         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14057         thought unnecessary.
14058         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14059
14060 2008-04-11  Ian Lance Taylor  <iant@google.com>
14061
14062         * output.h (class Output_section_data): Remove inline definition
14063         of set_addralign.
14064         * output.cc (Output_section_data::set_addralign): New function.
14065
14066 2008-04-11  Cary Coutant  <ccoutant@google.com>
14067
14068         Add support for TLS descriptors for i386 and x86_64.
14069         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14070         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14071         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14072         GOT_TYPE_TLS_DESC.
14073         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14074         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14075         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14076         relocations.
14077         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14078         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14079         Fix problem with initial-exec relocations.
14080         (Target_i386::Relocate::relocate_tls): Likewise.
14081         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14082         relaxation.
14083         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14084         support for section-plus-offset dynamic table entries.
14085         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14086         (Output_data_dynamic::Dynamic_entry): Add support for
14087         section-plus-offset dynamic table entries.
14088         (Output_data_dynamic::Classification): Likewise.
14089         (Output_data_dynamic::classification_): Renamed offset_.
14090         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14091         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14092         (Target_x86_64::make_plt_section): New function.
14093         (Target_x86_64::reserve_tlsdesc_entries): New function.
14094         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14095         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14096         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14097         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14098         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14099         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14100         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14101         add extra PLT entry for TLS descriptors.
14102         (Output_data_plt_x86_64::got_): New field.
14103         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14104         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14105         fields.
14106         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14107         descriptors.
14108         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14109         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14110         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14111         R_386_TLS_DESC_CALL relocations.
14112         (Target_x86_64::Scan::global): Likewise.
14113         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14114         for TLS descriptors.
14115         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14116         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14117         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14118         GD-to-IE relaxation.
14119         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14120         and TLS_DESCRIPTORS.
14121         * Makefile.in: Rebuild.
14122         * configure: Rebuild.
14123         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14124         (tls_test_shared2.so): New target.
14125         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14126         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14127         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14128         (tls_shared_gd_to_ie_test_LDADD): New variable.
14129         (tls_shared_gnu2_gd_to_ie_test): New target.
14130         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14131         New targets.
14132         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14133         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14134         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14135         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14136         (tls_shared_gnu2_test): New target.
14137         (tls_test_gnu2_shared.so): New target.
14138         (tls_shared_gnu2_test_SOURCES): New variable.
14139         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14140         (tls_shared_gnu2_test_LDFLAGS): New variable.
14141         (tls_shared_gnu2_test_LDADD): New variable.
14142         * testsuite/Makefile.in: Rebuild.
14143         * testsuite/Makefile.
14144
14145 2008-04-11  Ian Lance Taylor  <iant@google.com>
14146
14147         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14148         justsyms.t.
14149         * testsuite/Makefile.in: Rebuild.
14150
14151         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14152         long.
14153         * testsuite/script_test_2.cc (main): Adjust test.
14154
14155 2008-04-11  David S. Miller  <davem@davemloft.net>
14156             Ian Lance Taylor  <iant@google.com>
14157
14158         * options.h (General_options): Add entries for '-Y' and
14159         '-relax'.
14160         * options.cc (General_options:finalize): If -Y was used, add those
14161         entries to the library path instead of the default "/lib" and
14162         "/usr/lib".
14163
14164 2008-04-11  David S. Miller  <davem@davemloft.net>
14165
14166         * testsuite/justsyms.t: Start at 0x100.
14167         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14168         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14169         long.
14170         * testsuite/script_test_2.cc: Adjust string and section length
14171         checks.
14172
14173 2008-04-09  Ian Lance Taylor  <iant@google.com>
14174
14175         PR gold/5996
14176         * script-sections.cc (Sections_element::allocate_to_segment): Add
14177         orphan parameter.
14178         (Output_section_definition::allocate_to_segment): Likewise.
14179         (Orphan_output_section::allocate_to_segment): Likewise.
14180         (Script_sections::attach_sections_using_phdrs_clause): Don't
14181         propagate non-PT_LOAD segments to orphan sections.
14182         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14183         readelf rather than objdump.
14184         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14185         .interp section and PT_INTERP segment are the same size.
14186         * testsuite/Makefile.in: Rebuild.
14187
14188         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14189         aliases for symbols defined in the same object.
14190         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14191         (weak_alias_test_SOURCES): New variable.
14192         (weak_alias_test_DEPENDENCIES): New variable.
14193         (weak_alias_test_LDFLAGS): New variable.
14194         (weak_alias_test_LDADD): New variable.
14195         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14196         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14197         (weak_alias_test_3.o): New target.
14198         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14199         * testsuite/weak_alias_test_main.cc: New file.
14200         * testsuite/weak_alias_test_1.cc: New file.
14201         * testsuite/weak_alias_test_2.cc: New file.
14202         * testsuite/weak_alias_test_3.cc: New file.
14203
14204 2008-04-08  Ian Lance Taylor  <iant@google.com>
14205
14206         * options.h (class General_options): Add --noinhibit-exec option.
14207         * main.cc (main): Check --noinhibit-exec.
14208
14209         * options.h (class General_options): Define --wrap as a special
14210         option.  Add wrap_symbols_ field.
14211         (General_options::any_wrap_symbols): New function.
14212         (General_options::is_wrap_symbol): New function.
14213         * options.cc (General_options::parse_wrap): New function.
14214         (General_options::General_options): Initialize wrap_symbols_.
14215         * symtab.cc (Symbol_table::wrap_symbol): New function.
14216         (Symbol_table::add_from_object): Handle --wrap.
14217         * symtab.h (class Symbol_table): Declare wrap_symbol.
14218         * target.h (Target::wrap_char): New function.
14219         (Target::Target_info): Add wrap_char field.
14220         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14221         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14222         * testsuite/testfile.cc (Target_test::test_target_info):
14223         Likewise.
14224
14225         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14226         there is one.
14227
14228         * layout.h (class Layout): Add added_eh_frame_data_ field.
14229         * layout.cc (Layout::Layout): Initialize new field.
14230         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14231         output section until we find a section we merged successfully.
14232         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14233         that the size be non-zero.
14234
14235         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14236         qualifier.
14237
14238 2008-04-08  Craig Silverstein  <csilvers@google.com>
14239
14240         * configure.ac: Export new conditional variable HAVE_ZLIB.
14241         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14242         on HAVE_ZLIB.
14243         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14244         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14245
14246 2008-04-07  Ian Lance Taylor  <iant@google.com>
14247
14248         * version.cc (version_string): Set to "1.5".
14249
14250         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14251         Add issued_non_pic_error_ field.  Declare check_non_pic.
14252         (Target_x86_64::Scan::check_non_pic): New function.
14253         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14254         (Target_x86_64::Scan::global): Likewise.
14255
14256         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14257         addend parameter.  Change caller.  Handle merge sections.
14258         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14259         Address to Addend.  Don't add in the result of
14260         local_section_offset, pass down the addend and use the returned
14261         value.
14262         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14263         Update declarations of local_section_offset and symbol_value.
14264         * testsuite/two_file_test_1.cc (t18): New function.
14265         * testsuite/two_file_test_2.cc (f18): New function.
14266         * testsuite/two_file_test_main.cc (main): Call t18.
14267         * testsuite/two_file_test.h (t18, f18): Declare.
14268
14269         * configure.ac: Don't test for objdump, c++filt, or readelf.
14270         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14271         conditionals.
14272         (TEST_READELF): New variable.
14273         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14274         (check_PROGRAMS): Add two_file_strip_test.
14275         (two_file_strip_test): New target.
14276         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14277         (two_file_same_shared_strip_test_SOURCES): New variable.
14278         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14279         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14280         (two_file_same_shared_strip_test_LDADD): New variable.
14281         (two_file_shared_strip.so): New target.
14282         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14283         (ver_test_5.syms, ver_test_7.syms): Likewise.
14284         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14285         (strip_test_3.stdout): Use TEST_OBJDUMP.
14286         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14287
14288 2008-04-04  Cary Coutant  <ccoutant@google.com>
14289
14290         * symtab.h (Symbol::is_weak_undefined): New function.
14291         (Symbol::is_strong_undefined): New function.
14292         (Symbol::is_absolute): New function.
14293         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14294         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14295         absolute symbols.
14296         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14297         (weak_undef_test): New target.
14298         * testsuite/Makefile.in: Rebuild.
14299         * testsuite/weak_undef_file1.cc: New file.
14300         * testsuite/weak_undef_file2.cc: New file.
14301         * testsuite/weak_undef_test.cc: New file.
14302
14303 2008-04-03  Craig Silverstein  <csilvers@google.com>
14304
14305         * compressed_output.h (class Output_compressed_section): Use
14306         unsigned buffer.
14307         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14308         add zlib header.
14309         (zlib_compressed_suffix): Removed.
14310         (Output_compressed_section::set_final_data_size): Use unsigned
14311         buffers.
14312         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14313         Fix linker invocation.
14314         (flagstest_o_specialfile_and_compress_debug_sections):
14315         Likewise.
14316         * testsuite/Makefile.in: Regenerated.
14317
14318 2008-04-02  David S. Miller  <davem@davemloft.net>
14319
14320         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14321         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14322
14323 2008-04-02  Craig Silverstein  <csilvers@google.com>
14324
14325         * TODO: New file.
14326
14327 2008-04-02  Ian Lance Taylor  <iant@google.com>
14328
14329         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14330         parameters.  Update for new key type to views_.  Change all
14331         callers.
14332         (File_read::read): Adjust for byteshift in returned view.
14333         (File_read::add_view): New function, broken out of
14334         find_and_make_view.
14335         (File_read::make_view): New function, broken out of
14336         find_and_make_view.
14337         (File_read::find_or_make_view): Add offset and aligned
14338         parameters.  Rewrite accordingly.  Change all callers.
14339         (File_read::get_view): Add offset and aligned parameters.  Adjust
14340         for byteshift in return value.
14341         (File_read::get_lasting_view): Likewise.
14342         * fileread.h (class File_read): Update declarations.
14343         (class File_read::View): Add byteshift_ field.  Add byteshift to
14344         constructor.  Add byteshift method.
14345         * archive.h (Archive::clear_uncached_views): New function.
14346         (Archive::get_view): Add aligned parameter.  Change all callers.
14347         * object.h (Object::get_view): Add aligned parameter.  Change all
14348         callers.
14349         (Object::get_lasting_view): Likewise.
14350
14351         * fileread.cc (File_read::release): Don't call clear_views if
14352         there are multiple objects.
14353         * fileread.h (File_read::clear_uncached_views): New function.
14354         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14355         on the archive.
14356
14357 2008-03-31  Cary Coutant  <ccoutant@google.com>
14358
14359         Add thin archive support.
14360         * archive.cc (Archive::armagt): New const.
14361         (Archive::setup): Remove task parameter and calls to unlock.
14362         (Archive::unlock_nested_archives): New function.
14363         (Archive::read_header): Add nested_off parameter. Change
14364         all callers.
14365         (Archive::interpret_header): Likewise.
14366         (Archive::include_all_members): Change to handle thin
14367         archives.
14368         (Archive::include_member): Likewise.
14369         * archive.h (Archive::Archive): Add new parameters and
14370         initializers.
14371         (Archive::armagt): New const.
14372         (Archive::setup): Remove task parameter.
14373         (Archive::unlock_nested_archives): New function.
14374         (Archive::read_header): Add nested_off parameter.
14375         (Archive::interpret_header): Likewise.
14376         (Archive::Nested_archive_table): New typedef.
14377         (Archive::is_thin_archive_): New field.
14378         (Archive::nested_archives_): New field.
14379         (Archive::options_): New field.
14380         (Archive::dirpath_): New field.
14381         (Archive::task_): New field.
14382         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14383         for thin archives.  Pass additional parameters to
14384         Archive::Archive.  Unlock the archive file after calling
14385         Archive::setup.
14386
14387 2008-03-29  Ian Lance Taylor  <iant@google.com>
14388
14389         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14390         version symbol to be local.
14391         * testsuite/ver_test_4.sh: New file.
14392         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14393         (check_DATA): Add ver_test_4.syms.
14394         (ver_test_4.syms): New target.
14395         * testsuite/Makefile.in: Rebuild.
14396
14397         * output.cc
14398         (Output_section::Input_section_sort_entry::has_priority): New
14399         function.
14400         (Output_section::Input_section_sort_entry::match_file_name): New
14401         function.
14402         (Output_section::Input_section_sort_entry::match_section_name):
14403         Remove.
14404         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14405         Remove.
14406         (Output_section::Input_section_sort_entry::match_section_file):
14407         Remove.
14408         (Output_section::Input_section_sort_compare::operator()): Rewrite
14409         using new Input_section_sort_entry functions.  Sort crtbegin and
14410         crtend first.  Sort sections with no priority before sections with
14411         a priority.
14412         * testsuite/initpri1.c (d3): Check j != 4.
14413         (cd5): New constructor/destructor function.
14414         (main): Check j != 2.
14415
14416         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14417         new symbol when resolving, don't call set_is_default.
14418         * testsuite/ver_test_7.cc: New file.
14419         * testsuite/ver_test_7.sh: New file.
14420         * testsuite/Makefile.am (ver_test_7.so): New target.
14421         (ver_test_7.o): New target.
14422         (check_SCRIPTS): Add ver_test_7.sh.
14423         (check_DATA): Add ver_test_7.syms.
14424         (ver_test_7.syms): New target.
14425
14426 2008-03-28  Ian Lance Taylor  <iant@google.com>
14427
14428         * layout.cc (Layout::layout): If we see an input section with a
14429         name that needs sorting, set the must_sort flag for the output
14430         section.
14431         (Layout::make_output_section): If the name of the output section
14432         indicates that it might require sorting, set the may_sort flag.
14433         * output.h (Output_section::may_sort_attached_input_sections): New
14434         function.
14435         (Output_section::set_may_sort_attached_input_sections): New
14436         function.
14437         (Output_section::must_sort_attached_input_sections): New
14438         function.
14439         (Output_section::set_must_sort_attached_input_sections): New
14440         function.
14441         (class Output_section): Declare Input_section_sort_entry.  Define
14442         Input_section_sort_compare.  Declare
14443         sort_attached_input_sections.  Add new fields:
14444         may_sort_attached_input_sections_,
14445         must_sort_attached_input_sections_,
14446         attached_input_sections_are_sorted_.
14447         * output.cc (Output_section::Output_section): Initialize new
14448         fields.
14449         (Output_section::add_input_section): Add an entry to
14450         input_sections_ if may_sort or must_sort are true.
14451         (Output_section::set_final_data_size): Call
14452         sort_attached_input_sections if necessary.
14453         (Output_section::Input_section_sort_entry): Define new class.
14454         (Output_section::Input_section_sort_compare::operator()): New
14455         function.
14456         (Output_section::sort_attached_input_sections): New function.
14457         * configure.ac: Check whether the compiler supports constructor
14458         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14459         * testsuite/initpri1.c: New file.
14460         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14461         CONSTRUCTOR_PRIORITY.
14462         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14463         (initpri1_LDFLAGS): New variable.
14464         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14465
14466 2008-03-27  Ian Lance Taylor  <iant@google.com>
14467
14468         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14469         * testsuite/common_test_1.c: New file.
14470         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14471         (common_test_1_SOURCES): New variable.
14472         (common_test_1_DEPENDENCIES): New variable.
14473         (common_test_1_LDFLAGS): New variable.
14474
14475         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14476         and commons_ correctly when NAME/VERSION does not override
14477         NAME/NULL.
14478         * testsuite/ver_test_6.c: New file.
14479         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14480         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14481         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14482
14483 2008-03-26  Ian Lance Taylor  <iant@google.com>
14484
14485         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14486         of an undefined symbol from a version script.
14487         * testsuite/Makefile.am (ver_test_5.so): New target.
14488         (ver_test_5.o): New target.
14489         (check_SCRIPTS): Add ver_test_5.sh.
14490         (check_DATA): Add ver_test_5.syms.
14491         (ver_test_5.syms): New target.
14492         * testsuite/ver_test_5.cc: New file.
14493         * testsuite/ver_test_5.script: New file.
14494         * testsuite/ver_test_5.sh: New file.
14495         * Makefile.in, testsuite/Makefile.in: Rebuild.
14496
14497         PR gold/5986
14498         Fix problems building gold with gcc 4.3.0.
14499         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14500         (gold_error_at_location, gold_warning_at_location): Use it.
14501         * configure.ac: Check whether we can compile and use a template
14502         function with a printf attribute.
14503         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14504         when jumping over bytes.
14505         * object.cc: Instantiate Object::read_section_data.
14506         * debug.h: Include <cstring>
14507         * dwarf_reader.cc: Include <algorithm>
14508         * main.cc: Include <cstring>.
14509         * options.cc: Include <cstring>.
14510         * output.cc: Include <cstring>.
14511         * script.cc: Include <cstring>.
14512         * script.h: Include <string>.
14513         * symtab.cc: Include <cstring> and <algorithm>.
14514         * target-select.cc: Include <cstring>.
14515         * version.cc: Include <string>.
14516         * testsuite/testmain.cc: Include <cstdlib>.
14517         * configure, config.in: Rebuild.
14518
14519 2008-03-25  Ian Lance Taylor  <iant@google.com>
14520
14521         * options.cc: Include "../bfd/bfdver.h".
14522         (options::help): Print bug reporting address.
14523
14524         * version.cc (print_version): Adjust output for current value of
14525         BFD_VERSION_STRING.
14526
14527         * NEWS: New file.
14528
14529         * options.cc (options::help): Print list of supported targets.
14530         * target-select.h: Include <vector>.
14531         (class Target_selector): Make machine_, size_, and is_big_endian_
14532         fields const.  Add bfd_name_ and instantiated_target_ fields.
14533         (Target_selector::Target_selector): Add bfd_name parameter.
14534         (Target_selector::recognize): Make non-virtual, call
14535         do_recognize.
14536         (Target_selector::recognize_by_name): Make non-virtual, call
14537         do_recognize_by_name.
14538         (Target_selector::supported_names): New function.
14539         (Target_selector::bfd_name): New function.
14540         (Target_selector::do_instantiate_target): New pure virtual
14541         function.
14542         (Target_selector::do_recognize): New virtual function.
14543         (Target_selector::do_recognize_by_name): New virtual function.
14544         (Target_selector::instantiate_target): New private function.
14545         (supported_target_names): Declare.
14546         * target-select.cc (Target_selector::Target_selector): Update for
14547         new parameter and fields.
14548         (select_target_by_name): Check that the name matches before
14549         calling recognize_by_name.
14550         (supported_target_names): New function.
14551         * i386.cc (class Target_selector_i386): Update Target_selector
14552         constructor call.  Remove recognize and recognize_by_name.  Add
14553         do_instantiate_target.
14554         * x86_64.cc (class Target_selector_x86_64): Likewise.
14555         * testsuite/testfile.cc (class Target_selector_test): Update for
14556         changes to Target_selector.
14557
14558         * README: Rewrite, with some notes on unsupported features.
14559
14560 2008-03-24  Cary Coutant  <ccoutant@google.com>
14561
14562         * i386.cc (Target_i386::Got_type): New enum declaration.
14563         (Target_i386::Scan::local): Updated callers of Output_data_got
14564         member functions.
14565         (Target_i386::Scan::global): Likewise.
14566         (Target_i386::Relocate::relocate): Likewise.
14567         (Target_i386::Relocate::relocate_tls): Likewise.
14568         * object.h (Got_offset_list): New class.
14569         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14570         (Sized_relobj::local_got_offset): Likewise.
14571         (Sized_relobj::set_local_got_offset): Likewise.
14572         (Sized_relobj::local_has_tls_got_offset): Removed.
14573         (Sized_relobj::local_tls_got_offset): Removed.
14574         (Sized_relobj::set_local_tls_got_offset): Removed.
14575         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14576         * output.cc (Output_data_got::add_global): Added got_type parameter.
14577         (Output_data_got::add_global_with_rel): Likewise.
14578         (Output_data_got::add_global_with_rela): Likewise.
14579         (Output_data_got::add_global_pair_with_rel): New function.
14580         (Output_data_got::add_global_pair_with_rela): New function.
14581         (Output_data_got::add_local): Added got_type parameter.
14582         (Output_data_got::add_local_with_rel): Likewise.
14583         (Output_data_got::add_local_with_rela): Likewise.
14584         (Output_data_got::add_local_pair_with_rel): New function.
14585         (Output_data_got::add_local_pair_with_rela): New function.
14586         (Output_data_got::add_global_tls): Removed.
14587         (Output_data_got::add_global_tls_with_rel): Removed.
14588         (Output_data_got::add_global_tls_with_rela): Removed.
14589         (Output_data_got::add_local_tls): Removed.
14590         (Output_data_got::add_local_tls_with_rel): Removed.
14591         (Output_data_got::add_local_tls_with_rela): Removed.
14592         * output.h (Output_data_got::add_global): Added got_type parameter.
14593         (Output_data_got::add_global_with_rel): Likewise.
14594         (Output_data_got::add_global_with_rela): Likewise.
14595         (Output_data_got::add_global_pair_with_rel): New function.
14596         (Output_data_got::add_global_pair_with_rela): New function.
14597         (Output_data_got::add_local): Added got_type parameter.
14598         (Output_data_got::add_local_with_rel): Likewise.
14599         (Output_data_got::add_local_with_rela): Likewise.
14600         (Output_data_got::add_local_pair_with_rel): New function.
14601         (Output_data_got::add_local_pair_with_rela): New function.
14602         (Output_data_got::add_global_tls): Removed.
14603         (Output_data_got::add_global_tls_with_rel): Removed.
14604         (Output_data_got::add_global_tls_with_rela): Removed.
14605         (Output_data_got::add_local_tls): Removed.
14606         (Output_data_got::add_local_tls_with_rel): Removed.
14607         (Output_data_got::add_local_tls_with_rela): Removed.
14608         * resolve.cc (Symbol::override_base_with_special): Removed
14609         reference to has_got_offset_ field.
14610         * symtab.cc (Symbol::init_fields): Replaced initialization
14611         of got_offset_ with got_offsets_.  Removed initialization
14612         of has_got_offset_
14613         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14614         (Symbol::got_offset): Likewise.
14615         (Symbol::set_got_offset): Likewise.
14616         (Symbol::has_tls_got_offset): Removed.
14617         (Symbol::tls_got_offset): Removed.
14618         (Symbol::set_tls_got_offset): Removed.
14619         (Symbol::got_offset_): Removed.
14620         (Symbol::tls_mod_got_offset_): Removed.
14621         (Symbol::tls_pair_got_offset_): Removed.
14622         (Symbol::got_offsets_): New field.
14623         (Symbol::has_got_offset): Removed.
14624         (Symbol::has_tls_mod_got_offset): Removed.
14625         (Symbol::has_tls_pair_got_offset): Removed.
14626         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14627         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14628         member functions.
14629         (Target_x86_64::Scan::global): Likewise.
14630         (Target_x86_64::Relocate::relocate): Likewise.
14631         (Target_x86_64::Relocate::relocate_tls): Likewise.
14632
14633 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14634
14635         * yyscript.y: Fix spelling error in comment.
14636
14637 2008-03-24  Ian Lance Taylor  <iant@google.com>
14638
14639         * options.h (class General_options): Define build_id option.
14640         * layout.h (class Layout): Declare write_build_id, create_note,
14641         create_build_id.  Add build_id_note_ member.
14642         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14643         "libiberty.h", "md5.h", "sha1.h".
14644         (Layout::Layout): Initialize eh_frame_data_,
14645         eh_frame_hdr_section_, and build_id_note_.
14646         (Layout::finalize): Call create_build_id.
14647         (Layout::create_note): New function, broken out of
14648         Layout::create_gold_note.
14649         (Layout::create_gold_note): Call create_note.
14650         (Layout::create_build_id): New function.
14651         (Layout::write_build_id): New function.
14652         (Close_task_runner::run): Call write_build_id.
14653
14654         * x86_64.cc: Correct license to GPLv3.
14655
14656 2008-03-23  Ian Lance Taylor  <iant@google.com>
14657
14658         * options.cc: Include "demangle.h".
14659         (parse_optional_string): New function.
14660         (parse_long_option): Handle takes_optional_argument.
14661         (parse_short_option): Update dash_z initializer.  Handle
14662         takes_optional_argument.
14663         (General_options::General_options): Initialize do_demangle_.
14664         (General_options::finalize): Set do_demangle_.  Handle demangling
14665         style.
14666         * options.h (parse_optional_string): Declare.
14667         (struct One_option): Add optional_arg field.  Update constructor.
14668         Update call constructor calls.  Add takes_optional_argument
14669         function.
14670         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14671         (DEFINE_optional_string): Define.
14672         (General_options::demangle): Change from DEFINE_bool to
14673         DEFINE_optional_string.
14674         (General_options::no_demangle): New function.
14675         (General_options::do_demangle): New function.
14676         (General_options::set_do_demangle): New function.
14677         (General_options::execstack_status_): Move definition to end of
14678         class definition.
14679         (General_options::static_): Likewise.
14680         (General_options::do_demangle_): New field.
14681         * object.cc (big_endian>::get_symbol_location_info): Call
14682         Options::do_demangle, not Options::demangle.
14683         * symtab.cc (demangle): Likewise.
14684
14685 2008-03-22  Ian Lance Taylor  <iant@google.com>
14686
14687         * gold.h: Include <cstddef> and <sys/types.h>
14688         * options.h: Include <cstring>.
14689
14690 2008-03-21  Ian Lance Taylor  <iant@google.com>
14691
14692         * Added source code to GNU binutils.
14693 \f
14694 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14695
14696 Copying and distribution of this file, with or without modification,
14697 are permitted in any medium without royalty provided the copyright
14698 notice and this notice are preserved.
14699
14700 Local Variables:
14701 mode: change-log
14702 left-margin: 8
14703 fill-column: 74
14704 version-control: never
14705 End: