gold/
[external/binutils.git] / gold / ChangeLog
1 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2
3         * options.h (General_options): Add --rosegment-gap option.
4         * options.cc (finalize): --rosegment-gap implies --rosegment.
5         * layout.cc (set_segment_offsets): Let user option override
6         target->rosegment_gap().
7
8 2013-05-10  Roland McGrath  <mcgrathr@google.com>
9
10         * options.h (General_options): Remove leading space from help
11         messages for -nostdlib and --rosegment.
12
13 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
14
15         PR ld/15365
16         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
17
18 2013-05-03  Alan Modra  <amodra@gmail.com>
19
20         * merge.cc (Output_merge_string::do_add_input_section): Correct
21         scan for number of strings.  Rename vars to avoid shadowing.
22         Include missing terminator in input_size_.
23
24 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
25
26         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
27         Restore empty string handling.
28
29 2013-05-01  Cary Coutant  <ccoutant@google.com>
30
31         * stringpool.cc (Stringpool_template::new_key_offset): Fix
32         uninitialized warning.
33
34 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
35
36         * output.cc (Output_section::add_merge_input_section): Allow
37         to merge sections if the alignment is more than character size.
38         * merge.h (Output_merge_string::Output_merge_string): Remove
39         assert.
40         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
41         only not-null strings. Check the alignment of strings.
42         * stringpool.h
43         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
44         alignment as the argument.
45         (Stringpool_template<Stringpool_char>::addralign_): New class member.
46         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
47         Align non-zero length strings according to the addralign_.
48         (Stringpool_template<Stringpool_char>::set_string_offsets):
49         Updating offsets according to the given alignment.
50         * testsuite/Makefile.am (text_section_grouping): Test if string
51         literals are getting merged.
52         * testsuite/Makefile.in: Regenerate.
53         * testsuite/merge_string_literals_1.c: New file.
54         * testsuite/merge_string_literals_2.c: Ditto.
55         * testsuite/merge_string_literals.sh: Ditto.
56
57 2013-04-26  Ian Lance Taylor  <iant@google.com>
58
59         * target-reloc.h (relocate_section): If the reloc offset is out of
60         range, pass VIEW as NULL to relocate.relocate.
61         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
62         * i386.cc (Target_i386::Relocate::relocate): Likewise.
63         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
64         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
65         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
66         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
67
68 2013-04-26  Geoff Pike  <gpike@chromium.org>
69
70         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
71         * layout.cc (Hash_task): New class.
72         (Layout::queue_build_id_tasks): New function.
73         (Layout::write_build_id): Handle single-thread portion of build ID
74         computation.  (In some cases, all of it is single-threaded.)  Replace
75         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
76         functionality in fewer lines of code.
77         * layout.h (Layout::queue_build_id_tasks): New function declaration.
78         * options.h (General_options): make "--build-id" default to tree
79         rather than sha1.  Add two new options related to --build-id=tree:
80         --build-id-chunk-size-for-treehash and
81         --build-id-min-file-size-for-treehash.
82         * Makefile.am: add testing of --build-id=tree and related new options
83         (these tests will be invoked by "make check").
84         * Makefile.in: Regenerate.
85
86 2013-04-25  Alan Modra  <amodra@gmail.com>
87
88         * configure.tgt: Add powerpcle and powerpc64le.
89
90 2013-04-22  Alan Modra  <amodra@gmail.com>
91
92         PR gold/15355
93         * layout.cc (Layout::segment_precedes): Allow more than one
94         segment with the same type and flags.
95
96 2013-04-15  Cary Coutant  <ccoutant@google.com>
97
98         * layout.cc (Layout::set_relocatable_section_offsets): Don't
99         allocate space in file for BSS sections.
100
101 2013-04-15  Cary Coutant  <ccoutant@google.com>
102
103         * script-sections.cc (Orphan_output_section): Reset address
104         to zero after each orphaned section for relocatable links.
105
106 2013-04-15  Cary Coutant  <ccoutant@google.com>
107
108         * symtab.cc (Symbol_table::sized_write_globals): Subtract
109         section starting address for relocatable link.
110         * testsuite/Makefile.am (script_test_11): New test.
111         * testsuite/Makefile.in: Regenerate.
112         * testsuite/script_test_11.c: New source file.
113         * testsuite/script_test_11.t: New linker script.
114
115 2013-04-13  Alan Modra  <amodra@gmail.com>
116
117         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
118         owner when sections are not adjacent and exceed group size.
119         (Target_powerpc::group_sections): Handle corner case.
120         (Target_powerpc::Branch_info::make_stub): Handle case where
121         stub table doesn't exist due to branches in non-exec sections.
122         (Target_powerpc::Relocate::relocate): Likewise.
123
124 2013-04-11  Alan Modra  <amodra@gmail.com>
125
126         PR gold/15354
127         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
128         .branch_lt to match bfd ld.  Adjust comments throughout file.
129
130 2013-04-04  Ian Lance Taylor  <iant@google.com>
131
132         GCC PR c++/56840
133         * object.cc (do_layout_deferred_sections): Handle .eh_frame
134         sections before checking whether they are included in the link.
135
136 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
137
138         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
139         object before calling the plugin claim_file handler.  Pass the elf
140         object of the archive to the plugin. Delete the elf object if the
141         plugin claims the file.
142
143 2013-03-21  Alan Modra  <amodra@gmail.com>
144
145         * layout.cc (Layout::set_segment_offsets): Accept writable .text
146         segment when omagic.
147
148 2013-03-21  Alan Modra  <amodra@gmail.com>
149
150         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
151         comparison warning.
152         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
153         uninitialized" warning.
154
155 2013-03-20  Alan Modra  <amodra@gmail.com>
156
157         * symtab.h (Symbol::clear_version): New function.
158         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
159         is_needed by weak references.  Clear version for symbols defined
160         in as-needed objects that are not needed.
161
162 2013-03-15  Alan Modra  <amodra@gmail.com>
163
164         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
165         static and public.  Add report_err param.  Return false for data refs.
166         (Target_powerpc::rela_dyn_section): New overloaded function.
167         (Target_powerpc::plt_, iplt_): Elucidate.
168         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
169         (Output_data_plt_powerpc::do_write): Don't write .iplt.
170         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
171         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
172         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
173         push_branch and make_plt_entry for ifunc syms when
174         reloc_needs_plt_for_ifunc.
175         (Target_powerpc::Relocate::relocate): Don't use plt entry value
176         for ifunc unless reloc_needs_plt_for_ifunc.
177
178 2013-03-15  Alan Modra  <amodra@gmail.com>
179
180         * gc.h (gc_process_relocs): Don't look through function descriptors.
181         * icf.cc (get_section_contents): Do so here instead.
182
183 2013-03-13  Alan Modra  <amodra@gmail.com>
184
185         * powerpc.cc (is_branch_reloc): Forward declare.
186         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
187         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
188         false for 64-bit, true for 32-bit non-branch relocs.
189         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
190         * testsuite/Makefile.am (icf_test): Use linker map file instead of
191         nm output.
192         (icf_safe_test): Generate linker map file as well as nm output.
193         (icf_safe_so_test): Likewise.
194         * testsuite/Makefile.in: Regenerate.
195         * testsuite/icf_test.sh: Parse linker map file to determine
196         section folding.
197         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
198         * testsuite/icf_safe_so_test.sh: Likewise.
199         (X86_32_or_ARM_specific_safe_fold): Merge into..
200         (arch_specific_safe_fold): ..this.
201         (X86_64_specific_safe_fold): Delete unused function.
202
203 2013-03-12  Alan Modra  <amodra@gmail.com>
204
205         * gc.h (gc_process_relocs): Look through function descriptors
206         to determine shndx, symvalue and addend used by ICF.  Tidy
207         variable duplication.
208
209 2013-03-11  Alan Modra  <amodra@gmail.com>
210
211         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
212         * layout.cc (Layout_task_runner::run): ..to here.
213         * symtab.h (struct Symbol_location): Extract from..
214         (class Symbol_table): ..here.
215         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
216         * target.h (class Target): Add function_location and
217         do_function_location functions.
218         (class Sized_target): Add do_function_location.
219         * object.h (class Sized_relobj_file): Move find_shdr..
220         (class Object): ..to here.
221         * object.cc: Likewise.  Update to suit.  Instantiate.
222         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
223         * powerpc.cc (class Powerpc_dynobj): New.
224         (Target_powerpc::do_function_location): New function.
225         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
226         (Powerpc_dynobj::do_read_symbols): New function.
227         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
228
229 2013-03-08  Ian Lance Taylor  <iant@google.com>
230
231         * options.cc (General_options::string_to_object_format): Accept
232         "default".
233
234 2013-03-08  Alan Modra  <amodra@gmail.com>
235
236         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
237         pointer to Post_fde.
238         (struct Post_fde): Move definition to here..
239         * ehframe.cc (struct Post_fde): ..from here.
240         (Cie::write): Don't alloc Post_fde.
241         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
242
243 2013-03-07  Alan Modra  <amodra@gmail.com>
244
245         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
246         relocation referencing .LC0.
247         * testsuite/discard_locals_test.sh: Remove FIXMEs.
248
249 2013-03-07  Alan Modra  <amodra@gmail.com>
250
251         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
252         always_inline.  Add assembly for powerpc to avoid GOT.
253
254 2013-03-07  Alan Modra  <amodra@gmail.com>
255
256         * testsuite/script_test_10.sh: Don't test .bss section
257         header number.
258
259 2013-03-06  Alan Modra  <amodra@gmail.com>
260
261         * powerpc.cc (class Powerpc_relobj): Move some member functions.
262         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
263         all callers.  Handle folded sections.
264         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
265         to Powerpc_relobj.
266         (Global_symbol_visitor_opd::operator()): Likewise.
267
268 2013-03-04  Alan Modra  <amodra@gmail.com>
269
270         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
271         * testsuite/Makefile.in: Regenerate.
272
273 2013-03-01  Cary Coutant  <ccoutant@google.com>
274
275         Add dwp support for v2 DWARF package file format.
276         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
277         tu_length parameter.  Adjust all callers.
278         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
279         * dwp.cc: Include dwarf.h.
280         (Section_bounds): New struct type.
281         (Unit_set): New struct type.
282         (Dwo_file::Dwo_file): Initialize new data member.
283         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
284         Combine and rename to...
285         (Dwo_file::read_unit_index): ...this.
286         (Dwo_file::sized_read_compunit_index)
287         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
288         (Dwo_file::sized_read_unit_index): ...this.
289         (Dwo_file::copy_section): Remove section_name, is_str_offsets
290         parameters; add section_id parameter.
291         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
292         (Dwo_file::add_unit_set): ...this.
293         (Dwo_file::shndx_map_): Remove.
294         (Dwo_file::sect_offsets_): New data member.
295         (Dwp_output_file::Dwp_output_file): Initialize new data members.
296         (Dwp_output_file::add_section): Rename to...
297         (Dwp_output_file::add_contribution): ...this.
298         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
299         (Dwp_output_file::add_tu_set): Likewise.
300         (Dwp_output_file::Contribution): New type.
301         (Dwp_output_file::Section::contributions): New data member.
302         (Dwp_output_file::Cu_or_tu_set): Remove.
303         (Dwp_output_file::Section::Section): New ctor.
304         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
305         (Dwp_output_file::Dwp_index::Section_table): New type.
306         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
307         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
308         parameter.
309         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
310         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
311         (Dwp_output_file::Dwp_index::section_table): New member function.
312         (Dwp_output_file::Dwp_index::section_table_end): New member function.
313         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
314         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
315         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
316         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
317         (Dwp_output_file::Dwp_index::section_table_): New data member.
318         (Dwp_output_file::Dwp_index::section_mask_): New data member.
319         (Dwp_output_file::add_output_section): New member function.
320         (Dwp_output_file::write_new_section): New member function.
321         (Dwp_output_file::write_contributions): New member function.
322         (Dwp_output_file::section_id_map_): New data member.
323         (class Dwo_id_info_reader): Remove.
324         (class Unit_reader): New class.
325         (get_dwarf_section_name): New function.
326         (Dwo_file::read_executable): Adjust initializations of class data.
327         (Dwo_file::read): Add support for v2 package file format.
328         (Dwo_file::read_unit_index): Likewise.
329         (Dwo_file::sized_read_unit_index): Likewise.
330         (Dwo_file::copy_section): Likewise.
331         (Dwo_file::add_unit_set): Likewise.
332         (Dwp_output_file::add_output_section): Likewise.
333         (Dwp_output_file::add_contribution): Likewise.
334         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
335         for empty slot.
336         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
337         file format.
338         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
339         slot.
340         (Dwp_output_file::initialize): Remove unused function.
341         (Dwp_output_file::finalize): Add support for v2 package file format.
342         (Dwp_output_file::write_index): Likewise.
343         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
344         function prototype.
345
346 2013-03-01  Cary Coutant  <ccoutant@google.com>
347
348         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
349         function into class definition in header file.
350         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
351         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
352         New function.
353         (Dwarf_info_reader::check_buffer): Move here from .cc file.
354
355 2013-02-28  Alan Modra  <amodra@gmail.com>
356
357         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
358         * target.cc (Target::do_plt_fde_location): New function.
359         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
360         accessor function, and constructor param.
361         (struct Post_fde, Post_fdes): Declare.
362         (Cie::write): Add post_fdes param.
363         * ehframe.cc (Fde::write): Use plt_fde_location.
364         (struct Post_fde): Define.
365         (Cie::write): Stash FDEs added post merge mapping.
366         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
367         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
368         (Eh_frame::do_sized_write): Arrange to write post map FDES after
369         other FDEs.
370         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
371         (Target_powerpc::has_glink): New function.
372         (Target_powerpc::do_relax): Add eh_frame info for stubs.
373         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
374         glink_eh_frame_fde_32, default_fde): New data.
375         (Stub_table::eh_frame_added_): New var.
376         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
377         Make const.
378         (Stub_table::add_eh_frame): New function.
379         (Output_data_glink::add_eh_frame): New function.
380         (Target_powerpc::make_glink_section): Call add_eh_frame.
381
382 2013-02-15  Ian Lance Taylor  <iant@google.com>
383
384         * options.h (DEFINE_uint64_alias): Define.
385         (class General_options): Add -Ttext-segment as an alias for
386         -Ttext.
387
388 2013-02-15  Alan Modra  <amodra@gmail.com>
389
390         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
391         (Stub_table::do_write): ..here, two places.
392         (Stub_table::plt_call_size): Use it here too.
393
394 2013-02-11  Ian Lance Taylor  <iant@google.com>
395
396         * descriptors.cc (Descriptors::close_all): New function.
397         * descriptors.h (class Descriptors): Declare close_all.
398         (close_all_descriptors): New inline function.
399         * plugin.cc: Include "descriptors.h".
400         (Plugin_manager::cleanup): Call close_all_descriptors.
401
402 2013-02-06  Alan Modra  <amodra@gmail.com>
403
404         * README: Update coding style link.
405
406 2013-01-28  Cary Coutant  <ccoutant@google.com>
407
408         * dwp.cc (File_list): New typedef.
409         (Dwo_name_info_reader): New class.
410         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
411         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
412         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
413         (Dwo_file::read_executable): New function.
414         (Dwo_file::read): Move common setup code to ...
415         (Dwo_file::make_object): ... here.
416         (dwp_options): Add --exec/-e.
417         (usage): Likewise.
418         (main): Likewise.
419
420 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
421
422         * layout.cc (Layout::layout): Check for option text_reorder.
423         (Layout::make_output_section): Ditto.
424         * options.h (text_reorder): New option.
425         * output.cc (Input_section_sort_compare): Remove special ordering
426         of section names.
427         (Output_section::
428          Input_section_sort_section_name_special_ordering_compare::
429          operator()): New function.
430         (Output_section::sort_attached_input_sections): Use new sort function
431         for .text.
432         * output.h (Input_section_sort_section_name_special_ordering_compare):
433         New struct.
434         * testsuite/Makefile.am (text_section_grouping): Test option
435         --no-text-reorder
436         * testsuite/Makefile.in: Regenerate.
437         * testsuite/text_section_grouping.sh: Check order of functions without
438         default text reordering.
439
440 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
441
442         * options.h (General_options): Change default to true for new_dtags.
443
444 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
445
446         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
447         when enable_new_dtags is false.  Only add DT_RUNPATH when
448         enable_new_dtags is true.
449
450 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
451
452         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
453         used in declaration and definition consistent.
454         (Target_powerpc::symval_for_branch): Ditto.
455
456 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
457
458         * testsuite/plugin_final_layout.cc: Fix comment.
459
460 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
461
462         * layout.cc (Layout::layout): Do not do default sorting for
463         text sections when section ordering is specified.
464         (make_output_section): Ditto.
465         * testsuite/plugin_final_layout.cc: Name the function sections
466         to catch reordering issues.
467
468 2013-01-15  Alan Modra  <amodra@gmail.com>
469
470         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
471         plt-thread-safe.
472
473 2013-01-15  Alan Modra  <amodra@gmail.com>
474
475         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
476         * testsuite/Makefile.in: Regenerate.
477
478 2013-01-14  Alan Modra  <amodra@gmail.com>
479
480         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
481         * testsuite/Makefile.in: Regenerate.
482
483 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
484
485         PR bfd/14430
486         Fix mingw gold build with plugins enabled
487         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
488         * configure.ac: Export DLOPEN_LIBS and add headers check.
489         * plugin.cc: Handle non-dlfcn case.
490         * Makefile.in: Regenerate.
491         * config.in: Regenerate.
492         * configure: Regenerate.
493         * testsuite/Makefile.in: Regenerate.
494
495 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
496
497         * output.h (sort_attached_input_sections): Change to be public.
498         * script-sections.cc
499         (Output_section_definition::set_section_addresses): Sort
500         attached input sections according to section order before linker
501         script assigns section addresses.
502         (Orphan_output_section::set_section_addresses): Sort
503         attached input sections according to section order before linker
504         script assigns section addresses.
505         * Makefile.am (final_layout.sh): Use a simple linker script to
506         check if section ordering still works.
507         * Makefile.in: Regenerate.
508
509 2013-01-09  Ben Cheng  <bccheng@google.com>
510
511         * arm.cc (Target_arm::attributes_accept_div): New function.
512         (Target_arm::attributes_forbid_div): New function.
513         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
514         attribute using the same new functions as what bfd/elf32_arm.c
515         does.
516
517 2013-01-07  Cary Coutant  <ccoutant@google.com>
518
519         PR gold/14993
520         * output.cc (Output_section::add_input_section): For incremental
521         updates, don't track input sections that are allocated from patch
522         space.
523
524 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
525             Ian Lance Taylor  <iant@google.com>
526
527         PR gold/14897
528         * configure.ac (--enable-ld): Removed.
529         (install_as_default): Set to yes only for --enable-gold=default
530         or --disable-ld.
531         * configure: Regenerated.
532
533 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
534
535         * options.h (General_options): Add -fuse-ld= for GCC linker
536         option compatibility.
537
538 2013-01-04  Cary Coutant  <ccoutant@google.com>
539
540         * configure.ac: Fix typo restoring CXXFLAGS.
541         * configure: Regenerate.
542
543 2013-01-04  Cary Coutant  <ccoutant@google.com>
544
545         * testsuite/Makefile.am (CXXLINK_S): New macro.
546         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
547         * testsuite/Makefile.in: Regenerate.
548
549 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
550
551         * version.cc (print_version): Update copyright year to 2013.
552
553 2012-12-20  Ian Lance Taylor  <iant@google.com>
554
555         * layout.cc (Layout::special_ordering_of_input_section): New
556         function.
557         (Layout::layout): If input section requires special ordering, must
558         sort input sections.
559         (Layout::make_output_section): May sort .text input sections.
560         (Layout::is_section_name_prefix_grouped): Remove.
561         * layout.h (class Layout): Declare
562         special_ordering_of_input_section.  Don't declare
563         is_section_name_prefix_grouped.
564         * output.cc (Output_section::add_input_section): Revert last
565         change.
566         (Output_section::Input_section_sort::match_file_name): Don't crash
567         if called on output section data.
568         (Output_section::Input_section_sort_compare): Sort based on
569         special ordering.
570         (Output_section::Input_section_sort_section_order_index_compare):
571         Revert last patch.
572         (Output_section::sort_attached_input_sections): Likewise.
573
574 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
575
576         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
577         * layout.h (Layout::is_section_name_prefix_grouped): New function.
578         * output.cc (Output_section::add_input_section): Check if section
579         name contains special prefix.  Keep input sections to sort such
580         sections.
581         (Output_section::Input_section_sort_section_order_index_compare
582          ::operator()): Group sections according to prefixes.
583         (Output_section::sort_attached_input_sections): Add condition to
584         Input_section_entry constructor call.
585         * testsuite/Makefile.am (text_section_grouping): New test.
586         * testsuite/Makefile.in: Regenerate.
587         * testsuite/text_section_grouping.cc: New file.
588         * testsuite/text_section_grouping.sh: New file.
589
590 2012-12-17  Nick Clifton  <nickc@redhat.com>
591
592         * Makefile.am: Add copyright notice.
593         * NEWS: Likewise.
594         * README: Likewise.
595         * configure.ac: Likewise.
596         * ftruncate.c: Likewise.
597         * Makefile.in: Regenerate.
598
599 2012-12-14  Cary Coutant  <ccoutant@google.com>
600
601         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
602         --no-as-needed flag.
603         (exception_separate_shared_12_test): Likewise.
604         (incremental_copy_test): Likewise.
605         * testsuite/Makefile.in: Regenerate.
606
607 2012-12-14  Cary Coutant  <ccoutant@google.com>
608
609         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
610         (Dwp_output_file::Dwp_index::enter_set): Add assert.
611
612 2012-12-12  Alan Modra  <amodra@gmail.com>
613
614         * powerpc.cc (class Track_tls): New.
615         (class Relocate, class Scan): Inherit Track_tls.
616         (Target_powerpc::Scan::local, global): Track tls optimization
617         and avoid creating plt entry for __tls_get_addr if all uses
618         are optimized away.
619         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
620
621 2012-12-12  Alan Modra  <amodra@gmail.com>
622
623         * options.h (General_options): Add --toc-sort/--no-toc-sort.
624         Replace no_toc_optimize with toc_optimize.
625         * output.h (Output_section::input_sections): Provide non-const variant.
626         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
627         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
628         accessors.
629         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
630         (class Sort_toc_sections): New.
631         (Target_powerpc::do_finalize_sections): Sort toc sections.
632         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
633
634 2012-12-10  Roland McGrath  <mcgrathr@google.com>
635
636         * testsuite/binary_unittest.cc (read_all): New function.
637         (Sized_binary_test): Use it instead of ::read.
638         * fileread.cc (do_read): Don't assume pread always reads the whole
639         amount in a single call.
640
641 2012-12-10  Alan Modra  <amodra@gmail.com>
642
643         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
644         Set EM_PPC64 or EM_PPC here.
645         (Target_selector_powerpc::do_recognize): Delete.
646
647 2012-12-10  Alan Modra  <amodra@gmail.com>
648
649         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
650         stub_table_.
651         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
652
653 2012-12-07  Roland McGrath  <mcgrathr@google.com>
654
655         * testsuite/binary_unittest.cc (Sized_binary_test):
656         Use open_descriptor rather than ::open.
657
658 2012-12-07  Alan Modra  <amodra@gmail.com>
659
660         * powerpc.cc (Stub_table::do_write): Delete redundant Address
661         typedef and invalid_address constant.
662         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
663         instantiate constants.
664
665 2012-12-06  Roland McGrath  <mcgrathr@google.com>
666
667         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
668         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
669         * aclocal.m4: Regenerate.
670         * configure: Regenerate.
671         * Makefile.in: Regenerate.
672         * testsuite/Makefile.in: Regenerate.
673
674 2012-12-07  Alan Modra  <amodra@gmail.com>
675
676         * options.h (General_options): Add no_toc_optimize.
677         * powerpc.cc (ok_lo_toc_insn): New function.
678         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
679
680 2012-12-06  Alan Modra  <amodra@gmail.com>
681
682         * options.h (General_options): Add plt_align, plt_static_chain,
683         plt_thread_safe.  Update stub_group_size help text.
684         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
685         for new plt_thread_safe_ var.
686         (use_plt_offset): Correct comments.
687         (Target_powerpc::do_relax): Look for thread creation symbols to
688         determine default plt_thread_safe value.  Clear plt call stubs
689         as well as branch stubs each iteration.
690         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
691         insn constants.
692         (l, hi, ha, write_insn): Move earlier.
693         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
694         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
695         plt stubs too.
696         (Stub_table::update_size): Adjust.
697         (Stub_table::prev_size, set_prev_size): Delete.
698         (Stub_table::stub_align): Let --plt-align affect result.
699         (Stub_table::plt_call_size): Calculate sizes for various stubs.
700         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
701         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
702         (Stub_table::do_write): Support more stub variants.
703
704 2012-12-04  Alan Modra  <amodra@gmail.com>
705
706         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
707         (Target_powerpc::do_define_standard_symbols): New function.
708
709 2012-12-03  Alan Modra  <amodra@gmail.com>
710
711         * output.h: Formatting, whitespace.
712
713 2012-12-03  Alan Modra  <amodra@gmail.com>
714
715         * layout.h (Layout::get_executable_sections): Declare.
716         * layout.cc (Layout::get_executable_sections): New function.
717         * arm.cc (Target_arm::group_sections): Use it.
718         (Arm_output_section::group_sections): Delete now redundant test.
719         * output.cc (Output_reloc::Output_reloc): Add is_relative.
720         param to handle relative relocs.
721         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
722         (Output_data_reloc::add_absolute): Adjust.
723         (Output_data_reloc::add_relative): New function.
724         (Output_data::reset_data_size): New function.
725         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
726         (Output_section::set_addralign): New function.
727         (Output_section::checkpoint_set_addralign): New function.
728         (Output_section::clear_section_offsets_need_adjustment): New function.
729         (Output_section::input_sections): Make public.
730         * powerpc.cc (class Output_data_brlt_powerpc): New.
731         (class Stub_table, class Stub_control): New.
732         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
733         stub_table_, set_stub_table, stub_table): New vectors and accessor
734         functions.
735         (Target_powerpc::do_may_relax, do_relax, push_branch,
736         new_stub_table, stub_tables, brlt_section, group_sections,
737         add_branch_lookup_table, find_branch_lookup_table,
738         write_branch_lookup_table, make_brlt_section): New functions.
739         (Target_powerpc::struct Sort_sections, class Branch_info): New.
740         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
741         branch_info_): New vars.
742         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
743         make call stubs here.
744         (Output_data_glink): Remove all call stub handling from this class.
745         (Target_powerpc::Scan::local, global): Save interesting branch
746         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
747         (Target_powerpc::do_finalize_sections): Only make reg save/restore
748         functions on final link.
749         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
750         Handle long branch destinations too.
751         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
752         do_plt_address_for_local): Adjust lookup of plt call stubs.
753
754 2012-11-30  Alan Modra  <amodra@gmail.com>
755
756         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
757         relocs against protected symbols when building 32-bit shared libs.
758
759 2012-11-30  Alan Modra  <amodra@gmail.com>
760
761         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
762         param.  Call got_section() to make .got.  Update all callers
763         and their callers and so on.
764
765 2012-11-30  Alan Modra  <amodra@gmail.com>
766
767         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
768         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
769         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
770         value if it already exists.
771
772 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
773
774         PR gold/14858
775         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
776
777 2012-11-14  Roland McGrath  <mcgrathr@google.com>
778
779         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
780         than bfc instruction for data sandboxing.
781
782 2012-11-08  Alan Modra  <amodra@gmail.com>
783
784         * po/POTFILES.in: Regenerate.
785
786 2012-11-05  Alan Modra  <amodra@gmail.com>
787
788         * configure.ac: Apply 2012-09-10 change to config.in here.
789         * configure: Regenerate.
790
791 2012-11-05  Alan Modra  <amodra@gmail.com>
792
793         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
794         (struct Opd_ent): Use "Address" rather than "Offset".
795         (Output_data_got_powerpc::got_base_offset): Return Valtype.
796         (Target_powerpc::got_section): Make public.
797         (Target_powerpc::scan_relocs): Move code setting symbols..
798         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
799         Create _SDA_BASE_ only when referenced.
800
801 2012-11-02  Roland McGrath  <mcgrathr@google.com>
802
803         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
804         from last change.
805
806 2012-11-01  Roland McGrath  <mcgrathr@google.com>
807
808         * target.h (Sized_target::relocate_relocs): Use Elf_Off
809         for offset_in_output_section parameter.
810         (Sized_target::relocate_special_relocatable): Likewise.
811         * arm.cc (Target_arm::relocate_relocs): Likewise.
812         (Target_arm::relocate_special_relocatable): Likewise.
813         * i386.cc (Target_i386::relocate_relocs): Likewise.
814         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
815         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
816         * target-reloc.h (relocate_relocs): Likewise.
817         * testsuite/testfile.cc (Target_test): Likewise.
818         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
819         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
820
821         * system.h: Move inclusion of <clocale> to after <libintl.h> in
822         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
823
824         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
825         parameter, which is unused in the [!F_SETFD] case.
826
827         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
828         SYMNDX to off_t before comparing it to this->data_size().
829         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
830         * incremental.cc (Output_section_incremental_inputs::do_write):
831         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
832
833         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
834
835 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
836
837         * gold.cc (Target_arm::do_adjust_elf_header): Add the
838         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
839         in EABI_VER5.
840
841 2012-10-29  Cary Coutant  <ccoutant@google.com>
842
843         * dwp.cc (usage): Add file and exit status parameters;
844         add --help and --version options.
845         (print_version): New function.
846         (main): Add --help and --version options.
847
848 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
849
850         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
851         final_layout_sequence.txt.
852         * testsuite/Makefile.in: Regenerated.
853
854 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
855
856         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
857         COMPILE generated by automake.
858         (LINK1): Likewise.
859         (CXXCOMPILE1): Likewise.
860         (CXXLINK1): Likewise.
861         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
862         (LINK): Likewise.
863         (CXXCOMPILE): Likewise.
864         (CXXLINK): Likewise.
865         * testsuite/Makefile.in: Regenerated.
866
867 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
868
869         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
870         on bad fwrite return.
871
872 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
873
874         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
875         on val.
876
877 2012-10-23  Cary Coutant  <ccoutant@google.com>
878
879         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
880         * testsuite/Makefile.in: Regenerate.
881         * testsuite/dwp_test.h: New source file.
882         * testsuite/dwp_test_1.cc: New source file.
883         * testsuite/dwp_test_1.s: New source file.
884         * testsuite/dwp_test_1.sh: New source file.
885         * testsuite/dwp_test_1b.cc: New source file.
886         * testsuite/dwp_test_1b.s: New source file.
887         * testsuite/dwp_test_2.cc: New source file.
888         * testsuite/dwp_test_2.s: New source file.
889         * testsuite/dwp_test_2.sh: New source file.
890         * testsuite/dwp_test_main.cc: New source file.
891         * testsuite/dwp_test_main.s: New source file.
892
893 2012-10-23  Cary Coutant  <ccoutant@google.com>
894
895         * dwp.h: New header file.
896         * dwp.cc: New source file.
897         * gold.h: Move shared declarations to system.h.
898         * system.h: New header file.
899         * Makefile.am: Add dwp.
900         * Makefile.in: Regenerate.
901
902 2012-10-23  Cary Coutant  <ccoutant@google.com>
903
904         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
905         Dwarf_info_reader::read_from_pointer.
906         (Dwarf_pubnames_table::read_header): Likewise.
907         (Dwarf_pubnames_table::next_name): Likewise.
908         (Dwarf_die::read_attributes): Likewise.
909         (Dwarf_die::skip_attributes): Likewise.
910         (Dwarf_info_reader::read_from_pointer): New function template.
911         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
912         (Dwarf_pubnames_table): Likewise.
913         (Dwarf_info_reader::read_from_pointer): New function template.
914         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
915         Dwarf_pubnames_table ctor.
916
917 2012-10-23  Cary Coutant  <ccoutant@google.com>
918
919         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
920         abbrev_shndx.
921         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
922         abbrev_shndx_.
923         (Dwarf_info_reader::set_abbrev_shndx): New method.
924         (Dwarf_info_reader::abbrev_shndx_): New data member.
925
926 2012-10-23  Cary Coutant  <ccoutant@google.com>
927
928         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
929         from object, not parameters.
930         (Dwarf_info_reader::parse): Likewise.
931         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
932         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
933         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
934         methods.
935
936 2012-10-23  Cary Coutant  <ccoutant@google.com>
937
938         * fileread.cc (Input_file::Input_file): New constructor.
939         * fileread.h (class Input_file): Add new constructor.
940
941 2012-10-18  Alan Modra  <amodra@gmail.com>
942
943         PR gold/14727
944         * object.cc (Relobj::is_section_name_included): Also match
945         .sdata personality section.
946
947 2012-10-18  Alan Modra  <amodra@gmail.com>
948
949         * target-reloc.h (class Default_comdat_behavior): New, package up..
950         (get_comdat_behaviour): ..this.
951         (relocate_section): Add Relocate_comdat_behavior template arg,
952         adjust code to suit.
953         * arm.cc (Target_arm::relocate_section): Adjust to suit.
954         (Target_arm::scan_reloc_section): Likewise.
955         * i386.cc (Target_i386::relocate_section): Likewise.
956         * sparc.cc (Target_sparc::relocate_section): Likewise.
957         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
958         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
959         * powerpc.cc (class Relocate_comdat_behavior): New.
960         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
961         gold::relocate_section with new template arg.
962
963 2012-10-18  Alan Modra  <amodra@gmail.com>
964
965         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
966         dynamic relocs for GOT_TPREL got entries, without symbol if
967         resolving locally.
968         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
969         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
970         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
971
972 2012-10-17  Alan Modra  <amodra@gmail.com>
973
974         PR gold/14726
975         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
976
977 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
978
979         * layout.cc (Layout::include_section): Keep sections marked
980         SHF_EXCLUDE when doing relocatable links.
981
982 2012-10-16  Alan Modra  <amodra@gmail.com>
983
984         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
985         (Target_powerpc::do_finalize_sections): Call it.
986         (Output_data_save_res): New class and supporting functions.
987         (Target_powerpc::symval_for_branch): Only look up .opd entry for
988         normal symbols defined in object files.
989
990 2012-10-12  Alan Modra  <amodra@gmail.com>
991
992         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
993         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
994         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
995         section if scan_opd_relocs not yet called.
996         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
997
998 2012-10-12  Alan Modra  <amodra@gmail.com>
999
1000         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1001         add_local_ifunc_entry): Revert last change.
1002         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1003
1004 2012-10-05  Alan Modra  <amodra@gmail.com>
1005
1006         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1007         do_plt_address_for_global): New functions.
1008         (Output_data_got_powerpc::do_write): Don't segfault when linking
1009         statically.
1010         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1011         add_local_ifunc_entry): Return true on adding entry..
1012         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1013         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1014         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1015         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1016         set up symbols here.
1017         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1018         syms here.  Do so even when no .iplt.  Don't segfault when linking
1019         statically.
1020         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1021         new variants without reloc param.
1022         (Glink_sym_ent::Glink_sym_ent): Likewise.
1023         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1024         reloc when refs will resolve to plt call stub.
1025         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1026         R_PPC_PLTREL24 to resolve locally.
1027         (Target_powerpc::Scan::global): Correct ifunc handling.
1028         (Target_powerpc::Relocate::relocate): Correct local sym glink
1029         lookup.  Don't destroy "value" when we have a plt call stub,
1030         and when checking plt call validity.
1031         (Target_powerpc::do_dynsym_value): Simplify.
1032
1033 2012-10-05  Alan Modra  <amodra@gmail.com>
1034
1035         * i386.cc (Output_data_plt_i386::address_for_global,
1036         address_for_local): Add plt offset to returned value.  Adjust uses.
1037         * sparc.cc (Output_data_plt_sparc::address_for_global,
1038         address_for_local): Likewise.
1039         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1040         address_for_local): Likewise.
1041         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1042         address_for_local): Likewise.
1043         * target.h (Target::plt_address_for_global, plt_address_for_local):
1044         Update comment.
1045         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1046         (Output_data_got::Got_entry::write): Nor here.
1047         * output.h: Comment fix.
1048
1049 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1050
1051         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1052         global_offset_table_ value for larget got.
1053         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1054
1055 2012-09-29  Alan Modra  <amodra@gmail.com>
1056
1057         * powerpc.cc (Target_powerpc::iplt_): New output section.
1058         (Target_powerpc::iplt_section, make_iplt_section,
1059         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1060         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1061         Target_powerpc::plt_entry_count): Count iplt entries too.
1062         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1063         reloc section in constructor.  New params.
1064         (Target_powerpc::make_plt_section): Create reloc section here instead.
1065         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1066         functions.
1067         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1068         (Output_data_glink::add_entry, find_entry): New functions to
1069         deal with local syms.
1070         (Glink_sym_ent): Add support for local syms.
1071         (Output_data_glink::do_write): Handle ifunc plt entries.
1072         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1073         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1074         (Target_powerpc::Relocate::relocate): Likewise.
1075         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1076
1077 2012-09-25  Alan Modra  <amodra@gmail.com>
1078
1079         * object.h (Sized_relobj_file::adjust_local_symbol,
1080         do_adjust_local_symbol): New functions.
1081         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1082         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1083         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1084         and irregular opd entry spacing.
1085         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1086         (Global_symbol_visitor_opd): New functor.
1087         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1088         on deleted opd entries.
1089
1090 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1091
1092         * tilegx.cc: New file.
1093         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1094         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1095         * configure.tgt: Add entries for tilegx*.
1096         * configure.ac: Likewise.
1097         * Makefile.in: Rebuild.
1098         * configure: Likewise.
1099         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1100         tilegx.
1101
1102 2012-09-13  Alan Modra  <amodra@gmail.com>
1103
1104         * target-reloc.h (scan_relocs): Call scan.local for relocs
1105         against symbols in discarded sections.  Pass is_discarded
1106         param.
1107         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1108         Add is_discarded param.
1109         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1110         is_discarded to flag opd entry as discarded.  Don't emit dyn
1111         relocs on such entries.
1112         (Target_powerpc::Scan::global): Similarly detect and handle
1113         such opd entries.
1114         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1115         opd_ent_.  Update all uses.
1116         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1117         (Target_powerpc::relocate_section): Zero out discarded opd
1118         entry relocs.
1119
1120 2012-09-12  Ian Lance Taylor  <iant@google.com>
1121
1122         PR gold/14570
1123         * output.cc: Rename Output_data_got template parameter from size
1124         to got_size for all functions.  Compile all variants of
1125         Output_data_got.
1126         (Output_data_got::Got_entry::write): Correct use of size for
1127         symbol value.  Use local_is_tls rather than casting to
1128         Sized_relobj_file.
1129         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1130         (class Sized_relobj_file): Add do_local_is_tls.
1131         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1132
1133 2012-09-11  Alan Modra  <amodra@gmail.com>
1134
1135         PR gold/14566
1136         * layout.cc (Layout::set_segment_offsets): When using
1137         common-page-size alignment, ensure we are on a new max-page-size
1138         page.
1139         * output.cc (Output_segment::set_section_addresses): Use
1140         abi_pagesize, not common_pagesize for relro boundary.
1141         (Output_segment::set_offset): Likewise.
1142
1143 2012-09-11  Alan Modra  <amodra@gmail.com>
1144
1145         * output.h (Output_data_got::add_global_tls, add_local_tls,
1146         add_local_tls_pair): New functions.
1147         (Output_data_got::add_local_pair_with_rel): Remove second
1148         reloc param.  Expand comment.
1149         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1150         use_plt_or_tls_offset_, similarly for constructor param.
1151         (Output_data_got::Got_entry::write): Add got_index param.
1152         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1153         add_local_tls_pair): New functions.
1154         (Output_data_got::Got_entry::write): Handle tls symbols
1155         with use_plt_or_tls_offset_ set specially.
1156         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1157         (Output_data_got::do_write): Replace iterator with index, pass
1158         index to entry write function.
1159         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1160         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1161         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1162         call.
1163         * i386.cc (Target_i386::Scan::local): Likewise.
1164         * sparc.cc (Target_sparc::Scan::local): Likewise.
1165         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1166         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1167         do_tls_offset_for_global): New functions.
1168         (Target_powerpc::Scan::local): Correct TLS relocations and got
1169         entry values.
1170         (Target_powerpc::Scan::global): Don't emit unnecessary
1171         dynamic relocations on TLS GOT entries.
1172
1173 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1174
1175         * config.in: Disable sanity check for kfreebsd.
1176
1177 2012-09-10  Sterling Augustine  <saugustine@google.com>
1178
1179         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1180         (Gdb_index::pubtypes_read): New parameter.
1181         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1182         to calls.
1183         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1184         pubtypes_object_.
1185
1186 2012-09-09  Alan Modra  <amodra@gmail.com>
1187
1188         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1189         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1190         * gc.h (gc_process_relocs): Call target gc_add_reference.
1191         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1192         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1193         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1194         unnecessary cast.
1195         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1196         to cater for when we don't need code offset.  Update use.
1197         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1198         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1199         set_opd_valid): New functions.
1200         (Target_powerpc::do_gc_add_reference): New function.
1201         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1202         stashed refs.
1203         (Target_powerpc::do_gc_mark_symbol): New function.
1204
1205 2012-09-06  Cary Coutant  <ccoutant@google.com>
1206
1207         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1208         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1209         (Dwarf_die::skip_attributes): Likewise.
1210         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1211         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1212         (main): Call it.
1213         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1214
1215 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1216
1217         * testsuite/script_test_3.t: Add .got.plt output section
1218         statement.
1219         * testsuite/script_test_4.t: Likewise.
1220
1221 2012-09-05  Alan Modra  <amodra@gmail.com>
1222
1223         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1224         update all uses and lose "enum" when using type.
1225
1226 2012-09-05  Alan Modra  <amodra@gmail.com>
1227
1228         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1229         * configure: Regenerate.
1230         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1231         (plugin_final_layout.stdout): Likewise.
1232         (memory_test): Set page sizes to 0x1000.
1233         * testsuite/Makefile.in: Regenerate.
1234         * testsuite/discard_locals_test.sh: Add FIXME comment.
1235         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1236         * testsuite/pr14265.t: Add .got output section statement.
1237         * testsuite/script_test_2.t: Likewise.
1238         * testsuite/script_test_3.t: Likewise.
1239         * testsuite/script_test_4.t: Likewise.
1240         * testsuite/script_test_5.t: Likewise.
1241         * testsuite/script_test_6.t: Likewise.
1242         * testsuite/script_test_7.t: Likewise.
1243         * testsuite/script_test_9.t: Likewise.
1244
1245 2012-09-05  Alan Modra  <amodra@gmail.com>
1246
1247         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1248         (Powerpc_relocate_functions::Status): New typedef.
1249         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1250         (Target_powerpc::Scan::local): Handle REL64.
1251         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1252         for REL32 and REL64.
1253         (Target_powerpc::symval_for_branch): New function, extracted from..
1254         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1255         checks.  Report overflow errors.
1256
1257 2012-09-05  Alan Modra  <amodra@gmail.com>
1258
1259         * object.h (Sized_relobj_file::emit_relocs): Delete.
1260         (Sized_relobj_file::emit_relocs_reltype): Delete.
1261         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1262         relocate_relocs for --emit-relocs.
1263         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1264         * output.h: Update comment.
1265         (Output_segment::first_section): New function.
1266         (Output_segment::first_section_load_address): Use first_section.
1267         * output.cc (Output_segment::first_section): New function extracted..
1268         (Output_segment::first_section_load_address): ..from here.  Delete.
1269         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1270         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1271         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1272         adjust call to target.h function.
1273         * i386.cc (Target_i386): Likewise.
1274         * sparc.cc (Target_sparc): Likewise.
1275         * x86_64.cc (Target_x86_64): Likewise.
1276         * powerpc.cc (Target_powerpc): Likewise.
1277         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1278         first tls section has section symbol for optimised local dynamic
1279         output relocs.
1280         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1281         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1282         optimised tls code.
1283         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1284         Rename to relocate_relocs.  Update error message.
1285
1286 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1287
1288         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1289         --just-symbols.
1290
1291 2012-08-31  Alan Modra  <amodra@gmail.com>
1292
1293         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1294         (Powerpc_relobj::toc_base_offset): New stub function.
1295         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1296         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1297         (Target_powerpc::Relocate::enum skip_tls): New.
1298         (Target_powerpc::call_tls_get_addr_): New var.
1299         (Target_powerpc::is_branch_reloc): Move to file scope.
1300         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1301         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1302         New functions.
1303         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1304         (powerpc_info): Correct common_pagesize for ppc64.
1305         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1306         (Powerpc_relocate_functions): Add overflow check enums and functions.
1307         Add non-shift version of rela, rela_ua.  Delete all rel public
1308         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1309         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1310         addr16_ha3, addr14 functions.
1311         (Output_data_got_powerpc::add_constant_pair): New function.
1312         (Output_data_got_powerpc::got_base_offset): Likewise.
1313         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1314         (instruction constants): Sort, add some more.
1315         (Output_data_glink::do_write): Add and use Address typedef.  Use
1316         object->toc_base_offset() stub for 64-bit.
1317         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1318         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1319         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1320         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1321         Always treat .opd relocs as against locally defined symbol.
1322         Correct condition for RELATIVE relocs.
1323         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1324         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1325         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1326         calculations.  Handle TLS relocs, and more.  Add overflow
1327         checking and adjust for Powerpc_relocate_functions changes.
1328         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1329         Reinstate --emit-relocs code with FIXME.
1330
1331 2012-08-30  Alan Modra  <amodra@gmail.com>
1332
1333         * layout.cc (Layout::set_segment_offsets): Set p_align to
1334         abi_pagesize, not common_pagesize.
1335         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1336         to determine whether file header can go in segment.
1337
1338 2012-08-30  Alan Modra  <amodra@gmail.com>
1339
1340         * output.h (Output_reloc::Output_reloc <output section>): Add
1341         is_relative param.  Adjust calls.
1342         (Output_reloc::add_output_section_relative): New functions.
1343         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1344         is_relative.
1345         (Output_reloc::symbol_value): Handle SECTION_CODE.
1346
1347 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1348
1349         * gold.cc (queue_middle_tasks): Call layout again when unique
1350         segments for sections is desired.
1351         * layout.cc (Layout::Layout): Initialize new members.
1352         (Layout::get_output_section_flags): New function.
1353         (Layout::choose_output_section): Call get_output_section_flags.
1354         (Layout::layout): Make output section for mapping to a unique segment.
1355         (Layout::insert_section_segment_map): New function.
1356         (Layout::attach_allocated_section_to_segment): Make unique segment for
1357         output sections marked so.
1358         (Layout::segment_precedes): Check for unique segments when sorting.
1359         * layout.h (Layout::Unique_segment_info): New struct.
1360         (Layout::Section_segment_map): New typedef.
1361         (Layout::insert_section_segment_map): New function.
1362         (Layout::get_output_section_flags): New function.
1363         (Layout::is_unique_segment_for_sections_specified): New function.
1364         (Layout::set_unique_segment_for_sections_specified): New function.
1365         (Layout::unique_segment_for_sections_specified_): New member.
1366         (Layout::section_segment_map_): New member.
1367         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1368         Rename is_gc_pass_one to is_pass_one.
1369         Rename is_gc_pass_two to is_pass_two.
1370         Rename is_gc_or_icf to is_two_pass.
1371         Check for which pass based on whether symbols data is present.
1372         Make it two pass when unique segments for sections is desired.
1373         * output.cc (Output_section::Output_section): Initialize new
1374         members.
1375         * output.h (Output_section::is_unique_segment): New function.
1376         (Output_section::set_is_unique_segment): New function.
1377         (Output_section::is_unique_segment_): New member.
1378         (Output_section::extra_segment_flags): New function.
1379         (Output_section::set_extra_segment_flags): New function.
1380         (Output_section::extra_segment_flags_): New member.
1381         (Output_section::segment_alignment): New function.
1382         (Output_section::set_segment_alignment): New function.
1383         (Output_section::segment_alignment_): New member.
1384         (Output_segment::Output_segment): Initialize is_unique_segment_.
1385         (Output_segment::is_unique_segment): New function.
1386         (Output_segment::set_is_unique_segment): New function.
1387         (Output_segment::is_unique_segment_): New member.
1388         * plugin.cc (allow_unique_segment_for_sections): New function.
1389         (unique_segment_for_sections): New function.
1390         (Plugin::load): Add new functions to transfer vector.
1391         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1392         * Makefile.in: Regenerate.
1393         * testsuite/plugin_final_layout.sh: Check if unique segment
1394         functionality works.
1395         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1396         are available.
1397         (allow_unique_segment_for_sections): New global.
1398         (unique_segment_for_sections): New global.
1399         (claim_file_hook): Call allow_unique_segment_for_sections.
1400         (all_symbols_read_hook): Call unique_segment_for_sections.
1401
1402 2012-08-22  Cary Coutant  <ccoutant@google.com>
1403
1404         * layout.cc (Layout::include_section): Don't assert on GROUP
1405         sections with --emit-relocs.
1406
1407 2012-08-21  Cary Coutant  <ccoutant@google.com>
1408
1409         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1410         if --export-dynamic-symbol names an undef symbol.
1411
1412 2012-08-18  Alan Modra  <amodra@gmail.com>
1413
1414         * powerpc.cc: Formatting and white space.
1415         (Powerpc_relobj): Rename got2_section_ to special_.
1416         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1417         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1418         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1419         (Target_powerpc): Add Address typedef and invalid_address.  Use
1420         throughout.
1421         (Target_powerpc::is_branch_reloc): New function.
1422         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1423         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1424         for dst_mask, value and addend.
1425         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1426         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1427         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1428         uint16_t for 24-bit offset.  Use get_output_section_offset and
1429         check return.
1430         (Target_powerpc::Scan::local): Handle more relocs.
1431         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1432         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1433         Plug in toc restoring insn after plt calls.  Translate branches
1434         to function descriptor symbols to corresponding entry point.
1435         (Target_powerpc::relocate_for_relocatable): Check return from
1436         get_output_section_offset.
1437         * symtab.h: Comment typo.
1438
1439 2012-08-14  Ian Lance Taylor  <iant@google.com>
1440
1441         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1442         unsupported_relocal_local to call unsupported_reloc_global.
1443
1444 2012-08-14  Nick Clifton  <nickc@redhat.com>
1445
1446         PR ld/14265
1447         * script-sections.cc (Sections_element::output_section_name): Add
1448         keep return parameter.
1449         (Output_section_element::match_name): Add keep return parameter.
1450         Return the value of the keep_ member.
1451         * script-sections.h (class Output_section): Update
1452         output_section_name prototype.
1453         * layout.cc (Layout::keep_input_section): New public member
1454         function.
1455         (Layout::choose_output_section): Pass keep parameter to
1456         output_section_name.
1457         * layout.h (class Layout): Add keep_input_section.
1458         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1459         sections.
1460         * testsuite/Makefile.am: Add a test.
1461         * testsuite/Makefile.in: Regenerate.
1462         * testsuite/pr14265.c: Source file for the test.
1463         * testsuite/pr14265.t: Linker script for the test.
1464         * testsuite/pr14265.sh: Shell script for the test.
1465
1466 2012-08-14  Alan Modra  <amodra@gmail.com>
1467
1468         * target.h (Target::output_section_name): New function.
1469         (Target::do_output_section_name): New function.
1470         * layout.cc (Layout::choose_output_section): Call the above.
1471         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1472
1473 2012-08-14  Alan Modra  <amodra@gmail.com>
1474
1475         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1476         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1477         for replace_constant call.
1478         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1479         (Output_data_glink::do_print_to_mapfile): New function.
1480         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1481         (Target_powerpc::Relocate::relocate): Likewise.
1482
1483 2012-08-14  Alan Modra  <amodra@gmail.com>
1484
1485         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1486         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1487         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1488         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1489         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1490         here.
1491         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1492         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1493         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1494         here.
1495         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1496         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1497
1498 2012-08-12  Alan Modra  <amodra@gmail.com>
1499
1500         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1501         (glink insn constants): Use uint32_t.
1502         (Output_data_glink::add_entry): Use insert, not [] operator.
1503
1504 2012-08-11  Alan Modra  <amodra@gmail.com>
1505
1506         * object.h (Sized_relobj_file::find_shdr): New function.
1507         (Sized_relobj_file::find_special_sections): New function.
1508         * object.cc (Sized_relobj_file::find_shdr): New function.
1509         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1510         (Sized_relobj_file::find_special_sections): New function, split out..
1511         (Sized_relobj_file::do_read_symbols): ..from here.
1512         * output.h (Output_data_got::replace_constant): New function.
1513         (Output_data_got::num_entries): New function.
1514         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1515         (Output_data_got::got_offset): Protected rather than private.
1516         (Output_data_got::replace_got_entry): New function.
1517         * output.cc (Output_data_got::replace_got_entry): New function.
1518         * powerpc.cc (class Powerpc_relobj): New.
1519         (class Powerpc_relocate_functions): Delete all psymval variants or
1520         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1521         Implement _ha functions using corresponding _hi function.
1522         (Powerpc_relobj::find_special_sections): New function.
1523         (Target_powerpc::do_make_elf_object): New function.
1524         (class Output_data_got_powerpc): New.
1525         (class Output_data_glink): New.
1526         (class Powerpc_scan_relocatable_reloc): New.
1527         Many more changes througout file.
1528
1529 2012-08-09  Nick Clifton  <nickc@redhat.com>
1530
1531         * po/vi.po: Updated Vietnamese translation.
1532
1533 2012-08-07  Ian Lance Taylor  <iant@google.com>
1534
1535         * layout.cc (Layout::add_target_dynamic_tags): If
1536         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1537         plt_rel.
1538
1539 2012-07-30  Nick Clifton  <nickc@redhat.com>
1540
1541         * po/gold.pot: Updated template.
1542         * po/es.po: Updated Spanish translation.
1543
1544 2012-07-18  Cary Coutant  <ccoutant@google.com>
1545
1546         PR gold/14344
1547         * configure.ac: Add check for -gpubnames support.
1548         * configure: Regenerate.
1549         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1550         support; force -gno-pubnames.
1551         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1552         support.
1553         (gdb_index_test_4): New test.
1554         * testsuite/Makefile.in: Regenerate.
1555         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1556         * testsuite/gdb_index_test_2.sh: Likewise.
1557         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1558         * testsuite/gdb_index_test_4.sh: New script.
1559         * testsuite/gdb_index_test_comm.sh: New script with common code;
1560         don't look for space after colon.
1561
1562 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1563
1564         * gold.cc (queue_middle_tasks): Update function order only after
1565         deferred objects due to plugins are processed.
1566
1567 2012-07-11  Ian Lance Taylor  <iant@google.com>
1568
1569         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1570         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1571         (Target_arm::scan_reloc_for_stub): Likewise.
1572         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1573         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1574         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1575         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1576         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1577
1578 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1579             Ian Lance Taylor  <iant@google.com>
1580
1581         PR gold/14309
1582         * configure.ac: Test whether std::tr1::hash<off_t> works.
1583         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1584         needed.
1585         * output.h (class Output_fill): Add virtual destructor.
1586         * configure, config.in: Rebuild.
1587
1588 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1589
1590         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1591
1592 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1593
1594         * plugin.cc (Plugin::load): Handle position independent executables.
1595
1596 2012-06-06  Cary Coutant  <ccoutant@google.com>
1597
1598         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1599         add .debug_macro.
1600         (lines_only_debug_sections): Likewise.
1601         (gdb_fast_lookup_sections): New static array.
1602         (is_gdb_debug_section): Rename formal parameter.
1603         (is_lines_only_debug_section): Likewise.
1604         (is_gdb_fast_lookup_section): New function.
1605         (Layout::include_section): Check for ".zdebug_" prefix; pass
1606         section name suffix to is_gdb_debug_section, et al.; check for
1607         fast-lookup sections when building .gdb_index.
1608         * options.h (--strip-debug-gdb): Update GDB version number.
1609
1610 2012-06-06  Cary Coutant  <ccoutant@google.com>
1611
1612         * configure.ac: Add check for fallocate.
1613         * configure: Regenerate.
1614         * config.in: Regenerate.
1615
1616         * options.h (class General_options): Add --mmap-output-file and
1617         --posix-fallocate options.
1618         * output.cc: (posix_fallocate): Remove; replace with...
1619         (gold_fallocate): New function.
1620         (Output_file::map_no_anonymous): Call gold_fallocate.
1621         (Output_file::map): Check --mmap-output-file option.
1622
1623 2012-06-05  Jing Yu  <jingyu@google.com>
1624
1625         * gold.h (textdomain): Add do {} to empty while(0).
1626         (bindtextdomain): Likewise.
1627
1628 2012-06-04  Cary Coutant  <ccoutant@google.com>
1629
1630         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1631         has_dynsym_index.
1632
1633 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1634
1635         * symtab.cc (Symbol_table::define_special_symbol):
1636         Initialize *poldsym to prevent uninitialized variable errors.
1637
1638 2012-05-23  Cary Coutant  <ccoutant@google.com>
1639
1640         * layout.cc (Layout::section_name_mapping): Add rules to handle
1641         exact match on .data.rel.ro.local or .data.rel.ro.
1642         (Layout::output_section_name): Check for exact matches.
1643
1644 2012-05-23  Cary Coutant  <ccoutant@google.com>
1645
1646         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1647         more carefully.
1648
1649 2012-05-22  Cary Coutant  <ccoutant@google.com>
1650
1651         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1652         object before exporting symbol.
1653
1654 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1655
1656         * testsuite/tls_test.cc: Include "config.h" first.
1657         * testsuite/tls_test_c.c: Likewise.
1658
1659 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1660             Nick Clifton  <nickc@redhat.com>
1661
1662         PR 14072
1663         * configure.in: Add check that sysdep.h has been included before
1664         any system header files.
1665         * configure: Regenerate.
1666         * config.in: Regenerate.
1667
1668 2012-05-14  Cary Coutant  <ccoutant@google.com>
1669
1670         * layout.cc (Layout::make_output_section): Mark .tdata section
1671         as RELRO.
1672         * testsuite/relro_test.cc: Add a TLS variable.
1673
1674 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1675
1676         PR gold/14091
1677         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1678         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1679         R_X86_64_64.
1680
1681 2012-05-08  Cary Coutant  <ccoutant@google.com>
1682
1683         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1684         (lines_only_debug_sections): Likewise.
1685
1686 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1687
1688         * nacl.cc: New file.
1689         * nacl.h: New file.
1690         * Makefile.am (CCFILES, HFILES): Add them.
1691         * Makefile.in: Regenerate.
1692         * i386.cc (Output_data_plt_i386_nacl): New class.
1693         (Output_data_plt_i386_nacl_exec): New class.
1694         (Output_data_plt_i386_nacl_dyn): New class.
1695         (Target_i386_nacl): New class.
1696         (Target_selector_i386_nacl): New class.
1697         (target_selector_i386): Use it instead of Target_selector_i386.
1698         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1699         (Target_x86_64_nacl): New class.
1700         (Target_selector_x86_64_nacl): New class.
1701         (target_selector_x86_64, target_selector_x32): Use it instead of
1702         Target_selector_x86_64.
1703         * arm.cc (Output_data_plt_arm_nacl): New class.
1704         (Target_arm_nacl): New class.
1705         (Target_selector_arm_nacl): New class.
1706         (target_selector_arm, target_selector_armbe): Use it instead of
1707         Target_selector_arm.
1708
1709         * target-select.cc (select_target): Take new Input_file* and off_t
1710         arguments, pass them on to recognize method of selector.
1711         * object.cc (make_elf_sized_object): Update caller.
1712         * parameters.cc (parameters_force_valid_target): Likewise.
1713         * incremental.cc (make_sized_incremental_binary): Likewise.
1714         * target-select.h: Update decl.
1715         (Target_selector::recognize): Take new Input_file* argument,
1716         pass it on to do_recognize.
1717         (Target_selector::do_recognize): Take new Input_file* argument.
1718         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1719         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1720         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1721         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1722
1723         * target.h (Target::Target_info): New members isolate_execinstr
1724         and rosegment_gap.
1725         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1726         * arm.cc (Target_arm::arm_info): Update initializer.
1727         * i386.cc (Target_i386::i386_info): Likewise.
1728         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1729         * sparc.cc (Target_sparc::sparc_info): Likewise.
1730         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1731         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1732         * layout.cc (Layout::attach_allocated_section_to_segment):
1733         Take new const Target* argument.  If target->isolate_execinstr(), act
1734         like --rosegment.
1735         (Layout::find_first_load_seg): Take new const Target* argument;
1736         if target->isolate_execinstr(), reject PF_X segments.
1737         (Layout::relaxation_loop_body): Update caller.
1738         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1739         reset file offset to zero when we hit LOAD_SEG, and then do a second
1740         loop over the segments before LOAD_SEG to reassign offsets after
1741         addresses have been determined.  Handle target->rosegment_gap().
1742         (Layout::attach_section_to_segment): Take new const Target* argument;
1743         pass it to attach_allocated_section_to_segment.
1744         (Layout::make_output_section): Update caller.
1745         (Layout::attach_sections_to_segments): Take new const Target* argument;
1746         pass it to attach_section_to_segment.
1747         * gold.cc (queue_middle_tasks): Update caller.
1748         * layout.h (Layout): Update method decls with new arguments.
1749
1750         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1751         Target_info pointer to use.
1752         (Target_arm::do_make_data_plt): New virtual method.
1753         (Target_arm::make_data_plt): New method that calls it.
1754         (Target_arm::make_plt_entry): Use it.
1755         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1756         for the section alignment.
1757         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1758         method.
1759         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1760         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1761         method.
1762         (Output_data_plt_arm::get_plt_entry_size): Call it.
1763         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1764         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1765         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1766         method.
1767         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1768         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1769         method instead of sizeof(plt_entry).
1770         (Output_data_plt_arm::add_entry): Likewise.
1771         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1772         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1773         than static method.
1774         (Target_arm::plt_entry_size): Likewise.
1775         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1776         Move to ...
1777         (Output_data_plt_arm_standard): ... here, new class.
1778         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1779         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1780         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1781
1782         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1783         Take additional argument for the PLT entry size.
1784         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1785         Use get_plt_entry_size method rather than plt_entry_size variable.
1786         (Output_data_plt_x86_64::reserve_slot): Likewise.
1787         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1788         (Output_data_plt_x86_64::add_entry): Likewise.
1789         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1790         (Output_data_plt_x86_64::address_for_global): Likewise.
1791         (Output_data_plt_x86_64::address_for_local): Likewise.
1792         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1793         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1794         Make method non-static.
1795         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1796         method.
1797         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1798         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1799         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1800         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1801         virtual method.
1802         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1803         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1804         virtual method.
1805         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1806         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1807         virtual method.
1808         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1809         (Output_data_plt_x86_64::plt_entry_size)
1810         (Output_data_plt_x86_64::first_plt_entry)
1811         (Output_data_plt_x86_64::plt_entry)
1812         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1813         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1814         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1815         (Output_data_plt_x86_64_standard): ... here, new class.
1816         (Target_x86_64::Target_x86_64): Take optional argument for the
1817         Target_info pointer to use.
1818         (Target_x86_64::do_make_data_plt): New virtual method.
1819         (Target_x86_64::make_data_plt): New method to call it.
1820         (Target_x86_64::init_got_plt_for_update): Use that.
1821         Call this->plt_->add_eh_frame method here.
1822         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1823         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1824         rather than static method.
1825         (Target_x86_64::plt_entry_size): Likewise.
1826         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1827         rather than plt_entry_size variable.  Move guts of PLT filling to...
1828         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1829         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1830         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1831
1832         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1833         additional argument for the section alignment.
1834         Don't do add_eh_frame_for_plt here.
1835         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1836         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1837         variable.
1838         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1839         method.
1840         (Output_data_plt_i386::get_plt_entry_size): Call it.
1841         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1842         (Output_data_plt_i386::add_eh_frame): New method to call it.
1843         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1844         method.
1845         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1846         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1847         method.
1848         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1849         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1850         method instead of plt_entry_size.
1851         (Output_data_plt_i386::plt_entry_size)
1852         (Output_data_plt_i386::plt_eh_frame_fde_size)
1853         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1854         (Output_data_plt_i386_standard): ... here, new class.
1855         (Output_data_plt_i386_exec): New class.
1856         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1857         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1858         (Output_data_plt_i386::exec_plt_entry): Move to ...
1859         (Output_data_plt_i386_exec::plt_entry): ... here.
1860         (Output_data_plt_i386_dyn): New class.
1861         (Output_data_plt_i386::first_plt_entry): Move to ...
1862         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1863         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1864         (Output_data_plt_i386_dyn::plt_entry): ... here.
1865         (Target_i386::Target_i386): Take optional argument for the Target_info
1866         pointer to use.
1867         (Target_i386::do_make_data_plt): New virtual method.
1868         (Target_i386::make_data_plt): New method to call it.
1869         (Target_i386::make_plt_section): Use that.
1870         Call this->plt_->add_eh_frame method here.
1871         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1872         rather than plt_entry_size variable.
1873         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1874         (Output_data_plt_i386::address_for_local): Likewise.
1875         (Output_data_plt_i386::do_write): Likewise.
1876         Move guts of PLT filling to...
1877         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1878         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1879         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1880         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1881
1882 2012-05-01  Cary Coutant  <ccoutant@google.com>
1883
1884         * dwarf_reader.cc (Dwarf_die::read_attributes)
1885         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1886         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1887         * reduced_debug_output.cc
1888         (Output_reduced_debug_info_section::get_die_end): Remove
1889         DW_FORM_GNU_ref_index.  Add default case.
1890
1891 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1892
1893         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1894         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1895         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1896         DW_AT_high_pc as offset from DW_AT_low_pc.
1897
1898         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1899         * testsuite/Makefile.in: Regenerate.
1900         * testsuite/gdb_index_test_3.c: New test source file.
1901         * testsuite/gdb_index_test_3.sh: New test source file.
1902
1903 2012-04-25  Ian Lance Taylor  <iant@google.com>
1904
1905         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1906         pointer.
1907         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1908         as a class, not a struct.
1909         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1910         (Target_arm::apply_cortex_a8_workaround): Likewise.
1911         * gc.h: Declare Reloc_types as a struct, not a class.
1912         * object.h: Declare Symbols_data as a struct.
1913         * reloc.h: Declare Read_relocs_data as a struct.
1914         * target.h: Declare Relocate_info as a struct.
1915
1916 2012-04-24  David S. Miller  <davem@davemloft.net>
1917
1918         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1919         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1920         and R_SPARC_WPLT30.
1921
1922 2012-04-24  Cary Coutant  <ccoutant@google.com>
1923
1924         * incremental-dump.cc (find_input_containing_global): Replace
1925         magic number with symbolic constant.
1926         (dump_incremental_inputs): Update version number.
1927         * incremental.cc (Output_section_incremental_inputs): Update version
1928         number; import symbolic constants from Incremental_inputs_reader.
1929         (Incremental_inputs::create_data_sections): Align relocations
1930         section correctly for 64-bit targets.
1931         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1932         constants; add padding.
1933         (Output_section_incremental_inputs::write_header): Add assert for
1934         header_size.
1935         (Output_section_incremental_inputs::write_input_files): Add assert
1936         for input_entry_size.
1937         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1938         add assert for object_info_size, input_section_entry_size,
1939         global_sym_entry_size.
1940         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1941         for data structure sizes; use them.
1942         (Incremental_input_entry_reader): Import symbolic constants from
1943         Incremental_inputs_reader; use them.
1944
1945 2012-04-23  David S. Miller  <davem@davemloft.net>
1946
1947         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1948         and elf_flags_set_.
1949         (Target_sparc::Target_sparc): Initialize new fields.
1950         (Target_sparc::do_make_elf_object): New function.
1951         (Target_sparc::do_adjust_elf_header): New function.
1952
1953 2012-04-23  Cary Coutant  <ccoutant@google.com>
1954
1955         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1956         CU range table of gdb index.
1957
1958 2012-04-20  David S. Miller  <davem@davemloft.net>
1959
1960         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1961         instead of false.
1962
1963 2012-04-16  David S. Miller  <davem@davemloft.net>
1964
1965         * sparc.cc (Target_sparc::got_address): New function.
1966         (Sparc_relocate_functions::gdop_hix22): New function.
1967         (Sparc_relocate_functions::gdop_lox10): New function.
1968         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1969         relocs.
1970         (Target_sparc::Scan::local): Likewise if the global symbol is not
1971         preemptible and is not IFUNC.
1972         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1973         transformations for local and non-preemptible non-IFUNC global
1974         symbols.
1975
1976         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1977         writing out 64-bit part of ranges.
1978
1979         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1980         -fpic and -fpie respectively.
1981         * Makefile.in: Regenerate.
1982
1983         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1984         (Target_sparc::Target_sparc): Initialize new field.
1985         (Target_sparc::do_plt_section_for_global): New function.
1986         (Target_sparc::do_plt_section_for_local): New function.
1987         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1988         (Target_sparc::make_plt_section): New function, broken out of
1989         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1990         (Target_sparc::make_plt_entry): Call make_plt_section.
1991         (Target_sparc::make_local_ifunc_plt_entry): New function.
1992         (Target_sparc::rela_ifunc_section): New function.
1993         (Target_sparc::plt_section): Remove const.
1994         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1995         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1996         and ifunc_count_ fields.
1997         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1998         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1999         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2000         (Output_data_plt_sparc::rela_ifunc): New function.
2001         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2002         (Output_data_plt_sparc::has_ifunc_section): New function.
2003         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2004         (Output_data_plt_sparc::address_for_global): New function.
2005         (Output_data_plt_sparc::address_for_local): New function.
2006         (Output_data_plt_sparc::plt_index_to_offset): New function.
2007         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2008         and entry_count.
2009         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2010         entry_count.
2011         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2012         R_SPARC_JMP_IREL to switch.
2013         (Target_sparc::Scan::check_non_pic): Likewise.
2014         (Target_sparc::Scan::local): Handle IFUNC symbols.
2015         (Target_sparc::Scan::local): Likewise.
2016         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2017         and plt_address_for_local.
2018         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2019         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2020
2021         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2022         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2023         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2024         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2025         global relocs too.
2026         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2027         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2028         calls.
2029         * sparc.cc (Target_sparc::Scan::global): Likewise.
2030         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2031
2032 2012-04-16  Cary Coutant  <ccoutant@google.com>
2033
2034         * archive.cc (Library_base::should_include_member): Check for
2035         --export-dynamic-symbol.
2036         * options.h (class General_options): Add --export-dynamic-symbol.
2037         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2038         --export-dynamic-symbol.
2039         (Symbol_table::gc_mark_undef_symbols): Likewise.
2040         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2041
2042 2012-04-12  David S. Miller  <davem@davemloft.net>
2043
2044         * sparc.cc (Reloc::wdisp10): New relocation method.
2045         (Reloc::h34): Likewise.
2046         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2047         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2048         R_SPARC_WDISP10.
2049         (Target_sparc::Scan::local): Likewise.
2050         (Target_sparc::Scan::global): Likewise.
2051         (Target_sparc::Relocate::relocate): Likewise.
2052
2053 2012-04-09  Cary Coutant  <ccoutant@google.com>
2054
2055         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2056         low_pc == 0.
2057
2058 2012-04-06  Ian Lance Taylor  <iant@google.com>
2059
2060         * timer.cc: #include <unistd.h>.
2061
2062 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2063
2064         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2065         * config.in: Regenerate.
2066         * configure: Regenerate.
2067
2068 2012-04-05  Nick Clifton  <nickc@redhat.com>
2069
2070         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2071         (AM_LC_MESSAGES): Add.
2072         * aclocal.m4: Regenerate.
2073         * config.in: Regenerate.
2074         * configure: Regenerate.
2075
2076 2012-03-21  Cary Coutant  <ccoutant@google.com>
2077
2078         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2079         * Makefile.in: Regenerate.
2080         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2081         (Sized_elf_reloc_mapper::symbol_section): New function.
2082         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2083         (make_elf_reloc_mapper): New function.
2084         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2085         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2086         (Dwarf_abbrev_table::do_get_abbrev): New function.
2087         (Dwarf_ranges_table::read_ranges_table): New function.
2088         (Dwarf_ranges_table::read_range_list): New function.
2089         (Dwarf_pubnames_table::read_section): New function.
2090         (Dwarf_pubnames_table::read_header): New function.
2091         (Dwarf_pubnames_table::next_name): New function.
2092         (Dwarf_die::Dwarf_die): New function.
2093         (Dwarf_die::read_attributes): New function.
2094         (Dwarf_die::skip_attributes): New function.
2095         (Dwarf_die::set_name): New function.
2096         (Dwarf_die::set_linkage_name): New function.
2097         (Dwarf_die::attribute): New function.
2098         (Dwarf_die::string_attribute): New function.
2099         (Dwarf_die::int_attribute): New function.
2100         (Dwarf_die::uint_attribute): New function.
2101         (Dwarf_die::ref_attribute): New function.
2102         (Dwarf_die::child_offset): New function.
2103         (Dwarf_die::sibling_offset): New function.
2104         (Dwarf_info_reader::check_buffer): New function.
2105         (Dwarf_info_reader::parse): New function.
2106         (Dwarf_info_reader::do_parse): New function.
2107         (Dwarf_info_reader::do_read_string_table): New function.
2108         (Dwarf_info_reader::lookup_reloc): New function.
2109         (Dwarf_info_reader::get_string): New function.
2110         (Dwarf_info_reader::visit_compilation_unit): New function.
2111         (Dwarf_info_reader::visit_type_unit): New function.
2112         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2113         Sized_elf_reloc_mapper.
2114         (Sized_dwarf_line_info::symbol_section): Remove function.
2115         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2116         (Sized_dwarf_line_info::read_line_mappings): Remove object
2117         parameter, adjust callers.
2118         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2119         * dwarf_reader.h: Include <sys/types.h>.
2120         (class Track_relocs): Remove forward declaration.
2121         (class Elf_reloc_mapper): New class.
2122         (class Sized_elf_reloc_mapper): New class.
2123         (class Dwarf_abbrev_table): New class.
2124         (class Dwarf_range_list): New class.
2125         (class Dwarf_ranges_table): New class.
2126         (class Dwarf_pubnames_table): New class.
2127         (class Dwarf_die): New class.
2128         (class Dwarf_info_reader): New class.
2129         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2130         (Sized_dwarf_line_info::symbol_section): Remove member function.
2131         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2132         base class.
2133         * gdb-index.cc: New source file.
2134         * gdb-index.h: New source file.
2135         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2136         and .debug_types sections, call Layout::add_to_gdb_index.
2137         (Sized_relobj_incr::do_section_name): Implement.
2138         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2139         return type; Implement.
2140         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2141         return type.
2142         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2143         parameter list and return type.
2144         (Sized_incr_dynobj::do_section_contents): Likewise.
2145         * layout.cc: Include gdb-index.h.
2146         (Layout::Layout): Initialize gdb_index_data_.
2147         (Layout::init_fixed_output_section): Check for .gdb_index section.
2148         (Layout::add_to_gdb_index): New function. Instantiate.
2149         * layout.h: Add forward declaration for class Gdb_index.
2150         (Layout::add_to_gdb_index): New member function.
2151         (Layout::gdb_index_data_): New data member.
2152         * main.cc: Include gdb-index.h.
2153         (main): Print statistics for gdb index.
2154         * object.cc (Object::section_contents): Move code into
2155         do_section_contents.
2156         (need_decompressed_section): Check for sections needed when building
2157         gdb index.
2158         (build_compressed_section_map): Likewise.
2159         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2160         gdb index.
2161         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2162         sections; call Layout::add_to_gdb_index.
2163         (Sized_relobj_file::do_decompressed_section_contents): Call
2164         do_section_contents directly.
2165         * object.h (Object::do_section_contents): Adjust parameter list and
2166         return type.
2167         (Object::do_decompressed_section_contents): Call do_section_contents
2168         directly.
2169         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2170         return type.
2171         * options.h (class General_options): Add --gdb-index option.
2172         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2173         list and return type.
2174         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2175         * reloc.h (Track_relocs::checkpoint): New function.
2176         (Track_relocs::reset): New function.
2177
2178         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2179         New test cases.
2180         * testsuite/Makefile.in: Regenerate.
2181         * testsuite/gdb_index_test.cc: New test source file.
2182         * testsuite/gdb_index_test_1.sh: New test source file.
2183         * testsuite/gdb_index_test_2.sh: New test source file.
2184
2185 2012-03-19  Doug Kwan  <dougkwan@google.com>
2186
2187         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2188         (Target_arm::do_finalize_sections): Remove code which defines
2189         __exidx_start and __exidx_end.  Make symbol table parameter
2190         anonymous as it is not used.
2191         * gold.cc (queue_middle_tasks): Call target hook to define any
2192         target-specific symbols.
2193         * target.h (Target::define_standard_symbols): New method.
2194         (Target::do_define_standard_symbols): Same.
2195         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2196         * testsuite/Makefile.in: Regenerate.
2197         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2198         and __exidx_end.
2199         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2200         relocations are generated for __exidx_start and __exidx_end.
2201
2202 2012-03-16  Doug Kwan  <dougkwan@google.com>
2203
2204         * testsuite/Makefile.am: Disable test initpri3b.
2205         * testsuite/Makefile.in: Regenerate.
2206
2207 2012-03-15  Doug Kwan  <dougkwan@google.com>
2208
2209         * arm.cc (Target_arm::got_section): Make .got section read-only
2210         if -z now is given.
2211
2212 2012-03-15  Ian Lance Taylor  <iant@google.com>
2213
2214         PR gold/13850
2215         * layout.cc (Layout::make_output_section): Correctly mark
2216         SHT_INIT_ARRAY, et. al., as relro.
2217
2218 2012-03-14  Doug Kwan  <dougkwan@google.com>
2219
2220         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2221         dynamic relocations for protected symbols in shared objects.
2222
2223 2012-03-13  Ian Lance Taylor  <iant@google.com>
2224
2225         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2226         keep the larger alignment.
2227
2228 2012-03-12  Cary Coutant  <ccoutant@google.com>
2229
2230         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2231         handling of DW_LNE_define_file.
2232
2233 2012-03-12  Cary Coutant  <ccoutant@google.com>
2234
2235         * reduced_debug_output.cc
2236         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2237         codes to switch.
2238
2239 2012-02-29  Cary Coutant  <ccoutant@google.com>
2240
2241         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2242
2243 2012-02-29  Cary Coutant  <ccoutant@google.com>
2244
2245         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2246         Call Object::decompressed_section_contents.
2247         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2248         New dtor.
2249         (Sized_dwarf_line_info::buffer_start_): New data member.
2250         * merge.cc (Output_merge_data::do_add_input_section): Call
2251         Object::decompressed_section_contents.
2252         (Output_merge_string::do_add_input_section): Likewise.
2253         * object.cc (need_decompressed_section): New function.
2254         (build_compressed_section_map): Decompress sections needed later.
2255         (Sized_relobj_file::do_decompressed_section_contents): New function.
2256         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2257         * object.h (Object::decompressed_section_contents): New function.
2258         (Object::discard_decompressed_sections): New function.
2259         (Object::do_decompressed_section_contents): New function.
2260         (Object::do_discard_decompressed_sections): New function.
2261         (Compressed_section_info): New type.
2262         (Compressed_section_map): Include decompressed section contents.
2263         (Sized_relobj_file::do_decompressed_section_contents): New function.
2264         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2265
2266 2012-02-16  Cary Coutant  <ccoutant@google.com>
2267
2268         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2269         * testsuite/Makefile.in: Regenerate.
2270
2271 2012-02-14  Cary Coutant  <ccoutant@google.com>
2272
2273         * options.cc (General_options::finalize): Disallow -pie and -static.
2274
2275 2012-02-03  Doug Kwan  <dougkwan@google.com>
2276
2277         * arm.cc (Arm_relocate_functions::abs8,
2278         Arm_relocate_functions::abs16): Use
2279         Bits::has_signed_unsigned_overflow32.
2280         (Arm_relocate_functions::thm_abs8): Correct range of
2281         overflow check.
2282         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2283         in assertions.
2284
2285 2012-02-02  Doug Kwan  <dougkwan@google.com>
2286
2287         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2288         position independent outputs, not just shared objects.
2289
2290 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2291
2292         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2293         * configure: Regenerated.
2294
2295 2012-01-27  Ian Lance Taylor  <iant@google.com>
2296
2297         * reloc.h (Bits): New class with static functions, copied from
2298         namespace utils in arm.cc.
2299         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2300         instead.
2301
2302 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2303
2304         * incremental.cc (write_info_blocks): Correct relocation offset.
2305
2306 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2307
2308         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2309         (Relocate::tls_gd_to_le): Likewise.
2310
2311 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2312
2313         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2314
2315 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2316
2317         * configure.ac: Check if -mcmodel=medium works.
2318         * configure: Regenerated.
2319
2320 2012-01-24  Cary Coutant  <ccoutant@google.com>
2321
2322         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2323         definition and ...
2324         (read_unsigned_LEB_128_x): ... this new function.
2325         (read_signed_LEB_128): Replaced with inline definition and ...
2326         (read_signed_LEB_128_x): ... this new function.
2327         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2328         (read_unsigned_LEB_128): Add inline definition.
2329         (read_signed_LEB_128_x): New function.
2330         (read_signed_LEB_128): Add inline definition.
2331         * testsuite/Makefile.am (leb128_unittest): New unit test.
2332         * testsuite/Makefile.in: Regenerate.
2333         * testsuite/leb128_unittest.cc: New unit test.
2334
2335 2012-01-23  Ian Lance Taylor  <iant@google.com>
2336
2337         PR gold/13617
2338         * i386.cc (Target_i386::do_code_fill): When using a jmp
2339         instruction, pad with nop instructions.
2340         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2341
2342 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2343
2344         * x86_64.cc (gc_process_relocs): Add typename on types used in
2345         template.
2346         (scan_relocs): Likewise.
2347         (relocate_section): Likewise.
2348         (apply_relocation): Likewise.
2349
2350 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2351
2352         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2353         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2354         under x32.
2355
2356 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2357
2358         * x86_64.cc: Initial support for x32.
2359
2360 2012-01-03  Cary Coutant  <ccoutant@google.com>
2361
2362         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2363         Use abstract base class for GOT.
2364         * gold/output.h (class Output_data_got_base): New abstract base class.
2365         (class Output_data_got): Derive from new base class, adjust ctors.
2366         (Output_data_got::reserve_slot): Make virtual; rename to
2367         do_reserve_slot; Adjust callers.
2368         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2369         pointer to abstract base class.
2370         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2371
2372 2011-12-18  Ian Lance Taylor  <iant@google.com>
2373
2374         * object.h (Relobj::local_symbol_value): New function.
2375         (Relobj::local_plt_offset): New function.
2376         (Relobj::local_has_got_offset): New function.
2377         (Relobj::local_got_offset): New function.
2378         (Relobj::set_local_got_offset): New function.
2379         (Relobj::do_local_symbol_value): New pure virtual function.
2380         (Relobj::do_local_plt_offset): Likewise.
2381         (Relobj::do_local_has_got_offset): Likewise.
2382         (Relobj::do_local_got_offset): Likewise.
2383         (Relobj::do_set_local_got_offset): Likewise.
2384         (Sized_relobj::do_local_has_got_offset): Rename from
2385         local_has_got_offset.
2386         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2387         (Sized_relobj::do_set_local_got_offset): Rename from
2388         set_local_got_offset.
2389         (Sized_relobj_file::do_local_plt_offset): Rename from
2390         local_plt_offset.
2391         (Sized_relobj_file::do_local_symbol_value): New function.
2392         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2393         local_plt_offset.
2394         * output.cc (Output_data_got::Got_entry::write): Change object to
2395         Relobj.  Use local_symbol_value.
2396         (Output_data_got::add_global_with_rel): Change rel_dyn to
2397         Output_data_reloc_generic*.  Use add_global_generic.
2398         (Output_data_got::add_global_with_rela): Remove.  Change all
2399         callers to use add_global_with_rel.
2400         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2401         Output_data_reloc_generic*.  Use add_global_generic.
2402         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2403         callers to use add_global_pair_with_rel.
2404         (Output_data_got::add_local): Change object to Relobj*.
2405         (Output_data_got::add_local_plt): Likewise.
2406         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2407         change rel_dyn to Output_data_reloc_generic*.  Use
2408         add_local_generic.
2409         (Output_data_got::add_local_with_rela): Remove.  Change all
2410         callers to use all_local_with_rel.
2411         (Output_data_got::add_local_pair_with_rel): Change object to
2412         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2413         add_output_section_generic.
2414         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2415         callers to use add_local_pair_with_rel.
2416         (Output_data_got::reserve_local): Change object to Relobj*.
2417         * output.h: (class Output_data_reloc_generic): Add pure virtual
2418         declarations for add_global_generic, add_local_generic,
2419         add_output_section_generic.
2420         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2421         functions for Output_data_reloc_generic.  Update declarations for
2422         changes listed in output.cc.
2423         (class Output_data_got): Change template parameter to got_size.
2424         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2425         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2426         function.
2427         (Sized_relobj_incr::do_local_plt_offset): New function.
2428         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2429         add_global_generic.
2430
2431 2011-12-17  Cary Coutant  <ccoutant@google.com>
2432
2433         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2434         * resolve.cc (Symbol_table::resolve): Likewise.
2435         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2436         arrays.
2437         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2438
2439 2011-12-16  Ian Lance Taylor  <iant@google.com>
2440
2441         * output.h (Output_data_reloc_generic::add): Only call
2442         add_dynamic_reloc if this is a dynamic reloc section.
2443
2444 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2445
2446         PR gold/13505
2447         * target-reloc.h (apply_relocation): Replace <64, false> with
2448         <size, big_endian>.
2449
2450 2011-11-25  Nick Clifton  <nickc@redhat.com>
2451
2452         * po/it.po: New Italian translation.
2453
2454 2011-11-17  Sterling Augustine  <saugustine@google.com>
2455
2456         * script.cc (script_include_directive): Implement.
2457         (read_script_file): New local variables name and search_path. Update
2458         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2459         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2460         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2461
2462 2011-11-11  Sterling Augustine  <saugustine@google.com>
2463
2464         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2465         (file_or_sections_cmd): Likewise.
2466
2467 2011-11-11  Doug Kwan  <dougkwan@google.com>
2468
2469         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2470         if --just-symbols is given.
2471
2472 2011-11-10  Doug Kwan  <dougkwan@google.com>
2473
2474         PR gold/13362
2475         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2476         when processing data relocs.
2477         * reloc.h (Relocate_functions::rel_unaligned): New method.
2478         (Relocate_functions::pcrel_unaligned): Ditto.
2479         (Relocate_functions::rel32_unaligned): Ditto.
2480         (Relocate_functions::pcrel32_unaligned): Ditto.
2481
2482 2011-11-09  Doug Kwan  <dougkwan@google.com>
2483
2484         PR gold/13362
2485         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2486         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2487         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2488         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2489         (Relocate_functions::rel_unaligned): New.
2490         (Relocate_functions::rel32_unaligned): New.
2491         * target-reloc.h (relocate_for_relocatable): Add code to handle
2492         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2493         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2494         arm_unaligned_reloc_r): New targets.
2495         * testsuite/Makefile.in: Regenerate.
2496         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2497         linking.
2498
2499 2011-11-02  Ian Lance Taylor  <iant@google.com>
2500
2501         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2502         NATIVE_LINKER.
2503         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2504         * options.cc (General_options::finalize): Use library search path
2505         from configure script if specified.  If not native and no sysroot,
2506         only search TOOLLIBDIR.
2507         * options.h (Search_directory::Search_directory): Change name to
2508         const std::string&.
2509         (General_options::add_to_library_path_with_sysroot): Change arg to
2510         const std::string&.
2511         * configure, Makefile.in, config.in: Rebuild.
2512
2513 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2514
2515         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2516         we are working around the ARM1176 Erratum.
2517         * options.h (General_options::fix_arm1176): Add option.
2518         * testsuite/Makefile.am: Add testcases, and keep current ones
2519         working.
2520         * testsuite/Makefile.in: Regenerate.
2521         * testsuite/arm_fix_1176.s: New file.
2522         * testsuite/arm_fix_1176.sh: Likewise.
2523
2524 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2525
2526         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2527         may_use_blx_.
2528         (Target_arm::may_use_blx): Remove method.
2529         (Target_arm::set_may_use_blx): Likewise.
2530         (Target_arm::may_use_v4t_interworking): New method.
2531         (Target_arm::may_use_v5t_interworking): Likewise.
2532         (Target_arm::may_use_blx_): Remove member variable.
2533         (Arm_relocate_functions::arm_branch_common): Check for v5T
2534         interworking.
2535         (Arm_relocate_functions::thumb_branch_common): Likewise.
2536         (Reloc_stub::stub_type_for_reloc): Likewise.
2537         (Target_arm::do_finalize_sections): Correct interworking checks.
2538         * testsuite/Makefile.am: Add new tests.
2539         * testsuite/Makefile.in: Regenerate.
2540         * testsuite/arm_farcall_arm_arm.s: New test.
2541         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2542         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2543         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2544         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2545         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2546         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2547         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2548
2549 2011-10-31  Cary Coutant  <ccoutant@google.com>
2550
2551         PR gold/13023
2552         * expression.cc (Expression::eval_with_dot): Add
2553         is_section_dot_assignment parameter.
2554         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2555         absolute and assigning to dot within a section.
2556         * script-sections.cc
2557         (Output_section_element_assignment::set_section_addresses): Pass
2558         dot_section to set_if_absolute.
2559         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2560         as is_section_dot_assignment flag to eval_with_dot.
2561         (Output_section_element_dot_assignment::set_section_addresses):
2562         Likewise.
2563         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2564         parameter.  Also set value if relative to dot_section; set the
2565         symbol's output_section.
2566         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2567         parameter.  Adjust all callers.
2568         (Expression::eval_maybe_dot): Likewise.
2569         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2570         Adjust all callers.
2571         * testsuite/script_test_2.t: Test assignment of an absolute value
2572         to dot within an output section element.
2573
2574 2011-10-31  Cary Coutant  <ccoutant@google.com>
2575
2576         * options.h (class General_options): Add --[no-]gnu-unique options.
2577         * symtab.cc (Symbol_table::sized_write_globals): Convert
2578         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2579
2580 2011-10-31  Cary Coutant  <ccoutant@google.com>
2581
2582         PR gold/13359
2583         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2584         unnecessary assertion.
2585         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2586
2587 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2588
2589         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2590         gc_mark_symbol.
2591         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2592         gc_mark_symbol.
2593         Change to just keep the section associated with symbol.
2594         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2595         they are externally visible and --export-dynamic is turned on.
2596         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2597
2598 2011-10-19  Ian Lance Taylor  <iant@google.com>
2599
2600         PR gold/13163
2601         * script-sections.cc
2602         (Output_section_element_dot_assignment::needs_output_section): New
2603         function.
2604
2605 2011-10-19  Ian Lance Taylor  <iant@google.com>
2606
2607         PR gold/13204
2608         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2609         --section-start option was seen.
2610         * options.h (General_options::any_section_start): New function.
2611
2612 2011-10-18  David S. Miller  <davem@davemloft.net>
2613
2614         PR binutils/13301
2615         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2616         member to track relocation locations that have moved during TLS
2617         reloc optimizations.
2618         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2619         (Target_sparc::Relocate::relocate): Adjust view down by 4
2620         bytes if it matches reloc_adjust_addr_.
2621         (Target_sparc::Relocate::relocate_tls): Always move the
2622         __tls_get_addr call delay slot instruction forward 4 bytes when
2623         performing relaxation.
2624
2625 2011-10-18  Cary Coutant  <ccoutant@google.com>
2626
2627         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2628         (Output_file::map_no_anonymous): Check for non-zero
2629         return code from posix_fallocate.
2630
2631 2011-10-17  Cary Coutant  <ccoutant@google.com>
2632
2633         PR gold/13245
2634         * plugin.cc (is_visible_from_outside): Check for symbols
2635         referenced from dynamic objects.
2636         * resolve.cc (Symbol_table::resolve): Don't count references
2637         from dynamic objects as references from real ELF files.
2638         * testsuite/plugin_test_2.sh: Adjust expected result.
2639
2640 2011-10-17  Cary Coutant  <ccoutant@google.com>
2641
2642         * gold.cc: Include timer.h.
2643         (queue_middle_tasks): Stamp time.
2644         (queue_final_tasks): Likewise.
2645         * main.cc (main): Store timer in parameters.  Print timers
2646         for each pass.
2647         * parameters.cc (Parameters::Parameters): Initialize timer_.
2648         (Parameters::set_timer): New function.
2649         (set_parameters_timer): New function.
2650         * parameters.h (Parameters::set_timer): New function.
2651         (Parameters::timer): New function.
2652         (Parameters::timer_): New data member.
2653         (set_parameters_timer): New function.
2654         * timer.cc (Timer::stamp): New function.
2655         (Timer::get_pass_time): New function.
2656         * timer.h (Timer::stamp): New function.
2657         (Timer::get_pass_time): New function.
2658         (Timer::pass_times_): New data member.
2659
2660 2011-10-17  Cary Coutant  <ccoutant@google.com>
2661
2662         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2663         task for members of lib groups.
2664
2665 2011-10-17  Cary Coutant  <ccoutant@google.com>
2666
2667         PR gold/13288
2668         * fileread.cc (File_read::find_view): Add assert.
2669         (File_read::make_view): Move bounds check (replace with assert)...
2670         (File_read::find_or_make_view): ... to here.
2671
2672 2011-10-12  Cary Coutant  <ccoutant@google.com>
2673
2674         * output.cc (Output_file::open_base_file): Handle case where
2675         ::read returns less than requested size.
2676
2677 2011-10-10  Cary Coutant  <ccoutant@google.com>
2678
2679         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2680         Initialize defined_count_.
2681         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2682         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2683         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2684         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2685         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2686         * incremental.h (Sized_relobj_incr::defined_count_): New data
2687         member.
2688         (Sized_incr_dynobj::defined_count_): New data member.
2689         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2690         Return zeroes instead of internal error.
2691
2692 2011-10-10  Cary Coutant  <ccoutant@google.com>
2693
2694         PR gold/13249
2695         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2696         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2697         * output.h (class Output_reloc): Add use_plt_offset flag.
2698         (Output_reloc::type_): Adjust size of bit field.
2699         (Output_reloc::use_plt_offset_): New bit field.
2700         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2701         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2702         flag.  Adjust all callers.
2703         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2704         creating RELATIVE relocations.
2705
2706 2011-10-10  Nick Clifton  <nickc@redhat.com>
2707
2708         * po/es.po: Updated Spanish translation.
2709         * po/fi.po: Updated Finnish translation.
2710
2711 2011-10-03   Diego Novillo  <dnovillo@google.com>
2712
2713         * options.cc (parse_uint): Fix dereference of RETVAL.
2714
2715 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2716
2717         * layout.h (section_order_map_): New member.
2718         (get_section_order_map): New member function.
2719         * output.cc (Output_section::add_input_section): Check for patterns
2720         only when --section-ordering-file is specified.
2721         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2722         output_sections have been formed.
2723         * layout.cc (Layout_Layout): Initialize section_order_map_.
2724         * plugin.cc (update_section_order): Store order in order_map. Do not
2725         update the order.
2726         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2727         * testsuite/Makefile.in: Regenerate.
2728         * testsuite/plugin_section_order.c: New file.
2729         * testsuite/plugin_final_layout.cc: New file.
2730         * testsuite/plugin_final_layout.sh: New file.
2731
2732 2011-09-29  Cary Coutant  <ccoutant@google.com>
2733
2734         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2735         Check for NULL.
2736         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2737         symbols during incremental update.
2738         (Symbol_table::add_from_dynobj): Likewise.
2739
2740 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2741             Ian Lance Taylor  <iant@google.com>
2742
2743         * symtab.cc (Symbol_table::define_special_symbol): Always
2744         canonicalize version string.
2745
2746 2011-09-26  Cary Coutant  <ccoutant@google.com>
2747
2748         * gold.cc (queue_initial_tasks): Move option checks ...
2749         * options.cc (General_options::finalize): ... to here. Disable
2750         some options; make others fatal.
2751
2752 2011-09-26  Cary Coutant  <ccoutant@google.com>
2753
2754         gcc PR lto/47247
2755         * plugin.cc (get_symbols_v2): New function.
2756         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2757         (is_referenced_from_outside): New function.
2758         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2759         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2760         (get_symbols): Pass version parameter.
2761         (get_symbols_v2): New function.
2762         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2763         parameter.
2764         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2765         (onload): Add LDPT_GET_SYMBOLS_V2.
2766         (all_symbols_read_hook): Use get_symbols_v2; check for
2767         LDPR_PREVAILING_DEF_IRONLY_EXP.
2768         * testsuite/plugin_test_3.sh: Update expected results.
2769
2770 2011-09-23  Simon Baldwin  <simonb@google.com>
2771
2772         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2773         configuration options.
2774         * configure: Regenerate.
2775         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2776         * Makefile.in: Regenerate.
2777         * testsuite/Makefile.in: Regenerate.
2778
2779 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2780
2781         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2782
2783 2011-09-19  Cary Coutant  <ccoutant@google.com>
2784
2785         * incremental.cc (can_incremental_update): Fix typo in comment.
2786         * incremental.h (can_incremental_update): Likewise.
2787
2788 2011-09-18  Cary Coutant  <ccoutant@google.com>
2789
2790         * incremental.cc (can_incremental_update): New function.
2791         * incremental.h (can_incremental_update): New function.
2792         * layout.cc (Layout::init_fixed_output_section): Call it.
2793         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2794         * object.cc (Sized_relobj_file::do_layout): Call
2795         can_incremental_update.
2796
2797 2011-09-13  Cary Coutant  <ccoutant@google.com>
2798
2799         * configure.ac: Check for glibc support for gnu_indirect_function
2800         support with static linking, setting automake conditional
2801         IFUNC_STATIC.
2802         * Makefile.in: Regenerate.
2803         * configure: Regenerate.
2804
2805         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2806         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2807         for IFUNC_STATIC.
2808         * testsuite/Makefile.in: Regenerate.
2809
2810 2011-09-13  Cary Coutant  <ccoutant@google.com>
2811
2812         * incremental.cc (Sized_relobj_incr::do_layout): Call
2813         report_comdat_group for kept comdat sections.
2814         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2815         * testsuite/Makefile.in: Regenerate.
2816         * testsuite/incr_comdat_test_1.cc: New source file.
2817         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2818         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2819         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2820
2821 2011-09-13  Ian Lance Taylor  <iant@google.com>
2822
2823         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2824         variable external_symbols_offset.
2825
2826 2011-09-12  Ian Lance Taylor  <iant@google.com>
2827
2828         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2829         triggered if object has no symbols.
2830
2831 2011-09-09  David S. Miller  <davem@davemloft.net>
2832
2833         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2834         (Output_fill_debug_line::do_write): Likewise.
2835
2836 2011-08-29  Cary Coutant  <ccoutant@google.com>
2837
2838         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2839         casts to match formatting specs.
2840         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2841
2842 2011-08-26  Cary Coutant  <ccoutant@google.com>
2843
2844         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2845         remaining hole size when allocating.
2846         (Layout::make_output_section): Set fill methods for debug sections.
2847         * layout.h (Free_list::Free_list_node): Move from private to
2848         public.
2849         (Free_list::set_min_hole_size): New function.
2850         (Free_list::begin, Free_list::end): New functions.
2851         (Free_list::min_hole_): New data member.
2852         * output.cc: Include dwarf.h.
2853         (Output_fill_debug_info::do_minimum_hole_size): New function.
2854         (Output_fill_debug_info::do_write): New function.
2855         (Output_fill_debug_line::do_minimum_hole_size): New function.
2856         (Output_fill_debug_line::do_write): New function.
2857         (Output_section::Output_section): Initialize new data member.
2858         (Output_section::set_final_data_size): Ensure patch space is larger
2859         than minimum hole size.
2860         (Output_section::do_write): Fill holes in debug sections.
2861         * output.h (Output_fill): New class.
2862         (Output_fill_debug_info): New class.
2863         (Output_fill_debug_line): New class.
2864         (Output_section::set_free_space_fill): New function.
2865         (Output_section::free_space_fill_): New data member.
2866         * testsuite/Makefile.am (incremental_test_3): Add
2867         --incremental-patch option.
2868         (incremental_test_4): Likewise.
2869         (incremental_test_5): Likewise.
2870         (incremental_test_6): Likewise.
2871         (incremental_copy_test): Likewise.
2872         (incremental_common_test_1): Likewise.
2873         * testsuite/Makefile.in: Regenerate.
2874
2875 2011-08-26  Nick Clifton  <nickc@redhat.com>
2876
2877         * po/es.po: Updated Spanish translation.
2878
2879 2011-08-01  Cary Coutant  <ccoutant@google.com>
2880
2881         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2882         * gold/testsuite/Makefile.in: Regenerate.
2883         * gold/testsuite/justsyms_exec.c: New source file.
2884         * gold/testsuite/justsyms_lib.c: New source file.
2885
2886 2011-08-01  Cary Coutant  <ccoutant@google.com>
2887
2888         * layout.cc (Layout::set_segment_offsets): Don't realign text
2889         segment if -Ttext was specified.
2890         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2891         file type.
2892         * object.h (Sized_relobj_file::e_type): New function.
2893         (Sized_relobj_file::e_type_): New data member.
2894         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2895         base address for ET_EXEC files.
2896         * target.cc (Target::do_make_elf_object_implementation): Allow
2897         ET_EXEC files with --just-symbols option.
2898
2899 2011-07-28  Cary Coutant  <ccoutant@google.com>
2900
2901         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2902         Add thread_number parameter.
2903         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2904         * workqueue-threads.cc
2905         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2906         current thread if its thread number is greater than desired thread
2907         count.
2908         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2909         Add thread_number parameter.
2910         (Workqueue::should_cancel_thread): Likewise.
2911         (Workqueue::find_runnable_or_wait): Pass thread_number to
2912         should_cancel_thread.
2913         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2914         parameter.
2915
2916 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2917
2918         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2919         only after checking if it cannot be forced local.
2920         * symtab.h (is_externally_visible): Check if the symbol is not forced
2921         local.
2922
2923 2011-07-15  Ian Lance Taylor  <iant@google.com>
2924
2925         * options.h (class General_options): Add --print-output-format.
2926         Move -EL next to -EB, for  better --help output.
2927         * target-select.cc: Include <cstdio>, "options.h", and
2928         "parameters.h".
2929         (Target_selector::do_target_bfd_name): New function.
2930         (print_output_format): New function.
2931         * target-select.h (class Target_selector): Update declarations.
2932         (Target_selector::target_bfd_name): New function.
2933         (print_output_format): Declare.
2934         * main.cc: Include "target-select.h".
2935         (main): Handle --print-output-format.
2936         * gold.cc: Include "target-select.h".
2937         (queue_initial_tasks): Handle --print-output-format when there are
2938         no input files.
2939         * parameters.cc (parameters_force_valid_target): Give a better
2940         error message if -EB/-EL does not match target.
2941         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2942         function.
2943
2944 2011-07-15  Ian Lance Taylor  <iant@google.com>
2945
2946         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2947         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2948         (Output_data_plt_i386::do_write): Write address of .dynamic
2949         section to first entry in .got.plt section.
2950         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2951         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2952         Initialize layout_.
2953         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2954         section to first entry in .got.plt section.
2955         * layout.h (Layout::dynamic_section): New function.
2956
2957 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2958
2959         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2960         to claim_file call.
2961         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2962         input_section_position_, and input_section_glob_.
2963         (read_layout_from_file): Call function section_ordering_specified.
2964         * layout.h (is_section_ordering_specified): New function.
2965         (section_ordering_specified): New function.
2966         (section_ordering_specified_): New boolean member.
2967         * main.cc(main): Call load_plugins after layout object is defined.
2968         * output.cc (Output_section::add_input_section): Use
2969         function section_ordering_specified to check if section ordering is
2970         needed.
2971         * output.cc (Output_section::add_relaxed_input_section): Use
2972         function section_ordering_specified to check if section ordering is
2973         needed.
2974         (Output_section::update_section_layout): New function.
2975         (Output_section::sort_attached_input_sections): Check if input section
2976         must be reordered.
2977         * output.h (Output_section::update_section_layout): New function.
2978         * plugin.cc (get_section_count): New function.
2979         (get_section_type): New function.
2980         (get_section_name): New function.
2981         (get_section_contents): New function.
2982         (update_section_order): New function.
2983         (allow_section_ordering): New function.
2984         (Plugin::load): Add the new interfaces to the transfer vector.
2985         (Plugin_manager::load_plugins): New parameter.
2986         (Plugin_manager::all_symbols_read): New parameter.
2987         (Plugin_manager::claim_file): New parameter. Save the elf object for
2988         unclaimed objects.
2989         (Plugin_manager::get_elf_object): New function.
2990         (Plugin_manager::get_view): Change to directly use the bool to check
2991         if get_view is called from claim_file_hook.
2992         * plugin.h (input_objects): New function
2993         (Plugin__manager::load_plugins): New parameter.
2994         (Plugin_manager::claim_file): New parameter.
2995         (Plugin_manager::get_elf_object): New function.
2996         (Plugin_manager::in_claim_file_handler): New function.
2997         (Plugin_manager::in_claim_file_handler_): New member.
2998         (layout): New function.
2999         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3000         handler with an extra parameter. Make the elf object before calling
3001         claim_file handler.
3002         * testsuite/plugin_test.c (get_section_count): New function pointer.
3003         (get_section_type): New function pointer.
3004         (get_section_name): New function pointer.
3005         (get_section_contents): New function pointer.
3006         (update_section_order): New function pointer.
3007         (allow_section_ordering): New function pointer.
3008         (onload): Check if the new interfaces exist.
3009
3010 2011-07-13  Ian Lance Taylor  <iant@google.com>
3011
3012         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3013         relro section.
3014         * x86_64.cc (Target_x86_64::got_section): Likewise.
3015         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3016         (relro_now_test_SOURCES): New variable.
3017         (relro_now_test_DEPENDENCIES): New variable.
3018         (relro_now_test_LDFLAGS): New variable.
3019         (relro_now_test_LDADD): New variable.
3020         (relro_now_test.so): New target.
3021         * testsuite/Makefile.in: Rebuild.
3022
3023 2011-07-12  Ian Lance Taylor  <iant@google.com>
3024
3025         PR gold/12980
3026         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3027         GLOB_DAT relocation rather than a RELATIVE relocation for a
3028         protected symbol when creating a shared library.
3029         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3030         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3031         * testsuite/protected_main_1.cc (main): Test that protected
3032         function has same address.
3033
3034 2011-07-11  Ian Lance Taylor  <iant@google.com>
3035
3036         PR gold/12979
3037         * options.h (class General_options): Add -Bgroup.
3038         * options.cc (General_options::finalize): If -Bgroup is set,
3039         default to --unresolved-symbols=report-all.
3040         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3041         * target-reloc.h (issue_undefined_symbol_error): Handle
3042         --unresolved-symbols=report-all.
3043
3044 2011-07-08  Ian Lance Taylor  <iant@google.com>
3045
3046         PR gold/11985
3047         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3048         if linker script discards key sections.
3049         (Layout::create_dynamic_symtab): Likewise.
3050         (Layout::assign_local_dynsym_offsets): Likewise.
3051         (Layout::sized_create_version_sections): Likewise.
3052         (Layout::create_interp): Likewise.
3053         (Layout::finish_dynamic_section): Likewise.
3054         (Layout::set_dynamic_symbol_size): Likewise.
3055
3056 2011-07-08  Ian Lance Taylor  <iant@google.com>
3057
3058         PR gold/12386
3059         * options.h (class General_options): Add --unresolved-symbols.
3060         * target-reloc.h (issue_undefined_symbol_error): Check
3061         --unresolved-symbols.  Add comments.
3062
3063 2011-07-08  Ian Lance Taylor  <iant@google.com>
3064
3065         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3066         expression more complex.
3067
3068 2011-07-08  Ian Lance Taylor  <iant@google.com>
3069
3070         PR gold/11317
3071         * target-reloc.h (issue_undefined_symbol_error): New inline
3072         function, broken out of relocate_section.
3073         (relocate_section): Call issue_undefined_symbol_error.
3074         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3075         there is no TLS segment if we are about to issue an undefined
3076         symbol error.
3077         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3078
3079 2011-07-08  Ian Lance Taylor  <iant@google.com>
3080
3081         PR gold/12279
3082         * resolve.cc (Symbol_table::should_override): Add fromtype
3083         parameter.  Change all callers.  Give error when linking together
3084         TLS and non-TLS symbol.
3085         (Symbol_table::should_override_with_special): Add fromtype
3086         parameter.  Change all callers.
3087         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3088         there is no TLS segment if we have reported some errors.
3089         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3090
3091 2011-07-08  Ian Lance Taylor  <iant@google.com>
3092
3093         PR gold/12372
3094         * target.h (Target::plt_address_for_global): New function.
3095         (Target::plt_address_for_local): New function.
3096         (Target::plt_section_for_global): Remove.
3097         (Target::plt_section_for_local): Remove.
3098         (Target::do_plt_address_for_global): New virtual function.
3099         (Target::do_plt_address_for_local): New virtual function.
3100         (Target::do_plt_section_for_global): Remove.
3101         (Target::do_plt_section_for_local): Remove.
3102         (Target::register_global_plt_entry): Add Symbol_table and Layout
3103         parameters.
3104         * output.cc (Output_data_got::Got_entry::write): Use
3105         plt_address_for_global and plt_address_for_local.
3106         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3107         address of output section.
3108         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3109         got_irelative_, and irelative_count_ fields.  Update
3110         declarations.
3111         (Output_data_plt_i386::has_irelative_section): New function.
3112         (Output_data_plt_i386::entry_count): Add irelative_count_.
3113         (Output_data_plt_i386::set_final_data_size): Likewise.
3114         (class Target_i386): Add got_irelative_ and rel_irelative_
3115         fields.  Update declarations.
3116         (Target_i386::Target_i386): Initialize new fields.
3117         (Target_i386::do_plt_address_for_global): New function replacing
3118         do_plt_section_for_global.
3119         (Target_i386::do_plt_address_for_local): New function replacing
3120         do_plt_section_for_local.
3121         (Target_i386::got_section): Create got_irelative_.
3122         (Target_i386::rel_irelative_section): New function.
3123         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3124         fields.  Don't define __rel_iplt_{start,end}.
3125         (Output_data_plt_i386::add_entry): Add symtab and layout
3126         parameters.  Change all callers.  Use different PLT and GOT for
3127         IFUNC symbols.
3128         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3129         layout parameters.  Change all callers.  Use different PLT and
3130         GOT.
3131         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3132         (Output_data_plt_i386::rel_irelative): New function.
3133         (Output_data_plt_i386::address_for_global): New function.
3134         (Output_data_plt_i386::address_for_local): New function.
3135         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3136         IRELATIVE GOT when changing IFUNC GOT entries.
3137         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3138         reloc.
3139         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3140         if we didn't create an IRELATIVE GOT.
3141         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3142         plt_address_for_local.
3143         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3144         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3145         got_irelative_, and irelative_count_ fields.  Update
3146         declarations.
3147         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3148         Initialize new fields.  Remove symtab parameter.  Change all
3149         callers.
3150         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3151         irelative_count_.
3152         (Output_data_plt_x86_64::has_irelative_section): New function.
3153         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3154         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3155         fields.  Update declarations.
3156         (Target_x86_64::Target_x86_64): Initialize new fields.
3157         (Target_x86_64::do_plt_address_for_global): New function replacing
3158         do_plt_section_for_global.
3159         (Target_x86_64::do_plt_address_for_local): New function replacing
3160         do_plt_section_for_local.
3161         (Target_x86_64::got_section): Create got_irelative_.
3162         (Target_x86_64::rela_irelative_section): New function.
3163         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3164         all callers.  Don't create __rel_iplt_{start,end}.
3165         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3166         parameters.  Change all callers.  Use different PLT and GOT for
3167         IFUNC symbols.
3168         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3169         layout parameters.  Change all callers.  Use different PLT and
3170         GOT.
3171         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3172         parameters.  Change all callers.  Use different PLT and GOT for
3173         IFUNC symbols.
3174         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3175         (Output_data_plt_x86_64::rela_irelative): New function.
3176         (Output_data_plt_x86_64::address_for_global): New function.
3177         (Output_data_plt_x86_64::address_for_local): New function.
3178         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3179         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3180         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3181         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3182         parameters.
3183         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3184         reloc.
3185         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3186         symbols if we didn't create an IRELATIVE GOT.
3187         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3188         plt_address_for_local.
3189         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3190         * testsuite/ifuncvar1.c: New test file.
3191         * testsuite/ifuncvar2.c: New test file.
3192         * testsuite/ifuncvar3.c: New test file.
3193         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3194         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3195         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3196         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3197         * testsuite/Makefile.in: Rebuild.
3198
3199 2011-07-07  Cary Coutant  <ccoutant@google.com>
3200
3201         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3202         (two_file_test_1_ndebug.o): Likewise.
3203         (two_file_test_1b_ndebug.o): Likewise.
3204         (two_file_test_2_ndebug.o): Likewise.
3205         (two_file_test_main_ndebug.o): Likewise.
3206         (incremental_test_2): Link with no-debug versions.
3207
3208 2011-07-06  Cary Coutant  <ccoutant@google.com>
3209
3210         * gold/incremental.cc
3211         (Output_section_incremental_inputs::write_info_blocks): Check for
3212         hidden and internal symbols.
3213
3214 2011-07-06  Cary Coutant  <ccoutant@google.com>
3215
3216         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3217         Check disposition for startup file.
3218         (Incremental_inputs::report_command_line): Ignore
3219         --incremental-startup-unchanged option.
3220         * options.cc (General_options::parse_incremental_startup_unchanged):
3221         New function.
3222         (General_options::General_options): Initialize new data member.
3223         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3224         (General_options): Add --incremental-startup-unchanged option.
3225         (General_options::incremental_startup_disposition): New function.
3226         (General_options::incremental_startup_disposition_): New data member.
3227
3228 2011-07-06  Cary Coutant  <ccoutant@google.com>
3229
3230         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3231         input file index to Script_info ctor.
3232         (Sized_incremental_binary::do_file_has_changed): Find the
3233         command-line argument for files named in scripts.
3234         * incremental.h (Script_info::Script_info): New ctor
3235         with input file index.
3236         (Script_info::input_file_index): New function.
3237         (Script_info::input_file_index_): New data member.
3238         (Incremental_binary::get_library): Add const.
3239         (Incremental_binary::get_script_info): Add const.
3240         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3241         * testsuite/Makefile.am (incremental_test_5): New test case.
3242         (incremental_test_6): New test case.
3243         * testsuite/Makefile.in: Regenerate.
3244
3245 2011-07-06  Cary Coutant  <ccoutant@google.com>
3246
3247         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3248         debug output when command lines differ.
3249
3250 2011-07-06  Cary Coutant  <ccoutant@google.com>
3251
3252         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3253         --incremental-patch option.
3254         * layout.cc (Free_list::allocate): Extend allocation beyond original
3255         end if enabled.
3256         (Layout::make_output_section): Mark sections that should get
3257         patch space.
3258         * options.cc (parse_percent): New function.
3259         * options.h (parse_percent): New function.
3260         (DEFINE_percent): New macro.
3261         (General_options): Add --incremental-patch option.
3262         * output.cc (Output_section::Output_section): Initialize new data
3263         members.
3264         (Output_section::add_input_section): Print section name when out
3265         of patch space.
3266         (Output_section::add_output_section_data): Likewise.
3267         (Output_section::set_final_data_size): Add patch space when
3268         doing --incremental-full.
3269         (Output_section::do_reset_address_and_file_offset): Remove patch
3270         space.
3271         (Output_segment::set_section_list_addresses): Print debug output
3272         only if --incremental-update.
3273         * output.h (Output_section::set_is_patch_space_allowed): New function.
3274         (Output_section::is_patch_space_allowed_): New data member.
3275         (Output_section::patch_space_): New data member.
3276         * parameters.cc (Parameters::incremental_full): New function.
3277         * parameters.h (Parameters::incremental_full): New function
3278         * testsuite/Makefile.am (incremental_test_2): Add test for
3279         --incremental-patch option.
3280         * testsuite/Makefile.in: Regenerate.
3281         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3282         (t18): Remove function body.
3283
3284 2011-07-05  Doug Kwan  <dougkwan@google.com>
3285
3286         PR gold/12771
3287         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3288         Arm_Address type for relocation result.
3289         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3290         overflow check.
3291         (Arm_relocate_functions::abs32): Use unaligned access.
3292         (Arm_relocate_functions::rel32): Ditto.
3293         (Arm_relocate_functions::prel31): Ditto.
3294         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3295         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3296         static data relocations.
3297         * testsuite/Makefile.in: Regnerate.
3298         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3299
3300 2011-07-05  Ian Lance Taylor  <iant@google.com>
3301
3302         PR gold/12392
3303         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3304         symbols if necessary.
3305         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3306
3307 2011-07-05  Ian Lance Taylor  <iant@google.com>
3308
3309         PR gold/12952
3310         * resolve.cc (Symbol::override_base_with_special): Simply override
3311         version with special symbol version, ignoring previous version.
3312
3313 2011-07-05  Ian Lance Taylor  <iant@google.com>
3314
3315         * object.cc (Sized_relobj_file::include_section_group): Add
3316         information to comment about signature location.
3317
3318 2011-07-02  Ian Lance Taylor  <iant@google.com>
3319
3320         PR gold/12957
3321         * options.h (class General_options): Add -f and -F.
3322         * options.cc (General_options::finalize): Fatal error if -f/-F
3323         are used without -shared.
3324         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3325
3326 2011-07-02  Ian Lance Taylor  <iant@google.com>
3327
3328         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3329
3330 2011-07-01  Ian Lance Taylor  <iant@google.com>
3331
3332         PR gold/12525
3333         PR gold/12952
3334         * resolve.cc (Symbol::override_base_with_special): Don't override
3335         the version if the overriding symbol has a different name.
3336         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3337         all callers.  If we give an error about an undefined version,
3338         define the base version if necessary.
3339         * dynobj.h (class Versions): Update declaration.
3340         * testsuite/weak_alias_test_5.cc: New file.
3341         * testsuite/weak_alias_test.script: New file.
3342         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3343         and versioned_alias have the right value, and call t2.
3344         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3345         weak_alias_test_5.so.
3346         (weak_alias_test_LDADD): Likewise.
3347         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3348         * testsuite/Makefile.in: Rebuild.
3349
3350 2011-07-01  Ian Lance Taylor  <iant@google.com>
3351
3352         PR gold/12525
3353         * options.h (class General_options): Support -z notext.
3354         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3355         -Wl,-z,notext.
3356         (two_file_shared_nonpic.so): Likewise.
3357         (two_file_shared_mixed.so): Likewise.
3358         (two_file_shared_mixed_1.so): Likewise.
3359         (weak_undef_lib_nonpic.so): Likewise.
3360         (alt/weak_undef_lib_nonpic.so): Likewise.
3361         (tls_test_shared_nonpic.so): Likewise.
3362         * testsuite/Makefile.in: Rebuild.
3363
3364 2011-07-01  Ian Lance Taylor  <iant@google.com>
3365
3366         PR gold/12525
3367         * configure.ac: Test whether static linking works, setting
3368         the automake conditional HAVE_STATIC.
3369         * testsuite/Makefile.am: Disable tests using -static if
3370         HAVE_STATIC is not true.
3371         * configure, testsuite/Makefile.in: Rebuild.
3372
3373 2011-07-01  Ian Lance Taylor  <iant@google.com>
3374
3375         PR gold/12525
3376         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3377         Assert if we see DW_EH_PE_indirect.
3378         * target.h (Target::ehframe_datarel_base): New function.
3379         (Target::do_ehframe_datarel_base): New target function.
3380         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3381         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3382         function.
3383
3384 2011-07-01  Ian Lance Taylor  <iant@google.com>
3385
3386         PR gold/12571
3387         * options.h (class General_options): Add
3388         --ld-generated-unwind-info.
3389         * ehframe.cc (Fde::write): Add address parameter.  Change all
3390         callers.  If associated with PLT, fill in address and size.
3391         (Cie::set_output_offset): Only add merge mapping if there is an
3392         object.
3393         (Cie::write): Add address parameter.  Change all callers.
3394         (Eh_frame::add_ehframe_for_plt): New function.
3395         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3396         input_offset_ fields into union u_, with new plt field.
3397         (Fde::Fde): Adjust for new union field.
3398         (Fde::Fde) [Output_data version]: New constructor.
3399         (Fde::add_mapping): Only add merge mapping if there is an object.
3400         (class Cie): Update declarations.
3401         (class Eh_frame): Declare add_ehframe_for_plt.
3402         * layout.cc (Layout::layout_eh_frame): Break out code into
3403         make_eh_frame_section, and call it.
3404         (Layout::make_eh_frame_section): New function.
3405         (Layout::add_eh_frame_for_plt): New function.
3406         * layout.h (class Layout): Update declarations.
3407         * merge.cc (Merge_map::add_mapping): Add assertion.
3408         * i386.cc: Include "dwarf.h".
3409         (class Output_data_plt_i386): Make first_plt_entry,
3410         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3411         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3412         and plt_eh_frame_fde.
3413         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3414         boundary.  Call add_eh_frame_for_plt if appropriate.
3415         * x86_64.cc: Include "dwarf.h".
3416         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3417         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3418         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3419         and plt_eh_frame_fde.
3420         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3421         appropriate.
3422
3423 2011-06-29  Ian Lance Taylor  <iant@google.com>
3424
3425         PR gold/12629
3426         * object.cc (Sized_relobj_file::layout_section): Change shdr
3427         parameter to be const.
3428         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3429         out of do_layout.
3430         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3431         appropriate.  Call layout_eh_frame_section.
3432         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3433         sections.
3434         * object.h (class Sized_relobj_file): Update declarations.
3435
3436 2011-06-29  Ian Lance Taylor  <iant@google.com>
3437
3438         PR gold/12652
3439         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3440         modifier.
3441         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3442
3443 2011-06-29  Ian Lance Taylor  <iant@google.com>
3444
3445         PR gold/12675
3446         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3447         SHT_X86_64_UNWIND.
3448         * layout.cc (Layout::layout_eh_frame): Likewise.
3449
3450 2011-06-29  Ian Lance Taylor  <iant@google.com>
3451
3452         PR gold/12695
3453         * layout.cc (Layout::symtab_section_shndx): New function.
3454         * layout.h (class Layout): Declare symtab_section_shndx.
3455         * output.cc (Output_section::write_header): Call it.
3456
3457 2011-06-29  Ian Lance Taylor  <iant@google.com>
3458
3459         PR gold/12818
3460         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3461         symbols which are not used in a relocation.
3462
3463 2011-06-28  Ian Lance Taylor  <iant@google.com>
3464
3465         PR gold/12898
3466         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3467         script create indistinguishable segments.
3468         (Layout::set_segment_offsets): Use stable_sort when sorting
3469         segments.  Pass this to Compare_segments constructor.
3470         * layout.h (class Layout): Make segment_precedes non-static.
3471         (class Compare_segments): Change from struct to class.  Add
3472         layout_ field.  Add constructor.
3473         * script-sections.cc
3474         (Script_sections::attach_sections_using_phdrs_clause): Rename
3475         local orphan to is_orphan.  Don't report failure to put empty
3476         section in segment.  On attachment failure, report name of
3477         section, and attach to first PT_LOAD segment.
3478
3479 2011-06-28  Ian Lance Taylor  <iant@google.com>
3480
3481         PR gold/12934
3482         * target-select.cc (Target_selector::Target_selector): Add
3483         emulation parameter.  Change all callers.
3484         (select_target_by_bfd_name): Rename from select_target_by_name.
3485         Change all callers.
3486         (select_target_by_emulation): New function.
3487         (supported_emulation_names): New function.
3488         * target-select.h (class Target_selector): Add emulation_ field.
3489         Update declarations.
3490         (Target_selector::recognize_by_bfd_name): Rename from
3491         recognize_by_name.  Change all callers.
3492         (Target_selector::supported_bfd_names): Rename from
3493         supported_names.  Change all callers.
3494         (Target_selector::recognize_by_emulation): New function.
3495         (Target_selector::supported_emulations): New function.
3496         (Target_selector::emulation): New function.
3497         (Target_selector::do_recognize_by_bfd_name): Rename from
3498         do_recognize_by_name.  Change all callers.
3499         (Target_selector::do_supported_bfd_names): Rename from
3500         do_supported_names.  Change all callers.
3501         (Target_selector::do_recognize_by_emulation): New function.
3502         (Target_selector::do_supported_emulations): New function.
3503         (select_target_by_bfd_name): Change name in declaration.
3504         (select_target_by_emulation): Declare.
3505         (supported_emulation_names): Declare.
3506         * parameters.cc (parameters_force_valid_target): Try to find
3507         target based on emulation from -m option.
3508         * options.h (class General_options): Change doc string for -m.
3509         * options.cc (help): Print emulations.
3510         (General_options::parse_V): Likewise.
3511         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3512         Add emulation parameter.  Change all callers.
3513
3514 2011-06-28  Ian Lance Taylor  <iant@google.com>
3515
3516         * target.h (class Target): Add osabi_ field.
3517         (Target::osabi): New function.
3518         (Target::set_osabi): New function.
3519         (Target::Target): Initialize osabi_.
3520         (Target::do_adjust_elf_header): Make pure virtual.
3521         (Sized_target::do_adjust_elf_header): Declare.
3522         * target.cc (Sized_target::do_adjust_elf_header): New function.
3523         (class Sized_target): Instantiate all versions.
3524         * freebsd.h (class Target_freebsd): Remove.
3525         (Target_selector_freebsd::do_recognize): Call set_osabi on
3526         Target.
3527         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3528         (Target_selector_freebsd::set_osabi): Remove.
3529         * i386.cc (class Target_i386): Inherit from Sized_target rather
3530         than Target_freebsd.
3531         * x86_64.cc (class Target_x86_64): Likewise.
3532
3533 2011-06-28  Ian Lance Taylor  <iant@google.com>
3534
3535         * target.h (Target::can_check_for_function_pointers): Rewrite.
3536         Make non-virtual.
3537         (Target::can_icf_inline_merge_sections): Likewise.
3538         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3539         (Target::Target_info): Add can_icf_inline_merge_sections field.
3540         (Target::do_can_check_for_function_pointers): New virtual
3541         function.
3542         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3543         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3544         from can_check_for_function_pointers, move in file.
3545         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3546         section_may_have_icf_unsafe_poineters, move in file.
3547         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3548         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3549         Rename from can_check_for_function_pointers, move in file.
3550         (Target_i386::can_icf_inline_merge_sections): Remove.
3551         (Target_i386::i386_info): Initialize
3552         can_icf_inline_merge_sections.
3553         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3554         Initialize can_icf_inline_merge_sections.
3555         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3556         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3557         Rename from can_check_for_function_pointers, move in file.
3558         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3559         (Target_x86_64::x86_64_info): Initialize
3560         can_icf_inline_merge_sections.
3561         * testsuite/testfile.cc (Target_test::test_target_info):
3562         Likewise.
3563         * icf.cc (get_section_contents): Correct formatting.
3564
3565 2011-06-27  Ian Lance Taylor  <iant@google.com>
3566
3567         * symtab.cc (Symbol::versioned_name): New function.
3568         (Symbol_table::add_to_final_symtab): Use versioned_name when
3569         appropriate.
3570         (Symbol_table::sized_write_symbol): Likewise.
3571         * symtab.h (class Symbol): Declare versioned_name.
3572         * stringpool.h (class Stringpool_template): Add variant of add
3573         which takes a std::basic_string.
3574         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3575         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3576         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3577         (ver_test_12.o): New target.
3578         * testsuite/Makefile.in: Rebuild.
3579
3580 2011-06-27  Doug Kwan  <dougkwan@google.com>
3581
3582         * arm.cc (Arm_relocate_functions::thm_jump8,
3583         Arm_relocate_functions::thm_jump11): Use a wider signed
3584         type to compute offset.
3585         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3586         arm_thm_jump8.
3587         * testsuite/Makefile.in: Regenerate.
3588         * testsuite/arm_branch_in_range.sh: Check test results of
3589         arm_thm_jump11 and arm_thm_jump8.
3590         * testsuite/arm_thm_jump11.s: New test source file.
3591         * testsuite/arm_thm_jump11.t: New linker script.
3592         * testsuite/arm_thm_jump8.s: New test source file.
3593         * testsuite/arm_thm_jump8.t: New linker script.
3594
3595 2011-06-24  Ian Lance Taylor  <iant@google.com>
3596
3597         * layout.cc: Include "object.h".
3598         (ctors_sections_in_init_array): New static variable.
3599         (Layout::is_ctors_in_init_array): New function.
3600         (Layout::layout): Add entry to ctors_sections_in_init_array if
3601         appropriate.
3602         * layout.h (class Layout): Declare is_ctors_in_init_array.
3603         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3604         is_ctors_reverse_view is set.
3605         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3606         all callers.  Set is_ctors_reverse_view field of View_size.
3607         (Sized_relobj_file::reverse_words): New function.
3608         * object.h (Sized_relobj_file::View_size): Add
3609         is_ctors_reverse_view field.
3610         (class Sized_relobj_file): Update declarations.
3611         * testsuite/initpri3.c: New test.
3612         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3613         initpri3b.
3614         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3615         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3616         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3617         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3618         * testsuite/Makefile.in: Rebuild.
3619
3620 2011-06-24  Cary Coutant  <ccoutant@google.com>
3621
3622         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3623         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3624         (debug_msg_cdebug.err): New targets.
3625         * testsuite/Makefile.in: Regenerate.
3626         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3627         Fix checks for link with shared library.
3628
3629 2011-06-24  Doug Kwan  <dougkwan@google.com>
3630
3631         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3632         skip empty text sections.
3633         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3634
3635 2011-06-22  Ian Lance Taylor  <iant@google.com>
3636
3637         PR gold/12910
3638         * options.h (class General_options): Add --ctors-in-init-array.
3639         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3640         friends as SHT_PROGBITS for merging sections.
3641         (Layout::layout): Remove special handling of .init_array and
3642         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3643         and .dtors if ctors_in_init_array.
3644         (Layout::make_output_section): Force correct section types for
3645         .init_array and friends.  Don't sort if doing relocatable link,
3646         Don't sort .ctors and .dtors if ctors_in_init_array.
3647         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3648         (Layout::output_section_name): Add relobj parameter.  Change all
3649         callers.  Handle .ctors. and .dtors. in code rather than table.
3650         Handle .ctors and .dtors if ctors_in_init_array.
3651         (Layout::match_file_name): New function, moved from output.cc.
3652         * layout.h (class Layout): Update declarations.
3653         * output.cc: Include "layout.h".
3654         (Input_section_sort_entry::get_priority): New function.
3655         (Input_section_sort_entry::match_file_name): Just call
3656         Layout::match_file_name.
3657         (Output_section::Input_section_sort_init_fini_compare::operator()):
3658         Handle .ctors and .dtors.  Sort by explicit priority rather than
3659         by name.
3660         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3661         * testsuite/initpri2.c: New test.
3662         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3663         (check_PROGRAMS): Add initpri2.
3664         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3665         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3666         * configure, testsuite/Makefile.in: Rebuild.
3667
3668 2011-06-19  Ian Lance Taylor  <iant@google.com>
3669
3670         PR gold/12880
3671         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3672         .interp section to a PT_INTERP segment even if we have seen a
3673         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3674         clause in a linker script.
3675         (Layout::finalize): Don't create a .interp section if we've
3676         already create a PT_INTERP segment.
3677         (Layout::create_interp): Always call choose_output_section (revert
3678         patch of 2011-06-17).  Don't create PT_INTERP segment.
3679         * script-sections.cc
3680         (Script_sections::create_note_and_tls_segments): Add a .interp
3681         section to a PT_INTERP segment even if we have seen a
3682         --dynamic-linker option.
3683
3684 2011-06-18  Ian Lance Taylor  <iant@google.com>
3685
3686         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3687         merely because a non-PT_LOAD segment has a dynamic reloc.
3688
3689 2011-06-18  Ian Lance Taylor  <iant@google.com>
3690
3691         * layout.cc (Layout::finish_dynamic_section): Don't create
3692         DT_FLAGS entry if not needed.
3693
3694 2011-06-18  Ian Lance Taylor  <iant@google.com>
3695
3696         PR gold/12745
3697         * layout.cc (Layout::layout_eh_frame): Correct handling of
3698         writable .eh_frame section.
3699
3700 2011-06-17  Ian Lance Taylor  <iant@google.com>
3701
3702         PR gold/12893
3703         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3704         symbol is redefined with the exact same object and value.
3705
3706 2011-06-17  Ian Lance Taylor  <iant@google.com>
3707
3708         PR gold/12880
3709         * layout.h (class Layout): Add interp_segment_ field.
3710         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3711         (Layout::attach_allocated_section_to_segment): If making shared
3712         library, put .interp section in PT_INTERP segment.
3713         (Layout::finalize): Also call create_interp if -dynamic-linker
3714         option was used.
3715         (Layout::create_interp): Assert that there is no PT_INTERP
3716         segment.  If not using a SECTIONS clause, use make_output_section.
3717         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3718         * script-sections.cc
3719         (Script_sections::create_note_and_tls_segments): If making shared
3720         library, put .interp section in PT_INTERP segment.
3721
3722 2011-06-17  Ian Lance Taylor  <iant@google.com>
3723
3724         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3725         when making a shared library.
3726
3727 2011-06-17  Ian Lance Taylor  <iant@google.com>
3728
3729         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3730         parameter.  Change all callers.  Don't issue warning about PC32
3731         against locally defined symbol.
3732
3733 2011-06-16  Ian Lance Taylor  <iant@google.com>
3734
3735         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3736         occurs in same object.
3737
3738 2011-06-14  Alan Modra  <amodra@gmail.com>
3739
3740         * po/POTFILES.in: Regenerate.
3741
3742 2011-06-09  Ian Lance Taylor  <iant@google.com>
3743
3744         * script-sections.cc
3745         (Orphan_output_section::set_section_addresses): For a relocatable
3746         link set address to 0.
3747
3748 2011-06-09  Cary Coutant  <ccoutant@google.com>
3749
3750         PR gold/12804
3751         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3752         used with --compress-debug-sections.
3753         * gold/object.cc (Sized_relobj_file::do_layout): Report
3754         uncompressed size of compressed input sections.
3755
3756 2011-06-08  Cary Coutant  <ccoutant@google.com>
3757
3758         PR gold/12804
3759         * testsuite/two_file_test_2_v1.cc: Change initialization of
3760         v2 to keep it in .data.
3761
3762 2011-06-07  Cary Coutant  <ccoutant@google.com>
3763
3764         * common.cc (Symbol_table::do_allocate_commons_list): Call
3765         gold_fallback.
3766         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3767         (Errors::fallback): New function.
3768         (gold_fallback): New function.
3769         * errors.h (Errors::fallback): New function.
3770         * gold.cc (gold_exit): Change status parameter to enum; adjust
3771         all callers.
3772         (queue_initial_tasks): Call gold_fallback.
3773         * gold.h: Include cstdlib.
3774         (Exit_status): New enum type.
3775         (gold_exit): Change status parameter to enum.
3776         (gold_fallback): New function.
3777         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3778         (Layout::create_symtab_sections): Likewise.
3779         (Layout::create_shdrs): Likewise.
3780         * main.cc (main): Adjust call to gold_exit.
3781         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3782         (Output_data_got::add_got_entry_pair): Likewise.
3783         (Output_section::add_input_section): Likewise.
3784         (Output_section::add_output_section_data): Likewise.
3785         (Output_segment::set_section_list_addresses): Likewise.
3786         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3787
3788 2011-06-07  Cary Coutant  <ccoutant@google.com>
3789
3790         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3791         for incremental links.
3792         * output.cc (Output_segment::set_section_list_addresses): Remove
3793         FIXME and test for TLS or BSS.
3794
3795 2011-06-07  Cary Coutant  <ccoutant@google.com>
3796
3797         * testsuite/Makefile.am: Add incremental_copy_test,
3798         incremental_common_test_1.
3799         * testsuite/Makefile.in: Regenerate.
3800         * testsuite/common_test_1_v1.c: New source file.
3801         * testsuite/common_test_1_v2.c: New source file.
3802         * testsuite/copy_test_v1.cc: New source file.
3803
3804 2011-06-07  Cary Coutant  <ccoutant@google.com>
3805
3806         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3807         update, allocate common from bss section's free list.
3808         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3809         linker-defined symbols.
3810         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3811         Skip GOT and PLT entries that are no longer referenced.
3812         (Output_section_incremental_inputs::write_info_blocks): Mark
3813         linker-defined symbols.
3814         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3815         * output.cc (Output_section::allocate): New function.
3816         * output.h (Output_section::allocate): New function.
3817         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3818         linker-defined symbols.
3819         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3820         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3821         (Symbol::init_base_output_data): Likewise.
3822         (Symbol::init_base_output_segment): Likewise.
3823         (Symbol::init_base_constant): Likewise.
3824         (Sized_symbol::init_output_data): Likewise.
3825         (Sized_symbol::init_output_segment): Likewise.
3826         (Sized_symbol::init_constant): Likewise.
3827         (Symbol_table::do_define_in_output_data): Likewise.
3828         (Symbol_table::do_define_in_output_segment): Likewise.
3829         (Symbol_table::do_define_as_constant): Likewise.
3830         * symtab.h (Symbol::is_predefined): New function.
3831         (Symbol::init_base_output_data): Add is_predefined parameter.
3832         (Symbol::init_base_output_segment): Likewise.
3833         (Symbol::init_base_constant): Likewise.
3834         (Symbol::is_predefined_): New data member.
3835         (Sized_symbol::init_output_data): Add is_predefined parameter.
3836         (Sized_symbol::init_output_segment): Likewise.
3837         (Sized_symbol::init_constant): Likewise.
3838         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3839
3840 2011-06-07  Cary Coutant  <ccoutant@google.com>
3841
3842         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3843         instead of emit_copy_reloc.
3844         (Copy_relocs::emit_copy_reloc): Refactor.
3845         (Copy_relocs::make_copy_reloc): New function.
3846         (Copy_relocs::add_copy_reloc): Remove.
3847         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3848         section.
3849         (Copy_relocs::make_copy_reloc): New function.
3850         (Copy_relocs::add_copy_reloc): Remove.
3851         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3852         unchanged input files.
3853         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3854         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3855         Reserve BSS space for COPY relocations.
3856         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3857         (Output_section_incremental_inputs::write_info_blocks): Record
3858         whether a symbol is copied from a shared object.
3859         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3860         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3861         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3862         (Incremental_input_entry_reader::get_output_symbol_index): Add
3863         is_copy parameter.
3864         (Incremental_binary::emit_copy_relocs): New function.
3865         (Incremental_binary::do_emit_copy_relocs): New function.
3866         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3867         new data member.
3868         (Sized_incremental_binary::add_copy_reloc): New function.
3869         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3870         (Sized_incremental_binary::Copy_reloc): New struct.
3871         (Sized_incremental_binary::Copy_relocs): New typedef.
3872         (Sized_incremental_binary::copy_relocs_): New data member.
3873         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3874         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3875         * target.h (Sized_target::emit_copy_reloc): New function.
3876         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3877
3878 2011-06-02  Cary Coutant  <ccoutant@google.com>
3879
3880         PR gold/12163
3881         * gold/archive.cc (Archive::Archive): Initialize new data member.
3882         (Archive::include_all_members): Return if archive has already been
3883         included.
3884         * gold/archive.h (Archive::include_all_members_): New data member.
3885
3886 2011-06-02  Nick Clifton  <nickc@redhat.com>
3887
3888         * dynobj.h: Fix spelling mistake in comment.
3889         * output.cc: Likewise.
3890
3891 2011-05-31  Doug Kwan  <dougkwan@google.com>
3892             Asier Llano
3893
3894         PR gold/12826
3895         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3896         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3897         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3898         redundant arm_exidx_test.so.
3899         * testsuite/Makefile.in: Regenerate.
3900         (check_SCRIPTS): Add pr12826.sh
3901         (check_DATA): Add pr12826.stdout
3902         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3903         * testsuite/pr12826.sh: New file.
3904         * testsuite/pr12826_1.s: Ditto.
3905         * testsuite/pr12826_1.s: Ditto.
3906
3907 2011-05-30  Ian Lance Taylor  <iant@google.com>
3908
3909         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3910         sections.
3911
3912 2011-05-29  Ian Lance Taylor  <iant@google.com>
3913
3914         PR gold/12804
3915         * testsuite/Makefile.am: Use different file name for two_file_test
3916         temporary file for each incremental test.
3917         * testsuite/Makefile.in: Rebuild.
3918
3919 2011-05-29  Ian Lance Taylor  <iant@google.com>
3920
3921         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3922         binary input file is empty.
3923
3924 2011-05-27  Ian Lance Taylor  <iant@google.com>
3925
3926         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3927         (ver_test_9.so): Likewise.
3928         * testsuite/Makefile.in: Rebuild.
3929
3930 2011-05-26 Cary Coutant  <ccoutant@google.com>
3931
3932         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3933         * incremental.cc (Incremental_inputs::report_input_section): Fix
3934         comment, indentation.
3935         (Incremental_inputs::report_comdat_group): New function.
3936         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3937         of data for incremental input file entry.
3938         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3939         group count, COMDAT group signatures.
3940         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3941         an unchanged input file.
3942         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3943         Initialize new data member.
3944         (Incremental_object_entry::add_comdat_group): New function.
3945         (Incremental_object_entry::get_comdat_group_count): New function.
3946         (Incremental_object_entry::get_comdat_signature_key): New function.
3947         (Incremental_object_entry::groups_): New data member.
3948         (Incremental_inputs::report_comdat_group): New function.
3949         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3950         data for incremental input file entry.
3951         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3952         (Incremental_input_entry_reader::get_input_section): Adjust size of
3953         data for incremental input file entry.
3954         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3955         (Incremental_input_entry_reader::get_comdat_group_signature): New
3956         function.
3957         * object.cc (Sized_relobj::include_section_group): Report kept
3958         COMDAT groups for incremental links.
3959
3960 2011-05-24  David Meyer  <pdox@google.com>
3961
3962         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3963         with name parameter.  Add found_name parameter.
3964         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3965         * dirsearch.h (class Dirsearch): Update declaration.
3966
3967 2011-05-24  Ian Lance Taylor  <iant@google.com>
3968
3969         * archive.cc (Library_base::should_include_member): Pull in object
3970         from archive if it defines the entry symbol.
3971         * parameters.cc (Parameters::entry): New function.
3972         * parameters.h (class Parameters): Declare entry.
3973         * output.h (class Output_file_header): Remove entry_ field.
3974         * output.cc (Output_file_header::Output_file_header): Remove entry
3975         parameter.  Change all callers.
3976         (Output_file_header::entry): Use parameters->entry.
3977         * gold.cc (queue_middle_tasks): Likewise.
3978         * plugin.cc (Plugin_hook::run): Likewise.
3979
3980 2011-05-24 Cary Coutant  <ccoutant@google.com>
3981
3982         * gold.cc (queue_initial_tasks): Pass incremental base filename
3983         to Output_file::open_base_file; don't print error message.
3984         * incremental-dump.cc (main): Adjust call to
3985         Output_file::open_for_modification.
3986         * incremental-dump.cc (main): Likewise.
3987         * incremental.cc (Incremental_inputs::report_command_line):
3988         Ignore --incremental-base option when comparing command lines.
3989         Ignore parameter when given as separate argument.
3990         * options.h (class General_options): Add --incremental-base.
3991         * output.cc (Output_file::Output_file):
3992         (Output_file::open_base_file): Add base_name and writable parameters;
3993         read base file into new file; print error message here.
3994         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3995         callers.
3996         * output.h (Output_file::open_for_modification): Rename to...
3997         (Output_file::open_base_file): ...this; add base_name and
3998         writable parameters; adjust all callers.
3999         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4000         callers.
4001         * testsuite/Makefile.am (incremental_test_4): Test
4002         --incremental-base.
4003         * testsuite/Makefile.in: Regenerate.
4004
4005 2011-05-24 Cary Coutant  <ccoutant@google.com>
4006
4007         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4008         incremental_test_4.
4009         * testsuite/Makefile.in: Regenerate.
4010         * testsuite/two_file_test_1_v1.cc: New test source file.
4011         * testsuite/two_file_test_1b_v1.cc: New test source file.
4012         * testsuite/two_file_test_2_v1.cc: New test source file.
4013
4014 2011-05-24 Cary Coutant  <ccoutant@google.com>
4015
4016         * dynobj.h (Dynobj::do_dynobj): New function.
4017         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4018         flag and soname for shared objects.
4019         * incremental.cc (Incremental_inputs::report_object): Make
4020         either Incremental_object_entry or Incremental_dynobj_entry; add
4021         soname to string table.
4022         (Incremental_inputs::report_input_section): Add assertion.
4023         (Output_section_incremental_inputs::set_final_data_size): Adjust
4024         type of input file entry for shared libraries; adjust size of
4025         shared library info entry.
4026         (Output_section_incremental_inputs::write_input_files): Write
4027         as_needed flag for shared libraries.
4028         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4029         of input file entry for shared libraries; write soname.
4030         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4031         soname from incremental info.
4032         * incremental.h (enum Incremental_input_flags): Add
4033         INCREMENTAL_INPUT_AS_NEEDED.
4034         (Incremental_input_entry::Incremental_input_entry): Initialize new
4035         data member.
4036         (Incremental_input_entry::set_as_needed): New function.
4037         (Incremental_input_entry::as_needed): New function.
4038         (Incremental_input_entry::do_dynobj_entry): New function.
4039         (Incremental_input_entry::as_needed_): New data member.
4040         (Incremental_object_entry::Incremental_object_entry): Don't check
4041         for shared library.
4042         (Incremental_object_entry::do_type): Likewise.
4043         (class Incremental_dynobj_entry): New class.
4044         (Incremental_input_entry_reader::as_needed): New function.
4045         (Incremental_input_entry_reader::get_soname): New function.
4046         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4047         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4048         size of shared library info entry.
4049         * layout.cc (Layout::finish_dynamic_section): Don't test for
4050         incremental link when adding DT_NEEDED entries.
4051         * object.h (Object::Object): Initialize new data member.
4052         (Object::dynobj): New function.
4053         (Object::set_as_needed): New function.
4054         (Object::as_needed): New function.
4055         (Object::do_dynobj): New function.
4056         (Object::as_needed_): New data member.
4057
4058 2011-05-24 Cary Coutant  <ccoutant@google.com>
4059
4060         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4061         info; adjust display of GOT entries.
4062         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4063         vector of input objects; remove file_status_.
4064         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4065         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4066         got_plt reader; call target hooks to reserve GOT entries.
4067         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4068         of input file info header and GOT info entry.
4069         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4070         relocation info.
4071         (Got_plt_view_info::got_descriptor): Remove.
4072         (Got_plt_view_info::sym_index): New data member.
4073         (Got_plt_view_info::input_index): New data member.
4074         (Local_got_offset_visitor::visit): Write input file index.
4075         (Global_got_offset_visitor::visit): Write 0 for input file index.
4076         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4077         with sym_index and input_index.
4078         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4079         incremental info GOT entry; replace got_descriptor with input_index.
4080         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4081         map from input file index to object.
4082         (Sized_relobj_incr::do_layout): Replace direct data member reference
4083         with accessor function.
4084         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4085         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4086         Adjust size of input file info header.
4087         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4088         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4089         (Incremental_input_entry_reader::get_input_section): Adjust size of
4090         input file info header.
4091         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4092         of incremental info GOT entry.
4093         (Incremental_got_plt_reader::get_got_desc): Remove.
4094         (Incremental_got_plt_reader::get_got_symndx): New function.
4095         (Incremental_got_plt_reader::get_got_input_index): New function.
4096         (Sized_incremental_binary::Sized_incremental_binary): Remove
4097         file_status_; add input_objects_.
4098         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4099         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4100         (Sized_incremental_binary::file_is_unchanged): Remove.
4101         (Sized_incremental_binary::set_input_object): New function.
4102         (Sized_incremental_binary::input_object): New function.
4103         (Sized_incremental_binary::file_status_): Remove.
4104         (Sized_incremental_binary::input_objects_): New data member.
4105         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4106         references.
4107         (Sized_relobj_incr::invalid_address): Move to base class.
4108         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4109         class.
4110         (Sized_relobj_incr::do_output_section_offset): Likewise.
4111         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4112         (Sized_relobj_incr::section_offsets_): Likewise.
4113         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4114         function.
4115         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4116         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4117         with accessor function.
4118         (Sized_relobj_file::do_layout): Likewise.
4119         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4120         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4121         (Sized_relobj_file::compute_final_local_value): Replace refs to
4122         section_offsets_ with accessor function.
4123         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4124         * object.h (Relobj::Relobj): Initialize new data members.
4125         (Relobj::add_dyn_reloc): New function.
4126         (Relobj::first_dyn_reloc): New function.
4127         (Relobj::dyn_reloc_count): New function.
4128         (Relobj::first_dyn_reloc_): New data member.
4129         (Relobj::dyn_reloc_count_): New data member.
4130         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4131         references.
4132         (Sized_relobj::Address): New typedef.
4133         (Sized_relobj::invalid_address): Move here from child class.
4134         (Sized_relobj::Sized_relobj): Initialize new data members.
4135         (Sized_relobj::sized_relobj): New function.
4136         (Sized_relobj::is_output_section_offset_invalid): Move here from
4137         child class.
4138         (Sized_relobj::get_output_section_offset): Likewise.
4139         (Sized_relobj::local_has_got_offset): Likewise.
4140         (Sized_relobj::local_got_offset): Likewise.
4141         (Sized_relobj::set_local_got_offset): Likewise.
4142         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4143         (Sized_relobj::clear_got_offsets): New function.
4144         (Sized_relobj::section_offsets): Move here from child class.
4145         (Sized_relobj::do_output_section_offset): Likewise.
4146         (Sized_relobj::do_set_section_offset): Likewise.
4147         (Sized_relobj::Local_got_offsets): Likewise.
4148         (Sized_relobj::local_got_offsets_): Likewise.
4149         (Sized_relobj::section_offsets_): Likewise.
4150         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4151         references.
4152         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4153         class.
4154         (Sized_relobj_file::sized_relobj): New function
4155         (Sized_relobj_file::local_has_got_offset): Move to base class.
4156         (Sized_relobj_file::local_got_offset): Likewise.
4157         (Sized_relobj_file::set_local_got_offset): Likewise.
4158         (Sized_relobj_file::get_output_section_offset): Likewise.
4159         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4160         (Sized_relobj_file::do_output_section_offset): Likewise.
4161         (Sized_relobj_file::do_set_section_offset): Likewise.
4162         (Sized_relobj_file::Local_got_offsets): Likewise.
4163         (Sized_relobj_file::local_got_offsets_): Likewise.
4164         (Sized_relobj_file::section_offsets_): Likewise.
4165         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4166         (all constructors).
4167         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4168         (Output_reloc::get_symbol_index): Likewise.
4169         (Output_reloc::local_section_offset): Likewise.
4170         (Output_reloc::get_address): Likewise.
4171         (Output_reloc::symbol_value): Likewise.
4172         (Output_data_got::reserve_slot): Move to class definition.
4173         (Output_data_got::reserve_local): New function.
4174         (Output_data_got::reserve_slot_for_global): Remove.
4175         (Output_data_got::reserve_global): New function.
4176         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4177         (all constructors, two instantiations).
4178         (Output_reloc::get_relobj): New function (two instantiations).
4179         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4180         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4181         (Output_data_reloc::add_global): Adjust type of relobj.
4182         (Output_data_reloc::add_global_relative): Likewise.
4183         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4184         (Output_data_reloc::add_local): Likewise.
4185         (Output_data_reloc::add_local_relative): Likewise.
4186         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4187         (Output_data_reloc::add_local_section): Likewise.
4188         (Output_data_reloc::add_output_section): Likewise.
4189         (Output_data_reloc::add_absolute): Likewise.
4190         (Output_data_reloc::add_target_specific): Likewise.
4191         (Output_data_got::reserve_slot): Move definition here.
4192         (Output_data_got::reserve_local): New function.
4193         (Output_data_got::reserve_global): New function.
4194         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4195         section_offsets_ with accessor function.
4196         (Sized_relobj_file::write_sections): Likewise.
4197         (Sized_relobj_file::do_relocate_sections): Likewise.
4198         * target.h (Sized_target::reserve_local_got_entry): New function.
4199         (Sized_target::reserve_global_got_entry): New function.
4200         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4201         (Target_x86_64::reserve_global_got_entry): New function.
4202         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4203
4204 2011-05-23 Cary Coutant  <ccoutant@google.com>
4205
4206         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4207         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4208         bit when checking got_type.
4209         * incremental.cc (Sized_incremental_binary::setup_readers):
4210         Store symbol table and string table locations; initialize bit vector
4211         of file status flags.
4212         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4213         unchanged files.
4214         (Sized_incremental_binary::do_process_got_plt): New function.
4215         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4216         (Output_section_incremental_inputs::set_final_data_size): Record
4217         file index for each input file.
4218         (Output_section_incremental_inputs::write_got_plt): Store file index
4219         instead of input entry offset for each GOT entry.
4220         * incremental.h
4221         (Incremental_input_entry::Incremental_input_entry): Initialize new
4222         data member.
4223         (Incremental_input_entry::set_offset): Store file index.
4224         (Incremental_input_entry::get_file_index): New function.
4225         (Incremental_input_entry::file_index_): New data member.
4226         (Incremental_binary::process_got_plt): New function.
4227         (Incremental_binary::do_process_got_plt): New function.
4228         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4229         data members.
4230         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4231         (Sized_incremental_binary::set_file_is_unchanged): New function.
4232         (Sized_incremental_binary::file_is_unchanged): New function.
4233         (Sized_incremental_binary::do_process_got_plt): New function.
4234         (Sized_incremental_binary::file_status_): New data member.
4235         (Sized_incremental_binary::main_symtab_loc_): New data member.
4236         (Sized_incremental_binary::main_strtab_loc_): New data member.
4237         * output.cc (Output_data_got::Got_entry::write): Add case
4238         RESERVED_CODE.
4239         (Output_data_got::add_global): Call add_got_entry.
4240         (Output_data_got::add_global_plt): Likewise.
4241         (Output_data_got::add_global_with_rel): Likewise.
4242         (Output_data_got::add_global_with_rela): Likewise.
4243         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4244         (Output_data_got::add_global_pair_with_rela): Likewise.
4245         (Output_data_got::add_local): Call add_got_entry.
4246         (Output_data_got::add_local_plt): Likewise.
4247         (Output_data_got::add_local_with_rel): Likewise.
4248         (Output_data_got::add_local_with_rela): Likewise.
4249         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4250         (Output_data_got::add_local_pair_with_rela): Likewise.
4251         (Output_data_got::reserve_slot): New function.
4252         (Output_data_got::reserve_slot_for_global): New function.
4253         (Output_data_got::add_got_entry): New function.
4254         (Output_data_got::add_got_entry_pair): New function.
4255         (Output_section::add_output_section_data): Edit FIXME.
4256         * output.h
4257         (Output_section_data_build::Output_section_data_build): New
4258         constructor with size parameter.
4259         (Output_data_space::Output_data_space): Likewise.
4260         (Output_data_got::Output_data_got): Initialize new data member; new
4261         constructor with size parameter.
4262         (Output_data_got::add_constant): Call add_got_entry.
4263         (Output_data_got::reserve_slot): New function.
4264         (Output_data_got::reserve_slot_for_global): New function.
4265         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4266         (Output_data_got::add_got_entry): New function.
4267         (Output_data_got::add_got_entry_pair): New function.
4268         (Output_data_got::free_list_): New data member.
4269         * target.h (Sized_target::init_got_plt_for_update): New function.
4270         (Sized_target::register_global_plt_entry): New function.
4271         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4272         Initialize new data member; call init; add constructor with PLT count.
4273         (Output_data_plt_x86_64::init): New function.
4274         (Output_data_plt_x86_64::add_relocation): New function.
4275         (Output_data_plt_x86_64::reserve_slot): New function.
4276         (Output_data_plt_x86_64::free_list_): New data member.
4277         (Target_x86_64::init_got_plt_for_update): New function.
4278         (Target_x86_64::register_global_plt_entry): New function.
4279         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4280         incremental updates.
4281         (Output_data_plt_x86_64::add_relocation): New function.
4282         * testsuite/object_unittest.cc (Object_test): Set default options.
4283
4284 2011-05-16  Ian Lance Taylor  <iant@google.com>
4285
4286         * options.h (class General_options): Make -i a synonym for -r.
4287
4288 2011-05-16  Ian Lance Taylor  <iant@google.com>
4289
4290         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4291
4292 2011-05-10 Cary Coutant  <ccoutant@google.com>
4293
4294         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4295         strip_all (-s).
4296
4297 2011-05-06  Ian Lance Taylor  <iant@google.com>
4298
4299         * layout.cc (Layout::layout): If the output section flags change,
4300         update the ordering.
4301
4302 2011-04-25 Cary Coutant  <ccoutant@google.com>
4303
4304         * incremental-dump.cc (dump_incremental_inputs): Print local
4305         symbol info for each input file.
4306         * incremental.cc
4307         (Output_section_incremental_inputs::set_final_data_size): Add local
4308         symbol info to input file entries in incremental info.
4309         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4310         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4311         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4312         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4313         implementation.
4314         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4315         (Sized_incr_relobj::do_relocate): Write the local symbols.
4316         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4317         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4318         Adjust size of input file header.
4319         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4320         (Incremental_inputs_reader::get_local_symbol_count): New function.
4321         (Incremental_inputs_reader::get_input_section): Adjust size of input
4322         file header.
4323         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4324         (Sized_incr_relobj::This): New typedef.
4325         (Sized_incr_relobj::sym_size): New const data member.
4326         (Sized_incr_relobj::Local_symbol): New struct.
4327         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4328         (Sized_incr_relobj::do_local_symbol_offset): New function.
4329         (Sized_incr_relobj::local_symbol_count_): New data member.
4330         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4331         (Sized_incr_relobj::local_symbol_index_): New data member.
4332         (Sized_incr_relobj::local_symbol_offset_): New data member.
4333         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4334         (Sized_incr_relobj::local_symbols_): New data member.
4335         * object.h (Relobj::output_local_symbol_count): New function.
4336         (Relobj::local_symbol_offset): New function.
4337         (Relobj::do_output_local_symbol_count): New function.
4338         (Relobj::do_local_symbol_offset): New function.
4339         (Sized_relobj::do_output_local_symbol_count): New function.
4340         (Sized_relobj::do_local_symbol_offset): New function.
4341
4342 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4343
4344         * descriptors.cc (set_close_on_exec): New function.
4345         (Descriptors::open): Use set_close_on_exec.
4346         * output.cc (S_ISLNK): Define if not defined.
4347
4348 2011-04-22 Cary Coutant  <ccoutant@google.com>
4349
4350         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4351         global symbol map.
4352         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4353         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4354         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4355         relocations.
4356         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4357         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4358         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4359         * incremental.h
4360         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4361         function.
4362         (Incremental_binary::apply_incremental_relocs): New function.
4363         (Incremental_binary::do_apply_incremental_relocs): New function.
4364         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4365         data member.
4366         (Sized_incremental_binary::add_global_symbol): New function.
4367         (Sized_incremental_binary::global_symbol): New function.
4368         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4369         (Sized_incremental_binary::symbol_map_): New data member.
4370         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4371         * target.h (Sized_target::apply_relocation): New function.
4372         * target-reloc.h (apply_relocation): New function.
4373         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4374
4375 2011-04-22  Doug Kwan  <dougkwan@google.com>
4376
4377         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4378         flag of a SHT_ARM_EXIDX section.
4379         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4380         * testsuite/Makefile.in: Regenerate.
4381         * testsuite/arm_exidx_test.s: New file.
4382         * testsuite/arm_exidx_test.sh: Same.
4383
4384 2011-04-20 Cary Coutant  <ccoutant@google.com>
4385
4386         PR gold/12689
4387         * archive.h (Incremental_archive_entry::Archive_member):
4388         Initialize arg_serial_ (second constructor).
4389
4390 2011-04-17  Ian Lance Taylor  <iant@google.com>
4391
4392         * object.cc (Relocate_info::location): Simplify location string.
4393         * errors.cc (Errors::error_at_location): Don't print program
4394         name.
4395         (Errors::warning_at_location): Likewise.
4396         (Errors::undefined_symbol): Likewise.
4397         * testsuite/debug_msg.sh: Update accordingly.
4398
4399 2011-04-14 Cary Coutant  <ccoutant@google.com>
4400
4401         * gold/layout.cc (Layout::symtab_section_offset): New function.
4402         * gold/layout.h (Layout::symtab_section_offset): New function.
4403         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4404
4405 2011-04-12  Ian Lance Taylor  <iant@google.com>
4406
4407         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4408         with MREMAP_MAYMOVE.
4409         * output.h (class Output_file): Add map_is_allocated_ field.
4410         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4411         not available, provide stubs.  If mremap is not available, #define
4412         it to gold_mremap.
4413         (MREMAP_MAYMOVE): Define if not defined.
4414         (Output_file::Output_file): Initialize map_is_allocated_.
4415         (Output_file::resize): Check map_is_allocated_.
4416         (Output_file::map_anonymous): If mmap fails, use malloc.
4417         (Output_file::unmap): Don't do anything for an anonymous map.
4418         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4419         is not available, provide stubs.
4420         (File_read::View::~View): Use free rather than delete[].
4421         (File_read::make_view): Use malloc rather than new[].  If mmap
4422         fails, use malloc.
4423         (File_read::find_or_make_view): Use malloc rather than new[].
4424         * gold.h: Remove HAVE_REMAP code.
4425         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4426         exists.  Rename mremap to gold_mremap.  If mmap is not available
4427         don't do anything.
4428         * configure, config.in: Rebuild.
4429
4430 2011-04-11  Ian Lance Taylor  <iant@google.com>
4431
4432         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4433         initialize local variable v.
4434
4435 2011-04-11  Cary Coutant  <ccoutant@google.com>
4436
4437         * archive.cc (Archive::include_member): Adjust call to
4438         report_object.
4439         (Add_archive_symbols::run): Track argument serial numbers.
4440         (Lib_group::include_member): Likewise.
4441         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4442         * archive.h (Incremental_archive_entry::Archive_member):
4443         Initialize arg_serial_.
4444         (Archive_member::arg_serial_): New data member.
4445         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4446         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4447         incremental link.
4448         (Sized_dynobj::do_for_all_local_got_entries): New function.
4449         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4450         function.
4451         * fileread.cc (get_mtime): New function.
4452         * fileread.h (get_mtime): New function.
4453         * gold.cc (queue_initial_tasks): Check for incremental update.
4454         (process_incremental_input): New function.
4455         (queue_middle_tasks): Don't force valid target for incremental
4456         update.
4457         * incremental-dump.cc (find_input_containing_global): Adjust
4458         size of symbol info entry.
4459         (dump_incremental_inputs): Dump argument serial number and
4460         in_system_directory flag; bias shndx by 1; print symbol names
4461         when dumping per-file symbol lists; use new symbol info readers.
4462         * incremental.cc
4463         (Output_section_incremental_inputs:update_data_size): New function.
4464         (Sized_incremental_binary::setup_readers): Setup input readers
4465         for each input file; build maps for files added from libraries
4466         and scripts.
4467         (Sized_incremental_binary::check_input_args): New function.
4468         (Sized_incremental_binary::do_check_inputs): Build map of argument
4469         serial numbers to input arguments.
4470         (Sized_incremental_binary::do_file_has_changed): Rename
4471         do_file_is_unchanged to this; compare file modification times.
4472         (Sized_incremental_binary::do_init_layout): New function.
4473         (Sized_incremental_binary::do_reserve_layout): New function.
4474         (Sized_incremental_binary::do_get_input_reader): Remove.
4475         (Sized_incremental_binary::get_symtab_view): New function.
4476         (Incremental_checker::can_incrementally_link_output_file): Remove.
4477         (Incremental_inputs::report_command_line): Exclude --debug options.
4478         (Incremental_inputs::report_archive_begin): Add parameter; track
4479         argument serial numbers; don't put input file entry for archive
4480         before archive members.
4481         (Incremental_inputs::report_archive_end): Put input file entry
4482         for archive after archive members.
4483         (Incremental_inputs::report_object): Add parameter; track argument
4484         serial numbers and in_system_directory flag.
4485         (Incremental_inputs::report_script): Add parameter; track argument
4486         serial numbers.
4487         (Output_section_incremental_inputs::set_final_data_size): Adjust
4488         size of symbol info entry; check for forwarding symbols.
4489         (Output_section_incremental_inputs::write_input_files): Write
4490         in_system_directory flag and argument serial number.
4491         (Output_section_incremental_inputs::write_info_blocks): Map section
4492         indices between incremental info and original input file; store
4493         input section index for each symbol.
4494         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4495         change operator() to visit().
4496         (class Global_got_offset_visitor): Likewise.
4497         (class Global_symbol_visitor_got_plt):
4498         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4499         classes.
4500         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4501         (Sized_incr_relobj::do_read_symbols): New function.
4502         (Sized_incr_relobj::do_layout): New function.
4503         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4504         (Sized_incr_relobj::do_add_symbols): New function.
4505         (Sized_incr_relobj::do_should_include_member): New function.
4506         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4507         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4508         (Sized_incr_relobj::do_section_size): New function.
4509         (Sized_incr_relobj::do_section_name): New function.
4510         (Sized_incr_relobj::do_section_contents): New function.
4511         (Sized_incr_relobj::do_section_flags): New function.
4512         (Sized_incr_relobj::do_section_entsize): New function.
4513         (Sized_incr_relobj::do_section_address): New function.
4514         (Sized_incr_relobj::do_section_type): New function.
4515         (Sized_incr_relobj::do_section_link): New function.
4516         (Sized_incr_relobj::do_section_info): New function.
4517         (Sized_incr_relobj::do_section_addralign): New function.
4518         (Sized_incr_relobj::do_initialize_xindex): New function.
4519         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4520         (Sized_incr_relobj::do_read_relocs): New function.
4521         (Sized_incr_relobj::do_gc_process_relocs): New function.
4522         (Sized_incr_relobj::do_scan_relocs): New function.
4523         (Sized_incr_relobj::do_count_local_symbols): New function.
4524         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4525         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4526         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4527         (Sized_incr_relobj::do_relocate): New function.
4528         (Sized_incr_relobj::do_set_section_offset): New function.
4529         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4530         (Sized_incr_dynobj::do_read_symbols): New function.
4531         (Sized_incr_dynobj::do_layout): New function.
4532         (Sized_incr_dynobj::do_add_symbols): New function.
4533         (Sized_incr_dynobj::do_should_include_member): New function.
4534         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4535         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4536         (Sized_incr_dynobj::do_section_size): New function.
4537         (Sized_incr_dynobj::do_section_name): New function.
4538         (Sized_incr_dynobj::do_section_contents): New function.
4539         (Sized_incr_dynobj::do_section_flags): New function.
4540         (Sized_incr_dynobj::do_section_entsize): New function.
4541         (Sized_incr_dynobj::do_section_address): New function.
4542         (Sized_incr_dynobj::do_section_type): New function.
4543         (Sized_incr_dynobj::do_section_link): New function.
4544         (Sized_incr_dynobj::do_section_info): New function.
4545         (Sized_incr_dynobj::do_section_addralign): New function.
4546         (Sized_incr_dynobj::do_initialize_xindex): New function.
4547         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4548         (make_sized_incremental_object): New function.
4549         (Incremental_library::copy_unused_symbols): New function.
4550         (Incremental_library::do_for_all_unused_symbols): New function.
4551         * incremental.h (enum Incremental_input_flags): New type.
4552         (class Incremental_checker): Remove.
4553         (Incremental_input_entry::Incremental_input_entry): Add argument
4554         serial number.
4555         (Incremental_input_entry::arg_serial): New function.
4556         (Incremental_input_entry::set_is_in_system_directory): New function.
4557         (Incremental_input_entry::is_in_system_directory): New function.
4558         (Incremental_input_entry::arg_serial_): New data member.
4559         (Incremental_input_entry::is_in_system_directory_): New data member.
4560         (class Script_info): Move here from script.h.
4561         (Script_info::Script_info): Add filename parameter.
4562         (Script_info::filename): New function.
4563         (Script_info::filename_): New data member.
4564         (Incremental_script_entry::Incremental_script_entry): Add argument
4565         serial number.
4566         (Incremental_object_entry::Incremental_object_entry): Likewise.
4567         (Incremental_object_entry::add_input_section): Build list of input
4568         sections with map to original shndx.
4569         (Incremental_object_entry::get_input_section_index): New function.
4570         (Incremental_object_entry::shndx_): New data member.
4571         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4572         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4573         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4574         serial number.
4575         (Incremental_inputs::report_archive_begin): Likewise.
4576         (Incremental_inputs::report_object): Likewise.
4577         (Incremental_inputs::report_script): Likewise.
4578         (class Incremental_global_symbol_reader): New class.
4579         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4580         and store flags and input file type.
4581         (Incremental_input_entry_reader::arg_serial): New function.
4582         (Incremental_input_entry_reader::type): Extract type from flags.
4583         (Incremental_input_entry_reader::is_in_system_directory): New function.
4584         (Incremental_input_entry_reader::get_input_section_count): Call
4585         accessor function for type.
4586         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4587         function for type; adjust size of global symbol entry.
4588         (Incremental_input_entry_reader::get_global_symbol_count): Call
4589         accessor function for type.
4590         (Incremental_input_entry_reader::get_object_count): Likewise.
4591         (Incremental_input_entry_reader::get_object_offset): Likewise.
4592         (Incremental_input_entry_reader::get_member_count): Likewise.
4593         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4594         (Incremental_input_entry_reader::get_member_offset): Likewise.
4595         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4596         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4597         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4598         (Incremental_input_entry_reader::get_global_symbol_reader): New
4599         function.
4600         (Incremental_input_entry_reader::get_output_symbol_index): New
4601         function.
4602         (Incremental_input_entry_reader::type_): Remove.
4603         (Incremental_input_entry_reader::flags_): New data member.
4604         (Incremental_inputs_reader::input_file_offset): New function.
4605         (Incremental_inputs_reader::input_file_index): New function.
4606         (Incremental_inputs_reader::input_file): Call input_file_offset.
4607         (Incremental_inputs_reader::input_file_at_offset): New function.
4608         (Incremental_relocs_reader::get_r_type): Reformat.
4609         (Incremental_relocs_reader::get_r_shndx): Reformat.
4610         (Incremental_relocs_reader::get_r_offset): Reformat.
4611         (Incremental_relocs_reader::data): New function.
4612         (Incremental_binary::Incremental_binary): Initialize new data members.
4613         (Incremental_binary::check_inputs): Add cmdline parameter.
4614         (Incremental_binary::file_is_unchanged): Remove.
4615         (Input_reader::arg_serial): New function.
4616         (Input_reader::get_unused_symbol_count): New function.
4617         (Input_reader::get_unused_symbol): New function.
4618         (Input_reader::do_arg_serial): New function.
4619         (Input_reader::do_get_unused_symbol_count): New function.
4620         (Input_reader::do_get_unused_symbol): New function.
4621         (Incremental_binary::input_file_count): New function.
4622         (Incremental_binary::get_input_reader): Change signature to use
4623         index instead of filename.
4624         (Incremental_binary::file_has_changed): New function.
4625         (Incremental_binary::get_input_argument): New function.
4626         (Incremental_binary::get_library): New function.
4627         (Incremental_binary::get_script_info): New function.
4628         (Incremental_binary::init_layout): New function.
4629         (Incremental_binary::reserve_layout): New function.
4630         (Incremental_binary::output_file): New function.
4631         (Incremental_binary::do_check_inputs): New function.
4632         (Incremental_binary::do_file_is_unchanged): Remove.
4633         (Incremental_binary::do_file_has_changed): New function.
4634         (Incremental_binary::do_init_layout): New function.
4635         (Incremental_binary::do_reserve_layout): New function.
4636         (Incremental_binary::do_input_file_count): New function.
4637         (Incremental_binary::do_get_input_reader): Change signature.
4638         (Incremental_binary::input_args_map_): New data member.
4639         (Incremental_binary::library_map_): New data member.
4640         (Incremental_binary::script_map_): New data member.
4641         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4642         new data members.
4643         (Sized_incremental_binary::output_section): New function.
4644         (Sized_incremental_binary::inputs_reader): Add const.
4645         (Sized_incremental_binary::symtab_reader): Add const.
4646         (Sized_incremental_binary::relocs_reader): Add const.
4647         (Sized_incremental_binary::got_plt_reader): Add const.
4648         (Sized_incremental_binary::get_symtab_view): New function.
4649         (Sized_incremental_binary::Inputs_reader): New typedef.
4650         (Sized_incremental_binary::Input_entry_reader): New typedef.
4651         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4652         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4653         (Sized_incremental_binary::do_file_has_changed): New function.
4654         (Sized_incremental_binary::do_init_layout): New function.
4655         (Sized_incremental_binary::do_reserve_layout): New function.
4656         (Sized_input_reader::Inputs_reader): Remove.
4657         (Sized_input_reader::Input_entry_reader): Remove.
4658         (Sized_input_reader::do_arg_serial): New function.
4659         (Sized_input_reader::do_get_unused_symbol_count): New function.
4660         (Sized_input_reader::do_get_unused_symbol): New function.
4661         (Sized_incremental_binary::do_input_file_count): New function.
4662         (Sized_incremental_binary::do_get_input_reader): Change signature;
4663         use index instead of filename.
4664         (Sized_incremental_binary::section_map_): New data member.
4665         (Sized_incremental_binary::input_entry_readers_): New data member.
4666         (class Sized_incr_relobj): New class.
4667         (class Sized_incr_dynobj): New class.
4668         (make_sized_incremental_object): New function.
4669         (class Incremental_library): New class.
4670         * layout.cc (Free_list::num_lists): New static data member.
4671         (Free_list::num_nodes): New static data member.
4672         (Free_list::num_removes): New static data member.
4673         (Free_list::num_remove_visits): New static data member.
4674         (Free_list::num_allocates): New static data member.
4675         (Free_list::num_allocate_visits): New static data member.
4676         (Free_list::init): New function.
4677         (Free_list::remove): New function.
4678         (Free_list::allocate): New function.
4679         (Free_list::dump): New function.
4680         (Free_list::print_stats): New function.
4681         (Layout_task_runner::run): Resize output file for incremental updates.
4682         (Layout::Layout): Initialize new data members.
4683         (Layout::set_incremental_base): New function.
4684         (Layout::init_fixed_output_section): New function.
4685         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4686         incremental updates.
4687         (Layout::create_gold_note): Do not create gold note section for
4688         incremental updates.
4689         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4690         for incremental updates.
4691         (Layout::set_section_offsets): For incremental updates, allocate space
4692         from free list.
4693         (Layout::create_symtab_sections): Layout with offsets relative to
4694         start of section; for incremental updates, allocate space from free
4695         list.
4696         (Layout::create_shdrs): For incremental updates, allocate space from
4697         free list.
4698         (Layout::finish_dynamic_section): For incremental updates, do not
4699         check --as-needed (fixed in subsequent patch).
4700         * layout.h (class Free_list): New class.
4701         (Layout::set_incremental_base): New function.
4702         (Layout::incremental_base): New function.
4703         (Layout::init_fixed_output_section): New function.
4704         (Layout::allocate): New function.
4705         (Layout::incremental_base_): New data member.
4706         (Layout::free_list_): New data member.
4707         * main.cc (main): Print Free_list statistics.
4708         * object.cc (Relobj::finalize_incremental_relocs): Add
4709         clear_counts parameter; clear counts only when clear_counts is set.
4710         (Sized_relobj::Sized_relobj): Initialize new base class.
4711         (Sized_relobj::do_layout): Don't report special sections.
4712         (Sized_relobj::do_for_all_local_got_entries): New function.
4713         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4714         symtab_off to all symbol table offsets.
4715         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4716         * object.h (class Got_offset_list): Move to top of file.
4717         (Object::Object): Allow case where input_file == NULL.
4718         (Object::~Object): Likewise.
4719         (Object::input_file): Assert that input_file != NULL.
4720         (Object::lock): Allow case where input_file == NULL.
4721         (Object::unlock): Likewise.
4722         (Object::is_locked): Likewise.
4723         (Object::token): Likewise.
4724         (Object::release): Likewise.
4725         (Object::is_incremental): New function.
4726         (Object::get_mtime): New function.
4727         (Object::for_all_local_got_entries): New function.
4728         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4729         (Object::set_is_in_system_directory): New function.
4730         (Object::is_in_system_directory): New function.
4731         (Object::do_is_incremental): New function.
4732         (Object::do_get_mtime): New function.
4733         (Object::do_for_all_local_got_entries): New function.
4734         (Object::is_in_system_directory_): New data member.
4735         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4736         (class Sized_relobj_base): New class.
4737         (class Sized_relobj): Derive from Sized_relobj_base.
4738         (class Sized_relobj::Symbols): Redeclare from base class.
4739         (class Sized_relobj::local_got_offset_list): Remove.
4740         (class Sized_relobj::Output_sections): Redeclare from base class.
4741         (class Sized_relobj::do_for_all_local_got_entries): New function.
4742         (class Sized_relobj::write_local_symbols): Add offset parameter.
4743         (class Sized_relobj::local_symbol_offset_): Update comment.
4744         (class Sized_relobj::local_dynsym_offset_): Update comment.
4745         * options.cc (Input_arguments::add_file): Remove const.
4746         * options.h (Input_file_argument::Input_file_argument):
4747         Initialize arg_serial_ (all constructors).
4748         (Input_file_argument::set_arg_serial): New function.
4749         (Input_file_argument::arg_serial): New function.
4750         (Input_file_argument::arg_serial_): New data member.
4751         (Input_arguments::Input_arguments): Initialize file_count_.
4752         (Input_arguments::add_file): Remove const.
4753         (Input_arguments::number_of_input_files): New function.
4754         (Input_arguments::file_count_): New data member.
4755         (Command_line::number_of_input_files): Call
4756         Input_arguments::number_of_input_files.
4757         * output.cc (Output_segment_headers::Output_segment_headers):
4758         Set current size.
4759         (Output_section::Input_section::current_data_size): New function.
4760         (Output_section::Output_section): Initialize new data members.
4761         (Output_section::add_input_section): Don't do merge sections for
4762         an incremental link; allocate space from free list for an
4763         incremental update.
4764         (Output_section::add_output_section_data): Allocate space from
4765         free list for an incremental update.
4766         (Output_section::update_data_size): New function.
4767         (Output_section::set_fixed_layout): New function.
4768         (Output_section::reserve): New function.
4769         (Output_segment::set_section_addresses): Remove const.
4770         (Output_segment::set_section_list_addresses): Remove const; allocate
4771         space from free list for an incremental update.
4772         (Output_segment::set_offset): Adjust size of RELRO segment for an
4773         incremental update.
4774         * output.h (Output_data::current_data_size): Move here from
4775         child classes.
4776         (Output_data::pre_finalize_data_size): New function.
4777         (Output_data::update_data_size): New function.
4778         (Output_section_headers::update_data_size): new function.
4779         (Output_section_data_build::current_data_size): Move to Output_data.
4780         (Output_data_strtab::update_data_size): New function.
4781         (Output_section::current_data_size): Move to Output_data.
4782         (Output_section::set_fixed_layout): New function.
4783         (Output_section::has_fixed_layout): New function.
4784         (Output_section::reserve): New function.
4785         (Output_section::update_data_size): New function.
4786         (Output_section::has_fixed_layout_): New data member.
4787         (Output_section::free_list_): New data member.
4788         (Output_segment::set_section_addresses): Remove const.
4789         (Output_segment::set_section_list_addresses): Remove const.
4790         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4791         New function.
4792         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4793         New function.
4794         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4795         parameter when calling Add_symbols constructor; store argument
4796         serial number for members of a lib group.
4797         (Add_symbols::locks): Allow case where token == NULL.
4798         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4799         (Read_member::~Read_member): New function.
4800         (Read_member::is_runnable): New function.
4801         (Read_member::locks): New function.
4802         (Read_member::run): New function.
4803         (Check_script::~Check_script): New function.
4804         (Check_script::is_runnable): New function.
4805         (Check_script::locks): New function.
4806         (Check_script::run): New function.
4807         (Check_library::~Check_library): New function.
4808         (Check_library::is_runnable): New function.
4809         (Check_library::locks): New function.
4810         (Check_library::run): New function.
4811         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4812         (Add_symbols::library_): New data member.
4813         (class Read_member): New class.
4814         (class Check_script): New class.
4815         (class Check_library): New class.
4816         * reloc.cc (Read_relocs::is_runnable): Allow case where
4817         token == NULL.
4818         (Read_relocs::locks): Likewise.
4819         (Scan_relocs::locks): Likewise.
4820         (Relocate_task::locks): Likewise.
4821         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4822         to clear counters.
4823         (Sized_relobj::incremental_relocs_scan): Fix comment.
4824         (Sized_relobj::do_relocate): Pass output file offset to
4825         write_local_symbols.
4826         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4827         from class declaration.
4828         * script.cc (read_input_script): Allocate Script_info; pass
4829         argument serial number to report_script.
4830         * script.h (class Script_info): Move to incremental.h.
4831         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4832         * symtab.h (Symbol_table::add_from_incrobj): New function.
4833         (Symbol_table::set_file_offset): New function.
4834
4835 2011-04-05  Cary Coutant  <ccoutant@google.com>
4836
4837         * incremental-dump.cc (dump_incremental_inputs): Change signature
4838         to take a Sized_incremental_binary; change caller.  Use readers
4839         in Sized_incremental_binary.
4840         * incremental.cc
4841         (Sized_incremental_binary::find_incremental_inputs_sections):
4842         Rename do_find_incremental_inputs_sections to this.
4843         (Sized_incremental_binary::setup_readers): New function.
4844         (Sized_incremental_binary::do_check_inputs): Check
4845         has_incremental_info_ flag; move setup code to setup_readers;
4846         use input readers.
4847         (Sized_incremental_binary::do_file_is_unchanged): New function.
4848         (Sized_incremental_binary::do_get_input_reader): New function.
4849         * incremental.h (class Incremental_binary): Move to end of file.
4850         (Incremental_binary::file_is_unchanged): New function.
4851         (Incremental_binary::do_file_is_unchanged): New function.
4852         (Incremental_binary::Input_reader): New class.
4853         (Incremental_binary::get_input_reader): New function.
4854         (class Sized_incremental_binary): Move to end of file.
4855         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4856         input section reader classes.
4857         (Sized_incremental_binary::has_incremental_info): New function.
4858         (Sized_incremental_binary::inputs_reader): New function.
4859         (Sized_incremental_binary::symtab_reader): New function.
4860         (Sized_incremental_binary::relocs_reader): New function.
4861         (Sized_incremental_binary::got_plt_reader): New function.
4862         (Sized_incremental_binary::do_file_is_unchanged): New function.
4863         (Sized_incremental_binary::Sized_input_reader): New class.
4864         (Sized_incremental_binary::get_input_reader): New function.
4865         (Sized_incremental_binary::find_incremental_inputs_sections):
4866         Rename do_find_incremental_inputs_sections to this.
4867         (Sized_incremental_binary::setup_readers): New function.
4868         (Sized_incremental_binary::has_incremental_info_): New data member.
4869         (Sized_incremental_binary::inputs_reader_): New data member.
4870         (Sized_incremental_binary::symtab_reader_): New data member.
4871         (Sized_incremental_binary::relocs_reader_): New data member.
4872         (Sized_incremental_binary::got_plt_reader_): New data member.
4873         (Sized_incremental_binary::current_input_file_): New data member.
4874
4875 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4876
4877         PR gold/12640
4878         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4879         violation.
4880
4881 2011-03-30  Cary Coutant  <ccoutant@google.com>
4882
4883         * archive.cc (Archive::include_member): Adjust call to report_object.
4884         (Add_archive_symbols::run): Add script_info to call to
4885         report_archive_begin.
4886         (Lib_group::include_member): Adjust call to report_object.
4887         (Add_lib_group_symbols::run): Adjust call to report_object.
4888         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4889         blocks.  Add object count for script input files.
4890         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4891         script_info parameter; change all callers.
4892         (Incremental_inputs::report_object): Add script_info parameter;
4893         change all callers.
4894         (Incremental_inputs::report_script): Store backpointer to
4895         incremental info entry.
4896         (Output_section_incremental_inputs::set_final_data_size): Record
4897         additional information for scripts.
4898         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4899         * incremental.h (Incremental_script_entry::add_object): New function.
4900         (Incremental_script_entry::get_object_count): New function.
4901         (Incremental_script_entry::get_object): New function.
4902         (Incremental_script_entry::objects_): New data member; adjust
4903         constructor.
4904         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4905         (Incremental_inputs::report_object): Add script_info parameter.
4906         (Incremental_inputs_reader::get_object_count): New function.
4907         (Incremental_inputs_reader::get_object_offset): New function.
4908         * options.cc (Input_arguments::add_file): Return reference to
4909         new input argument.
4910         * options.h (Input_argument::set_script_info): New function.
4911         (Input_argument::script_info): New function.
4912         (Input_argument::script_info_): New data member; adjust all
4913         constructors.
4914         (Input_file_group::add_file): Return reference to new input argument.
4915         (Input_file_lib::add_file): Likewise.
4916         (Input_arguments::add_file): Likewise.
4917         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4918         * script.cc (Parser_closure::Parser_closure): Add script_info
4919         parameter; adjust all callers.
4920         (Parser_closure::script_info): New function.
4921         (Parser_closure::script_info_): New data member.
4922         (read_input_script): Report scripts earlier to incremental info.
4923         (script_add_file): Set script_info in Input_argument.
4924         (script_add_library): Likewise.
4925         * script.h (Script_options::Script_info): Rewrite class.
4926
4927 2011-03-29  Cary Coutant  <ccoutant@google.com>
4928
4929         * archive.cc (Library_base::should_include_member): Move
4930         method here from class Archive.
4931         (Archive::Archive): Initialize base class.
4932         (Archive::should_include_member): Move to base class.
4933         (Archive::do_for_all_unused_symbols): New function.
4934         (Add_archive_symbols::run): Remove redundant access to
4935         incremental_inputs.
4936         (Lib_group::Lib_group): Initialize base class.
4937         (Lib_group::do_filename): New function.
4938         (Lib_group::include_member): Pass pointer to Lib_group to
4939         report_object.
4940         (Lib_group::do_for_all_unused_symbols): New function.
4941         (Add_lib_group_symbols::run): Report archive information for
4942         incremental links.
4943         * archive.h (class Library_base): New base class.
4944         (class Archive): Derive from Library_base.
4945         (Archive::filename): Move to base class.
4946         (Archive::set_incremental_info): Likewise.
4947         (Archive::incremental_info): Likewise.
4948         (Archive::Should_include): Likewise.
4949         (Archive::should_include_member): Likewise.
4950         (Archive::Armap_entry): Remove.
4951         (Archive::Unused_symbol_iterator): Remove.
4952         (Archive::unused_symbols_begin): Remove.
4953         (Archive::unused_symbols_end): Remove.
4954         (Archive::do_filename): New function.
4955         (Archive::do_get_mtime): New function.
4956         (Archive::do_for_all_unused_symbols): New function.
4957         (Archive::task_): Move to base class.
4958         (Archive::incremental_info_): Likewise.
4959         (class Lib_group): Derive from Library_base.
4960         (Lib_group::do_filename): New function.
4961         (Lib_group::do_get_mtime): New function.
4962         (Lib_group::do_for_all_unused_symbols): New function.
4963         (Lib_group::task_): Move to base class.
4964         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4965         function.
4966         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4967         function.
4968         * incremental.cc (Incremental_inputs::report_archive_begin):
4969         Use Library_base; call library's get_mtime; add incremental inputs
4970         entry before members.
4971         (class Unused_symbol_visitor): New class.
4972         (Incremental_inputs::report_archive_end): Use Library_base; use
4973         visitor class to record unused symbols; don't add incremental inputs
4974         entry after members.
4975         (Incremental_inputs::report_object): Use Library_base.
4976         * incremental.h
4977         (Incremental_archive_entry::Incremental_archive_entry): Remove
4978         unused Archive parameter.
4979         (Incremental_inputs::report_archive_begin): Use Library_base.
4980         (Incremental_inputs::report_archive_end): Likewise.
4981         (Incremental_inputs::report_object): Likewise.
4982         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4983         function.
4984         * object.h (Object::for_all_global_symbols): New function.
4985         (Object::do_for_all_global_symbols): New function.
4986         (Sized_relobj::do_for_all_global_symbols): New function.
4987         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4988         function.
4989         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4990         function.
4991
4992 2011-03-27  Ian Lance Taylor  <iant@google.com>
4993
4994         * archive.cc (Archive::interpret_header): Return -1 if something
4995         goes wrong.  Change callers accordingly.
4996
4997 2011-03-25  Cary Coutant  <ccoutant@google.com>
4998
4999         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5000         * testsuite/Makefile.in: Regenerate.
5001
5002 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5003
5004         * plugin.cc (get_view): New.
5005         (Plugin::load): Pass get_view to the plugin.
5006         (Plugin_manager::get_view): New.
5007
5008 2011-03-21  Ian Lance Taylor  <iant@google.com>
5009
5010         * testsuite/final_layout.sh: Rewrite to not use dc.
5011         * testsuite/relro_test.sh: Fail if dc is not present.
5012
5013 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5014
5015         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5016         Change == to -eq.
5017         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5018         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5019         Change == to -eq.
5020         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5021         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5022
5023 2011-03-14  Ian Lance Taylor  <iant@google.com>
5024
5025         * script-sections.cc (Sort_output_sections::script_compare):
5026         Rename from is_before, change return type.
5027         (Sort_output_sections::operator()): Adjust accordingly.
5028
5029 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5030
5031         PR gold/12572
5032         * testsuite/odr_violation2.cc: Add comment to make all error line
5033         numbers double digits.
5034         * testsuite/debug_msg.sh: Adjust expected errors.
5035
5036 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5037
5038         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5039         but mark earlier ones as non-canonical
5040         (offset_to_iterator): Update search target and example
5041         (do_addr2line): Return extra lines in a vector*
5042         (format_file_lineno): Extract from do_addr2line
5043         (one_addr2line): Add vector* out-param
5044         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5045         when a lineno entry appeared last for its instruction
5046         (Dwarf_line_info): Add vector* out-param
5047         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5048         * symtab.cc (Odr_violation_compare): Include the lineno in the
5049         comparison again.
5050         (linenos_from_loc): New. Combine the canonical line for an
5051         address with its other lines.
5052         (True_if_intersect): New. Helper functor to make
5053         std::set_intersection a query.
5054         (detect_odr_violations): Compare sets of lines instead of just
5055         one line for each function. This became less deterministic, but
5056         has fewer false positives.
5057         * symtab.h: Declarations.
5058         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5059         mix an optimized and non-optimized object in the same binary
5060         (odr_violation2.so): Same.
5061         * testsuite/Makefile.in: Regenerate from Makefile.am.
5062         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5063         * testsuite/debug_msg.sh: Update line numbers and add
5064         assertions.
5065         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5066         non-optimized context.
5067         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5068         isn't inlined, and use OdrDerived in an optimized context.
5069         * testsuite/odr_header1.h: Defines OdrDerived, where
5070         optimization will change the
5071         first-instruction-in-the-destructor's file and line number.
5072         * testsuite/odr_header2.h: Defines OdrBase.
5073
5074 2011-03-09  Ian Lance Taylor  <iant@google.com>
5075
5076         * fileread.cc (File_read::clear_views): Don't delete the whole
5077         file view.
5078
5079 2011-03-08  Ian Lance Taylor  <iant@google.com>
5080
5081         PR gold/12525
5082         * fileread.cc: #include <climits>.
5083         (GOLD_IOV_MAX): Define.
5084         (File_read::read_multiple): Limit number of entries by iov_max.
5085         * fileread.h (class File_read): Always set max_readv_entries to
5086         128.
5087
5088 2011-03-07  Ian Lance Taylor  <iant@google.com>
5089
5090         PR gold/12525
5091         * options.h (class General_options): Add -dy and -dn.
5092
5093 2011-03-02  Cary Coutant  <ccoutant@google.com>
5094
5095         * testsuite/script_test_9.t: Add TLS segment.
5096
5097 2011-03-02  Simon Baldwin  <simonb@google.com>
5098
5099         * configure.ac: Add check for gnu_indirect_function support in
5100         the toolchain building binutils.
5101         * configure: Rebuild.
5102
5103 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5104
5105         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5106         plugin only symbols.
5107         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5108         in plugin files as not needed in the symbol table.
5109
5110 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5111
5112         * output.cc (Output_section::add_input_section): Delay fill
5113         generation for section ordering.
5114
5115 2011-02-09  Ian Lance Taylor  <iant@google.com>
5116
5117         PR gold/12316
5118         * object.h (class Sized_relobj): Remove clear_local_symbols.
5119         * reloc.cc (Sized_relobj::do_relocate): Don't call
5120         clear_local_symbols.
5121
5122 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5123
5124         * plugin.cc (is_visible_from_outside): Return true for symbols
5125         in the -u option.
5126
5127 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5128
5129         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5130         filename.
5131
5132 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5133
5134         * icf.h (is_section_foldable_candidate): Change type of parameter
5135         to std::string.
5136         * icf.cc (Icf::find_identical_sections): Change type of local variable
5137         section_name to be std::string.
5138         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5139
5140 2011-01-25  Ian Lance Taylor  <iant@google.com>
5141
5142         * script.cc (script_add_extern): Rewrite to use
5143         add_symbol_reference.
5144
5145 2011-01-25  Doug Kwan  <dougkwan@google.com>
5146
5147         * icf.cc (get_section_contents): Always lock section's object.
5148
5149 2011-01-24  Ian Lance Taylor  <iant@google.com>
5150
5151         * options.h (class General_options): Accept
5152         --no-detect-odr-violations.
5153
5154 2011-01-24  Ian Lance Taylor  <iant@google.com>
5155
5156         * version.cc (version_string): Bump to 1.11.
5157
5158 2011-01-24  Ian Lance Taylor  <iant@google.com>
5159
5160         * plugin.cc (class Plugin_rescan): Define new class.
5161         (Plugin_manager::claim_file): Set any_claimed_.
5162         (Plugin_manager::save_archive): New function.
5163         (Plugin_manager::save_input_group): New function.
5164         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5165         necessary.
5166         (Plugin_manager::new_undefined_symbol): New function.
5167         (Plugin_manager::rescan): New function.
5168         (Plugin_manager::rescannable_defines): New function.
5169         (Plugin_manager::add_input_file): Set any_added_.
5170         * plugin.h (class Plugin_manager): define new fields rescannable_,
5171         undefined_symbols_, any_claimed_, and any_added_.  Declare
5172         Plugin_rescan as friend.  Declare new functions.
5173         (Plugin_manager::Rescannable): Define type.
5174         (Plugin_manager::Rescannable_list): Define type.
5175         (Plugin_manager::Undefined_symbol_list): Define type.
5176         (Plugin_manager::Plugin_manager): Initialize new fields.
5177         * archive.cc (Archive::defines_symbol): New function.
5178         (Add_archive_symbols::run): Pass archive to plugins if any.
5179         * archive.h (class Archive): Declare defines_symbol.
5180         * readsyms.cc (Input_group::~Input_group): New function.
5181         (Finish_group::run): Pass input_group to plugins if any.
5182         * readsyms.h (class Input_group): Declare destructor.
5183         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5184         any.
5185
5186 2011-01-10  Ian Lance Taylor  <iant@google.com>
5187
5188         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5189         section as relro.
5190         (Layout::set_segment_offsets): Reset increase_relro before calling
5191         set_section_addresses a second time.
5192
5193 2011-01-04  Cary Coutant  <ccoutant@google.com>
5194
5195         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5196         sections before NOBITS sections.
5197
5198 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5199
5200         * version.cc (print_version): Update copyright to 2011.
5201
5202 2010-12-23  Cary Coutant  <ccoutant@google.com>
5203
5204         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5205         of OS to this->add.  Add OD parameter to second form of the function.
5206
5207 2010-12-20  Ian Lance Taylor  <iant@google.com>
5208
5209         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5210         second of two consecutive entries with same offset.
5211
5212 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5213
5214         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5215         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5216         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5217         to avoid unneeded links against $(LDADD).
5218         * testsuite/Makefile.in: Regenerate.
5219
5220 2010-12-15  Ian Lance Taylor  <iant@google.com>
5221
5222         PR gold/12324
5223         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5224         for R_X86_64_32 and R_X86_64_PC32.
5225         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5226         ver_matching_def_pic.o.
5227         (ver_matching_def_pic.o): New target.
5228
5229 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5230
5231         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5232         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5233         Move definition before File_read::View member definitions.
5234         (File_read::View::~View): Initialize and hold lock before
5235         updating current_mapped_bytes.
5236
5237 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5238
5239         * dwarf_reader.cc: Remove outdated comment.
5240         * gold-threads.cc: Fix typo in error message.
5241         * archive.cc: Fix typos in comments.
5242         * archive.h: Likewise.
5243         * arm-reloc-property.cc: Likewise.
5244         * arm-reloc-property.h: Likewise.
5245         * arm-reloc.def: Likewise.
5246         * arm.cc: Likewise.
5247         * attributes.h: Likewise.
5248         * cref.cc: Likewise.
5249         * ehframe.cc: Likewise.
5250         * fileread.h: Likewise.
5251         * gold.h: Likewise.
5252         * i386.cc: Likewise.
5253         * icf.cc: Likewise.
5254         * incremental.h: Likewise.
5255         * int_encoding.cc: Likewise.
5256         * layout.h: Likewise.
5257         * main.cc: Likewise.
5258         * merge.h: Likewise.
5259         * object.cc: Likewise.
5260         * object.h: Likewise.
5261         * options.cc: Likewise.
5262         * readsyms.cc: Likewise.
5263         * reduced_debug_output.cc: Likewise.
5264         * reloc.cc: Likewise.
5265         * script-sections.cc: Likewise.
5266         * sparc.cc: Likewise.
5267         * symtab.h: Likewise.
5268         * target-reloc.h: Likewise.
5269         * target.cc: Likewise.
5270         * target.h: Likewise.
5271         * timer.cc: Likewise.
5272         * timer.h: Likewise.
5273         * x86_64.cc: Likewise.
5274
5275 2010-12-09  Cary Coutant  <ccoutant@google.com>
5276
5277         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5278         stack.
5279         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5280         parameter; change all callers.
5281         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5282         * options.h (warn_execstack): New option.
5283
5284 2010-12-07  Doug Kwan  <dougkwan@google.com>
5285
5286         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5287         like function call relocations.
5288
5289 2010-12-07  Ian Lance Taylor  <iant@google.com>
5290
5291         * archive.cc (Archive::get_elf_object_for_member): Permit
5292         punconfigured to be NULL.
5293         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5294         (Archive::include_member): Pass NULL to get_elf_object_for_member
5295         if we searched for the archive and this is the first included
5296         object.
5297
5298 2010-12-01  Ian Lance Taylor  <iant@google.com>
5299
5300         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5301         track_relocs_type_ field.
5302         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5303         Set track_relocs_type_.
5304         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5305         contents when using RELA relocs.
5306         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5307         reloc_map_.
5308         * reloc.cc (Track_relocs::next_addend): New function.
5309         * reloc.h (class Track_relocs): Declare next_addend.
5310
5311 2010-12-01  Ian Lance Taylor  <iant@google.com>
5312
5313         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5314         virtual destructor.
5315
5316 2010-12-01  Ian Lance Taylor  <iant@google.com>
5317
5318         * README: Update compilers known to work and fail.
5319
5320 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5321
5322         * configure.in: For --enable-gold, handle value `default' instead of
5323         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5324         not the default.
5325         * configure: Regenerate.
5326
5327 2010-11-18  Doug Kwan  <dougkwan@google.com>
5328
5329         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5330         and right_alignment to be zero.  Store result alignment only if it is
5331         greater than existing alignment.
5332
5333 2010-11-16  Cary Coutant  <ccoutant@google.com>
5334
5335         PR gold/12220
5336         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5337         Check for ".zdebug_line".
5338
5339 2010-11-16  Doug Kwan  <dougkwan@google.com>
5340             Cary Coutant  <ccoutant@google.com>
5341
5342         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5343         by reference; adjust all callers.
5344         * output.cc (Output_segment::set_section_addresses): Adjust references
5345         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5346         list is empty.
5347         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5348         end at page boundary.
5349
5350 2010-11-16  Cary Coutant  <ccoutant@google.com>
5351
5352         PR gold/12220
5353         * layout.cc (Layout::choose_output_section): Transform names of
5354         compressed sections even when using a script with a SECTIONS clause.
5355         (Layout::output_section_name): Remove code to transform
5356         compressed debug section names.
5357         * output.cc (Output_section::add_input_section): Use uncompressed
5358         section size when tracking input sections.
5359
5360 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5361
5362         * symtab.h (Symbol::NON_PIC_REF): Remove.
5363         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5364         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5365         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5366         (Symbol::use_plt_offset): Take a flags argument and pass it
5367         directly to needs_dynamic_reloc.  Restrict check for undefined
5368         weak symbols to function calls.
5369         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5370         (Target_arm::Scan::global): Use it.
5371         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5372         (Target_arm::Relocate::relocate): Likewise.
5373         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5374         parameter with an r_type parameter.  Use get_reference_flags
5375         to get the flags.
5376         (Target_arm::Relocate::relocate): Update accordingly.
5377         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5378         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5379         (Target_i386::Scan::global): Likewise.
5380         (Target_i386::Relocate::relocate): Likewise.
5381         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5382         parameter with an r_type parameter.  Use get_reference_flags
5383         to get the flags.
5384         (Target_i386::Relocate::relocate): Update accordingly.
5385         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5386         (Target_powerpc::Scan::global): Use it.
5387         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5388         (Target_powerpc::Relocate::relocate): Likewise.
5389         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5390         (Target_sparc::Scan::global): Use it.
5391         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5392         (Target_sparc::Relocate::relocate): Likewise.
5393         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5394         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5395         (Target_x86_64::Scan::global): Likewise.
5396         (Target_x86_64::Relocate::relocate): Likewise.
5397
5398 2010-11-08  Doug Kwan  <dougkwan@google.com>
5399             Cary Coutant  <ccoutant@google.com>
5400
5401         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5402         (Arm_exidx_merge_section::section_contents_): New data member.
5403         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5404         (Arm_input_section::~Arm_input_section): De-allocate memory.
5405         (Arm_input_section::original_contents_): New data member.
5406         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5407         in parameters instead of calling Object::section_contents without
5408         locking.
5409         (Arm_output_section::group_section): New parameter TASK.  Pass it
5410         to callees that need locking objects.
5411         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5412         to lock EXIDX input sections.  Fix a formatting issue.  Call
5413         Arm_exidx_merged_section::build_contents to create merged section
5414         contents.
5415         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5416         to lock object of stub table owner.
5417         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5418         TEXT_SIZE to initialize data member TEXT_SIZE_.
5419         (Arm_exidx_input_section::addralign): Fix typo in comment.
5420         (Arm_exidx_input_section::text_size): New method.
5421         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5422         that require locking objects.  Lock objects before scanning for stubs
5423         and updating local symbols.
5424         (Arm_input_section<big_endian>::init): Copy contents of original
5425         input section.
5426         (Arm_input_section<big_endian>::do_write): Use saved contents of
5427         original input section instead of calling Object::section_contents
5428         without locking.
5429         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5430         size without calling Object::section_size().
5431         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5432         for size.  Allocate a buffer for merged EXIDX entries.
5433         (Arm_exidx_merged_section::build_contents): New method.
5434         (Arm_exidx_merged_section::do_write): Move merge section contents
5435         building code to Arm_exidx_merged_section::build_contetns.  Write
5436         out contetns in buffer instead of building it on the fly.
5437         (Arm_relobj::make_exidx_input_section): Also pass text section size
5438         to Arm_exidx_input_section constructor.
5439         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5440         (Arm_dynobj::do_read_symbols): Fix memory leak.
5441         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5442         * target.h: (class Task): Add forward declaration.
5443         (Target::relax): Add new parameter TASK and pass it to
5444         Target::do_relax().
5445         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5446
5447 2010-11-05  Cary Coutant  <ccoutant@google.com>
5448
5449         PR gold/10708
5450         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5451         object when reading from the file.
5452         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5453         second layout pass.
5454         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5455         when reading section contents.
5456         (get_section_contents): Likewise.
5457         (icf::find_identical_sections): Likewise.
5458         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5459         object when reading from the file.
5460         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5461         the object when doing deferred section layout.
5462
5463 2010-11-03  Nick Clifton  <nickc@redhat.com>
5464
5465         PR gold/12001
5466         * script.h (class Symbol_assignment: name): New member.  Returns
5467         the name of the symbol.
5468         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5469         Returns true if the given symbol name is on the list of
5470         assignments wating to be processed.
5471         * archive.cc (should_incldue_member): If the symbol is undefined,
5472         check to see if it is on the list of symbols pending assignment.
5473
5474 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5475
5476         * script-sections.cc (Script_sections::find_memory_region): Check
5477         for a NULL output section pointer.
5478
5479 2010-10-29  Doug Kwan  <dougkwan@google.com>
5480
5481         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5482         Output_section::add_relaxed_input_section.
5483         * output.cc (Output_section::add_relaxed_input_section): Add new
5484         arguments LAYOUT and NAME.  Set section order index.
5485         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5486         Copy section order index.
5487         * output.h (Output_section::add_relaxed_input_section): Add new
5488         arguments LAYOUT and NAME.
5489
5490 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5491
5492         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5493         NATIVE_OR_CROSS_LINKER.
5494         * testsuite/Makefile.in: Regenerate.
5495
5496 2010-10-20  Doug Kwan  <dougkwan@google.com>
5497
5498         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5499         without SHF_LINK_ORDER flags.
5500         * layout.cc (Layout::choose_output_section): Do not filter
5501         SHF_LINK_ORDER flag in a relocatable link.
5502
5503 2010-10-17  Cary Coutant  <ccoutant@google.com>
5504
5505         * output.h (Output_segment::set_section_addresses): Change function
5506         signature.  Update all callers.
5507         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5508         sections.
5509         (Output_segment::set_section_addresses): Align after last TLS
5510         section.  Add padding before last relro section instead of after.
5511
5512 2010-10-17  Doug Kwan  <dougkwan@google.com>
5513
5514         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5515         GOT output section to be writable.
5516
5517 2010-10-14  Cary Coutant  <ccoutant@google.com>
5518
5519         * debug.h (DEBUG_INCREMENTAL): New flag.
5520         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5521         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5522         mode.
5523         * incremental.cc (report_command_line): Ignore all forms of
5524         --incremental.
5525         * layout.cc (Layout::Layout): Check parameters for incremental link
5526         mode.
5527         * options.cc (General_options::parse_incremental): New function.
5528         (General_options::parse_no_incremental): New function.
5529         (General_options::parse_incremental_full): New function.
5530         (General_options::parse_incremental_update): New function.
5531         (General_options::incremental_mode_): New data member.
5532         (General_options::finalize): Check incremental_mode_.
5533         * options.h (General_options): Update help text for --incremental.
5534         Add --no-incremental, --incremental-full, --incremental-update.
5535         (General_options::Incremental_mode): New enum type.
5536         (General_options::incremental_mode): New function.
5537         (General_options::incremental_mode_): New data member.
5538         * parameters.cc (Parameters::incremental_mode_): New data member.
5539         (Parameters::set_options): Set incremental_mode_.
5540         (Parameters::set_incremental_full): New function.
5541         (Parameters::incremental): New function.
5542         (Parameters::incremental_update): New function.
5543         (set_parameters_incremental_full): New function.
5544         * parameters.h (Parameters::set_incremental_full): New function.
5545         (Parameters::incremental): New function.
5546         (Parameters::incremental_update): New function.
5547         (Parameters::incremental_mode_): New data member.
5548         (set_parameters_incremental_full): New function.
5549         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5550         incremental link mode.
5551         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5552         (Sized_relobj::do_relocate_sections): Likewise.
5553         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5554         option.
5555         * testsuite/Makefile.in: Regenerate.
5556         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5557
5558 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5559
5560         * script-sections.h (class Script_sections): Make
5561         Sections_elements typedef public.
5562         * script-sections.cc (class Sort_output_sections): Add elements_
5563         field.  Add constructor which sets it; change all callers.
5564         (Sort_output_sections::is_before): New function.
5565         (Sort_output_sections::operator()): Call is_before.
5566         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5567         conditional.
5568         * testsuite/script_test_10.sh: New test. Test script section
5569         order.
5570         * testsuite/script_test_10.t: Likewise.
5571         * testsuite/script_test_10.s: Likewise.
5572         * testsuite/Makefile.am: Wrap the cross linker tests and the
5573         common tests into NATIVE_OR_CROSS_LINKER.
5574         (check_SCRIPTS): Add script_test_10.sh.
5575         (check_DATA): Add script_test_10.stdout.
5576         (script_test_10.o, script_test_10): New targets.
5577         (script_test_10.stdout): New target.
5578         * configure, testsuite/Makefile.in: Regenerate.
5579
5580 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5581
5582         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5583         error for the deprecated relocations.
5584         (Target_arm::Scan::global): Likewise.
5585         (Target_arm::Relocate::relocate): Likewise.
5586
5587 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5588
5589         * fileread.cc (Input_file::find_file): Initialize *found_name
5590         and *namep when using the fallback search for case 4.
5591
5592 2010-10-11  Cary Coutant  <ccoutant@google.com>
5593
5594         * options.h (class General_options): Redefine -z lazy as an alias for
5595         the negation of -z now.
5596
5597 2010-10-11  Ian Lance Taylor  <iant@google.com>
5598
5599         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5600         binding.
5601
5602 2010-10-06  Nick Clifton  <nickc@redhat.com>
5603
5604         * script-sections.cc(class Memory_region): Remove
5605         current_lma_offset_ field.  Rename current_vma_offset_ to
5606         current_offset_.  Add last_section_ field.
5607         (Memory_region::get_current_vma_address): Rename to
5608         get_current_address.
5609         (Memory_region::get_current_lma_address): Delete.
5610         (Memory_region::increment_vma_offset): Rename to
5611         increment_offset.
5612         (Memory_region::increment_lma_offset): Delete.
5613         (Memory_region::attributes_compatible): New method.  Returns
5614         true if the provided section is compatible with the region.
5615         (Memory_region::get_last_section): New method.  Returns the last
5616         section to use the region.
5617         (Memory_region::set_last_section): New method.  Stores the last
5618         section to use the region.
5619         (Script_sections::block_in_region): New method.  Returns true if
5620         a block of memory is contained within a region.
5621         (Script_sections::find_memory_region): New method.  Locates a
5622         memory region to be used to set a VMA or LMA address.
5623         (Output_section_definition::set_section_addresses): Add code to
5624         check for addresses set by memory regions.
5625         (Output_segment::set_section_addresses): Remove memory region
5626         walking code.
5627         (Script_sections::create_segment): Add a warning if a header
5628         segment is created outside of any region.
5629         * script-sections.h (class Script_sections): Add prototypes for
5630         find_memory_region and block_in_region methods.
5631         * testsuite/memory_test.s: Use .long instead of .word.
5632         * testsuite/memory_test.t: Add some more output sections.
5633         * testsuite/memory_test.sh: Update expected output.
5634
5635 2010-10-02  Doug Kwan  <dougkwan@google.com>
5636
5637         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5638         defintion to symtab.h
5639         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5640         declaration to defintion.
5641
5642 2010-10-01  Nick Clifton  <nickc@redhat.com>
5643
5644         * expression.cc (eval): Replace dummy argument with NULL.
5645         (eval_maybe_dot): Check for a NULL result section pointer.
5646         (Symbol_expression::value): Likewise.
5647         (Dot_expression::value): Likewise.
5648         (BINARY_EXPRESSION): Likewise.
5649         (Max_expression::value): Likewise.
5650         (Min_expression::value): Likewise.
5651         (Absolute_expression::value): Likewise.
5652         (Addr_expression::value_from_output_section): Likewise.
5653         (Loaddddr_expression::value_from_output_section): Likewise.
5654         (Segment_start_expression::value): Likewise.
5655         * script-sections.cc
5656         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5657         argument with NULL.
5658         (Sections_elememt_dot_assignment::set_section_addresses):
5659         Likewise.
5660         (Output_data_expression::do_write_to_buffer): Likewise.
5661         (Output_section_definition::finalize_symbols): Likewise.
5662         (Output_section_definition::set_section_addresses): Likewise.
5663
5664 2010-09-30  Doug Kwan  <dougkwan@google.com>
5665
5666         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5667
5668 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5669
5670         * target.h (Target::can_icf_inline_merge_sections): New virtual
5671         function.
5672         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5673         virtual function.
5674         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5675         virtual function.
5676         * icf.cc (get_section_contents): Inline merge sections only when
5677         target allows it.
5678
5679 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5680
5681         * configure: Regenerate.
5682
5683 2010-09-17  Ian Lance Taylor  <iant@google.com>
5684
5685         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5686         * testsuite/Makefile.am (memory_test.o): New target.
5687         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5688         memory_test.t.
5689         * testsuite/Makefile.in: Rebuild.
5690
5691 2010-09-17  Doug Kwan  <dougkwan@google.com>
5692
5693         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5694         defintion if relocation uses GOT entries of the symbol.
5695         * testsuite/icf_safe_test.sh: Fix test.
5696         * testsuite/icf_safe_so_test.sh: Fix test.
5697
5698 2010-09-16  Cary Coutant  <ccoutant@google.com>
5699
5700         * script_sections.cc (class Memory_region): Remove "NULL" from
5701         vector initializations.
5702
5703 2010-09-15  Cary Coutant  <ccoutant@google.com>
5704
5705         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5706         Resolve forwarding symbols.
5707
5708 2010-09-15  Doug Kwan  <dougkwan@google.com>
5709
5710         * gold/testsuite/script_test_3.t: Add ARM special sections.
5711         * gold/testsuite/script_test_4.t: Same.
5712         * gold/testsuite/script_test_5.t: Same.
5713         * gold/testsuite/script_test_6.t: Same.
5714         * gold/testsuite/script_test_7.t: Same.
5715         * gold/testsuite/script_test_7.t: Same.
5716         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5717
5718 2010-09-14  Cary Coutant  <ccoutant@google.com>
5719
5720         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5721         (Target_x86_64::Relocate::relocate_tls): Replace check for
5722         saw_tls_block_reloc_ with test for executable section.
5723
5724 2010-09-12  Cary Coutant  <ccoutant@google.com>
5725
5726         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5727         position-independent executables to shared libraries need dynamic
5728         relocations.
5729         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5730         position-independent executables.
5731         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5732         * testsuite/Makefile.in: Regenerate.
5733
5734 2010-09-10  Nick Clifton  <nickc@redhat.com>
5735
5736         PR gold/11997
5737         * testsuite/memory_test.t: Discard any sections that are not
5738         needed.
5739
5740 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5741
5742         PR gold/11996
5743         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5744         "This::" to work around a bug in gcc 4.2.
5745
5746         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5747
5748 2010-09-09  Rafael Espindola  <espindola@google.com>
5749
5750         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5751         sections with different PF_X flags in the same segment.
5752         (Layout::find_first_load_seg): Search all segments to find the first
5753         one.
5754         * options.h (rosegment): New.
5755
5756 2010-09-08  Rafael Espindola  <espindola@google.com>
5757
5758         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5759
5760 2010-09-08  Doug Kwan  <dougkwan@google.com>
5761
5762         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5763         (Arm_relobj::do_relocate_sections): Add new parameter for output
5764         file to match the parent.
5765         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5766         of local symbols instead of input values.  Update code to track
5767         changes in gold::relocate_section.
5768         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5769         (Sized_relobj::compute_final_local_value_internal): New methods.
5770         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5771         body into private version of Sized_relobj::compute_final_local_value.
5772         Call the inline method.
5773         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5774         merged symbol value if there is one.
5775         (Symbol_value::has_output_value): New method defintiion.
5776         (Sized_relobj::Compute_final_local_value_status): New enum type.
5777         (Sized_relobj::compute_final_local_value): New methods.
5778         (Sized_relobj::compute_final_local_value_internal): New methods.
5779         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5780         and arm_cortex_a8.sh.
5781         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5782         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5783         New tests.
5784         * Makefile.in: Regenerate.
5785         * testsuite/arm_bl_out_of_range.s: Update test.
5786         * testsuite/thumb_bl_out_of_range.s: Ditto.
5787         * testsuite/thumb_blx_out_of_range.s: Ditto.
5788         * testsuite/arm_branch_out_of_range.sh: New file.
5789         * testsuite/arm_cortex_a8.sh: Ditto.
5790         * testsuite/arm_cortex_a8_b.s: Ditto.
5791         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5792         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5793         * testsuite/arm_cortex_a8_bl.s: Ditto.
5794         * testsuite/arm_cortex_a8_blx.s: Ditto.
5795         * testsuite/arm_cortex_a8_local.s: Ditto.
5796         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5797         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5798
5799 2010-09-08  Rafael Espindola  <espindola@google.com>
5800
5801         * Makefile.am (memory_test.stdout): Run readelf with -W.
5802         * Makefile.in: Regenerate.
5803         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5804         64 bit output.
5805
5806 2010-09-08  Rafael Espindola  <espindola@google.com>
5807
5808         * script-sections.cc (Script_sections::add_memory_region): Convert
5809         field precision to int.
5810         * script.cc (script_set_section_region, script_set_section_region):
5811         Convert field precision to int.
5812
5813 2010-09-08  Rafael Espindola  <espindola@google.com>
5814
5815         * arm.cc (do_finalize_sections): Create the __exidx_start and
5816         __exdix_end symbols even when the section is missing.
5817
5818 2010-09-08  Nick Clifton  <nickc@redhat.com>
5819
5820         * README: Remove claim that MEMORY is not supported.
5821         * expression.cc (script_exp_function_origin)
5822         (script_exp_function_length): Move from here to ...
5823         * script.cc: ... here.
5824         (script_set_section_region, script_add_memory)
5825         (script_parse_memory_attr, script_include_directive): New
5826         functions.
5827         * script-sections.cc
5828         (class Memory_region): New class.
5829         (class Output_section_definition): Add set_memory_region,
5830         set_section_vma, set_section_lma and get_section_name methods.
5831         (class Script_Sections): Add add_memory_region,
5832         find_memory_region, find_memory_region_origin,
5833         find_memory_region_length and set_memory_region methods.
5834         Have set_section_addresses method walk the list of set memory
5835         regions.
5836         Extend the print methos to display memory regions.
5837         * script-sections.h: Add prototypes for new methods.
5838         Add enum for MEMORY region attributes.
5839         * yyscript.y: Add support for parsing MEMORY regions.
5840         * script-c.h: Add prototypes for new functions.
5841         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5842         * testsuite/Makefile.in: Regenerate.
5843         * testsuite/memory_test.sh: New script.
5844         * testsuite/memory_test.s: New assembler source file.
5845         * testsuite/memory_test.t: New linker script.
5846
5847 2010-08-27  Doug Kwan  <dougkwan@google.com>
5848
5849         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5850         reference override an existing dynamic weak reference.
5851         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5852         * testsuite/Makefile.in: Regenerate.
5853         * testsuite/dyn_weak_ref.sh: New file.
5854         * testsuite/dyn_weak_ref_1.c: Ditto.
5855         * testsuite/dyn_weak_ref_2.c: Ditto.
5856
5857 2010-08-27  Ian Lance Taylor  <iant@google.com>
5858
5859         * incremental.h (class Incremental_input_entry): Add virtual
5860         destructor.
5861
5862 2010-08-27  Ian Lance Taylor  <iant@google.com>
5863
5864         * testsuite/start_lib_test_3.c: Mark t3 as used.
5865
5866 2010-08-27  Nick Clifton  <nickc@redhat.com>
5867
5868         * options.cc (version_script): Fix small typo in previous
5869         whitespace tidyup.
5870
5871 2010-08-25  Nick Clifton  <nickc@redhat.com>
5872
5873         * archive.cc: Formatting fixes: Remove whitespace between
5874         typename and following asterisk.  Remove whitespace between
5875         function name and opening parenthesis.
5876         * archive.h: Likewise.
5877         * arm.cc: Likewise.
5878         * attributes.cc: Likewise.
5879         * attributes.h: Likewise.
5880         * common.cc: Likewise.
5881         * copy-relocs.cc: Likewise.
5882         * dirsearch.h: Likewise.
5883         * dynobj.cc: Likewise.
5884         * ehframe.cc: Likewise.
5885         * ehframe.h: Likewise.
5886         * expression.cc: Likewise.
5887         * fileread.cc: Likewise.
5888         * fileread.h: Likewise.
5889         * gc.h: Likewise.
5890         * gold-threads.cc: Likewise.
5891         * gold.cc: Likewise.
5892         * i386.cc: Likewise.
5893         * icf.h: Likewise.
5894         * incremental-dump.cc: Likewise.
5895         * incremental.cc: Likewise.
5896         * layout.cc: Likewise.
5897         * layout.h: Likewise.
5898         * main.cc: Likewise.
5899         * merge.cc: Likewise.
5900         * merge.h: Likewise.
5901         * object.cc: Likewise.
5902         * object.h: Likewise.
5903         * options.cc: Likewise.
5904         * options.h: Likewise.
5905         * output.cc: Likewise.
5906         * output.h: Likewise.
5907         * plugin.cc: Likewise.
5908         * plugin.h: Likewise.
5909         * powerpc.cc: Likewise.
5910         * reloc.cc: Likewise.
5911         * script-c.h: Likewise.
5912         * script-sections.cc: Likewise.
5913         * script.cc: Likewise.
5914         * stringpool.cc: Likewise.
5915         * symtab.cc: Likewise.
5916         * symtab.h: Likewise.
5917         * target.cc: Likewise.
5918         * timer.cc: Likewise.
5919         * timer.h: Likewise.
5920         * version.cc: Likewise.
5921         * x86_64.cc: Likewise.
5922
5923 2010-08-24  Nick Clifton  <nickc@redhat.com>
5924
5925         PR 11899
5926         * layout.cc (segment_precedes): Sort segments by their physical
5927         addresses, if they have been set.
5928
5929 2010-08-23  Cary Coutant  <ccoutant@google.com>
5930
5931         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5932         symbols data.
5933         (Lib_group::include_member): Unlock object after deleting its
5934         symbols data.
5935         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5936         the bug fixed here.
5937
5938 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5939             Cary Coutant  <ccoutant@google.com>
5940
5941         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5942         constructor, and set_blocker.
5943         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5944         readsyms_blocker_.
5945         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5946         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5947         * testsuite/Makefile.am (start_lib_test): New test case.
5948         * testsuite/Makefile.in: Regenerate.
5949         * testsuite/start_lib_test_main.c: New file.
5950         * testsuite/start_lib_test_1.c: New file.
5951         * testsuite/start_lib_test_2.c: New file.
5952         * testsuite/start_lib_test_3.c: New file.
5953
5954 2010-08-19  Ian Lance Taylor  <iant@google.com>
5955
5956         * Makefile.in: Rebuild with automake 1.11.1.
5957         * aclocal.m4: Likewise.
5958         * testsuite/Makefile.in: Likewise.
5959
5960 2010-08-19  Ian Lance Taylor  <iant@google.com>
5961
5962         PR 10893
5963         * i386.cc (class Output_data_plt_i386): Update declarations.
5964         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5965         local_ifuncs_ fields.
5966         (Target_i386::do_plt_section_for_global): New function.
5967         (Target_i386::do_plt_section_for_local): New function.
5968         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5969         parameter; change all callers.  Initialize global_ifuncs_ and
5970         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5971         __rel_iplt_end.
5972         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5973         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5974         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5975         symbols.
5976         (Target_i386::make_plt_section): New function, broken out of
5977         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5978         (Target_i386::make_plt_entry): Call make_plt_section.
5979         (Target_i386::make_local_ifunc_plt_entry): New function.
5980         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5981         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5982         R_386_IRELATIVE to switch.
5983         (Target_i386::Scan::global): Likewise.
5984         (Target_i386::Relocate::relocate): Likewise.
5985         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5986         switch.
5987         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5988         (Target_x86_64::do_plt_section_for_global): New function.
5989         (Target_x86_64::do_plt_section_for_local): New function.
5990         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5991         parameter; change all callers.  If doing a static link define
5992         __rela_iplt_start and __rela_iplt_end.
5993         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5994         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5995         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5996         to point to .plt.
5997         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5998         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5999         switch.
6000         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6001         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6002         R_X86_64_IRELATIVE to switch.
6003         (Target_x86_64::Scan::global): Likewise.
6004         (Target_x86_64::Relocate::relocate): Likewise.
6005         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6006         switch.
6007         * target.h (class Target): Add plt_section_for_global and
6008         plt_section_for_local functions.  Add do_plt_section_for_global
6009         and do_plt_section_for_local virtual functions.
6010         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6011         clarifying comments.
6012         (Symbol::use_plt_offset): Handle IFUNC symbol.
6013         * object.cc (Sized_relobj::Sized_relobj): Initialize
6014         local_plt_offsets_.
6015         (Sized_relobj::local_has_plt_offset): New function.
6016         (Sized_relobj::local_plt_offset): New function.
6017         (Sized_relobj::set_local_plt_offset): New function.
6018         (Sized_relobj::do_count): Handle IFUNC symbol.
6019         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6020         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6021         is_ifunc_symbol functions.
6022         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6023         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6024         local_plt_offsets_ field.
6025         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6026         * output.h (class Output_section_data): Add non-const
6027         output_section function.
6028         (class Output_data_got): Update declarations.
6029         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6030         Add use_plt_offset parameter to global and local constructors.
6031         Change all callers.  Change local_sym_index_ field to 31 bits.
6032         Change GSYM_CODE and CONSTANT_CODE accordingly.
6033         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6034         doing a static link don't set sh_link field.
6035         (Output_data_got::Got_entry::write): Use PLT offset if
6036         appropriate.
6037         (Output_data_got::add_global_plt): New function.
6038         (Output_data_got::add_local_plt): New function.
6039         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6040         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6041         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6042         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6043         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6044         IFUNC conditional.
6045         * testsuite/ifunc-sel.h: New file.
6046         * testsuite/ifuncmain1.c: New file.
6047         * testsuite/ifuncmain1vis.c: New file.
6048         * testsuite/ifuncmod1.c: New file.
6049         * testsuite/ifuncdep2.c: New file.
6050         * testsuite/ifuncmain2.c: New file.
6051         * testsuite/ifuncmain3.c: New file.
6052         * testsuite/ifuncmod3.c: New file.
6053         * testsuite/ifuncmain4.c: New file.
6054         * testsuite/ifuncmain5.c: New file.
6055         * testsuite/ifuncmod5.c: New file.
6056         * testsuite/ifuncmain6pie.c: New file.
6057         * testsuite/ifuncmod6.c: New file.
6058         * testsuite/ifuncmain7.c: New file.
6059         * configure, testsuite/Makefile.in: Rebuild.
6060
6061 2010-08-18  Ian Lance Taylor  <iant@google.com>
6062
6063         * incremental.cc
6064         (Output_section_incremental_inputs::write_input_files): Add cast
6065         to avoid signed/unsigned comparison warning.
6066         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6067
6068 2010-08-12  Cary Coutant  <ccoutant@google.com>
6069
6070         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6071
6072 2010-08-13  Ian Lance Taylor  <iant@google.com>
6073
6074         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6075
6076 2010-08-12  Cary Coutant  <ccoutant@google.com>
6077             Doug Kwan  <dougkwan@google.com>
6078
6079         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6080         defintion overrides non-weak undef, remember that the original undef
6081         is not weak.
6082         * symtab.cc (Symbol_table::sized_write_global): For undef without
6083         an original weak binding, set binding to global in output.
6084         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6085         * testsuite/Makefile.in: Regenerate.
6086         * testsuite/strong_ref_weak_def.sh: New file.
6087         * testsuite/strong_ref_weak_def_1.c: Ditto.
6088         * testsuite/strong_ref_weak_def_2.c: Ditto.
6089
6090 2010-08-12  Cary Coutant  <ccoutant@google.com>
6091
6092         * testsuite/incremental_test.sh: Rewrite.
6093         * testsuite/incremental_test_1.c: Rewrite.
6094         * testsuite/incremental_test_2.c: Rewrite.
6095
6096 2010-08-12  Cary Coutant  <ccoutant@google.com>
6097
6098         * arm.cc (Target_arm::got_size): Add const.
6099         (Target_arm::got_entry_count): New function.
6100         (Target_arm::plt_entry_count): New function.
6101         (Target_arm::first_plt_entry_offset): New function.
6102         (Target_arm::plt_entry_size): New function.
6103         (Output_data_plt_arm::entry_count): New function.
6104         (Output_data_plt_arm::first_plt_entry_offset): New function.
6105         (Output_data_plt_arm::get_plt_entry_size): New function.
6106         * i386.cc (Target_i386::got_size): Add const.
6107         (Target_i386::got_entry_count): New function.
6108         (Target_i386::plt_entry_count): New function.
6109         (Target_i386::first_plt_entry_offset): New function.
6110         (Target_i386::plt_entry_size): New function.
6111         (Output_data_plt_i386::entry_count): New function.
6112         (Output_data_plt_i386::first_plt_entry_offset): New function.
6113         (Output_data_plt_i386::get_plt_entry_size): New function.
6114         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6115         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6116         * incremental.cc: Include target.h.
6117         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6118         parameter.  Adjust all callers.  Find incremental_got_plt section.
6119         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6120         section.
6121         (Output_section_incremental_inputs::set_final_data_size): Calculate
6122         size of incremental_got_plt section.
6123         (Output_section_incremental_inputs::do_write): Write the
6124         incremental_got_plt section.
6125         (Got_plt_view_info): New struct.
6126         (Local_got_offset_visitor): New class.
6127         (Global_got_offset_visitor): New class.
6128         (Global_symbol_visitor_got_plt): New class.
6129         (Output_section_incremental_inputs::write_got_plt): New function.
6130         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6131         Add parameter.  Adjust all callers.
6132         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6133         (Incremental_inputs::got_plt_section): New function.
6134         (Incremental_inputs::got_plt_section_): New data member.
6135         (Incremental_got_plt_reader): New class.
6136         * layout.cc (Layout::create_incremental_info_sections): Add the
6137         incremental_got_plt section.
6138         * object.h (Got_offset_list::get_list): New function.
6139         (Got offset_list::for_all_got_offsets): New function.
6140         (Sized_relobj::local_got_offset_list): New function.
6141         * powerpc.cc (Target_powerpc::got_size): Add const.
6142         (Target_powerpc::got_entry_count): New function.
6143         (Target_powerpc::plt_entry_count): New function.
6144         (Target_powerpc::first_plt_entry_offset): New function.
6145         (Target_powerpc::plt_entry_size): New function.
6146         (Output_data_plt_powerpc::entry_count): New function.
6147         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6148         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6149         * sparc.cc (Target_sparc::got_size): Add const.
6150         (Target_sparc::got_entry_count): New function.
6151         (Target_sparc::plt_entry_count): New function.
6152         (Target_sparc::first_plt_entry_offset): New function.
6153         (Target_sparc::plt_entry_size): New function.
6154         (Output_data_plt_sparc::entry_count): New function.
6155         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6156         (Output_data_plt_sparc::get_plt_entry_size): New function.
6157         * symtab.h (Symbol::got_offset_list): New function.
6158         (Symbol_table::for_all_symbols): New function.
6159         * target.h (Sized_target::got_entry_count): New function.
6160         (Sized_target::plt_entry_count): New function.
6161         (Sized_target::plt_entry_size): New function.
6162         * x86_64.cc (Target_x86_64::got_size): Add const.
6163         (Target_x86_64::got_entry_count): New function.
6164         (Target_x86_64::plt_entry_count): New function.
6165         (Target_x86_64::first_plt_entry_offset): New function.
6166         (Target_x86_64::plt_entry_size): New function.
6167         (Output_data_plt_x86_64::entry_count): New function.
6168         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6169         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6170
6171 2010-08-12  Cary Coutant  <ccoutant@google.com>
6172
6173         * archive.cc: Include incremental.h.
6174         (Archive::Archive): Initialize incremental_info_.
6175         (Archive::include_member): Record archive members in incremental info.
6176         (Add_archive_symbols::run): Record begin and end of an archive in
6177         incremental info.
6178         (Lib_group::include_member): Record objects in incremental info.
6179         * archive.h (Incremental_archive_entry): Forward declaration.
6180         (Archive::set_incremental_info): New member function.
6181         (Archive::incremental_info): New member function.
6182         (Archive::Unused_symbol_iterator): New class.
6183         (Archive::unused_symbols_begin): New member function.
6184         (Archive::unused_symbols_end): New member function.
6185         (Archive::incremental_info_): New data member.
6186         * incremental-dump.cc (find_input_containing_global): New function.
6187         (dump_incremental_inputs): Dump new incremental info sections.
6188         * incremental.cc: Include symtab.h.
6189         (Output_section_incremental_inputs): New class.
6190         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6191         new incremental info sections.
6192         (Sized_incremental_binary::do_check_inputs): Likewise.
6193         (Incremental_inputs::report_archive): Remove.
6194         (Incremental_inputs::report_archive_begin): New function.
6195         (Incremental_inputs::report_archive_end): New function.
6196         (Incremental_inputs::report_object): New function.
6197         (Incremental_inputs::finalize_inputs): Remove.
6198         (Incremental_inputs::report_input_section): New function.
6199         (Incremental_inputs::report_script): Rewrite.
6200         (Incremental_inputs::finalize): Do nothing but finalize string table.
6201         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6202         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6203         (Incremental_inputs::create_data_sections): New function.
6204         (Incremental_inputs::relocs_entsize): New function.
6205         (Output_section_incremental_inputs::set_final_data_size): New function.
6206         (Output_section_incremental_inputs::do_write): New function.
6207         (Output_section_incremental_inputs::write_header): New function.
6208         (Output_section_incremental_inputs::write_input_files): New function.
6209         (Output_section_incremental_inputs::write_info_blocks): New function.
6210         (Output_section_incremental_inputs::write_symtab): New function.
6211         * incremental.h (Incremental_script_entry): Forward declaration.
6212         (Incremental_object_entry): Forward declaration.
6213         (Incremental_archive_entry): Forward declaration.
6214         (Incremental_inputs): Forward declaration.
6215         (Incremental_inputs_header_data): Remove.
6216         (Incremental_inputs_header): Remove.
6217         (Incremental_inputs_header_write): Remove.
6218         (Incremental_inputs_entry_data): Remove.
6219         (Incremental_inputs_entry): Remove.
6220         (Incremental_inputs_entry_write): Remove.
6221         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6222         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6223         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6224         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6225         Likewise.
6226         (Incremental_input_entry): New class.
6227         (Incremental_script_entry): New class.
6228         (Incremental_object_entry): New class.
6229         (Incremental_archive_entry): New class.
6230         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6231         (Incremental_inputs::report_inputs): Remove.
6232         (Incremental_inputs::report_archive): Remove.
6233         (Incremental_inputs::report_archive_begin): New function.
6234         (Incremental_inputs::report_archive_end): New function.
6235         (Incremental_inputs::report_object): Change prototype.
6236         (Incremental_inputs::report_input_section): New function.
6237         (Incremental_inputs::report_script): Change prototype.
6238         (Incremental_inputs::get_reloc_count): New function.
6239         (Incremental_inputs::set_reloc_count): New function.
6240         (Incremental_inputs::create_data_sections): New function.
6241         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6242         (Incremental_inputs::inputs_section): New function.
6243         (Incremental_inputs::symtab_section): New function.
6244         (Incremental_inputs::relocs_section): New function.
6245         (Incremental_inputs::get_stringpool): Add const.
6246         (Incremental_inputs::command_line): Add const.
6247         (Incremental_inputs::inputs): Remove.
6248         (Incremental_inputs::command_line_key): New function.
6249         (Incremental_inputs::input_file_count): New function.
6250         (Incremental_inputs::input_files): New function.
6251         (Incremental_inputs::relocs_entsize): New function.
6252         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6253         (Incremental_inputs::finalize_inputs): Remove.
6254         (Incremental_inputs::Input_info): Remove.
6255         (Incremental_inputs::lock_): Remove.
6256         (Incremental_inputs::inputs_): Change type.
6257         (Incremental_inputs::inputs_map_): Remove.
6258         (Incremental_inputs::current_object_entry_): New data member.
6259         (Incremental_inputs::inputs_section_): New data member.
6260         (Incremental_inputs::symtab_section_): New data member.
6261         (Incremental_inputs::relocs_section_): New data member.
6262         (Incremental_inputs::reloc_count_): New data member.
6263         (Incremental_inputs_reader): New class.
6264         (Incremental_symtab_reader): New class.
6265         (Incremental_relocs_reader): New class.
6266         * layout.cc (Layout::finalize): Move finalization of incremental info
6267         and creation of incremental info sections to follow finalization of
6268         symbol table.  Set offsets for postprocessing sections.
6269         (Layout::create_incremental_info_sections): Call
6270         Incremental_inputs::create_data_sections.  Add incremental symtab
6271         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6272         sections to layout after input sections.
6273         * layout.h (struct Timespec): Forward declaration.
6274         (Layout::incremental_inputs): Add const.
6275         (Layout::create_incremental_info_sections): Add parameter.
6276         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6277         * object.cc: Include incremental.h.
6278         (Relobj::finalize_incremental_relocs): New function.
6279         (Sized_relobj::do_layout): Record input sections in incremental info.
6280         * object.h (Object::output_section): New function.
6281         (Object::output_section_offset): Moved from Relobj.
6282         (Object::get_incremental_reloc_base): New function.
6283         (Object::get_incremental_reloc_count): New function.
6284         (Object::do_output_section): New function.
6285         (Object::do_output_section_offset): Moved from Relobj.
6286         (Object::do_get_incremental_reloc_base): New function.
6287         (Object::do_get_incremental_reloc_count): New function.
6288         (Object::Object): Initialize new data members.
6289         (Relobj::output_section): Renamed do_output_section and moved to
6290         protected.
6291         (Relobj::output_section_offset): Moved to Object.
6292         (Relobj::do_get_incremental_reloc_base): New function.
6293         (Relobj::do_get_incremental_reloc_count): New function.
6294         (Relobj::allocate_incremental_reloc_counts): New function.
6295         (Relobj::count_incremental_reloc): New function.
6296         (Relobj::finalize_incremental_relocs): New function.
6297         (Relobj::next_incremental_reloc_index): New function.
6298         (Relobj::reloc_counts_): New data member.
6299         (Relobj::reloc_bases_): New data member.
6300         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6301         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6302         (Sized_relobj::incremental_relocs_scan): New function.
6303         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6304         (Sized_relobj::incremental_relocs_write): New function.
6305         (Sized_relobj::incremental_relocs_write_reltype): New function.
6306         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6307         incremental link.
6308         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6309         archives and object files elsewhere.
6310         (Add_symbols::run): Report object files here.
6311         (Finish_group::run): Report end of archive at end of group.
6312         * reloc.cc: Include layout.h, incremental.h.
6313         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6314         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6315         (Sized_relobj::incremental_relocs_scan): New function.
6316         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6317         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6318         (Sized_relobj::incremental_relocs_write): New function.
6319         (Sized_relobj::incremental_relocs_write_reltype): New function.
6320         * script.cc (read_input_script): Rewrite test for incremental link.
6321         Change call to Incremental_inputs::report_script.
6322         * symtab.h (Symbol_table::first_global_index): New function.
6323         (Symbol_table::output_count): New function.
6324
6325 2010-08-12  Doug Kwan  <dougkwan@google.com>
6326
6327         * arm.cc (Target_arm::merge_object_attributes): Check command line
6328         options --no-wchar-size-warning and --no-enum-size-warning.
6329         * options.h (General_options): Add ld-compatible options
6330         --no-enum-size-warning and --no-wchar-size-warning.
6331
6332 2010-08-04  Ian Lance Taylor  <iant@google.com>
6333
6334         * x86_64.cc (Target_x86_64::Scan::local): Use
6335         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6336         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6337         (Target_x86_64::Scan::global): Likewise.
6338         (Target_x86_64::Relocate::relocate): Likewise.
6339         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6340         Likewise.
6341
6342 2010-08-03  Cary Coutant  <ccoutant@google.com>
6343
6344         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6345         to reserve space in merged_strings vector. Keep total input size
6346         for stats.
6347         (Output_merge_string::do_print_merge_stats): Print total input size.
6348         * merge.h (Output_merge_string): Add input_size_ field.
6349         * stringpool.cc (Stringpool_template::string_length): Move
6350         implementations out of Stringpool_template class and place in
6351         stringpool.h.
6352         * stringpool.h (string_length): Move out of Stringpool_template.
6353
6354 2010-08-03  Ian Lance Taylor  <iant@google.com>
6355
6356         PR 11712
6357         * layout.cc (relaxation_loop_body): If address of load segment is
6358         set, adjust address to include headers if possible.
6359
6360 2010-08-03  Ian Lance Taylor  <iant@google.com>
6361
6362         * version.cc (version_string): Bump to 1.10.
6363
6364 2010-08-03  Ian Lance Taylor  <iant@google.com>
6365
6366         PR 11805
6367         * layout.h (enum Output_section_order): Define.
6368         (class Layout): Update declarations.
6369         * layout.cc (Layout::get_output_section): Add order parameter.
6370         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6371         is_first_non_relro parameters.  Change all callers.
6372         (Layout::choose_output_section): Likewise.
6373         (Layout::add_output_section_data): Likewise.
6374         (Layout::make_output_section): Likewise.  Set order.
6375         (Layout::default_section_order): New function.
6376         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6377         * output.cc (Output_section::Output_section): Initialize order_.
6378         Don't initialize deleted fields.
6379         (Output_segment::Output_segment): Don't initialize deleted
6380         fields.
6381         (Output_segment::add_output_section_to_load): New function
6382         replacing add_output_section.  Change all callers to call this or
6383         add_output_section_to_nonload.
6384         (Output_segment::add_output_section_to_nonload): New function.
6385         (Output_segment::remove_output_section): Rewrite.
6386         (Output_segment::add_initial_output_data): Likewise.
6387         (Output_segment::has_any_data_sections): Likewise.
6388         (Output_segment::is_first_section_relro): Likewise.
6389         (Output_segment::maximum_alignment): Likewise.
6390         (Output_segment::has_dynamic_reloc): New function replacing
6391         dynamic_reloc_count.  Change all callers.
6392         (Output_segment::has_dynamic_reloc_list): New function replacing
6393         dynamic_reloc_count_list.  Change all callers.
6394         (Output_segment::set_section_addresses): Rewrite.
6395         (Output_segment::set_offset): Rewrite.
6396         (Output_segment::find_first_and_last_list): Remove.
6397         (Output_segment::set_tls_offsets): Rewrite.
6398         (Output_segment::first_section_load_address): Likewise.
6399         (Output_segment::output_section_count): Likewise.
6400         (Output_segment::section_with_lowest_load_address): Likewise.
6401         (Output_segment::write_section_headers): Likewise.
6402         (Output_segment::print_sections_to_map): Likewise.
6403         * output.h (class Output_data): Remove dynamic_reloc_count_
6404         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6405         (Output_data::add_dynamic_reloc): Rewrite.
6406         (Output_data::has_dynamic_reloc): New function.
6407         (Output_data::dynamic_reloc_count): Remove.
6408         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6409         is_last_relro_, is_first_non_relro_, is_interp_,
6410         is_dynamic_linker_section_ fields.  Add order and set_order
6411         functions.  Remove is_relro_local, set_is_relro_local,
6412         is_last_relro, set_is_last_relro, is_first_non_relro,
6413         set_is_first_non_relro functions, is_interp, set_is_interp,
6414         is_dynamic_linker_section, and set_is_dynamic_linker_section
6415         functions.
6416         (class Output_segment): Change Output_data_list from std::list to
6417         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6418         output_bss_ fields.  Update declarations.
6419
6420 2010-08-02  Ian Lance Taylor  <iant@google.com>
6421
6422         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6423         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6424         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6425
6426 2010-08-02  Ian Lance Taylor  <iant@google.com>
6427
6428         PR 11855
6429         * script.cc (Script_options::Script_options): Initialize
6430         symbol_definitions_ and symbol_references_.
6431         (Script_options::add_symbol_assignment): Update
6432         symbol_definitions_ and symbol_references_.
6433         (Script_options::add_symbol_reference): New function.
6434         (script_symbol): New function.
6435         * script.h (class Script_options): Add symbol_definitions_ and
6436         symbol_references_ fields.
6437         (Script_options::referenced_const_iterator): New type.
6438         (Script_options::referenced_begin): New function.
6439         (Script_options::referenced_end): New function.
6440         (Script_options::is_referenced): New function.
6441         (Script_options::any_unreferenced): New function.
6442         * script-c.h (script_symbol): Declare.
6443         * yyscript.y (exp): Call script_symbol.
6444         * symtab.cc: Include "script.h".
6445         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6446         Change all callers.  Check symbols referenced by scripts.
6447         (Symbol_table::add_undefined_symbols_from_command_line): Add
6448         layout parameter.  Change all callers.
6449         (Symbol_table::do_add_undefined_symbols_from_command_line):
6450         Likewise.  Break out loop body.  Check symbols referenced by
6451         scripts.
6452         (Symbol_table::add_undefined_symbol_from_command_line): New
6453         function broken out of
6454         do_add_undefined_symbols_from_command_line.
6455         * symtab.h (class Symbol_table): Update declarations.
6456         * archive.cc: Include "layout.h".
6457         (Archive::should_include_member): Add layout parameter.  Change
6458         all callers.  Check for symbol mentioned in expression.
6459         * archive.h (class Archive): Update declaration.
6460         * object.cc (Sized_relobj::do_should_include_member): Add layout
6461         parameter.
6462         * object.h (Object::should_include_member): Add layout parameter.
6463         Change all callers.
6464         (Object::do_should_include_member): Add layout parameter.
6465         (class Sized_relobj): Update declaration.
6466         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6467         parameter.
6468         * dynobj.h (class Sized_dynobj): Update declaration.
6469         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6470         layout parameter.
6471         * plugin.h (class Sized_pluginobj): Update declaration.
6472
6473 2010-08-02  Ian Lance Taylor  <iant@google.com>
6474
6475         PR 11866
6476         * output.cc (Output_segment::set_offset): Search for the first and
6477         last sections rather than assuming that the list is in order.
6478         (Output_segment::find_first_and_last_list): New function.
6479         * output.h (class Output_segment): Update declarations.
6480         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6481         (relro_strip_test_SOURCES): New variable.
6482         (relro_strip_test_DEPENDENCIES): New variable.
6483         (relro_strip_test_LDFLAGS): New variable.
6484         (relro_strip_test_LDADD): New variable.
6485         (relro_strip_test.so): New target.
6486
6487 2010-08-02  Ian Lance Taylor  <iant@google.com>
6488
6489         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6490         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6491         (Target_i386::got_tlsdesc_section): New function.
6492         (Target_i386::got_section): Create space for GOT entries for
6493         TLSDESC relocations.
6494         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6495         R_386_TLS_GOTDESC.
6496         (Target_i386::Scan::global): Likewise.
6497         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6498         using TLSDESC GOT.
6499         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6500         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6501         (Target_x86_64::got_tlsdesc_section): New function.
6502         (Target_x86_64::got_section): Create space for GOT entries for
6503         TLSDESC relocations.
6504         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6505         R_386_TLS_GOTDESC.
6506         (Target_x86_64::Scan::global): Likewise.
6507         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6508         using TLSDESC GOT.
6509
6510 2010-08-02  Ian Lance Taylor  <iant@google.com>
6511
6512         * testsuite/final_layout.sh: Use dc to convert from hex to
6513         decimal.
6514
6515 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6516
6517         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6518         paramter to the call to gold::gc_process_relocs.
6519         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6520         paramter to the call to gold::gc_process_relocs.
6521         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6522         parameter to the call to gold::gc_process_relocs.
6523         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6524         template parameter to the call to gold::gc_process_relocs.
6525         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6526         paramter to the call to gold::gc_process_relocs.
6527         * gc.h (get_embedded_addend_size): New function.
6528         (gc_process_relocs): Save the size of the reloc for use by ICF.
6529         * icf.cc (get_section_contents): Get the addend from the text section
6530         for SHT_REL relocation sections.
6531         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6532         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6533         * int_encoding.h (read_from_pointer): New overloaded function.
6534         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6535         * testsuite/icf_sht_rel_addend_test.sh: New file.
6536         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6537         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6538
6539 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6540
6541         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6542         * Makefile.in: Regenerate.
6543         * testsuite/Makefile.in: Regenerate.
6544
6545 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6546
6547         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6548         * gold/testsuite/debug_msg.cc: Likewise.
6549         * gold/testsuite/odr_violation1.cc
6550         * gold/testsuite/odr_violation2.cc
6551
6552 2010-07-21  Cary Coutant  <ccoutant@google.com>
6553
6554         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6555         string, and length fields.
6556         (Output_merge_string::Merged_strings_list): New type.
6557         (Output_merge_string::Merged_strings_lists): New typedef.
6558         (Output_merge_string): Replace merged_strings_ with
6559         merged_strings_lists_.
6560         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6561         Merged_strings_list per input object and section.  Don't store pointer
6562         to the string.  Don't store length with each merged string entry.
6563         (Output_merge_string::finalize_merged_data): Loop over list of merged
6564         strings lists.  Recompute length of each merged string.
6565
6566 2010-07-15  Cary Coutant  <ccoutant@google.com>
6567
6568         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6569         here.
6570
6571 2010-07-14  Ian Lance Taylor  <iant@google.com>
6572
6573         * descriptors.cc (Descriptors::open): Report correct name in error
6574         message.
6575
6576 2010-07-13  Doug Kwan  <dougkwan@google.com>
6577
6578         * arm.cc (Arm_input_section::Arm_input_section): For a
6579         SHT_ARM_EXIDX section, always keeps the input sections.
6580         (Arm_input_section::set_exidx_section_link): New method.
6581         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6582         has_errors_ to false.
6583         (Arm_exidx_input_section::has_errors,
6584         Arm_exidx_input_section::set_has_errors): New methods.
6585         (Arm_exidx_input_section::has_errors_): New data member.
6586         (Arm_relobj::get_exidx_shndx_list): New method.
6587         (Arm_output_section::append_text_sections_to_list): Do not skip
6588         section without SHF_EXECINSTR.
6589         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6590         errors.
6591         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6592         section header.  Make error messages more verbose.  Check for
6593         a non-executable section linked to an EXIDX section.
6594         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6595         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6596         check that there is no deferred EXIDX section if we exit early.
6597         Instead of not making an EXIDX section in case of an error, make one
6598         and set the has_errors flag of it.
6599         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6600         in a relocatable link.
6601         (Target_arm::do_relax): Look for the EXIDX output section instead of
6602         assuming that it is called .ARM.exidx.
6603         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6604         section list.  Do not check for SHF_EXECINSTR section flags but
6605         skip any input section with errors.
6606         * output.cc (Output_section::Output_section): Initialize
6607         always_keeps_input_sections_ to false.
6608         (Output_section::add_input_section): Check for
6609         always_keeps_input_sections_.
6610         *  output.h (Output_section::always_keeps_input_sections,
6611         Output_section::set_always_keeps_input_sections): New methods.
6612         (Output_section::always_keeps_input_sections): New data member.
6613
6614 2010-07-13  Rafael Espindola  <espindola@google.com>
6615
6616         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6617         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6618
6619 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6620             Ian Lance Taylor  <iant@google.com>
6621
6622         * output.h (Output_section_lookup_maps::add_merge_section):
6623         Correct check of whether value was inserted.
6624         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6625         (Output_section_lookup_maps::add_relaxed_input_section):
6626         Likewise.
6627         * arm.cc (Target_arm::got_section): Remove used local os.
6628         * i386.cc (Target_i386::got_section): Likewise.
6629         * x86_64.cc (Target_x86_64::got_section): Likewise.
6630         * sparc.cc (Target_sparc::got_section): Likewise.
6631         (Target_sparc::relocate): Remove unused local have_got_offset.
6632         * powerpc.cc (Target_powerpc::relocate): Likewise.
6633
6634 2010-07-13  Ian Lance Taylor  <iant@google.com>
6635
6636         * compressed_output.cc (zlib_decompress): Fix signature in
6637         !HAVE_ZLIB_H case.
6638
6639         * archive.cc (Archive::include_member): Unlock an external member
6640         of a thin archive.  Don't bother to delete an object we know is
6641         NULL.
6642
6643 2010-07-12  Cary Coutant  <ccoutant@google.com>
6644
6645         * compressed_output.cc (zlib_decompress): New function.
6646         (get_uncompressed_size): New function.
6647         (decompress_input_section): New function.
6648         * compressed_output.h (get_uncompressed_size): New function.
6649         (decompress_input_section): New function.
6650         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6651         Handle compressed debug sections.
6652         * layout.cc (is_compressed_debug_section): New function.
6653         (Layout::output_section_name): Map compressed section names to
6654         canonical names.
6655         * layout.h (is_compressed_debug_section): New function.
6656         (is_debug_info_section): Recognize compressed debug sections.
6657         * merge.cc: Include compressed_output.h.
6658         (Output_merge_data::do_add_input_section): Handle compressed
6659         debug sections.
6660         (Output_merge_string::do_add_input_section): Handle compressed
6661         debug sections.
6662         * object.cc: Include compressed_output.h.
6663         (Sized_relobj::Sized_relobj): Initialize new data members.
6664         (build_compressed_section_map): New function.
6665         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6666         * object.h (Object::section_is_compressed): New method.
6667         (Object::do_section_is_compressed): New method.
6668         (Sized_relobj::Compressed_section_map): New type.
6669         (Sized_relobj::do_section_is_compressed): New method.
6670         (Sized_relobj::compressed_sections_): New data member.
6671         * output.cc (Output_section::add_input_section): Handle compressed
6672         debug sections.
6673         * reloc.cc: Include compressed_output.h.
6674         (Sized_relobj::write_sections): Handle compressed debug sections.
6675
6676 2010-07-08  Cary Coutant  <ccoutant@google.com>
6677
6678         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6679         weak when resolving to a dynamic def.
6680         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6681         for weak undef/dynamic def cases. Adjust callers.
6682         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6683         undef_binding_weak_.
6684         (Symbol_table::sized_write_globals): Adjust symbol binding.
6685         (Symbol_table::sized_write_symbol): Add binding parameter.
6686         * symtab.h (Symbol::set_undef_binding): New method.
6687         (Symbol::is_undef_binding_weak): New method.
6688         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6689         (Symbol_table::should_override): Add new parameter.
6690         (Symbol_table::sized_write_symbol): Add new parameter.
6691
6692         * testsuite/weak_undef_file1.cc: Add new test case.
6693         * testsuite/weak_undef_file2.cc: Fix header comment.
6694         * testsuite/weak_undef_test.cc: Add new test case.
6695
6696 2010-06-29  Doug Kwan  <dougkwan@google.com>
6697
6698         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6699         Initialize USE_SYMBOL_.
6700         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6701         definition.
6702         (Arm_reloc_property::uses_symbol_): New data member declaration.
6703         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6704         uses symbol value and symbol is undefined but not weakly undefined.
6705
6706 2010-06-28  Rafael Espindola  <espindola@google.com>
6707
6708         * plugin.cc (Plugin::load): Use dlerror.
6709
6710 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6711
6712         * symtab.cc (detect_odr_violations): When reporting an ODR
6713         violation, report an object where the symbol is defined.
6714
6715 2010-06-25  Doug Kwan  <dougkwan@google.com>
6716
6717         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6718         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6719         definition.
6720         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6721         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6722         target hook to detect function points.
6723         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6724         * icf.h (Icf::check_section_for_function_pointers): Change type of
6725         parameter SECTION_NAME to const reference to std::string.  Use
6726         target hook to determine if section may have unsafe pointers.
6727         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6728         method definition.
6729
6730 2010-06-21  Rafael Espindola  <espindola@google.com>
6731
6732         * fileread.cc (Input_file::find_fie): New
6733         (Input_file::open): Use Input_file::find_fie.
6734         * fileread.h (Input_file::find_fie): New
6735         * plugin.cc (set_extra_library_path): New.
6736         (Plugin::load): Add set_extra_library_path to the transfer vector.
6737         (Plugin_manager::set_extra_library_path): New.
6738         (Plugin_manager::add_input_file): Use the extra search path if set.
6739         (set_extra_library_path(): New.
6740         * plugin.h (Plugin_manager): Add set_extra_library_path and
6741         extra_search_path_.
6742
6743 2010-06-19  Cary Coutant  <ccoutant@google.com>
6744
6745         * layout.cc (gdb_sections): Add .debug_types.
6746         (lines_only_debug_sections): Likewise.
6747
6748 2010-06-18  Rafael Espindola  <espindola@google.com>
6749
6750         * plugin.cc (add_input_file,add_input_library)
6751         (Plugin_manager::add_input_file): Make filename arguments const.
6752         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6753         const.
6754
6755 2010-06-16  Doug Kwan  <dougkwan@google.com>
6756
6757         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6758         .ARM.attributes section if we have not merged any input
6759         attributes sections.
6760
6761 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6762
6763         * arm.cc: Allow combining objects with no EABI version
6764         information.
6765
6766 2010-06-15  Rafael Espindola  <espindola@google.com>
6767
6768         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6769
6770 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6771
6772         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6773         (struct iovec): Correct !HAVE_READV definition.
6774
6775 2010-06-10  Cary Coutant  <ccoutant@google.com>
6776
6777         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6778         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6779         reloc sections.
6780         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6781
6782         PR 11683
6783         * symtab.h (Symbol::is_placeholder): New member function.
6784         * target-reloc.h (relocate_section): Check for placeholder symbols.
6785
6786         * testsuite/Makefile.am (plugin_test_8): New test.
6787         (plugin_test_9): New test.
6788         * testsuite/Makefile.in: Regenerate.
6789
6790 2010-06-09  Nick Clifton  <nickc@redhat.com>
6791
6792         * yyscript.y (input_list_element): Allow strings prefixed with
6793         the '-' character.  Treat these as libraries.
6794         * script.cc (script_add_library): New function.  Adds a library
6795         specified by "-l<name>" found in an input script.
6796         * script-c.h: Add prototype for script_add_library.
6797
6798 2010-06-07  Doug Kwan  <dougkwan@google.com>
6799
6800         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6801         Restrict stub-group size to be within long conditional branch
6802         range when working around cortex-A8 erratum.
6803
6804 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6805
6806         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6807         #ifdef typo.
6808
6809 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6810
6811         PR gold/11658
6812         * output.cc
6813         (Output_section::Input_section_sort_entry::compare_section_ordering):
6814         Change to return non-zero correctly.
6815         (Output_section::Input_section_sort_section_order_index_compare
6816         ::operator()): Change to fix ambiguity in comparisons.
6817
6818 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6819
6820         * gold.h (is_wildcard_string): New function.
6821         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6822         (Layout::layout_eh_frame): Ditto.
6823         (Layout::find_section_order_index): New method.
6824         (Layout::read_layout_from_file): New method.
6825         * layout.h (Layout::find_section_order_index): New method.
6826         (Layout::read_layout_from_file): New method.
6827         (Layout::input_section_position_): New private member.
6828         (Layout::input_section_glob_): New private member.
6829         * main.cc (main): Call read_layout_from_file here.
6830         * options.h (--section-ordering-file): New option.
6831         * output.cc (Output_section::input_section_order_specified_): New
6832         member.
6833         (Output_section::Output_section): Initialize new member.
6834         (Output_section::add_input_section): Add new parameter.
6835         Keep input sections when --section-ordering-file is used.
6836         (Output_section::set_final_data_size): Sort input sections when
6837         section ordering file is specified.
6838         (Output_section::Input_section_sort_entry): Add new parameter.
6839         Check sorting type.
6840         (Output_section::Input_section_sort_entry::compare_section_ordering):
6841         New method.
6842         (Output_section::Input_section_sort_compare::operator()): Change to
6843         consider section_order_index.
6844         (Output_section::Input_section_sort_init_fini_compare::operator()):
6845         Change to consider section_order_index.
6846         (Output_section::Input_section_sort_section_order_index_compare
6847         ::operator()): New method.
6848         (Output_section::sort_attached_input_sections): Change to sort
6849         according to section order when specified.
6850         (Output_section::add_input_section<32, true>): Add new parameter.
6851         (Output_section::add_input_section<64, true>): Add new parameter.
6852         (Output_section::add_input_section<32, false>): Add new parameter.
6853         (Output_section::add_input_section<64, false>): Add new parameter.
6854         * output.h (Output_section::add_input_section): Add new parameter.
6855         (Output_section::input_section_order_specified): New
6856         method.
6857         (Output_section::set_input_section_order_specified): New method.
6858         (Input_section::Input_section): Initialize section_order_index_.
6859         (Input_section::section_order_index): New method.
6860         (Input_section::set_section_order_index): New method.
6861         (Input_section::section_order_index_): New member.
6862         (Input_section::Input_section_sort_section_order_index_compare): New
6863         struct.
6864         (Output_section::input_section_order_specified_): New member.
6865         * script-sections.cc (is_wildcard_string): Delete and move modified
6866         method to gold.h.
6867         (Output_section_element_input::Output_section_element_input): Modify
6868         call to is_wildcard_string.
6869         (Output_section_element_input::Input_section_pattern
6870         ::Input_section_pattern): Ditto.
6871         (Output_section_element_input::Output_section_element_input): Ditto.
6872         * testsuite/Makefile.am (final_layout): New test case.
6873         * testsuite/Makefile.in: Regenerate.
6874         * testsuite/final_layout.cc: New file.
6875         * testsuite/final_layout.sh: New file.
6876
6877 2010-06-01  Rafael Espindola  <espindola@google.com>
6878
6879         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6880
6881 2010-06-01  Rafael Espindola  <espindola@google.com>
6882
6883         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6884         visibility of symbols.
6885
6886 2010-05-27  Doug Kwan  <dougkwan@google.com>
6887
6888         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6889         from start of output section instead of address for a local symbol
6890         in a merged or relaxed section when doing a relocatable link.
6891
6892 2010-05-26  Rafael Espindola  <espindola@google.com>
6893
6894         PR 11604
6895         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6896         adding sections the garbage collector removed.
6897         * gold/testsuite/Makefile.am: Add test.
6898         * gold/testsuite/Makefile.in: Regenerate.
6899         * gold/testsuite/plugin_test_7.sh: New.
6900         * gold/testsuite/plugin_test_7_1.c: New.
6901         * gold/testsuite/plugin_test_7_2.c: New.
6902
6903 2010-05-26  Rafael Espindola  <espindola@google.com>
6904
6905         * script-sections.cc (Output_section_definition::set_section_addresses):
6906         Check for --section-start.
6907
6908 2010-05-26  Doug Kwan  <dougkwan@google.com>
6909
6910         * arm.cc (Arm_scan_relocatable_relocs): New class.
6911         (Target_arm::relocate_special_relocatable): New method.
6912         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6913         (Arm_relocate_functions::thumb_branch_common): Same.
6914         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6915         instead of Default_scan_relocatable_relocs.
6916         * target-reloc.h (relocate_for_relocatable): Let target handle
6917         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6918         * target.h (Sized_target::relocate_special_relocatable): New method.
6919
6920 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6921
6922         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6923
6924 2010-05-23  Doug Kwan  <dougkwan@google.com>
6925
6926         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6927         instead of a cast.
6928         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6929         with a direct branch, not a conditional branch, to a stub.
6930         * merge.cc (Output_merge_base::record_input_section): New method
6931         defintion.
6932         (Output_merge_data::do_add_input_section): Record input section if
6933         keeps-input-sections flag is set.
6934         (Output_merge_string::do_add_input_section): Ditto.
6935         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6936         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6937         INPUT_SECTIONS_.
6938         (Output_merge_base::keeps_input_sections,
6939         Output_merge_base::set_keeps_input_sections,
6940         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6941         method definitions.
6942         (Output_merge_base::Input_sections): New type declaration.
6943         (Output_merge_base::input_sections_begin,
6944         Output_merge_base::input_sections_end,
6945         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6946         (Output_merge_base::bool keeps_input_sections_,
6947         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6948         Output_merge_base::input_sections_): New data members.
6949         (Output_merge_data::do_set_keeps_input_sections): New method
6950         defintion.
6951         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6952         * output.cc (Output_section::Input_section::relobj): Move method
6953         defintion from class declaration to here and handle merge sections.
6954         (Output_section::Input_section::shndx): Ditto.
6955         (Output_section::Output_section): Remove initializations of removed
6956         data members and initialize new data member LOOKUP_MAPS_.
6957         (Output_section::add_input_section): Set keeps-input-sections flag
6958         for a newly created merge output section as appropriate.  Adjust code
6959         to use Output_section_lookup_maps class.
6960         (Output_section::add_relaxed_input_section): Adjst code for lookup
6961         maps code refactoring.
6962         (Output_section::add_merge_input_section): Add a new parameter
6963         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6964         class.  If adding input section to a newly created merge output
6965         section fails, remove the new merge section.
6966         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6967         Adjust code for use of the Output_section_lookup_maps class.
6968         (Output_section::find_merge_section): Ditto.
6969         (Output_section::build_lookup_maps): New method defintion.
6970         (Output_section::find_relaxed_input_section): Adjust code to use
6971         Output_section_lookup_maps class.
6972         (Output_section::get_input_sections): Export merge sections.  Adjust
6973         code to use Output_section_lookup_maps class.
6974         (Output_section:::add_script_input_section): Adjust code to use
6975         Output_section_lookup_maps class.  Update lookup maps for merge
6976         sections also.
6977         (Output_section::discard_states): Use Output_section_lookup_maps.
6978         (Output_section::restore_states): Same.
6979         * output.h (Merge_section_properties): Move class defintion out of
6980         Output_section.
6981         (Output_section_lookup_maps): New class.
6982         (Output_section::Input_section::is_merge_section): New method
6983         defintion.
6984         (Output_section::Input_section::relobj): Move defintion out of class
6985         defintion.  Declare method only.
6986         (Output_section::Input_section::shndx): Ditto.
6987         (Output_section::Input_section::output_merge_base): New method defintion.
6988         (Output_section::Input_section::u2_.pomb): New union field.
6989         (Output_section::Merge_section_by_properties_map,
6990         Output_section::Output_section_data_by_input_section_map,
6991         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6992         Remove types.
6993         (Output_section::add_merge_input_section): Add new parameter
6994         KEEPS_INPUT_SECTIONS.
6995         (Output_section::build_lookup_maps): New method declaration.
6996         (Output_section::merge_section_map_,
6997         Output_section::merge_section_by_properties_map_,
6998         Output_section::relaxed_input_section_map_,
6999         Output_section::is_relaxed_input_section_map_valid_): Remove data
7000         members.
7001         (Output_section::lookup_maps_): New data member.
7002
7003 2010-05-21  Doug Kwan  <dougkwan@google.com>
7004
7005         PR gold/11619
7006         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7007         avoid a compilation error.
7008
7009 2010-05-19  Rafael Espindola  <espindola@google.com>
7010
7011         * script-sections.cc (Output_section_definition::allocate_to_segment):
7012         Update the phdrs_list even when the output section is NULL.
7013         * testsuite/Makefile.am: Add test.
7014         * testsuite/Makefile.in: Regenerate.
7015         * testsuite/script_test_9.cc: New.
7016         * testsuite/script_test_9.sh: New.
7017         * testsuite/script_test_9.t: New.
7018
7019 2010-05-19  Doug Kwan  <dougkwan@google.com>
7020
7021         * arm.cc (Arm_input_section::original_size): New method.
7022         (Arm_input_section::do_addralign): Add a cast.
7023         (Arm_input_section::do_output_offset): Remove static cast.
7024         (Arm_input_section::original_addralign,
7025          Arm_input_section::original_size_): Change type to uint32_t.
7026         (Arm_input_section::init): Add safe casts for section alignment
7027         and size.
7028         (Arm_input_section::set_final_data_size): Do not set address and
7029         offset of stub table.
7030         (Arm_output_section::fix_exidx_coverage): Change use of of
7031         Output_section::Simple_input_section to that of
7032         Output_section::Input_section.
7033         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7034         except for the first pass.
7035         * output.cc (Output_section::get_input_sections): Change type of
7036         input_sections to std::list<Input_section>.
7037         (Output_section::add_script_input_section): Rename from
7038         Output_section::add_simple_input_section.  Change type of SIS
7039         parameter from Simple_input_section to Input_section.
7040         * output.h (Output_section::Simple_input_section): Remove class.
7041         (Output_section::Input_section): Change class visibility to public.
7042         (Output_section::Input_section::addralign): Use stored alignments
7043         for special input sections if set.
7044         (Output_section::Input_section::set_addralign): New method.
7045         (Output_section::get_input_sections): Change parameter type from
7046         list of Simple_input_section to list of Input_section.
7047         (Output_section::add_script_input_section): Rename from
7048         Output_section::add_simple_input_section. Change first parameter's
7049         type from Simple_input_section to Input_section and remove the
7050         second and third parameters.
7051         * script-sections.cc (Input_section::Input_section_list): Change
7052         type to list of Output_section::Input_section/
7053         (Input_section_info::Input_section_info): Change parameter type of
7054         INPUT_SECTION to Output_section::Input_section.
7055         (Input_section_info::input_section): Change return type.
7056         (Input_section_info::input_section_): Change type to
7057         Output_section::Input_section.
7058         (Output_section_element_input::set_section_addresses): Adjust code
7059         to use Output_section::Input_section instead of
7060         Output_section::Simple_input_section.  Adjust code for renaming
7061         of Output_section::add_simple_input_section.
7062         (Orphan_output_section::set_section_addresses): Ditto.
7063
7064 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7065
7066         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7067         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7068
7069 2010-05-18  Rafael Espindola  <espindola@google.com>
7070
7071         * options.cc (General_options::finalize): Handle -nostdlib.
7072         * options.h (nostdlib): New option.
7073         * script.cc (script_add_search_dir): Handle -nostdlib.
7074
7075 2010-05-12  Doug Kwan  <dougkwan@google.com>
7076
7077         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7078         attributes section only if there no attributes section after merging.
7079         (Target_arm::merge_object_attributes): Move value of
7080         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7081         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7082         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7083         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7084         and arm_attr_merge_7.stdout.
7085         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7086         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7087         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7088         arm_attr_merge_7b.o): New rules.
7089         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7090         arm_attr_merge_7
7091         * testsuite/Makefile.in: Regenerate.
7092         * testsuite/arm_attr_merge.sh: New file.
7093         * testsuite/arm_attr_merge_[67][ab].s: Same.
7094
7095 2010-05-05  Nick Clifton  <nickc@redhat.com>
7096
7097         * po/es.po: Updated Spanish translation.
7098
7099 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7100
7101         * Makefile.am (install-exec-local): Properly install gold as
7102         default cross linker.
7103         * Makefile.in: Regenerated.
7104
7105 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7106             Nick Clifton  <nickc@redhat.com>
7107
7108         * configure.ac (install_as_default): Define and set to false
7109         unless --enable-gold or --enable-gold=both/gold has been
7110         specified.
7111         * configure: Regenerate.
7112
7113         * Makefile.am (install-exec-local): Install the executable as
7114         'ld.gold'.  If install_as_default is true then also install it as
7115         'ld'.
7116         * Makefile.in: Regenerated.
7117
7118 2010-04-24  Ian Lance Taylor  <iant@google.com>
7119
7120         * layout.cc (Layout::layout_reloc): In relocatable link don't
7121         combine reloc sections for grouped sections.
7122
7123 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7124
7125         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7126         sections that are not ordinary to icf.
7127         * icf.cc (get_section_contents): Handle relocation pointing to section
7128         with no object or shndx information.
7129         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7130         * testsuite/Makefile.in: Regenerate.
7131         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7132         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7133
7134 2010-04-22  Ian Lance Taylor  <iant@google.com>
7135
7136         * expression.cc (Expression::Expression_eval_info): Add
7137         result_alignment_pointer field.
7138         (Expression::eval_with_dot): Add result_alignment_pointer
7139         parameter.  Change all callers.
7140         (Expression::eval_maybe_dot): Likewise.
7141         (class Binary_expression): Add alignment_pointer parameter to
7142         left_value and right_value.  Change all callers.
7143         (BINARY_EXPRESSION): Set result alignment.
7144         (class Trinary_expression): Add alignment_pointer parameter to
7145         arg2_value and arg3_value.  Change all callers.
7146         (Trinary_cond::value): Set result alignment.
7147         (Max_expression::value, Min_expression::value): Likewise.
7148         (Align_expression::value): Likewise.
7149         * script-sections.cc (class Sections_element): Add dot_alignment
7150         parameter to set_section_addresses virtual function.  Update
7151         instantiations.
7152         (class Output_section_element): Likewise.
7153         (Script_sections::create_segments): Add dot_alignment parameter.
7154         Change all callers.
7155         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7156         (Script_sections::set_phdrs_clause_addresses): Likewise.
7157         * script-sections.h: Update declarations.
7158         * script.h: Update declarations.
7159         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7160         min_p_align.
7161         * testsuite/script_test_3.t: Set large alignment.
7162         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7163         segment has expected alignment.
7164
7165 2010-04-22  Nick Clifton  <nickc@redhat.com>
7166
7167         * po/gold.pot: Updated by the Translation project.
7168         * po/vi.po: Updated Vietnamese translation.
7169
7170 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7171
7172         * testsuite/Makefile.am (check_PROGRAMS): Add
7173         icf_virtual_function_folding_test.
7174         * testsuite/Makefile.in: Regenerated.
7175
7176 2010-04-15  Andrew Haley  <aph@redhat.com>
7177
7178         * options.h (merge_exidx_entries): New option.
7179         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7180         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7181         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7182         (Target_arm::merge_exidx_entries): New function.
7183         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7184         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7185         to Arm_exidx_fixup constructor.
7186         Add new arg, merge_exidx_entries.
7187         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7188         Arm_output_section::fix_exidx_coverage.
7189
7190 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7191
7192         * icf.cc (get_section_contents): Check for preemptible functions.
7193         Ignore addend when appropriate.
7194         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7195         section folded.
7196         (add_from_relobj): Check for section folded.
7197         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7198         * symtab.h (should_add_dynsym_entry): Add new parameter.
7199         * target-reloc.h (scan_relocs): Check for section folded.
7200         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7201         Check reloc types for function pointers in shared objects.
7202         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7203         case.
7204         (icf_preemptible_functions_test): New test case.
7205         (icf_string_merge_test): New test case.
7206         * testsuite.Makefile.in: Regenerate.
7207         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7208         bar_glob.  Refactor code.
7209         * testsuite/icf_preemptible_functions_test.cc: New file.
7210         * testsuite/icf_preemptible_functions_test.sh: New file.
7211         * testsuite/icf_string_merge_test.cc: New file.
7212         * testsuite/icf_string_merge_test.sh: New file.
7213         * testsuite/icf_virtual_function_folding_test.cc: New file.
7214         * testsuite/icf_virtual_function_folding_test.sh: New file.
7215
7216 2010-04-14  Doug Kwan  <dougkwan@google.com>
7217
7218         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7219         for local symbol recounting if we remove a section due to ICF.
7220         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7221         there are no regular objects in input.
7222
7223 2010-04-13  Doug Kwan  <dougkwan@google.com>
7224
7225         * arm.cc (Arm_input_section::set_final_data_size): Compute
7226         accurate final data size instead of using current data size.
7227
7228 2010-04-09  Doug Kwan  <dougkwan@google.com>
7229
7230         * layout.cc (Layout::choose_output_section): Handle script section
7231         types.
7232         (Layout::make_output_section_for_script): Add section type parameter.
7233         Handle script section types.
7234         * layout.h (Layout::make_output_section_for_script): Add section
7235         type parameter.
7236         * output.cc (Output_section::Output_section): Initialize data member
7237         is_noload_.
7238         (Output_section::do_reset_address_and_file_offset): Do not set address
7239         to 0 if section is a NOLOAD section.
7240         * output.h (Output_section::is_noload): New method.
7241         (Output_section::set_is_noload): Ditto.
7242         (Output_section::is_noload_): New data member.
7243         * script-c.h (Script_section_type): New enum type.
7244         (struct Parser_output_section_header): Add new file section_type.
7245         * script-sections.cc (Sections_element::output_section_name): Add
7246         parameter for returning script section type.
7247         (Output_section_definition::output_section_name): Ditto.
7248         (Output_section_definition::section_type)P; New method.
7249         (Output_section_definiton::script_section_type_name): Ditto.
7250         (Output_section_definition::script_section_type_): New data member.
7251         (Output_section_definition::Output_section_definition): Initialize
7252         data member Output_section_definition::script_section_type_.
7253         (Output_section_definition::create_sections): Pass script section type
7254         to Layout::make_output_section_for_script.
7255         (Output_section_definition::output_section_name): Return script
7256         section type to caller.
7257         (Output_section_definition::set_section_address): Do not advance
7258         dot value and load address if section type is NOLOAD.  Set address
7259         of NOLOAD sections regardless of section flags.
7260         (Output_section_definition::print): Print section type if it is
7261         not SCRIPT_SECTION_TYPE_NONE.
7262         (Output_section_definition::section_type): New method.
7263         (Output_section_definition::script_section_type_name): Ditto.
7264         (Script_sections::output_section_name): Add new parameter
7265         PSECTION_TYPE for returning script section type.  Pass it to
7266         section elements.  Handle discard sections.
7267         (Sort_output_sections::operator()): Handle NOLOAD sections.
7268         * script-sections.h (Script_sections::Section_type): New enum type.
7269         (Script_sections::output_section_name): Add a new parameter for
7270         returning script section type.
7271         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7272         INFO and NOLOAD.
7273         * yyscript.y (union): Add new field SECTION_TYPE.
7274         (COPY, DSECT, INFO, NOLOAD): New tokens.
7275         (opt_address_and_section_type): Change type to output_section_header.
7276         (section_type): New non-terminal
7277         (section_header): Handle section type.
7278         (opt_address_and_section_type): Return section type value.
7279
7280 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7281
7282         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7283         * testsuite/plugin_common_test_2.c (foo): Likewise.
7284
7285 2010-04-08  Doug Kwan  <dougkwan@google.com>
7286
7287         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7288         Output_merge_data.
7289         * output.cc (Output_section::add_merge_input_section): Simplify
7290         code and return status of Output_merge_base::add_input_section.
7291         Update merge section map only if Output_merge_base::add_input_section
7292         returns true.
7293
7294 2010-04-07  Doug Kwan  <dougkwan@google.com>
7295
7296         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7297         if section is marked as containing instructions but has no mapping
7298         symbols.
7299         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7300         correct section index.
7301         (Arm_relobj::find_linked_text_section): Ditto.
7302
7303 2010-04-07  Cary Coutant  <ccoutant@google.com>
7304
7305         * archive.cc (include_member): Destroy Read_symbols_data object before
7306         releasing file.
7307         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7308         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7309         (Read_symbols_data::~Read_symbols_data) New destructor.
7310         (Section_relocs::Section_relocs) New constructor.
7311         (Section_relocs::~Section_relocs) New destructor.
7312         (Read_relocs_data::Read_relocs_data) New constructor.
7313         (Read_relocs_data::~Read_relocs_data) New destructor.
7314         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7315         pointers to NULL after deleting.
7316
7317 2010-04-07  Doug Kwan  <dougkwan@google.com>
7318
7319         * arm.cc: Replace "endianity" with "endianness" in comments.
7320         (Arm_exidx_cantunwind): Ditto.
7321         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7322         (Arm_relobj::merge_flags_and_attributes): New method.
7323         (Arm_relobj::merge_flags_and_attributes_): New data member.
7324         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7325         (Arm_relobj::scan_sections_for_stubs): Ditto.
7326         (Arm_relobj::do_read_symbols): Check to see if we really want to
7327         merge processor-specific flags and attributes.  Exit early if
7328         an object is empty except for section names and the undefined symbol.
7329         (Target_arm::do_finalize_sections): Move check for ELF format to
7330         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7331         attributes from a regular object only when we have determined that
7332         it is aapropriate.  Do not create an .ARM.attributes section in
7333         output if there is no regular input object.
7334         (Target_arm::merge_processor_specific_flags): Check
7335         --warn-mismatch before printing any error.
7336         (Target_arm::merge_object_attributes): Ditto.
7337         * gold.cc (queue_middle_tasks): Handle the case in which there is
7338         no regular object in input.
7339         * options.cc (General_options::parse_EB): New method.
7340         (General_options::parse_EL): Same.
7341         (General_options::General_options): Initialize endianness_.
7342         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7343         New options.
7344         (General_options::Endianness): New enum.
7345         (General_options::endianness): New method.
7346         (General_options::endianness_): New data member.
7347         * parameters.cc (Parameters::set_options): Check target endianness.
7348         (Parameters::set_target_once): Ditto.
7349         (Parameters::check_target_endianness): New method.
7350         (parameters_force_valid_target): If either -EL or -EB is specified,
7351         use it to define endianness of default target.
7352         * parameters.h (Parameters::check_target_endianness): New method
7353         declaration.
7354         * target.h (class Target): Change "endianity" to "endianness"
7355         in comments.
7356
7357 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7358
7359         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7360         * configure: Regenerate.
7361         * Makefile.in: Regenerate.
7362         * testsuite/Makefile.in: Regenerate.
7363
7364 2010-04-06  Cary Coutant  <ccoutant@google.com>
7365
7366         gcc PR lto/42757
7367         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7368         prevailing definitions of common symbols.
7369         * testsuite/plugin_test_6.sh: New test case.
7370         * testsuite/plugin_common_test_1.c: New test case.
7371         * testsuite/plugin_common_test_2.c: New test case.
7372         * testsuite/Makefile.am (plugin_test_6): New test case.
7373         * testsuite/Makefile.in: Regenerate.
7374
7375 2010-04-06  Nick Clifton  <nickc@redhat.com>
7376
7377         * po/vi.po: New Vietnamese translation.
7378
7379 2010-03-30  Doug Kwan  <dougkwan@google.com>
7380
7381         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7382
7383 2010-03-25  Doug Kwan  <dougkwan@google.com>
7384
7385         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7386         to avoid a conversion warning on a 32-bit host.
7387
7388 2010-03-24  Ian Lance Taylor  <iant@google.com>
7389
7390         * testsuite/script_test_3.t: Add a TLS segment.
7391         * testsuite/Makefile.am (check_PROGRAMS): Add
7392         tls_phdrs_script_test.
7393         (tls_phdrs_script_test_SOURCES): Define.
7394         (tls_phdrs_script_test_DEPENDENCIES): Define.
7395         (tls_phdrs_script_test_LDFLAGS): Define.
7396         (tls_phdrs_script_test_LDADD): Define.
7397         * testsuite/Makefile.in: Rebuild.
7398
7399 2010-03-23  Cary Coutant  <ccoutant@google.com>
7400
7401         * fileread.cc (find_or_make_view): Fix comment.
7402
7403 2010-03-23  Ian Lance Taylor  <iant@google.com>
7404
7405         * script-sections.cc (class Orphan_section_placement): Define
7406         PLACE_TLS and PLACE_TLS_BSS.
7407         (Orphan_section_placement::Orphan_section_placement): Initialize
7408         new places.
7409         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7410         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7411         (tls_script_test_SOURCES): Define.
7412         (tls_script_test_DEPENDENCIES): Define.
7413         (tls_script_test_LDFLAGS): Define.
7414         (tls_script_test_LDADD): Define.
7415         * testsuite/Makefile.in: Rebuild.
7416
7417 2010-03-22  Doug Kwan  <dougkwan@google.com>
7418
7419         * arm.cc (Arm_relocate_functions::abs8,
7420         Arm_relocate_functions::abs16): Use correct check for overflow
7421         specified in the ARM ELF specs.
7422         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7423         target of a BLX instruction specially.
7424         (Reloc_stub::stub_type_for_reloc): Ditto.
7425         (Relocate::relocate): Use symbolic names instead of numeric relocation
7426         codes to report error.
7427         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7428         workaround.
7429         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7430         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7431         thumb2_blx_out_of_range.stdout
7432         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7433         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7434         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7435         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7436         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7437         thumb2_blx_in_range, thumb2_blx_in_range.o,
7438         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7439         thumb2_blx_out_of_range.o): New rules.
7440         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7441         thumb2_blx_in_range and thumb2_blx_out_of_range.
7442         * testsuite/Makefile.in: Regenerate.
7443         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7444         * testsuite/thumb_blx_in_range.s: New file.
7445         * testsuite/thumb_blx_out_of_range.s: New file.
7446
7447 2010-03-22  Rafael Espindola  <espindola@google.com>
7448
7449         * archive.cc (Should_include): Move to archive.h.
7450         (should_include_member): Make it a member of Archive.
7451         (Lib_group): New.
7452         (Add_lib_group_symbols): New.
7453         * archive.h: Include options.h.
7454         (Archive_member): Moved from Archive.
7455         (Should_include): Moved from archive.cc.
7456         (Lib_group): New.
7457         (Add_lib_group_symbols): New.
7458         * dynobj.cc (do_should_include_member): New.
7459         * dynobj.h (do_should_include_member): New.
7460         * gold.cc (queue_initial_tasks): Update call to queue.
7461         * main.cc (main): Print lib group stats.
7462         * object.cc (do_should_include_member): New.
7463         * object.h: Include archive.h.
7464         (Object::should_include_member): New.
7465         (Object::do_should_include_member): New.
7466         (Sized_relobj::do_should_include_member): New.
7467         * options.cc (General_options::parse_start_lib): New.
7468         (General_options::parse_end_lib): New.
7469         (Input_arguments::add_file): Handle lib groups.
7470         (Input_arguments::start_group): Check we are not in a lib.
7471         (Input_arguments::start_lib): New.
7472         (Input_arguments::end_lib): New.
7473         * options.h (General_options): Add start_lib and end_lib.
7474         (Input_argument::lib_): New.
7475         (Input_argument::lib): New.
7476         (Input_argument::is_lib): New.
7477         (Input_file_lib): New.
7478         (Input_arguments::in_lib_): New.
7479         (Input_arguments::in_lib): New.
7480         (Input_arguments::start_lib): New.
7481         (Input_arguments::end_lib_): New.
7482         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7483         in unused members as preempted.
7484         (Sized_pluginobj::do_should_include_member): New.
7485         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7486         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7487         return the blocker.
7488         (Read_symbols::do_whole_lib_group): New.
7489         (Read_symbols::do_lib_group): New.
7490         (Read_symbols::do_read_symbols): Handle lib groups.
7491         (Read_symbols::get_name): Handle lib groups.
7492         * readsyms.h (Read_symbols): Add an archive member pointer.
7493         (Read_symbols::do_whole_lib_group): New.
7494         (Read_symbols::do_lib_group): New.
7495         (Read_symbols::member_): New.
7496         * script.cc (read_input_script): Update call to queue_soon.
7497
7498 2010-03-19  Doug Kwan  <dougkwan@google.com>
7499
7500         * arm.cc (Stub_table::Stub_table): Initialize new data members
7501         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7502         (Stub_table::add_reloc_stub): Assign stub offset and update
7503         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7504         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7505         New data members.
7506         (Stub_table::update_data_size_and_addralign): Use
7507         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7508         instead of going over all reloc stubs.
7509         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7510         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7511         Stringpool_template::offset_ to size of Stringpool_char.
7512         (Stringpool_template::new_key_offset): Remove code to initialize
7513         Stringpool_template::offset_.
7514         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7515         Stringpool_template::offset_ to zero.
7516
7517 2010-03-15  Doug Kwan  <dougkwan@google.com>
7518
7519         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7520         offset_.
7521         (Stringpool_template::new_key_offset): New method.
7522         (Stringpool_template::add_string): Assign offsets when adding new
7523         strings.
7524         (Stringpool_template::set_string_offsets): Do not set string offsets
7525         when not optimizing.
7526         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7527         member size_.
7528         (Chunked_vector::clear): Clear size_.
7529         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7530         (Chunked_vector::size): Return size_.
7531         (Chunked_vector::push_back): Use size_ to find insert position.
7532         (Chunked_vector::size_): New data member.
7533         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7534         (Stringpool_template::new_key_offset): New method declaration.
7535         (Stringpool_template::offset_): New data member.
7536
7537 2010-03-15   Rafael Espindola  <espindola@google.com>
7538
7539         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7540         Add_symbols' constructor.
7541         * readsyms.h (Add_symbols): Remove the input_group member.
7542
7543 2010-03-10  Ian Lance Taylor  <iant@google.com>
7544
7545         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7546         target to ask whether a reference to a symbol requires a stack
7547         split.
7548         * target.h (Target::is_call_to_non_split): New function.
7549         (Target::do_is_call_to_non_split): Declare virtual function.
7550         * target.cc: Include "symtab.h".
7551         (Target::do_is_call_to_non_split): New function.
7552         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7553
7554 2010-03-10  Cary Coutant  <ccoutant@google.com>
7555
7556         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7557         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7558         (File_read::open[2]): Add whole_file_view_ to list of views.
7559         (File_read::make_view): Remove test of whole_file_view_.
7560         (File_read::find_or_make_view): Create whole_file_view_ if
7561         necessary.
7562         (File_read::clear_views): Replace bool parameter with enum;
7563         adjust all callers.  Don't delete views with permanent data;
7564         do delete cached views and views from archives if
7565         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7566         if clearing the corresponding view.
7567         * fileread.h (File_read::Clear_views_mode): New enum.
7568         (File_read::View::is_permanent_view): New method.
7569         (File_read::clear_views): Replace bool parameter
7570         with enum; adjust all callers.
7571         * options.h (General_options): Change keep_files_mapped option;
7572         add map_whole_files.
7573         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7574         releasing the file.
7575         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7576         the file.
7577
7578 2010-03-10  David S. Miller  <davem@davemloft.net>
7579
7580         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7581
7582 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7583
7584         * icf.cc (get_section_contents): Add '@' marker after processing the
7585         merge reloc.
7586
7587 2010-03-08  Doug Kwan  <dougkwan@google.com>
7588
7589         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7590         due to a conversion warning.
7591         (Arm_relobj::update_output_local_symbol_count): Check for local
7592         symbol with unset output index.
7593
7594 2010-03-05  Ian Lance Taylor  <iant@google.com>
7595
7596         * options.h (class General_options): Add --spare-dynamic-tags.
7597         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7598         --spare-dynamic-tags.
7599
7600 2010-03-05  Ian Lance Taylor  <iant@google.com>
7601
7602         * incremental.cc: Include "libiberty.h".
7603
7604 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7605
7606         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7607         function, is_info_ member.
7608         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7609         (Versions::Versions): Update caller.
7610         (Versions::define_base_version): Likewise.
7611         (Versions::add_def): Likewise.
7612
7613 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7614
7615         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7616         (Scan::possible_function_pointer_reloc): New function.
7617         (Scan::local_reloc_may_be_function_pointer): Change to call
7618         possible_function_pointer_reloc.
7619         (Scan::global_reloc_may_be_function_pointer): Ditto.
7620         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7621         relocations in ".data.rel.ro._ZTV" section.
7622         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7623         * testsuite/icf_safe_so_test.cc: Ditto.
7624         * testsuite/icf_safe_test.cc: Ditto.
7625         * testsuite/icf_safe_test.sh: Ditto.
7626
7627 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7628             Ian Lance Taylor  <iant@google.com>
7629
7630         * target-reloc.h (relocate_section): Check the symbol table index
7631         for -1U before setting the local symbol index.
7632         (scan_relocatable_relocs): If copying the relocation, record that
7633         the local symbol is required.
7634         * object.h (Symbol_value::is_output_symtab_index_set): New
7635         function.
7636         (Symbol_value::may_be_discarded_from_output_symtab): New
7637         function.
7638         (Symbol_value::has_output_symtab_entry): New function.
7639         (Symbol_value::needs_output_symtab_entry): Remove.
7640         (Symbol_value::output_symtab_index): Make sure the symbol index is
7641         set.
7642         (Symbol_value::set_output_symtab_index): Make sure the symbol
7643         index is not set.  Make sure the new index is valid.
7644         (Symbol_value::set_must_have_output_symtab_entry): New function.
7645         (Symbol_value::has_output_dynsym_entry): New function.
7646         (Symbol_value::set_output_dynsym_index): Make sure the new index
7647         is valid.
7648         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7649         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7650         local symbol if permitted.
7651         (Sized_relobj::do_finalize_local_symbols): Call
7652         is_output_symtab_index_set rather than needs_output_symtab_entry.
7653         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7654         rather than needs_output_symtab_entry.  Call
7655         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7656         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7657         is_output_symtab_index_set rather than needs_output_symtab_entry.
7658         * testsuite/discard_locals_relocatable_test.c: New file.
7659         * testsuite/discard_locals_test.sh: Test -r.
7660         * testsuite/Makefile.am (check_DATA): Add
7661         discard_locals_relocatable_test1.syms,
7662         discard_local_relocatable_test2.syms.
7663         (MOSTLYCLEANFILES): Likewise.  Also add
7664         discard_locals_relocatable_test1.lout and
7665         discard_locals_relocatable_test2.out.
7666         (discard_locals_relocatable_test1.syms): New target.
7667         (discard_locals_relocatable_test.o): New target.
7668         (discard_locals_relocatable_test1.out): New target.
7669         (discard_locals_relocatable_test2.syms): New target.
7670         (discard_locals_relocatable_test2.out): New target.
7671         (various): Add missing ../ld-new dependencies.
7672         * testsuite/Makefile.in: Rebuild.
7673
7674 2010-03-03  Nick Clifton  <nickc@redhat.com>
7675
7676         * po/fi.po: New Finnish translation.
7677
7678 2010-03-01  Doug Kwan  <dougkwan@google.com>
7679
7680         * layout.cc (Layout::Layout): Force section types of .init_array*,
7681         .preinit_array* and .fini_array* sections.
7682         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7683         Fix check of return value of std::string::find.().
7684         (Output_section::Input_section_sort_compare::operator()): Remove
7685         comment about .init_array.
7686         (Output_section::Input_section_sort_init_fini_compare::operator()):
7687         New method.
7688         (Output_section::sort_attached_input_sections): Handle .init_array
7689         and .fini_array specially.
7690         * output.h (Output_section::Inut_section_sort_compare): Update
7691         comment.
7692         (Output_section::Input_section_sort_init_fini_compare): New struct.
7693
7694 2010-02-26  Doug Kwan  <dougkwan@google.com>
7695
7696         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7697         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7698         * testsuite/debug_msg.sh: Avoid matching source line number for
7699         use of global variable undef_int.
7700
7701 2010-02-26  Doug Kwan  <dougkwan@google.com>
7702
7703         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7704         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7705         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7706         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7707         * options.cc (General_options::General_options): Initialize member
7708         fix_v4bx_.
7709         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7710         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7711         and rm_no_fix_v4bx.stdout
7712         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7713         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7714         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7715         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7716         and arm_no_fix_v4bx.
7717         * Makefile.in: Regenerate.
7718         * testsuite/arm_fix_v4bx.s: New file.
7719         * testsuite/arm_fix_v4bx.sh: Ditto.
7720
7721 2010-02-24  Doug Kwan  <dougkwan@google.com>
7722
7723         * arm.cc (Target_arm::got_section): Make the .got section the first
7724         non RELRO section in the data segment.
7725         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7726         suffixes of section names.
7727
7728 2010-02-24  Doug Kwan  <dougkwan@google.com>
7729
7730         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7731         flags and attributes merging if an input file is a binary file.
7732         * fileread.cc (Input_file::open): Record format of original file.
7733         * fileread.h (Input_file::Format): New enum type.
7734         (Input_file::Input_file): Initialize data member format_.
7735         (Input_file::format): New method definition.
7736         (Input_file::format_):: New data member.
7737
7738 2010-02-24  Doug Kwan  <dougkwan@google.com>
7739
7740         * arm.cc (Arm_output_data_got): New class.
7741         (ARM_TCB_SIZE): New constant
7742         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7743         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7744         If user uses a script with a SECTIONS clause, issue only a warning
7745         for a misplaced EXIDX input section.  Otherwise, issue an error.
7746         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7747         garbage collection.
7748         (Target_arm::got_mode_index_entry): Handle static linking.
7749         (Target_arm::Scan::local): Ditto.
7750         (Target_arm::Scan::global): Ditto.
7751         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7752         all incorrectly implemented relocations.
7753         (Target_arm::fix_exidx_coverage): Pass layout to
7754         Arm_output_section::fix_exidx_coverage.
7755         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7756         from ".ARM.exidx." and ".ARM.extab.".
7757
7758 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7759
7760         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7761         section if it does not already exist.
7762         * attributes.cc (Attributes_section_data::Attributes_section_data):
7763         Don't crash if size is zero.
7764
7765 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7766             Ian Lance Taylor  <iant@google.com>
7767
7768         * gold.cc (queue_middle_tasks): If no input files were opened,
7769         exit.
7770         * workqueue.h (Task_function::Task_function): Assert that there is
7771         a blocker.
7772
7773 2010-02-22  Doug Kwan  <dougkwan@google.com>
7774
7775         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7776         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7777         types to avoid warnings due to different uint64_t implementations
7778         on different hosts.
7779
7780 2010-02-21  Doug Kwan  <dougkwan@google.com>
7781
7782         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7783         handling of the maximum backward branch offset.
7784         (Arm_relocate_functions::thumb_branch_common): Ditto.
7785         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7786         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7787         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7788         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7789         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7790         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7791         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7792         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7793         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7794         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7795         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7796         thumb2_bl_out_of_range.o): New rules.
7797         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7798         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7799         thumb2_bl_out_of_range
7800         * testsuite/Makefile.in: Regenerate.
7801         * testsuite/arm_bl_in_range.s: New file.
7802         * testsuite/arm_bl_out_of_range.s: Ditto.
7803         * testsuite/arm_branch_in_range.sh: Ditto.
7804         * testsuite/arm_branch_range.t: Ditto.
7805         * testsuite/thumb2_branch_range.t: Ditto.
7806         * testsuite/thumb_bl_in_range.s: Ditto.
7807         * testsuite/thumb_bl_out_of_range.s: Ditto.
7808         * testsuite/thumb_branch_range.t: Ditto.
7809
7810 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7811
7812         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7813         Add reloc offset information.
7814         * icf.cc (get_section_contents): Change iterators to point to the new
7815         vectors. Add reloc offset information to the contents.
7816         * icf.h (Icf::Sections_reachable_info): New typedef.
7817         (Icf::Sections_reachable_list): New typedef.
7818         (Icf::Offset_info): New typedef.
7819         (Icf::Reloc_info): New struct typedef.
7820         (Icf::Reloc_info_list): New typedef.
7821         (Icf::symbol_reloc_list): Delete method.
7822         (Icf::addend_reloc_list): Delete method.
7823         (Icf::section_reloc_list): Delete method.
7824         (Icf::reloc_info_list): New method.
7825         (Icf::reloc_info_list_): New member.
7826
7827 2010-02-19  Doug Kwan  <dougkwan@google.com>
7828
7829         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7830         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7831         * arm.cc (Arm_relocation_functions): New forward declaration.
7832         (Target_arm::Target_arm): Initialize new data members
7833         got_mod_index_offset_ and tls_base_symbol_defined_.
7834         (Target_arm::Relocate::relocate_tls): New method.
7835         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7836          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7837         New methods.
7838         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7839         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7840         (Target_arm::got_mod_index_offset_,
7841         Target_arm::tls_base_symbol_defined_): New data members.
7842         (Target_arm::Scan::local, Target::Scan::global,
7843         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7844         relocations.
7845
7846 2010-02-18  Doug Kwan  <dougkwan@google.com>
7847
7848         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7849         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7850         text section as a parameter becuase some broken tools may not set
7851         the link in section header.
7852         (Target_arm::has_got_section): New method.
7853         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7854         without any mapping symbol as data only.  Remove warning.
7855         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7856         link in its section header, try to discover the link by inspecting the
7857         REL31 relocation at the beginning of the section.
7858         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7859         in error message.
7860         (Target_arm::Scan::global): Treat any reference to the symbol
7861         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7862
7863 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7864
7865         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7866         (Scan::global_reloc_may_be_function_pointer): New function.
7867         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7868         (Scan::global_reloc_may_be_function_pointer): New function.
7869         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7870         (Scan::global_reloc_may_be_function_pointer): New function.
7871         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7872         (Scan::global_reloc_may_be_function_pointer): New function.
7873         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7874         (Scan::global_reloc_may_be_function_pointer): New function.
7875         (Scan::possible_function_pointer_reloc): New function.
7876         (Target_x86_64::can_check_for_function_pointers): New function.
7877         * gc.h (gc_process_relocs): Scan relocation types to determine if
7878         function pointers were taken for targets that support it.
7879         * icf.cc (Icf::find_identical_sections): Include functions for
7880         folding in safe ICF whose pointer is not taken.
7881         * icf.h (Secn_fptr_taken_set): New typedef.
7882         (fptr_section_id_): New member.
7883         (section_has_function_pointers): New function.
7884         (set_section_has_function_pointers): New function.
7885         (check_section_for_function_pointers): New function.
7886         * options.h: Fix comment for safe ICF option.
7887         * target.h (can_check_for_function_pointers): New function.
7888         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7889         Modify icf_safe_test for X86-64.
7890         * testsuite/Makefile.in: Regenerate.
7891         * testsuite/icf_safe_so_test.cc: New file.
7892         * testsuite/icf_safe_so_test.sh: New file.
7893         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7894         (main): Change to take pointer to function kept_func_3.
7895         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7896         folding is done correctly for X86-64.
7897
7898 2010-02-12  David S. Miller  <davem@davemloft.net>
7899
7900         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7901         is_symbolless parameter.
7902         (Output_reloc<SHT_REL>::is_symbolless): New.
7903         (Output_reloc<SHT_REL>::is_symbolless_): New.
7904         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7905         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7906         (Output_reloc<SHT_RELA>::is_symbolless): New.
7907         (Output_data_reloc::add_global): Handle is_symbolless.
7908         (Output_data_reloc::add_global_relative): Likewise.
7909         (Output_data_reloc::add_local): Likewise.
7910         (Output_data_reloc::add_local_relative): Likewise.
7911         (Output_data_reloc::add_symbolless_global_addend): New.
7912         (Output_data_reloc::add_symbolless_local_addend): New.
7913         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7914         is_symbolless.
7915         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7916         instead of ->is_relative_
7917         (Output_reloc::write): Likewise.
7918         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7919         (Output_reloc::write_rel): Simplify.
7920
7921         * sparc.cc (Target_sparc::Scan::local): Use
7922         ->add_symbolless_local_addend as needed.
7923         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7924         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7925         based upon relocation offset.
7926
7927 2010-02-11  Doug Kwan  <dougkwan@google.com>
7928
7929         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7930         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7931         beginning of function.
7932         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7933         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7934         parameter is_32bit in calls to should_apply_static_reloc.
7935         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7936         (check_DATA): Add arm_abs_global.stdout.
7937         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7938         arm_abs_global.stdout): New rules.
7939         (MOSTLLYCLEANFILES): Add arm_abs_global
7940         * Makefile.in: Regenerate.
7941         * testsuite/arm_abs_global.s: New file.
7942         * testsuite/arm_abs_global.sh: Ditto.
7943         * testsuite/arm_abs_lib.s: Ditto.
7944
7945 2010-02-11  Ian Lance Taylor  <iant@google.com>
7946
7947         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7948         Read_relocs task.
7949         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7950         Allocate_commons_task first.
7951         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7952         task, rather than symtab_lock_.
7953         (Gc_process_relocs::~Gc_process_relocs): New function.
7954         (Gc_process_relocs::is_runnable): Check this_blocker_.
7955         (Gc_process_relocs::locks): Use next_blocker_ rather than
7956         blocker_.
7957         (Scan_relocs::~Scan_relocs): New function.
7958         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7959         symtab_lock_.
7960         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7961         next_blocker_.
7962         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7963         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7964         constructor accordingly.
7965         (class Gc_process_relocs): Likewise.
7966         (class Scan_relocs): Likewise.
7967         * common.h (class Allocate_commons_task): Remove symtab_lock_
7968         field, and corresponding constructor parameter.
7969         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7970         symtab_lock_.
7971         (Allocate_commons_task::locks): Likewise.
7972
7973 2010-02-11  Ian Lance Taylor  <iant@google.com>
7974
7975         * gold-threads.h (class Once): Define.
7976         (class Initialize_lock): Rewrite as child of Once.
7977         * gold-threads.cc (class Once_initialize): Define.
7978         (once_pointer_control): New static variable.
7979         (once_pointer, once_arg): New static variables.
7980         (c_run_once): New static function.
7981         (Once::Once, Once::run_once, Once::internal_run): New functions.
7982         (class Initialize_lock_once): Remove.
7983         (initialize_lock_control): Remove.
7984         (initialize_lock_pointer): Remove.
7985         (initialize_lock_once): Remove.
7986         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7987         (Initialize_lock::initialize): Rewrite.
7988         (Initialize_lock::do_run_once): New function.
7989         * archive.cc (Archive::interpret_header): Only clear name if it is
7990         not already empty.
7991         * fileread.cc: Include "gold-threads.h"
7992         (file_counts_lock): New static variable.
7993         (file_counts_initialize_lock): Likewise.
7994         (File_read::release): Only increment counts when using --stats.
7995         Use a lock around the increment.
7996         * parameters.cc (class Set_parameters_target_once): Define.
7997         (set_parameters_target_once): New static variable.
7998         (Parameters::Parameters): Move here from parameters.h.
7999         (Parameters::set_target): Rewrite.
8000         (Parameters::set_target_once): New function.
8001         (Parameters::clear_target): Move here and rewrite.
8002         * parameters.h (class Parameters): Update declarations.  Add
8003         set_parameters_target_once_ field.
8004         (Parameters::Parameters): Move to parameters.cc.
8005         (Parameters::clear_target): Likewise.
8006         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8007         task.
8008         (Start_group::~Start_group): New function.
8009         (Start_group::is_runnable): New function.
8010         (Start_group::locks, Start_group::run): New functions.
8011         (Finish_group::run): Change saw_undefined to size_t.
8012         * readsyms.h (class Start_group): Define.
8013         (class Finish_group): Change saw_undefined_ field to size_t.
8014         (Finish_group::Finish_group): Remove saw_undefined and
8015         this_blocker parameters.  Change all callers.
8016         (Finish_group::set_saw_undefined): New function.
8017         (Finish_group::set_blocker): New function.
8018         * symtab.h (class Symbol_table): Change saw_undefined to return
8019         size_t.  Change saw_undefined_ field to size_t.
8020         * target-select.cc (Set_target_once::do_run_once): New function.
8021         (Target_selector::Target_selector): Initialize set_target_once_
8022         field.  Don't initialize lock_ and initialize_lock_ fields.
8023         (Target_selector::instantiate_target): Rewrite.
8024         (Target_selector::set_target): New function.
8025         * target-select.h (class Set_target_once): Define.
8026         (class Target_selector): Update declarations.  Make
8027         Set_target_once a friend.  Remove lock_ and initialize_lock_
8028         fields.  Add set_target_once_ field.
8029
8030 2010-02-10  Ian Lance Taylor  <iant@google.com>
8031
8032         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8033         queueing any tasks.
8034         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8035         (queue_middle_tasks): Add all blockers before queueing any tasks.
8036         (queue_final_tasks): Likewise.
8037         * token.h (Task_token::add_blockers): New function.
8038         * object.h (Input_objects::number_of_relobjs): New function.
8039
8040 2010-02-10  Ian Lance Taylor  <iant@google.com>
8041
8042         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8043         shared, not if not position independent.
8044         * x86_64.cc (Relocate::relocate_tls): Likewise.
8045         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8046         (tls_pie_pic_test): New target.
8047         * testsuite/Makefile.in: Rebuild.
8048
8049         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8050         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8051         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8052         * testsuite/Makefile.in: Rebuild.
8053
8054 2010-02-09  David S. Miller  <davem@davemloft.net>
8055
8056         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8057         R_SPARC_RELATIVE using ->add_local_relative().
8058         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8059
8060         * output.h (Output_data_dynamic::add_section_size): New method
8061         that takes two Output_data objects.
8062         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8063         entry param.  Handle it in initializers.
8064         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8065         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8066         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8067         arg.
8068         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8069         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8070         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8071         for dynrel_includes_plt.
8072         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8073         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8074         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8075         before .rela.plt
8076         (Target_sparc::do_finalize_sections): Update to pass true for
8077         dynrel_includes_plt.
8078         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8079         output before .rela.plt
8080         (Target_powerpc::do_finalize_sections): Update to pass true for
8081         dynrel_includes_plt when 32-bit.
8082
8083 2010-02-08  Doug Kwan  <dougkwan@google.com>
8084
8085         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8086         method.
8087         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8088         Arm_relobj::scan_section_for_cortex_a8_stubs,
8089         Arm_relobj::do_relocation_section): Instead of calling
8090         Output_section::output_address, use faster
8091         Arm_relobj::simple_input_section_output_address.
8092
8093 2010-02-08  David S. Miller  <davem@davemloft.net>
8094
8095         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8096         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8097         relocation helper function.
8098
8099         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8100         just like R_SPARC_GOT{10,13,22}.
8101         (Target_sparc::Scan::local): Likewise.
8102         (Target_sparc::Relocate:relocate): Likewise.
8103
8104 2010-02-06  Ian Lance Taylor  <iant@google.com>
8105
8106         * configure.ac: Rewrite targetobjs duplicate removal code to use
8107         only shell constructs.
8108         * configure: Rebuild.
8109
8110 2010-02-05  Doug Kwan  <dougkwan@google.com>
8111
8112         PR 11247
8113         * arm.cc (Arm_relobj::section_is_scannable): New method.
8114         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8115         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8116
8117 2010-02-04  Doug Kwan  <dougkwan@google.com>
8118
8119         PR 11247
8120         * arm-reloc-property.cc (cstdio): Include.
8121         * configure.ac (targetobjs): Remove duplicates.
8122         * configure: Regenerate.
8123         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8124         big and little endian version for a given address size.
8125
8126 2010-02-03  Doug Kwan  <dougkwan@google.com>
8127
8128         * arm-reloc-property.cc
8129         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8130         definition.
8131         * arm-reloc-property.h
8132         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8133         New method definition.
8134         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8135         declaration.
8136         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8137         overflow to N.
8138         (GOT_PREL): Change implemented to Y.
8139         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8140         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8141         (Arm_relocate_functions::movw_abs_nc): Remove method.
8142         (Arm_relocate_functions::movt_abs): Ditto.
8143         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8144         (Arm_relocate_functions::thm_movt_abs): Ditto.
8145         (Arm_relocate_functions::movw_rel_nc): Ditto.
8146         (Arm_relocate_functions::movw_rel): Ditto.
8147         (Arm_relocate_functions::movt_rel): Ditto.
8148         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8149         (Arm_relocate_functions:thm_movw_rel): Ditto.
8150         (Arm_relocate_functions:thm_movt_rel): Ditto.
8151         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8152         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8153         New method definitions.
8154         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8155         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8156         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8157         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8158         (Target_arm::Relocate::relocate): Check for non-static or
8159         unimplemented relocation code and exit early.  Change calls to
8160         Target_arm::reloc_uses_thumb_bit and
8161         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8162         instead.  Refactor code to handle similar relocations to increase
8163         code sharing.  Remove check for unsupported relocation code in switch
8164         statement.
8165         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8166         relocation property table to find out size.  Change error message to
8167         print out the name of a relocation code instead of the numeric value.
8168         (Target_arm::scan_reloc_for_stub): Use relocation property table
8169         instead of calling Target_arm::reloc_uses_thumb_bit().
8170
8171 2010-02-02  Doug Kwan  <dougkwan@google.com>
8172
8173         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8174         types of relaxed input section.
8175
8176 2010-02-02  Doug Kwan  <dougkwan@google.com>
8177
8178         * Makefile.am (HFILES): Add arm-reloc-property.h.
8179         (DEFFILES): New.
8180         (TARGETSOURCES): Add arm-reloc-property.cc
8181         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8182         (libgold_a_SOURCES): $(DEFFILES)
8183         * Makefile.in: Regenerate.
8184         * arm-reloc-property.cc: New file.
8185         * arm-reloc-property.h: New file.
8186         * arm-reloc.def: New file.
8187         * arm.cc: Update comments.
8188         (arm-reloc-property.h): New included header.
8189         (arm_reloc_property_table): New global variable.
8190         (Target_arm::do_select_as_default_target): New method definition.
8191         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8192         arm-reloc-property to targ_extra_obj.
8193         * parameters.cc (set_parameters_target): Call
8194         Target::select_as_default_target().
8195         * target.h (Target::select_as_default_target): New method definition.
8196         (Target::do_select_as_default_target): Same.
8197
8198 2010-02-01  Doug Kwan  <dougkwan@google.com>
8199
8200         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8201         first_output_text_section_.
8202         (Arm_exidx_fixup::first_output_text_section): New method definition.
8203         (Arm_exidx_fixup::first_output_text_section_): New data member.
8204         (Arm_exidx_fixup::process_exidx_section): Record the first text
8205         output section seen.
8206         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8207         and entsize in output section header.
8208
8209 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8210
8211         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8212         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8213         (Arm_relocate_functions::thm_alu11): New Method.
8214         (Arm_relocate_functions::thm_pc8): New Method.
8215         (Arm_relocate_functions::thm_pc12): New Method.
8216         (Target_arm::Scan::local): Handle the relocations.
8217         (Target_arm::Scan::global): Likewise.
8218         (Target_arm::Relocate::relocate): Likewise.
8219         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8220
8221 2010-01-29  Doug Kwan  <dougkwan@google.com>
8222
8223         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8224         of relocation types as ld.
8225
8226 2010-01-29  Doug Kwan  <dougkwan@google.com>
8227
8228         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8229         to public.
8230         (Arm_relocate_functions::thumb_branch_common): Ditto.
8231         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8232         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8233         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8234         Arm_relocate_functions::jump24): Remove.
8235         (Target_arm::Relocate::relocate): Adjust code to call
8236         Arm_relocation_functions::arm_branch_common and
8237         Arm_relocation_functions::thumb_branch_common instead of their removed
8238         wrappers.  Merge switch-cases together to reduce source code size.
8239
8240 2010-01-29  Doug Kwan  <dougkwan@google.com>
8241
8242         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8243         output_local_symbol_count_needs_update_.
8244         (Arm_relobj::output_local_symbol_count_needs_update,
8245          Arm_relobj::set_output_local_symbol_count_needs_update,
8246          Arm_relobj::update_output_local_symbol_count): New methods.
8247         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8248         member.
8249         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8250         of pointed function as in a R_ARM_PREL31 relocation.
8251         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8252         for output local symbol count updating.
8253         (Target_arm::do_relax): Update output local symbol counts in objects
8254         if necessary.
8255         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8256
8257 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8258
8259         * arm.cc: Added support for the ARM relocations:
8260         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8261         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8262         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8263         movw_prel_nc).
8264         (Arm_relocate_functions::movw_rel): New method.
8265         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8266         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8267         thm_movw_prel_nc).
8268         (Arm_relocate_functions::thm_movw_rel): New method.
8269         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8270         thm_movt_prel).
8271         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8272         relocations.
8273         (Target_arm::Scan::global): Likewise.
8274         (Target_arm::Relocate::relocate): Likewise.
8275         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8276         Likewise.
8277
8278 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8279
8280         * arm.cc: Added support for ARM group relocations.
8281         (Target_arm::reloc_needs_sym_origin): New method.
8282         (Arm_relocate_functions::calc_grp_kn): New method.
8283         (Arm_relocate_functions::calc_grp_residual): New method.
8284         (Arm_relocate_functions::calc_grp_gn): New method.
8285         (Arm_relocate_functions::arm_grp_alu): New Method.
8286         (Arm_relocate_functions::arm_grp_ldr): New Method.
8287         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8288         (Arm_relocate_functions::arm_grp_ldc): New Method.
8289         (Target_arm::Scan::local): Handle the ARM group relocations.
8290         (Target_arm::Scan::global): Likewise.
8291         (Target_arm::Relocate::relocate): Likewise.
8292         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8293         Likewise.
8294
8295 2010-01-26  Doug Kwan  <dougkwan@google.com>
8296
8297         * arm.cc (set): Include.
8298         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8299         pointer type.
8300         (Arm_output_section::Text_section_list): New type.
8301         (Arm_output_section::append_text_sections_to_list): New method.
8302         (Arm_output_section::fix_exidx_coverage): Ditto.
8303         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8304         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8305         Relobj::set_section_offset() instead of
8306         Sized_relobj::invalidate_section_offset().
8307         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8308         parameter for section headers. Ignore relocation sections for
8309         unallocated sections and EXIDX sections.
8310         (Target_arm::fix_exidx_coverage): New method.
8311         (Target_arm::output_section_address_less_than): New type.
8312         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8313         linked text section instead of the EXIDX section.
8314         (Arm_output_section::create_stub_group): Add an assertion to check
8315         that this is not an EXIDX output section.
8316         (Arm_output_section::append_text_sections_to_list): New method.
8317         (Arm_output_section::fix_exidx_coverage): Ditto.
8318         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8319         Arm_relobj::section_needs_reloc_stub_scanning.
8320         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8321         first pass.
8322         (Target_arm::fix_exidx_coverage): New method.
8323         * object.h (Relobj::set_output_section): New method.
8324         (Sized_relobj::invalidate_section_offset): Remove method.
8325         (Sized_relobj::do_invalidate_section_offset): Remove method.
8326         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8327
8328 2010-01-25  Doug Kwan  <dougkwan@google.com>
8329
8330         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8331         Fix warning due to signed and unsigned comparison on a 32-bit host.
8332
8333 2010-01-22  Doug Kwan  <dougkwan@google.com>
8334
8335         * arm.cc (Target_arm::do_relax): Record an output section for section
8336         offset adjustment it contains any stub table that has changed.
8337         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8338         offsets in an output section if necessary.
8339         * output.cc (Output_section::Output_section): Initialize
8340         section_offsets_need_adjustments_.
8341         (Output_section::add_input_section_for_script): Renamed to
8342         Output_section::add_simple_input_section.
8343         (Output_section::save_states): Add a comment.
8344         (Output_section::discard_states): New method defintion.
8345         (Output_section::adjust_section_offsets): Same.
8346         * output.h (Output_section::add_input_section_for_script): Renamed to
8347         Output_section::add_simple_input_section.
8348         (Output_section::discard_states): New method declaration.
8349         (Output_section::adjust_section_offsets): Same.
8350         (Output_section::section_offsets_need_adjustment,
8351         Output_section::set_section_offsets_need_adjustment): New method
8352         definitions.
8353         (Output_section::section_offsets_need_adjustment_): New data member.
8354         * script-sections.cc
8355         (Output_section_element_input::set_section_address): Adjust code for
8356         renaming of Output_section::add_input_section_for_script.
8357         (Orphan_output_section::set_section_address): Same.
8358
8359 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8360
8361         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8362         Fix_v4bx enum values .
8363         * gold/options.h (General_options): New option definitions.
8364         (General_options::fix_v4bx): New method.
8365         (General_options::Fix_v4bx): New enum.
8366         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8367         (General_options::parse_fix_v4bx_interworking): New method.
8368
8369 2010-01-22  Doug Kwan  <dougkwan@google.com>
8370
8371         * arm.cc (Arm_exidx_fixup): New class.
8372
8373 2010-01-21  Doug Kwan  <dougkwan@google.com>
8374
8375         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8376         classes.
8377         (Arm_exidx_section_offset_map): New type.
8378
8379 2010-01-21  Doug Kwan  <dougkwan@google.com>
8380
8381         * arm.cc (Arm_exidx_input_section): New class.
8382         (Arm_relobj::exidx_input_section_by_link,
8383         Arm_relobj::exidx_input_section_by_shndx,
8384         Arm_relobj::make_exidx_input_section): New methods.
8385         (read_arm_attributes_section): Remove.
8386         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8387         information about them.
8388         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8389         to here.
8390
8391 2010-01-20  Doug Kwan  <dougkwan@google.com>
8392
8393         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8394         Input_section_specifier to Section_id.
8395         (Target_arm::new_arm_input_section: Adjust code for change of key
8396         type.
8397         (Target_arm::find_arm_input_section): Ditto.
8398         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8399         (Section_id): Remove.
8400         (Garbage_collection::Section_id_hash): Remove.
8401         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8402         (Section_id): Remove.
8403         (Icf::Section_id_hash): Remove.
8404         * object.h (Section_id, Const_section_id, Section_id_hash,
8405         Const_section_id_hash): New type definitions.
8406         * output.cc (Output_section::add_relaxed_input_section): Change to
8407         use Const_section_id instead of Input_section_specifier as key type.
8408         (Output_section::add_merge_input_section): Ditto.
8409         (Output_section::build_relaxation_map): Change to use Section_id
8410         instead of Input_section_specifier as key type.
8411         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8412         Ditto.
8413         (Output_section::convert_input_sections_to_relaxed_sections): Change
8414         to use Const_section_id instead of Input_section_specifier as key type.
8415         (Output_section::find_merge_section): Ditto.
8416         (Output_section::find_relaxed_input_section): Ditto.
8417         * output.h (Input_section_specifier): Remove class.
8418         (Output_section::Output_section_data_by_input_section_map): Change
8419         key type to Const_section_id.
8420         (Output_section::Output_relaxed_input_section_by_input_section_map):
8421         Ditto.
8422         (Output_section::Relaxation_map): Change key type to Section_id.
8423
8424 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8425
8426         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8427         (class Arm_v4bx_stub): New class.
8428         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8429         (Stub_factory::make_arm_v4bx_stub): New method.
8430         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8431         (Stub_table::empty): Handle v4bx stubs.
8432         (Stub_table::add_arm_v4bx_stub): New method.
8433         (Stub_table::find_arm_v4bx_stub): New method.
8434         (Arm_relocate_functions::v4bx): New method.
8435         (Target_arm::fix_v4bx): New method.
8436         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8437         (Stub_table::relocate_stubs): Likewise.
8438         (Stub_table::do_write): Likewise.
8439         (Stub_table::update_data_size_and_addralign): Likewise.
8440         (Stub_table::finalize_stubs):  Likewise.
8441         (Target_arm::Scan::local): Likewise.
8442         (Target_arm::Scan::global): Likewise.
8443         (Target_arm::do_finalize_sections): Likewise.
8444         (Target_arm::Relocate::relocate): Likewise.
8445         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8446         Likewise.
8447         (Target_arm::scan_reloc_for_stub): Likewise.
8448         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8449
8450 2010-01-19  Ian Lance Taylor  <iant@google.com>
8451
8452         * output.cc (Output_section_headers::do_sized_write): Write large
8453         segment count to sh_info field.
8454         (Output_file_header::do_sized_write): For large segment count,
8455         write PN_XNUM to e_phnum field.
8456
8457 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8458
8459         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8460         (Arm_relocate_functions::thm_jump8): New function.
8461         (Arm_relocate_functions::thm_jump11): New function.
8462         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8463         R_ARM_THM_JUMP11.
8464         (Target_arm::Scan::global): Likewise.
8465         (Target_arm::Relocate::relocate): Likewise.
8466         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8467         Likewise.
8468
8469 2010-01-14  Doug Kwan  <dougkwan@google.com>
8470
8471         * arm.cc (map, utility): Include headers.
8472         (Target_arm::apply_cortex_a8_workaround): New method.
8473         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8474         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8475         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8476         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8477         the --[no-]fix-cortex-a8 command line options.
8478         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8479         (Target_arm::relocate_stub): Use addend in instruction template.
8480         * options.h (DEFINE_bool): Set the user-set flag.
8481         (General_options): Add --[no-]-fix-cortex options.
8482         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8483         : Update fast look-up map after conversion.
8484
8485 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8486
8487         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8488         in the first pass of do_layout.
8489
8490 2010-01-13  Doug Kwan  <dougkwan@google.com>
8491
8492         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8493         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8494         apparent compiler problem of not folding static constant integral
8495         data members of elfcpp::Elf_sizes<32>.
8496
8497 2010-01-13  Doug Kwan  <dougkwan@google.com>
8498
8499         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8500         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8501         Arm_relobj::scan_section_for_cortex_a8_erratum,
8502         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8503         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8504         sections to scan for relocation stubs into a new method
8505         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8506         relocation and Cortex-A8 stub scanning.
8507         (Target_arm::do_relax): Force stubs to be after stubbed sections
8508         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8509         the beginning of a new relaxation pass.  Update a comment.
8510         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8511
8512 2010-01-12  Ian Lance Taylor  <iant@google.com>
8513
8514         * target-reloc.h (visibility_error): New inline function.
8515         (relocate_section): Call visibility_error.
8516         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8517         (MOSTLYCLEANFILES): Likewise.
8518         (protected_4_pic.o, protected_3.err): New targets.
8519         * testsuite/protected_4.cc: New file.
8520
8521 2010-01-12  Doug Kwan  <dougkwan@google.com>
8522
8523         * arm.cc (Cortex_a8_reloc): New class.
8524         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8525         and cortex_a8_relocs_info_.
8526         (Target_arm::fix_cortex_a8): New method definition.
8527         (Target_arm::Cortex_a8_relocs_info): New type.
8528         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8529         New data member declarations.
8530         (Target_arm::scan_reloc_for_stub): Record information about
8531         relocations for THUMB branches that might be exempted from the
8532         Cortex-A8 workaround.
8533         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8534         at the beginning of a relaxation pass.
8535
8536 2010-01-12  Doug Kwan  <dougkwan@google.com>
8537
8538         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8539         (Arm_relobj::Mapping_symbol_position,
8540          Arm_reloj::Mapping_symbol_position_less,
8541          Arm_relobj::Mapping_symbols_info): New types.
8542         (Target_arm::is_mapping_symbol_name): New method definition.
8543         (Arm_relobj::do_count_local_symbols): Save information about mapping
8544         symbols.
8545
8546 2010-01-11  Doug Kwan  <dougkwan@google.com>
8547
8548         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8549         Arm_relocate_functions::thumb32_branch_upper,
8550         Arm_relocate_functions::thumb32_branch_lower,
8551         Arm_relocate_functions::thumb32_cond_branch_offset,
8552         Arm_relocate_functions::thumb32_cond_branch_upper,
8553         Arm_relocate_functions::thumb32_cond_branch_lower,
8554         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8555         branch offset encoding.
8556         (Arm_relocate_functions::thumb_branch_common): Use new branch
8557         offset encoding methods to avoid code duplication.
8558         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8559         (Stub_addend_reader::operator()): Use new branch encoding method
8560         to avoid code duplication.
8561
8562 2010-01-11  Doug Kwan  <dougkwan@google.com>
8563
8564         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8565         (Target_arm::do_finalize_sections): Define special EXIDX section
8566         symbols only if referenced.
8567         * gc.h (Garbage_collection::add_reference): New method.
8568         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8569         code duplication.
8570
8571 2010-01-11  Ian Lance Taylor  <iant@google.com>
8572
8573         * script.cc (Version_script_info::build_expression_list_lookup):
8574         Change complaing about duplicate wildcard match from error to
8575         warning.
8576
8577         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8578         of 2009-12-30.
8579         (Version_script_info::Version_script_info): Initialize globs_,
8580         default_version_, default_is_global_, and exact_.  Don't
8581         initialize globals_ or locals_.
8582         (Version_script_info::build_lookup_tables): Build local symbols
8583         first.
8584         (Version_script_info::unquote): New function.
8585         (Version_script_info::add_exact_match): New function.
8586         (Version_script_info::build_expression_list_lookup): Remove lookup
8587         parameter.  Add is_global parameter.  Change all callers.  Handle
8588         wildcard pattern specially.  Unquote pattern.  Call
8589         add_exact_match.
8590         (Version_script_info::get_name_to_match): New function.
8591         (Version_script_info::get_symbol_version): New function.
8592         (Version_script_info::get_symbol_version_helper): Remove.
8593         (Version_script_info::check_unmatched_names): Call unquote.
8594         * script.h (class Version_script_info): Change get_symbol_version
8595         to be non-inline and add is_global parameter; change all callers.
8596         Rewrite symbol_is_local.  Update declarations.  Define struct
8597         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8598         Remove globals_ and locals_ members.  Add exact_, globs_,
8599         default_version_, is_global_.
8600         (Version_script_info::Glob): Remove pattern, add expression and
8601         is_global.  Update constructor.  Change all callers.
8602         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8603         default version.
8604         (Versions::symbol_section_contents): If a symbol is undefined, or
8605         defined in a dynamic object, set the version index to
8606         VER_NDX_LOCAL.
8607         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8608         symbol_is_local.
8609         (Symbol_table::add_from_pluginobj): Likewise.
8610         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8611
8612 2010-01-11  Doug Kwan  <dougkwan@google.com>
8613
8614         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8615         (incremental_dump_LDADD): Add linking option for libintl.
8616         * Makefile.in: Regenerate.
8617
8618 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8619
8620         PR gold/11144
8621         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8622         instead of -Ds.
8623         * testsuite/Makefile.in: Regenerated.
8624
8625 2010-01-10  Doug Kwan  <dougkwan@google.com>
8626
8627         * options.h (DEFINE_var): Use parentheses around argument varname__
8628         in macro body to avoid any unintended subsequent substitutions.
8629
8630 2010-01-10  Ian Lance Taylor  <iant@google.com>
8631
8632         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8633         candidates before doing symbol resolution.
8634
8635         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8636         ODR candidates if only one is weak.
8637
8638 2010-01-08  Ian Lance Taylor  <iant@google.com>
8639
8640         * script.cc (Version_script_info::build_expression_list_lookup):
8641         Don't warn about ambiguous version, just record the ambiguity.
8642         (Version_script_info::get_symbol_version_helper): Give error if
8643         version is ambiguous.
8644
8645 2010-01-08  Doug Kwan  <dougkwan@google.com>
8646
8647         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8648         prev_data_size_ and prev_addralign_.  Remove initializer for
8649         deleted data member has_been_changed_.
8650         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8651         to determine if the table is empty.
8652         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8653         Remove.
8654         (Stub_table::add_reloc_stub): Define method in class definition
8655         instead of just declaring it there.
8656         (Stub_table::add_cortex_a8_stub): New method definition.
8657         (Stub_table::update_data_size_and_addralign): Ditto.
8658         (Stub_table::finalize_stubs): Ditto.
8659         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8660         (Stub_table::do_addralign_): Return address alignment in the
8661         (Stub_table::do_reset_address_and_file_offset): Define method in
8662         class definition instead of declaring it there.  Set current data
8663         size to be the data size of the previous pass.
8664         (Stub_table::set_final_data_size): Use current data size as the
8665         final data size.
8666         (Stub_table::relocate_stub): Change parameter type of stub from
8667         Reloc_stub pointer to Stub pointer.
8668         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8669         (Stub_table::Cortex_a8_stub_list): New typedef.
8670         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8671          Stub_table::prev_addralign_): New data member.
8672         (Arm_relobj::Arm_relobj): Initialize data member
8673         section_has_cortex_a8_workaround_.
8674         (Arm_relobj::section_has_cortex_a8_workaround,
8675          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8676          definitions.
8677         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8678         declarations.
8679         (Target_arm::relocate_stub): Change parameter type of stub from
8680         Reloc_stub pointer to Stub pointer.
8681         (Insn_template::size, Insn_template::alignment): Handle
8682         THUMB16_SPECIAL_TYPE.
8683         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8684          Stub_table::update_data_size_and_addralign,
8685          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8686         definitions.
8687         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8688         (Stub_table::do_write): Ditto.
8689         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8690
8691 2010-01-08  Ian Lance Taylor  <iant@google.com>
8692
8693         PR 11108
8694         * symtab.h (class Symbol): Remove fields is_target_special_ and
8695         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8696         (Symbol::is_defined_in_discarded_section): New function.
8697         (Symbol::set_is_defined_in_discarded_section): New function.
8698         (Symbol::has_plt_offset): Rewrite.
8699         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8700         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8701         Don't initialize is_target_special_ or has_plt_offset_.
8702         Initialize is_defined_in_discarded_section_.
8703         (Symbol_table::add_from_relobj): If appropriate, set
8704         is_defined_in_discarded_section.
8705         * resolve.cc (Symbol::override_base_with_special): Don't test
8706         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8707         * target-reloc.h (relocate_section): Do special handling for
8708         symbols defined in discarded sections for global symbols as well
8709         as local symbols.
8710
8711 2010-01-08  Ian Lance Taylor  <iant@google.com>
8712
8713         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8714         the SHT_SYMTAB case.
8715
8716 2010-01-08  Ian Lance Taylor  <iant@google.com>
8717
8718         * object.cc (Sized_relobj::do_layout): Don't get confused if
8719         layout_eh_frame returns NULL.
8720
8721 2010-01-08  Ian Lance Taylor  <iant@google.com>
8722
8723         PR 11084
8724         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8725         dynamic symbol table, use the normal symbol table.
8726         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8727         symbol table.
8728
8729 2010-01-08  Ian Lance Taylor  <iant@google.com>
8730
8731         PR 11072
8732         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8733         sections.
8734
8735 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8736
8737         * version.cc (print_version): Change to "Copyright 2010".
8738
8739 2010-01-08  Ian Lance Taylor  <iant@google.com>
8740
8741         PR 10287
8742         PR 11063
8743         * i386.cc (class Target_i386): Change return type of plt_section
8744         to be non-const.
8745         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8746         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8747         tls_desc_rel_ field.
8748         (Output_data_plt_i386::rel_tls_desc): New function.
8749         (Target_i386::rel_tls_desc_section): New function.
8750         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8751         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8752         R_386_TLS_DESC reloc in rel_tls_desc_section.
8753         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8754         Define struct Tlsdesc_info.
8755         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8756         (Target_x86_64::do_reloc_symbol_index): New function.
8757         (Target_x86_64::add_tlsdesc_info): New function.
8758         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8759         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8760         tlsdesc_rel_ field.
8761         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8762         all callers.
8763         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8764         (Target_x86_64::rela_tlsdesc_section): New function.
8765         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8766         handling.
8767         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8768         (Target_x86_64::do_reloc_addend): New function.
8769         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8770         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8771         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8772         (Output_reloc::type): New function.
8773         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8774         (Output_reloc::is_target_specific): New function.
8775         (Output_reloc::target_arg): New function.
8776         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8777         absolute relocs and target specific relocs.
8778         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8779         add_target_specific.
8780         (class Output_data_reloc) [SHT_RELA]: Likewise.
8781         * output.cc (Output_reloc::Output_reloc): Add four new versions
8782         for absolute relocs and target specific relocs.
8783         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8784         (Output_reloc::get_symbol_index): Likewise.
8785         (Output_reloc::local_section_offset): Check that local_sym_index_
8786         is not TARGET_CODE or 0.
8787         (Output_reloc::symbol_value): Likewise.
8788         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8789         reloc.
8790         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8791         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8792         functions.
8793         * layout.cc (add_target_dynamic_tags): Use output section for
8794         DT_PLTRELSZ and DT_JMPREL.
8795
8796 2010-01-07  Ian Lance Taylor  <iant@google.com>
8797
8798         PR 11061
8799         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8800         function.
8801         (class Output_data_reloc_generic): Define.
8802         (class Output_data_reloc_base): Change base class to
8803         Output_data_reloc_generic.  Change add() method to call
8804         bump_relative_reloc_count for a relative reloc.  Remove
8805         sort_relocs_ field.
8806         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8807         to sort_relocs().
8808         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8809         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8810         appropriate.
8811         * layout.h (class Layout): Update declaration.
8812
8813 2010-01-07  Ian Lance Taylor  <iant@google.com>
8814
8815         * output.h (class Output_data): Add const version of
8816         output_section and do_output_section.
8817         (class Output_section_data): Add const version of
8818         do_output_section.
8819         (class Output_section): Likewise.
8820         * layout.cc (Layout::add_target_dynamic_tags): New function.
8821         * layout.h (class Layout): Update declarations.
8822         * arm.cc (Target_arm::do_finalize_sections): Use
8823         add_target_dynamic_tags.
8824         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8825         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8826         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8827         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8828
8829 2010-01-07  Ian Lance Taylor  <iant@google.com>
8830
8831         PR 11042
8832         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8833         object as needed.
8834
8835 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8836             Ian Lance Taylor  <iant@google.com>
8837
8838         PR 11019
8839         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8840         Xindex::read_symtab_xindex.
8841
8842 2010-01-07  Doug Kwan  <dougkwan@google.com>
8843
8844         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8845         (Insn_template::thumb16_bcond_insn): New method declaration.
8846         (Insn_template): Fix spelling.
8847         (Stub::thumb16_special): New method declaration.
8848         (Stub::do_write): Define virtual method which was previously pure
8849         virtual.
8850         (Stub::do_thumb16_special): New method declaration.
8851         (Stub::do_fixed_endian_write): New template member.
8852         (Reloc_stub::do_write): Remove.
8853         (Reloc_stub::do_fixed_endian_write): Remove.
8854         (Cortex_a8_stub): New class definition.
8855         (Stub_factory::make_cortex_a8_stub): New method definition.
8856         (Stub_factory::Stub_factory): Add missing static storage class
8857         qualifier for elf32_arm_stub_a8_veneer_blx.
8858
8859 2010-01-07  Ian Lance Taylor  <iant@google.com>
8860
8861         PR 10980
8862         * options.h (class General_options): Add --warn-unresolved-symbols
8863         and --error-unresolved-symbols.
8864         * errors.cc (Errors::undefined_symbol): Implement
8865         --warn-unresolved-symbols.
8866
8867         * options.h (class General_options): Add -z text and -z textoff.
8868         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8869
8870 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8871
8872         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8873         (Garbage_collection::cident_sections): New function.
8874         (Garbage_collection::add_cident_section): New function.
8875         (Garbage_collection::cident_sections_): New member.
8876         (gc_process_relocs): Add references to sections whose names are C
8877         identifiers.
8878         * gold.h (cident_section_start_prefix): New constant.
8879         (cident_section_stop_prefix): New constant.
8880         (is_cident): New function.
8881         * layout.cc (Layout::define_section_symbols): Replace string constants
8882         with the newly defined constants.
8883         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8884         C identifiers.
8885         * testsuite/Makefile.am: Add gc_orphan_section_test.
8886         * testsuite/Makefile.in: Regenerate.
8887         * testsuite/gc_orphan_section_test.cc: New file.
8888         * testsuite/gc_orphan_section_test.sh: New file.
8889
8890 2010-01-06  Ian Lance Taylor  <iant@google.com>
8891
8892         PR 10980
8893         * options.h (class General_options): Add --warn-shared-textrel.
8894         * layout.cc (Layout::finish_dynamic_section): Implement
8895         --warn-shared-textrel.
8896
8897         PR 10980
8898         * options.h (class General_options): Add --warn-multiple-gp.
8899
8900 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8901
8902         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8903         $(THREADSLIB) and $(LIBDL).
8904         * Makefile.in: Rebuild.
8905
8906 2010-01-06  Ian Lance Taylor  <iant@google.com>
8907
8908         PR 10980
8909         * options.cc (General_options::parse_section_start): New function.
8910         (General_options::section_start): New function.
8911         (General_options::General_options): Initialize all members.
8912         * options.h: Include <map>
8913         (class General_options): Add --section-start.  Add section_starts_
8914         member.
8915         * layout.cc (Layout::attach_allocated_section_to_segment): If
8916         --section-start was used, set the address of the segment.  Remove
8917         local sort_sections.
8918         (Layout::relaxation_loop_body): If the address of the load segment
8919         has been set by --section-start, don't use it.
8920         * output.h (Output_segment::update_flags_for_output_section): New
8921         function.
8922         * output.cc (Output_segment::add_output_section): Call
8923         update_flags_for_output_section.
8924
8925 2010-01-05  Ian Lance Taylor  <iant@google.com>
8926
8927         PR 10980
8928         * options.h (class General_options): Add --undefined-version.
8929         * script.cc (struct Version_expression): Add was_matched_by_symbol
8930         field.
8931         (Version_script_info::matched_symbol): New function.
8932         (Version_script_info::get_symbol_version_helper): Call
8933         matched_symbol.
8934         (Version_script_info::check_unmatched_names): New function.
8935         * script.h (class Version_script_info): Update declarations.
8936         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8937
8938         * options.h (class General_options): Use DEFINE_bool_alias for
8939         allow_multiple_definition.
8940         * resolve.cc (Symbol_table::should_override): Don't test
8941         allow_multiple_definition.
8942
8943         PR 10980
8944         * options.h (class General_options): Add --cref.
8945         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8946         until after printing cref table.
8947         * cref.cc: Include "symtab.h".
8948         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8949         (Cref_table_compare::operator()): New function.
8950         (Cref_inputs::gather_cref): New function.
8951         (filecol): New static const.
8952         (Cref_inputs::print_cref): New function.
8953         (Cref::print_cref): New function.
8954         * cref.h: Include <cstdio>.
8955         (class Cref): Update declarations.
8956         * mapfile.h (Mapfile::file): New function.
8957         * object.h (class Object): Define Symbols.  Declare virtual
8958         do_get_global_symbols.
8959         (Object::get_global_symbols): New function.
8960         * object.cc (Input_objects::add_object): Pass object to cref_ if
8961         --cref.
8962         (Input_objects::archive_start): Likewise.
8963         (Input_objects::archive_stop): Likewise.
8964         (Input_objects::print_cref): New function.
8965         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8966         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8967         --cref.
8968         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8969         function.
8970         * plugin.h (class Sized_pluginobj): Update declarations.
8971
8972 2010-01-05  Ian Lance Taylor  <iant@google.com>
8973
8974         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8975         to is_default_version.  Rename insdef to insdefault.
8976         (Symbol_table::add_from_relobj): Rename def to is_default_version
8977         and local to is_forced_local.
8978         (Symbol_table::add_from_pluginobj): Likewise.
8979         (Symbol_table::add_from_dynobj): Likewise.
8980         (Symbol_table::define_special_symbol): Rename insdef to
8981         insdefault.
8982
8983 2010-01-04  Ian Lance Taylor  <iant@google.com>
8984
8985         PR 10980
8986         * options.h (class General_options): Add
8987         --allow-multiple-definition and -z muldefs.
8988         * resolve.cc (Symbol_table::should_override): Don't warn about a
8989         multiple symbol definition if --allow-multiple-definition or -z
8990         muldefs.
8991
8992         PR 10980
8993         * options.h (class General_options): Add --add-needed and
8994         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8995         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8996         error if --copy-dt-needed-entries aka --add-needed is used and
8997         would cause a change in behaviour.
8998
8999         PR 10980
9000         * options.h (class General_options): Add -G as a short version of
9001         --shared.  Add no-op options -assert, -g, and -i.
9002
9003 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9004
9005         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9006         check for .text or .gnu.linkonce.t sections.
9007         * icf.cc (Icf::find_identical_sections): Ditto.
9008         Change the detection for mangled function name within the section
9009         name.
9010         * icf.h (is_section_foldable_candidate): New function.
9011
9012 2009-12-30  Ian Lance Taylor  <iant@google.com>
9013
9014         PR 10980
9015         * options.h (class General_options): Permit two dashes with
9016         --retain-symbols-file.
9017
9018 2009-12-30  Ian Lance Taylor  <iant@google.com>
9019
9020         PR 10979
9021         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9022         don't put the file header and segment headers in the text
9023         segment.
9024
9025         PR 10979
9026         * common.cc (Sort_commons::operator()): Stabilize sort when both
9027         entries are NULL.
9028         (Symbol_table::do_allocate_commons_list): When allocating common
9029         symbols, skip a symbol which is no longer common.
9030         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9031         an object before checking its type.
9032         * testsuite/common_test_2.c: New file.
9033         * testsuite/common_test_3.c: New file.
9034         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9035         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9036         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9037         (common_test_2_pic.o, common_test_2.so): New targets.
9038         (common_test_3_pic.o, common_test_3.so): New targets.
9039         * testsuite/Makefile.in: Rebuild.
9040
9041         PR 10979
9042         * script.cc (read_input_script): If we see a new SECTIONS clause,
9043         and we have added an input section, give an error.
9044         * layout.h (class Layout): Add have_added_input_section function.
9045         Add have_added_input_section_ field.
9046         * layout.cc (Layout::Layout): Initialize
9047         have_added_input_section_.
9048         (Layout::layout): Set have_added_input_section_.
9049         (Layout::layout_eh_frame): Likewise.
9050
9051 2009-12-30  Ian Lance Taylor  <iant@google.com>
9052
9053         PR 10931
9054         * options.h (class General_options): Add --sort-common option.
9055         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9056         * common.cc (Sort_common): Add sort_order parameter to
9057         constructor.  Add sort_order_ field.
9058         (Sort_commons::operator): Check sort_order_.
9059         (Symbol_table::allocate_commons): Determine the sort order.
9060         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9061         Change all callers.
9062         (Symbol_table::do_allocate_commons_list): Likewise.
9063
9064 2009-12-30  Ian Lance Taylor  <iant@google.com>
9065
9066         PR 10916
9067         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9068         symbols from this object, don't change the visibility of an
9069         undefined symbol.
9070         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9071
9072 2009-12-30  Ian Lance Taylor  <iant@google.com>
9073
9074         PR 10861
9075         * script.h (class Version_script_info): Define Language enum.
9076         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9077         new fields globals_, locals_, and is_finalized_.
9078         * script.cc: Various formatting fixes.
9079         (class Parser_closure): Change language_stack_ from a vector of
9080         std::string to one of Version_script_info::Language.  Adjust all
9081         uses accordingly.
9082         (class Lazy_demangler): Remove.
9083         (struct Version_expression): Change language from std::string to
9084         Version_script_info::Language.
9085         (Version_script_info::Version_script_info): New function.
9086         (Version_script_info::~Version_script_info): Don't call clear.
9087         (Version_script_info::finalize): New function.
9088         (Version_script_info::build_lookup_tables): New function.
9089         (Version_script_info::build_expression_list_lookup): New
9090         function.
9091         (Version_script_info::get_symbol_version_helper): Rewrite to use
9092         lookup tables.
9093         (Version_script_info::print_expression_list): Adjust to use
9094         Version_script_info::Language.
9095         (script_push_lex_into_version_mode): Check that the version script
9096         has not been finalized.
9097         (version_script_push_lang): Change language string to
9098         Version_script_info::Language.
9099         * options.cc (Command_line::version_script): New function.
9100         * options.h (class General_options): Add finalize_dynamic_list
9101         function.  Change version_script from declaration to definition.
9102         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9103         * testsuite/version_script.map: Remove duplicate def of foo.
9104         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9105         version_script.map.
9106         * testsuite/Makefile.in: Rebuild.
9107
9108 2009-12-30  Ian Lance Taylor  <iant@google.com>
9109
9110         PR 10843
9111         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9112         if the input symbol index is 0, make the output symbol index 0.
9113
9114 2009-12-30  Ian Lance Taylor  <iant@google.com>
9115
9116         PR 10670
9117         * options.h (class General_options): Add -x/--discard-all.
9118         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9119         --discard-all.  If the local symbol needs a dynamic entry, check
9120         that before handling --discard-locals.
9121
9122 2009-12-30  Ian Lance Taylor  <iant@google.com>
9123
9124         PR 10450
9125         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9126         flags to PF_R.
9127         (Output_segment::add_output_section): Don't change the flags if
9128         the type is PT_TLS.
9129
9130         PR 10450
9131         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9132         GNU hash table if they need a dynamic value.  Otherwise, don't add
9133         them if they are defined in a dynamic object or are forced local.
9134
9135 2009-12-29  Ian Lance Taylor  <iant@google.com>
9136
9137         PR 10450
9138         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9139         .gnu.hash table for a 32-bit target.
9140
9141         PR 10450
9142         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9143         regular and a dynamic object only needs a dynamic symbol table
9144         entry if it is externally visible.
9145
9146         PR 10450
9147         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9148         constructor.  Add global_offset_table_ field.
9149         (Target_i386::got_section): Set global_offset_table_.
9150         (Target_i386::do_finalize_sections): Set global_offset_table_
9151         size.
9152         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9153         in constructor.  Add global_offset_table_ field.
9154         (Target_x86_64::got_section): Set global_offset_table_.
9155         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9156         size.
9157
9158         * layout.cc (Layout::Layout): Initialize increase_relro_.
9159         (Layout::get_output_section): Add is_relro, is_last_relro, and
9160         is_first_non_relro parameters.  Change all callers.
9161         (Layout::choose_output_section): Likewise.
9162         (Layout::add_output_section_data): Likewise.
9163         (Layout::make_output_section): Likewise.
9164         (Layout::set_segment_offsets): Clear increase_relro when using a
9165         linker script.
9166         * layout.h (class Layout): Add increase_relro method.  Add
9167         increase_relro_ field.  Update declarations.
9168         * output.cc (Output_section::Output_section): Initialize
9169         is_last_relro_ and is_first_non_relro_.
9170         (Output_segment::add_output_section): Group relro sections is
9171         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9172         (Output_segment::maximum_alignment): Remove relro handling.
9173         (Output_segment::set_section_addresses): Add increase_relro
9174         parameter.  Change all callers.  Add initial alignment to align
9175         relro sections on separate page.  Remove old relro handling.
9176         (Output_segment::set_section_list_addresses): Remove in_relro
9177         parameter.  Change all callers.
9178         (Output_segment::set_offset): Add increase parameter.  Change all
9179         callers.  Remove old relro handling.
9180         * output.h (class Output_section): Add new methods: is_last_relro,
9181         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9182         Add is_last_relro_ and is_first_non_relro_ fields.
9183         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9184         Create separate .got.plt section.  Call increase_relro.
9185         * x86_64.cc (Target_x86_64::got_section): Likewise.
9186         * testsuite/relro_script_test.t: Add .got.plt.
9187
9188         PR 10450
9189         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9190         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9191         (Layout::finalize): Call set_dynamic_symbol_size.
9192         (Layout::set_dynamic_symbol_size): New function.
9193         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9194         set_dynamic_symbol_size.
9195
9196         PR 10450
9197         * output.h (class Output_section): Add is_entsize_zero_ field.
9198         * output.cc (Output_section::Output_section): Initialize
9199         is_entsize_zero_.
9200         (Output_section::set_entsize): If two different entsizes are
9201         requested, force it to zero.
9202         (Output_section::add_input_section): Set flags for .debug_str
9203         before updating section flags.  Set entsize.
9204         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9205         and SHF_STRING if all input sections have those flags.
9206
9207 2009-12-29   Rafael Espindola  <espindola@google.com>
9208
9209         * main.cc (main): Fix the sys time reporting.
9210         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9211         reporting.
9212
9213 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9214
9215         * options.cc (General_options::parse_version): Allow -v to exit
9216         without an error if there is nothing to link.
9217
9218 2009-12-29  Ian Lance Taylor  <iant@google.com>
9219
9220         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9221         using a version of gcc before 4.1.
9222         * configure: Rebuild.
9223
9224 2009-12-28  Chris Demetriou  <cgd@google.com>
9225
9226         * attributes.cc (Output_attributes_section_data::do_write): Use
9227         std::vector::front rather than std::vector::data.
9228
9229 2009-12-28  Ian Lance Taylor  <iant@google.com>
9230
9231         * symtab.h (class Symbol_table): Add enum Defined.
9232         * resolve.cc (Symbol_table::should_override): Add defined
9233         parameter.  Change all callers.  Test whether object is NULL
9234         before calling a method on it.
9235         (Symbol_table::report_resolve_problem): Add defined parameter.
9236         Change all callers.
9237         (Symbol_table::should_override_with_special): Likewise.
9238         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9239         parameter.  Change all callers.
9240         (Symbol_table::do_define_in_output_data): Likewise.
9241         (Symbol_table::define_in_output_segment): Likewise.
9242         (Symbol_table::do_define_in_output_segment): Likewise.
9243         (Symbol_table::define_as_constant): Likewise.
9244         (Symbol_table::do_define_as_constant): Likewise.
9245         * script.h (class Symbol_assignment): Add is_defsym parameter to
9246         constructor; change all callers.
9247         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9248         parameter.  Change all callers.  Add is_defsym_ field.
9249         (class Parser_closure): Add parsing_defsym parameter to
9250         constructor; change all callers.  Add parsing_defsym accessor
9251         function.  Add parsing_defsym_ field.
9252
9253 2009-12-28  Ian Lance Taylor  <iant@google.com>
9254
9255         * gold.cc (queue_middle_tasks): Fix formatting.
9256         * object.cc (Relobj::is_section_name_included): Likewise.
9257
9258 2009-12-23  Ian Lance Taylor  <iant@google.com>
9259
9260         * i386.cc (Target_i386::do_calls_non_split): Recognize
9261         -fsplit-stack prologue for a function with a static chain.
9262         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9263         -fsplit-stack prologue when using %r11.
9264
9265 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9266
9267         * options.cc (General_options::parse_version): Make -v continue and do
9268         the link like GNU ld does.
9269
9270 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9271
9272         * Makefile.am (CCFILES): Add timer.cc.
9273         (HFILES): Add timer.h.
9274         * configure.ac: Check for sysconf and times.
9275         * main.cc: include timer.h.
9276         (main): Use Timer instead of get_run_time.
9277         * timer.cc: New.
9278         * timer.h: New.
9279         * workqueue.cc: include timer.h.
9280         (Workqueue::find_and_run_task):
9281         Report user, sys and wall time.
9282         * Makefile.in: Regenerate.
9283         * config.in: Regenerate.
9284         * configure: Regenerate.
9285
9286 2009-12-16  Doug Kwan  <dougkwan@google.com>
9287
9288         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9289         sections.
9290         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9291         relaxed input sections.
9292         * output.cc (Output_section::find_relaxed_input_section): Change
9293         return type to Output_relaxed_input_section pointer.  Adjust code
9294         for new type of relaxed_input_section_map_.
9295         * output.h (Output_section::find_relaxed_input_section): Change
9296         return type to Output_relaxed_input_section pointer.
9297         (Output_section::Output_relaxed_input_section_by_input_section_map):
9298         New type.
9299         (Output_section::relaxed_input_section_map_): Change type to
9300         Output_section::Output_relaxed_input_section_by_input_section_map.
9301         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9302         input section.
9303
9304 2009-12-15  Ian Lance Taylor  <iant@google.com>
9305
9306         * layout.cc (Layout::create_shstrtab): Only write out after input
9307         sections if we are compressing debug sections.
9308
9309 2009-12-15  Ian Lance Taylor  <iant@google.com>
9310
9311         * archive.cc (Archive::add_symbols): Only look up a symbol without
9312         a version if there is, in fact, a version.
9313
9314 2009-12-14  Ian Lance Taylor  <iant@google.com>
9315
9316         Revert -Wshadow changes, all changes from:
9317         2009-12-11  Doug Kwan  <dougkwan@google.com>
9318         2009-12-11  Nick Clifton  <nickc@redhat.com>
9319         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9320
9321 2009-12-11  Doug Kwan  <dougkwan@google.com>
9322
9323         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9324         due to -Wshadow.
9325         * attributes.cc (Object_attribute::size): Ditto.
9326         (Attributes_section_data::size): Ditto.
9327         (Attributes_section_data::Attributes_section_data): Ditto.
9328         (Output_attributes_section_data::do_write): Ditto.
9329         * attributes.h (Object_attribute::set_type): Ditto.
9330         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9331
9332 2009-12-11  Nick Clifton  <nickc@redhat.com>
9333
9334         * archive.cc: Fix shadowed variable warnings.
9335         * arm.cc: Likewise.
9336         * compressed_output.cc: Likewise.
9337         * compressed_output.h: Likewise.
9338         * configure: Likewise.
9339         * dwarf_reader.cc: Likewise.
9340         * dynobj.cc: Likewise.
9341         * dynobj.h: Likewise.
9342         * ehframe.cc: Likewise.
9343         * ehframe.h: Likewise.
9344         * errors.cc: Likewise.
9345         * expression.cc: Likewise.
9346         * fileread.cc: Likewise.
9347         * fileread.h: Likewise.
9348         * freebsd.h: Likewise.
9349         * i386.cc: Likewise.
9350         * icf.cc: Likewise.
9351         * incremental.h: Likewise.
9352         * layout.cc: Likewise.
9353         * layout.h: Likewise.
9354         * mapfile.cc: Likewise.
9355         * merge.cc: Likewise.
9356         * merge.h: Likewise.
9357         * object.cc: Likewise.
9358         * object.h: Likewise.
9359         * options.h: Likewise.
9360         * output.cc: Likewise.
9361         * output.h: Likewise.
9362         * parameters.cc: Likewise.
9363         * plugin.cc: Likewise.
9364         * powerpc.cc: Likewise.
9365         * reduced_debug_output.cc: Likewise.
9366         * reduced_debug_output.h: Likewise.
9367         * reloc.cc: Likewise.
9368         * reloc.h: Likewise.
9369         * resolve.cc: Likewise.
9370         * script-sections.cc: Likewise.
9371         * script.cc: Likewise.
9372         * script.h: Likewise.
9373         * sparc.cc: Likewise.
9374         * symtab.cc: Likewise.
9375         * symtab.h: Likewise.
9376         * target-select.cc: Likewise.
9377         * target-select.h: Likewise.
9378         * token.h: Likewise.
9379         * workqueue.cc: Likewise.
9380         * workqueue.h: Likewise.
9381         * x86_64.cc: Likewise.
9382
9383 2009-12-10  Doug Kwan  <dougkwan@google.com>
9384
9385         * arm.cc (attributes.h): New include.
9386         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9387         (Arm_relobj::~Arm_relobj): Delete object pointed by
9388         attributes_section_data_.
9389         (Arm_relobj::attributes_section_data): New method definition.
9390         (Arm_relobj::attributes_section_data_): New data member declaration.
9391         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9392         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9393         attributes_section_data_.
9394         (Arm_dynobj::attributes_section_data): New method definition.
9395         (Arm_dynobj::attributes_section_data_): New data member declaration.
9396         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9397         initialization value of may_use_blx_ to false.
9398         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9399         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9400         object attributes to compute results instead of hard-coding.
9401         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9402         Target_arm::get_secondary_compatible_arch,
9403         Target_arm::set_secondary_compatible_arch
9404         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9405         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9406         New method declarations.
9407         (Target_arm::get_aeabi_object_attribute): New method definition.
9408         (Target_arm::attributes_section_data_): New data member declaration.
9409         (read_arm_attributes_section): New template definition.
9410         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9411         (Arm_dynobj::do_read_symbols): Ditto.
9412         (Target_arm::do_finalize_sections): Merge attributes sections from
9413         input.  Check for BLX use after attributes section merging.
9414         Fix __exidx_start and __exidx_end visibility.  Create an
9415         .ARM.attributes section if necessary.
9416         (Target_arm::get_secondary_compatible_arch,
9417         Target_arm::set_secondary_compatible_arch,
9418         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9419         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9420         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9421         New method definitions.
9422
9423 2009-12-09  Ian Lance Taylor  <iant@google.com>
9424
9425         * plugin.cc (Plugin::load): Don't cast from void* to a function
9426         pointer.
9427
9428 2009-12-09  Ian Lance Taylor  <iant@google.com>
9429
9430         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9431         information fields.
9432
9433 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9434
9435         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9436         Replace two_file_shared_1.so with two_file_shared_2.so.
9437         * testsuite/Makefile.in: Regenerated.
9438
9439 2009-12-08  Doug Kwan  <dougkwan@google.com>
9440
9441         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9442         (HFILES): Add attributes.h and int_encoding.h.
9443         * Makefile.in: Regenerate.
9444         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9445         function definitions to int_encoding.cc
9446         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9447         prototypes to int_encoding.h
9448         * reduced_debug_output.cc (int_encoding.h): New include.
9449         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9450         function definitions to int_encoding.cc
9451         (insert_into_vector, read_from_pointer): Move template definitions to
9452         int_encoding.h
9453         * attributes.cc: New file.
9454         * attributes.h: New file.
9455         * int_encoding.cc: New file.
9456         * int_encoding.h: New file.
9457
9458 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9459
9460         PR gold/11055
9461         * incremental-dump.cc (dump_incremental_inputs): New.
9462         (main): Use dump_incremental_inputs.
9463
9464 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9465
9466         PR gold/10893
9467         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9468         checking elfcpp::STT_FUNC.
9469         (Target_i386::Relocate::relocate): Likewise.
9470         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9471
9472         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9473         symbols from shared libraries into normal FUNC symbols.
9474
9475         * symtab.h (Symbol): Add is_func and use it.
9476
9477 2009-12-05  Doug Kwan  <dougkwan@google.com>
9478
9479         * arm.cc (Target_arm::arm_info): Initialize new fields
9480         attributes_section and attributes_vendor.
9481         * i386.cc (Target_i386::i386_info): Same.
9482         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9483         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9484         fields attributes_section and attributes_vendor.
9485         * sparc.cc (Target_sparc::sparc_info): Same.
9486         * target.h (Target::attributes_section, Target::attributes_vendor,
9487         Target::is_attributes_section, Target::attribute_arg_type,
9488         Target::attributes_order): New method definitions.
9489         (Target::Target_info::attributes_section,
9490         Target::Target_info::attributes_vendor): New fields.
9491         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9492         virtual method definitions.
9493         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9494         attributes_section and attributes_vendor.
9495         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9496
9497 2009-12-05  Doug Kwan  <dougkwan@google.com>
9498
9499         * arm.cc: Update comments about interworking and stub generation.
9500         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9501         considered as non-PIC.
9502         (Arm_relocate_functions::base_abs): Fix formatting.
9503         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9504         of function to use GOT entry address instead of offset.
9505         (Target_arm::Scan::global): Issue an error if a symbol would need a
9506         PLT does not get one because it is untyped.  Remove code to create
9507         dynamic symbols for relative branches.
9508         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9509         takes unsigned integer instead of boolean.
9510
9511 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9512
9513         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9514         (two_file_test_LDADD): Likewise.
9515         (common_test_1_LDADD): Likewise.
9516         (exception_test_LDADD) Likewise.
9517         (weak_test_LDADD): Likewise.
9518         (many_sections_test_LDADD): Likewise.
9519         (initpri1_LDADD): Likewise.
9520         (script_test_1_LDADD): Likewise.
9521         (script_test_2_LDADD): Likewise.
9522         (justsyms_LDADD): Likewise.
9523         (binary_test_LDADD): Likewise.
9524         (large_LDADD): Likewise.
9525         * testsuite/Makefile.in: Regenerated.
9526
9527 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9528
9529         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9530         (Symbol_table::override_with_special): Likewise.
9531         (Symbol_table::add_from_object): Likewise.
9532
9533 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9534
9535         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9536         Don't set the data_offset twice.
9537
9538 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9539
9540         * testsuite/Makefile.in: Regenerate.
9541
9542 2009-12-03  Doug Kwan  <dougkwan@google.com>
9543
9544         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9545         (Target_arm::do_finalize_sections): Add parameter for symbol table
9546         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9547         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9548         parameter for symbol table pointer.
9549         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9550         an additional parameter for a pointer to symbol table.
9551         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9552         parameter for a symbol table pointer.
9553         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9554         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9555         Ditto.
9556         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9557         parameter for a symbol table pointer.
9558
9559 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9560
9561         * incremental.cc (Incremental_inputs_header)
9562         (Incremental_inputs_header_write, Incremental_inputs_entry)
9563         (Incremental_inputs_entry_write): Move ...
9564         * incremental.h (Incremental_inputs_header)
9565         (Incremental_inputs_header_write, Incremental_inputs_entry)
9566         (Incremental_inputs_entry_write): here.
9567
9568 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9569
9570         * incremental.cc (make_sized_incremental_binary): Set the target.
9571         Error if it is incompatible.
9572         * output.h (Output_file): Add filename method.
9573
9574 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9575
9576         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9577         from the get_* methods.
9578
9579 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9580
9581         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9582         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9583         Write 0 for the data_offset of scripts.
9584
9585 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9586
9587         * testsuite/Makefile.am: Add the incremental_test.sh test.
9588         * testsuite/incremental_test.sh: New.
9589         * testsuite/incremental_test_1.c: New.
9590         * testsuite/incremental_test_2.c: New.
9591
9592 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9593
9594         * incremental-dump.cc (main): Fix typos.
9595
9596 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9597
9598         PR gold/11025
9599         * incremental-dump.cc (main): Use llu to print 64 bit values.
9600
9601 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9602             H.J. Lu  <hongjiu.lu@intel.com>
9603
9604         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9605         $(LIBDL).
9606         (incremental_dump_LDADD): Likewise.
9607         * Makefile.in: Regenerated.
9608
9609 2009-11-25  Doug Kwan  <dougkwan@google.com>
9610
9611         Revert:
9612
9613         2009-11-25  Doug Kwan  <dougkwan@google.com>
9614
9615                 * arm.cc (Target_arm::Target_arm): Move method definition
9616                 outside of class definition.  Add code to handle
9617                 --target1-rel, --target1-abs and --target2= options.
9618                 (Target_arm::get_reloc_reloc_type): Change method to be
9619                 non-static and const.
9620                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9621                 New data member declaration.
9622                 (Target_arm::Scan::local, Target_arm::Scan::global,
9623                 Target_arm::Relocate::relocate,
9624                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9625                 Adjust call to Target_arm::get_real_reloc_type.
9626                 (Target_arm::get_real_reloc_type): Use command line options
9627                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9628                 * options.h (--target1-rel, --target1-abs, --target2): New
9629                 ARM-only options.
9630
9631 2009-11-25  Doug Kwan  <dougkwan@google.com>
9632
9633         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9634         class definition.  Add code to handle --target1-rel, --target1-abs
9635         and --target2= options.
9636         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9637         and const.
9638         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9639         member declaration.
9640         (Target_arm::Scan::local, Target_arm::Scan::global,
9641         Target_arm::Relocate::relocate,
9642         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9643         call to Target_arm::get_real_reloc_type.
9644         (Target_arm::get_real_reloc_type): Use command line options to
9645         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9646         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9647         options.
9648
9649 2009-11-25  Doug Kwan  <dougkwan@google.com>
9650
9651         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9652         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9653         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9654         formatting.
9655         (Arm_relocate_functions::thm_call): Replace body with a call to
9656         Arm_relocate_functions::thumb_branch_common.
9657         (Arm_relocate_functions::thm_jump24,
9658         Arm_relocate_functions::thm_xpc22): New method definitions.
9659         (Arm_relocate_functions::thumb_branch_common): New method definition.
9660         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9661         operator.
9662         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9663         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9664
9665 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9666
9667         * Makefile.am: Build incremental-dump
9668         * Makefile.in: Regenerate.
9669         * incremental-dump.cc: New.
9670         * incremental.cc (Incremental_inputs_header_data,
9671         Incremental_inputs_entry_data): Move to incremental.h
9672         * incremental.h: (Incremental_inputs_header_data,
9673         Incremental_inputs_entry_data): Move from incremental.cc
9674
9675 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9676
9677         * incremental.cc (Incremental_inputs_header,
9678         Incremental_inputs_header_write, Incremental_inputs_entry,
9679         Incremental_inputs_entry_write): Add a typedef with the data type.
9680
9681 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9682
9683         * incremental.cc (Incremental_inputs_header,
9684         Incremental_inputs_header_write, Incremental_inputs_entry,
9685         Incremental_inputs_entry_write): Update comment about which
9686         type has the filed descriptions.
9687
9688 2009-11-15  Doug Kwan  <dougkwan@google.com>
9689
9690         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9691         (Arm_relocate_functions::arm_branch_common): Change method defintion
9692         in class definition to a method declaration and update list of formal
9693         parameters.
9694         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9695         Arm_relocation_functions::jump24): Adjust call to
9696         Arm_relocate_functions::arm_branch_common.  Update list of formal
9697         parameters.
9698         (Arm_relocate_functions::xpc25): New method definition.
9699         (Arm_relocate_functions::arm_branch_common): Move method defintion
9700         out from class definition.  Use stubs for mode-switching and extending
9701         branch ranges.
9702         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9703         specially.  Change code to enable use of stubs in ARM branches.
9704
9705 2009-11-10  Doug Kwan  <dougkwan@google.com>
9706
9707         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9708         in method declaration.
9709         (Target_arm::relocate_stub): New method declaration.
9710         (Target_arm::default_target): Change to return a pointer instead of
9711         a const reference.
9712         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9713         Target_arm::default_target.
9714         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9715         method definition.
9716         (Target_arm::relocate_section): Adjust view.
9717         (Target_arm::relocate_stub): New method definition.
9718
9719 2009-11-10  Doug Kwan  <dougkwan@google.com>
9720
9721         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9722         a format warning.
9723         * incremental.cc (open_incremental_binary): Initialized local
9724         variables to avoid warnings.
9725         * object.cc (make_elf_object): Ditto.
9726         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9727         a format warning.
9728
9729 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9730
9731         PR gold/10930
9732         * testsuite/plugin_test.c: Include "config.h".
9733
9734 2009-11-09  Doug Kwan  <dougkwan@google.com>
9735
9736         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9737         (arm_symbol_value): Remove.
9738         (Arm_relocate_functions::arm_branch_common,
9739         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9740         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9741         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9742         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9743         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9744         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9745         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9746         Arm_relocate_functions::thm_mobw_abs_nc,
9747         Arm_relocate_functions::thm_mov_abs,
9748         Arm_relocate_functions::movw_prel_nc,
9749         Arm_relocate_functions::thm_movt_abs,
9750         Arm_relocate_functions::movt_prel,
9751         Arm_relocate_functions::thm_movw_prel_nc,
9752         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9753         (Target_arm::Relocate::relocate): Only decompose address into two
9754         parts if relocation type uses the thumb-bit and pass the actual
9755         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9756         calls to methods in Arm_relocate_functions for this change.
9757
9758 2009-11-08  Ian Lance Taylor  <iant@google.com>
9759
9760         PR 10925
9761         * reloc.cc: Instantiate
9762         Sized_relobj::initialize_input_to_output_maps and
9763         Sized_relobj:free_input_to_output_maps.
9764
9765 2009-11-06  Ian Lance Taylor  <iant@google.com>
9766
9767         PR 10876
9768         * defstd.cc (in_segment): Set only_if_ref true for "end".
9769
9770 2009-11-06  Doug Kwan  <dougkwan@google.com>
9771
9772         * arm.cc (class Reloc_stub): Correct a comment.
9773         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9774         (Target_arm::scan_section_for_stubs): New method declaration.
9775         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9776         Change methods from private to protected.
9777         (Target_arm::do_may_relax): New method definition.
9778         (Target_arm::do_relax, Target_arm::group_sections,
9779         Target_arm::scan_reloc_for_stub,
9780         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9781         (Target_arm::arm_input_section_map_): New data member declaration.
9782         (Target_arm::scan_reloc_for_stub,
9783         Target_arm::scan_reloc_section_for_stubs,
9784         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9785         Target_arm::do_relax): New method definitions.
9786
9787 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9788
9789         * configure.ac: Check for (struct stat)::st_mtim
9790         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9791         * config.in: Regenerate.
9792         * configure: Regenerate.
9793
9794 2009-11-05  Ian Lance Taylor  <iant@google.com>
9795
9796         PR 10910
9797         * output.cc (Output_segment::add_output_section): Add missing
9798         return statement.
9799
9800 2009-11-04  Ian Lance Taylor  <iant@google.com>
9801
9802         PR 10880
9803         * object.h (class Object): Add is_needed and set_is_needed
9804         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9805         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9806         defined in a dynamic object and referenced by a regular object,
9807         set is_needed for the dynamic object.
9808         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9809         if the file is marked with as_needed and it is not needed.
9810
9811 2009-11-04  Ian Lance Taylor  <iant@google.com>
9812
9813         PR 10887
9814         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9815         tags if data is discarded by linker script.
9816         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9817         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9818         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9819         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9820
9821 2009-11-04  Ian Lance Taylor  <iant@google.com>
9822
9823         * layout.cc (Layout::get_output_section): Add is_interp and
9824         is_dynamic_linker_section parameters.  Change all callers.
9825         (Layout::choose_output_section): Likewise.
9826         (Layout::make_output_section): Likewise.
9827         (Layout::add_output_section_data): Add is_dynamic_linker_section
9828         parameter.  Change all callers.
9829         * layout.h (class Layout): Update declarations.
9830         * output.h (class Output_section): Add is_interp, set_is_interp,
9831         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9832         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9833         generate_code_fills_at_write_ to a bitfield.
9834         * output.cc (Output_section::Output_sections): Initialize new
9835         fields.
9836         (Output_segment::add_output_section): Add do_sort parameter.
9837         Change all callers.
9838
9839 2009-11-03  Ian Lance Taylor  <iant@google.com>
9840
9841         PR 10860
9842         * options.h (class General_options): Add --warn-common.
9843         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9844         merging two common symbols.
9845         (Symbol_table::should_override): Handle --warn-common when merging
9846         a common symbol with a defined symbol.  Use report_resolve_problem
9847         for multiple definitions.
9848         (Symbol_table::report_resolve_problem): New function.
9849         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9850
9851 2009-11-03  Doug Kwan  <dougkwan@google.com>
9852
9853         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9854         stub_factory_.
9855         (Target_arm::stub_factory): New method definition.
9856         (Target_arm::new_arm_input_section,
9857         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9858         Target_arm::reloc_uses_thumb_bit): New method declarations.
9859         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9860         New type definitions.
9861         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9862         member declarations.
9863         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9864         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9865         New method definitions.
9866
9867 2009-11-03  Ian Lance Taylor  <iant@google.com>
9868
9869         * options.h (class General_options): Add --warn_constructors.
9870
9871 2009-11-03  Ian Lance Taylor  <iant@google.com>
9872
9873         PR 10893
9874         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9875         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9876
9877 2009-11-03  Ian Lance Taylor  <iant@google.com>
9878
9879         PR 10895
9880         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9881         --msgid-bugs-address.
9882         (install-pdf): New target.
9883         (install-data_yes): Look up one directory to find mkinstalldirs.
9884
9885 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9886
9887         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9888         tree.
9889
9890 2009-10-30  Doug Kwan  <dougkwan@google.com>
9891
9892         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9893
9894 2009-10-30  Doug Kwan  <dougkwan@google.com>
9895
9896         * arm.cc (Stub_addend_reader): New struct template definition
9897         and partial specializations.
9898         (Stub_addend_reader::operator()): New method definition for a
9899         partially specialized template.
9900
9901 2009-10-30  Doug Kwan  <dougkwan@google.com>
9902
9903         * arm.cc (Arm_relobj::processor_specific_flags): New method
9904         definition.
9905         (Arm_relobj::do_read_symbols): New method declaration.
9906         (Arm_relobj::processor_specific_flags_): New data member declaration.
9907         (Arm_dynobj): New class definition.
9908         (Target_arm::do_finalize_sections): Add input_objects parameter.
9909         (Target_arm::do_adjust_elf_header): New method declaration.
9910         (Target_arm::are_eabi_versions_compatible,
9911         (Target_arm::merge_processor_specific_flags): New method declaration.
9912         (Target_arm::do_make_elf_object): New overloaded method definitions
9913         and declaration.
9914         (Arm_relobj::do_read_symbols): New method definition.
9915         (Arm_dynobj::do_read_symbols): Ditto.
9916         (Target_arm::do_finalize_sections): Add input_objects parameters.
9917         Merge processor-specific flags from all input objects.
9918         (Target_arm::are_eabi_versions_compatible,
9919         Target_arm::merge_processor_specific_flags,
9920         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9921         New method definitions.
9922         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9923         Input_objects pointer type parameter.
9924         * layout.cc (Layout::finalize): Pass input objects to target's.
9925         finalize_sections function.
9926         * output.cc (Output_file_header::do_sized_write): Set ELF file
9927         header's processor-specific flags.
9928         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9929         Input_objects pointer type parameter.
9930         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9931         * target.h (Input_objects): New forward class declaration.
9932         (Target::processor_specific_flags,
9933         Target::are_processor_specific_flags_sect): New method definitions.
9934         (Target::finalize_sections): Add input_objects parameter.
9935         (Target::Target): Initialize processor_specific_flags_ and
9936         are_processor_specific_flags_set_.
9937         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9938         parameter.
9939         (Target::set_processor_specific_flags): New method definition.
9940         (Target::processor_specific_flags_,
9941         Target::are_processor_specific_flags_set_): New data member
9942         declarations.
9943         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9944         Input_objects pointer type parameter.
9945
9946 2009-10-30  Doug Kwan  <dougkwan@google.com>
9947
9948         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9949
9950 2009-10-28  Ian Lance Taylor  <iant@google.com>
9951
9952         * object.h (class Relobj): Drop options parameter from
9953         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9954         do_scan_relocs, do_relocate.  Change all callers.
9955         (class Sized_relobj): Drop options parameters from
9956         do_gc_process_relocs, do_scan_relocs, do_relocate,
9957         do_relocate_sections, relocate_sections, emit_relocs_scan,
9958         emit_relocs_scan_reltype.  Change all callers.
9959         (struct Relocate_info): Remove options field and all references to
9960         it.
9961         * reloc.h (class Read_relocs): Remove options constructor
9962         parameter and options_ field.  Change all callers.
9963         (class Gc_process_relocs, class Scan_relocs): Likewise.
9964         (class Relocate_task): Likewise.
9965         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9966         all callers.
9967         (scan_relocatable_relocs): Likewise.
9968         * target.h (class Sized_target): Remove options parameter from
9969         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9970         all callers.
9971         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9972         callers.
9973         * arm.cc: Update functions to remove options parameters.
9974         * i386.cc: Likewise.
9975         * powerpc.cc: Likewise.
9976         * sparc.cc: Likewise.
9977         * x86_64.cc: Likewise.
9978         * testsuite/testfile.cc: Likewise.
9979
9980 2009-10-28  Doug Kwan  <dougkwan@google.com>
9981
9982         * arm.cc (Arm_relobj): New class definition.
9983         (Arm_relobj::scan_sections_for_stubs,
9984         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9985         New method definitions.
9986
9987 2009-10-28  Cary Coutant  <ccoutant@google.com>
9988
9989         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9990         (Plugin::cleanup_done_): New member.
9991         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9992         (Plugin_manager::cleanup_done_): Remove.
9993         (Plugin_manager::add_input_file): Edit error message.
9994         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9995         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9996
9997 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9998
9999         * fileread.cc: (File_read::View::~View): Use the new
10000         data_ownership_ filed.
10001         (File_read::~File_read): Dispose the new whole_file_view_.
10002         (File_read::open): Mmap the whole file if needed.
10003         (File_read::open): Use whole_file_view_ instead of contents_.
10004         (File_read::find_view): Use whole_file_view_ if applicable.
10005         (File_read::do_read): Use whole_file_view_ instead of contents_.
10006         (File_read::make_view): Use whole_file_view_ instead of contents_,
10007         update File_read::View::View call.
10008         (File_read::find_or_make_view): Update File_read::View::View
10009         call.
10010         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10011         remove contents_
10012         (File_read::View::Data_ownership): New enum.
10013         (File_read::View::View): Replace bool mapped_ with Data_ownership
10014         argument.
10015         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10016         (File_read::View::data_ownership_): New field.
10017         (File_read::contents_): Remove (replaced by whole_file_view_).
10018         (File_read::whole_file_view_): New field.
10019         * options.h (class General_options): Add --keep-files-mapped.
10020
10021 2009-10-27  Cary Coutant  <ccoutant@google.com>
10022
10023         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10024         * testsuite/Makefile.am (plugin_test_5): New test case.
10025         * testsuite/Makefile.in: Regenerate.
10026
10027 2009-10-25  Doug Kwan  <dougkwan@google.com>
10028
10029         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10030         from private to protected to allow access by child class.
10031         (Sized_relobj::do_relocate_sections): New method declaration.
10032         (Sized_relobj::relocate_sections): Virtualize.
10033         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10034         Sized_relobj::relocate_sections.  Instantiate template explicitly
10035         for different target sizes and endianity.
10036
10037 2009-10-24  Doug Kwan  <dougkwan@google.com>
10038
10039         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10040         (Arm_input_section::as_arm_input_section): New method.
10041         (Arm_output_section): New class definition.
10042         (Arm_output_section::create_stub_group,
10043         Arm_output_section::group_sections): New method definitions.
10044
10045 2009-10-22  Doug Kwan  <dougkwan@google.com>
10046
10047         * arm.cc (Arm_input_section): New class definition.
10048         (Arm_input_section::init, Arm_input_section:do_write,
10049         Arm_input_section::set_final_data_size,
10050         Arm_input_section::do_reset_address_and_file_offset): New method
10051         definitions.
10052
10053 2009-10-21  Doug Kwan  <dougkwan@google.com>
10054
10055         * arm.cc (Stub_table, Arm_input_section): New forward class
10056         declarations.
10057         (Stub_table): New class defintion.
10058         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10059         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10060         New method definition.
10061
10062 2009-10-21  Doug Kwan  <dougkwan@google.com>
10063
10064         * arm.cc: Update copyright comments.
10065         (Target_arm): New forward class template declaration.
10066         (Arm_address): New type.
10067         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10068         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10069         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10070         constants.
10071         (Insn_template): Same.
10072         (DEF_STUBS): New macro.
10073         (Stub_type): New enum type.
10074         (Stub_template): New class definition.
10075         (Stub): Same.
10076         (Reloc_stub): Same.
10077         (Stub_factory): Same.
10078         (Target_arm::Target_arm): Initialize may_use_blx_ and
10079         should_force_pic_veneer_.
10080         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10081         Target_arm::should_force_pic_veneer,
10082         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10083         Target_arm::using_thumb_only, Target_arm:;default_target): New
10084         method defintions.
10085         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10086         New data member declarations.
10087         (Insn_template::size, Insn_template::alignment): New method defintions.
10088         (Stub_template::Stub_template): New method definition.
10089         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10090         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10091         (Stub_factory::Stub_factory): New method definition.
10092         * gold.h (string_hash): New template.
10093         * output.h (Input_section_specifier::hash_value): Use
10094         gold::string_hash.
10095         (Input_section_specifier::string_hash): Remove.
10096         * stringpool.cc (Stringpool_template::string_hash): Use
10097         gold::string_hash.
10098
10099 2009-10-20  Doug Kwan  <dougkwan@google.com>
10100
10101         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10102         symbols of relaxed input sections.
10103         * output.h (Output_section::find_relaxed_input_section): Make
10104         method public.
10105
10106 2009-10-16  Doug Kwan  <dougkwan@google.com>
10107
10108         * dynobj.cc (Versions::Versions): Initialize version_script_.
10109         Only insert base version symbol definition for a shared object
10110         if version script defines any version versions.
10111         (Versions::define_base_version): New method definition.
10112         (Versions::add_def): Check that base version is not needed.
10113         (Versions::add_need): Define base version lazily.
10114         * dynobj.h (Versions::define_base_version): New method declaration.
10115         (Versions::needs_base_version_): New data member declaration.
10116         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10117         (check_DATA): Add no_version_test.stdout.
10118         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10119         New make rules.
10120         * testsuite/Makefile.in: Regenerate.
10121         * testsuite/no_version_test.c: New file.
10122         * testsuite/no_version_test.sh: Ditto.
10123
10124 2009-10-16  Doug Kwan  <dougkwan@google.com>
10125
10126         * expression.cc (class Segment_start_expression): New class definition.
10127         (Segment_start_expression::value): New method definition.
10128         (script_exp_function_segment_start): Return a new
10129         Segment_start_expression.
10130         * gold/script-c.h (script_saw_segment_start_expression): New function
10131         prototype.
10132         * script-sections.cc (Script_sections::Script_sections): Initialize
10133         SAW_SEGMENT_START_EXPRESSION_ to false.
10134         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10135         and -Tbbs options to specify section addresses if given in
10136         command line and no SEGMENT_START expression is seen in a script.
10137         * script-sections.h (Script_sections::saw_segment_start_expression,
10138         Script_sections::set_saw_segment_start_expression): New method
10139         definition.
10140         (Script_sections::saw_segment_start_expression_): New data member
10141         declaration.
10142         * script.cc (script_saw_segment_start_expression): New function.
10143         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10144         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10145         script_test_7.sh and script_test_8.sh.
10146         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10147         script_test_8.stdout.
10148         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10149         (script_test_6, script_test_6.stdout, script_test_7,
10150         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10151         * Makefile.in: Regenerate.
10152         * testsuite/script_test_6.sh: New file.
10153         * testsuite/script_test_6.t: Same.
10154         * testsuite/script_test_7.sh: Same.
10155         * testsuite/script_test_7.t: Same.
10156         * testsuite/script_test_8.sh: Same.
10157
10158 2009-10-16  Doug Kwan  <dougkwan@google.com>
10159
10160         * output.cc (Output_segment::set_section_list_address): Cast
10161         expressions to unsigned long long type to avoid format warnings.
10162
10163 2009-10-15  Ian Lance Taylor  <iant@google.com>
10164
10165         * script.cc (Script_options::add_symbol_assignment): Always add a
10166         dot assignment to script_sections_.
10167         * script-sections.cc (Script_sections::add_dot_assignment):
10168         Initialize if necessary.
10169
10170         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10171         program headers with no load segment if there is a linker script.
10172
10173         * layout.cc (Layout::set_segment_offsets): Align the file offset
10174         to the segment aligment for -N or -n with no load segment.
10175         * output.cc (Output_segment::add_output_section): Don't crash if
10176         the first section is a TLS section.
10177         (Output_segment::set_section_list_addresses): Print an error
10178         message if the address moves backward in a linker script.
10179         * script-sections.cc
10180         (Output_section_element_input::set_section_addresses): Don't
10181         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10182         (Orphan_output_section::set_section_addresses): Likewise.
10183
10184 2009-10-15  Doug Kwan  <dougkwan@google.com>
10185
10186         * layout.cc (Layout::finish_dynamic_section): Generate tags
10187         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10188         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10189         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10190
10191 2009-10-14  Ian Lance Taylor  <iant@google.com>
10192
10193         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10194         fields.
10195         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10196         data_shdr fields of relinfo.
10197         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10198         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10199         R_386_TLS_LDO_32, adjust based on section flags.
10200         (Target_i386::Relocate::fix_up_ldo): Remove.
10201
10202 2009-10-13  Ian Lance Taylor  <iant@google.com>
10203
10204         Add support for -pie.
10205         * options.h (class General_options): Add -pie and
10206         --pic-executable.
10207         (General_options::output_is_position_independent): Test -pie.
10208         (General_options::output_is_executable): Return true if not shared
10209         and not relocatable.
10210         (General_options::output_is_pie): Remove.
10211         * options.cc (General_options::finalize): Reject incompatible uses
10212         of -pie.
10213         * gold.cc (queue_middle_tasks): A -pie link is not static.
10214         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10215         * symtab.cc (Symbol::final_value_is_known): Return false if
10216         output_is_position_independent.
10217         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10218         output_is_position_independent.
10219         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10220         output_is_position_independent.
10221         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10222         output_is_position_independent.
10223         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10224         two_file_pie_test.
10225         (basic_pie_test.o, basic_pie_test): New targets.
10226         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10227         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10228         (two_file_pie_test): New target.
10229         * testsuite/Makefile.in: Rebuild.
10230         * README: Remove note saying that -pie is not supported.
10231
10232 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10233
10234         * options.h (class General_options): Add -init and -fini.
10235         * layout.cc (Layout::finish_dynamic_section): Emit
10236         given init and fini functions.
10237
10238 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10239
10240         * gc.h (gc_process_relocs): Check if icf is enabled using new
10241         function.
10242         * gold.cc (queue_initial_tasks): Likewise.
10243         (queue_middle_tasks): Likewise.
10244         * object.cc (do_layout): Likewise.
10245         * symtab.cc (is_section_folded): Likewise.
10246         * main.cc (main): Likewise.
10247         * reloc.cc (Read_relocs::run): Likewise.
10248         (Sized_relobj::do_scan_relocs): Likewise.
10249         * icf.cc (is_function_ctor_or_dtor): New function.
10250         (Icf::find_identical_sections): Check if function is ctor or dtor when
10251         safe icf is chosen.
10252         * options.h (General_options::icf): Change option to be an enum.
10253         (Icf_status): New enum.
10254         (icf_enabled): New method.
10255         (icf_safe_folding): New method.
10256         (set_icf_status): New method.
10257         (icf_status_): New variable.
10258         * (options.cc) (General_options::finalize): Set icf_status_.
10259         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10260         icf_test and icf_keep_unique_test to use the --icf enum flag.
10261         * testsuite/icf_safe_test.sh: New file.
10262         * testsuite/icf_safe_test.cc: New file.
10263
10264 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10265
10266         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10267         includes to gc.h and icf.h.
10268         * arm.cc: Include gc.h.
10269         * gold.cc: Likewise.
10270         * i386.cc: Likewise.
10271         * powerpc.cc: Likewise.
10272         * sparc.cc: Likewise.
10273         * x86_64.cc: Likewise.
10274         * gc.h: Include icf.h.
10275
10276 2009-10-11  Ian Lance Taylor  <iant@google.com>
10277
10278         * plugin.cc: Include "gold.h" before other header files.
10279
10280 2009-10-10  Chris Demetriou  <cgd@google.com>
10281
10282         * options.h (Input_file_argument::Input_file_type): New enum.
10283         (Input_file_argument::is_lib_): Replace with...
10284         (Input_file_argument::type_): New member.
10285         (Input_file_argument::Input_file_argument): Take Input_file_type
10286         'type' rather than boolean 'is_lib' as second argument.
10287         (Input_file_argument::is_lib): Use type_.
10288         (Input_file_argument::is_searched_file): New function.
10289         (Input_file_argument::may_need_search): Handle is_searched_file.
10290         * options.cc (General_options::parse_library): Support -l:filename.
10291         (General_options::parse_just_symbols): Update for Input_file_argument
10292         changes.
10293         (Command_line::process): Likewise.
10294         * archive.cc (Archive::get_file_and_offset): Likewise.
10295         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10296         * script.cc (read_script_file, script_add_file): Likewise.
10297         * fileread.cc (Input_file::Input_file): Likewise.
10298         (Input_file::will_search_for): Handle is_searched_file.
10299         (Input_file::open): Likewise.
10300         * readsyms.cc (Read_symbols::get_name): Likewise.
10301         * testsuite/Makefile.am (searched_file_test): New test.
10302         * testsuite/Makefile.in: Regenerate.
10303         * testsuite/searched_file_test.cc: New file.
10304         * testsuite/searched_file_test_lib.cc: New file.
10305
10306 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10307             Ian Lance Taylor  <iant@google.com>
10308
10309         * descriptor.cc: Include <cstdio> and "binary-io.h".
10310         (Descriptors::open): Open the files in binary mode always.
10311         * script.cc (Lex::get_token): Treat \r as whitespace.
10312
10313 2009-10-09  Ian Lance Taylor  <iant@google.com>
10314
10315         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10316
10317 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10318             Ian Lance Taylor  <iant@google.com>
10319
10320         * configure.ac: Check for readv function also.
10321         * fileread.cc (readv): Define if not HAVE_READV.
10322         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10323         does not exist.
10324         * config.in: Regenerate.
10325         * configure: Regenerate.
10326
10327 2009-10-09  Doug Kwan  <dougkwan@google.com>
10328
10329         * layout.cc (Layout::make_output_section): Call target hook to make
10330         ordinary output section.
10331         (Layout::finalize): Adjust parameter list of call the
10332         Target::may_relax().
10333         * layout.h (class Layout::section_list): New method.
10334         * merge.h (Output_merge_base::entsize): Change visibility to public.
10335         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10336         New methods.
10337         (Output_merge_string::do_is_string): New method.
10338         * object.cc (Sized_relobj::do_setup): renamed from
10339         Sized_relobj::set_up.
10340         * object.h (Sized_relobj::adjust_shndx,
10341         Sized_relobj::initializ_input_to_output_maps,
10342         Sized_relobj::free_input_to_output_maps): Change visibilities to
10343         protected.
10344         (Sized_relobj::setup): Virtualize.
10345         (Sized_relobj::do_setup): New method declaration.
10346         (Sized_relobj::invalidate_section_offset,
10347         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10348         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10349         * options.cc (parse_int): New function.
10350         * options.h (parse_int): New declaration.
10351         (DEFINE_int): New macro.
10352         (stub_group_size): New option.
10353         * output.cc (Output_section::Output_section): Initialize memebers
10354         merge_section_map_, merge_section_by_properties_map_,
10355         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10356         (Output_section::add_input_section): Handled deferred code-fill
10357         generation and remove an old comment.
10358         (Output_section::add_relaxed_input_section): New method definition.
10359         (Output_section::add_merge_input_section): Use merge section by
10360         properties map to speed to search.  Update merge section maps
10361         as appropriate.
10362         (Output_section::build_relaxation_map): New method definition.
10363         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10364         Same.
10365         (Output_section::relax_input_section): Renamed to
10366         Output_section::convert_input_sections_to_relaxed_sections and change
10367         interface to take a vector of pointers to relaxed sections.
10368         (Output_section::find_merge_section,
10369         Output_section::find_relaxed_input_section): New method definitions.
10370         (Output_section::is_input_address_mapped,
10371         Output_section::output_offset, Output_section::output_address):
10372         Use output section data maps to speed up searching.
10373         (Output_section::find_starting_output_address): Add comments.
10374         (Output_section::do_write,
10375         Output_section::write_to_postprocessing_buffer): Do code-fill
10376         generation as appropriate.
10377         (Output_section::get_input_sections): Invalidate relaxed input section
10378         map.
10379         (Output_section::restore_states): Adjust type of checkpoint .
10380         Invalidate relaxed input section map.
10381         * output.h (Output_merge_base): New class declaration.
10382         (Input_section_specifier): New class defintion.
10383         (class Output_relaxed_input_section) Change base class to
10384         Output_section_data_build.
10385         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10386         base class initializer.
10387         (Output_section::add_relaxed_input_section): New method declaration.
10388         (Output_section::Input_section): Change visibility to protected.
10389         (Output_section::Input_section::relobj,
10390         Output_section::Input_section::shndx): Handle relaxed input sections.
10391         Output_section::input_sections) Change visibility to protected.  Also
10392         define overload to return a non-const pointer.
10393         (Output_section::Merge_section_properties): New class defintion.
10394         (Output_section::Merge_section_by_properties_map,
10395         Output_section::Output_section_data_by_input_section_map,
10396         Output_section::Relaxation_map): New types.
10397         (Output_section::relax_input_section): Rename method to
10398         Output_section::convert_input_sections_to_relaxed_sections and change
10399         interface to take a vector of relaxed section pointers.
10400         (Output_section::find_merge_section,
10401         Output_section::find_relaxed_input_section,
10402         Output_section::build_relaxation_map,
10403         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10404         New method declarations.
10405         (Output_section::merge_section_map_
10406         Output_section::merge_section_by_properties_map_,
10407         Output_section::relaxed_input_section_map_,
10408         Output_section::is_relaxed_input_section_map_valid_,
10409         Output_section::generate_code_fills_at_write_): New data members.
10410         * script-sections.cc
10411         (Output_section_element_input::set_section_addresses): Call
10412         current_data_size and addralign methods of relaxed input sections.
10413         (Orphan_output_section::set_section_addresses): Call current_data_size
10414         and addralign methods of relaxed input sections.
10415         * symtab.cc (Symbol_table::compute_final_value): Extract template
10416         from the body of Symbol_table::sized_finalize_symbol.
10417         (Symbol_table::sized_finalized_symbol): Call
10418         Symbol_table::compute_final_value.
10419         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10420         (Symbol_table::compute_final_value): New templated method declaration.
10421         * target.cc (Target::do_make_output_section): New method defintion.
10422         * target.h (Target::make_output_section): New method declaration.
10423         (Target::relax): Add more parameters for input objects, symbol table
10424         and layout.  Adjust call to do_relax.
10425         (Target::do_make_output_section): New method declaration.
10426         (Target::do_relax): Add parameters for input objects, symbol table
10427         and layout.
10428
10429 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10430
10431         * pread.c: Include stdio.h.
10432
10433 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10434
10435         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10436         defined.
10437
10438 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10439
10440         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10441         Change read_shndx type to unsigned int.
10442         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10443         int.
10444         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10445         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10446         Change read_shndx type to unsigned int.
10447         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10448         int.
10449         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10450         * layout.cc (Layout::create_symtab_sections): Cast the result of
10451         local_symcount * symsize to off_t in the gold_assert.
10452
10453 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10454
10455         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10456         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10457         R_ARM_BASE_ABS.
10458         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10459         (Arm_relocate_functions::thm_abs5): New function.
10460         (Arm_relocate_functions::abs12): New function.
10461         (Arm_relocate_functions::abs16): New function.
10462         (Arm_relocate_functions::base_abs): New function.
10463         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10464         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10465         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10466         R_ARM_BASE_ABS.
10467         (Scan::global): Likewise.
10468         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10469         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10470         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10471         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10472         R_ARM_BASE_ABS.
10473
10474 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10475
10476         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10477         (Arm_relocate_functions::movt_prel): New function.
10478         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10479         (Arm_relocate_functions::thm_movt_prel): New function.
10480         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10481         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10482         (Scan::global, Relocate::relocate): Likewise.
10483         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10484
10485 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10486
10487         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10488         Incremental_checker.
10489         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10490         unsigned int.
10491         (class Incremental_inputs_header): New class.
10492         (Incremental_inputs_header_writer): Edit comment.
10493         (Incremental_inputs_entry): New class.
10494         (Incremental_inputs_entry_writer): Edit comment.
10495         (Sized_incremental_binary::do_find_incremental_inputs_section):
10496         Add *strtab_shndx parameter, fill it.
10497         (Sized_incremental_binary::do_check_inputs): New method.
10498         (Incremental_checker::can_incrementally_link_output_file): Use
10499         Sized_incremental_binary::check_inputs.
10500         (Incremental_inputs::report_command_line): Save command line in
10501         command_line_.
10502         * incremental.h:
10503         (Incremental_binary::find_incremental_inputs_section): New
10504         method.
10505         (Incremental_binary::do_find_incremental_inputs_section): Add
10506         strtab_shndx parameter.
10507         (Incremental_binary::do_check_inputs): New pure virtual method.
10508         (Sized_incremental_binary::do_check_inputs): Declare.
10509         (Incremental_checker::Incremental_checker): Add incremental_inputs
10510         parameter, use it to initialize incremental_inputs_.
10511         (Incremental_checker::incremental_inputs_): New field.
10512         (Incremental_checker::command_line): New method.
10513         (Incremental_checker::inputs): New method.
10514         (Incremental_checker::command_line_): New field.
10515
10516 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10517
10518         * incremental.cc: Include <cstdarg> and "target-select.h".
10519         (vexplain_no_incremental): New function.
10520         (explain_no_incremental): New function.
10521         (Incremental_binary::error): New method.
10522         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10523         method.
10524         (make_sized_incremental_binary): New function.
10525         (open_incremental_binary): New function.
10526         (can_incrementally_link_file): Add checks if output is ELF and has
10527         inputs section.
10528         * incremental.h: Include "elfcpp_file.h" and "output.h".
10529         (Incremental_binary): New class.
10530         (Sized_incremental_binary): New class.
10531         (open_incremental_binary): Declare.
10532         * object.cc (is_elf_object): Use
10533         elfcpp::Elf_recognizer::is_elf_file.
10534         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10535         * output.h (Output_file::filesize): New method.
10536
10537 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10538
10539         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10540         New function.
10541         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10542         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10543         function.
10544         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10545         function.
10546         (Arm_relocate_functions::movw_abs_nc): New function.
10547         (Arm_relocate_functions::movt_abs): New function.
10548         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10549         (Arm_relocate_functions::thm_movt_abs): New function.
10550         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10551         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10552         (Scan::global): Likewise.
10553         (Relocate::relocate): Likewise.
10554         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10555
10556 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10557
10558         * arm.cc (Arm_relocate_functions::got_prel) New function.
10559         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10560         (Relocate::relocate): Likewise.
10561         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10562
10563 2009-10-06  Ian Lance Taylor  <iant@google.com>
10564
10565         * options.h (class General_options): Define
10566         split_stack_adjust_size parameter.
10567         * object.h (class Object): Add uses_split_stack_ and
10568         has_no_split_stack_ fields.  Add uses_split_stack and
10569         has_no_split_stack accessor functions.  Declare
10570         handle_split_stack_section.
10571         (class Reloc_symbol_changes): Define.
10572         (class Sized_relobj): Define Function_offsets.  Declare
10573         split_stack_adjust, split_stack_adjust_reltype, and
10574         find_functions.
10575         * object.cc (Object::handle_split_stack_section): New function.
10576         (Sized_relobj::do_layout): Call handle_split_stack_section.
10577         * dynobj.cc (Sized_dynobj::do_layout): Call
10578         handle_split_stack_section.
10579         * reloc.cc (Sized_relobj::relocate_sections): Call
10580         split_stack_adjust for executable sections in split_stack
10581         objects.  Pass reloc_map to relocate_section.
10582         (Sized_relobj::split_stack_adjust): New function.
10583         (Sized_relobj::split_stack_adjust_reltype): New function.
10584         (Sized_relobj::find_functions): New function.
10585         * target-reloc.h: Include "object.h".
10586         (relocate_section): Add reloc_symbol_changes parameter.  Change
10587         all callers.
10588         * target.h (class Target): Add calls_non_split method.  Declare
10589         do_calls_non_split virtual method.  Declare match_view and
10590         set_view_to_nop.
10591         * target.cc: Include "elfcpp.h".
10592         (Target::do_calls_non_split): New function.
10593         (Target::match_view): New function.
10594         (Target::set_view_to_nop): New function.
10595         * gold.cc (queue_middle_tasks): Give an error if mixing
10596         split-stack and non-split-stack objects with -r.
10597         * i386.cc (Target_i386::relocate_section): Add
10598         reloc_symbol_changes parameter.
10599         (Target_i386::do_calls_non_split): New function.
10600         * x86_64.cc (Target_x86_64::relocate_section): Add
10601         reloc_symbol_changes parameter.
10602         (Target_x86_64::do_calls_non_split): New function.
10603         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10604         parameter.
10605         * powerpc.cc (Target_powerpc::relocate_section): Add
10606         reloc_symbol_changes parameter.
10607         * sparc.cc (Target_sparc::relocate_section): Add
10608         reloc_symbol_changes parameter.
10609         * configure.ac: Call AM_CONDITIONAL for the default target.
10610         * configure: Rebuild.
10611         * testsuite/Makefile.am (TEST_AS): New variable.
10612         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10613         (check_DATA): Add split_i386 and split_x86_64 files.
10614         (SPLIT_DEFSYMS): Define.
10615         (split_i386_[1234n].o): New targets.
10616         (split_i386_[124]): New targets.
10617         (split_i386_[1234r].stdout): New targets.
10618         (split_x86_64_[1234n].o): New targets.
10619         (split_x86_64_[124]): New targets.
10620         (split_x86_64_[1234r].stdout): New targets.
10621         (MOSTLYCLEANFILES): Add new executables.
10622         * testsuite/split_i386.sh: New file.
10623         * testsuite/split_x86_64.sh: New file.
10624         * testsuite/split_i386_1.s: New file.
10625         * testsuite/split_i386_2.s: New file.
10626         * testsuite/split_i386_3.s: New file.
10627         * testsuite/split_i386_4.s: New file.
10628         * testsuite/split_i386_n.s: New file.
10629         * testsuite/split_x86_64_1.s: New file.
10630         * testsuite/split_x86_64_2.s: New file.
10631         * testsuite/split_x86_64_3.s: New file.
10632         * testsuite/split_x86_64_4.s: New file.
10633         * testsuite/split_x86_64_n.s: New file.
10634         * testsuite/testfile.cc (Target_test): Update relocation_section
10635         function.
10636         * testsuite/Makefile.in: Rebuild.
10637
10638 2009-10-06  Ian Lance Taylor  <iant@google.com>
10639
10640         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10641         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10642         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10643         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10644         the address on ldo_addrs_.
10645         (Target_i386::Relocate::fix_up_ldo): New function.
10646
10647 2009-10-06   Rafael Espindola  <espindola@google.com>
10648
10649         * plugin.cc (add_input_library): New.
10650         (Plugin::load): Add add_input_library to tv.
10651         (Plugin_manager::add_input_file): Add the is_lib argument.
10652         (add_input_file): Update call to Plugin_manager::add_input_file.
10653         (add_input_library): New.
10654         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10655
10656 2009-09-30  Doug Kwan  <dougkwan@google.com>
10657
10658         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10659         symbol and call Symbol::may_need_copy_reloc to determine if
10660         a copy reloc is needed.
10661         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10662         nocopyreloc is given in command line.
10663         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10664         given in command line.
10665         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10666         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10667         of the removed Target_i386::may_need_copy_reloc.
10668         * options.h (copyreloc): New option with default value false.
10669         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10670         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10671         instead of the removed Target_powerpc::may_need_copy_reloc.
10672         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10673         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10674         instead of the removed Target_sparc::may_need_copy_reloc.
10675         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10676         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10677         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10678         instead of the removed Target_x86_64::may_need_copy_reloc.
10679
10680 2009-09-30  Ian Lance Taylor  <iant@google.com>
10681
10682         * object.h (class Object): Remove target_ field, and target,
10683         sized_target, and set_target methods.
10684         (Object::sized_target): Remove.
10685         (class Sized_relobj): Update declarations.  Remove sized_target.
10686         * object.cc (Sized_relobj::setup): Remove target parameter.
10687         Change all callers.
10688         (Input_objects::add_object): Don't do anything with the target.
10689         (make_elf_sized_object): Add punconfigured parameter.  Change all
10690         callers.  Set or test parameter target.
10691         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10692         Change all callers.
10693         * parameters.cc (Parameters::set_target): Change parameter type to
10694         be non-const.
10695         (Parameters::default_target): Remove.
10696         (set_parameters_target): Change parameter type to be non-const.
10697         (parameters_force_valid_target): New function.
10698         (parameters_clear_target): New function.
10699         * parameters.h (class Parameters): Update declarations.  Remove
10700         default_target method.  Add sized_target and clear_target
10701         methods.  Change target_ to be non-const.
10702         (set_parameters_target): Update declaration.
10703         (parameters_force_valid_target): Declare.
10704         (parameters_clear_target): Declare.
10705         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10706         as NULL if we aren't searching.
10707         (Add_symbols::run): Don't check for compatible target.
10708         * fileread.cc (Input_file::open_binary): Call
10709         parameters_force_valid_target.
10710         * gold.cc (queue_middle_tasks): Likewise.
10711         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10712         set_target on object.
10713         * dynobj.h (class Sized_dynobj): Update declarations.
10714         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10715         make_elf_object returns NULL.
10716         (Archive::include_member): Don't check whether object target is
10717         compatible.
10718         * output.cc (Output_section::add_input_section): Get target from
10719         parameters.
10720         (Output_section::relax_input_section): Likewise.
10721         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10722         parameters.
10723         (Sized_relobj::do_scan_relocs): Likewise.
10724         (Sized_relobj::relocate_sections): Likewise.
10725         * resolve.cc (Symbol_table::resolve): Likewise.
10726         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10727         parameter.  Change all callers.
10728         (Symbol_table::add_from_object): Get target from parameters.
10729         (Symbol_table::add_from_relobj): Don't check object target.
10730         (Symbol_table::add_from_dynobj): Likewise.
10731         (Symbol_table::define_special_symbol): Get target from
10732         parameters.
10733         * symtab.h (class Symbol_table): Update declaration.
10734         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10735         parameter.  Change all callers.  Clear parameter target.
10736         (Binary_test): Test target here.
10737         * testsuite/object_unittest.cc (gold_testsuite): Remove
10738         target_test_pointer parameter.  Change all callers.
10739         (Object_test): Test target here.
10740
10741 2009-09-26  Ian Lance Taylor  <iant@google.com>
10742
10743         * testsuite/initpri1.c: Don't try to use constructor priorities if
10744         compiling with gcc before 4.3.
10745
10746 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10747
10748         * testsuite/retain_symbols_file_test.sh (check_present): Change
10749         output file name to retain_symbols_file_test.stdout.
10750         (check_absent): Likewise.
10751
10752 2009-09-18  Craig Silverstein  <csilvers@google.com>
10753
10754         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10755         * options.cc: Include <cerrno> and <fstream>.
10756         (General_options::finalize): Parse -retain-symbols-file tag.
10757         * options.h: New flag.
10758         (General_options): New method should_retain_symbol, new
10759         variable symbols_to_retain.
10760         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10761         should_retain_symbol map.
10762         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10763         * testsuite/Makefile.in: Regenerate.
10764         * testsuite/retain_symbols_file_test.sh: New file.
10765
10766 2009-09-18  Nick Clifton  <nickc@redhat.com>
10767
10768         * po/es.po: Updated Spanish translation.
10769
10770 2009-09-17  Doug Kwan  <dougkwan@google.com>
10771
10772         * debug.h (DEBUG_RELAXATION): New constant.
10773         (DEBUG_ALL): Add DEBUG_RELAXATION.
10774         (debug_string_to_enum): Add relaxation debug option.
10775         * layout.cc
10776         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10777         Layout::Relaxation_debug_check::read_sections,
10778         Layout::Relaxation_debug_check::read_sections): New method definitions.
10779         (Layout::Layout): Initialize data members
10780         record_output_section_data_from_scrips_,
10781         script_output_section_data_list_ and relaxation_debug_check_.
10782         (Layout::save_segments, Layout::restore_segments,
10783         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10784         Layout::relaxation_loop_body): New method definitions.
10785         (Layout::finalize): Support relaxation.  Move section layout code to
10786         Layout::relaxation_loop_body.
10787         (Layout::set_asection_address_from_script): Move code for orphan
10788         section placement out.
10789         (Layout::place_orphan_sections_in_script): New method definition.
10790         * layout.h (Output_segment_headers, Output_file_header):
10791         New forward class declarations.
10792         (Layout::~Layout): Define.
10793         (Layout::new_output_section_data_from_script): New method definition.
10794         (Layout::place_orphan_sections_in_script): New method declaration.
10795         (Layout::Segment_states): New type declaration.
10796         (Layout::save_segments, Layout::restore_segments,
10797         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10798         Layout::relaxation_loop_body): New method declarations.
10799         (Layout::Output_section_data_list): New type declaration.
10800         (Layout::Relaxation_debug_check): New class definition.
10801         (Layout::record_output_section_data_from_script_,
10802         Layout::script_output_section_data_list_, Layout::segment_states_,
10803         Layout::relaxation_debug_check_): New data members.
10804         * output.cc: (Output_section_headers::do_size): New method definition.
10805         (Output_section_headers::Output_section_headers): Move size
10806         computation to Output_section_headers::do_size.
10807         (Output_segment_headers::do_size): New method definition.
10808         (Output_file_header::Output_file_header): Move size computation to
10809         Output_file_header::do_size and call it.
10810         (Output_file_header::do_size): New method definition.
10811         (Output_data_group::Output_data_group): Adjust call to
10812         Output_section_data.
10813         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10814         (Output_symtab_xindex::do_write): Add array bound check.
10815         (Output_section::Input_section::print_to_mapfile): Handle
10816         RELAXED_INPUT_SECTION_CODE.
10817         (Output_section::Output_section): Initialize data member checkpoint_.
10818         (Output_section::~Output_section): Delete checkpoint object pointed
10819         by checkpoint_.
10820         (Output_section::add_input_section): Always add an Input_section if
10821         relaxing.
10822         (Output_section::add_merge_input_section): Add assert.
10823         (Output_section::relax_input_section): New method definition.
10824         (Output_section::set_final_data_size): Set load address to zero for
10825         an unallocated section.
10826         (Output_section::do_address_and_file_offset_have_reset_values):
10827         New method definition.
10828         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10829         Handle relaxed input section.
10830         (Output_section::sort_attached_input_sections): Checkpoint input
10831         section list lazily.
10832         (Output_section::get_input_sections): Change type of input_sections to
10833         list of Simple_input_section pointers.  Checkpoint input section list
10834         lazily.  Also handle relaxed input sections.
10835         (Output_section::add_input_section_for_script): Take a reference to
10836         a Simple_input_section object instead of Relobj pointer and section
10837         index as parameter.  Handle relaxed input sections.
10838         (Output_section::save_states, Output_section::restore_states): New
10839         method definitions.
10840         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10841         (Output_data::is_data_size_fixed): New method definition.
10842         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10843         if it is fixed.
10844         (Output_data::address_and_file_offset_have_reset_values): New method
10845         definition.
10846         (Output_data::do_address_and_file_offset_have_reset_values): New method
10847         definition.
10848         (Output_data::set_data_size): Check that data size is not fixed.
10849         (Output_data::fix_data_size): New method definition.
10850         (Output_data::is_data_size_fixed_): New data member.
10851         (Output_section_headers::set_final_data_size): New method definition.
10852         (Output_section_headers::do_size): New method declaration.
10853         (Output_segment_headers::set_final_data_size): New method definition.
10854         (Output_segment_headers::do_size): New method declaration.
10855         (Output_file_header::set_final_data_size)::New method definition.
10856         (Output_file_header::do_size)::New method declaration.
10857         (Output_section_data::Output_section_data): Add new parameter
10858         is_data_size_fixed and use it to fix data size.
10859         (Output_data_const::Output_data_const): Adjust call to base class
10860         constructor and fix data size.
10861         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10862         base class constructor and fix data size.
10863         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10864         base class constructor and fix data size.
10865         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10866         class constructor and fix data size.
10867         (Output_data_group::set_final_data_size): New method definition.
10868         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10869         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10870         class constructor and fix data size.
10871         (Output_relaxed_input_section): New class definition.
10872         (Output_section::Simple_input_section): New class definition.
10873         (Output_section::get_input_sections): Adjust parameter list.
10874         (Output_section::add_input_section_for_script): Same.
10875         (Output_section::save_states, Output_section::restore_states,
10876         Output_section::do_address_and_file_offset_have_reset_values,
10877         (Output_section::Input_section::Input_section): Handle
10878         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10879         Output_relaxed_input_section.
10880         (Output_section::Input_section::is_input_section,
10881         Output_section::Input_section::set_output_section): Handle relaxed
10882         input section.
10883         (Output_section::Input_section::is_relaxed_input_section,
10884         Output_section::Input_section::output_section_data,
10885         Output_section::Input_section::relaxed_input_section): New method
10886         definitions.
10887         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10888         value.
10889         (Output_section::Input_section::u1_): Update comments.
10890         (Output_section::Input_section::u2_): Add new union member poris.
10891         (Output_section::Checkpoint_output_section): New classs definition.
10892         (Output_section::relax_input_section): New method declaration.
10893         (Output_section::checkpoint_): New data member.
10894         (Output_segment): Update comments.
10895         (Output_segment::Output_segment): Un-privatize copy constructor.
10896         (Output_segment::operator=): Un-privatize.
10897         * script-sections.cc (Output_section_element::Input_section_list):
10898         Change element type to Output_section::Simple_input_section.
10899         (Output_section_element_dot_assignment::set_section_addresses):
10900         Register output section data for relaxation clean up.
10901         (Output_data_exression::Output_data_expression): Adjust call to base
10902         constructor to fix data size.
10903         (Output_section_element_data::set_section_addresses): Register
10904         Output_data_expression object for relaxation clean up.
10905         (struct Input_section_info): Replace Relobj pointer and section index
10906         pair with Output_section::Simple_input_section and Convert struct to a
10907         class.
10908         (Input_section_sorter::operator()): Adjust access to
10909         Input_section_info data member to use accessors.
10910         (Output_section_element_input::set_section_addresses): Use layout
10911         parameter.  Adjust code to use Output_section::Simple_input_section
10912         and Input_secction_info classes.  Register filler for relaxation
10913         clean up.
10914         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10915         and section index pair with Output_section::Simple_input_section
10916         class.  Adjust code accordingly.
10917         (Phdrs_element::release_segment): New method definition.
10918         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10919         segment list.
10920         (Script_sections::release_segments): New method definition.
10921         * gold/script-sections.h (Script_sections::release_segments): New
10922         method declaration.
10923         * gold/target.h (Target::may_relax, Target::relax,
10924         Target::do_may_relax, Target::do_relax): New method definitions.
10925
10926 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10927
10928         * arm.cc (has_signed_unsigned_overflow): New function.
10929         (Arm_relocate_functions::abs8): New function.
10930         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10931         (Target_arm::Scan::global): Likewise.
10932         (Target_arm::relocate::relocate): Likewise.
10933         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10934         Likewise.
10935
10936 2009-09-16  Cary Coutant  <ccoutant@google.com>
10937
10938         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10939         * testsuite/Makefile.in: Regenerate.
10940
10941 2009-09-11  Nick Clifton  <nickc@redhat.com>
10942
10943         * po/gold.pot: Updated by the Translation project.
10944
10945 2009-09-08  Cary Coutant  <ccoutant@google.com>
10946
10947         * output.cc (Output_file::open): Add execute permission to empty file.
10948         * testsuite/Makefile.am (permission_test): New test.
10949         * testsuite/Makefile.in: Regenerate.
10950
10951 2009-09-02  Ian Lance Taylor  <iant@google.com>
10952
10953         * output.cc (Output_file::resize): Call map_no_anonymous rather
10954         than map.
10955
10956 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10957
10958         * gold.cc: Include "incremental.h".
10959         (queue_initial_tasks): Call Incremental_checker methods.
10960         * incremental.cc: Include "output.h".
10961         (Incremental_checker::can_incrementally_link_output_file): New
10962         method.
10963         * incremental.h (Incremental_checker): New class.
10964
10965         * output.cc (Output_file::open_for_modification): New method.
10966         (Output_file::map_anonymous): Changed return type to bool.  Record
10967         map in base_ field.
10968         (Output_file::map_no_anonymous): New method, broken out of map.
10969         (Output_file::map): Use map_no_anonymous and map_anonymous.
10970         * output.h (class Output_file): Update declarations.
10971
10972 2009-08-24  Cary Coutant  <ccoutant@google.com>
10973
10974         * options.h (Command_line::Pre_options): New class.
10975         (Command_line::pre_options): New member.
10976         * options.cc (gold::options::ready_to_register): New variable.
10977         (One_option::register_option): Do nothing if not registering options.
10978         Assert if same short option registered twice.
10979         (General_options::General_options): Turn off option registration when
10980         done constructing.
10981         (Command_line::Pre_options::Pre_options): New constructor.
10982
10983 2009-08-24  Cary Coutant  <ccoutant@google.com>
10984
10985         * options.h (General_options::no_keep_memory): Remove incorrect
10986         short option.
10987
10988 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10989
10990         * Makefile.am (am__skiplex, am__skipyacc): New.
10991         * Makefile.in: Regenerate.
10992
10993 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10994
10995         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10996         (INCLUDES): ... this.
10997         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10998         (AM_CPPFLAGS): Renamed from ...
10999         (INCLUDE): ... this.
11000         * Makefile.in, testsuite/Makefile.in: Regenerate.
11001
11002         * Makefile.in: Regenerate.
11003         * aclocal.m4: Likewise.
11004         * config.in: Likewise.
11005         * configure: Likewise.
11006         * testsuite/Makefile.in: Likewise.
11007
11008         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11009         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11010         * Makefile.in: Regenerate.
11011         * testsuite/Makefile.in: Regenerate.
11012
11013 2009-08-19  Cary Coutant  <ccoutant@google.com>
11014
11015         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11016         symbols in shared libraries overridden by hidden or internal symbols
11017         in the main program.
11018
11019 2009-08-19  Chris Demetriou  <cgd@google.com>
11020
11021         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11022         checking source file names in error messages.
11023
11024 2009-08-18  Doug Kwan  <dougkwan@google.com>
11025
11026         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11027         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11028         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11029         an elfcpp::Ehdr as parameter.
11030         * object.cc (Object::set_target): Remove the version that looks up
11031         a target and sets it.
11032         (Sized_relobj::setup): Take a Target object instead of
11033         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11034         (make_elf_sized_object): Find target and ask target to
11035         make an ELF object.
11036         * object.h: (Object::set_target): Remove the version that looks up
11037         a target and sets it.
11038         (Sized_relobj::setup): Take a Target object instead of
11039         an elfcpp:Ehdr as parameter.
11040         * target.cc: Include dynobj.h.
11041         (Target::do_make_elf_object_implementation): New.
11042         (Target::do_make_elf_object): New.
11043         * target.h (Target::make_elf_object): New template declaration.
11044         (Target::do_make_elf_object): New method declarations.
11045         (Target::do_make_elf_object_implementation): New template declaration.
11046
11047 2009-08-14  Ian Lance Taylor  <iant@google.com>
11048
11049         * gold.h (FUNCTION_NAME): Define.
11050         (gold_unreachable): Use FUNCTION_NAME.
11051
11052 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11053
11054         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11055         symbol in the --keep-unique list is not found.
11056
11057 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11058
11059         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11060         been maked as --keep-unique.
11061         (Icf::unfold_section): New function.
11062         * icf.h (Icf::unfold_section): New function.
11063         * options.h (General_options::keep_unique): New option.
11064         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11065         * testsuite/Makefile.in: Regenerate.
11066         * testsuite/icf_keep_unique_test.sh: New file.
11067         * testsuite/icf_keep_unique_test.cc: New file.
11068
11069 2009-08-12  Cary Coutant  <ccoutant@google.com>
11070
11071         PR 10471
11072         * resolve.cc (Symbol_table::resolve): Check for references from
11073         dynamic objects to hidden and internal symbols.
11074         * testsuite/Makefile.am (hidden_test.sh): New test.
11075         * testsuite/Makefile.in: Regenerate.
11076         * testsuite/hidden_test.sh: New script.
11077         * testsuite/hidden_test_1.c: New test source.
11078         * testsuite/hidden_test_main.c: New test source.
11079
11080 2009-08-11  Doug Kwan  <dougkwan@google.com>
11081
11082         * arm.cc: Update comments.
11083         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11084         segment to locate the .ARM.exidx section if present.
11085
11086 2009-08-09  Doug Kwan  <dougkwan@google.com>
11087
11088         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11089         patch.
11090
11091 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11092         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11093         compiler warnings.
11094
11095 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11096
11097         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11098         valid tls_segment only for non-debug-section relocations.
11099         * testsuite/Makefile.am: Add gc_tls_test.
11100         * testsuite/Makefile.in: Regenerate.
11101         * testsuite/gc_tls_test.cc: New file.
11102         * testsuite/gc_tls_test.sh: New file.
11103
11104 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11105
11106         * icf.cc: New file.
11107         * icf.h: New file.
11108         * Makefile.am (CCFILES): Add icf.cc.
11109         (HFILES): Add icf.h
11110         * Makefile.in: Regenerate.
11111         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11112         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11113         section, symbol and addend information for the relocs.
11114         * gold.cc (queue_middle_tasks): Call identical code folding.
11115         * gold.h: Add defines for multimap.
11116         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11117         to the call of finalize_local_symbols.
11118         * main.cc (main): Create object of class Icf.
11119         * object.cc (Sized_relobj::do_layout): Allow this function to be
11120         called twice during icf.
11121         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11122         to sections marked as identical by icf.
11123         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11124         when available.
11125         (Sized_relobj::do_section_entsize): New function.
11126         * object.h (Object::section_entsize): New function.
11127         (Object::do_section_entsize): New pure virtual function.
11128         (Relobj::finalize_local_symbols): Add new parameter.
11129         (Relobj::do_section_entsize): New function.
11130         * options.h (General_options::icf): New option.
11131         (General_options::icf_iterations): New option.
11132         (General_options::print_icf_sections): New option.
11133         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11134         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11135         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11136         icf.
11137         * symtab.cc (Symbol_table::is_section_folded): New function.
11138         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11139         to sections marked as identical by icf.
11140         * symtab.h (Symbol_table::set_icf): New function.
11141         (Symbol_table::icf): New function.
11142         (Symbol_table::is_section_folded): New function.
11143         (Symbol_table::icf_): New data member.
11144         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11145         * testsuite/Makefile.am: Add commands to build icf_test.
11146         * testsuite/Makefile.in: Regenerate.
11147         * testsuite/icf_test.sh: New file.
11148         * testsuite/icf_test.cc: New file.
11149
11150 2009-07-24  Chris Demetriou  <cgd@google.com>
11151
11152         * layout.cc (is_compressible_debug_section): Fix incorrect
11153         comment about compressed section names.
11154
11155 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11156
11157         PR 10419
11158         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11159
11160 2009-07-16  Ian Lance Taylor  <iant@google.com>
11161
11162         PR 10400
11163         * layout.h: #include <map>.
11164         (class Kept_section): Change from struct to class.  Add accessors
11165         and setters.  Add section size to Comdat_group mapping.  Change
11166         Comdat_group to std::map.  Add is_comdat_ field.  Add
11167         linkonce_size field in union.
11168         (class Layout): Update declaration of find_or_add_kept_section.
11169         Don't declare find_kept_object.
11170         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11171         parameter.  Add object, shndx, is_comdat, and is_group_name
11172         parameters.  Change all callers.  Adjust for new Kept_section.
11173         (Layout::find_kept_object): Remove.
11174         * object.cc (Sized_relobj::include_section_group): Update use of
11175         Kept_section.  Rename secnum to shndx.  Only record
11176         Kept_comdat_section if sections are the same size.
11177         (Sized_relobj::include_linkonce_section): Update use of
11178         Kept_section.  Only record Kept_comdat_section if sections are the
11179         same size.  Set size of linkonce section.
11180         (Sized_relobj::map_to_kept_section): Update call to
11181         get_kept_comdat_section.
11182         * object.h (class Sized_relobj): Rename fields in
11183         Kept_comdat_section to drop trailing underscores; change object
11184         field to Relobj*.  Change Kept_comdat_section_table to store
11185         struct rather than pointer.
11186         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11187         Add kept_object and kept_shndx parameters.  Change all callers.
11188         (Sized_relobj::get_kept_comdat_section): Change return type to
11189         bool.  Add kept_object and kept_shndx parameters.  Change all
11190         callers.
11191         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11192         Layout::find_or_add_kept_section.
11193
11194 2009-07-09  Ian Lance Taylor  <iant@google.com>
11195
11196         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11197         Reserve space in the hash table.
11198
11199 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11200
11201         * fileread.cc (File_read::get_mtime): New method.
11202         * fileread.h (Timespec): New structure.
11203         (File_read::get_mtime): New method.
11204         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11205         Renamed from timestamp_nsec.
11206         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11207         Elf_Xword.
11208         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11209         timestamp_nsec.
11210         (Incremental_inputs::report_archive): Save mtime; style fix.
11211         (Incremental_inputs::report_obejct): Save mtime; style fix.
11212         (Incremental_inputs::report_script): Save mtime; style fix.
11213         (Incremental_inputs::finalize_inputs): Style fix.
11214         (Incremental_inputs::finalize): Style fix.
11215         (Incremental_inputs::create_input_section_data): Store inputs
11216         mtime.
11217         * incremental.h (Incremental_inputs::report_script): Add mtime
11218         argument.
11219         (Incremental_inputs::Input_info::Input_info): Intialize only one
11220         union member.
11221         (Incremental_inputs::Input_info::archive): Move to nameless
11222         union.
11223         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11224         (Incremental_inputs::Input_info::script): Move to nameless union.
11225         (Incremental_inputs::mtime): New field.
11226         * script.cc (read_input_script): Pass file mtime to
11227         Incremental_input.
11228         * script.h (Script_info::inputs): Style fix.
11229
11230 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11231
11232         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11233         instead of 32.
11234
11235 2009-06-24  Ian Lance Taylor  <iant@google.com>
11236
11237         PR 10156
11238         * layout.cc (Layout::choose_output_section): If we find an
11239         existing section, update the flags.
11240         (Layout::create_notes): New function, broken out of
11241         Layout::finalize.
11242         (Layout::finalize): Don't create note sections.
11243         (Layout::create_note): Don't crash if linker script discards
11244         section.
11245         (Layout::create_gold_note): Likewise.
11246         (Layout::create_build_id): Likewise.  Don't set
11247         after_input_sections on the section.
11248         (Layout::create_executable_stack_info): Remove target parameter.
11249         Change caller.
11250         * layout.h (class Layout): Declare create_notes.  Update
11251         declaration of create_executable_stack_info.
11252         * gold.cc (queue_middle_tasks): Call create_notes.
11253         * output.cc (Output_section::update_flags_for_input_section): Move
11254         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11255         invalid.
11256         * output.h (Output_data::mark_address_invalid): New function.
11257         (class Output_section): Only declare, not define,
11258         update_flags_for_input_section.  Remove set_flags.
11259
11260 2009-06-24  Ian Lance Taylor  <iant@google.com>
11261
11262         * script-sections.cc (Output_section_definition::
11263         set_section_addresses): Rename shadowing local load_address to
11264         laddr.
11265
11266 2009-06-24  Ian Lance Taylor  <iant@google.com>
11267
11268         PR 10244
11269         * reloc.cc (relocate_sections): Skip empty relocation sections.
11270
11271 2009-06-23  Ian Lance Taylor  <iant@google.com>
11272
11273         PR 10156
11274         * layout.cc (Layout::create_note): Use choose_output_section
11275         rather than make_output_section.
11276
11277 2009-06-23  Ian Lance Taylor  <iant@google.com>
11278
11279         PR 10237
11280         * options.cc (General_options::parse_V): Set printed_version_.
11281         (General_options::General_options): Initialize printed_version_.
11282         * options.h (class General_options): Add printed_version_ field.
11283         * gold.cc (queue_initial_tasks): If there are no input files,
11284         don't give a fatal error if we printed the version information.
11285         (queue_middle_tasks): If using -r with a shared object, give a
11286         fatal error rather than an ordinary error.
11287
11288 2009-06-23  Ian Lance Taylor  <iant@google.com>
11289
11290         PR 10219
11291         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11292         (Layout::make_output_section): Set have_stabstr_section_ if we see
11293         a .stab*str section.
11294         (Layout::finalize): Call link_stabs_sections.
11295         (Layout::link_stabs_sections): New file.
11296         * layout.h (class Layout): Add have_stabstr_section_ field.
11297         Declare link_stabs_sections.
11298
11299 2009-06-23  Doug Kwan  <dougkwan@google.com>
11300
11301         * Makefile.am (libgold_a_LIBADD): New.
11302         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11303         * Makefile.in: Regenerate.
11304         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11305         * configure: Regenerate.
11306         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11307         * fileread.cc: Include sys/state.h
11308         * gold.h: Declare memmem and strndup if found missing.
11309         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11310
11311 2009-06-23  Ian Lance Taylor  <iant@google.com>
11312
11313         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11314         * configure: Rebuild.
11315
11316 2009-06-23  Ian Lance Taylor  <iant@google.com>
11317
11318         PR 10147
11319         * object.cc (Object::section_contents): Don't try to get a view if
11320         the section has length zero.
11321         (Object::handle_gnu_warning_section): If the section is empty, use
11322         the name of the section as the warning.
11323
11324 2009-06-23  Ian Lance Taylor  <iant@google.com>
11325
11326         PR 10133
11327         * stringpool.h (class Stringpool_template): Add optimize_ field.
11328         (Stringpool_template::set_optimize): New function.
11329         * stringpool.cc (Stringpool_template::Stringpool_template):
11330         Initialize optimize_ field.
11331         (Stringpool_template::set_string_offsets): Test local optimize
11332         fild rather than parameter.
11333         * layout.cc (Layout::Layout): Call set_optimize on the section
11334         name stringpool.
11335
11336 2009-06-22  Ian Lance Taylor  <iant@google.com>
11337
11338         PR 10030
11339         * yyscript.y: Parse TARGET.
11340         * script.cc (script_set_target): New function.
11341         * script-c.h (script_set_target): Declare.
11342         * options.cc (General_options::string_to_object_format): Rename
11343         from string_to_object_format in anonymous namespace.  Change
11344         callers.
11345         * options.h (class General_options): Declare
11346         string_to_object_format.
11347
11348 2009-06-22  Ian Lance Taylor  <iant@google.com>
11349
11350         * script-sections.cc (Script_sections::create_segments): Don't put
11351         program headers in a PT_LOAD segment if -n or -N.
11352
11353 2009-06-22  Ian Lance Taylor  <iant@google.com>
11354
11355         PR 10141
11356         * options.h (class General_options): Add -z lazy and -z now.  Sort
11357         -z options into alphabetical order.
11358         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11359
11360 2009-06-21  Ian Lance Taylor  <iant@google.com>
11361
11362         * layout.cc (Layout::make_output_section): Call
11363         Target::new_output_section.
11364         (Layout::attach_allocated_section_to_segment): Put large section
11365         sections in a separate load segment with the large segment flag
11366         set.
11367         (Layout::segment_precedes): Sort large data segments after other
11368         load segments.
11369         (align_file_offset): New static function.
11370         (Layout::set_segment_offsets): Use align_file_offset.
11371         * output.h (class Output_section): Add is_small_section_ and
11372         is_large_section_ fields.
11373         (Output_section::is_small_section): New function.
11374         (Output_section::set_is_small_section):  New function.
11375         (Output_section::is_large_section): New function.
11376         (Output_section::set_is_large_section): New function.
11377         (Output_section::is_large_data_section): New function.
11378         (class Output_segment): Add is_large_data_segment_ field.
11379         (Output_segment::is_large_data_segment): New function.
11380         (Output_segment::set_is_large_data_segment): New function.
11381         * output.cc (Output_section::Output_section): Initialize new
11382         fields.
11383         (Output_segment::Output_segment): Likewise.
11384         (Output_segment::add_output_section): Add assertion that large
11385         data sections always go in large data segments.  Force small data
11386         sections to the end of the list of data sections.  Force small BSS
11387         sections to the start of the list of BSS sections.  For large BSS
11388         sections to the end of the list of BSS sections.
11389         * symtab.h (class Symbol): Declare is_common_shndx.
11390         (Symbol::is_defined): Check Symbol::is_common_shndx.
11391         (Symbol::is_common): Likewise.
11392         (class Symbol_table): Define enum Commons_section_type.  Update
11393         declarations.  Add small_commons_ and large_commons_ fields.
11394         * symtab.cc (Symbol::is_common_shndx): New function.
11395         (Symbol_table::Symbol_table): Initialize new fields.
11396         (Symbol_table::add_from_object): Put small and large common
11397         symbols in the right list.
11398         (Symbol_table::sized_finalized_symbol): Check
11399         Symbol::is_common_shndx.
11400         (Symbol_table::sized_write_globals): Likewise.
11401         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11402         common symbol lists.  Don't call do_allocate_commons_list if the
11403         list is empty.
11404         (Symbol_table::do_allocate_commons_list): Remove is_tls
11405         parameter.  Add comons_section_type parameter.  Change all
11406         callers.  Handle small and large common symbols.
11407         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11408         Symbol::is_common_shndx.
11409         * resolve.cc (symbol_to_bits): Likewise.
11410         * target.h (Target::small_common_shndx): New function.
11411         (Target::small_common_section_flags): New function.
11412         (Target::large_common_shndx): New function.
11413         (Target::large_common_section_flags): New function.
11414         (Target::new_output_section): New function.
11415         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11416         small_common_section_flags, and large_common_section_flags
11417         fields.
11418         (Target::do_new_output_section): New virtual function.
11419         * arm.cc (Target_arm::arm_info): Initialize new fields.
11420         * i386.cc (Target_i386::i386_info): Likewise.
11421         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11422         Likewise.
11423         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11424         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11425         (Target_x86_64::do_new_output_section): New function.
11426         * configure.ac: Define conditional MCMODEL_MEDIUM.
11427         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11428         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11429         (large_LDFLAGS): Define.
11430         * testsuite/large.c: New file.
11431         * testsuite/testfile.cc (Target_test::test_target_info):
11432         Initialize new fields.
11433         * configure, testsuite/Makefile.in: Rebuild.
11434
11435 2009-06-05  Doug Kwan  <dougkwan@google.com>
11436
11437         * Makefile.am (CCFILES): Add target.cc.
11438         * Makefile.in: Regenerate.
11439         * i386.cc (class Target_i386): Define new virtual method to
11440         override do_is_local_label_name in parent.
11441         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11442         local symbols if --discard-locals or -X is given.
11443         * options.h (class General_options): Declare new options
11444         '--discard-locals' and '-X' for discarding locals.
11445         * target.h (class Target): Define new methods is_local_label_name.
11446         Declare new virtual method do_is_local_label_name.
11447         * target.cc: New file.
11448         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11449         (check_SCRIPTS): Add discard_locals_test.sh.
11450         (check_DATA): Add discard_local_tests.syms.
11451         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11452         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11453         * testsuite/Makefile.in: Regenerate.
11454         * testsuite/discard_locals_test.c: New file.
11455         * testsuite/discard_locals_test.sh: Same.
11456
11457 2009-06-05  Doug Kwan  <dougkwan@google.com>
11458
11459         * object.cc (Sized_relobj::Sized_relobj): Initialize
11460         discarded_eh_frame_shndx_ to -1U.
11461         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11462         section.
11463         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11464         a discarded .eh_frame section.
11465         (Sized_relobj::do_finalize_local_symbols): Ditto.
11466         * object.h (class Sized_relobj): Declare new member
11467         discarded_eh_frame_shndx_.
11468         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11469         (local_labels_test.o, local_labels_test): New rules.
11470         * testsuite/Makefile.in: Regenerate.
11471
11472 2009-06-04  Doug Kwan  <dougkwan@google.com>
11473
11474         * layout.cc (Layout::section_name_mapping): Add mapping for
11475         special ARM sections.
11476
11477 2009-06-03  Doug Kwan  <dougkwan@google.com>
11478
11479         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11480         (utils::has_overflow): Same.
11481
11482 2009-06-03  Ian Lance Taylor  <iant@google.com>
11483
11484         * layout.cc (Layout::section_name_mapping): New array, replacing
11485         Layout::linkonce_mapping.
11486         (Layout::section_name_mapping_count): New variable, replacing
11487         Layout::linkonce_mapping_count.
11488         (Layout::linkonce_output_name): Remove.
11489         (Layout::output_section_name): Rewrite.
11490         * layout.h (class Layout): Rename Linkonce_mapping to
11491         Section_name_mapping, linkonce_mapping to section_name_mapping,
11492         linkonce_mapping_count to section_name_mapping_count.  Don't
11493         declare linkonce_output_name.
11494
11495 2009-06-03  Doug Kwan  <dougkwan@google.com>
11496
11497         * gold/arm.cc (namespace utils): New.
11498         (Target_arm::reloc_is_non_pic): Define new method.
11499         (class Arm_relocate_functions): New.
11500         (Target_arm::Relocate::relocate): Handle relocation types used by
11501         Android.
11502
11503 2009-06-03  Ian Lance Taylor  <iant@google.com>
11504
11505         * arm.cc (Target_arm::scan::global): Use || instead of |.
11506
11507 2009-06-02  Doug Kwan  <dougkwan@google.com>
11508
11509         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11510         issued_non_pic_error_.
11511         (class Target_arm::Scan): Declare new method check_non_pic.
11512         Define new method symbol_needs_plt_entry.
11513         Declare new data member issued_non_pic_error_.
11514         (class Target_arm::Relocate): Declare new method
11515         should_apply_static_reloc.
11516         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11517         (Target_arm::Scan::check_non_pic): Define new method.
11518         (Target_arm::Scan::local): Handle a small subset of reloc types used
11519         by Android.
11520         (Target_arm::Scan::local): Same.
11521         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11522
11523 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11524
11525         * incremental.cc (Incremental_inputs::report_command_line): Filter
11526         out --incremental-* options.
11527
11528 2009-05-29  Doug Kwan  <dougkwan@google.com>
11529
11530         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11531         template class.
11532         (class Target_arm): Update comment.
11533         (Target_arm::Target_arm): Initialize new data members GOT_,
11534         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11535         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11536         and Target_arm::rel_dyn_section.
11537         Declare new_enum Target_arm::Got_type.
11538         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11539         and DYNBSS_.
11540         Update commments for member do_dynsym_value.
11541         (Target_arm::got_size, Target_arm::plt_section,
11542         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11543         new methods inside class defintion.
11544         (Target_arm::got_section): Define new method.
11545         (Target_arm::rel_dyn_section): Same.
11546         (Output_data_plt_arm): New template class.
11547         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11548         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11549         (Output_data_plt_arm::add_entry): Same.
11550         (Output_data_plt_arm::first_plt_entry): Define new
11551         static data member for PLT instruction template.
11552         (Output_data_plt_arm::plt_entry): Same.
11553         (Output_data_plt_arm::do_write): Define new method.
11554         (Target_arm::make_plt_entry): Same.
11555         (Target_arm::do_finalize_sections): Same.
11556         (Target_arm::do_dynsym_value): Same.
11557
11558 2009-05-28  Doug Kwan  <dougkwan@google.com>
11559
11560         * Makefile.am (TARGETSOURCES): Add arm.cc.
11561         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11562         * Makefile.in: Regenerate.
11563         * arm.cc: New file.
11564         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11565
11566 2009-05-26  Doug Kwan  <dougkwan@google.com>
11567
11568         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11569         (General_options::check_excluded_libs): Strip off directories in
11570         archive name before matching like GNU ld does.
11571         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11572         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11573         (exclude_libs_test_LDFLAGS): Add linker option
11574         -Wl,--exclude-libs,libexclude_libs_test_3
11575         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11576         an explicit archive without using -l.
11577         (alt/libexclude_libs_test_3.a): New make rule.
11578         * testsuite/Makefile.in: Regenerate.
11579         * testsuite/exclude_libs_test.c : Declare lib3_default().
11580         (main): Call it.
11581         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11582         * exclude_libs_test_3.c: New file.
11583
11584 2009-05-26  Nick Clifton  <nickc@redhat.com>
11585
11586         * po/id.po: New Indonesian translation.
11587         * po/gold.pot: Updated template file.
11588
11589 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11590
11591         * testsuite/Makefile.am: Add -ffunction-sections to compile
11592         gc_comdat_test files.  Add -Wl,--gc-sections to build
11593         gc_comdat_test.
11594         * testsuite/Makefile.in: Regenerate.
11595         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11596
11597 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11598
11599         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11600         kept comdat section was garbage collected.
11601         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11602         * testsuite/Makefile.in: Regenerate.
11603         * testsuite/gc_comdat_test.sh: New file.
11604         * testsuite/gc_comdat_test_1.cc: New file.
11605         * testsuite/gc_comdat_test_2.cc: New file.
11606
11607 2009-05-19  Doug Kwan  <dougkwan@google.com>
11608
11609         * archive.cc (Archive::Archive): Move constructor from archive.h
11610         to here.  Initialize no_export_.
11611         (Archive::get_elf_object_for_member): Set no_export flag of object.
11612         * archive.h (Archive::Archive): Move constructor body to
11613         archive.cc.
11614         (Archive::no_export): New method.
11615         (Archive::no_export_): New field.
11616         * object.h (Object::Object): Initialize no_export_ to false.
11617         (Object::no_export, Object::set_no_export): New methods.
11618         (Object::no_export_): New field.
11619         * options.cc (General_options::parse_exclude_libs): New method.
11620         (General_options::check_excluded_libs) Same.
11621         * options.h (exclude_libs): New option.
11622         (General_options::check_excluded_libs): New method declaration.
11623         (General_options::excluded_libs_): New field.
11624         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11625         default or protected visibility if an object has no-export flag set.
11626         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11627         (check_SCRIPTS): Add exclude_libs_test.sh.
11628         (check_DATA): Add exclude_libs_test.syms.
11629         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11630         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11631         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11632         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11633         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11634         libexclude_libs_test_2.a): New rules.
11635         * testsuite/Makefile.in: Regenerate.
11636         * testsuite/exclude_libs_test.c: New file.
11637         * testsuite/exclude_libs_test.sh: Ditto.
11638         * testsuite/exclude_libs_test_1.c: Ditto.
11639         * testsuite/exclude_libs_test_2.c: Ditto.
11640
11641 2009-05-15  Ian Lance Taylor  <iant@google.com>
11642
11643         * configure.ac: Check for declarations for cases where libiberty.h
11644         checks HAVE_DECL_xxx.
11645         * configure, config.in: Rebuild.
11646
11647 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11648
11649         * gold.h (Incremental_argument_list): Remove (invalid) forward
11650         declaration.
11651         * incremental.cc (Incremental_inputs::report_achive): New method.
11652         (Incremental_inputs::report_object): New method.
11653         (Incremental_inputs::report_script): New method.
11654         (Incremental_inputs::finalize_inputs): New method.
11655         (Incremental_inputs::finalize): Call finalize_inputs().
11656         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11657         Create inputs entries.
11658         * incremental.h (Incremental_input_type): New enum.
11659         (Incremental_inputs::Incremental_input): Initialize new fields.
11660         (Incremental_inputs::report_inputs): New method.
11661         (Incremental_inputs::report_achive): New method.
11662         (Incremental_inputs::report_object): New method.
11663         (Incremental_inputs::report_script): New method.
11664         (Incremental_inputs::finalize_inputs): New method.
11665         (Incremental_inputs::Input_info): New struct.
11666         (Incremental_inputs::Input_info_map): New typedef.
11667         (Incremental_inputs::lock_): New field.
11668         (Incremental_inputs::Inputs_): New field.
11669         (Incremental_inputs::Inputs_map): New field.
11670         * main.cc (main): Call Incremental_input::report_inputs.
11671         * options.h (Input_argument_list): Typedef moved from
11672         Input_arguments.
11673         (Input_file_group::Files): Remove, use ::Input_argument_list.
11674         (Input_file_group::Input_argument_list): Remove, use
11675         ::Input_argument_list.
11676         * plugin.cc (Plugin_manager::add_input_file): Add error in
11677         incremental build.
11678         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11679         functions.
11680         * script.cc (read_input_script): Call
11681         Incremental_input::report_script.
11682         * script.h (Script_info): New class.
11683
11684 2009-04-27  Ian Lance Taylor  <iant@google.com>
11685
11686         * x86_64.cc (do_adjust_output_section): Set entsize to
11687         plt_entry_size.
11688
11689 2009-04-23  Elliott Hughes  <enh@google.com>
11690
11691         * output.cc (Output_file::close): After short writes, continue
11692         writing from the correct offset in the buffer being written.
11693
11694 2009-04-23  Chris Demetriou  <cgd@google.com>
11695
11696         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11697         * configure: Regenerate.
11698         * config.in: Regenerate.
11699         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11700         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11701
11702 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11703
11704         * incremental.cc (Incremental_inputs_header_data): Renamed from
11705         Incremental_input_header_data.
11706         (Incremental_inputs_header_data::data_size): New field.
11707         (Incremental_inputs_header_data::put_input_file_count): Renamed
11708         from input_file_count.
11709         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11710         from command_line_offset.
11711         (Incremental_inputs_header_data::put_reserved): Renamed from
11712         put_reserved.
11713         (Incremental_inputs_entry_data): Renamed from
11714         Incremental_input_entry_data.
11715         (Incremental_inputs_entry_data::data_size): New field.
11716         (Incremental_inputs::report_command_line): New method.
11717         (Incremental_inputs::finalize): New method.
11718         (Incremental_inputs::create_incremental_inputs_data): New method.
11719         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11720         * incremental.h: New file.
11721         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11722         (Layout::finalize): Create incremental inputs section in
11723         incremental builds.
11724         (Layout::create_incremental_info_sections): New method.
11725         * layout.h (Layout::incremental_inputs): New method.
11726         (Layout::create_incremental_info_sections): New method.
11727         (Layout::incremental_inputs_): New field.
11728         * main.cc (main): Notify Incremental_input of the command line.
11729
11730 2009-04-01  Ian Lance Taylor  <iant@google.com>
11731             Mikolaj Zalewski  <mikolajz@google.com>
11732
11733         * gold.h (reserve_unordered_map): Define, three versions, one for
11734         each version of Unordered_map.
11735         * layout.cc (Layout::Layout): Remove options parameter.  Add
11736         number_of_input_files parameter.  Don't initialize options_.
11737         Initialize number_of_input_files_ and resized_signatures_.  Move
11738         sections_are_attached_.
11739         (Layout::layout_group): Reserve space for group_signatures_.
11740         (Layout::find_or_add_kept_section): Change name parameter to be a
11741         reference.  Resize signatures_ map when it gets large enough.
11742         (Layout::layout_eh_frame): Use parameters->options() instead of
11743         this->options_.
11744         (Layout::make_output_section): Likewise.
11745         (Layout::attach_allocated_section_to_segment): Likewise.
11746         (Layout::finalize, Layout::create_executable_stack): Likewise.
11747         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11748         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11749         * layout.h (class Layout): Update declarations.  Remove options_
11750         field.  Add number_of_input_files_ and resized_signatures_
11751         fields.  Move sections_are_attached_ field.
11752         * main.cc (main): Pass number of input files to Layout
11753         constructor.  Don't pass options.
11754
11755 2009-03-30  Ian Lance Taylor  <iant@google.com>
11756
11757         * ffsll.c (ffsll): Correct implementation.
11758
11759 2009-03-27  Ian Lance Taylor  <iant@google.com>
11760
11761         * ffsll.c: New file.
11762         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11763         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11764         * ftruncate.c (ftruncate): Declare before definition.
11765         * mremap.c (mremap): Likewise.
11766         * pread.c (pread): Likewise.
11767         * configure, Makefile.in, config.in: Rebuild.
11768
11769         * mremap.c: New file.
11770         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11771         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11772         (mremap): Declare if HAVE_MREMAP is not defined.
11773         * configure, Makefile.in, config.in: Rebuild.
11774
11775 2009-03-27  Cary Coutant  <ccoutant@google.com>
11776
11777         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11778         position independent.
11779         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11780         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11781
11782 2009-03-24  Cary Coutant  <ccoutant@google.com>
11783
11784         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11785         an executable.
11786         (needs_dynamic_reloc): Likewise.
11787
11788 2009-03-24  Ian Lance Taylor  <iant@google.com>
11789
11790         * yyscript.y (file_cmd): Recognize EXTERN.
11791         (extern_name_list, extern_name_list_body): New nonterminals.
11792         * script.cc (script_add_extern): Define.
11793         * script-c.h (script_add_extern): Declare.
11794
11795 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11796
11797         * object.cc (is_elf_object): Define.
11798         * object.h (is_elf_object): Declare.
11799         * archive.cc (Archive::get_elf_object_for_member): Call
11800         is_elf_object.
11801         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11802
11803 2009-03-24  Elliott Hughes  <enh@google.com>
11804
11805         * output.cc (Output_file::map_anonymous): Define.
11806         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11807         try an anonymous one.  Report the size if the mmap fails.
11808         * output.h (class Output_file): Declare map_anonymous.
11809
11810 2009-03-24  Ian Lance Taylor  <iant@google.com>
11811
11812         * target-select.cc (instantiate_target): Don't acquire the lock if
11813         the instantiated_target_ field has already been set.
11814
11815 2009-03-23  Ian Lance Taylor  <iant@google.com>
11816
11817         * gold-threads.h (class Initialize_lock): Define.
11818         * gold-threads.cc (class Initialize_lock_once): Define.
11819         (initialize_lock_control): New static variable.
11820         (initialize_lock_pointer): New static variable.
11821         (initialize_lock_once): New static function.
11822         (Initialize_lock::Initialize_lock): Define.
11823         (Initialize_lock::initialize): Define.
11824         * target-select.h: Include "gold-threads.h".
11825         (class Target_selector): Add lock_ and initialize_lock_ fields.
11826         Don't define instantiate_target, just declare it.
11827         * target-select.cc (Target_selector::Target_selector): Initialize
11828         new fields.
11829         (Target_selector::instantiate_target): Define.
11830         * descriptors.h: Include "gold-threads.h".
11831         (class Descriptors): Add initialize_lock_ field.
11832         * descriptors.cc (Descriptors::Descriptors): Initialize new
11833         field.
11834         (Descriptors::open): Use initialize_lock_ field
11835         * errors.h (class Errors): Add initialize_lock_ field.
11836         * errors.cc (Errors::Errors): Initialize new field.
11837         (Errors::initialize_lock): Use initialize_lock_ field.
11838         * powerpc.cc (class Target_selector_powerpc): Remove
11839         instantiated_target_ field.  In do_recognize call
11840         instantiate_target rather than do_instantiate_target.  In
11841         do_instantiate_target just allocate a new target.
11842         * sparc.cc (class Target_selector_sparc): Likewise.
11843
11844         * freebsd.h: New file.
11845         * i386.cc: Include "freebsd.h".
11846         (Target_i386): Derive from Target_freebsd rather than
11847         Sized_target.
11848         (Target_selector_i386): Derive from Target_selector_freebsd rather
11849         than Target_selector.
11850         * x86_64.cc: Include "freebsd.h".
11851         (Target_x86_64): Derive from Target_freebsd rather than
11852         Sized_target.
11853         (Target_selector_x86_64): Derive from Target_selector_freebsd
11854         rather than Target_selector.
11855         * target.h (class Target): Add adjust_elf_header and
11856         do_adjust_elf_header.
11857         * output.cc (Output_file_header:: do_sized_write): Call target
11858         adjust_elf_header routine.
11859         * configure.tgt: Set targ_osabi.
11860         * configure.ac: Define GOLD_DEFAULT_OSABI.
11861         * parameters.cc (Parameters::default_target): Pass
11862         GOLD_DEFAULT_OSABI to select_target.
11863         * target-select.h (class Target_selector): Make instantiate_target
11864         protected rather than private.
11865         * Makefile.am (HFILES): Add freebsd.h.
11866         * configure, Makefile.in, config.in: Rebuild.
11867
11868         * merge.cc (do_add_input_section): Correct pend value.  Change
11869         message about last entry not being null terminated from error to
11870         warning.
11871
11872 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11873
11874         * incremental.cc: New file.
11875         * Makefile.am (CCFILES): Add incremental.cc.
11876         * Makefile.in: Rebuild.
11877
11878 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11879
11880         * layout.cc (Layout::output_section_name): Preserve names
11881         of '.note.' sections.
11882
11883 2009-03-19  Ian Lance Taylor  <iant@google.com>
11884
11885         * descriptors.cc (Descriptors::open): Check that the options are
11886         valid before using them.
11887
11888 2009-03-18  Ian Lance Taylor  <iant@google.com>
11889
11890         * script-sections.h: Include <list>.
11891         (class Script_sections): Change Sections_elements from std::vector
11892         to std::list.  Typedef public Elements_iterator.  Add
11893         orphan_section_placement_, data_segment_align_start_, and
11894         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11895         field.
11896         * script-sections.cc (class Orphan_section_placement): New class.
11897         (class Sections_element): Add virtual functions is_relro and
11898         orphan_section_init.  Remove virtual function place_orphan_here.
11899         (class Output_section_definition): Add is_relro and
11900         orphan_section_init.  Remove place_orphan_here.
11901         (class Orphan_output_section): Likewise.
11902         (Script_sections::Script_sections): Update for field changes.
11903         (Script_sections::data_segment_align): Set saw_data_segment_align_
11904         and data_segment_align_start_, not data_segment_align_index.
11905         (Script_sections::data_segment_relro_end): Check
11906         saw_data_segment_align_.  Use data_segment_align_start_ rather
11907         than data_segment_align_index_.
11908         (Script_sections::place_orphan): Rewrite to use
11909         Orphan_section_placement.
11910
11911 2009-03-17  Ian Lance Taylor  <iant@google.com>
11912
11913         * archive.cc (Archive::add_symbols): Check for a version attached
11914         to the symbol name in the archive map.
11915         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11916         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11917         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11918         (ver_test_11.a): New target.
11919         * testsuite/Makefile.in: Rebuild.
11920
11921         * configure.ac: Check for chsize and posix_fallocate.  Replace
11922         ftruncate.
11923         * ftruncate.c: New file, from gnulib.
11924         * output.cc (posix_fallocate): Define dummy version if not
11925         HAVE_POSIX_FALLOCATE.
11926         (Output_file::map): Call posix_fallocate rather than lseek and
11927         write.
11928         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11929         * configure, Makefile.in, config.in: Rebuild.
11930
11931 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11932
11933         * layout.h (Layout::create_note): Add section_name parameter.
11934         * layout.cc (Layout::create_note): Likewise.
11935         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11936
11937 2009-03-17  Ian Lance Taylor  <iant@google.com>
11938
11939         * descriptors.cc: Include "options.h".
11940         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11941         (Descriptors::open): Always use O_CLOEXEC when opening a new
11942         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11943         then set FD_CLOEXEC.
11944
11945         * sparc.cc (class Target_sparc): Add has_got_section.
11946         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11947         make sure we have a GOT section.
11948
11949         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11950         (Target_sparc::Scan::local): Likewise.
11951         (Target_sparc::Scan::global): Likewise.
11952         (Target_sparc::Relocate::relocate): Likewise.
11953         (Target_sparc::Relocate::relocate_tls): Likewise.
11954
11955         * symtab.cc (Symbol_table::define_default_version): New function,
11956         broken out of add_from_object.
11957         (Symbol_table::add_from_object): Call define_default_version.
11958         (Symbol_table::define_special_symbol): Add resolve_oldsym
11959         parameter.  Change all callers.  If the version for a symbol comes
11960         from a version script, resolve it with the symbol with the same
11961         name with no version.  Also add the symbol without a version if
11962         appropriate.
11963         (do_define_in_output_data): If resolving with oldsym, don't delete
11964         sym.
11965         (do_define_in_output_segment): Likewise.
11966         (do_define_as_constant): Likewise.
11967         * symtab.h (class Symbol_table): Update declarations.
11968
11969 2009-03-13  Ian Lance Taylor  <iant@google.com>
11970
11971         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11972         (Read_symbols::requeue): New function.
11973         (Read_symbols::do_read_symbols): If make_elf_object fails because
11974         the target type is not configured, and the file was searched for,
11975         issue a warning and retry with the next directory.
11976         (Add_symbols::run): If the file has an incompatible format, and
11977         it was searched for, requeue the Read_symbols task.  On error,
11978         release the object.
11979         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11980         dirindex parameter to constructor.  Change all callers.  Declare
11981         incompatible_warning and requeue.
11982         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11983         input_argument_ and input_group_ fields.  Add them to
11984         constructor.  Change all callers.
11985         (class Read_script): Add dirindex_ field.  Add it to constructor.
11986         Change all callers.
11987         * archive.cc (Archive::setup): Remove input_objects parameter.
11988         Change all callers.
11989         (Archive::get_file_and_offset): Likewise.
11990         (Archive::read_all_symbols): Likewise.
11991         (Archive::read_symbols): Likewise.
11992         (Archive::get_elf_object_for_member): Remove input_objects
11993         parameter.  Add punconfigured parameter.  Change all callers.
11994         (Archive::add_symbols): Change return type to bool.  Check return
11995         value of include_member.
11996         (Archive::include_all_members): Likewise.
11997         (Archive::include_member): Change return type to bool.  Return
11998         false if first included object has incompatible target.  Set
11999         included_member_ field.
12000         (Add_archive_symbols::run): If add_symbols returns false, requeue
12001         Read_symbols task.
12002         * archive.h (class Archive): Add included_member_ field.
12003         Initialize it in constructor.  Add input_file and searched_for
12004         methods.  Update declarations.
12005         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12006         input_argument_ fields.  Add them to constructor.  Change all
12007         callers.
12008         * script.cc: Include "target-select.h".
12009         (class Parser_closure): Add skip_on_incompatible_target_ and
12010         found_incompatible_target_ fields.  Add
12011         skip_on_incompatible_target parameter to constructor.  Change all
12012         callers.  Add methods skip_on_incompatible_target,
12013         clear_skip_on_incompatible_target, found_incompatible_target, and
12014         set_found_incompatible_target.
12015         (read_input_script): Add dirindex parameter.  Change all callers.
12016         If parser finds an incompatible target, requeue Read_symbols
12017         task.
12018         (script_set_symbol): Clear skip_on_incompatible_target in
12019         closure.
12020         (script_add_assertion, script_parse_option): Likewise.
12021         (script_start_sections, script_add_phdr): Likewise.
12022         (script_check_output_format): New function.
12023         * script.h (read_input_script): Update declaration.
12024         * script-c.h (script_check_output_format): Declare.
12025         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12026         (ignore_cmd): Remove OUTPUT_FORMAT.
12027         * fileread.cc (Input_file::Input_file): Add explicit this.
12028         (Input_file::will_search_for): New function.
12029         (Input_file::open): Add pindex parameter.  Change all callers.
12030         * fileread.h (class Input_file): Add input_file_argument method.
12031         Declare will_search_for.  Update declarations.
12032         * object.cc (make_elf_object): Add punconfigured parameter.
12033         Change all callers.
12034         * object.h (class Object): Make input_file public.  Add
12035         searched_for method.
12036         (make_elf_object): Update declaration.
12037         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12038         restart search.
12039         * dirsearch.h (class Dirsearch): Update declaration.
12040         * options.h (class General_options): Add --warn-search-mismatch.
12041         * parameters.cc (Parameters::is_compatible_target): New function.
12042         * parameters.h (class Parameters): Declare is_compatible_target.
12043         * workqueue.cc (Workqueue::add_blocker): New function.
12044         * workqueue.h (class Workqueue): Declare add_blocker.
12045
12046         * fileread.cc (Input_file::open): Remove options parameter.
12047         Change all callers.
12048         (Input_file::open_binary): Likewise.
12049         * script.cc (read_input_script): Likewise.
12050         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12051         options parameter from constructor.  Change all callers.
12052         (class Read_script): Likewise.
12053         * fileread.h (class Input_file): Update declarations.
12054         * script.h (read_input_script): Update declaration.
12055
12056 2009-03-10  Nick Clifton  <nickc@redhat.com>
12057
12058         * po/es.po: New Spanish translation.
12059
12060 2009-03-06  Cary Coutant  <ccoutant@google.com>
12061
12062         * options.cc (parse_short_option): Keep dash_z from registering itself.
12063
12064 2009-03-03  Ian Lance Taylor  <iant@google.com>
12065
12066         PR 9918
12067         * target-reloc.h (relocate_section): Pass output_section to
12068         relocate.
12069         * i386.cc (Target_i386::should_apply_static_reloc): Add
12070         output_section parameter.  Change all callers.
12071         (Target_i386::Relocate::relocate): Add output_section parameter.
12072         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12073         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12074         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12075         * testsuite/two_file_shared.sh: New script.
12076         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12077         (check_DATA): Add two_file_shared.dbg.
12078         (two_file_shared.dbg): New target.
12079         * testsuite/Makefile.in: Rebuild.
12080
12081 2009-03-01  Ian Lance Taylor  <iant@google.com>
12082
12083         * configure.ac: Check for byteswap.h.
12084         * configure: Rebuild.
12085         * config.in: Rebuild.
12086
12087 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12088
12089         * layout.cc (Layout::find_or_add_kept_section): New function.
12090         (Layout::add_comdat): Removed.
12091         * layout.h (struct Kept_section): Move out of class Layout.
12092         Remove trailing underscores from field names.  Add group_sections
12093         field.  Rename group_ field to is_group.  Change all uses.
12094         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12095         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12096         comdat_groups_ field.
12097         (Sized_relobj::include_section_group): Use
12098         find_or_add_kept_section and Kept_section::group_sections.
12099         (Sized_relobj::include_linkonce_section): Likewise.
12100         * object.cc (class Sized_relobj): Don't define Comdat_group or
12101         Comdat_group_table.  Remove find_comdat_group and
12102         add_comdat_group.  Remove comdat_groups_ field.
12103         * plugin.cc (include_comdat_group): Use
12104         Layout::find_or_add_kept_section.
12105
12106 2009-02-28  Ian Lance Taylor  <iant@google.com>
12107
12108         * README: --gc-sections and map files are now supported.  Document
12109         some build requirements.
12110
12111         PR 6992
12112         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12113         relocatable link set the value of the section symbol to zero.
12114         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12115         relocatable link don't include the section address in the local
12116         symbol value.
12117
12118 2009-02-27  Ian Lance Taylor  <iant@google.com>
12119
12120         PR 6811
12121         * options.h (class Search_directory): Add is_system_directory.
12122         (class General_options): Declare is_in_system_directory.
12123         * options.cc (get_relative_sysroot): Make static.
12124         (get_default_sysroot): Make static.
12125         (General_optoins::is_in_system_directory): New function.
12126         * fileread.cc (Input_file::is_in_system_directory): New function.
12127         * fileread.h (class Input_file): Declare is_in_system_directory.
12128         * object.h (class Object): Add is_in_system_directory.
12129         (class Input_objects): Remove system_library_directory_ field.
12130         * object.cc (Input_objects::add_object): Don't set
12131         system_library_directory_.
12132         (input_objects::found_in_system_library_directory): Remove.
12133         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12134         parameter.  Change all callers.
12135         (Symbol_table::sized_write_globals): Likewise.
12136         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12137         Call Object::is_in_system_directory.
12138         * symtab.h (class Symbol_table): Update declarations.
12139
12140         PR 5990
12141         * descriptors.h (Open_descriptor): Add is_on_stack field.
12142         * descriptors.cc (Descriptors::open): If the descriptor is on the
12143         top of the stack, remove it.  Initialize is_on_stack field.
12144         (Descriptors::release): Only add pod to stack if it is not on the
12145         stack already.
12146         (Descriptors::close_some_descriptor): Clear stack_next and
12147         is_on_stack fields.
12148
12149         PR 7091
12150         * output.cc (Output_section::find_starting_output_address): Rename
12151         from starting_output_address; add PADDR parameter; change return
12152         type.
12153         * output.h (class Output_section): Declare
12154         find_starting_output_address instead of starting_output_address.
12155         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12156         section symbol for which we can't find a merge section.
12157
12158         PR 9836
12159         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12160         hidden or internal, force the symbol to be local.
12161         * resolve.cc (Symbol::override_visibility): Define.
12162         (Symbol::override_base): Use override_visibility.
12163         (Symbol_table::resolve): Likewise.
12164         (Symbol::override_base_with_special): Likewise.
12165         (Symbol_table::override_with_special): If the visibility is hidden
12166         or internal, force the symbol to be local.
12167         * symtab.h (class Symbol): Add set_visibility and
12168         override_visibility.
12169         * testsuite/ver_test_1.sh: New file.
12170         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12171         (check_DATA): Add ver_test_1.syms.
12172         (ver_test_1.syms): New target.
12173         * testsuite/Makefile.in: Rebuild.
12174
12175 2009-02-25  Cary Coutant  <ccoutant@google.com>
12176
12177         * layout.cc (Layout::choose_output_section): Don't rename sections
12178         when using a linker script that has a SECTIONS clause.
12179         * Makefile.in: Regenerate.
12180
12181         * testsuite/Makefile.am (script_test_5.sh): New test case.
12182         * testsuite/Makefile.in: Regenerate.
12183         * testsuite/script_test_5.cc: New file.
12184         * testsuite/script_test_5.sh: New file.
12185         * testsuite/script_test_5.t: New file.
12186
12187 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12188
12189         * archive.cc (Archive::include_member): Update calls to add_symbols.
12190         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12191         the Layout argument.
12192         * dynobj.h (do_add_symbols): Add the Layout argument.
12193         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12194         Layout argument.
12195         * object.h (Object::add_symbols): Add the Layout argument.
12196         (Object::do_add_symbols): Add the Layout argument.
12197         (Sized_relobj::do_add_symbols): Add the Layout argument.
12198         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12199         Unify the two versions.
12200         (Add_plugin_symbols): Remove.
12201         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12202         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12203         (Add_plugin_symbols): Remove.
12204         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12205         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12206         (Add_symbols::run): Make it work with Pulginobj.
12207
12208 2009-02-06  Ian Lance Taylor  <iant@google.com>
12209
12210         * object.cc (Sized_relobj::do_layout): Make info message start
12211         with lower case letter.
12212
12213 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12214
12215         * binary.cc: Fix file comment.
12216
12217         * options.h (enum Incremental_disposition): Define.
12218         (class General_options): Add new options: --incremental,
12219         --incremental_changed, --incremental_unchanged,
12220         --incremental_unknown.  Add incremental_disposition_ and
12221         implicit_incremental_ fields.
12222         (General_options::incremental_disposition): New function.
12223         (class Position_dependent_options): Add incremental_disposition
12224         option.
12225         (Position_dependent_options::copy_from_options): Set incremental
12226         dispositions.
12227         * options.cc (General_options::parse_incremental_changed): New
12228         function.
12229         (General_options::parse_incremental_unchanged): New function.
12230         (General_options::parse_incremental_unknown): New function.
12231         (General_options::General_options): Initialize new fields
12232         incremental_disposition_ and implicit_incremental_.
12233         (General_options::finalize): Check for uasge of --incremental-*
12234         without --incremental.
12235
12236 2009-02-06  Chris Demetriou  <cgd@google.com>
12237
12238         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12239         pointer and to report location as the file name associated with
12240         the symbol.
12241         (gold_undefined_symbol_at_location): New function to replace the
12242         old gold_undefined_symbol functionality.
12243         * target-reloc.h (relocate_section): Update to use
12244         gold_undefined_symbol_at_location.
12245         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12246         Call gold_undefined_symbol function rather than gold_error.
12247         * errors.h (Errors::undefined_symbol): Take location as a
12248         string, rather than calculating it from a relocation.
12249         * errors.cc (Errors::fatal): Print "fatal error:" before the
12250         formatted message.
12251         (Errors::error, Errors::error_at_location): Print "error: "
12252         before the formatted message.
12253         (Errors::undefined_symbol): Take location as a string, rather
12254         than calculating it from a relocation.
12255         (gold_undefined_symbol_at_location): New function akin to
12256         old gold_undefined_symbol, calculates location from relocation.
12257         (gold_undefined_symbol): Change to take only a Symbol pointer
12258         and to report location as the file name associated with the symbol.
12259         * testsuite/debug_msg.sh: Update for changed error messages.
12260         * testsuite/undef_symbol.sh: Likewise.
12261
12262 2009-02-04  Duncan Sands  <baldrick@free.fr>
12263
12264         PR 9812
12265         * reduced_debug_output.h
12266         (Output_reduced_debug_abbrev_section::failed): Use format for
12267         gold_warning.
12268         (Output_reduced_debug_info_section::faild): Likewise.
12269
12270 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12271
12272         * script.cc (Lazy_demangler): New class.
12273         (Version_script_info::get_symbol_version_helper): Demangle a
12274         symbol only once.
12275
12276 2009-01-29  Cary Coutant  <ccoutant@google.com>
12277
12278         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12279         to __tls_get_addr.
12280         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12281
12282 2009-01-28  Ian Lance Taylor  <iant@google.com>
12283
12284         * version.cc (version_string): Bump to 1.9.
12285
12286         * gold.h: Include <cstring> and <stdint.h>.
12287         * version.cc: Include <cstdio>.
12288         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12289         warning.
12290         * reduced_debug_output.cc (insert_into_vector): Rename from
12291         Insert_into_vector; change all callers.  Use Swap_unaligned to
12292         avoid aliasing issue; remove union since it is unnecessary.
12293
12294 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12295
12296         * Makefile.am (CCFILES): Add gc.cc.
12297         (HFILES): Add gc.h.
12298         * Makefile.in: Regenerate.
12299         * gold.cc (Gc_runner): New class.
12300         (queue_initial_tasks): Call garbage collection related tasks
12301         when corresponding options are invoked.
12302         (queue_middle_gc_tasks): New function.
12303         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12304         processed early before laying out sections during garbage collection.
12305         * gold.h (queue_middle_gc_tasks): New function.
12306         (is_prefix_of): Move from "layout.cc".
12307         * i386.cc (Target_i386::gc_process_relocs): New function.
12308         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12309         * main.cc (main): Create object of class "Garbage_collection".
12310         * object.cc (Relobj::copy_symbols_data): New function.
12311         (Relobj::is_section_name_included): New function.
12312         (Sized_relobj::do_layout): Allow this function to be called twice
12313         during garbage collection and defer layout of section during the
12314         first call.
12315         * object.h (Relobj::get_symbols_data): New function.
12316         (Relobj::is_section_name_included): New function.
12317         (Relobj::copy_symbols_data): New function.
12318         (Relobj::set_symbols_data): New function.
12319         (Relobj::get_relocs_data): New function.
12320         (Relobj::set_relocs_data): New function.
12321         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12322         (Relobj::gc_process_relocs): New function.
12323         (Relobj::do_gc_process_relocs): New pure virtual function.
12324         (Relobj::sd_): New data member.
12325         (Sized_relobj::is_output_section_offset_invalid): New function.
12326         (Sized_relobj::do_gc_process_relocs): New function.
12327         * options.h (General_options::gc_sections): Modify to not be a no-op.
12328         (General_options::print_gc_sections): New option.
12329         * plugin.cc (Plugin_finish::run): Remove function call to
12330         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12331         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12332         * reloc.cc (Read_relocs::run): Add task to process relocs and
12333         determine unreferenced sections when doing garbage collection.
12334         (Gc_process_relocs): New class.
12335         (Sized_relobj::do_gc_process_relocs): New function.
12336         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12337         sections that are garbage collected.
12338         * reloc.h (Gc_process_relocs): New class.
12339         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12340         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12341         symbols whose corresponding sections are garbage collected.
12342         (Symbol_table::Symbol_table): Add new parameter for the garbage
12343         collection object.
12344         (Symbol_table::gc_mark_undef_symbols): New function.
12345         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12346         (Symbol_table::gc_mark_dyn_syms): New function.
12347         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12348         as garbage.
12349         (Symbol_table::add_from_object): Likewise.
12350         (Symbol_table::add_from_relobj): When building shared objects, do not
12351         treat externally visible symbols as garbage.
12352         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12353         table information for static and relocatable links.
12354         * symtab.h (Symbol_table::set_gc): New function.
12355         (Symbol_table::gc): New function.
12356         (Symbol_table::gc_mark_undef_symbols): New function.
12357         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12358         (Symbol_table::gc_mark_dyn_syms): New function.
12359         (Symbol_table::gc_): New data member.
12360         * target.h (Sized_target::gc_process_relocs): New pure virtual
12361         function.
12362         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12363         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12364
12365 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12366
12367         * options.h (General_options::gc_sections): Define as a no-op for now.
12368         (General_options::no_keep_memory): Ditto.
12369         (General_options::Bshareable): Define.
12370         * options.cc (General_options::finalize): Honor -Bshareable.
12371
12372 2009-01-20  Andreas Schwab  <schwab@suse.de>
12373
12374         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12375         read the value in the contents, since we don't use it.  Use the
12376         template endianness when writing.
12377         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12378
12379 2009-01-19  Andreas Schwab  <schwab@suse.de>
12380
12381         * configure.tgt (powerpc64-*): Fix targ_obj.
12382
12383 2009-01-15  Ian Lance Taylor  <iant@google.com>
12384
12385         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12386         local symbols when stripping all symbols.
12387
12388 2009-01-14  Cary Coutant  <ccoutant@google.com>
12389
12390         * output.cc (Output_reloc): Add explicit instantiations.
12391
12392 2009-01-14  Cary Coutant  <ccoutant@google.com>
12393
12394         * archive.cc (Archive::get_elf_object_for_member): Remove call
12395         to File_read::claim_for_plugin.
12396         * descriptors.cc (Descriptors::open): Remove reference to
12397         is_claimed.
12398         (Descriptors::claim_for_plugin): Remove.
12399         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12400         (Descriptors::is_claimed): Remove.
12401         (claim_descriptor_for_plugin): Remove.
12402         * fileread.cc (File_read::claim_for_plugin): Remove.
12403         * fileread.h (File_read::claim_for_plugin): Remove.
12404         (File_read::descriptor): Reopen descriptor if necessary.
12405         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12406         (Plugin_manager::all_symbols_read): Add task parameter. Change
12407         all callers.
12408         (Plugin_manager::get_input_file): New function.
12409         (Plugin_manager::release_input_file): New function.
12410         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12411         corresponding data member.
12412         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12413         and pass to base constructor. Change all callers.
12414         (get_input_file, release_input_file): New functions.
12415         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12416         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12417         (Plugin_manager::all_symbols_read): Add task parameter.
12418         (Plugin_manager::get_input_file): New function.
12419         (Plugin_manager::release_input_file): New function.
12420         (Plugin_manager::task_): New data member.
12421         (Pluginobj::Pluginobj): Add filesize parameter.
12422         (Pluginobj::filename): New function.
12423         (Pluginobj::descriptor): New function.
12424         (Pluginobj::filesize): New function.
12425         (Pluginobj::filesize_): New data member.
12426         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12427         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12428         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12429
12430         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12431         with archive libraries.
12432         * testsuite/Makefile.in: Regenerate.
12433         * testsuite/plugin_test.c (struct sym_info): New type.
12434         (get_input_file, release_input_file): New static variables.
12435         (onload): Capture new transfer vector entries.
12436         (claim_file_hook): Stop reading at end of file according to filesize.
12437         Factor out parsing of readelf output into separate function.
12438         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12439         APIs and get the source file name from the symbol table.  Convert
12440         source file name to corresponding object file name.  Print info
12441         message when adding new input files.
12442         (parse_readelf_line): New function.
12443         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12444         * testsuite/plugin_test_2.sh: Likewise.
12445         * testsuite/plugin_test_3.sh: Likewise.
12446         * testsuite/plugin_test_4.sh: New test case.
12447
12448 2009-01-07  Ian Lance Taylor  <iant@google.com>
12449
12450         * version.cc (version_string): Bump to 1.8.
12451
12452 2008-12-23  Cary Coutant  <ccoutant@google.com>
12453
12454         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12455         * plugin.cc (Plugin_manager::finish): Rename as
12456         layout_deferred_objects.  Move cleanup to separate function.
12457         (Plugin_manager::cleanup): New function.
12458         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12459         separately.
12460         * plugin.h (Plugin_manager::finish): Rename as
12461         layout_deferred_objects.
12462         (Plugin_manager::cleanup): New function.
12463         (Plugin_manager::cleanup_done): New field.
12464
12465 2008-12-23  Cary Coutant  <ccoutant@google.com>
12466
12467         * plugin.cc (is_visible_from_outside): New function.
12468         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12469         so we don't return "IR only" status for exported symbols or -r links.
12470
12471         * testsuite/Makefile.am (plugin_test_3): New test case.
12472         * testsuite/Makefile.in: Regenerate.
12473         * testsuite/plugin_test_3.sh: New file.
12474
12475 2008-12-22  Cary Coutant  <ccoutant@google.com>
12476
12477         * object.cc (Sized_relobj::layout_section): New function.
12478         (Sized_relobj::do_layout): Defer layout of input sections until after
12479         plugin has provided replacement files.
12480         (Sized_relobj::do_layout_deferred_sections): New function.
12481         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12482         (Relobj::layout_deferred_sections): New function.
12483         (Relobj::do_layout_deferred_sections): New function.
12484         (Sized_relobj::do_layout_deferred_sections): New function.
12485         (Sized_relobj::layout_section): New function.
12486         (Sized_relobj::Deferred_layout): New structure.
12487         (Sized_relobj::deferred_layout_): New field.
12488         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12489         Change all callers.  Layout deferred sections.
12490         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12491         references.
12492         (Plugin_hook::run): Move code from do_plugin_hook inline.
12493         (Plugin_hook::do_plugin_hook): Remove.
12494         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12495         (Plugin_manager::finish): Renamed, was cleanup.
12496         (Plugin_manager::should_defer_layout): New function.
12497         (Plugin_manager::add_deferred_layout_object): New function.
12498         (Plugin_manager::Deferred_layout_list): New type.
12499         (Plugin_manager::deferred_layout_objects_): New field.
12500         (Plugin_hook::do_plugin_hook): Remove.
12501
12502 2008-12-17  Ian Lance Taylor  <iant@google.com>
12503
12504         * options.h (class General_options): Add --no case for
12505         --export-dynamic.
12506
12507 2008-12-16  Cary Coutant  <ccoutant@google.com>
12508
12509         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12510         vector.
12511         (Plugin_manager::claim_file): Create plugin object even if
12512         plugin did not call the add_symbols callback.
12513         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12514         asking for more symbols than were added.
12515         * testsuite/Makefile.am (plugin_test_1): Add test case with
12516         no global symbols.
12517         (empty.syms): New target.
12518         * testsuite/Makefile.in: Regenerate.
12519         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12520         message. Don't call add_symbols if no globals.
12521         (all_symbols_read_hook): Don't provide replacement for empty
12522         claimed file.
12523
12524 2008-12-12  Ian Lance Taylor  <iant@google.com>
12525
12526         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12527         r_type == 0 for a local symbol with r_sym == 0.
12528         (scan_relocatable_relocs): Pass r_sym to
12529         local_non_section_strategy.
12530         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12531         r_sym parameter.
12532
12533         * configure.ac: Update test for TLS descriptors: they are
12534         supported as of glibc 2.9.
12535         * configure: Rebuild.
12536
12537 2008-12-11  Ian Lance Taylor  <iant@google.com>
12538
12539         PR 7091
12540         * target-reloc.h (Default_scan_relocatable_relocs): For each
12541         function, map r_type == 0 to RELOC_DISCARD.
12542
12543 2008-12-10  Cary Coutant  <ccoutant@google.com>
12544
12545         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12546         object to override a kept COMDAT group from a plugin object.
12547
12548 2008-12-09  Ian Lance Taylor  <iant@google.com>
12549
12550         PR 7088
12551         * yyscript.y (file_cmd): Handle INPUT.
12552
12553         * testsuite/initpri1.c: Change all declarations to be full
12554         prototypes by adding void, to avoid compiler warnings.
12555
12556 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12557
12558         * options.cc (General_options::parse_plugin_opt): New.
12559         (General_options::add_plugin): The argument now is just the filename.
12560         (General_options::add_plugin_option): New.
12561         * options.h (plugin_opt): New.
12562         (add_plugin): Change argument name.
12563         (add_plugin_option): New.
12564         * plugin.cc (Plugin::load): Don't parse the plugin option.
12565         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12566         (Plugin::add_option): New.
12567         (Plugin::args_): Change type.
12568         (Plugin::filename_): New.
12569         (Plugin_manager::add_plugin_option): New.
12570         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12571         * testsuite/Makefile.in: Regenerate.
12572
12573 2008-12-05  Cary Coutant  <ccoutant@google.com>
12574
12575         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12576         Handle --strip-lto-sections option.
12577         * options.h (strip_lto_sections): New option.
12578
12579 2008-12-01  Cary Coutant  <ccoutant@google.com>
12580
12581         * plugin.cc (ld_plugin_message): Change format parameter to const.
12582         Fix mismatch between new[] and delete.
12583
12584 2008-11-14  Cary Coutant  <ccoutant@google.com>
12585
12586         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12587         instead of -1U.
12588
12589 2008-11-05  Craig Silverstein  <csilvers@google.com>
12590
12591         * options.cc (General_options::parse_dynamic_list): New function.
12592         * options.h (General_options): New flags dynamic_list,
12593         dynamic_list_data, dynamic_list_cpp_new, and
12594         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12595         (General_options::in_dynamic_list): New function.
12596         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12597         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12598         (Lex::can_continue_name): Likewise.
12599         (yylex): Likewise.
12600         (read_script_file): New parameter script_options.
12601         (read_dynamic_list): New function.
12602         (Script_options::define_dynamic_list): New function.
12603         (dynamic_list_keyword_parsecodes): New variable.
12604         (dynamic_list_keywords): New variable.
12605         * script.h (Script_options::define_dynamic_list): New function
12606         prototype.
12607         (read_dynamic_list): New function prototype.
12608         * symtab.cc (strprefix): New macro.
12609         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12610         dynamic_list_data, dynamic_list_cpp_new, and
12611         dynamic_list_cpp_typeinfo.
12612         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12613         (dynamic_list_expr): New rule.
12614         (dynamic_list_nodes): Likewise.
12615         (dynamic_list_node): Likewise.
12616         * testsuite/Makefile.am (dynamic_list): New test.
12617         * testsuite/Makefile.in: Regenerated.
12618         * testsuite/dynamic_list.t: New file.
12619         * testsuite/dynamic_list.sh: New file.
12620
12621 2008-11-05  Craig Silverstein  <csilvers@google.com>
12622
12623         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12624         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12625         (t11_last): Likewise.
12626         * testsuite/ver_test_6.c (main): Likewise.
12627
12628 2008-10-07  Cary Coutant  <ccoutant@google.com>
12629
12630         * options.c (General_options::finalize): Add check for -static and
12631         -shared.
12632         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12633         is not empty.
12634
12635 2008-10-02  Cary Coutant  <ccoutant@google.com>
12636
12637         * plugin.cc (make_sized_plugin_object): Fix conditional
12638         compilation to work when not all targets are enabled.
12639
12640 2008-09-29  Cary Coutant  <ccoutant@google.com>
12641
12642         * archive.cc (Archive::get_file_and_offset): Use filename instead
12643         of name to get library path.
12644         (Archive::include_member): Unlock external member of a thin archive.
12645
12646         * testsuite/Makefile.am (TEST_AR): New variable.
12647         (thin_archive_test_1): New test.
12648         (thin_archive_test_2): New test.
12649         * testsuite/Makefile.in: Regenerate.
12650         * testsuite/thin_archive_main.cc: New file.
12651         * testsuite/thin_archive_test_1.cc: New file.
12652         * testsuite/thin_archive_test_2.cc: New file.
12653         * testsuite/thin_archive_test_3.cc: New file.
12654         * testsuite/thin_archive_test_4.cc: New file.
12655
12656 2008-09-29  Cary Coutant  <ccoutant@google.com>
12657
12658         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12659         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12660         instead of -1U.
12661         (Sized_relobj::do_finalize_local_symbols): Likewise.
12662         (Sized_relobj::map_to_kept_section): Likewise.
12663         * object.h (Sized_relobj::invalid_address): New constant.
12664         (Sized_relobj::do_output_section_offset): Check for invalid_address
12665         and return -1ULL.
12666         * output.cc (Output_reloc::local_section_offset): Use constant
12667         invalid_address instead of -1U.
12668         (Output_reloc::get_address): Likewise.
12669         (Output_section::output_address): Change -1U to -1ULL.
12670         * output.h (Output_reloc::invalid_address): New constant.
12671         * reloc.cc (Sized_relobj::write_sections): Use constant
12672         invalid_address instead of -1U.
12673         (Sized_relobj::relocate_sections): Likewise.
12674         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12675         values for merge sections.
12676         * target-reloc.h (relocate_for_relocatable): Use constant
12677         invalid_address instead of -1U.
12678
12679 2008-09-19  Cary Coutant  <ccoutant@google.com>
12680
12681         Add plugin functionality for link-time optimization (LTO).
12682         * configure.ac (plugins): Add --enable-plugins option.
12683         * configure: Regenerate.
12684         * config.in: Regenerate.
12685         * Makefile.am (LIBDL): New variable.
12686         (CCFILES): Add plugin.cc.
12687         (HFILES): Add plugin.h.
12688         (ldadd_var): Add LIBDL.
12689         * Makefile.in: Regenerate.
12690
12691         * archive.cc: Include "plugin.h".
12692         (Archive::setup): Don't preread archive symbols when using a plugin.
12693         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12694         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12695         files.
12696         (Archive::include_member): Add symbols from plugin objects.
12697         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12698         * descriptors.cc (Descriptors::open): Check for file descriptors
12699         abandoned by plugins.
12700         (Descriptors::claim_for_plugin): New function.
12701         * descriptors.h (Descriptors::claim_for_plugin): New function.
12702         (Open_descriptor::is_claimed): New field.
12703         (claim_descriptor_for_plugin): New function.
12704         * fileread.cc (File_read::claim_for_plugin): New function.
12705         * fileread.h (File_read::claim_for_plugin): New function.
12706         (File_read::descriptor): New function.
12707         * gold.cc: Include "plugin.h".
12708         (queue_initial_tasks): Add task to call plugin hooks for generating
12709         new object files.
12710         * main.cc: Include "plugin.h".
12711         (main): Load plugin libraries.
12712         * object.h (Pluginobj): Declare.
12713         (Object::pluginobj): New function.
12714         (Object::do_pluginobj): New function.
12715         (Object::set_target): New function.
12716         * options.cc: Include "plugin.h".
12717         (General_options::parse_plugin): New function.
12718         (General_options::General_options): Initialize plugins_ field.
12719         (General_options::add_plugin): New function.
12720         * options.h (Plugin_manager): Declare.
12721         (General_options): Add --plugin option.
12722         (General_options::has_plugins): New function.
12723         (General_options::plugins): New function.
12724         (General_options::add_plugin): New function.
12725         (General_options::plugins_): New field.
12726         * plugin.cc: New file.
12727         * plugin.h: New file.
12728         * readsyms.cc: Include "plugin.h".
12729         (Read_symbols::do_read_symbols): Check for archive before checking
12730         for ELF file.  Call plugin hooks to claim files.
12731         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12732         from a real object file; force override when processing replacement
12733         files.
12734         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12735         (Symbol::init_base_object): Likewise.
12736         (Symbol::init_base_output_data): Likewise.
12737         (Symbol::init_base_output_segment): Likewise.
12738         (Symbol::init_base_constant): Likewise.
12739         (Symbol::init_base_undefined): Likewise.
12740         (Symbol::output_section): Assert that object is not a plugin.
12741         (Symbol_table::add_from_pluginobj): New function.
12742         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12743         undefined.
12744         (Symbol_table::sized_write_globals): Likewise.
12745         (Symbol_table::add_from_pluginobj): Instantiate template.
12746         * symtab.h (Sized_pluginobj): Declare.
12747         (Symbol::in_real_elf): New function.
12748         (Symbol::set_in_real_elf): New function.
12749         (Symbol::in_real_elf_): New field.
12750         (Symbol_table::add_from_pluginobj): New function.
12751
12752         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12753         (LIBDL): New variable.
12754         (LDADD): Add LIBDL.
12755         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12756         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12757         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12758         (MOSTLYCLEANFILES): Likewise.
12759         * testsuite/Makefile.in: Regenerate.
12760         * testsuite/plugin_test.c: New file.
12761         * testsuite/plugin_test_1.sh: New file.
12762         * testsuite/plugin_test_2.sh: New file.
12763
12764 2008-09-16  Ian Lance Taylor  <iant@google.com>
12765
12766         * target-reloc.h (relocate_section): Check whether a symbol is
12767         defined by the ABI before reporting an undefined symbol error.
12768         * target.h (Target::is_defined_by_abi): Make parameter const.
12769         (Target::do_is_defined_by_abi): Likewise.
12770         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12771         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12772         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12773         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12774         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12775         * testsuite/Makefile.in: Rebuild.
12776
12777         * fileread.cc (make_view): Add casts to avoid warning.
12778
12779 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12780
12781         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12782         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12783
12784 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12785
12786         * options.h (General_options::output_is_executable): New.
12787         (General_options::output_is_pie): New.
12788         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12789         for shared libraries.
12790         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12791
12792 2008-09-11  Chris Demetriou  <cgd@google.com>
12793
12794         * options.h (origin): New -z option.
12795         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12796         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12797         in DT_FLAGS_1.
12798
12799 2008-09-05  Cary Coutant  <ccoutant@google.com>
12800
12801         * fileread.cc (File_read::make_view): Add check for attempt to map
12802         beyond end of file.
12803
12804 2008-09-05  Cary Coutant  <ccoutant@google.com>
12805
12806         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12807         explicit instantiations.
12808
12809 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12810
12811         PR gold/6858
12812         * options.cc (General_options::finalize): Allow undefined symbols
12813         in shlibs if linking -shared.
12814
12815         PR gold/6859
12816         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12817         symbols as not needing a dynsym entry.
12818
12819 2008-08-20  Craig Silverstein  <csilvers@google.com>
12820
12821         * fileread.cc (File_read::open): Do not lock the file unless it
12822         was successfully opened.
12823
12824 2008-08-14  Cary Coutant  <ccoutant@google.com>
12825
12826         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12827         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12828         * testsuite/tls_test.cc (struct int128): 128-bit struct
12829         for testing TLS relocs with non-zero addend.
12830         (v12): New TLS variable.
12831         (t12): New test.
12832         (t_last): Add check for v12.
12833         * testsuite/tls_test.h (t12): New function.
12834         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12835
12836 2008-08-13  Ian Lance Taylor  <iant@google.com>
12837
12838         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12839         set tls_segment_ or relro_segment_.
12840         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12841         when appropriate.
12842         * output.h (Output_section::clear_is_relro): New function.
12843         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12844         sections specially even when output_data_ is empty.
12845         (Output_segment::maximum_alignment): When first section is relro,
12846         only force alignment for PT_LOAD segments.
12847         * script.cc (script_data_segment_align): New function.
12848         (script_data_segment_relro_end): New function.
12849         * script-c.h (script_data_segment_align): Declare.
12850         (script_data_segment_relro_end): Declare.
12851         * script-sections.h (class Script_sections): Declare
12852         data_segment_align and data_segment_relro_end.  Add fields
12853         segment_align_index_ and saw_relro_end_.
12854         * script-sections.cc (class Sections_element): Add set_is_relro
12855         virtual function.  Add new bool* parameter to place_orphan_here.
12856         Add get_output_section virtual function.
12857         (class Output_section_definition): Add set_is_relro.  Add new
12858         bool* parameter to place_orphan_here.  Add get_output_section.
12859         Add is_relro_ field.
12860         (Output_section_definition::Output_section_definition): Initialize
12861         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12862         and is_relro_ fields.
12863         (Output_section_definition::place_orphan_here): Add is_relro
12864         parameter.
12865         (Output_section_definition::set_section_addresses): Set relro for
12866         output section.
12867         (Output_section_definition::alternate_constraint): Likewise.
12868         (class Orphan_output_section): Add new bool* parameter to
12869         place_orphan_here.  Add get_output_section.
12870         (Orphan_output_section::place_orphan_here): Add is_relro
12871         parameter.
12872         (Script_sections::Script_sections): Initialize
12873         data_segment_align_index_ and saw_relro_end_.
12874         (Script_sections::data_segment_align): New function.
12875         (Script_sections::data_segment_relro_end): New function.
12876         (Script_sections::place_orphan): Set or clear is_relro.
12877         (Script_sections::set_section_addresses): Force alignment of first
12878         TLS section.
12879         * yyscript.y (exp): Call script_data_segment_align and
12880         script_data_segment_relro_end.
12881         * testsuite/relro_script_test.t: New file.
12882         * testsuite/relro_test.cc (using_script): Declare.
12883         (t1, t2): Test using_script.
12884         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12885         (relro_script_test_SOURCES): Define.
12886         (relro_script_test_DEPENDENCIES): Define.
12887         (relro_script_test_LDFLAGS): Define.
12888         (relro_script_test_LDADD): Define.
12889         (relro_script_test.so): New target.
12890         * testsuite/Makefile.in: Rebuild.
12891
12892 2008-08-06  Cary Coutant <ccoutant@google.com>
12893
12894         * archive.cc (Archive::total_archives, Archive::total_members)
12895         (Archive::total_members_loaded): New variables.
12896         (Archive::setup): Add parameter.  Add option to preread
12897         archive symbols.
12898         (Archive::read_armap): Add counter.
12899         (Archive::get_file_and_offset): New function.
12900         (Archive::get_elf_object_for_member): New function.
12901         (Archive::read_all_symbols): New function.
12902         (Archive::read_symbols): New function.
12903         (Archive::add_symbols): Add counters.
12904         (Archive::include_all_members): Use armap to find members if it's
12905         already built.
12906         (Archive::include_member): Skip reading symbols if already read.
12907         Factored code into Archive::get_file_and_offset and
12908         Archive::get_elf_object_for_member.  Changed call to
12909         Mapfile::report_include_archive_member.
12910         (Archive::print_stats): New function.
12911         * archive.h: Declare Object and Read_symbols_data classes.
12912         (Archive::Archive): Add initializers for new members.
12913         (Archive::setup): Add parameter.
12914         (Archive::print_stats): New function.
12915         (Archive::total_archives, Archive::total_members)
12916         (Archive::total_members_loaded): New variables.
12917         (Archive::get_file_and_offset): New function.
12918         (Archive::get_elf_object_for_member): New function.
12919         (Archive::read_all_symbols): New function.
12920         (Archive::read_symbols): New function.
12921         (Archive::Archive_member): New class.
12922         (Archive::members_): New member.
12923         (Archive::num_members_): New member.
12924         * main.cc: Include archive.h.
12925         (main): Call Archive::print_stats.
12926         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12927         archive parameter; member_name is now the fully-decorated name.
12928         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12929         * options.h: (General_options): Add --preread-archive-symbols option.
12930         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12931         Archive::setup.
12932
12933 2008-08-04  Ian Lance Taylor  <iant@google.com>
12934
12935         * symtab.h (Symbol::use_plt_offset): New function.
12936         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12937         * powerpc.cc (Relocate::relocate): Likewise.
12938         * sparc.cc (Relocate::relocate): Likewise.
12939         * x86_64.cc (Relocate::relocate): Likewise.
12940         * testsuite/weak_plt.sh: New test.
12941         * testsuite/weak_plt_main.cc: New test.
12942         * testsuite/weak_plt_shared.cc: New test.
12943         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12944         (check_PROGRAMS): Add weak_plt.
12945         (check_DATA): Add weak_plt_shared.so.
12946         (weak_plt_main_pic.o, weak_plt): New targets.
12947         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12948         * testsuite/Makefile.in: Rebuild.
12949
12950         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12951         gcctestdir/ld.
12952         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12953         * testsuite/Makefile.in: Rebuild.
12954
12955 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12956
12957         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12958         * Makefile.in: Regenerate.
12959         * po/POTFILES.in: Regenerate.
12960
12961 2008-07-29  Ian Lance Taylor  <iant@google.com>
12962
12963         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12964         symbols before other symbols.
12965         * testsuite/script_test_2.cc (test_addr): Declare.
12966         (test_addr_alias): Declare.
12967         (main): Check that test_addr and test_addr_alias have the right
12968         values.
12969         * testsuite/script_test_2.t: Define test_addr_alias and
12970         test_addr.
12971
12972 2008-07-24  Ian Lance Taylor  <iant@google.com>
12973
12974         PR 5990
12975         * descriptors.cc: New file.
12976         * descriptors.h: New file.
12977         * gold-threads.h (class Hold_optional_lock): New class.
12978         * fileread.cc: Include "descriptors.h".
12979         (File_read::~File_read): Release descriptor rather than closing
12980         it.
12981         (File_read::open) [file]: Call open_descriptor rather than open.
12982         Set is_descriptor_opened_.
12983         (File_read::open) [memory]: Assert that descriptor is not open.
12984         (File_read::reopen_descriptor): New function.
12985         (File_read::release): Release descriptor.
12986         (File_read::do_read): Make non-const.  Reopen descriptor.
12987         (File_read::read): Make non-const.
12988         (File_read::make_view): Reopen descriptor.
12989         (File_read::do_readv): Likewise.
12990         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12991         Update declarations.
12992         * layout.cc: Include "descriptors.h".
12993         (Layout::create_build_id): Use open_descriptor rather than open.
12994         * output.cc: Include "descriptors.h".
12995         (Output_file::open): Use open_descriptor rather than open.
12996         * archive.cc (Archive::const_iterator): Change Archive to be
12997         non-const.
12998         (Archive::begin, Archive::end): Make non-const.
12999         (Archive::count_members): Likewise.
13000         * archive.h (class Archive): Update declarations.
13001         * object.h (Object::read): Make non-const.
13002         * Makefile.am (CCFILES): Add descriptors.cc.
13003         (HFILES): Add descriptors.h.
13004         * Makefile.in: Rebuild.
13005
13006         PR 6716
13007         * gold.h: Always include <clocale>.  Add Solaris workarounds
13008         following code in binutils/sysdep.h.
13009
13010         PR 6048
13011         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13012         this->eh_frame_hdr_ is NULL before using it.
13013
13014         * dynobj.cc (Versions::Versions): Update comment.
13015
13016         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13017         the base version name.
13018
13019         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13020         array size plus one.
13021         (Stringpool_template::set_string_offsets): Subtract one from key
13022         before using it as an array index.
13023         (Stringpool_template::get_offset_with_length): Likewise.
13024         (Stringpool_template::write_to_buffer): Likewise.
13025         * stringpool.h (Stringpool_template::get_offset_from_key):
13026         Likewise.
13027
13028 2008-07-23  Ian Lance Taylor  <iant@google.com>
13029
13030         PR 6658
13031         * object.h (Merged_symbol_value::value): Do our best to handle a
13032         negative addend.
13033
13034         PR 6647
13035         * script.cc (Version_script_info::get_versions): Don't add empty
13036         version tag to return value.
13037         (Version_script_info::get_symbol_version_helper): Change return
13038         type to bool.  Add pversion parameter.  Change all callers.
13039         (script_register_vers_node): Don't require a non-NULL tag.
13040         * script.h (class Version_script_info): Update declarations.
13041         (Version_script_info::get_symbol_version): Change return type to
13042         bool.  Add version parameter.  Change all callers.
13043         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13044         handling.  Handle an empty version from a version script.
13045         (Symbol_table::define_special_symbol): Likewise.
13046         * testsuite/ver_test_10.script: New file.
13047         * testsuite/ver_test_10.sh: New file.
13048         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13049         (check_DATA): Add ver_test_10.syms.
13050         (ver_test_10.syms, ver_test_10.so): New target.
13051         * testsuite/Makefile.in: Rebuild.
13052
13053 2008-07-23  Simon Baldwin  <simonb@google.com>
13054
13055         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13056         to zero for undefined symbols from dynamic libraries.
13057
13058 2008-07-23  Ian Lance Taylor  <iant@google.com>
13059
13060         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13061         Change all callers.
13062         * symtab.h (class Symbol_table): Update declaration.
13063         * testsuite/ver_test_9.cc: New file.
13064         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13065         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13066         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13067         (ver_test_9.so, ver_test_9.o): New targets.
13068         * testsuite/Makefile.in: Rebuild.
13069
13070 2008-07-22  Ian Lance Taylor  <iant@google.com>
13071
13072         * options.h (class General_options): Define --check-sections.
13073         * layout.cc (Layout::set_segment_offsets): Handle
13074         --check-sections.
13075
13076         * options.h (class General_options): Define -n/--nmagic and
13077         -N/--omagic.
13078         * options.cc (General_options::finalize): For -n/--nmagic or
13079         -N/--omagic, set -static.
13080         * layout.cc (Layout::attach_allocated_section_to_segment): If
13081         -N/--omagic, don't put read-only and read-write sections in
13082         different segments.
13083         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13084         finding a read-only segment.
13085         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13086         don't set the minimum segment alignment to the common page size,
13087         and don't set the file offset to the address modulo the page size.
13088         * script-sections.cc (Script_sections::create_segments): If
13089         -n/--omagic, don't put read-only and read-write sections in
13090         different segments.
13091
13092         * cref.cc: New file.
13093         * cref.h: New file.
13094         * options.h (class General_options): Add --print-symbol-counts.
13095         * main.cc (main): Issue defined symbol report if requested.
13096         * archive.cc (Archive::interpret_header): Make into a const member
13097         function.
13098         (Archive::add_symbols): Call Input_objects::archive_start and
13099         archive_stop.
13100         (Archive::const_iterator): Define new class.
13101         (Archive::begin, Archive::end): New functions.
13102         (Archive::include_all_members): Rewrite to use iterator.
13103         (Archive::count_members): New function.
13104         * archive.h (class Archive): Update declarations.
13105         (Archive::filename): New function.
13106         * object.cc: Include "cref.h".
13107         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13108         (Sized_relobj::do_get_global_symbol_counts): New function.
13109         (Input_objects::add_object): Add object to cross-referencer.
13110         (Input_objects::archive_start): New function.
13111         (Input_objects::archive_stop): New function.
13112         (Input_objects::print_symbol_counts): New function.
13113         * object.h: Declare Cref and Archive.
13114         (Object::get_global_symbol_counts): New function.
13115         (Object::do_get_global_symbol_counts): New pure virtual function.
13116         (class Sized_relobj): Add defined_count_ field.  Update
13117         declarations.
13118         (class Input_objects): Add cref_ field.  Update constructor.
13119         Update declarations.
13120         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13121         defined_count_.
13122         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13123         symbol counts.
13124         (Sized_dynobj::do_get_global_symbol_counts): New function.
13125         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13126         defined_count_.  Update declarations.  Define Symbols typedef.
13127         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13128         parameter.  Change all callers.
13129         (Symbol_table::add_from_dynobj): Add sympointers and defined
13130         parameters.  Change all callers.
13131         * symtab.h (class Symbol_table): Update declarations.
13132         * Makefile.am (CCFILES): Add cref.cc.
13133         (HFILES): Add cref.h.
13134         * Makefile.in: Rebuild.
13135
13136 2008-07-22  Simon Baldwin  <simonb@google.com>
13137
13138         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13139         to zero when writing undefined symbols.
13140
13141 2008-07-22  Ian Lance Taylor  <iant@google.com>
13142
13143         * output.cc (Output_section::add_input_section): Don't try to
13144         merge empty merge sections.
13145
13146 2008-07-21  Craig Silverstein  <csilvers@google.com>
13147
13148         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13149         Include symbol version in error message.
13150
13151 2008-07-20  Chris Demetriou  <cgd@google.com>
13152
13153         * configure.ac (gold_cv_c_random_seed): New configured variable.
13154         (RANDOM_SEED_CFLAGS): New substituted variable.
13155         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13156         * configure: Rebuild.
13157         * Makefile.in: Likewise.
13158         * testsuite/Makefile.in: Likewise.
13159
13160 2008-07-18  Ian Lance Taylor  <iant@google.com>
13161
13162         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13163         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13164         * testsuite/ver_test_main.cc (main): Call t4.
13165         (t4, t4_2a): Define.
13166         * testsuite/ver_test_2.cc (t4_2): Define.
13167         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13168         * testsuite/ver_test_4.cc (t4_2a): Define.
13169         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13170         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13171
13172 2008-07-17  Ian Lance Taylor  <iant@google.com>
13173
13174         * dynobj.cc (Versions::add_def): If we give an error about a
13175         missing version, go ahead and create the version anyhow.
13176
13177 2008-07-10  Ian Lance Taylor  <iant@google.com>
13178
13179         Handle output sections with more than 0x7fffffff bytes.
13180         * object.h (class Relobj): Change map_to_output_ to
13181         output_sections_, and just keep a section pointer.  Change all
13182         uses.  Move comdat group support to Sized_relobj.
13183         (Relobj::is_section_specially_mapped): Remove.
13184         (Relobj::output_section): Remove poff parameter.  Change all
13185         callers.
13186         (Relobj::output_section_offset): New function.
13187         (Relobj::set_section_offset): Rewrite.
13188         (Relobj::map_to_output): Remove.
13189         (Relobj::output_sections): New function.
13190         (Relobj::do_output_section_offset): New pure virtual function.
13191         (Relobj::do_set_section_offset): Likewise.
13192         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13193         group support from Relobj.  Update declarations.
13194         (Sized_relobj::get_output_section_offset): New function.
13195         (Sized_relobj::do_output_section_offset): New function.
13196         (Sized_relobj::do_set_section_offset): New function.
13197         * object.cc (Relobj::output_section_address): Remove.
13198         (Sized_relobj::Sized_relobj): Initialize new fields.
13199         (Sized_relobj::include_section_group): Cast find_kept_object to
13200         Sized_relobj.
13201         (Sized_relobj::include_linkonce_section): Likewise.
13202         (Sized_relobj::do_layout): Use separate arrays for output section
13203         and output offset.
13204         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13205         output_sections.
13206         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13207         output_sections and section_offsets.
13208         (Sized_relobj::write_local_symbols): Likewise.
13209         (map_to_kept_section): Compute output address directly.
13210         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13211         output_sections and section_offsets.
13212         (Sized_relobj::write_sections): Likewise.
13213         (Sized_relobj::relocate_sections): Likewise.
13214         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13215         * output.h (class Output_reloc): Update declarations.  Change
13216         u2_.relobj to Sized_relobj*.
13217         (class Output_data_reloc): Change add functions to use
13218         Sized_relobj*.
13219         * output.cc (Output_reloc::Output_reloc): Change relobj to
13220         Sized_relobj*.
13221         (Output_reloc::local_section_offset): Change return type to
13222         Elf_Addr.  Use get_output_section_offset.
13223         (Output_reloc::get_address): Likewise.
13224         (Output_section::is_input_address_mapped): Don't call
13225         is_section_specially_mapped.
13226         (Output_section::output_offset): Likewise.
13227         (Output_section::output_address): Likewise.
13228         (Output_section::starting_output_address): Likewise.
13229         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13230         parameter to Sized_relobj*.
13231         (Copy_relocs::need_copy_reloc): Likewise.
13232         (Copy_relocs::save): Likewise.
13233         * copy-relocs.h (class Copy_relocs): Update declarations.
13234         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13235         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13236         * target-reloc.h (relocate_for_relocatable): Change
13237         offset_in_output_section type to Elf_Addr.  Change code that uses
13238         it as well.
13239         * layout.cc (Layout::layout): Always set *off.
13240         * mapfile.cc (Mapfile::print_input_section): Use
13241         output_section_offset.
13242         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13243         Sized_relobj*.
13244         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13245         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13246         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13247
13248 2008-07-03  Ian Lance Taylor  <iant@google.com>
13249
13250         * layout.cc (Layout::include_section): Do not discard unrecognized
13251         SHT_STRTAB sections.
13252
13253 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13254
13255         * script.cc (Lex::can_continue_name): Make '?' allowable in
13256         version-script names.
13257         * testsuite/version_script.map: Change glob pattern to use '?'
13258
13259 2008-06-30  Manish Singh  <yosh@gimp.org>
13260
13261         PR 6585
13262         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13263         Correct typo.
13264
13265 2008-06-30  Ian Lance Taylor  <iant@google.com>
13266
13267         PR 6660
13268         PR 6682
13269         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13270         versions]: Don't try to read the value in the contents, since we
13271         don't use it.  Use the template endianness when writing.
13272
13273 2008-06-25  Cary Coutant  <ccoutant@google.com>
13274
13275         * fileread.cc (File_read::make_view): Assert on zero-length view.
13276         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13277         symbol table when there are no symbols to read.
13278
13279 2008-06-23  Craig Silverstein  <csilvers@google.com>
13280
13281         * version.cc (version_string): Bump to 1.7
13282
13283 2008-06-18  Craig Silverstein  <csilvers@google.com>
13284
13285         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13286         constant 0xFFFF to type Valtype.
13287         (Powerpc_relocate_functions::rel16_ha): Likewise.
13288
13289 2008-06-17  Ian Lance Taylor  <iant@google.com>
13290
13291         * output.h (Output_section::Input_section): Initialize p2align_ to
13292         zero for Output_section_data constructors.
13293         (Output_section::Input_section::addralign): If not an input
13294         section, return the alignment of the Output_section_data.
13295         * testsuite/copy_test.cc: New file.
13296         * testsuite/copy_test_1.cc: New file.
13297         * testsuite/copy_test_2.cc: New file.
13298         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13299         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13300         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13301         (copy_test_1_pic.o, copy_test_1.so): New targets.
13302         (copy_test_2_pic.o, copy_test_2.so): New targets.
13303         * testsuite/Makefile.in: Rebuild.
13304
13305         * script-sections.cc (Script_sections::place_orphan): Initialize
13306         local variable exact.
13307
13308 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13309
13310         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13311
13312 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13313             David S. Miller  <davem@davemloft.net>
13314
13315         * powerpc.cc: New file.
13316         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13317         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13318         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13319         * Makefile.in: Rebuild.
13320
13321 2008-06-09  Ian Lance Taylor  <iant@google.com>
13322
13323         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13324         <exception>.
13325         (throwing, orig_terminate): New static variables.
13326         (terminate_handler): New static function.
13327         (t2): Set terminate handler.
13328
13329 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13330
13331         PR 6584
13332         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13333         alignment.
13334
13335 2008-05-30  Cary Coutant  <ccoutant@google.com>
13336
13337         * archive.cc (Archive::include_all_members) Correct to step
13338         over symbol table and extended name table in thin archives.
13339
13340 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13341
13342         PR 6407
13343         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13344         calculation.
13345
13346 2008-05-28  Caleb Howe  <cshowe@google.com>
13347
13348         * reduced_debug_output.cc: New file.
13349         * reduced_debug_output.h: New file.
13350         * options.h (class General_options): Add --strip-debug-non-line.
13351         * options.cc (General_options::finalize): Add strip_debug_non_line
13352         to the strip heirarchy.
13353         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13354         fields.
13355         * layout.cc: Include "reduced_debug_output.h".
13356         (Layout::Layout): Initialize new fields.
13357         (line_only_debug_sections): New static array.
13358         (is_lines_only_debug_sections): New static inline function.
13359         (Layout::include_section): Handle --strip-debug-non-line.
13360         (Layout::make_output_section): If --strip-debug-non-line, build
13361         new output sections for .debug_abbrev and .debug_info.
13362         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13363         gold.  Warn about possible overflow.
13364         (read_signed_LEB_128): Likewise.
13365         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13366         (read_signed_LEB_128): Declare.
13367         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13368         (HFILES): Add reduced_debug_output.h.
13369         * Makefile.in: Rebuild.
13370
13371 2008-05-21  Ian Lance Taylor  <iant@google.com>
13372
13373         * mapfile.cc: New file.
13374         * mapfile.h: New file.
13375         * options.h (class General_options): Add -M/--print-map and -Map.
13376         * options.cc (General_options::finalize): Make -M equivalent to
13377         -Map -.
13378         * main.cc: Include <cstdio> and "mapfile.h".
13379         (main): Open mapfile if requested.
13380         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13381         constructor.  Change caller.
13382         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13383         (queue_middle_tasks): Likewise.
13384         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13385         declarations.
13386         * archive.cc: Include "mapfile.h".
13387         (Archive::add_symbols): Add mapfile parameter.  Change all
13388         callers.  Pass mapfile, symbol, and reason to include_member.
13389         (Archive::include_all_members): Add mapfile parameter.  Change all
13390         callers.
13391         (Archive::include_member): Add mapfile, sym, and why parameters.
13392         Change all callers.  Report inclusion to map file.
13393         * archive.h: Include "fileread.h".
13394         (class Archive): Update declarations.
13395         (Archive::file): New const method.
13396         (class Add_archive_symbols): Add mapfile_ field.  Update
13397         constructor.  Change all callers.
13398         * readsyms.h (class Read_symbols): Likewise.
13399         (class Finish_group): Likewise.
13400         (class Read_script): Likewise.
13401         * common.cc: Include "mapfile.h".
13402         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13403         all callers.
13404         (Symbol_table::do_allocate_commons): Likewise.
13405         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13406         symbol allocation to mapfile.
13407         * common.h (class Allocate_commons_task): Add mapfile_ field.
13408         Update constructor.  Change all callers.
13409         * symtab.h (class Symbol_table): Update declarations.
13410         * layout.cc: Include "mapfile.h".
13411         (Layout_task_runner::run): Print information to mapfile.
13412         (Layout::create_gold_note): Change Output_data_fixed_space to
13413         Output_data_zero_fill.
13414         (Layout::create_build_id): Likewise.
13415         (Layout::print_to_mapfile): New function.
13416         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13417         constructor.  Change caller.
13418         (class Layout): Declare print_to_mapfile.
13419         * output.cc (Output_section::Input_section::print_to_mapfile): New
13420         function.
13421         (Output_section::add_input_section): If producing a map, always
13422         add to input_sections_ list.
13423         (Output_section::do_print_to_mapfile): New function.
13424         (Output_segment::print_sections_to_mapfile): New function.
13425         (Output_segment::print_section_list_to_mapfile): New function.
13426         * output.h: Include "mapfile.h".
13427         (Output_data::print_to_mapfile): New function.
13428         (Output_data::do_print_to_mapfile): New virtual function.
13429         (Output_segment_headers::do_print_to_mapfile): New function.
13430         (Output_file_header::do_print_to_mapfile): New function.
13431         (Output_data_const::do_print_to_mapfile): New function.
13432         (class Output_data_const_buffer): Add map_name_ field.  Update
13433         constructor.  Change all callers.  Add do_print_to_mapfile
13434         function.
13435         (class Output_data_fixed_space): Likewise.
13436         (class Output_data_space): Likewise.
13437         (class Output_data_zero_fill): New class.
13438         (Output_data_strtab::do_print_to_mapfile): New function.
13439         (Output_data_reloc_base::do_print_to_mapfile): New function.
13440         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13441         (Output_data_group::do_print_to_mapfile): New function.
13442         (Output_data_got::do_print_to_mapfile): New function.
13443         (Output_data_dynamic::do_print_to_mapfile): New function.
13444         (Output_symtab_xindex::do_print_to_mapfile): New function.
13445         (class Output_section): Declare do_print_to_mapflie.  Declare
13446         print_to_mapfile in Input_section.
13447         (class Output_segment): Declare new functions.
13448         * object.h (Sized_relobj::symbol_count): New function.
13449         * script-sections.cc
13450         (Output_section_element_dot_assignment::set_section_addresses):
13451         Change Output_data_fixed_space to Output_data_zero_fill.
13452         (Output_data_expression::do_print_to_mapfile): New function.
13453         * script.cc (read_input_script): Add mapfile parameter.  Change
13454         all callers.
13455         * script.h (read_input_script): Update declaration.
13456         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13457         (Eh_frame::do_print_to_mapfile): New function.
13458         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13459         (Output_merge_string::do_print_to_mapfile): New function.
13460         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13461         function.
13462         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13463         function.
13464         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13465         function.
13466         * Makefile.am (CCFILES): Add mapfile.cc.
13467         (HFILES): Add mapfile.h.
13468         * Makefile.in: Rebuild.
13469
13470 2008-05-19  Ian Lance Taylor  <iant@google.com>
13471
13472         * options.h (class General_options): Add -z relro.
13473         * layout.cc (Layout::Layout): Initialize relro_segment_.
13474         (Layout::add_output_section_data): Return the output section.
13475         (Layout::make_output_section): Rcognize relro sections and mark
13476         them appropriately.
13477         (Layout::attach_allocated_section_to_segment): Put relro sections
13478         in a PT_GNU_RELRO segment.
13479         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13480         section as relro.
13481         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13482         PT_TLS segments.
13483         (Layout::linkonce_mapping): Map d.rel.ro.local to
13484         .data.rel.ro.local.
13485         (Layout::output_section_name): Us .data.rel.ro.local for any
13486         section which begins with that.
13487         * layout.h (class Layout): Update add_output_section_data
13488         declaration.  Add relro_segment_ field.
13489         * output.cc (Output_section::Output_section): Initialize is_relro_
13490         and is_relro_local_ fields.
13491         (Output_segment::add_output_section): Group relro sections.
13492         (Output_segment::is_first_section_relro): New function.
13493         (Output_segment::maximum_alignment): If there is a relro section,
13494         align the segment to the common page size.
13495         (Output_segment::set_section_addresses): Track whether we are
13496         looking at relro sections.  If the last section is a relro
13497         section, align to the common page size.
13498         (Output_segment::set_section_list_addresses): Add in_relro
13499         parameter.  Change all callers.  Align to the page size when
13500         moving from relro to non-relro section.
13501         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13502         segment.
13503         * output.h (class Output_section): Add is_relro_ and
13504         is_relro_local_ fields.
13505         (Output_section::is_relro): New function.
13506         (Output_section::set_is_relro): New function.
13507         (Output_section::is_relro_local): New function.
13508         (Output_section::set_is_relro_local): New function.
13509         (class Output_segment): Update declarations.
13510         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13511         * sparc.cc (Target_sparc::got_section): Likewise.
13512         * x86_64.cc (Target_x86_64::got_section): Likewise.
13513         * testsuite/relro_test_main.cc: New file.
13514         * testsuite/relro_test.cc: New file.
13515         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13516         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13517         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13518         (relro_test.so, relro_test_pic.o): New targets.
13519         * testsuite/Makefile.in: Rebuild.
13520
13521 2008-05-16  Ian Lance Taylor  <iant@google.com>
13522
13523         * output.cc (Output_segment::add_output_section): Remove front
13524         parameter.
13525         * output.h (class Output_segment): Remove
13526         add_initial_output_section and overloaded add_output_section.
13527         Update declaration of remaining add_output_section.
13528         * layout.cc (Layout::create_interp): Call add_output_section
13529         rather than add_initial_output_section.
13530         (Layout::finish_dynamic_section): Likewise.
13531
13532         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13533         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13534         know the dynamic type.
13535         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13536         field.  Initialize it in constructor.
13537         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13538         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13539         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13540         reloc.
13541
13542         * output.cc (Output_reloc::get_address): Change return type to
13543         Elf_Addr.
13544         * output.h (class Output_reloc): Update get_address declaration.
13545         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13546         for section addresses.
13547
13548 2008-05-09  Ian Lance Taylor  <iant@google.com>
13549
13550         PR 6493
13551         * gold.cc (gold_nomem): Use return value of write.
13552
13553 2008-05-08  Ian Lance Taylor  <iant@google.com>
13554
13555         * symtab.c (Symbol::init_base_output_data): Add version
13556         parameter.  Change all callers.
13557         (Symbol::init_base_output_segment): Likewise.
13558         (Symbol::init_base_constant): Likewise.
13559         (Symbol::init_base_undefined): Likewise.
13560         (Sized_symbol::init_output_data): Likewise.
13561         (Sized_symbol::init_output_segment): Likewise.
13562         (Sized_symbol::init_constant): Likewise.
13563         (Sized_symbol::init_undefined): Likewise.
13564         (Symbol_table::do_define_in_output_data): If the new symbol has a
13565         version, mark it as the default.
13566         (Symbol_table::do_define_in_output_segment): Likewise.
13567         (Symbol_table::do_define_as_constant): Likewise.
13568         * symtab.h (class Symbol): Update declarations.
13569         (class Sized_symbol): Likewise.
13570         * resolve.cc (Symbol::override_version): New function.
13571         (Symbol::override_base): Call override_version.
13572         (Symbol::override_base_with_special): Likewise.
13573         * testsuite/ver_script_8.script: New file.
13574         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13575         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13576         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13577         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13578
13579 2008-05-06  Ian Lance Taylor  <iant@google.com>
13580
13581         PR 6049
13582         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13583         functions.
13584         (class General_options): Remove existing --undefined, and add
13585         --no-undefined instead.  Add new --undefined as synonym for -u.
13586         * archive.cc (Archive::add_symbols): Check whether symbol was
13587         named with -u.
13588         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13589         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13590         all uses.  Add IS_UNDEFINED.  Update declarations to split
13591         different versions of init_base.  Declare init_base_undefined.
13592         (Symbol::is_defined): Handle IS_UNDEFINED.
13593         (Symbol::is_undefined): Likewise.
13594         (Symbol::is_weak_undefined): Call is_undefined.
13595         (Symbol::is_absolute): Handle IS_CONSTANT.
13596         (class Sized_symbol): Update declarations to split different
13597         versions of init.  Declare init_undefined.
13598         (class Symbol_table): Declare new functions.
13599         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13600         Change all callers.
13601         (Symbol::init_base_output_data): Likewise.
13602         (Symbol::init_base_output_segment): Likewise.
13603         (Symbol::init_base_constant): Likewise.
13604         (Symbol::init_base_undefined): New function.
13605         (Sized_symbol::init_object): Rename from init.  Change all
13606         callers.
13607         (Sized_symbol::init_output_data): Likewise.
13608         (Sized_symbol::init_output_segment): Likewise.
13609         (Sized_symbol::init_constant): Likewise.
13610         (Sized_symbol::init_undefined): New function.
13611         (Symbol_table::add_undefined_symbols_from_command_line): New
13612         function.
13613         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13614         function.
13615         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13616         (Symbol::output_section): Likewise.
13617         (Symbol::set_output_section): Likewise.
13618         (Symbol_table::sized_finalize_symbol): Likewise.
13619         (Symbol_table::sized_write_globals): Likewise.
13620         * resolve.cc (Symbol_table::should_override): Likewise.
13621         (Symbol::override_base_with_special): Likewise.
13622
13623         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13624         symbol, change it to have default visibility.
13625         * testsuite/protected_1.cc: New file.
13626         * testsuite/protected_2.cc: New file.
13627         * testsuite/protected_3.cc: New file.
13628         * testsuite/protected_main_1.cc: New file.
13629         * testsuite/protected_main_2.cc: New file.
13630         * testsuite/protected_main_3.cc: New file.
13631         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13632         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13633         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13634         (protected_1.so): New target.
13635         (protected_1_pic.o, protected_2_pic.o): New targets.
13636         (protected_3_pic.o): New target.
13637         (check_PROGRAMS): Add protected_2.
13638         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13639         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13640         * testsuite/Makefile.in: Rebuild.
13641
13642         * options.h (DEFINE_var): Add set_user_set_##varname__.
13643         (DEFINE_bool_alias): New macro.
13644         (class General_options): Define -Bstatic using DEFINE_bool_alias
13645         rather than DEFINE_special.  Add --undefined as an alias for -z
13646         defs.
13647         * options.cc (General_options::parse_Bstatic): Remove.
13648
13649         * options.h (class General_options): Add --fatal-warnings.
13650         * main.cc (main): Implement --fatal-warnings.
13651         * errors.h (Errors::warning_count): New function.
13652
13653         * options.h (class General_options): Add -Bsymbolic-functions.
13654         * symtab.h (Symbol::is_preemptible): Check for
13655         -Bsymbolic-functions.
13656
13657 2008-05-05  Ian Lance Taylor  <iant@google.com>
13658
13659         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13660         as noVARNAME rather than no-VARNAME.
13661         (class General_options): Add option -z combreloc.
13662         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13663         get_address.
13664         (Output_reloc::sort_before) [SHT_REL]: New function.
13665         (Output_reloc::sort_before) [SHT_RELA]: New function.
13666         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13667         Sort_relocs_comparison.
13668         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13669         parameter.  Change all callers.
13670         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13671         sort_relocs parameter.  Change all callers.
13672         * output.cc (Output_reloc::get_address): New function, broken out
13673         of write_rel.
13674         (Output_reloc::write_rel): Call it.
13675         (Output_reloc::compare): New function.
13676         (Output_data_reloc_base::do_write): Optionally sort relocs.
13677
13678         * configure.ac: If targ_extra_obj is set, link it in.
13679         * configure.tgt: Initialize all variables.
13680         (x86_64*): Set targ_extra_obj and targ_extra_size.
13681         * configure: Rebuild.
13682
13683         * object.cc (Sized_relobj::include_section_group): Adjust section
13684         indexes read from group data.  Build vector to pass to
13685         layout_group.
13686         * layout.cc (Layout::layout_group): Add flags and shndxes
13687         parameters.  Remove contents parameter.  Change caller.  Update
13688         explicit instantiations.
13689         * layout.h (class Layout): Update layout_group declaration.
13690         * output.cc (Output_data_group::Output_data_group): Add flags and
13691         input_shndxes parameters.  Remove contents parameter.  Change
13692         caller.
13693         (Output_data_group::do_write): Change input_sections_ to
13694         input_shndxes_.
13695         * output.h (class Output_data_group): Update constructor
13696         declaration.  Rename input_sections_ to input_shndxes_.
13697         * testsuite/many_sections_test.cc: Add template.
13698
13699 2008-04-30  Cary Coutant  <ccoutant@google.com>
13700
13701         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13702
13703         * layout.cc (Layout::include_section): Refactored check for debug
13704         info section.
13705         (Layout::add_comdat): Add new parameters.  Change type
13706         of signature parameter.  Add object and shndx to signatures table.
13707         (Layout::find_kept_object): New function.
13708         * layout.h: Include <cstring>.
13709         (Layout::is_debug_info_section): New function.
13710         (Layout::add_comdat): Add new parameters.
13711         (Layout::find_kept_object): New function.
13712         (Layout::Kept_section): New struct.
13713         (Layout::Signatures): Change type of map range.
13714         * object.cc (Relobj::output_section_address): New function.
13715         (Sized_relobj::include_section_group): Add new parameters.  Change
13716         calls to Layout::add_comdat.  Change to build table of kept comdat
13717         groups and table mapping discarded sections to kept sections.
13718         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13719         (Sized_relobj::do_layout): Change calls to include_section_group and
13720         include_linkonce_section.
13721         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13722         value to zero when section is discarded.
13723         (Sized_relobj::map_to_kept_section): New function.
13724         * object.h (Relobj::output_section_address): New function.
13725         (Relobj::Comdat_group): New type.
13726         (Relobj::find_comdat_group): New function.
13727         (Relobj::Comdat_group_table): New type.
13728         (Relobj::Kept_comdat_section): New type.
13729         (Relobj::Kept_comdat_section_table): New type.
13730         (Relobj::add_comdat_group): New function.
13731         (Relobj::set_kept_comdat_section): New function.
13732         (Relobj::get_kept_comdat_section): New function.
13733         (Relobj::comdat_groups_): New field.
13734         (Relobj::kept_comdat_sections_): New field.
13735         (Symbol_value::input_value): Update comment.
13736         (Sized_relobj::map_to_kept_section) New function.
13737         (Sized_relobj::include_linkonce_section): Add new parameter.
13738         * target-reloc.h (Comdat_behavior): New type.
13739         (get_comdat_behavior): New function.
13740         (relocate_section): Add code to map a discarded section to the
13741         corresponding kept section when applying a relocation.
13742
13743 2008-04-30  Craig Silverstein  <csilvers@google.com>
13744
13745         * dwarf_reader.cc (next_generation_count): New static var.
13746         (Addr2line_cache_entry): New struct.
13747         (addr2line_cache): New static var.
13748         (Dwarf_line_info::one_addr2line): Added caching.
13749         (Dwarf_line_info::clear_addr2line_cache): New function.
13750         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13751         cache-size parameter.
13752         (Dwarf_line_info::one_addr2line_cache): New function.
13753         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13754         new cache-size argument to one_addr2line(), and clear cache.
13755
13756 2008-04-28  Cary Coutant  <ccoutant@google.com>
13757
13758         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13759         R_386_PC8 relocations.
13760
13761 2008-04-23  Ian Lance Taylor  <iant@google.com>
13762
13763         * object.cc (Sized_relobj::include_section_group): Check for
13764         invalid section group.
13765
13766         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13767         header size.
13768
13769         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13770         than read for file header.
13771         * archive.cc (Archive::include_member): Likewise.
13772
13773 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13774
13775         * aclocal.m4: Regenerate.
13776         * configure: Regenerate.
13777
13778 2008-04-19  Ian Lance Taylor  <iant@google.com>
13779
13780         * version.cc (version_string): Bump to 1.6.
13781
13782         * testsuite/Makefile.am (many_sections_r_test): New target.
13783         (many_sections_r_test_SOURCES): Remove.
13784         (many_sections_r_test_DEPENDENCIES): Remove.
13785         (many_sections_r_test_LDFLAGS): Remove.
13786         (many_sections_r_test_LDADD): Remove.
13787
13788         * object.cc (Sized_relobj::do_add_symbols): Always pass
13789         local_symbol_count_ to add_from_relobj.
13790
13791         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13792         every thousand variables.
13793         * testsuite/Makefile.in: Rebuild.
13794
13795         * object.cc (Xindex::initialize_symtab_xindex): New function.
13796         (Xindex::read_symtab_xindex): New function.
13797         (Xindex::sym_xindex_to_shndx): New function.
13798         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13799         available.
13800         (Sized_relobj::do_initialize_xindex): New function.
13801         (Sized_relobj::do_read_symbols): Adjust section links.
13802         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13803         parameter.  Change all callers.
13804         (Sized_relobj::include_section_group): Adjust section links and
13805         symbol section indexes.
13806         (Sized_relobj::do_layout): Adjust section links.
13807         (Sized_relobj::do_count_local_symbols): Adjust section links and
13808         symbol section indexes.
13809         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13810         ordinary and special symbols.
13811         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13812         dynsym_xindex parameters.  Change all callers.  Adjust section
13813         links.  Use SHN_XINDEX when needed.
13814         (Sized_relobj::get_symbol_location_info): Adjust section links.
13815         Don't get fooled by special symbols.
13816         * object.h (class Xindex): Define.
13817         (class Object): Add xindex_ parameter.  Declare virtual functoin
13818         do_initialize_xindex.
13819         (Object::adjust_sym_shndx): New function.
13820         (Object::set_xindex): New protected function.
13821         (class Symbol_value): Add is_ordinary_shndx_ field.
13822         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13823         (Symbol_value::value): Assert ordinary section.
13824         (Symbol_value::initialize_input_to_output_map): Likewise.
13825         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13826         Change all callers.
13827         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13828         all callers.
13829         (class Sized_relobj): Update declarations.
13830         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13831         parameter.  Change all callers.
13832         (Sized_relobj::adjust_shndx): New function.
13833         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13834         field.
13835         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13836         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13837         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13838         (Sized_dynobj::read_dynsym_section): Adjust section links.
13839         (Sized_dynobj::read_dynamic): Likewise.
13840         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13841         section links.
13842         (Sized_dynobj::do_initialize_xindex): New function.
13843         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13844         do_initialize_xindex.
13845         (Sized_dynobj::adjust_shndx): New function.
13846         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13847         dynsym_xindex_ fields.
13848         (Layout::finalize): Add a call to set_section_indexes before
13849         creating the symtab sections.
13850         (Layout::set_section_indexes): Don't do anything if the section
13851         already has a section index.
13852         (Layout::create_symtab_sections): Add shnum parameter.  Change
13853         caller.  Create .symtab_shndx section if needed.
13854         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13855         caller.
13856         (Layout::allocated_output_section_count): New function.
13857         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13858         needed.
13859         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13860         fields.  Update declarations.
13861         (Layout::symtab_xindex): New function.
13862         (Layout::dynsym_xindex): New function.
13863         (class Write_symbols_task): Add layout_ field.
13864         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13865         Change caller.
13866         * output.cc (Output_section_headers::Output_section_headers): Add
13867         shstrtab_section parameter.  Change all callers.
13868         (Output_section_headers::do_sized_write): Store overflow values
13869         for section count and section string table section index in
13870         section header zero.
13871         (Output_file_header::do_sized_write): Check for overflow of
13872         section count and section string table section index.
13873         (Output_symtab_xindex::do_write): New function.
13874         (Output_symtab_xindex::endian_do_write): New function.
13875         * output.h (class Output_section_headers): Add shstrtab_section_.
13876         Update declarations.
13877         (class Output_symtab_xindex): Define.
13878         (Output_section::has_out_shndx): New function.
13879         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13880         field.
13881         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13882         Change all callers.
13883         (Sized_symbol::init): Likewise.
13884         (Symbol::output_section): Check for ordinary symbol.
13885         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13886         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13887         callers.
13888         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13889         Change all callers.  Simplify handling of symbols from sections
13890         not included in the link.
13891         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13892         distinction.
13893         (Weak_alias_sorter::operator()): Assert that symbols are
13894         ordinary.
13895         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13896         distinction.
13897         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13898         parameters.  Change all callers.
13899         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13900         symbol distinction.  Use SHN_XINDEX when needed.
13901         (Symbol_table::write_section_symbol): Add symtab_xindex
13902         parameter.  Change all callers.
13903         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13904         SHN_XINDEX when needed.
13905         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13906         declarations.
13907         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13908         (Symbol::is_defined): Check is_ordinary.
13909         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13910         (Symbol::is_absolute, Symbol::is_common): Likewise.
13911         (class Sized_symbol): Update declarations.
13912         (class Symbol_table): Update declarations.
13913         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13914         parameters.  Change all callers.
13915         (Sized_symbol::override): Likewise.
13916         (Symbol_table::override): Likewise.
13917         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13918         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13919         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13920         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13921         to be in an ordinary section.
13922         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13923         object and is_ordinary parameters.  Change all callers.
13924         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13925         Change all callers.  Don't add undefined or non-ordinary symbols
13926         to reloc_map_.
13927         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13928         Change all callers.
13929         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13930         declarations.
13931         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13932         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13933         (Sized_relobj::relocate_sections): Likewise.
13934         * target-reloc.h (scan_relocs): Adjust section symbol index.
13935         (scan_relocatable_relocs): Likewise.
13936         * i386.cc (Scan::local): Check for ordinary symbols.
13937         * sparc.cc (Scan::local): Likewise.
13938         * x86_64.cc (Scan::local): Likewise.
13939         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13940         to symbol_section_and_value.
13941         * testsuite/many_sections_test.cc: New file.
13942         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13943         (check_PROGRAMS): Add many_sections_test.
13944         (many_sections_test_SOURCES): Define.
13945         (many_sections_test_DEPENDENCIES): Define.
13946         (many_sections_test_LDFLAGS): Define.
13947         (BUILT_SOURCES): Add many_sections_define.h.
13948         (many_sections_define.h): New target.
13949         (BUILT_SOURCES): Add many_sections_check.h.
13950         (many_sections_check.h): New target.
13951         (check_PROGRAMS): Add many_sections_r_test.
13952         (many_sections_r_test_SOURCES): Define.
13953         (many_sections_r_test_DEPENDENCIES): Define.
13954         (many_sections_r_test_LDFLAGS): Define.
13955         (many_sections_r_test_LDADD): Define.
13956         (many_sections_r_test.o): New target.
13957         * testsuite/Makefile.in: Rebuild.
13958
13959 2008-04-17  Cary Coutant  <ccoutant@google.com>
13960
13961         * errors.cc (Errors::info): New function.
13962         (gold_info): New function.
13963         * errors.h (Errors::info): New function.
13964         * gold.h (gold_info): New function.
13965         * object.cc (Input_objects::add_object): Print trace output.
13966         * options.cc (options::parse_set): New function.
13967         (General_options::parse_wrap): Deleted.
13968         (General_options::General_options): Deleted initializer.
13969         * options.h (options::String_set): New typedef.
13970         (options::parse_set): New function.
13971         (DEFINE_set): New macro.
13972         (General_options::wrap): Changed to use DEFINE_set. Changed
13973         callers of any_wrap_symbols and is_wrap_symbol.
13974         (General_options::trace, General_options::trace_symbol):
13975         New options.
13976         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13977         (General_options::wrap_symbols_): Deleted.
13978         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13979
13980 2008-04-17  David S. Miller  <davem@davemloft.net>
13981
13982         * options.cc (General_options::parse_V): New function.
13983         * options.h: Add entries for -V and -Qy.
13984
13985 2008-04-17  Ian Lance Taylor  <iant@google.com>
13986
13987         * common.cc (Symbol_table::allocate_commons): Remove options
13988         parameter.  Change caller.
13989         (Symbol_table::do_allocate_commons): Remove options parameter.
13990         Change caller.  Just call do_allocate_commons_list twice.
13991         (Symbol_table::do_allocate_commons_list): New function, broken out
13992         of do_allocate_commons.
13993         * common.h (class Allocate_commons_task): Remove options_ field.
13994         Update constructor.
13995         * symtab.cc (Symbol_table::Symbol_table): Initialize
13996         tls_commons_.
13997         (Symbol_table::add_from_object): Put TLS common symbols on
13998         tls_commons_ list.
13999         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14000         which are IN_OUTPUT_DATA.
14001         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14002         allocate_commons and do_allocate_commons declarations.  Declare
14003         do_allocate_commons_list.
14004         * gold.cc (queue_middle_tasks): Update creation of
14005         Allocate_commons_task to not pass options.
14006         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14007         (TLS_TEST_C_FLAGS): New variable.
14008         (tls_test_c_pic.o): New target.
14009         (tls_test_shared.so): Link in tls_test_c_pic.o.
14010         (tls_test_c_pic_ie.o): New target.
14011         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14012         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14013         (tls_test_c.o): New target.
14014         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14015         (tls_pic_test_LDADD): Likewise.
14016         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14017         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14018         (tls_test_c_gnu2.o): New target.
14019         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14020         tls_test_c_gnu2.o.
14021         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14022         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14023         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14024         * testsuite/tls_test.cc: Include "config.h".
14025         (t_last): Call t11_last.
14026         * testsuite/tls_test.h (t11, t11_last): Declare.
14027         * testsuite/tls_test_c.c: New file.
14028         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14029         * configure.ac: Check for OpenMP support.
14030         * configure, config.in, Makefile.in: Rebuild.
14031         * testsuite/Makefile.in: Rebuild.
14032
14033 2008-04-16  Cary Coutant  <ccoutant@google.com>
14034
14035         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14036         (Target_i386::tls_base_symbol_defined_): New field.
14037         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14038         (Target_i386::Scan::global): Likewise.
14039         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14040         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14041         (Target_x86_64::tls_base_symbol_defined_): New field.
14042         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14043         (Target_x86_64::Scan::global): Likewise.
14044
14045 2008-04-16  Cary Coutant  <ccoutant@google.com>
14046
14047         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14048         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14049         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14050         building shared libraries.
14051         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14052         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14053         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14054         * testsuite/Makefile.in: Rebuild.
14055         * testsuite/weak_undef.h: New file.
14056         * testsuite/weak_undef_file1.cc: Add extra test cases.
14057         * testsuite/weak_undef_file2.cc: Likewise.
14058         * testsuite/weak_undef_test.cc: Likewise.
14059
14060 2008-04-16  David S. Miller  <davem@davemloft.net>
14061
14062         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14063         Add issued_non_pic_error_ field.  Declare check_non_pic.
14064         (Target_sparc::Scan::check_non_pic): New function.
14065         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14066         (Target_sparc::Scan::global): Likewise.
14067
14068         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14069         * configure: Rebuild.
14070
14071         * options.h (DEFINE_enable): New macro.
14072         (new_dtags): New enable option.
14073         (initfirst, interpose, loadfltr, nodefaultlib,
14074         nodelete, nodlopen, nodump): New -z options.
14075         * layout.cc (Layout:finish_dynamic_section): If new
14076         dtags enabled, emit DT_RUNPATH.  Also, emit a
14077         DT_FLAGS_1 containing any specified -z flags.
14078
14079 2008-04-16  Ian Lance Taylor  <iant@google.com>
14080
14081         * copy-relocs.cc: New file.
14082         * copy-relocs.h: New file.
14083         * reloc.cc: Remove Copy_relocs code.
14084         * reloc.h: Likewise.
14085         * reloc-types.h (struct Reloc_types) [both versions]: Add
14086         get_reloc_addend_noerror.
14087         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14088         variants of add_global which take an addend which must be zero.
14089         * i386.cc: Include "copy-relocs.h".
14090         (class Target_i386): Change type of copy_relocs_ to variable,
14091         update initializer.
14092         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14093         Change all callers.
14094         (Target_i386::do_finalize_sections): Change handling of
14095         copy_relocs_.
14096         * sparc.cc: Include "copy-relocs.h".
14097         (class Target_sparc): Change type of copy_relocs_ to variable,
14098         update initializer.
14099         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14100         Change all callers.
14101         (Target_sparc::do_finalize_sections): Change handling of
14102         copy_relocs_.
14103         * x86_64.cc: Include "copy-relocs.h".
14104         (class Target_x86_64): Change type of copy_relocs_ to variable,
14105         update initializer.
14106         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14107         class.  Change all callers.
14108         (Target_x86_64::do_finalize_sections): Change handling of
14109         copy_relocs_.
14110         * Makefile.am (CCFILES): Add copy-relocs.cc.
14111         (HFILES): Add copy-relocs.h.
14112
14113         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14114
14115         * testsuite/script_test_4.sh: Permit leading zeroes.
14116
14117 2008-04-15  Ian Lance Taylor  <iant@google.com>
14118
14119         * script-sections.cc (Script_sections::create_segments): Use
14120         header_size_adjustment even when there is enough room for the
14121         headers.
14122         * testsuite/script_test_4.sh: New file.
14123         * testsuite/script_test_4.t: New file.
14124         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14125         (check_DATA): Add script_test_4.stdout.
14126         (MOSTLYCLEANFILES): Likewise.
14127         (script_test_4): New target.
14128         (script_test_4.stdout): New target.
14129         * testsuite/Makefile.in: Rebuild.
14130
14131         * sparc.cc: Add definitions for Output_data_plt_sparc class
14132         constants.
14133
14134 2008-04-14  David S. Miller  <davem@davemloft.net>
14135
14136         * sparc.cc: New file.
14137         * Makefile.am (TARGETSOURCES): Add sparc.cc
14138         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14139         * configure.tgt: Document targ_extra_size and
14140         targ_extra_big_endian.  Add entries for sparc-* and
14141         sparc64-*.
14142         * configure.ac: Handle targ_extra_size and
14143         targ_extra_big_endian.
14144         * Makefile.in: Rebuild.
14145         * configure: Likewise.
14146         * po/POTFILES.in: Likewise.
14147         * po/gold.pot: Likewise.
14148
14149 2008-04-14  Ian Lance Taylor  <iant@google.com>
14150
14151         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14152         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14153         in the name/type/flags to section mapping.  Don't call
14154         allocate_output_section.
14155         (Layout::choose_output_section): Change parameter from adjust_name
14156         to is_input_section.  Don't permit input sections after sections
14157         are attached to segments.  Don't call allocate_output_section.
14158         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14159         not write_enable_output_section.
14160         (Layout::make_output_section): Don't push to
14161         unattached_section_list_ nor call attach_to_segment.  Call
14162         attach_section_to_segment if sections are attached.
14163         (Layout::attach_sections_to_segments): New function.
14164         (Layout::attach_section_to_segment): New function.
14165         (Layout::attach_allocated_section_to_segment): Rename from
14166         attach_to_segment.  Remove flags parameter.
14167         (Layout::allocate_output_section): Remove function.
14168         (Layout::write_enable_output_section): Remove function.
14169         * layout.h (class Layout): Update for above changes.  Add new
14170         field sections_are_attached_.
14171         * output.h (Output_section::update_flags_for_input_section): New
14172         function.
14173         * output.cc (Output_section::add_input_section): Call
14174         update_flags_for_input_section.
14175         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14176
14177 2008-04-11  Cary Coutant  <ccoutant@google.com>
14178
14179         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14180         thought unnecessary.
14181         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14182
14183 2008-04-11  Ian Lance Taylor  <iant@google.com>
14184
14185         * output.h (class Output_section_data): Remove inline definition
14186         of set_addralign.
14187         * output.cc (Output_section_data::set_addralign): New function.
14188
14189 2008-04-11  Cary Coutant  <ccoutant@google.com>
14190
14191         Add support for TLS descriptors for i386 and x86_64.
14192         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14193         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14194         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14195         GOT_TYPE_TLS_DESC.
14196         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14197         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14198         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14199         relocations.
14200         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14201         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14202         Fix problem with initial-exec relocations.
14203         (Target_i386::Relocate::relocate_tls): Likewise.
14204         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14205         relaxation.
14206         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14207         support for section-plus-offset dynamic table entries.
14208         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14209         (Output_data_dynamic::Dynamic_entry): Add support for
14210         section-plus-offset dynamic table entries.
14211         (Output_data_dynamic::Classification): Likewise.
14212         (Output_data_dynamic::classification_): Renamed offset_.
14213         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14214         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14215         (Target_x86_64::make_plt_section): New function.
14216         (Target_x86_64::reserve_tlsdesc_entries): New function.
14217         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14218         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14219         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14220         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14221         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14222         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14223         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14224         add extra PLT entry for TLS descriptors.
14225         (Output_data_plt_x86_64::got_): New field.
14226         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14227         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14228         fields.
14229         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14230         descriptors.
14231         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14232         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14233         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14234         R_386_TLS_DESC_CALL relocations.
14235         (Target_x86_64::Scan::global): Likewise.
14236         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14237         for TLS descriptors.
14238         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14239         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14240         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14241         GD-to-IE relaxation.
14242         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14243         and TLS_DESCRIPTORS.
14244         * Makefile.in: Rebuild.
14245         * configure: Rebuild.
14246         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14247         (tls_test_shared2.so): New target.
14248         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14249         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14250         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14251         (tls_shared_gd_to_ie_test_LDADD): New variable.
14252         (tls_shared_gnu2_gd_to_ie_test): New target.
14253         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14254         New targets.
14255         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14256         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14257         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14258         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14259         (tls_shared_gnu2_test): New target.
14260         (tls_test_gnu2_shared.so): New target.
14261         (tls_shared_gnu2_test_SOURCES): New variable.
14262         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14263         (tls_shared_gnu2_test_LDFLAGS): New variable.
14264         (tls_shared_gnu2_test_LDADD): New variable.
14265         * testsuite/Makefile.in: Rebuild.
14266         * testsuite/Makefile.
14267
14268 2008-04-11  Ian Lance Taylor  <iant@google.com>
14269
14270         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14271         justsyms.t.
14272         * testsuite/Makefile.in: Rebuild.
14273
14274         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14275         long.
14276         * testsuite/script_test_2.cc (main): Adjust test.
14277
14278 2008-04-11  David S. Miller  <davem@davemloft.net>
14279             Ian Lance Taylor  <iant@google.com>
14280
14281         * options.h (General_options): Add entries for '-Y' and
14282         '-relax'.
14283         * options.cc (General_options:finalize): If -Y was used, add those
14284         entries to the library path instead of the default "/lib" and
14285         "/usr/lib".
14286
14287 2008-04-11  David S. Miller  <davem@davemloft.net>
14288
14289         * testsuite/justsyms.t: Start at 0x100.
14290         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14291         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14292         long.
14293         * testsuite/script_test_2.cc: Adjust string and section length
14294         checks.
14295
14296 2008-04-09  Ian Lance Taylor  <iant@google.com>
14297
14298         PR gold/5996
14299         * script-sections.cc (Sections_element::allocate_to_segment): Add
14300         orphan parameter.
14301         (Output_section_definition::allocate_to_segment): Likewise.
14302         (Orphan_output_section::allocate_to_segment): Likewise.
14303         (Script_sections::attach_sections_using_phdrs_clause): Don't
14304         propagate non-PT_LOAD segments to orphan sections.
14305         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14306         readelf rather than objdump.
14307         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14308         .interp section and PT_INTERP segment are the same size.
14309         * testsuite/Makefile.in: Rebuild.
14310
14311         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14312         aliases for symbols defined in the same object.
14313         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14314         (weak_alias_test_SOURCES): New variable.
14315         (weak_alias_test_DEPENDENCIES): New variable.
14316         (weak_alias_test_LDFLAGS): New variable.
14317         (weak_alias_test_LDADD): New variable.
14318         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14319         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14320         (weak_alias_test_3.o): New target.
14321         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14322         * testsuite/weak_alias_test_main.cc: New file.
14323         * testsuite/weak_alias_test_1.cc: New file.
14324         * testsuite/weak_alias_test_2.cc: New file.
14325         * testsuite/weak_alias_test_3.cc: New file.
14326
14327 2008-04-08  Ian Lance Taylor  <iant@google.com>
14328
14329         * options.h (class General_options): Add --noinhibit-exec option.
14330         * main.cc (main): Check --noinhibit-exec.
14331
14332         * options.h (class General_options): Define --wrap as a special
14333         option.  Add wrap_symbols_ field.
14334         (General_options::any_wrap_symbols): New function.
14335         (General_options::is_wrap_symbol): New function.
14336         * options.cc (General_options::parse_wrap): New function.
14337         (General_options::General_options): Initialize wrap_symbols_.
14338         * symtab.cc (Symbol_table::wrap_symbol): New function.
14339         (Symbol_table::add_from_object): Handle --wrap.
14340         * symtab.h (class Symbol_table): Declare wrap_symbol.
14341         * target.h (Target::wrap_char): New function.
14342         (Target::Target_info): Add wrap_char field.
14343         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14344         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14345         * testsuite/testfile.cc (Target_test::test_target_info):
14346         Likewise.
14347
14348         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14349         there is one.
14350
14351         * layout.h (class Layout): Add added_eh_frame_data_ field.
14352         * layout.cc (Layout::Layout): Initialize new field.
14353         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14354         output section until we find a section we merged successfully.
14355         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14356         that the size be non-zero.
14357
14358         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14359         qualifier.
14360
14361 2008-04-08  Craig Silverstein  <csilvers@google.com>
14362
14363         * configure.ac: Export new conditional variable HAVE_ZLIB.
14364         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14365         on HAVE_ZLIB.
14366         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14367         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14368
14369 2008-04-07  Ian Lance Taylor  <iant@google.com>
14370
14371         * version.cc (version_string): Set to "1.5".
14372
14373         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14374         Add issued_non_pic_error_ field.  Declare check_non_pic.
14375         (Target_x86_64::Scan::check_non_pic): New function.
14376         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14377         (Target_x86_64::Scan::global): Likewise.
14378
14379         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14380         addend parameter.  Change caller.  Handle merge sections.
14381         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14382         Address to Addend.  Don't add in the result of
14383         local_section_offset, pass down the addend and use the returned
14384         value.
14385         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14386         Update declarations of local_section_offset and symbol_value.
14387         * testsuite/two_file_test_1.cc (t18): New function.
14388         * testsuite/two_file_test_2.cc (f18): New function.
14389         * testsuite/two_file_test_main.cc (main): Call t18.
14390         * testsuite/two_file_test.h (t18, f18): Declare.
14391
14392         * configure.ac: Don't test for objdump, c++filt, or readelf.
14393         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14394         conditionals.
14395         (TEST_READELF): New variable.
14396         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14397         (check_PROGRAMS): Add two_file_strip_test.
14398         (two_file_strip_test): New target.
14399         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14400         (two_file_same_shared_strip_test_SOURCES): New variable.
14401         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14402         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14403         (two_file_same_shared_strip_test_LDADD): New variable.
14404         (two_file_shared_strip.so): New target.
14405         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14406         (ver_test_5.syms, ver_test_7.syms): Likewise.
14407         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14408         (strip_test_3.stdout): Use TEST_OBJDUMP.
14409         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14410
14411 2008-04-04  Cary Coutant  <ccoutant@google.com>
14412
14413         * symtab.h (Symbol::is_weak_undefined): New function.
14414         (Symbol::is_strong_undefined): New function.
14415         (Symbol::is_absolute): New function.
14416         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14417         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14418         absolute symbols.
14419         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14420         (weak_undef_test): New target.
14421         * testsuite/Makefile.in: Rebuild.
14422         * testsuite/weak_undef_file1.cc: New file.
14423         * testsuite/weak_undef_file2.cc: New file.
14424         * testsuite/weak_undef_test.cc: New file.
14425
14426 2008-04-03  Craig Silverstein  <csilvers@google.com>
14427
14428         * compressed_output.h (class Output_compressed_section): Use
14429         unsigned buffer.
14430         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14431         add zlib header.
14432         (zlib_compressed_suffix): Removed.
14433         (Output_compressed_section::set_final_data_size): Use unsigned
14434         buffers.
14435         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14436         Fix linker invocation.
14437         (flagstest_o_specialfile_and_compress_debug_sections):
14438         Likewise.
14439         * testsuite/Makefile.in: Regenerated.
14440
14441 2008-04-02  David S. Miller  <davem@davemloft.net>
14442
14443         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14444         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14445
14446 2008-04-02  Craig Silverstein  <csilvers@google.com>
14447
14448         * TODO: New file.
14449
14450 2008-04-02  Ian Lance Taylor  <iant@google.com>
14451
14452         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14453         parameters.  Update for new key type to views_.  Change all
14454         callers.
14455         (File_read::read): Adjust for byteshift in returned view.
14456         (File_read::add_view): New function, broken out of
14457         find_and_make_view.
14458         (File_read::make_view): New function, broken out of
14459         find_and_make_view.
14460         (File_read::find_or_make_view): Add offset and aligned
14461         parameters.  Rewrite accordingly.  Change all callers.
14462         (File_read::get_view): Add offset and aligned parameters.  Adjust
14463         for byteshift in return value.
14464         (File_read::get_lasting_view): Likewise.
14465         * fileread.h (class File_read): Update declarations.
14466         (class File_read::View): Add byteshift_ field.  Add byteshift to
14467         constructor.  Add byteshift method.
14468         * archive.h (Archive::clear_uncached_views): New function.
14469         (Archive::get_view): Add aligned parameter.  Change all callers.
14470         * object.h (Object::get_view): Add aligned parameter.  Change all
14471         callers.
14472         (Object::get_lasting_view): Likewise.
14473
14474         * fileread.cc (File_read::release): Don't call clear_views if
14475         there are multiple objects.
14476         * fileread.h (File_read::clear_uncached_views): New function.
14477         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14478         on the archive.
14479
14480 2008-03-31  Cary Coutant  <ccoutant@google.com>
14481
14482         Add thin archive support.
14483         * archive.cc (Archive::armagt): New const.
14484         (Archive::setup): Remove task parameter and calls to unlock.
14485         (Archive::unlock_nested_archives): New function.
14486         (Archive::read_header): Add nested_off parameter. Change
14487         all callers.
14488         (Archive::interpret_header): Likewise.
14489         (Archive::include_all_members): Change to handle thin
14490         archives.
14491         (Archive::include_member): Likewise.
14492         * archive.h (Archive::Archive): Add new parameters and
14493         initializers.
14494         (Archive::armagt): New const.
14495         (Archive::setup): Remove task parameter.
14496         (Archive::unlock_nested_archives): New function.
14497         (Archive::read_header): Add nested_off parameter.
14498         (Archive::interpret_header): Likewise.
14499         (Archive::Nested_archive_table): New typedef.
14500         (Archive::is_thin_archive_): New field.
14501         (Archive::nested_archives_): New field.
14502         (Archive::options_): New field.
14503         (Archive::dirpath_): New field.
14504         (Archive::task_): New field.
14505         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14506         for thin archives.  Pass additional parameters to
14507         Archive::Archive.  Unlock the archive file after calling
14508         Archive::setup.
14509
14510 2008-03-29  Ian Lance Taylor  <iant@google.com>
14511
14512         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14513         version symbol to be local.
14514         * testsuite/ver_test_4.sh: New file.
14515         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14516         (check_DATA): Add ver_test_4.syms.
14517         (ver_test_4.syms): New target.
14518         * testsuite/Makefile.in: Rebuild.
14519
14520         * output.cc
14521         (Output_section::Input_section_sort_entry::has_priority): New
14522         function.
14523         (Output_section::Input_section_sort_entry::match_file_name): New
14524         function.
14525         (Output_section::Input_section_sort_entry::match_section_name):
14526         Remove.
14527         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14528         Remove.
14529         (Output_section::Input_section_sort_entry::match_section_file):
14530         Remove.
14531         (Output_section::Input_section_sort_compare::operator()): Rewrite
14532         using new Input_section_sort_entry functions.  Sort crtbegin and
14533         crtend first.  Sort sections with no priority before sections with
14534         a priority.
14535         * testsuite/initpri1.c (d3): Check j != 4.
14536         (cd5): New constructor/destructor function.
14537         (main): Check j != 2.
14538
14539         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14540         new symbol when resolving, don't call set_is_default.
14541         * testsuite/ver_test_7.cc: New file.
14542         * testsuite/ver_test_7.sh: New file.
14543         * testsuite/Makefile.am (ver_test_7.so): New target.
14544         (ver_test_7.o): New target.
14545         (check_SCRIPTS): Add ver_test_7.sh.
14546         (check_DATA): Add ver_test_7.syms.
14547         (ver_test_7.syms): New target.
14548
14549 2008-03-28  Ian Lance Taylor  <iant@google.com>
14550
14551         * layout.cc (Layout::layout): If we see an input section with a
14552         name that needs sorting, set the must_sort flag for the output
14553         section.
14554         (Layout::make_output_section): If the name of the output section
14555         indicates that it might require sorting, set the may_sort flag.
14556         * output.h (Output_section::may_sort_attached_input_sections): New
14557         function.
14558         (Output_section::set_may_sort_attached_input_sections): New
14559         function.
14560         (Output_section::must_sort_attached_input_sections): New
14561         function.
14562         (Output_section::set_must_sort_attached_input_sections): New
14563         function.
14564         (class Output_section): Declare Input_section_sort_entry.  Define
14565         Input_section_sort_compare.  Declare
14566         sort_attached_input_sections.  Add new fields:
14567         may_sort_attached_input_sections_,
14568         must_sort_attached_input_sections_,
14569         attached_input_sections_are_sorted_.
14570         * output.cc (Output_section::Output_section): Initialize new
14571         fields.
14572         (Output_section::add_input_section): Add an entry to
14573         input_sections_ if may_sort or must_sort are true.
14574         (Output_section::set_final_data_size): Call
14575         sort_attached_input_sections if necessary.
14576         (Output_section::Input_section_sort_entry): Define new class.
14577         (Output_section::Input_section_sort_compare::operator()): New
14578         function.
14579         (Output_section::sort_attached_input_sections): New function.
14580         * configure.ac: Check whether the compiler supports constructor
14581         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14582         * testsuite/initpri1.c: New file.
14583         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14584         CONSTRUCTOR_PRIORITY.
14585         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14586         (initpri1_LDFLAGS): New variable.
14587         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14588
14589 2008-03-27  Ian Lance Taylor  <iant@google.com>
14590
14591         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14592         * testsuite/common_test_1.c: New file.
14593         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14594         (common_test_1_SOURCES): New variable.
14595         (common_test_1_DEPENDENCIES): New variable.
14596         (common_test_1_LDFLAGS): New variable.
14597
14598         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14599         and commons_ correctly when NAME/VERSION does not override
14600         NAME/NULL.
14601         * testsuite/ver_test_6.c: New file.
14602         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14603         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14604         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14605
14606 2008-03-26  Ian Lance Taylor  <iant@google.com>
14607
14608         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14609         of an undefined symbol from a version script.
14610         * testsuite/Makefile.am (ver_test_5.so): New target.
14611         (ver_test_5.o): New target.
14612         (check_SCRIPTS): Add ver_test_5.sh.
14613         (check_DATA): Add ver_test_5.syms.
14614         (ver_test_5.syms): New target.
14615         * testsuite/ver_test_5.cc: New file.
14616         * testsuite/ver_test_5.script: New file.
14617         * testsuite/ver_test_5.sh: New file.
14618         * Makefile.in, testsuite/Makefile.in: Rebuild.
14619
14620         PR gold/5986
14621         Fix problems building gold with gcc 4.3.0.
14622         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14623         (gold_error_at_location, gold_warning_at_location): Use it.
14624         * configure.ac: Check whether we can compile and use a template
14625         function with a printf attribute.
14626         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14627         when jumping over bytes.
14628         * object.cc: Instantiate Object::read_section_data.
14629         * debug.h: Include <cstring>
14630         * dwarf_reader.cc: Include <algorithm>
14631         * main.cc: Include <cstring>.
14632         * options.cc: Include <cstring>.
14633         * output.cc: Include <cstring>.
14634         * script.cc: Include <cstring>.
14635         * script.h: Include <string>.
14636         * symtab.cc: Include <cstring> and <algorithm>.
14637         * target-select.cc: Include <cstring>.
14638         * version.cc: Include <string>.
14639         * testsuite/testmain.cc: Include <cstdlib>.
14640         * configure, config.in: Rebuild.
14641
14642 2008-03-25  Ian Lance Taylor  <iant@google.com>
14643
14644         * options.cc: Include "../bfd/bfdver.h".
14645         (options::help): Print bug reporting address.
14646
14647         * version.cc (print_version): Adjust output for current value of
14648         BFD_VERSION_STRING.
14649
14650         * NEWS: New file.
14651
14652         * options.cc (options::help): Print list of supported targets.
14653         * target-select.h: Include <vector>.
14654         (class Target_selector): Make machine_, size_, and is_big_endian_
14655         fields const.  Add bfd_name_ and instantiated_target_ fields.
14656         (Target_selector::Target_selector): Add bfd_name parameter.
14657         (Target_selector::recognize): Make non-virtual, call
14658         do_recognize.
14659         (Target_selector::recognize_by_name): Make non-virtual, call
14660         do_recognize_by_name.
14661         (Target_selector::supported_names): New function.
14662         (Target_selector::bfd_name): New function.
14663         (Target_selector::do_instantiate_target): New pure virtual
14664         function.
14665         (Target_selector::do_recognize): New virtual function.
14666         (Target_selector::do_recognize_by_name): New virtual function.
14667         (Target_selector::instantiate_target): New private function.
14668         (supported_target_names): Declare.
14669         * target-select.cc (Target_selector::Target_selector): Update for
14670         new parameter and fields.
14671         (select_target_by_name): Check that the name matches before
14672         calling recognize_by_name.
14673         (supported_target_names): New function.
14674         * i386.cc (class Target_selector_i386): Update Target_selector
14675         constructor call.  Remove recognize and recognize_by_name.  Add
14676         do_instantiate_target.
14677         * x86_64.cc (class Target_selector_x86_64): Likewise.
14678         * testsuite/testfile.cc (class Target_selector_test): Update for
14679         changes to Target_selector.
14680
14681         * README: Rewrite, with some notes on unsupported features.
14682
14683 2008-03-24  Cary Coutant  <ccoutant@google.com>
14684
14685         * i386.cc (Target_i386::Got_type): New enum declaration.
14686         (Target_i386::Scan::local): Updated callers of Output_data_got
14687         member functions.
14688         (Target_i386::Scan::global): Likewise.
14689         (Target_i386::Relocate::relocate): Likewise.
14690         (Target_i386::Relocate::relocate_tls): Likewise.
14691         * object.h (Got_offset_list): New class.
14692         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14693         (Sized_relobj::local_got_offset): Likewise.
14694         (Sized_relobj::set_local_got_offset): Likewise.
14695         (Sized_relobj::local_has_tls_got_offset): Removed.
14696         (Sized_relobj::local_tls_got_offset): Removed.
14697         (Sized_relobj::set_local_tls_got_offset): Removed.
14698         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14699         * output.cc (Output_data_got::add_global): Added got_type parameter.
14700         (Output_data_got::add_global_with_rel): Likewise.
14701         (Output_data_got::add_global_with_rela): Likewise.
14702         (Output_data_got::add_global_pair_with_rel): New function.
14703         (Output_data_got::add_global_pair_with_rela): New function.
14704         (Output_data_got::add_local): Added got_type parameter.
14705         (Output_data_got::add_local_with_rel): Likewise.
14706         (Output_data_got::add_local_with_rela): Likewise.
14707         (Output_data_got::add_local_pair_with_rel): New function.
14708         (Output_data_got::add_local_pair_with_rela): New function.
14709         (Output_data_got::add_global_tls): Removed.
14710         (Output_data_got::add_global_tls_with_rel): Removed.
14711         (Output_data_got::add_global_tls_with_rela): Removed.
14712         (Output_data_got::add_local_tls): Removed.
14713         (Output_data_got::add_local_tls_with_rel): Removed.
14714         (Output_data_got::add_local_tls_with_rela): Removed.
14715         * output.h (Output_data_got::add_global): Added got_type parameter.
14716         (Output_data_got::add_global_with_rel): Likewise.
14717         (Output_data_got::add_global_with_rela): Likewise.
14718         (Output_data_got::add_global_pair_with_rel): New function.
14719         (Output_data_got::add_global_pair_with_rela): New function.
14720         (Output_data_got::add_local): Added got_type parameter.
14721         (Output_data_got::add_local_with_rel): Likewise.
14722         (Output_data_got::add_local_with_rela): Likewise.
14723         (Output_data_got::add_local_pair_with_rel): New function.
14724         (Output_data_got::add_local_pair_with_rela): New function.
14725         (Output_data_got::add_global_tls): Removed.
14726         (Output_data_got::add_global_tls_with_rel): Removed.
14727         (Output_data_got::add_global_tls_with_rela): Removed.
14728         (Output_data_got::add_local_tls): Removed.
14729         (Output_data_got::add_local_tls_with_rel): Removed.
14730         (Output_data_got::add_local_tls_with_rela): Removed.
14731         * resolve.cc (Symbol::override_base_with_special): Removed
14732         reference to has_got_offset_ field.
14733         * symtab.cc (Symbol::init_fields): Replaced initialization
14734         of got_offset_ with got_offsets_.  Removed initialization
14735         of has_got_offset_
14736         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14737         (Symbol::got_offset): Likewise.
14738         (Symbol::set_got_offset): Likewise.
14739         (Symbol::has_tls_got_offset): Removed.
14740         (Symbol::tls_got_offset): Removed.
14741         (Symbol::set_tls_got_offset): Removed.
14742         (Symbol::got_offset_): Removed.
14743         (Symbol::tls_mod_got_offset_): Removed.
14744         (Symbol::tls_pair_got_offset_): Removed.
14745         (Symbol::got_offsets_): New field.
14746         (Symbol::has_got_offset): Removed.
14747         (Symbol::has_tls_mod_got_offset): Removed.
14748         (Symbol::has_tls_pair_got_offset): Removed.
14749         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14750         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14751         member functions.
14752         (Target_x86_64::Scan::global): Likewise.
14753         (Target_x86_64::Relocate::relocate): Likewise.
14754         (Target_x86_64::Relocate::relocate_tls): Likewise.
14755
14756 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14757
14758         * yyscript.y: Fix spelling error in comment.
14759
14760 2008-03-24  Ian Lance Taylor  <iant@google.com>
14761
14762         * options.h (class General_options): Define build_id option.
14763         * layout.h (class Layout): Declare write_build_id, create_note,
14764         create_build_id.  Add build_id_note_ member.
14765         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14766         "libiberty.h", "md5.h", "sha1.h".
14767         (Layout::Layout): Initialize eh_frame_data_,
14768         eh_frame_hdr_section_, and build_id_note_.
14769         (Layout::finalize): Call create_build_id.
14770         (Layout::create_note): New function, broken out of
14771         Layout::create_gold_note.
14772         (Layout::create_gold_note): Call create_note.
14773         (Layout::create_build_id): New function.
14774         (Layout::write_build_id): New function.
14775         (Close_task_runner::run): Call write_build_id.
14776
14777         * x86_64.cc: Correct license to GPLv3.
14778
14779 2008-03-23  Ian Lance Taylor  <iant@google.com>
14780
14781         * options.cc: Include "demangle.h".
14782         (parse_optional_string): New function.
14783         (parse_long_option): Handle takes_optional_argument.
14784         (parse_short_option): Update dash_z initializer.  Handle
14785         takes_optional_argument.
14786         (General_options::General_options): Initialize do_demangle_.
14787         (General_options::finalize): Set do_demangle_.  Handle demangling
14788         style.
14789         * options.h (parse_optional_string): Declare.
14790         (struct One_option): Add optional_arg field.  Update constructor.
14791         Update call constructor calls.  Add takes_optional_argument
14792         function.
14793         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14794         (DEFINE_optional_string): Define.
14795         (General_options::demangle): Change from DEFINE_bool to
14796         DEFINE_optional_string.
14797         (General_options::no_demangle): New function.
14798         (General_options::do_demangle): New function.
14799         (General_options::set_do_demangle): New function.
14800         (General_options::execstack_status_): Move definition to end of
14801         class definition.
14802         (General_options::static_): Likewise.
14803         (General_options::do_demangle_): New field.
14804         * object.cc (big_endian>::get_symbol_location_info): Call
14805         Options::do_demangle, not Options::demangle.
14806         * symtab.cc (demangle): Likewise.
14807
14808 2008-03-22  Ian Lance Taylor  <iant@google.com>
14809
14810         * gold.h: Include <cstddef> and <sys/types.h>
14811         * options.h: Include <cstring>.
14812
14813 2008-03-21  Ian Lance Taylor  <iant@google.com>
14814
14815         * Added source code to GNU binutils.
14816 \f
14817 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14818
14819 Copying and distribution of this file, with or without modification,
14820 are permitted in any medium without royalty provided the copyright
14821 notice and this notice are preserved.
14822
14823 Local Variables:
14824 mode: change-log
14825 left-margin: 8
14826 fill-column: 74
14827 version-control: never
14828 End: