gold/
[external/binutils.git] / gold / ChangeLog
1 2013-05-01  Cary Coutant  <ccoutant@google.com>
2
3         * stringpool.cc (Stringpool_template::new_key_offset): Fix
4         uninitialized warning.
5
6 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
7
8         * output.cc (Output_section::add_merge_input_section): Allow
9         to merge sections if the alignment is more than character size.
10         * merge.h (Output_merge_string::Output_merge_string): Remove
11         assert.
12         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
13         only not-null strings. Check the alignment of strings.
14         * stringpool.h
15         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
16         alignment as the argument.
17         (Stringpool_template<Stringpool_char>::addralign_): New class member.
18         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
19         Align non-zero length strings according to the addralign_.
20         (Stringpool_template<Stringpool_char>::set_string_offsets):
21         Updating offsets according to the given alignment.
22         * testsuite/Makefile.am (text_section_grouping): Test if string
23         literals are getting merged.
24         * testsuite/Makefile.in: Regenerate.
25         * testsuite/merge_string_literals_1.c: New file.
26         * testsuite/merge_string_literals_2.c: Ditto.
27         * testsuite/merge_string_literals.sh: Ditto.
28
29 2013-04-26  Ian Lance Taylor  <iant@google.com>
30
31         * target-reloc.h (relocate_section): If the reloc offset is out of
32         range, pass VIEW as NULL to relocate.relocate.
33         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
34         * i386.cc (Target_i386::Relocate::relocate): Likewise.
35         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
36         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
37         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
38         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
39
40 2013-04-26  Geoff Pike  <gpike@chromium.org>
41
42         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
43         * layout.cc (Hash_task): New class.
44         (Layout::queue_build_id_tasks): New function.
45         (Layout::write_build_id): Handle single-thread portion of build ID
46         computation.  (In some cases, all of it is single-threaded.)  Replace
47         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
48         functionality in fewer lines of code.
49         * layout.h (Layout::queue_build_id_tasks): New function declaration.
50         * options.h (General_options): make "--build-id" default to tree
51         rather than sha1.  Add two new options related to --build-id=tree:
52         --build-id-chunk-size-for-treehash and
53         --build-id-min-file-size-for-treehash.
54         * Makefile.am: add testing of --build-id=tree and related new options
55         (these tests will be invoked by "make check").
56         * Makefile.in: Regenerate.
57
58 2013-04-25  Alan Modra  <amodra@gmail.com>
59
60         * configure.tgt: Add powerpcle and powerpc64le.
61
62 2013-04-22  Alan Modra  <amodra@gmail.com>
63
64         PR gold/15355
65         * layout.cc (Layout::segment_precedes): Allow more than one
66         segment with the same type and flags.
67
68 2013-04-15  Cary Coutant  <ccoutant@google.com>
69
70         * layout.cc (Layout::set_relocatable_section_offsets): Don't
71         allocate space in file for BSS sections.
72
73 2013-04-15  Cary Coutant  <ccoutant@google.com>
74
75         * script-sections.cc (Orphan_output_section): Reset address
76         to zero after each orphaned section for relocatable links.
77
78 2013-04-15  Cary Coutant  <ccoutant@google.com>
79
80         * symtab.cc (Symbol_table::sized_write_globals): Subtract
81         section starting address for relocatable link.
82         * testsuite/Makefile.am (script_test_11): New test.
83         * testsuite/Makefile.in: Regenerate.
84         * testsuite/script_test_11.c: New source file.
85         * testsuite/script_test_11.t: New linker script.
86
87 2013-04-13  Alan Modra  <amodra@gmail.com>
88
89         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
90         owner when sections are not adjacent and exceed group size.
91         (Target_powerpc::group_sections): Handle corner case.
92         (Target_powerpc::Branch_info::make_stub): Handle case where
93         stub table doesn't exist due to branches in non-exec sections.
94         (Target_powerpc::Relocate::relocate): Likewise.
95
96 2013-04-11  Alan Modra  <amodra@gmail.com>
97
98         PR gold/15354
99         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
100         .branch_lt to match bfd ld.  Adjust comments throughout file.
101
102 2013-04-04  Ian Lance Taylor  <iant@google.com>
103
104         GCC PR c++/56840
105         * object.cc (do_layout_deferred_sections): Handle .eh_frame
106         sections before checking whether they are included in the link.
107
108 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
109
110         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
111         object before calling the plugin claim_file handler.  Pass the elf
112         object of the archive to the plugin. Delete the elf object if the
113         plugin claims the file.
114
115 2013-03-21  Alan Modra  <amodra@gmail.com>
116
117         * layout.cc (Layout::set_segment_offsets): Accept writable .text
118         segment when omagic.
119
120 2013-03-21  Alan Modra  <amodra@gmail.com>
121
122         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
123         comparison warning.
124         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
125         uninitialized" warning.
126
127 2013-03-20  Alan Modra  <amodra@gmail.com>
128
129         * symtab.h (Symbol::clear_version): New function.
130         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
131         is_needed by weak references.  Clear version for symbols defined
132         in as-needed objects that are not needed.
133
134 2013-03-15  Alan Modra  <amodra@gmail.com>
135
136         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
137         static and public.  Add report_err param.  Return false for data refs.
138         (Target_powerpc::rela_dyn_section): New overloaded function.
139         (Target_powerpc::plt_, iplt_): Elucidate.
140         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
141         (Output_data_plt_powerpc::do_write): Don't write .iplt.
142         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
143         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
144         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
145         push_branch and make_plt_entry for ifunc syms when
146         reloc_needs_plt_for_ifunc.
147         (Target_powerpc::Relocate::relocate): Don't use plt entry value
148         for ifunc unless reloc_needs_plt_for_ifunc.
149
150 2013-03-15  Alan Modra  <amodra@gmail.com>
151
152         * gc.h (gc_process_relocs): Don't look through function descriptors.
153         * icf.cc (get_section_contents): Do so here instead.
154
155 2013-03-13  Alan Modra  <amodra@gmail.com>
156
157         * powerpc.cc (is_branch_reloc): Forward declare.
158         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
159         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
160         false for 64-bit, true for 32-bit non-branch relocs.
161         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
162         * testsuite/Makefile.am (icf_test): Use linker map file instead of
163         nm output.
164         (icf_safe_test): Generate linker map file as well as nm output.
165         (icf_safe_so_test): Likewise.
166         * testsuite/Makefile.in: Regenerate.
167         * testsuite/icf_test.sh: Parse linker map file to determine
168         section folding.
169         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
170         * testsuite/icf_safe_so_test.sh: Likewise.
171         (X86_32_or_ARM_specific_safe_fold): Merge into..
172         (arch_specific_safe_fold): ..this.
173         (X86_64_specific_safe_fold): Delete unused function.
174
175 2013-03-12  Alan Modra  <amodra@gmail.com>
176
177         * gc.h (gc_process_relocs): Look through function descriptors
178         to determine shndx, symvalue and addend used by ICF.  Tidy
179         variable duplication.
180
181 2013-03-11  Alan Modra  <amodra@gmail.com>
182
183         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
184         * layout.cc (Layout_task_runner::run): ..to here.
185         * symtab.h (struct Symbol_location): Extract from..
186         (class Symbol_table): ..here.
187         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
188         * target.h (class Target): Add function_location and
189         do_function_location functions.
190         (class Sized_target): Add do_function_location.
191         * object.h (class Sized_relobj_file): Move find_shdr..
192         (class Object): ..to here.
193         * object.cc: Likewise.  Update to suit.  Instantiate.
194         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
195         * powerpc.cc (class Powerpc_dynobj): New.
196         (Target_powerpc::do_function_location): New function.
197         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
198         (Powerpc_dynobj::do_read_symbols): New function.
199         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
200
201 2013-03-08  Ian Lance Taylor  <iant@google.com>
202
203         * options.cc (General_options::string_to_object_format): Accept
204         "default".
205
206 2013-03-08  Alan Modra  <amodra@gmail.com>
207
208         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
209         pointer to Post_fde.
210         (struct Post_fde): Move definition to here..
211         * ehframe.cc (struct Post_fde): ..from here.
212         (Cie::write): Don't alloc Post_fde.
213         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
214
215 2013-03-07  Alan Modra  <amodra@gmail.com>
216
217         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
218         relocation referencing .LC0.
219         * testsuite/discard_locals_test.sh: Remove FIXMEs.
220
221 2013-03-07  Alan Modra  <amodra@gmail.com>
222
223         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
224         always_inline.  Add assembly for powerpc to avoid GOT.
225
226 2013-03-07  Alan Modra  <amodra@gmail.com>
227
228         * testsuite/script_test_10.sh: Don't test .bss section
229         header number.
230
231 2013-03-06  Alan Modra  <amodra@gmail.com>
232
233         * powerpc.cc (class Powerpc_relobj): Move some member functions.
234         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
235         all callers.  Handle folded sections.
236         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
237         to Powerpc_relobj.
238         (Global_symbol_visitor_opd::operator()): Likewise.
239
240 2013-03-04  Alan Modra  <amodra@gmail.com>
241
242         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
243         * testsuite/Makefile.in: Regenerate.
244
245 2013-03-01  Cary Coutant  <ccoutant@google.com>
246
247         Add dwp support for v2 DWARF package file format.
248         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
249         tu_length parameter.  Adjust all callers.
250         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
251         * dwp.cc: Include dwarf.h.
252         (Section_bounds): New struct type.
253         (Unit_set): New struct type.
254         (Dwo_file::Dwo_file): Initialize new data member.
255         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
256         Combine and rename to...
257         (Dwo_file::read_unit_index): ...this.
258         (Dwo_file::sized_read_compunit_index)
259         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
260         (Dwo_file::sized_read_unit_index): ...this.
261         (Dwo_file::copy_section): Remove section_name, is_str_offsets
262         parameters; add section_id parameter.
263         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
264         (Dwo_file::add_unit_set): ...this.
265         (Dwo_file::shndx_map_): Remove.
266         (Dwo_file::sect_offsets_): New data member.
267         (Dwp_output_file::Dwp_output_file): Initialize new data members.
268         (Dwp_output_file::add_section): Rename to...
269         (Dwp_output_file::add_contribution): ...this.
270         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
271         (Dwp_output_file::add_tu_set): Likewise.
272         (Dwp_output_file::Contribution): New type.
273         (Dwp_output_file::Section::contributions): New data member.
274         (Dwp_output_file::Cu_or_tu_set): Remove.
275         (Dwp_output_file::Section::Section): New ctor.
276         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
277         (Dwp_output_file::Dwp_index::Section_table): New type.
278         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
279         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
280         parameter.
281         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
282         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
283         (Dwp_output_file::Dwp_index::section_table): New member function.
284         (Dwp_output_file::Dwp_index::section_table_end): New member function.
285         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
286         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
287         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
288         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
289         (Dwp_output_file::Dwp_index::section_table_): New data member.
290         (Dwp_output_file::Dwp_index::section_mask_): New data member.
291         (Dwp_output_file::add_output_section): New member function.
292         (Dwp_output_file::write_new_section): New member function.
293         (Dwp_output_file::write_contributions): New member function.
294         (Dwp_output_file::section_id_map_): New data member.
295         (class Dwo_id_info_reader): Remove.
296         (class Unit_reader): New class.
297         (get_dwarf_section_name): New function.
298         (Dwo_file::read_executable): Adjust initializations of class data.
299         (Dwo_file::read): Add support for v2 package file format.
300         (Dwo_file::read_unit_index): Likewise.
301         (Dwo_file::sized_read_unit_index): Likewise.
302         (Dwo_file::copy_section): Likewise.
303         (Dwo_file::add_unit_set): Likewise.
304         (Dwp_output_file::add_output_section): Likewise.
305         (Dwp_output_file::add_contribution): Likewise.
306         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
307         for empty slot.
308         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
309         file format.
310         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
311         slot.
312         (Dwp_output_file::initialize): Remove unused function.
313         (Dwp_output_file::finalize): Add support for v2 package file format.
314         (Dwp_output_file::write_index): Likewise.
315         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
316         function prototype.
317
318 2013-03-01  Cary Coutant  <ccoutant@google.com>
319
320         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
321         function into class definition in header file.
322         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
323         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
324         New function.
325         (Dwarf_info_reader::check_buffer): Move here from .cc file.
326
327 2013-02-28  Alan Modra  <amodra@gmail.com>
328
329         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
330         * target.cc (Target::do_plt_fde_location): New function.
331         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
332         accessor function, and constructor param.
333         (struct Post_fde, Post_fdes): Declare.
334         (Cie::write): Add post_fdes param.
335         * ehframe.cc (Fde::write): Use plt_fde_location.
336         (struct Post_fde): Define.
337         (Cie::write): Stash FDEs added post merge mapping.
338         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
339         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
340         (Eh_frame::do_sized_write): Arrange to write post map FDES after
341         other FDEs.
342         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
343         (Target_powerpc::has_glink): New function.
344         (Target_powerpc::do_relax): Add eh_frame info for stubs.
345         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
346         glink_eh_frame_fde_32, default_fde): New data.
347         (Stub_table::eh_frame_added_): New var.
348         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
349         Make const.
350         (Stub_table::add_eh_frame): New function.
351         (Output_data_glink::add_eh_frame): New function.
352         (Target_powerpc::make_glink_section): Call add_eh_frame.
353
354 2013-02-15  Ian Lance Taylor  <iant@google.com>
355
356         * options.h (DEFINE_uint64_alias): Define.
357         (class General_options): Add -Ttext-segment as an alias for
358         -Ttext.
359
360 2013-02-15  Alan Modra  <amodra@gmail.com>
361
362         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
363         (Stub_table::do_write): ..here, two places.
364         (Stub_table::plt_call_size): Use it here too.
365
366 2013-02-11  Ian Lance Taylor  <iant@google.com>
367
368         * descriptors.cc (Descriptors::close_all): New function.
369         * descriptors.h (class Descriptors): Declare close_all.
370         (close_all_descriptors): New inline function.
371         * plugin.cc: Include "descriptors.h".
372         (Plugin_manager::cleanup): Call close_all_descriptors.
373
374 2013-02-06  Alan Modra  <amodra@gmail.com>
375
376         * README: Update coding style link.
377
378 2013-01-28  Cary Coutant  <ccoutant@google.com>
379
380         * dwp.cc (File_list): New typedef.
381         (Dwo_name_info_reader): New class.
382         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
383         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
384         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
385         (Dwo_file::read_executable): New function.
386         (Dwo_file::read): Move common setup code to ...
387         (Dwo_file::make_object): ... here.
388         (dwp_options): Add --exec/-e.
389         (usage): Likewise.
390         (main): Likewise.
391
392 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
393
394         * layout.cc (Layout::layout): Check for option text_reorder.
395         (Layout::make_output_section): Ditto.
396         * options.h (text_reorder): New option.
397         * output.cc (Input_section_sort_compare): Remove special ordering
398         of section names.
399         (Output_section::
400          Input_section_sort_section_name_special_ordering_compare::
401          operator()): New function.
402         (Output_section::sort_attached_input_sections): Use new sort function
403         for .text.
404         * output.h (Input_section_sort_section_name_special_ordering_compare):
405         New struct.
406         * testsuite/Makefile.am (text_section_grouping): Test option
407         --no-text-reorder
408         * testsuite/Makefile.in: Regenerate.
409         * testsuite/text_section_grouping.sh: Check order of functions without
410         default text reordering.
411
412 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
413
414         * options.h (General_options): Change default to true for new_dtags.
415
416 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
417
418         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
419         when enable_new_dtags is false.  Only add DT_RUNPATH when
420         enable_new_dtags is true.
421
422 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
423
424         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
425         used in declaration and definition consistent.
426         (Target_powerpc::symval_for_branch): Ditto.
427
428 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
429
430         * testsuite/plugin_final_layout.cc: Fix comment.
431
432 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
433
434         * layout.cc (Layout::layout): Do not do default sorting for
435         text sections when section ordering is specified.
436         (make_output_section): Ditto.
437         * testsuite/plugin_final_layout.cc: Name the function sections
438         to catch reordering issues.
439
440 2013-01-15  Alan Modra  <amodra@gmail.com>
441
442         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
443         plt-thread-safe.
444
445 2013-01-15  Alan Modra  <amodra@gmail.com>
446
447         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
448         * testsuite/Makefile.in: Regenerate.
449
450 2013-01-14  Alan Modra  <amodra@gmail.com>
451
452         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
453         * testsuite/Makefile.in: Regenerate.
454
455 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
456
457         PR bfd/14430
458         Fix mingw gold build with plugins enabled
459         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
460         * configure.ac: Export DLOPEN_LIBS and add headers check.
461         * plugin.cc: Handle non-dlfcn case.
462         * Makefile.in: Regenerate.
463         * config.in: Regenerate.
464         * configure: Regenerate.
465         * testsuite/Makefile.in: Regenerate.
466
467 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
468
469         * output.h (sort_attached_input_sections): Change to be public.
470         * script-sections.cc
471         (Output_section_definition::set_section_addresses): Sort
472         attached input sections according to section order before linker
473         script assigns section addresses.
474         (Orphan_output_section::set_section_addresses): Sort
475         attached input sections according to section order before linker
476         script assigns section addresses.
477         * Makefile.am (final_layout.sh): Use a simple linker script to
478         check if section ordering still works.
479         * Makefile.in: Regenerate.
480
481 2013-01-09  Ben Cheng  <bccheng@google.com>
482
483         * arm.cc (Target_arm::attributes_accept_div): New function.
484         (Target_arm::attributes_forbid_div): New function.
485         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
486         attribute using the same new functions as what bfd/elf32_arm.c
487         does.
488
489 2013-01-07  Cary Coutant  <ccoutant@google.com>
490
491         PR gold/14993
492         * output.cc (Output_section::add_input_section): For incremental
493         updates, don't track input sections that are allocated from patch
494         space.
495
496 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
497             Ian Lance Taylor  <iant@google.com>
498
499         PR gold/14897
500         * configure.ac (--enable-ld): Removed.
501         (install_as_default): Set to yes only for --enable-gold=default
502         or --disable-ld.
503         * configure: Regenerated.
504
505 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
506
507         * options.h (General_options): Add -fuse-ld= for GCC linker
508         option compatibility.
509
510 2013-01-04  Cary Coutant  <ccoutant@google.com>
511
512         * configure.ac: Fix typo restoring CXXFLAGS.
513         * configure: Regenerate.
514
515 2013-01-04  Cary Coutant  <ccoutant@google.com>
516
517         * testsuite/Makefile.am (CXXLINK_S): New macro.
518         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
519         * testsuite/Makefile.in: Regenerate.
520
521 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
522
523         * version.cc (print_version): Update copyright year to 2013.
524
525 2012-12-20  Ian Lance Taylor  <iant@google.com>
526
527         * layout.cc (Layout::special_ordering_of_input_section): New
528         function.
529         (Layout::layout): If input section requires special ordering, must
530         sort input sections.
531         (Layout::make_output_section): May sort .text input sections.
532         (Layout::is_section_name_prefix_grouped): Remove.
533         * layout.h (class Layout): Declare
534         special_ordering_of_input_section.  Don't declare
535         is_section_name_prefix_grouped.
536         * output.cc (Output_section::add_input_section): Revert last
537         change.
538         (Output_section::Input_section_sort::match_file_name): Don't crash
539         if called on output section data.
540         (Output_section::Input_section_sort_compare): Sort based on
541         special ordering.
542         (Output_section::Input_section_sort_section_order_index_compare):
543         Revert last patch.
544         (Output_section::sort_attached_input_sections): Likewise.
545
546 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
547
548         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
549         * layout.h (Layout::is_section_name_prefix_grouped): New function.
550         * output.cc (Output_section::add_input_section): Check if section
551         name contains special prefix.  Keep input sections to sort such
552         sections.
553         (Output_section::Input_section_sort_section_order_index_compare
554          ::operator()): Group sections according to prefixes.
555         (Output_section::sort_attached_input_sections): Add condition to
556         Input_section_entry constructor call.
557         * testsuite/Makefile.am (text_section_grouping): New test.
558         * testsuite/Makefile.in: Regenerate.
559         * testsuite/text_section_grouping.cc: New file.
560         * testsuite/text_section_grouping.sh: New file.
561
562 2012-12-17  Nick Clifton  <nickc@redhat.com>
563
564         * Makefile.am: Add copyright notice.
565         * NEWS: Likewise.
566         * README: Likewise.
567         * configure.ac: Likewise.
568         * ftruncate.c: Likewise.
569         * Makefile.in: Regenerate.
570
571 2012-12-14  Cary Coutant  <ccoutant@google.com>
572
573         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
574         --no-as-needed flag.
575         (exception_separate_shared_12_test): Likewise.
576         (incremental_copy_test): Likewise.
577         * testsuite/Makefile.in: Regenerate.
578
579 2012-12-14  Cary Coutant  <ccoutant@google.com>
580
581         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
582         (Dwp_output_file::Dwp_index::enter_set): Add assert.
583
584 2012-12-12  Alan Modra  <amodra@gmail.com>
585
586         * powerpc.cc (class Track_tls): New.
587         (class Relocate, class Scan): Inherit Track_tls.
588         (Target_powerpc::Scan::local, global): Track tls optimization
589         and avoid creating plt entry for __tls_get_addr if all uses
590         are optimized away.
591         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
592
593 2012-12-12  Alan Modra  <amodra@gmail.com>
594
595         * options.h (General_options): Add --toc-sort/--no-toc-sort.
596         Replace no_toc_optimize with toc_optimize.
597         * output.h (Output_section::input_sections): Provide non-const variant.
598         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
599         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
600         accessors.
601         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
602         (class Sort_toc_sections): New.
603         (Target_powerpc::do_finalize_sections): Sort toc sections.
604         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
605
606 2012-12-10  Roland McGrath  <mcgrathr@google.com>
607
608         * testsuite/binary_unittest.cc (read_all): New function.
609         (Sized_binary_test): Use it instead of ::read.
610         * fileread.cc (do_read): Don't assume pread always reads the whole
611         amount in a single call.
612
613 2012-12-10  Alan Modra  <amodra@gmail.com>
614
615         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
616         Set EM_PPC64 or EM_PPC here.
617         (Target_selector_powerpc::do_recognize): Delete.
618
619 2012-12-10  Alan Modra  <amodra@gmail.com>
620
621         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
622         stub_table_.
623         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
624
625 2012-12-07  Roland McGrath  <mcgrathr@google.com>
626
627         * testsuite/binary_unittest.cc (Sized_binary_test):
628         Use open_descriptor rather than ::open.
629
630 2012-12-07  Alan Modra  <amodra@gmail.com>
631
632         * powerpc.cc (Stub_table::do_write): Delete redundant Address
633         typedef and invalid_address constant.
634         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
635         instantiate constants.
636
637 2012-12-06  Roland McGrath  <mcgrathr@google.com>
638
639         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
640         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
641         * aclocal.m4: Regenerate.
642         * configure: Regenerate.
643         * Makefile.in: Regenerate.
644         * testsuite/Makefile.in: Regenerate.
645
646 2012-12-07  Alan Modra  <amodra@gmail.com>
647
648         * options.h (General_options): Add no_toc_optimize.
649         * powerpc.cc (ok_lo_toc_insn): New function.
650         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
651
652 2012-12-06  Alan Modra  <amodra@gmail.com>
653
654         * options.h (General_options): Add plt_align, plt_static_chain,
655         plt_thread_safe.  Update stub_group_size help text.
656         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
657         for new plt_thread_safe_ var.
658         (use_plt_offset): Correct comments.
659         (Target_powerpc::do_relax): Look for thread creation symbols to
660         determine default plt_thread_safe value.  Clear plt call stubs
661         as well as branch stubs each iteration.
662         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
663         insn constants.
664         (l, hi, ha, write_insn): Move earlier.
665         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
666         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
667         plt stubs too.
668         (Stub_table::update_size): Adjust.
669         (Stub_table::prev_size, set_prev_size): Delete.
670         (Stub_table::stub_align): Let --plt-align affect result.
671         (Stub_table::plt_call_size): Calculate sizes for various stubs.
672         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
673         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
674         (Stub_table::do_write): Support more stub variants.
675
676 2012-12-04  Alan Modra  <amodra@gmail.com>
677
678         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
679         (Target_powerpc::do_define_standard_symbols): New function.
680
681 2012-12-03  Alan Modra  <amodra@gmail.com>
682
683         * output.h: Formatting, whitespace.
684
685 2012-12-03  Alan Modra  <amodra@gmail.com>
686
687         * layout.h (Layout::get_executable_sections): Declare.
688         * layout.cc (Layout::get_executable_sections): New function.
689         * arm.cc (Target_arm::group_sections): Use it.
690         (Arm_output_section::group_sections): Delete now redundant test.
691         * output.cc (Output_reloc::Output_reloc): Add is_relative.
692         param to handle relative relocs.
693         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
694         (Output_data_reloc::add_absolute): Adjust.
695         (Output_data_reloc::add_relative): New function.
696         (Output_data::reset_data_size): New function.
697         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
698         (Output_section::set_addralign): New function.
699         (Output_section::checkpoint_set_addralign): New function.
700         (Output_section::clear_section_offsets_need_adjustment): New function.
701         (Output_section::input_sections): Make public.
702         * powerpc.cc (class Output_data_brlt_powerpc): New.
703         (class Stub_table, class Stub_control): New.
704         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
705         stub_table_, set_stub_table, stub_table): New vectors and accessor
706         functions.
707         (Target_powerpc::do_may_relax, do_relax, push_branch,
708         new_stub_table, stub_tables, brlt_section, group_sections,
709         add_branch_lookup_table, find_branch_lookup_table,
710         write_branch_lookup_table, make_brlt_section): New functions.
711         (Target_powerpc::struct Sort_sections, class Branch_info): New.
712         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
713         branch_info_): New vars.
714         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
715         make call stubs here.
716         (Output_data_glink): Remove all call stub handling from this class.
717         (Target_powerpc::Scan::local, global): Save interesting branch
718         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
719         (Target_powerpc::do_finalize_sections): Only make reg save/restore
720         functions on final link.
721         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
722         Handle long branch destinations too.
723         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
724         do_plt_address_for_local): Adjust lookup of plt call stubs.
725
726 2012-11-30  Alan Modra  <amodra@gmail.com>
727
728         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
729         relocs against protected symbols when building 32-bit shared libs.
730
731 2012-11-30  Alan Modra  <amodra@gmail.com>
732
733         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
734         param.  Call got_section() to make .got.  Update all callers
735         and their callers and so on.
736
737 2012-11-30  Alan Modra  <amodra@gmail.com>
738
739         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
740         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
741         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
742         value if it already exists.
743
744 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
745
746         PR gold/14858
747         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
748
749 2012-11-14  Roland McGrath  <mcgrathr@google.com>
750
751         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
752         than bfc instruction for data sandboxing.
753
754 2012-11-08  Alan Modra  <amodra@gmail.com>
755
756         * po/POTFILES.in: Regenerate.
757
758 2012-11-05  Alan Modra  <amodra@gmail.com>
759
760         * configure.ac: Apply 2012-09-10 change to config.in here.
761         * configure: Regenerate.
762
763 2012-11-05  Alan Modra  <amodra@gmail.com>
764
765         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
766         (struct Opd_ent): Use "Address" rather than "Offset".
767         (Output_data_got_powerpc::got_base_offset): Return Valtype.
768         (Target_powerpc::got_section): Make public.
769         (Target_powerpc::scan_relocs): Move code setting symbols..
770         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
771         Create _SDA_BASE_ only when referenced.
772
773 2012-11-02  Roland McGrath  <mcgrathr@google.com>
774
775         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
776         from last change.
777
778 2012-11-01  Roland McGrath  <mcgrathr@google.com>
779
780         * target.h (Sized_target::relocate_relocs): Use Elf_Off
781         for offset_in_output_section parameter.
782         (Sized_target::relocate_special_relocatable): Likewise.
783         * arm.cc (Target_arm::relocate_relocs): Likewise.
784         (Target_arm::relocate_special_relocatable): Likewise.
785         * i386.cc (Target_i386::relocate_relocs): Likewise.
786         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
787         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
788         * target-reloc.h (relocate_relocs): Likewise.
789         * testsuite/testfile.cc (Target_test): Likewise.
790         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
791         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
792
793         * system.h: Move inclusion of <clocale> to after <libintl.h> in
794         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
795
796         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
797         parameter, which is unused in the [!F_SETFD] case.
798
799         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
800         SYMNDX to off_t before comparing it to this->data_size().
801         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
802         * incremental.cc (Output_section_incremental_inputs::do_write):
803         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
804
805         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
806
807 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
808
809         * gold.cc (Target_arm::do_adjust_elf_header): Add the
810         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
811         in EABI_VER5.
812
813 2012-10-29  Cary Coutant  <ccoutant@google.com>
814
815         * dwp.cc (usage): Add file and exit status parameters;
816         add --help and --version options.
817         (print_version): New function.
818         (main): Add --help and --version options.
819
820 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
821
822         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
823         final_layout_sequence.txt.
824         * testsuite/Makefile.in: Regenerated.
825
826 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
827
828         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
829         COMPILE generated by automake.
830         (LINK1): Likewise.
831         (CXXCOMPILE1): Likewise.
832         (CXXLINK1): Likewise.
833         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
834         (LINK): Likewise.
835         (CXXCOMPILE): Likewise.
836         (CXXLINK): Likewise.
837         * testsuite/Makefile.in: Regenerated.
838
839 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
840
841         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
842         on bad fwrite return.
843
844 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
845
846         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
847         on val.
848
849 2012-10-23  Cary Coutant  <ccoutant@google.com>
850
851         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
852         * testsuite/Makefile.in: Regenerate.
853         * testsuite/dwp_test.h: New source file.
854         * testsuite/dwp_test_1.cc: New source file.
855         * testsuite/dwp_test_1.s: New source file.
856         * testsuite/dwp_test_1.sh: New source file.
857         * testsuite/dwp_test_1b.cc: New source file.
858         * testsuite/dwp_test_1b.s: New source file.
859         * testsuite/dwp_test_2.cc: New source file.
860         * testsuite/dwp_test_2.s: New source file.
861         * testsuite/dwp_test_2.sh: New source file.
862         * testsuite/dwp_test_main.cc: New source file.
863         * testsuite/dwp_test_main.s: New source file.
864
865 2012-10-23  Cary Coutant  <ccoutant@google.com>
866
867         * dwp.h: New header file.
868         * dwp.cc: New source file.
869         * gold.h: Move shared declarations to system.h.
870         * system.h: New header file.
871         * Makefile.am: Add dwp.
872         * Makefile.in: Regenerate.
873
874 2012-10-23  Cary Coutant  <ccoutant@google.com>
875
876         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
877         Dwarf_info_reader::read_from_pointer.
878         (Dwarf_pubnames_table::read_header): Likewise.
879         (Dwarf_pubnames_table::next_name): Likewise.
880         (Dwarf_die::read_attributes): Likewise.
881         (Dwarf_die::skip_attributes): Likewise.
882         (Dwarf_info_reader::read_from_pointer): New function template.
883         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
884         (Dwarf_pubnames_table): Likewise.
885         (Dwarf_info_reader::read_from_pointer): New function template.
886         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
887         Dwarf_pubnames_table ctor.
888
889 2012-10-23  Cary Coutant  <ccoutant@google.com>
890
891         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
892         abbrev_shndx.
893         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
894         abbrev_shndx_.
895         (Dwarf_info_reader::set_abbrev_shndx): New method.
896         (Dwarf_info_reader::abbrev_shndx_): New data member.
897
898 2012-10-23  Cary Coutant  <ccoutant@google.com>
899
900         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
901         from object, not parameters.
902         (Dwarf_info_reader::parse): Likewise.
903         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
904         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
905         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
906         methods.
907
908 2012-10-23  Cary Coutant  <ccoutant@google.com>
909
910         * fileread.cc (Input_file::Input_file): New constructor.
911         * fileread.h (class Input_file): Add new constructor.
912
913 2012-10-18  Alan Modra  <amodra@gmail.com>
914
915         PR gold/14727
916         * object.cc (Relobj::is_section_name_included): Also match
917         .sdata personality section.
918
919 2012-10-18  Alan Modra  <amodra@gmail.com>
920
921         * target-reloc.h (class Default_comdat_behavior): New, package up..
922         (get_comdat_behaviour): ..this.
923         (relocate_section): Add Relocate_comdat_behavior template arg,
924         adjust code to suit.
925         * arm.cc (Target_arm::relocate_section): Adjust to suit.
926         (Target_arm::scan_reloc_section): Likewise.
927         * i386.cc (Target_i386::relocate_section): Likewise.
928         * sparc.cc (Target_sparc::relocate_section): Likewise.
929         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
930         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
931         * powerpc.cc (class Relocate_comdat_behavior): New.
932         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
933         gold::relocate_section with new template arg.
934
935 2012-10-18  Alan Modra  <amodra@gmail.com>
936
937         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
938         dynamic relocs for GOT_TPREL got entries, without symbol if
939         resolving locally.
940         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
941         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
942         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
943
944 2012-10-17  Alan Modra  <amodra@gmail.com>
945
946         PR gold/14726
947         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
948
949 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
950
951         * layout.cc (Layout::include_section): Keep sections marked
952         SHF_EXCLUDE when doing relocatable links.
953
954 2012-10-16  Alan Modra  <amodra@gmail.com>
955
956         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
957         (Target_powerpc::do_finalize_sections): Call it.
958         (Output_data_save_res): New class and supporting functions.
959         (Target_powerpc::symval_for_branch): Only look up .opd entry for
960         normal symbols defined in object files.
961
962 2012-10-12  Alan Modra  <amodra@gmail.com>
963
964         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
965         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
966         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
967         section if scan_opd_relocs not yet called.
968         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
969
970 2012-10-12  Alan Modra  <amodra@gmail.com>
971
972         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
973         add_local_ifunc_entry): Revert last change.
974         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
975
976 2012-10-05  Alan Modra  <amodra@gmail.com>
977
978         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
979         do_plt_address_for_global): New functions.
980         (Output_data_got_powerpc::do_write): Don't segfault when linking
981         statically.
982         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
983         add_local_ifunc_entry): Return true on adding entry..
984         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
985         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
986         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
987         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
988         set up symbols here.
989         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
990         syms here.  Do so even when no .iplt.  Don't segfault when linking
991         statically.
992         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
993         new variants without reloc param.
994         (Glink_sym_ent::Glink_sym_ent): Likewise.
995         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
996         reloc when refs will resolve to plt call stub.
997         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
998         R_PPC_PLTREL24 to resolve locally.
999         (Target_powerpc::Scan::global): Correct ifunc handling.
1000         (Target_powerpc::Relocate::relocate): Correct local sym glink
1001         lookup.  Don't destroy "value" when we have a plt call stub,
1002         and when checking plt call validity.
1003         (Target_powerpc::do_dynsym_value): Simplify.
1004
1005 2012-10-05  Alan Modra  <amodra@gmail.com>
1006
1007         * i386.cc (Output_data_plt_i386::address_for_global,
1008         address_for_local): Add plt offset to returned value.  Adjust uses.
1009         * sparc.cc (Output_data_plt_sparc::address_for_global,
1010         address_for_local): Likewise.
1011         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1012         address_for_local): Likewise.
1013         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1014         address_for_local): Likewise.
1015         * target.h (Target::plt_address_for_global, plt_address_for_local):
1016         Update comment.
1017         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1018         (Output_data_got::Got_entry::write): Nor here.
1019         * output.h: Comment fix.
1020
1021 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1022
1023         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1024         global_offset_table_ value for larget got.
1025         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1026
1027 2012-09-29  Alan Modra  <amodra@gmail.com>
1028
1029         * powerpc.cc (Target_powerpc::iplt_): New output section.
1030         (Target_powerpc::iplt_section, make_iplt_section,
1031         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1032         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1033         Target_powerpc::plt_entry_count): Count iplt entries too.
1034         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1035         reloc section in constructor.  New params.
1036         (Target_powerpc::make_plt_section): Create reloc section here instead.
1037         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1038         functions.
1039         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1040         (Output_data_glink::add_entry, find_entry): New functions to
1041         deal with local syms.
1042         (Glink_sym_ent): Add support for local syms.
1043         (Output_data_glink::do_write): Handle ifunc plt entries.
1044         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1045         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1046         (Target_powerpc::Relocate::relocate): Likewise.
1047         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1048
1049 2012-09-25  Alan Modra  <amodra@gmail.com>
1050
1051         * object.h (Sized_relobj_file::adjust_local_symbol,
1052         do_adjust_local_symbol): New functions.
1053         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1054         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1055         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1056         and irregular opd entry spacing.
1057         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1058         (Global_symbol_visitor_opd): New functor.
1059         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1060         on deleted opd entries.
1061
1062 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1063
1064         * tilegx.cc: New file.
1065         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1066         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1067         * configure.tgt: Add entries for tilegx*.
1068         * configure.ac: Likewise.
1069         * Makefile.in: Rebuild.
1070         * configure: Likewise.
1071         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1072         tilegx.
1073
1074 2012-09-13  Alan Modra  <amodra@gmail.com>
1075
1076         * target-reloc.h (scan_relocs): Call scan.local for relocs
1077         against symbols in discarded sections.  Pass is_discarded
1078         param.
1079         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1080         Add is_discarded param.
1081         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1082         is_discarded to flag opd entry as discarded.  Don't emit dyn
1083         relocs on such entries.
1084         (Target_powerpc::Scan::global): Similarly detect and handle
1085         such opd entries.
1086         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1087         opd_ent_.  Update all uses.
1088         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1089         (Target_powerpc::relocate_section): Zero out discarded opd
1090         entry relocs.
1091
1092 2012-09-12  Ian Lance Taylor  <iant@google.com>
1093
1094         PR gold/14570
1095         * output.cc: Rename Output_data_got template parameter from size
1096         to got_size for all functions.  Compile all variants of
1097         Output_data_got.
1098         (Output_data_got::Got_entry::write): Correct use of size for
1099         symbol value.  Use local_is_tls rather than casting to
1100         Sized_relobj_file.
1101         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1102         (class Sized_relobj_file): Add do_local_is_tls.
1103         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1104
1105 2012-09-11  Alan Modra  <amodra@gmail.com>
1106
1107         PR gold/14566
1108         * layout.cc (Layout::set_segment_offsets): When using
1109         common-page-size alignment, ensure we are on a new max-page-size
1110         page.
1111         * output.cc (Output_segment::set_section_addresses): Use
1112         abi_pagesize, not common_pagesize for relro boundary.
1113         (Output_segment::set_offset): Likewise.
1114
1115 2012-09-11  Alan Modra  <amodra@gmail.com>
1116
1117         * output.h (Output_data_got::add_global_tls, add_local_tls,
1118         add_local_tls_pair): New functions.
1119         (Output_data_got::add_local_pair_with_rel): Remove second
1120         reloc param.  Expand comment.
1121         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1122         use_plt_or_tls_offset_, similarly for constructor param.
1123         (Output_data_got::Got_entry::write): Add got_index param.
1124         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1125         add_local_tls_pair): New functions.
1126         (Output_data_got::Got_entry::write): Handle tls symbols
1127         with use_plt_or_tls_offset_ set specially.
1128         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1129         (Output_data_got::do_write): Replace iterator with index, pass
1130         index to entry write function.
1131         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1132         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1133         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1134         call.
1135         * i386.cc (Target_i386::Scan::local): Likewise.
1136         * sparc.cc (Target_sparc::Scan::local): Likewise.
1137         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1138         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1139         do_tls_offset_for_global): New functions.
1140         (Target_powerpc::Scan::local): Correct TLS relocations and got
1141         entry values.
1142         (Target_powerpc::Scan::global): Don't emit unnecessary
1143         dynamic relocations on TLS GOT entries.
1144
1145 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1146
1147         * config.in: Disable sanity check for kfreebsd.
1148
1149 2012-09-10  Sterling Augustine  <saugustine@google.com>
1150
1151         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1152         (Gdb_index::pubtypes_read): New parameter.
1153         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1154         to calls.
1155         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1156         pubtypes_object_.
1157
1158 2012-09-09  Alan Modra  <amodra@gmail.com>
1159
1160         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1161         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1162         * gc.h (gc_process_relocs): Call target gc_add_reference.
1163         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1164         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1165         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1166         unnecessary cast.
1167         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1168         to cater for when we don't need code offset.  Update use.
1169         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1170         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1171         set_opd_valid): New functions.
1172         (Target_powerpc::do_gc_add_reference): New function.
1173         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1174         stashed refs.
1175         (Target_powerpc::do_gc_mark_symbol): New function.
1176
1177 2012-09-06  Cary Coutant  <ccoutant@google.com>
1178
1179         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1180         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1181         (Dwarf_die::skip_attributes): Likewise.
1182         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1183         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1184         (main): Call it.
1185         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1186
1187 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1188
1189         * testsuite/script_test_3.t: Add .got.plt output section
1190         statement.
1191         * testsuite/script_test_4.t: Likewise.
1192
1193 2012-09-05  Alan Modra  <amodra@gmail.com>
1194
1195         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1196         update all uses and lose "enum" when using type.
1197
1198 2012-09-05  Alan Modra  <amodra@gmail.com>
1199
1200         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1201         * configure: Regenerate.
1202         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1203         (plugin_final_layout.stdout): Likewise.
1204         (memory_test): Set page sizes to 0x1000.
1205         * testsuite/Makefile.in: Regenerate.
1206         * testsuite/discard_locals_test.sh: Add FIXME comment.
1207         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1208         * testsuite/pr14265.t: Add .got output section statement.
1209         * testsuite/script_test_2.t: Likewise.
1210         * testsuite/script_test_3.t: Likewise.
1211         * testsuite/script_test_4.t: Likewise.
1212         * testsuite/script_test_5.t: Likewise.
1213         * testsuite/script_test_6.t: Likewise.
1214         * testsuite/script_test_7.t: Likewise.
1215         * testsuite/script_test_9.t: Likewise.
1216
1217 2012-09-05  Alan Modra  <amodra@gmail.com>
1218
1219         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1220         (Powerpc_relocate_functions::Status): New typedef.
1221         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1222         (Target_powerpc::Scan::local): Handle REL64.
1223         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1224         for REL32 and REL64.
1225         (Target_powerpc::symval_for_branch): New function, extracted from..
1226         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1227         checks.  Report overflow errors.
1228
1229 2012-09-05  Alan Modra  <amodra@gmail.com>
1230
1231         * object.h (Sized_relobj_file::emit_relocs): Delete.
1232         (Sized_relobj_file::emit_relocs_reltype): Delete.
1233         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1234         relocate_relocs for --emit-relocs.
1235         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1236         * output.h: Update comment.
1237         (Output_segment::first_section): New function.
1238         (Output_segment::first_section_load_address): Use first_section.
1239         * output.cc (Output_segment::first_section): New function extracted..
1240         (Output_segment::first_section_load_address): ..from here.  Delete.
1241         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1242         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1243         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1244         adjust call to target.h function.
1245         * i386.cc (Target_i386): Likewise.
1246         * sparc.cc (Target_sparc): Likewise.
1247         * x86_64.cc (Target_x86_64): Likewise.
1248         * powerpc.cc (Target_powerpc): Likewise.
1249         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1250         first tls section has section symbol for optimised local dynamic
1251         output relocs.
1252         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1253         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1254         optimised tls code.
1255         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1256         Rename to relocate_relocs.  Update error message.
1257
1258 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1259
1260         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1261         --just-symbols.
1262
1263 2012-08-31  Alan Modra  <amodra@gmail.com>
1264
1265         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1266         (Powerpc_relobj::toc_base_offset): New stub function.
1267         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1268         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1269         (Target_powerpc::Relocate::enum skip_tls): New.
1270         (Target_powerpc::call_tls_get_addr_): New var.
1271         (Target_powerpc::is_branch_reloc): Move to file scope.
1272         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1273         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1274         New functions.
1275         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1276         (powerpc_info): Correct common_pagesize for ppc64.
1277         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1278         (Powerpc_relocate_functions): Add overflow check enums and functions.
1279         Add non-shift version of rela, rela_ua.  Delete all rel public
1280         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1281         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1282         addr16_ha3, addr14 functions.
1283         (Output_data_got_powerpc::add_constant_pair): New function.
1284         (Output_data_got_powerpc::got_base_offset): Likewise.
1285         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1286         (instruction constants): Sort, add some more.
1287         (Output_data_glink::do_write): Add and use Address typedef.  Use
1288         object->toc_base_offset() stub for 64-bit.
1289         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1290         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1291         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1292         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1293         Always treat .opd relocs as against locally defined symbol.
1294         Correct condition for RELATIVE relocs.
1295         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1296         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1297         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1298         calculations.  Handle TLS relocs, and more.  Add overflow
1299         checking and adjust for Powerpc_relocate_functions changes.
1300         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1301         Reinstate --emit-relocs code with FIXME.
1302
1303 2012-08-30  Alan Modra  <amodra@gmail.com>
1304
1305         * layout.cc (Layout::set_segment_offsets): Set p_align to
1306         abi_pagesize, not common_pagesize.
1307         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1308         to determine whether file header can go in segment.
1309
1310 2012-08-30  Alan Modra  <amodra@gmail.com>
1311
1312         * output.h (Output_reloc::Output_reloc <output section>): Add
1313         is_relative param.  Adjust calls.
1314         (Output_reloc::add_output_section_relative): New functions.
1315         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1316         is_relative.
1317         (Output_reloc::symbol_value): Handle SECTION_CODE.
1318
1319 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1320
1321         * gold.cc (queue_middle_tasks): Call layout again when unique
1322         segments for sections is desired.
1323         * layout.cc (Layout::Layout): Initialize new members.
1324         (Layout::get_output_section_flags): New function.
1325         (Layout::choose_output_section): Call get_output_section_flags.
1326         (Layout::layout): Make output section for mapping to a unique segment.
1327         (Layout::insert_section_segment_map): New function.
1328         (Layout::attach_allocated_section_to_segment): Make unique segment for
1329         output sections marked so.
1330         (Layout::segment_precedes): Check for unique segments when sorting.
1331         * layout.h (Layout::Unique_segment_info): New struct.
1332         (Layout::Section_segment_map): New typedef.
1333         (Layout::insert_section_segment_map): New function.
1334         (Layout::get_output_section_flags): New function.
1335         (Layout::is_unique_segment_for_sections_specified): New function.
1336         (Layout::set_unique_segment_for_sections_specified): New function.
1337         (Layout::unique_segment_for_sections_specified_): New member.
1338         (Layout::section_segment_map_): New member.
1339         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1340         Rename is_gc_pass_one to is_pass_one.
1341         Rename is_gc_pass_two to is_pass_two.
1342         Rename is_gc_or_icf to is_two_pass.
1343         Check for which pass based on whether symbols data is present.
1344         Make it two pass when unique segments for sections is desired.
1345         * output.cc (Output_section::Output_section): Initialize new
1346         members.
1347         * output.h (Output_section::is_unique_segment): New function.
1348         (Output_section::set_is_unique_segment): New function.
1349         (Output_section::is_unique_segment_): New member.
1350         (Output_section::extra_segment_flags): New function.
1351         (Output_section::set_extra_segment_flags): New function.
1352         (Output_section::extra_segment_flags_): New member.
1353         (Output_section::segment_alignment): New function.
1354         (Output_section::set_segment_alignment): New function.
1355         (Output_section::segment_alignment_): New member.
1356         (Output_segment::Output_segment): Initialize is_unique_segment_.
1357         (Output_segment::is_unique_segment): New function.
1358         (Output_segment::set_is_unique_segment): New function.
1359         (Output_segment::is_unique_segment_): New member.
1360         * plugin.cc (allow_unique_segment_for_sections): New function.
1361         (unique_segment_for_sections): New function.
1362         (Plugin::load): Add new functions to transfer vector.
1363         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1364         * Makefile.in: Regenerate.
1365         * testsuite/plugin_final_layout.sh: Check if unique segment
1366         functionality works.
1367         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1368         are available.
1369         (allow_unique_segment_for_sections): New global.
1370         (unique_segment_for_sections): New global.
1371         (claim_file_hook): Call allow_unique_segment_for_sections.
1372         (all_symbols_read_hook): Call unique_segment_for_sections.
1373
1374 2012-08-22  Cary Coutant  <ccoutant@google.com>
1375
1376         * layout.cc (Layout::include_section): Don't assert on GROUP
1377         sections with --emit-relocs.
1378
1379 2012-08-21  Cary Coutant  <ccoutant@google.com>
1380
1381         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1382         if --export-dynamic-symbol names an undef symbol.
1383
1384 2012-08-18  Alan Modra  <amodra@gmail.com>
1385
1386         * powerpc.cc: Formatting and white space.
1387         (Powerpc_relobj): Rename got2_section_ to special_.
1388         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1389         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1390         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1391         (Target_powerpc): Add Address typedef and invalid_address.  Use
1392         throughout.
1393         (Target_powerpc::is_branch_reloc): New function.
1394         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1395         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1396         for dst_mask, value and addend.
1397         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1398         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1399         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1400         uint16_t for 24-bit offset.  Use get_output_section_offset and
1401         check return.
1402         (Target_powerpc::Scan::local): Handle more relocs.
1403         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1404         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1405         Plug in toc restoring insn after plt calls.  Translate branches
1406         to function descriptor symbols to corresponding entry point.
1407         (Target_powerpc::relocate_for_relocatable): Check return from
1408         get_output_section_offset.
1409         * symtab.h: Comment typo.
1410
1411 2012-08-14  Ian Lance Taylor  <iant@google.com>
1412
1413         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1414         unsupported_relocal_local to call unsupported_reloc_global.
1415
1416 2012-08-14  Nick Clifton  <nickc@redhat.com>
1417
1418         PR ld/14265
1419         * script-sections.cc (Sections_element::output_section_name): Add
1420         keep return parameter.
1421         (Output_section_element::match_name): Add keep return parameter.
1422         Return the value of the keep_ member.
1423         * script-sections.h (class Output_section): Update
1424         output_section_name prototype.
1425         * layout.cc (Layout::keep_input_section): New public member
1426         function.
1427         (Layout::choose_output_section): Pass keep parameter to
1428         output_section_name.
1429         * layout.h (class Layout): Add keep_input_section.
1430         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1431         sections.
1432         * testsuite/Makefile.am: Add a test.
1433         * testsuite/Makefile.in: Regenerate.
1434         * testsuite/pr14265.c: Source file for the test.
1435         * testsuite/pr14265.t: Linker script for the test.
1436         * testsuite/pr14265.sh: Shell script for the test.
1437
1438 2012-08-14  Alan Modra  <amodra@gmail.com>
1439
1440         * target.h (Target::output_section_name): New function.
1441         (Target::do_output_section_name): New function.
1442         * layout.cc (Layout::choose_output_section): Call the above.
1443         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1444
1445 2012-08-14  Alan Modra  <amodra@gmail.com>
1446
1447         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1448         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1449         for replace_constant call.
1450         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1451         (Output_data_glink::do_print_to_mapfile): New function.
1452         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1453         (Target_powerpc::Relocate::relocate): Likewise.
1454
1455 2012-08-14  Alan Modra  <amodra@gmail.com>
1456
1457         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1458         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1459         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1460         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1461         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1462         here.
1463         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1464         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1465         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1466         here.
1467         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1468         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1469
1470 2012-08-12  Alan Modra  <amodra@gmail.com>
1471
1472         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1473         (glink insn constants): Use uint32_t.
1474         (Output_data_glink::add_entry): Use insert, not [] operator.
1475
1476 2012-08-11  Alan Modra  <amodra@gmail.com>
1477
1478         * object.h (Sized_relobj_file::find_shdr): New function.
1479         (Sized_relobj_file::find_special_sections): New function.
1480         * object.cc (Sized_relobj_file::find_shdr): New function.
1481         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1482         (Sized_relobj_file::find_special_sections): New function, split out..
1483         (Sized_relobj_file::do_read_symbols): ..from here.
1484         * output.h (Output_data_got::replace_constant): New function.
1485         (Output_data_got::num_entries): New function.
1486         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1487         (Output_data_got::got_offset): Protected rather than private.
1488         (Output_data_got::replace_got_entry): New function.
1489         * output.cc (Output_data_got::replace_got_entry): New function.
1490         * powerpc.cc (class Powerpc_relobj): New.
1491         (class Powerpc_relocate_functions): Delete all psymval variants or
1492         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1493         Implement _ha functions using corresponding _hi function.
1494         (Powerpc_relobj::find_special_sections): New function.
1495         (Target_powerpc::do_make_elf_object): New function.
1496         (class Output_data_got_powerpc): New.
1497         (class Output_data_glink): New.
1498         (class Powerpc_scan_relocatable_reloc): New.
1499         Many more changes througout file.
1500
1501 2012-08-09  Nick Clifton  <nickc@redhat.com>
1502
1503         * po/vi.po: Updated Vietnamese translation.
1504
1505 2012-08-07  Ian Lance Taylor  <iant@google.com>
1506
1507         * layout.cc (Layout::add_target_dynamic_tags): If
1508         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1509         plt_rel.
1510
1511 2012-07-30  Nick Clifton  <nickc@redhat.com>
1512
1513         * po/gold.pot: Updated template.
1514         * po/es.po: Updated Spanish translation.
1515
1516 2012-07-18  Cary Coutant  <ccoutant@google.com>
1517
1518         PR gold/14344
1519         * configure.ac: Add check for -gpubnames support.
1520         * configure: Regenerate.
1521         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1522         support; force -gno-pubnames.
1523         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1524         support.
1525         (gdb_index_test_4): New test.
1526         * testsuite/Makefile.in: Regenerate.
1527         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1528         * testsuite/gdb_index_test_2.sh: Likewise.
1529         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1530         * testsuite/gdb_index_test_4.sh: New script.
1531         * testsuite/gdb_index_test_comm.sh: New script with common code;
1532         don't look for space after colon.
1533
1534 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1535
1536         * gold.cc (queue_middle_tasks): Update function order only after
1537         deferred objects due to plugins are processed.
1538
1539 2012-07-11  Ian Lance Taylor  <iant@google.com>
1540
1541         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1542         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1543         (Target_arm::scan_reloc_for_stub): Likewise.
1544         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1545         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1546         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1547         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1548         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1549
1550 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1551             Ian Lance Taylor  <iant@google.com>
1552
1553         PR gold/14309
1554         * configure.ac: Test whether std::tr1::hash<off_t> works.
1555         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1556         needed.
1557         * output.h (class Output_fill): Add virtual destructor.
1558         * configure, config.in: Rebuild.
1559
1560 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1561
1562         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1563
1564 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1565
1566         * plugin.cc (Plugin::load): Handle position independent executables.
1567
1568 2012-06-06  Cary Coutant  <ccoutant@google.com>
1569
1570         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1571         add .debug_macro.
1572         (lines_only_debug_sections): Likewise.
1573         (gdb_fast_lookup_sections): New static array.
1574         (is_gdb_debug_section): Rename formal parameter.
1575         (is_lines_only_debug_section): Likewise.
1576         (is_gdb_fast_lookup_section): New function.
1577         (Layout::include_section): Check for ".zdebug_" prefix; pass
1578         section name suffix to is_gdb_debug_section, et al.; check for
1579         fast-lookup sections when building .gdb_index.
1580         * options.h (--strip-debug-gdb): Update GDB version number.
1581
1582 2012-06-06  Cary Coutant  <ccoutant@google.com>
1583
1584         * configure.ac: Add check for fallocate.
1585         * configure: Regenerate.
1586         * config.in: Regenerate.
1587
1588         * options.h (class General_options): Add --mmap-output-file and
1589         --posix-fallocate options.
1590         * output.cc: (posix_fallocate): Remove; replace with...
1591         (gold_fallocate): New function.
1592         (Output_file::map_no_anonymous): Call gold_fallocate.
1593         (Output_file::map): Check --mmap-output-file option.
1594
1595 2012-06-05  Jing Yu  <jingyu@google.com>
1596
1597         * gold.h (textdomain): Add do {} to empty while(0).
1598         (bindtextdomain): Likewise.
1599
1600 2012-06-04  Cary Coutant  <ccoutant@google.com>
1601
1602         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1603         has_dynsym_index.
1604
1605 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1606
1607         * symtab.cc (Symbol_table::define_special_symbol):
1608         Initialize *poldsym to prevent uninitialized variable errors.
1609
1610 2012-05-23  Cary Coutant  <ccoutant@google.com>
1611
1612         * layout.cc (Layout::section_name_mapping): Add rules to handle
1613         exact match on .data.rel.ro.local or .data.rel.ro.
1614         (Layout::output_section_name): Check for exact matches.
1615
1616 2012-05-23  Cary Coutant  <ccoutant@google.com>
1617
1618         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1619         more carefully.
1620
1621 2012-05-22  Cary Coutant  <ccoutant@google.com>
1622
1623         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1624         object before exporting symbol.
1625
1626 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1627
1628         * testsuite/tls_test.cc: Include "config.h" first.
1629         * testsuite/tls_test_c.c: Likewise.
1630
1631 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1632             Nick Clifton  <nickc@redhat.com>
1633
1634         PR 14072
1635         * configure.in: Add check that sysdep.h has been included before
1636         any system header files.
1637         * configure: Regenerate.
1638         * config.in: Regenerate.
1639
1640 2012-05-14  Cary Coutant  <ccoutant@google.com>
1641
1642         * layout.cc (Layout::make_output_section): Mark .tdata section
1643         as RELRO.
1644         * testsuite/relro_test.cc: Add a TLS variable.
1645
1646 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1647
1648         PR gold/14091
1649         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1650         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1651         R_X86_64_64.
1652
1653 2012-05-08  Cary Coutant  <ccoutant@google.com>
1654
1655         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1656         (lines_only_debug_sections): Likewise.
1657
1658 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1659
1660         * nacl.cc: New file.
1661         * nacl.h: New file.
1662         * Makefile.am (CCFILES, HFILES): Add them.
1663         * Makefile.in: Regenerate.
1664         * i386.cc (Output_data_plt_i386_nacl): New class.
1665         (Output_data_plt_i386_nacl_exec): New class.
1666         (Output_data_plt_i386_nacl_dyn): New class.
1667         (Target_i386_nacl): New class.
1668         (Target_selector_i386_nacl): New class.
1669         (target_selector_i386): Use it instead of Target_selector_i386.
1670         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1671         (Target_x86_64_nacl): New class.
1672         (Target_selector_x86_64_nacl): New class.
1673         (target_selector_x86_64, target_selector_x32): Use it instead of
1674         Target_selector_x86_64.
1675         * arm.cc (Output_data_plt_arm_nacl): New class.
1676         (Target_arm_nacl): New class.
1677         (Target_selector_arm_nacl): New class.
1678         (target_selector_arm, target_selector_armbe): Use it instead of
1679         Target_selector_arm.
1680
1681         * target-select.cc (select_target): Take new Input_file* and off_t
1682         arguments, pass them on to recognize method of selector.
1683         * object.cc (make_elf_sized_object): Update caller.
1684         * parameters.cc (parameters_force_valid_target): Likewise.
1685         * incremental.cc (make_sized_incremental_binary): Likewise.
1686         * target-select.h: Update decl.
1687         (Target_selector::recognize): Take new Input_file* argument,
1688         pass it on to do_recognize.
1689         (Target_selector::do_recognize): Take new Input_file* argument.
1690         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1691         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1692         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1693         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1694
1695         * target.h (Target::Target_info): New members isolate_execinstr
1696         and rosegment_gap.
1697         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1698         * arm.cc (Target_arm::arm_info): Update initializer.
1699         * i386.cc (Target_i386::i386_info): Likewise.
1700         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1701         * sparc.cc (Target_sparc::sparc_info): Likewise.
1702         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1703         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1704         * layout.cc (Layout::attach_allocated_section_to_segment):
1705         Take new const Target* argument.  If target->isolate_execinstr(), act
1706         like --rosegment.
1707         (Layout::find_first_load_seg): Take new const Target* argument;
1708         if target->isolate_execinstr(), reject PF_X segments.
1709         (Layout::relaxation_loop_body): Update caller.
1710         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1711         reset file offset to zero when we hit LOAD_SEG, and then do a second
1712         loop over the segments before LOAD_SEG to reassign offsets after
1713         addresses have been determined.  Handle target->rosegment_gap().
1714         (Layout::attach_section_to_segment): Take new const Target* argument;
1715         pass it to attach_allocated_section_to_segment.
1716         (Layout::make_output_section): Update caller.
1717         (Layout::attach_sections_to_segments): Take new const Target* argument;
1718         pass it to attach_section_to_segment.
1719         * gold.cc (queue_middle_tasks): Update caller.
1720         * layout.h (Layout): Update method decls with new arguments.
1721
1722         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1723         Target_info pointer to use.
1724         (Target_arm::do_make_data_plt): New virtual method.
1725         (Target_arm::make_data_plt): New method that calls it.
1726         (Target_arm::make_plt_entry): Use it.
1727         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1728         for the section alignment.
1729         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1730         method.
1731         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1732         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1733         method.
1734         (Output_data_plt_arm::get_plt_entry_size): Call it.
1735         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1736         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1737         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1738         method.
1739         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1740         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1741         method instead of sizeof(plt_entry).
1742         (Output_data_plt_arm::add_entry): Likewise.
1743         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1744         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1745         than static method.
1746         (Target_arm::plt_entry_size): Likewise.
1747         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1748         Move to ...
1749         (Output_data_plt_arm_standard): ... here, new class.
1750         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1751         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1752         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1753
1754         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1755         Take additional argument for the PLT entry size.
1756         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1757         Use get_plt_entry_size method rather than plt_entry_size variable.
1758         (Output_data_plt_x86_64::reserve_slot): Likewise.
1759         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1760         (Output_data_plt_x86_64::add_entry): Likewise.
1761         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1762         (Output_data_plt_x86_64::address_for_global): Likewise.
1763         (Output_data_plt_x86_64::address_for_local): Likewise.
1764         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1765         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1766         Make method non-static.
1767         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1768         method.
1769         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1770         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1771         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1772         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1773         virtual method.
1774         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1775         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1776         virtual method.
1777         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1778         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1779         virtual method.
1780         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1781         (Output_data_plt_x86_64::plt_entry_size)
1782         (Output_data_plt_x86_64::first_plt_entry)
1783         (Output_data_plt_x86_64::plt_entry)
1784         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1785         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1786         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1787         (Output_data_plt_x86_64_standard): ... here, new class.
1788         (Target_x86_64::Target_x86_64): Take optional argument for the
1789         Target_info pointer to use.
1790         (Target_x86_64::do_make_data_plt): New virtual method.
1791         (Target_x86_64::make_data_plt): New method to call it.
1792         (Target_x86_64::init_got_plt_for_update): Use that.
1793         Call this->plt_->add_eh_frame method here.
1794         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1795         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1796         rather than static method.
1797         (Target_x86_64::plt_entry_size): Likewise.
1798         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1799         rather than plt_entry_size variable.  Move guts of PLT filling to...
1800         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1801         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1802         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1803
1804         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1805         additional argument for the section alignment.
1806         Don't do add_eh_frame_for_plt here.
1807         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1808         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1809         variable.
1810         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1811         method.
1812         (Output_data_plt_i386::get_plt_entry_size): Call it.
1813         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1814         (Output_data_plt_i386::add_eh_frame): New method to call it.
1815         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1816         method.
1817         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1818         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1819         method.
1820         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1821         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1822         method instead of plt_entry_size.
1823         (Output_data_plt_i386::plt_entry_size)
1824         (Output_data_plt_i386::plt_eh_frame_fde_size)
1825         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1826         (Output_data_plt_i386_standard): ... here, new class.
1827         (Output_data_plt_i386_exec): New class.
1828         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1829         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1830         (Output_data_plt_i386::exec_plt_entry): Move to ...
1831         (Output_data_plt_i386_exec::plt_entry): ... here.
1832         (Output_data_plt_i386_dyn): New class.
1833         (Output_data_plt_i386::first_plt_entry): Move to ...
1834         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1835         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1836         (Output_data_plt_i386_dyn::plt_entry): ... here.
1837         (Target_i386::Target_i386): Take optional argument for the Target_info
1838         pointer to use.
1839         (Target_i386::do_make_data_plt): New virtual method.
1840         (Target_i386::make_data_plt): New method to call it.
1841         (Target_i386::make_plt_section): Use that.
1842         Call this->plt_->add_eh_frame method here.
1843         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1844         rather than plt_entry_size variable.
1845         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1846         (Output_data_plt_i386::address_for_local): Likewise.
1847         (Output_data_plt_i386::do_write): Likewise.
1848         Move guts of PLT filling to...
1849         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1850         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1851         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1852         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1853
1854 2012-05-01  Cary Coutant  <ccoutant@google.com>
1855
1856         * dwarf_reader.cc (Dwarf_die::read_attributes)
1857         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1858         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1859         * reduced_debug_output.cc
1860         (Output_reduced_debug_info_section::get_die_end): Remove
1861         DW_FORM_GNU_ref_index.  Add default case.
1862
1863 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1864
1865         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1866         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1867         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1868         DW_AT_high_pc as offset from DW_AT_low_pc.
1869
1870         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1871         * testsuite/Makefile.in: Regenerate.
1872         * testsuite/gdb_index_test_3.c: New test source file.
1873         * testsuite/gdb_index_test_3.sh: New test source file.
1874
1875 2012-04-25  Ian Lance Taylor  <iant@google.com>
1876
1877         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1878         pointer.
1879         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1880         as a class, not a struct.
1881         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1882         (Target_arm::apply_cortex_a8_workaround): Likewise.
1883         * gc.h: Declare Reloc_types as a struct, not a class.
1884         * object.h: Declare Symbols_data as a struct.
1885         * reloc.h: Declare Read_relocs_data as a struct.
1886         * target.h: Declare Relocate_info as a struct.
1887
1888 2012-04-24  David S. Miller  <davem@davemloft.net>
1889
1890         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1891         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1892         and R_SPARC_WPLT30.
1893
1894 2012-04-24  Cary Coutant  <ccoutant@google.com>
1895
1896         * incremental-dump.cc (find_input_containing_global): Replace
1897         magic number with symbolic constant.
1898         (dump_incremental_inputs): Update version number.
1899         * incremental.cc (Output_section_incremental_inputs): Update version
1900         number; import symbolic constants from Incremental_inputs_reader.
1901         (Incremental_inputs::create_data_sections): Align relocations
1902         section correctly for 64-bit targets.
1903         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1904         constants; add padding.
1905         (Output_section_incremental_inputs::write_header): Add assert for
1906         header_size.
1907         (Output_section_incremental_inputs::write_input_files): Add assert
1908         for input_entry_size.
1909         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1910         add assert for object_info_size, input_section_entry_size,
1911         global_sym_entry_size.
1912         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1913         for data structure sizes; use them.
1914         (Incremental_input_entry_reader): Import symbolic constants from
1915         Incremental_inputs_reader; use them.
1916
1917 2012-04-23  David S. Miller  <davem@davemloft.net>
1918
1919         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1920         and elf_flags_set_.
1921         (Target_sparc::Target_sparc): Initialize new fields.
1922         (Target_sparc::do_make_elf_object): New function.
1923         (Target_sparc::do_adjust_elf_header): New function.
1924
1925 2012-04-23  Cary Coutant  <ccoutant@google.com>
1926
1927         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1928         CU range table of gdb index.
1929
1930 2012-04-20  David S. Miller  <davem@davemloft.net>
1931
1932         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1933         instead of false.
1934
1935 2012-04-16  David S. Miller  <davem@davemloft.net>
1936
1937         * sparc.cc (Target_sparc::got_address): New function.
1938         (Sparc_relocate_functions::gdop_hix22): New function.
1939         (Sparc_relocate_functions::gdop_lox10): New function.
1940         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1941         relocs.
1942         (Target_sparc::Scan::local): Likewise if the global symbol is not
1943         preemptible and is not IFUNC.
1944         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1945         transformations for local and non-preemptible non-IFUNC global
1946         symbols.
1947
1948         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1949         writing out 64-bit part of ranges.
1950
1951         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1952         -fpic and -fpie respectively.
1953         * Makefile.in: Regenerate.
1954
1955         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1956         (Target_sparc::Target_sparc): Initialize new field.
1957         (Target_sparc::do_plt_section_for_global): New function.
1958         (Target_sparc::do_plt_section_for_local): New function.
1959         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1960         (Target_sparc::make_plt_section): New function, broken out of
1961         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1962         (Target_sparc::make_plt_entry): Call make_plt_section.
1963         (Target_sparc::make_local_ifunc_plt_entry): New function.
1964         (Target_sparc::rela_ifunc_section): New function.
1965         (Target_sparc::plt_section): Remove const.
1966         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1967         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1968         and ifunc_count_ fields.
1969         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1970         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1971         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1972         (Output_data_plt_sparc::rela_ifunc): New function.
1973         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1974         (Output_data_plt_sparc::has_ifunc_section): New function.
1975         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1976         (Output_data_plt_sparc::address_for_global): New function.
1977         (Output_data_plt_sparc::address_for_local): New function.
1978         (Output_data_plt_sparc::plt_index_to_offset): New function.
1979         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1980         and entry_count.
1981         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1982         entry_count.
1983         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1984         R_SPARC_JMP_IREL to switch.
1985         (Target_sparc::Scan::check_non_pic): Likewise.
1986         (Target_sparc::Scan::local): Handle IFUNC symbols.
1987         (Target_sparc::Scan::local): Likewise.
1988         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1989         and plt_address_for_local.
1990         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1991         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1992
1993         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1994         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1995         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1996         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1997         global relocs too.
1998         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1999         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2000         calls.
2001         * sparc.cc (Target_sparc::Scan::global): Likewise.
2002         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2003
2004 2012-04-16  Cary Coutant  <ccoutant@google.com>
2005
2006         * archive.cc (Library_base::should_include_member): Check for
2007         --export-dynamic-symbol.
2008         * options.h (class General_options): Add --export-dynamic-symbol.
2009         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2010         --export-dynamic-symbol.
2011         (Symbol_table::gc_mark_undef_symbols): Likewise.
2012         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2013
2014 2012-04-12  David S. Miller  <davem@davemloft.net>
2015
2016         * sparc.cc (Reloc::wdisp10): New relocation method.
2017         (Reloc::h34): Likewise.
2018         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2019         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2020         R_SPARC_WDISP10.
2021         (Target_sparc::Scan::local): Likewise.
2022         (Target_sparc::Scan::global): Likewise.
2023         (Target_sparc::Relocate::relocate): Likewise.
2024
2025 2012-04-09  Cary Coutant  <ccoutant@google.com>
2026
2027         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2028         low_pc == 0.
2029
2030 2012-04-06  Ian Lance Taylor  <iant@google.com>
2031
2032         * timer.cc: #include <unistd.h>.
2033
2034 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2035
2036         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2037         * config.in: Regenerate.
2038         * configure: Regenerate.
2039
2040 2012-04-05  Nick Clifton  <nickc@redhat.com>
2041
2042         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2043         (AM_LC_MESSAGES): Add.
2044         * aclocal.m4: Regenerate.
2045         * config.in: Regenerate.
2046         * configure: Regenerate.
2047
2048 2012-03-21  Cary Coutant  <ccoutant@google.com>
2049
2050         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2051         * Makefile.in: Regenerate.
2052         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2053         (Sized_elf_reloc_mapper::symbol_section): New function.
2054         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2055         (make_elf_reloc_mapper): New function.
2056         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2057         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2058         (Dwarf_abbrev_table::do_get_abbrev): New function.
2059         (Dwarf_ranges_table::read_ranges_table): New function.
2060         (Dwarf_ranges_table::read_range_list): New function.
2061         (Dwarf_pubnames_table::read_section): New function.
2062         (Dwarf_pubnames_table::read_header): New function.
2063         (Dwarf_pubnames_table::next_name): New function.
2064         (Dwarf_die::Dwarf_die): New function.
2065         (Dwarf_die::read_attributes): New function.
2066         (Dwarf_die::skip_attributes): New function.
2067         (Dwarf_die::set_name): New function.
2068         (Dwarf_die::set_linkage_name): New function.
2069         (Dwarf_die::attribute): New function.
2070         (Dwarf_die::string_attribute): New function.
2071         (Dwarf_die::int_attribute): New function.
2072         (Dwarf_die::uint_attribute): New function.
2073         (Dwarf_die::ref_attribute): New function.
2074         (Dwarf_die::child_offset): New function.
2075         (Dwarf_die::sibling_offset): New function.
2076         (Dwarf_info_reader::check_buffer): New function.
2077         (Dwarf_info_reader::parse): New function.
2078         (Dwarf_info_reader::do_parse): New function.
2079         (Dwarf_info_reader::do_read_string_table): New function.
2080         (Dwarf_info_reader::lookup_reloc): New function.
2081         (Dwarf_info_reader::get_string): New function.
2082         (Dwarf_info_reader::visit_compilation_unit): New function.
2083         (Dwarf_info_reader::visit_type_unit): New function.
2084         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2085         Sized_elf_reloc_mapper.
2086         (Sized_dwarf_line_info::symbol_section): Remove function.
2087         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2088         (Sized_dwarf_line_info::read_line_mappings): Remove object
2089         parameter, adjust callers.
2090         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2091         * dwarf_reader.h: Include <sys/types.h>.
2092         (class Track_relocs): Remove forward declaration.
2093         (class Elf_reloc_mapper): New class.
2094         (class Sized_elf_reloc_mapper): New class.
2095         (class Dwarf_abbrev_table): New class.
2096         (class Dwarf_range_list): New class.
2097         (class Dwarf_ranges_table): New class.
2098         (class Dwarf_pubnames_table): New class.
2099         (class Dwarf_die): New class.
2100         (class Dwarf_info_reader): New class.
2101         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2102         (Sized_dwarf_line_info::symbol_section): Remove member function.
2103         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2104         base class.
2105         * gdb-index.cc: New source file.
2106         * gdb-index.h: New source file.
2107         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2108         and .debug_types sections, call Layout::add_to_gdb_index.
2109         (Sized_relobj_incr::do_section_name): Implement.
2110         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2111         return type; Implement.
2112         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2113         return type.
2114         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2115         parameter list and return type.
2116         (Sized_incr_dynobj::do_section_contents): Likewise.
2117         * layout.cc: Include gdb-index.h.
2118         (Layout::Layout): Initialize gdb_index_data_.
2119         (Layout::init_fixed_output_section): Check for .gdb_index section.
2120         (Layout::add_to_gdb_index): New function. Instantiate.
2121         * layout.h: Add forward declaration for class Gdb_index.
2122         (Layout::add_to_gdb_index): New member function.
2123         (Layout::gdb_index_data_): New data member.
2124         * main.cc: Include gdb-index.h.
2125         (main): Print statistics for gdb index.
2126         * object.cc (Object::section_contents): Move code into
2127         do_section_contents.
2128         (need_decompressed_section): Check for sections needed when building
2129         gdb index.
2130         (build_compressed_section_map): Likewise.
2131         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2132         gdb index.
2133         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2134         sections; call Layout::add_to_gdb_index.
2135         (Sized_relobj_file::do_decompressed_section_contents): Call
2136         do_section_contents directly.
2137         * object.h (Object::do_section_contents): Adjust parameter list and
2138         return type.
2139         (Object::do_decompressed_section_contents): Call do_section_contents
2140         directly.
2141         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2142         return type.
2143         * options.h (class General_options): Add --gdb-index option.
2144         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2145         list and return type.
2146         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2147         * reloc.h (Track_relocs::checkpoint): New function.
2148         (Track_relocs::reset): New function.
2149
2150         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2151         New test cases.
2152         * testsuite/Makefile.in: Regenerate.
2153         * testsuite/gdb_index_test.cc: New test source file.
2154         * testsuite/gdb_index_test_1.sh: New test source file.
2155         * testsuite/gdb_index_test_2.sh: New test source file.
2156
2157 2012-03-19  Doug Kwan  <dougkwan@google.com>
2158
2159         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2160         (Target_arm::do_finalize_sections): Remove code which defines
2161         __exidx_start and __exidx_end.  Make symbol table parameter
2162         anonymous as it is not used.
2163         * gold.cc (queue_middle_tasks): Call target hook to define any
2164         target-specific symbols.
2165         * target.h (Target::define_standard_symbols): New method.
2166         (Target::do_define_standard_symbols): Same.
2167         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2168         * testsuite/Makefile.in: Regenerate.
2169         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2170         and __exidx_end.
2171         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2172         relocations are generated for __exidx_start and __exidx_end.
2173
2174 2012-03-16  Doug Kwan  <dougkwan@google.com>
2175
2176         * testsuite/Makefile.am: Disable test initpri3b.
2177         * testsuite/Makefile.in: Regenerate.
2178
2179 2012-03-15  Doug Kwan  <dougkwan@google.com>
2180
2181         * arm.cc (Target_arm::got_section): Make .got section read-only
2182         if -z now is given.
2183
2184 2012-03-15  Ian Lance Taylor  <iant@google.com>
2185
2186         PR gold/13850
2187         * layout.cc (Layout::make_output_section): Correctly mark
2188         SHT_INIT_ARRAY, et. al., as relro.
2189
2190 2012-03-14  Doug Kwan  <dougkwan@google.com>
2191
2192         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2193         dynamic relocations for protected symbols in shared objects.
2194
2195 2012-03-13  Ian Lance Taylor  <iant@google.com>
2196
2197         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2198         keep the larger alignment.
2199
2200 2012-03-12  Cary Coutant  <ccoutant@google.com>
2201
2202         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2203         handling of DW_LNE_define_file.
2204
2205 2012-03-12  Cary Coutant  <ccoutant@google.com>
2206
2207         * reduced_debug_output.cc
2208         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2209         codes to switch.
2210
2211 2012-02-29  Cary Coutant  <ccoutant@google.com>
2212
2213         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2214
2215 2012-02-29  Cary Coutant  <ccoutant@google.com>
2216
2217         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2218         Call Object::decompressed_section_contents.
2219         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2220         New dtor.
2221         (Sized_dwarf_line_info::buffer_start_): New data member.
2222         * merge.cc (Output_merge_data::do_add_input_section): Call
2223         Object::decompressed_section_contents.
2224         (Output_merge_string::do_add_input_section): Likewise.
2225         * object.cc (need_decompressed_section): New function.
2226         (build_compressed_section_map): Decompress sections needed later.
2227         (Sized_relobj_file::do_decompressed_section_contents): New function.
2228         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2229         * object.h (Object::decompressed_section_contents): New function.
2230         (Object::discard_decompressed_sections): New function.
2231         (Object::do_decompressed_section_contents): New function.
2232         (Object::do_discard_decompressed_sections): New function.
2233         (Compressed_section_info): New type.
2234         (Compressed_section_map): Include decompressed section contents.
2235         (Sized_relobj_file::do_decompressed_section_contents): New function.
2236         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2237
2238 2012-02-16  Cary Coutant  <ccoutant@google.com>
2239
2240         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2241         * testsuite/Makefile.in: Regenerate.
2242
2243 2012-02-14  Cary Coutant  <ccoutant@google.com>
2244
2245         * options.cc (General_options::finalize): Disallow -pie and -static.
2246
2247 2012-02-03  Doug Kwan  <dougkwan@google.com>
2248
2249         * arm.cc (Arm_relocate_functions::abs8,
2250         Arm_relocate_functions::abs16): Use
2251         Bits::has_signed_unsigned_overflow32.
2252         (Arm_relocate_functions::thm_abs8): Correct range of
2253         overflow check.
2254         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2255         in assertions.
2256
2257 2012-02-02  Doug Kwan  <dougkwan@google.com>
2258
2259         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2260         position independent outputs, not just shared objects.
2261
2262 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2263
2264         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2265         * configure: Regenerated.
2266
2267 2012-01-27  Ian Lance Taylor  <iant@google.com>
2268
2269         * reloc.h (Bits): New class with static functions, copied from
2270         namespace utils in arm.cc.
2271         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2272         instead.
2273
2274 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2275
2276         * incremental.cc (write_info_blocks): Correct relocation offset.
2277
2278 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2279
2280         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2281         (Relocate::tls_gd_to_le): Likewise.
2282
2283 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2284
2285         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2286
2287 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2288
2289         * configure.ac: Check if -mcmodel=medium works.
2290         * configure: Regenerated.
2291
2292 2012-01-24  Cary Coutant  <ccoutant@google.com>
2293
2294         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2295         definition and ...
2296         (read_unsigned_LEB_128_x): ... this new function.
2297         (read_signed_LEB_128): Replaced with inline definition and ...
2298         (read_signed_LEB_128_x): ... this new function.
2299         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2300         (read_unsigned_LEB_128): Add inline definition.
2301         (read_signed_LEB_128_x): New function.
2302         (read_signed_LEB_128): Add inline definition.
2303         * testsuite/Makefile.am (leb128_unittest): New unit test.
2304         * testsuite/Makefile.in: Regenerate.
2305         * testsuite/leb128_unittest.cc: New unit test.
2306
2307 2012-01-23  Ian Lance Taylor  <iant@google.com>
2308
2309         PR gold/13617
2310         * i386.cc (Target_i386::do_code_fill): When using a jmp
2311         instruction, pad with nop instructions.
2312         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2313
2314 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2315
2316         * x86_64.cc (gc_process_relocs): Add typename on types used in
2317         template.
2318         (scan_relocs): Likewise.
2319         (relocate_section): Likewise.
2320         (apply_relocation): Likewise.
2321
2322 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2323
2324         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2325         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2326         under x32.
2327
2328 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2329
2330         * x86_64.cc: Initial support for x32.
2331
2332 2012-01-03  Cary Coutant  <ccoutant@google.com>
2333
2334         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2335         Use abstract base class for GOT.
2336         * gold/output.h (class Output_data_got_base): New abstract base class.
2337         (class Output_data_got): Derive from new base class, adjust ctors.
2338         (Output_data_got::reserve_slot): Make virtual; rename to
2339         do_reserve_slot; Adjust callers.
2340         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2341         pointer to abstract base class.
2342         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2343
2344 2011-12-18  Ian Lance Taylor  <iant@google.com>
2345
2346         * object.h (Relobj::local_symbol_value): New function.
2347         (Relobj::local_plt_offset): New function.
2348         (Relobj::local_has_got_offset): New function.
2349         (Relobj::local_got_offset): New function.
2350         (Relobj::set_local_got_offset): New function.
2351         (Relobj::do_local_symbol_value): New pure virtual function.
2352         (Relobj::do_local_plt_offset): Likewise.
2353         (Relobj::do_local_has_got_offset): Likewise.
2354         (Relobj::do_local_got_offset): Likewise.
2355         (Relobj::do_set_local_got_offset): Likewise.
2356         (Sized_relobj::do_local_has_got_offset): Rename from
2357         local_has_got_offset.
2358         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2359         (Sized_relobj::do_set_local_got_offset): Rename from
2360         set_local_got_offset.
2361         (Sized_relobj_file::do_local_plt_offset): Rename from
2362         local_plt_offset.
2363         (Sized_relobj_file::do_local_symbol_value): New function.
2364         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2365         local_plt_offset.
2366         * output.cc (Output_data_got::Got_entry::write): Change object to
2367         Relobj.  Use local_symbol_value.
2368         (Output_data_got::add_global_with_rel): Change rel_dyn to
2369         Output_data_reloc_generic*.  Use add_global_generic.
2370         (Output_data_got::add_global_with_rela): Remove.  Change all
2371         callers to use add_global_with_rel.
2372         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2373         Output_data_reloc_generic*.  Use add_global_generic.
2374         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2375         callers to use add_global_pair_with_rel.
2376         (Output_data_got::add_local): Change object to Relobj*.
2377         (Output_data_got::add_local_plt): Likewise.
2378         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2379         change rel_dyn to Output_data_reloc_generic*.  Use
2380         add_local_generic.
2381         (Output_data_got::add_local_with_rela): Remove.  Change all
2382         callers to use all_local_with_rel.
2383         (Output_data_got::add_local_pair_with_rel): Change object to
2384         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2385         add_output_section_generic.
2386         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2387         callers to use add_local_pair_with_rel.
2388         (Output_data_got::reserve_local): Change object to Relobj*.
2389         * output.h: (class Output_data_reloc_generic): Add pure virtual
2390         declarations for add_global_generic, add_local_generic,
2391         add_output_section_generic.
2392         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2393         functions for Output_data_reloc_generic.  Update declarations for
2394         changes listed in output.cc.
2395         (class Output_data_got): Change template parameter to got_size.
2396         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2397         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2398         function.
2399         (Sized_relobj_incr::do_local_plt_offset): New function.
2400         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2401         add_global_generic.
2402
2403 2011-12-17  Cary Coutant  <ccoutant@google.com>
2404
2405         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2406         * resolve.cc (Symbol_table::resolve): Likewise.
2407         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2408         arrays.
2409         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2410
2411 2011-12-16  Ian Lance Taylor  <iant@google.com>
2412
2413         * output.h (Output_data_reloc_generic::add): Only call
2414         add_dynamic_reloc if this is a dynamic reloc section.
2415
2416 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2417
2418         PR gold/13505
2419         * target-reloc.h (apply_relocation): Replace <64, false> with
2420         <size, big_endian>.
2421
2422 2011-11-25  Nick Clifton  <nickc@redhat.com>
2423
2424         * po/it.po: New Italian translation.
2425
2426 2011-11-17  Sterling Augustine  <saugustine@google.com>
2427
2428         * script.cc (script_include_directive): Implement.
2429         (read_script_file): New local variables name and search_path. Update
2430         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2431         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2432         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2433
2434 2011-11-11  Sterling Augustine  <saugustine@google.com>
2435
2436         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2437         (file_or_sections_cmd): Likewise.
2438
2439 2011-11-11  Doug Kwan  <dougkwan@google.com>
2440
2441         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2442         if --just-symbols is given.
2443
2444 2011-11-10  Doug Kwan  <dougkwan@google.com>
2445
2446         PR gold/13362
2447         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2448         when processing data relocs.
2449         * reloc.h (Relocate_functions::rel_unaligned): New method.
2450         (Relocate_functions::pcrel_unaligned): Ditto.
2451         (Relocate_functions::rel32_unaligned): Ditto.
2452         (Relocate_functions::pcrel32_unaligned): Ditto.
2453
2454 2011-11-09  Doug Kwan  <dougkwan@google.com>
2455
2456         PR gold/13362
2457         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2458         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2459         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2460         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2461         (Relocate_functions::rel_unaligned): New.
2462         (Relocate_functions::rel32_unaligned): New.
2463         * target-reloc.h (relocate_for_relocatable): Add code to handle
2464         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2465         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2466         arm_unaligned_reloc_r): New targets.
2467         * testsuite/Makefile.in: Regenerate.
2468         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2469         linking.
2470
2471 2011-11-02  Ian Lance Taylor  <iant@google.com>
2472
2473         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2474         NATIVE_LINKER.
2475         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2476         * options.cc (General_options::finalize): Use library search path
2477         from configure script if specified.  If not native and no sysroot,
2478         only search TOOLLIBDIR.
2479         * options.h (Search_directory::Search_directory): Change name to
2480         const std::string&.
2481         (General_options::add_to_library_path_with_sysroot): Change arg to
2482         const std::string&.
2483         * configure, Makefile.in, config.in: Rebuild.
2484
2485 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2486
2487         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2488         we are working around the ARM1176 Erratum.
2489         * options.h (General_options::fix_arm1176): Add option.
2490         * testsuite/Makefile.am: Add testcases, and keep current ones
2491         working.
2492         * testsuite/Makefile.in: Regenerate.
2493         * testsuite/arm_fix_1176.s: New file.
2494         * testsuite/arm_fix_1176.sh: Likewise.
2495
2496 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2497
2498         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2499         may_use_blx_.
2500         (Target_arm::may_use_blx): Remove method.
2501         (Target_arm::set_may_use_blx): Likewise.
2502         (Target_arm::may_use_v4t_interworking): New method.
2503         (Target_arm::may_use_v5t_interworking): Likewise.
2504         (Target_arm::may_use_blx_): Remove member variable.
2505         (Arm_relocate_functions::arm_branch_common): Check for v5T
2506         interworking.
2507         (Arm_relocate_functions::thumb_branch_common): Likewise.
2508         (Reloc_stub::stub_type_for_reloc): Likewise.
2509         (Target_arm::do_finalize_sections): Correct interworking checks.
2510         * testsuite/Makefile.am: Add new tests.
2511         * testsuite/Makefile.in: Regenerate.
2512         * testsuite/arm_farcall_arm_arm.s: New test.
2513         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2514         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2515         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2516         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2517         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2518         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2519         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2520
2521 2011-10-31  Cary Coutant  <ccoutant@google.com>
2522
2523         PR gold/13023
2524         * expression.cc (Expression::eval_with_dot): Add
2525         is_section_dot_assignment parameter.
2526         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2527         absolute and assigning to dot within a section.
2528         * script-sections.cc
2529         (Output_section_element_assignment::set_section_addresses): Pass
2530         dot_section to set_if_absolute.
2531         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2532         as is_section_dot_assignment flag to eval_with_dot.
2533         (Output_section_element_dot_assignment::set_section_addresses):
2534         Likewise.
2535         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2536         parameter.  Also set value if relative to dot_section; set the
2537         symbol's output_section.
2538         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2539         parameter.  Adjust all callers.
2540         (Expression::eval_maybe_dot): Likewise.
2541         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2542         Adjust all callers.
2543         * testsuite/script_test_2.t: Test assignment of an absolute value
2544         to dot within an output section element.
2545
2546 2011-10-31  Cary Coutant  <ccoutant@google.com>
2547
2548         * options.h (class General_options): Add --[no-]gnu-unique options.
2549         * symtab.cc (Symbol_table::sized_write_globals): Convert
2550         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2551
2552 2011-10-31  Cary Coutant  <ccoutant@google.com>
2553
2554         PR gold/13359
2555         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2556         unnecessary assertion.
2557         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2558
2559 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2560
2561         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2562         gc_mark_symbol.
2563         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2564         gc_mark_symbol.
2565         Change to just keep the section associated with symbol.
2566         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2567         they are externally visible and --export-dynamic is turned on.
2568         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2569
2570 2011-10-19  Ian Lance Taylor  <iant@google.com>
2571
2572         PR gold/13163
2573         * script-sections.cc
2574         (Output_section_element_dot_assignment::needs_output_section): New
2575         function.
2576
2577 2011-10-19  Ian Lance Taylor  <iant@google.com>
2578
2579         PR gold/13204
2580         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2581         --section-start option was seen.
2582         * options.h (General_options::any_section_start): New function.
2583
2584 2011-10-18  David S. Miller  <davem@davemloft.net>
2585
2586         PR binutils/13301
2587         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2588         member to track relocation locations that have moved during TLS
2589         reloc optimizations.
2590         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2591         (Target_sparc::Relocate::relocate): Adjust view down by 4
2592         bytes if it matches reloc_adjust_addr_.
2593         (Target_sparc::Relocate::relocate_tls): Always move the
2594         __tls_get_addr call delay slot instruction forward 4 bytes when
2595         performing relaxation.
2596
2597 2011-10-18  Cary Coutant  <ccoutant@google.com>
2598
2599         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2600         (Output_file::map_no_anonymous): Check for non-zero
2601         return code from posix_fallocate.
2602
2603 2011-10-17  Cary Coutant  <ccoutant@google.com>
2604
2605         PR gold/13245
2606         * plugin.cc (is_visible_from_outside): Check for symbols
2607         referenced from dynamic objects.
2608         * resolve.cc (Symbol_table::resolve): Don't count references
2609         from dynamic objects as references from real ELF files.
2610         * testsuite/plugin_test_2.sh: Adjust expected result.
2611
2612 2011-10-17  Cary Coutant  <ccoutant@google.com>
2613
2614         * gold.cc: Include timer.h.
2615         (queue_middle_tasks): Stamp time.
2616         (queue_final_tasks): Likewise.
2617         * main.cc (main): Store timer in parameters.  Print timers
2618         for each pass.
2619         * parameters.cc (Parameters::Parameters): Initialize timer_.
2620         (Parameters::set_timer): New function.
2621         (set_parameters_timer): New function.
2622         * parameters.h (Parameters::set_timer): New function.
2623         (Parameters::timer): New function.
2624         (Parameters::timer_): New data member.
2625         (set_parameters_timer): New function.
2626         * timer.cc (Timer::stamp): New function.
2627         (Timer::get_pass_time): New function.
2628         * timer.h (Timer::stamp): New function.
2629         (Timer::get_pass_time): New function.
2630         (Timer::pass_times_): New data member.
2631
2632 2011-10-17  Cary Coutant  <ccoutant@google.com>
2633
2634         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2635         task for members of lib groups.
2636
2637 2011-10-17  Cary Coutant  <ccoutant@google.com>
2638
2639         PR gold/13288
2640         * fileread.cc (File_read::find_view): Add assert.
2641         (File_read::make_view): Move bounds check (replace with assert)...
2642         (File_read::find_or_make_view): ... to here.
2643
2644 2011-10-12  Cary Coutant  <ccoutant@google.com>
2645
2646         * output.cc (Output_file::open_base_file): Handle case where
2647         ::read returns less than requested size.
2648
2649 2011-10-10  Cary Coutant  <ccoutant@google.com>
2650
2651         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2652         Initialize defined_count_.
2653         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2654         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2655         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2656         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2657         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2658         * incremental.h (Sized_relobj_incr::defined_count_): New data
2659         member.
2660         (Sized_incr_dynobj::defined_count_): New data member.
2661         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2662         Return zeroes instead of internal error.
2663
2664 2011-10-10  Cary Coutant  <ccoutant@google.com>
2665
2666         PR gold/13249
2667         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2668         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2669         * output.h (class Output_reloc): Add use_plt_offset flag.
2670         (Output_reloc::type_): Adjust size of bit field.
2671         (Output_reloc::use_plt_offset_): New bit field.
2672         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2673         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2674         flag.  Adjust all callers.
2675         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2676         creating RELATIVE relocations.
2677
2678 2011-10-10  Nick Clifton  <nickc@redhat.com>
2679
2680         * po/es.po: Updated Spanish translation.
2681         * po/fi.po: Updated Finnish translation.
2682
2683 2011-10-03   Diego Novillo  <dnovillo@google.com>
2684
2685         * options.cc (parse_uint): Fix dereference of RETVAL.
2686
2687 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2688
2689         * layout.h (section_order_map_): New member.
2690         (get_section_order_map): New member function.
2691         * output.cc (Output_section::add_input_section): Check for patterns
2692         only when --section-ordering-file is specified.
2693         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2694         output_sections have been formed.
2695         * layout.cc (Layout_Layout): Initialize section_order_map_.
2696         * plugin.cc (update_section_order): Store order in order_map. Do not
2697         update the order.
2698         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2699         * testsuite/Makefile.in: Regenerate.
2700         * testsuite/plugin_section_order.c: New file.
2701         * testsuite/plugin_final_layout.cc: New file.
2702         * testsuite/plugin_final_layout.sh: New file.
2703
2704 2011-09-29  Cary Coutant  <ccoutant@google.com>
2705
2706         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2707         Check for NULL.
2708         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2709         symbols during incremental update.
2710         (Symbol_table::add_from_dynobj): Likewise.
2711
2712 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2713             Ian Lance Taylor  <iant@google.com>
2714
2715         * symtab.cc (Symbol_table::define_special_symbol): Always
2716         canonicalize version string.
2717
2718 2011-09-26  Cary Coutant  <ccoutant@google.com>
2719
2720         * gold.cc (queue_initial_tasks): Move option checks ...
2721         * options.cc (General_options::finalize): ... to here. Disable
2722         some options; make others fatal.
2723
2724 2011-09-26  Cary Coutant  <ccoutant@google.com>
2725
2726         gcc PR lto/47247
2727         * plugin.cc (get_symbols_v2): New function.
2728         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2729         (is_referenced_from_outside): New function.
2730         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2731         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2732         (get_symbols): Pass version parameter.
2733         (get_symbols_v2): New function.
2734         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2735         parameter.
2736         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2737         (onload): Add LDPT_GET_SYMBOLS_V2.
2738         (all_symbols_read_hook): Use get_symbols_v2; check for
2739         LDPR_PREVAILING_DEF_IRONLY_EXP.
2740         * testsuite/plugin_test_3.sh: Update expected results.
2741
2742 2011-09-23  Simon Baldwin  <simonb@google.com>
2743
2744         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2745         configuration options.
2746         * configure: Regenerate.
2747         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2748         * Makefile.in: Regenerate.
2749         * testsuite/Makefile.in: Regenerate.
2750
2751 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2752
2753         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2754
2755 2011-09-19  Cary Coutant  <ccoutant@google.com>
2756
2757         * incremental.cc (can_incremental_update): Fix typo in comment.
2758         * incremental.h (can_incremental_update): Likewise.
2759
2760 2011-09-18  Cary Coutant  <ccoutant@google.com>
2761
2762         * incremental.cc (can_incremental_update): New function.
2763         * incremental.h (can_incremental_update): New function.
2764         * layout.cc (Layout::init_fixed_output_section): Call it.
2765         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2766         * object.cc (Sized_relobj_file::do_layout): Call
2767         can_incremental_update.
2768
2769 2011-09-13  Cary Coutant  <ccoutant@google.com>
2770
2771         * configure.ac: Check for glibc support for gnu_indirect_function
2772         support with static linking, setting automake conditional
2773         IFUNC_STATIC.
2774         * Makefile.in: Regenerate.
2775         * configure: Regenerate.
2776
2777         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2778         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2779         for IFUNC_STATIC.
2780         * testsuite/Makefile.in: Regenerate.
2781
2782 2011-09-13  Cary Coutant  <ccoutant@google.com>
2783
2784         * incremental.cc (Sized_relobj_incr::do_layout): Call
2785         report_comdat_group for kept comdat sections.
2786         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2787         * testsuite/Makefile.in: Regenerate.
2788         * testsuite/incr_comdat_test_1.cc: New source file.
2789         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2790         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2791         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2792
2793 2011-09-13  Ian Lance Taylor  <iant@google.com>
2794
2795         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2796         variable external_symbols_offset.
2797
2798 2011-09-12  Ian Lance Taylor  <iant@google.com>
2799
2800         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2801         triggered if object has no symbols.
2802
2803 2011-09-09  David S. Miller  <davem@davemloft.net>
2804
2805         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2806         (Output_fill_debug_line::do_write): Likewise.
2807
2808 2011-08-29  Cary Coutant  <ccoutant@google.com>
2809
2810         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2811         casts to match formatting specs.
2812         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2813
2814 2011-08-26  Cary Coutant  <ccoutant@google.com>
2815
2816         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2817         remaining hole size when allocating.
2818         (Layout::make_output_section): Set fill methods for debug sections.
2819         * layout.h (Free_list::Free_list_node): Move from private to
2820         public.
2821         (Free_list::set_min_hole_size): New function.
2822         (Free_list::begin, Free_list::end): New functions.
2823         (Free_list::min_hole_): New data member.
2824         * output.cc: Include dwarf.h.
2825         (Output_fill_debug_info::do_minimum_hole_size): New function.
2826         (Output_fill_debug_info::do_write): New function.
2827         (Output_fill_debug_line::do_minimum_hole_size): New function.
2828         (Output_fill_debug_line::do_write): New function.
2829         (Output_section::Output_section): Initialize new data member.
2830         (Output_section::set_final_data_size): Ensure patch space is larger
2831         than minimum hole size.
2832         (Output_section::do_write): Fill holes in debug sections.
2833         * output.h (Output_fill): New class.
2834         (Output_fill_debug_info): New class.
2835         (Output_fill_debug_line): New class.
2836         (Output_section::set_free_space_fill): New function.
2837         (Output_section::free_space_fill_): New data member.
2838         * testsuite/Makefile.am (incremental_test_3): Add
2839         --incremental-patch option.
2840         (incremental_test_4): Likewise.
2841         (incremental_test_5): Likewise.
2842         (incremental_test_6): Likewise.
2843         (incremental_copy_test): Likewise.
2844         (incremental_common_test_1): Likewise.
2845         * testsuite/Makefile.in: Regenerate.
2846
2847 2011-08-26  Nick Clifton  <nickc@redhat.com>
2848
2849         * po/es.po: Updated Spanish translation.
2850
2851 2011-08-01  Cary Coutant  <ccoutant@google.com>
2852
2853         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2854         * gold/testsuite/Makefile.in: Regenerate.
2855         * gold/testsuite/justsyms_exec.c: New source file.
2856         * gold/testsuite/justsyms_lib.c: New source file.
2857
2858 2011-08-01  Cary Coutant  <ccoutant@google.com>
2859
2860         * layout.cc (Layout::set_segment_offsets): Don't realign text
2861         segment if -Ttext was specified.
2862         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2863         file type.
2864         * object.h (Sized_relobj_file::e_type): New function.
2865         (Sized_relobj_file::e_type_): New data member.
2866         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2867         base address for ET_EXEC files.
2868         * target.cc (Target::do_make_elf_object_implementation): Allow
2869         ET_EXEC files with --just-symbols option.
2870
2871 2011-07-28  Cary Coutant  <ccoutant@google.com>
2872
2873         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2874         Add thread_number parameter.
2875         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2876         * workqueue-threads.cc
2877         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2878         current thread if its thread number is greater than desired thread
2879         count.
2880         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2881         Add thread_number parameter.
2882         (Workqueue::should_cancel_thread): Likewise.
2883         (Workqueue::find_runnable_or_wait): Pass thread_number to
2884         should_cancel_thread.
2885         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2886         parameter.
2887
2888 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2889
2890         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2891         only after checking if it cannot be forced local.
2892         * symtab.h (is_externally_visible): Check if the symbol is not forced
2893         local.
2894
2895 2011-07-15  Ian Lance Taylor  <iant@google.com>
2896
2897         * options.h (class General_options): Add --print-output-format.
2898         Move -EL next to -EB, for  better --help output.
2899         * target-select.cc: Include <cstdio>, "options.h", and
2900         "parameters.h".
2901         (Target_selector::do_target_bfd_name): New function.
2902         (print_output_format): New function.
2903         * target-select.h (class Target_selector): Update declarations.
2904         (Target_selector::target_bfd_name): New function.
2905         (print_output_format): Declare.
2906         * main.cc: Include "target-select.h".
2907         (main): Handle --print-output-format.
2908         * gold.cc: Include "target-select.h".
2909         (queue_initial_tasks): Handle --print-output-format when there are
2910         no input files.
2911         * parameters.cc (parameters_force_valid_target): Give a better
2912         error message if -EB/-EL does not match target.
2913         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2914         function.
2915
2916 2011-07-15  Ian Lance Taylor  <iant@google.com>
2917
2918         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2919         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2920         (Output_data_plt_i386::do_write): Write address of .dynamic
2921         section to first entry in .got.plt section.
2922         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2923         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2924         Initialize layout_.
2925         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2926         section to first entry in .got.plt section.
2927         * layout.h (Layout::dynamic_section): New function.
2928
2929 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2930
2931         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2932         to claim_file call.
2933         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2934         input_section_position_, and input_section_glob_.
2935         (read_layout_from_file): Call function section_ordering_specified.
2936         * layout.h (is_section_ordering_specified): New function.
2937         (section_ordering_specified): New function.
2938         (section_ordering_specified_): New boolean member.
2939         * main.cc(main): Call load_plugins after layout object is defined.
2940         * output.cc (Output_section::add_input_section): Use
2941         function section_ordering_specified to check if section ordering is
2942         needed.
2943         * output.cc (Output_section::add_relaxed_input_section): Use
2944         function section_ordering_specified to check if section ordering is
2945         needed.
2946         (Output_section::update_section_layout): New function.
2947         (Output_section::sort_attached_input_sections): Check if input section
2948         must be reordered.
2949         * output.h (Output_section::update_section_layout): New function.
2950         * plugin.cc (get_section_count): New function.
2951         (get_section_type): New function.
2952         (get_section_name): New function.
2953         (get_section_contents): New function.
2954         (update_section_order): New function.
2955         (allow_section_ordering): New function.
2956         (Plugin::load): Add the new interfaces to the transfer vector.
2957         (Plugin_manager::load_plugins): New parameter.
2958         (Plugin_manager::all_symbols_read): New parameter.
2959         (Plugin_manager::claim_file): New parameter. Save the elf object for
2960         unclaimed objects.
2961         (Plugin_manager::get_elf_object): New function.
2962         (Plugin_manager::get_view): Change to directly use the bool to check
2963         if get_view is called from claim_file_hook.
2964         * plugin.h (input_objects): New function
2965         (Plugin__manager::load_plugins): New parameter.
2966         (Plugin_manager::claim_file): New parameter.
2967         (Plugin_manager::get_elf_object): New function.
2968         (Plugin_manager::in_claim_file_handler): New function.
2969         (Plugin_manager::in_claim_file_handler_): New member.
2970         (layout): New function.
2971         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2972         handler with an extra parameter. Make the elf object before calling
2973         claim_file handler.
2974         * testsuite/plugin_test.c (get_section_count): New function pointer.
2975         (get_section_type): New function pointer.
2976         (get_section_name): New function pointer.
2977         (get_section_contents): New function pointer.
2978         (update_section_order): New function pointer.
2979         (allow_section_ordering): New function pointer.
2980         (onload): Check if the new interfaces exist.
2981
2982 2011-07-13  Ian Lance Taylor  <iant@google.com>
2983
2984         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2985         relro section.
2986         * x86_64.cc (Target_x86_64::got_section): Likewise.
2987         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2988         (relro_now_test_SOURCES): New variable.
2989         (relro_now_test_DEPENDENCIES): New variable.
2990         (relro_now_test_LDFLAGS): New variable.
2991         (relro_now_test_LDADD): New variable.
2992         (relro_now_test.so): New target.
2993         * testsuite/Makefile.in: Rebuild.
2994
2995 2011-07-12  Ian Lance Taylor  <iant@google.com>
2996
2997         PR gold/12980
2998         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2999         GLOB_DAT relocation rather than a RELATIVE relocation for a
3000         protected symbol when creating a shared library.
3001         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3002         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3003         * testsuite/protected_main_1.cc (main): Test that protected
3004         function has same address.
3005
3006 2011-07-11  Ian Lance Taylor  <iant@google.com>
3007
3008         PR gold/12979
3009         * options.h (class General_options): Add -Bgroup.
3010         * options.cc (General_options::finalize): If -Bgroup is set,
3011         default to --unresolved-symbols=report-all.
3012         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3013         * target-reloc.h (issue_undefined_symbol_error): Handle
3014         --unresolved-symbols=report-all.
3015
3016 2011-07-08  Ian Lance Taylor  <iant@google.com>
3017
3018         PR gold/11985
3019         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3020         if linker script discards key sections.
3021         (Layout::create_dynamic_symtab): Likewise.
3022         (Layout::assign_local_dynsym_offsets): Likewise.
3023         (Layout::sized_create_version_sections): Likewise.
3024         (Layout::create_interp): Likewise.
3025         (Layout::finish_dynamic_section): Likewise.
3026         (Layout::set_dynamic_symbol_size): Likewise.
3027
3028 2011-07-08  Ian Lance Taylor  <iant@google.com>
3029
3030         PR gold/12386
3031         * options.h (class General_options): Add --unresolved-symbols.
3032         * target-reloc.h (issue_undefined_symbol_error): Check
3033         --unresolved-symbols.  Add comments.
3034
3035 2011-07-08  Ian Lance Taylor  <iant@google.com>
3036
3037         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3038         expression more complex.
3039
3040 2011-07-08  Ian Lance Taylor  <iant@google.com>
3041
3042         PR gold/11317
3043         * target-reloc.h (issue_undefined_symbol_error): New inline
3044         function, broken out of relocate_section.
3045         (relocate_section): Call issue_undefined_symbol_error.
3046         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3047         there is no TLS segment if we are about to issue an undefined
3048         symbol error.
3049         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3050
3051 2011-07-08  Ian Lance Taylor  <iant@google.com>
3052
3053         PR gold/12279
3054         * resolve.cc (Symbol_table::should_override): Add fromtype
3055         parameter.  Change all callers.  Give error when linking together
3056         TLS and non-TLS symbol.
3057         (Symbol_table::should_override_with_special): Add fromtype
3058         parameter.  Change all callers.
3059         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3060         there is no TLS segment if we have reported some errors.
3061         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3062
3063 2011-07-08  Ian Lance Taylor  <iant@google.com>
3064
3065         PR gold/12372
3066         * target.h (Target::plt_address_for_global): New function.
3067         (Target::plt_address_for_local): New function.
3068         (Target::plt_section_for_global): Remove.
3069         (Target::plt_section_for_local): Remove.
3070         (Target::do_plt_address_for_global): New virtual function.
3071         (Target::do_plt_address_for_local): New virtual function.
3072         (Target::do_plt_section_for_global): Remove.
3073         (Target::do_plt_section_for_local): Remove.
3074         (Target::register_global_plt_entry): Add Symbol_table and Layout
3075         parameters.
3076         * output.cc (Output_data_got::Got_entry::write): Use
3077         plt_address_for_global and plt_address_for_local.
3078         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3079         address of output section.
3080         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3081         got_irelative_, and irelative_count_ fields.  Update
3082         declarations.
3083         (Output_data_plt_i386::has_irelative_section): New function.
3084         (Output_data_plt_i386::entry_count): Add irelative_count_.
3085         (Output_data_plt_i386::set_final_data_size): Likewise.
3086         (class Target_i386): Add got_irelative_ and rel_irelative_
3087         fields.  Update declarations.
3088         (Target_i386::Target_i386): Initialize new fields.
3089         (Target_i386::do_plt_address_for_global): New function replacing
3090         do_plt_section_for_global.
3091         (Target_i386::do_plt_address_for_local): New function replacing
3092         do_plt_section_for_local.
3093         (Target_i386::got_section): Create got_irelative_.
3094         (Target_i386::rel_irelative_section): New function.
3095         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3096         fields.  Don't define __rel_iplt_{start,end}.
3097         (Output_data_plt_i386::add_entry): Add symtab and layout
3098         parameters.  Change all callers.  Use different PLT and GOT for
3099         IFUNC symbols.
3100         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3101         layout parameters.  Change all callers.  Use different PLT and
3102         GOT.
3103         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3104         (Output_data_plt_i386::rel_irelative): New function.
3105         (Output_data_plt_i386::address_for_global): New function.
3106         (Output_data_plt_i386::address_for_local): New function.
3107         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3108         IRELATIVE GOT when changing IFUNC GOT entries.
3109         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3110         reloc.
3111         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3112         if we didn't create an IRELATIVE GOT.
3113         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3114         plt_address_for_local.
3115         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3116         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3117         got_irelative_, and irelative_count_ fields.  Update
3118         declarations.
3119         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3120         Initialize new fields.  Remove symtab parameter.  Change all
3121         callers.
3122         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3123         irelative_count_.
3124         (Output_data_plt_x86_64::has_irelative_section): New function.
3125         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3126         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3127         fields.  Update declarations.
3128         (Target_x86_64::Target_x86_64): Initialize new fields.
3129         (Target_x86_64::do_plt_address_for_global): New function replacing
3130         do_plt_section_for_global.
3131         (Target_x86_64::do_plt_address_for_local): New function replacing
3132         do_plt_section_for_local.
3133         (Target_x86_64::got_section): Create got_irelative_.
3134         (Target_x86_64::rela_irelative_section): New function.
3135         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3136         all callers.  Don't create __rel_iplt_{start,end}.
3137         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3138         parameters.  Change all callers.  Use different PLT and GOT for
3139         IFUNC symbols.
3140         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3141         layout parameters.  Change all callers.  Use different PLT and
3142         GOT.
3143         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3144         parameters.  Change all callers.  Use different PLT and GOT for
3145         IFUNC symbols.
3146         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3147         (Output_data_plt_x86_64::rela_irelative): New function.
3148         (Output_data_plt_x86_64::address_for_global): New function.
3149         (Output_data_plt_x86_64::address_for_local): New function.
3150         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3151         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3152         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3153         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3154         parameters.
3155         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3156         reloc.
3157         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3158         symbols if we didn't create an IRELATIVE GOT.
3159         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3160         plt_address_for_local.
3161         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3162         * testsuite/ifuncvar1.c: New test file.
3163         * testsuite/ifuncvar2.c: New test file.
3164         * testsuite/ifuncvar3.c: New test file.
3165         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3166         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3167         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3168         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3169         * testsuite/Makefile.in: Rebuild.
3170
3171 2011-07-07  Cary Coutant  <ccoutant@google.com>
3172
3173         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3174         (two_file_test_1_ndebug.o): Likewise.
3175         (two_file_test_1b_ndebug.o): Likewise.
3176         (two_file_test_2_ndebug.o): Likewise.
3177         (two_file_test_main_ndebug.o): Likewise.
3178         (incremental_test_2): Link with no-debug versions.
3179
3180 2011-07-06  Cary Coutant  <ccoutant@google.com>
3181
3182         * gold/incremental.cc
3183         (Output_section_incremental_inputs::write_info_blocks): Check for
3184         hidden and internal symbols.
3185
3186 2011-07-06  Cary Coutant  <ccoutant@google.com>
3187
3188         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3189         Check disposition for startup file.
3190         (Incremental_inputs::report_command_line): Ignore
3191         --incremental-startup-unchanged option.
3192         * options.cc (General_options::parse_incremental_startup_unchanged):
3193         New function.
3194         (General_options::General_options): Initialize new data member.
3195         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3196         (General_options): Add --incremental-startup-unchanged option.
3197         (General_options::incremental_startup_disposition): New function.
3198         (General_options::incremental_startup_disposition_): New data member.
3199
3200 2011-07-06  Cary Coutant  <ccoutant@google.com>
3201
3202         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3203         input file index to Script_info ctor.
3204         (Sized_incremental_binary::do_file_has_changed): Find the
3205         command-line argument for files named in scripts.
3206         * incremental.h (Script_info::Script_info): New ctor
3207         with input file index.
3208         (Script_info::input_file_index): New function.
3209         (Script_info::input_file_index_): New data member.
3210         (Incremental_binary::get_library): Add const.
3211         (Incremental_binary::get_script_info): Add const.
3212         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3213         * testsuite/Makefile.am (incremental_test_5): New test case.
3214         (incremental_test_6): New test case.
3215         * testsuite/Makefile.in: Regenerate.
3216
3217 2011-07-06  Cary Coutant  <ccoutant@google.com>
3218
3219         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3220         debug output when command lines differ.
3221
3222 2011-07-06  Cary Coutant  <ccoutant@google.com>
3223
3224         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3225         --incremental-patch option.
3226         * layout.cc (Free_list::allocate): Extend allocation beyond original
3227         end if enabled.
3228         (Layout::make_output_section): Mark sections that should get
3229         patch space.
3230         * options.cc (parse_percent): New function.
3231         * options.h (parse_percent): New function.
3232         (DEFINE_percent): New macro.
3233         (General_options): Add --incremental-patch option.
3234         * output.cc (Output_section::Output_section): Initialize new data
3235         members.
3236         (Output_section::add_input_section): Print section name when out
3237         of patch space.
3238         (Output_section::add_output_section_data): Likewise.
3239         (Output_section::set_final_data_size): Add patch space when
3240         doing --incremental-full.
3241         (Output_section::do_reset_address_and_file_offset): Remove patch
3242         space.
3243         (Output_segment::set_section_list_addresses): Print debug output
3244         only if --incremental-update.
3245         * output.h (Output_section::set_is_patch_space_allowed): New function.
3246         (Output_section::is_patch_space_allowed_): New data member.
3247         (Output_section::patch_space_): New data member.
3248         * parameters.cc (Parameters::incremental_full): New function.
3249         * parameters.h (Parameters::incremental_full): New function
3250         * testsuite/Makefile.am (incremental_test_2): Add test for
3251         --incremental-patch option.
3252         * testsuite/Makefile.in: Regenerate.
3253         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3254         (t18): Remove function body.
3255
3256 2011-07-05  Doug Kwan  <dougkwan@google.com>
3257
3258         PR gold/12771
3259         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3260         Arm_Address type for relocation result.
3261         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3262         overflow check.
3263         (Arm_relocate_functions::abs32): Use unaligned access.
3264         (Arm_relocate_functions::rel32): Ditto.
3265         (Arm_relocate_functions::prel31): Ditto.
3266         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3267         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3268         static data relocations.
3269         * testsuite/Makefile.in: Regnerate.
3270         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3271
3272 2011-07-05  Ian Lance Taylor  <iant@google.com>
3273
3274         PR gold/12392
3275         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3276         symbols if necessary.
3277         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3278
3279 2011-07-05  Ian Lance Taylor  <iant@google.com>
3280
3281         PR gold/12952
3282         * resolve.cc (Symbol::override_base_with_special): Simply override
3283         version with special symbol version, ignoring previous version.
3284
3285 2011-07-05  Ian Lance Taylor  <iant@google.com>
3286
3287         * object.cc (Sized_relobj_file::include_section_group): Add
3288         information to comment about signature location.
3289
3290 2011-07-02  Ian Lance Taylor  <iant@google.com>
3291
3292         PR gold/12957
3293         * options.h (class General_options): Add -f and -F.
3294         * options.cc (General_options::finalize): Fatal error if -f/-F
3295         are used without -shared.
3296         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3297
3298 2011-07-02  Ian Lance Taylor  <iant@google.com>
3299
3300         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3301
3302 2011-07-01  Ian Lance Taylor  <iant@google.com>
3303
3304         PR gold/12525
3305         PR gold/12952
3306         * resolve.cc (Symbol::override_base_with_special): Don't override
3307         the version if the overriding symbol has a different name.
3308         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3309         all callers.  If we give an error about an undefined version,
3310         define the base version if necessary.
3311         * dynobj.h (class Versions): Update declaration.
3312         * testsuite/weak_alias_test_5.cc: New file.
3313         * testsuite/weak_alias_test.script: New file.
3314         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3315         and versioned_alias have the right value, and call t2.
3316         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3317         weak_alias_test_5.so.
3318         (weak_alias_test_LDADD): Likewise.
3319         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3320         * testsuite/Makefile.in: Rebuild.
3321
3322 2011-07-01  Ian Lance Taylor  <iant@google.com>
3323
3324         PR gold/12525
3325         * options.h (class General_options): Support -z notext.
3326         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3327         -Wl,-z,notext.
3328         (two_file_shared_nonpic.so): Likewise.
3329         (two_file_shared_mixed.so): Likewise.
3330         (two_file_shared_mixed_1.so): Likewise.
3331         (weak_undef_lib_nonpic.so): Likewise.
3332         (alt/weak_undef_lib_nonpic.so): Likewise.
3333         (tls_test_shared_nonpic.so): Likewise.
3334         * testsuite/Makefile.in: Rebuild.
3335
3336 2011-07-01  Ian Lance Taylor  <iant@google.com>
3337
3338         PR gold/12525
3339         * configure.ac: Test whether static linking works, setting
3340         the automake conditional HAVE_STATIC.
3341         * testsuite/Makefile.am: Disable tests using -static if
3342         HAVE_STATIC is not true.
3343         * configure, testsuite/Makefile.in: Rebuild.
3344
3345 2011-07-01  Ian Lance Taylor  <iant@google.com>
3346
3347         PR gold/12525
3348         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3349         Assert if we see DW_EH_PE_indirect.
3350         * target.h (Target::ehframe_datarel_base): New function.
3351         (Target::do_ehframe_datarel_base): New target function.
3352         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3353         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3354         function.
3355
3356 2011-07-01  Ian Lance Taylor  <iant@google.com>
3357
3358         PR gold/12571
3359         * options.h (class General_options): Add
3360         --ld-generated-unwind-info.
3361         * ehframe.cc (Fde::write): Add address parameter.  Change all
3362         callers.  If associated with PLT, fill in address and size.
3363         (Cie::set_output_offset): Only add merge mapping if there is an
3364         object.
3365         (Cie::write): Add address parameter.  Change all callers.
3366         (Eh_frame::add_ehframe_for_plt): New function.
3367         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3368         input_offset_ fields into union u_, with new plt field.
3369         (Fde::Fde): Adjust for new union field.
3370         (Fde::Fde) [Output_data version]: New constructor.
3371         (Fde::add_mapping): Only add merge mapping if there is an object.
3372         (class Cie): Update declarations.
3373         (class Eh_frame): Declare add_ehframe_for_plt.
3374         * layout.cc (Layout::layout_eh_frame): Break out code into
3375         make_eh_frame_section, and call it.
3376         (Layout::make_eh_frame_section): New function.
3377         (Layout::add_eh_frame_for_plt): New function.
3378         * layout.h (class Layout): Update declarations.
3379         * merge.cc (Merge_map::add_mapping): Add assertion.
3380         * i386.cc: Include "dwarf.h".
3381         (class Output_data_plt_i386): Make first_plt_entry,
3382         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3383         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3384         and plt_eh_frame_fde.
3385         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3386         boundary.  Call add_eh_frame_for_plt if appropriate.
3387         * x86_64.cc: Include "dwarf.h".
3388         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3389         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3390         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3391         and plt_eh_frame_fde.
3392         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3393         appropriate.
3394
3395 2011-06-29  Ian Lance Taylor  <iant@google.com>
3396
3397         PR gold/12629
3398         * object.cc (Sized_relobj_file::layout_section): Change shdr
3399         parameter to be const.
3400         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3401         out of do_layout.
3402         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3403         appropriate.  Call layout_eh_frame_section.
3404         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3405         sections.
3406         * object.h (class Sized_relobj_file): Update declarations.
3407
3408 2011-06-29  Ian Lance Taylor  <iant@google.com>
3409
3410         PR gold/12652
3411         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3412         modifier.
3413         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3414
3415 2011-06-29  Ian Lance Taylor  <iant@google.com>
3416
3417         PR gold/12675
3418         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3419         SHT_X86_64_UNWIND.
3420         * layout.cc (Layout::layout_eh_frame): Likewise.
3421
3422 2011-06-29  Ian Lance Taylor  <iant@google.com>
3423
3424         PR gold/12695
3425         * layout.cc (Layout::symtab_section_shndx): New function.
3426         * layout.h (class Layout): Declare symtab_section_shndx.
3427         * output.cc (Output_section::write_header): Call it.
3428
3429 2011-06-29  Ian Lance Taylor  <iant@google.com>
3430
3431         PR gold/12818
3432         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3433         symbols which are not used in a relocation.
3434
3435 2011-06-28  Ian Lance Taylor  <iant@google.com>
3436
3437         PR gold/12898
3438         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3439         script create indistinguishable segments.
3440         (Layout::set_segment_offsets): Use stable_sort when sorting
3441         segments.  Pass this to Compare_segments constructor.
3442         * layout.h (class Layout): Make segment_precedes non-static.
3443         (class Compare_segments): Change from struct to class.  Add
3444         layout_ field.  Add constructor.
3445         * script-sections.cc
3446         (Script_sections::attach_sections_using_phdrs_clause): Rename
3447         local orphan to is_orphan.  Don't report failure to put empty
3448         section in segment.  On attachment failure, report name of
3449         section, and attach to first PT_LOAD segment.
3450
3451 2011-06-28  Ian Lance Taylor  <iant@google.com>
3452
3453         PR gold/12934
3454         * target-select.cc (Target_selector::Target_selector): Add
3455         emulation parameter.  Change all callers.
3456         (select_target_by_bfd_name): Rename from select_target_by_name.
3457         Change all callers.
3458         (select_target_by_emulation): New function.
3459         (supported_emulation_names): New function.
3460         * target-select.h (class Target_selector): Add emulation_ field.
3461         Update declarations.
3462         (Target_selector::recognize_by_bfd_name): Rename from
3463         recognize_by_name.  Change all callers.
3464         (Target_selector::supported_bfd_names): Rename from
3465         supported_names.  Change all callers.
3466         (Target_selector::recognize_by_emulation): New function.
3467         (Target_selector::supported_emulations): New function.
3468         (Target_selector::emulation): New function.
3469         (Target_selector::do_recognize_by_bfd_name): Rename from
3470         do_recognize_by_name.  Change all callers.
3471         (Target_selector::do_supported_bfd_names): Rename from
3472         do_supported_names.  Change all callers.
3473         (Target_selector::do_recognize_by_emulation): New function.
3474         (Target_selector::do_supported_emulations): New function.
3475         (select_target_by_bfd_name): Change name in declaration.
3476         (select_target_by_emulation): Declare.
3477         (supported_emulation_names): Declare.
3478         * parameters.cc (parameters_force_valid_target): Try to find
3479         target based on emulation from -m option.
3480         * options.h (class General_options): Change doc string for -m.
3481         * options.cc (help): Print emulations.
3482         (General_options::parse_V): Likewise.
3483         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3484         Add emulation parameter.  Change all callers.
3485
3486 2011-06-28  Ian Lance Taylor  <iant@google.com>
3487
3488         * target.h (class Target): Add osabi_ field.
3489         (Target::osabi): New function.
3490         (Target::set_osabi): New function.
3491         (Target::Target): Initialize osabi_.
3492         (Target::do_adjust_elf_header): Make pure virtual.
3493         (Sized_target::do_adjust_elf_header): Declare.
3494         * target.cc (Sized_target::do_adjust_elf_header): New function.
3495         (class Sized_target): Instantiate all versions.
3496         * freebsd.h (class Target_freebsd): Remove.
3497         (Target_selector_freebsd::do_recognize): Call set_osabi on
3498         Target.
3499         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3500         (Target_selector_freebsd::set_osabi): Remove.
3501         * i386.cc (class Target_i386): Inherit from Sized_target rather
3502         than Target_freebsd.
3503         * x86_64.cc (class Target_x86_64): Likewise.
3504
3505 2011-06-28  Ian Lance Taylor  <iant@google.com>
3506
3507         * target.h (Target::can_check_for_function_pointers): Rewrite.
3508         Make non-virtual.
3509         (Target::can_icf_inline_merge_sections): Likewise.
3510         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3511         (Target::Target_info): Add can_icf_inline_merge_sections field.
3512         (Target::do_can_check_for_function_pointers): New virtual
3513         function.
3514         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3515         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3516         from can_check_for_function_pointers, move in file.
3517         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3518         section_may_have_icf_unsafe_poineters, move in file.
3519         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3520         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3521         Rename from can_check_for_function_pointers, move in file.
3522         (Target_i386::can_icf_inline_merge_sections): Remove.
3523         (Target_i386::i386_info): Initialize
3524         can_icf_inline_merge_sections.
3525         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3526         Initialize can_icf_inline_merge_sections.
3527         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3528         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3529         Rename from can_check_for_function_pointers, move in file.
3530         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3531         (Target_x86_64::x86_64_info): Initialize
3532         can_icf_inline_merge_sections.
3533         * testsuite/testfile.cc (Target_test::test_target_info):
3534         Likewise.
3535         * icf.cc (get_section_contents): Correct formatting.
3536
3537 2011-06-27  Ian Lance Taylor  <iant@google.com>
3538
3539         * symtab.cc (Symbol::versioned_name): New function.
3540         (Symbol_table::add_to_final_symtab): Use versioned_name when
3541         appropriate.
3542         (Symbol_table::sized_write_symbol): Likewise.
3543         * symtab.h (class Symbol): Declare versioned_name.
3544         * stringpool.h (class Stringpool_template): Add variant of add
3545         which takes a std::basic_string.
3546         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3547         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3548         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3549         (ver_test_12.o): New target.
3550         * testsuite/Makefile.in: Rebuild.
3551
3552 2011-06-27  Doug Kwan  <dougkwan@google.com>
3553
3554         * arm.cc (Arm_relocate_functions::thm_jump8,
3555         Arm_relocate_functions::thm_jump11): Use a wider signed
3556         type to compute offset.
3557         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3558         arm_thm_jump8.
3559         * testsuite/Makefile.in: Regenerate.
3560         * testsuite/arm_branch_in_range.sh: Check test results of
3561         arm_thm_jump11 and arm_thm_jump8.
3562         * testsuite/arm_thm_jump11.s: New test source file.
3563         * testsuite/arm_thm_jump11.t: New linker script.
3564         * testsuite/arm_thm_jump8.s: New test source file.
3565         * testsuite/arm_thm_jump8.t: New linker script.
3566
3567 2011-06-24  Ian Lance Taylor  <iant@google.com>
3568
3569         * layout.cc: Include "object.h".
3570         (ctors_sections_in_init_array): New static variable.
3571         (Layout::is_ctors_in_init_array): New function.
3572         (Layout::layout): Add entry to ctors_sections_in_init_array if
3573         appropriate.
3574         * layout.h (class Layout): Declare is_ctors_in_init_array.
3575         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3576         is_ctors_reverse_view is set.
3577         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3578         all callers.  Set is_ctors_reverse_view field of View_size.
3579         (Sized_relobj_file::reverse_words): New function.
3580         * object.h (Sized_relobj_file::View_size): Add
3581         is_ctors_reverse_view field.
3582         (class Sized_relobj_file): Update declarations.
3583         * testsuite/initpri3.c: New test.
3584         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3585         initpri3b.
3586         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3587         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3588         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3589         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3590         * testsuite/Makefile.in: Rebuild.
3591
3592 2011-06-24  Cary Coutant  <ccoutant@google.com>
3593
3594         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3595         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3596         (debug_msg_cdebug.err): New targets.
3597         * testsuite/Makefile.in: Regenerate.
3598         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3599         Fix checks for link with shared library.
3600
3601 2011-06-24  Doug Kwan  <dougkwan@google.com>
3602
3603         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3604         skip empty text sections.
3605         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3606
3607 2011-06-22  Ian Lance Taylor  <iant@google.com>
3608
3609         PR gold/12910
3610         * options.h (class General_options): Add --ctors-in-init-array.
3611         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3612         friends as SHT_PROGBITS for merging sections.
3613         (Layout::layout): Remove special handling of .init_array and
3614         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3615         and .dtors if ctors_in_init_array.
3616         (Layout::make_output_section): Force correct section types for
3617         .init_array and friends.  Don't sort if doing relocatable link,
3618         Don't sort .ctors and .dtors if ctors_in_init_array.
3619         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3620         (Layout::output_section_name): Add relobj parameter.  Change all
3621         callers.  Handle .ctors. and .dtors. in code rather than table.
3622         Handle .ctors and .dtors if ctors_in_init_array.
3623         (Layout::match_file_name): New function, moved from output.cc.
3624         * layout.h (class Layout): Update declarations.
3625         * output.cc: Include "layout.h".
3626         (Input_section_sort_entry::get_priority): New function.
3627         (Input_section_sort_entry::match_file_name): Just call
3628         Layout::match_file_name.
3629         (Output_section::Input_section_sort_init_fini_compare::operator()):
3630         Handle .ctors and .dtors.  Sort by explicit priority rather than
3631         by name.
3632         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3633         * testsuite/initpri2.c: New test.
3634         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3635         (check_PROGRAMS): Add initpri2.
3636         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3637         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3638         * configure, testsuite/Makefile.in: Rebuild.
3639
3640 2011-06-19  Ian Lance Taylor  <iant@google.com>
3641
3642         PR gold/12880
3643         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3644         .interp section to a PT_INTERP segment even if we have seen a
3645         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3646         clause in a linker script.
3647         (Layout::finalize): Don't create a .interp section if we've
3648         already create a PT_INTERP segment.
3649         (Layout::create_interp): Always call choose_output_section (revert
3650         patch of 2011-06-17).  Don't create PT_INTERP segment.
3651         * script-sections.cc
3652         (Script_sections::create_note_and_tls_segments): Add a .interp
3653         section to a PT_INTERP segment even if we have seen a
3654         --dynamic-linker option.
3655
3656 2011-06-18  Ian Lance Taylor  <iant@google.com>
3657
3658         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3659         merely because a non-PT_LOAD segment has a dynamic reloc.
3660
3661 2011-06-18  Ian Lance Taylor  <iant@google.com>
3662
3663         * layout.cc (Layout::finish_dynamic_section): Don't create
3664         DT_FLAGS entry if not needed.
3665
3666 2011-06-18  Ian Lance Taylor  <iant@google.com>
3667
3668         PR gold/12745
3669         * layout.cc (Layout::layout_eh_frame): Correct handling of
3670         writable .eh_frame section.
3671
3672 2011-06-17  Ian Lance Taylor  <iant@google.com>
3673
3674         PR gold/12893
3675         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3676         symbol is redefined with the exact same object and value.
3677
3678 2011-06-17  Ian Lance Taylor  <iant@google.com>
3679
3680         PR gold/12880
3681         * layout.h (class Layout): Add interp_segment_ field.
3682         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3683         (Layout::attach_allocated_section_to_segment): If making shared
3684         library, put .interp section in PT_INTERP segment.
3685         (Layout::finalize): Also call create_interp if -dynamic-linker
3686         option was used.
3687         (Layout::create_interp): Assert that there is no PT_INTERP
3688         segment.  If not using a SECTIONS clause, use make_output_section.
3689         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3690         * script-sections.cc
3691         (Script_sections::create_note_and_tls_segments): If making shared
3692         library, put .interp section in PT_INTERP segment.
3693
3694 2011-06-17  Ian Lance Taylor  <iant@google.com>
3695
3696         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3697         when making a shared library.
3698
3699 2011-06-17  Ian Lance Taylor  <iant@google.com>
3700
3701         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3702         parameter.  Change all callers.  Don't issue warning about PC32
3703         against locally defined symbol.
3704
3705 2011-06-16  Ian Lance Taylor  <iant@google.com>
3706
3707         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3708         occurs in same object.
3709
3710 2011-06-14  Alan Modra  <amodra@gmail.com>
3711
3712         * po/POTFILES.in: Regenerate.
3713
3714 2011-06-09  Ian Lance Taylor  <iant@google.com>
3715
3716         * script-sections.cc
3717         (Orphan_output_section::set_section_addresses): For a relocatable
3718         link set address to 0.
3719
3720 2011-06-09  Cary Coutant  <ccoutant@google.com>
3721
3722         PR gold/12804
3723         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3724         used with --compress-debug-sections.
3725         * gold/object.cc (Sized_relobj_file::do_layout): Report
3726         uncompressed size of compressed input sections.
3727
3728 2011-06-08  Cary Coutant  <ccoutant@google.com>
3729
3730         PR gold/12804
3731         * testsuite/two_file_test_2_v1.cc: Change initialization of
3732         v2 to keep it in .data.
3733
3734 2011-06-07  Cary Coutant  <ccoutant@google.com>
3735
3736         * common.cc (Symbol_table::do_allocate_commons_list): Call
3737         gold_fallback.
3738         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3739         (Errors::fallback): New function.
3740         (gold_fallback): New function.
3741         * errors.h (Errors::fallback): New function.
3742         * gold.cc (gold_exit): Change status parameter to enum; adjust
3743         all callers.
3744         (queue_initial_tasks): Call gold_fallback.
3745         * gold.h: Include cstdlib.
3746         (Exit_status): New enum type.
3747         (gold_exit): Change status parameter to enum.
3748         (gold_fallback): New function.
3749         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3750         (Layout::create_symtab_sections): Likewise.
3751         (Layout::create_shdrs): Likewise.
3752         * main.cc (main): Adjust call to gold_exit.
3753         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3754         (Output_data_got::add_got_entry_pair): Likewise.
3755         (Output_section::add_input_section): Likewise.
3756         (Output_section::add_output_section_data): Likewise.
3757         (Output_segment::set_section_list_addresses): Likewise.
3758         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3759
3760 2011-06-07  Cary Coutant  <ccoutant@google.com>
3761
3762         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3763         for incremental links.
3764         * output.cc (Output_segment::set_section_list_addresses): Remove
3765         FIXME and test for TLS or BSS.
3766
3767 2011-06-07  Cary Coutant  <ccoutant@google.com>
3768
3769         * testsuite/Makefile.am: Add incremental_copy_test,
3770         incremental_common_test_1.
3771         * testsuite/Makefile.in: Regenerate.
3772         * testsuite/common_test_1_v1.c: New source file.
3773         * testsuite/common_test_1_v2.c: New source file.
3774         * testsuite/copy_test_v1.cc: New source file.
3775
3776 2011-06-07  Cary Coutant  <ccoutant@google.com>
3777
3778         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3779         update, allocate common from bss section's free list.
3780         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3781         linker-defined symbols.
3782         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3783         Skip GOT and PLT entries that are no longer referenced.
3784         (Output_section_incremental_inputs::write_info_blocks): Mark
3785         linker-defined symbols.
3786         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3787         * output.cc (Output_section::allocate): New function.
3788         * output.h (Output_section::allocate): New function.
3789         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3790         linker-defined symbols.
3791         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3792         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3793         (Symbol::init_base_output_data): Likewise.
3794         (Symbol::init_base_output_segment): Likewise.
3795         (Symbol::init_base_constant): Likewise.
3796         (Sized_symbol::init_output_data): Likewise.
3797         (Sized_symbol::init_output_segment): Likewise.
3798         (Sized_symbol::init_constant): Likewise.
3799         (Symbol_table::do_define_in_output_data): Likewise.
3800         (Symbol_table::do_define_in_output_segment): Likewise.
3801         (Symbol_table::do_define_as_constant): Likewise.
3802         * symtab.h (Symbol::is_predefined): New function.
3803         (Symbol::init_base_output_data): Add is_predefined parameter.
3804         (Symbol::init_base_output_segment): Likewise.
3805         (Symbol::init_base_constant): Likewise.
3806         (Symbol::is_predefined_): New data member.
3807         (Sized_symbol::init_output_data): Add is_predefined parameter.
3808         (Sized_symbol::init_output_segment): Likewise.
3809         (Sized_symbol::init_constant): Likewise.
3810         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3811
3812 2011-06-07  Cary Coutant  <ccoutant@google.com>
3813
3814         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3815         instead of emit_copy_reloc.
3816         (Copy_relocs::emit_copy_reloc): Refactor.
3817         (Copy_relocs::make_copy_reloc): New function.
3818         (Copy_relocs::add_copy_reloc): Remove.
3819         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3820         section.
3821         (Copy_relocs::make_copy_reloc): New function.
3822         (Copy_relocs::add_copy_reloc): Remove.
3823         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3824         unchanged input files.
3825         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3826         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3827         Reserve BSS space for COPY relocations.
3828         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3829         (Output_section_incremental_inputs::write_info_blocks): Record
3830         whether a symbol is copied from a shared object.
3831         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3832         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3833         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3834         (Incremental_input_entry_reader::get_output_symbol_index): Add
3835         is_copy parameter.
3836         (Incremental_binary::emit_copy_relocs): New function.
3837         (Incremental_binary::do_emit_copy_relocs): New function.
3838         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3839         new data member.
3840         (Sized_incremental_binary::add_copy_reloc): New function.
3841         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3842         (Sized_incremental_binary::Copy_reloc): New struct.
3843         (Sized_incremental_binary::Copy_relocs): New typedef.
3844         (Sized_incremental_binary::copy_relocs_): New data member.
3845         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3846         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3847         * target.h (Sized_target::emit_copy_reloc): New function.
3848         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3849
3850 2011-06-02  Cary Coutant  <ccoutant@google.com>
3851
3852         PR gold/12163
3853         * gold/archive.cc (Archive::Archive): Initialize new data member.
3854         (Archive::include_all_members): Return if archive has already been
3855         included.
3856         * gold/archive.h (Archive::include_all_members_): New data member.
3857
3858 2011-06-02  Nick Clifton  <nickc@redhat.com>
3859
3860         * dynobj.h: Fix spelling mistake in comment.
3861         * output.cc: Likewise.
3862
3863 2011-05-31  Doug Kwan  <dougkwan@google.com>
3864             Asier Llano
3865
3866         PR gold/12826
3867         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3868         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3869         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3870         redundant arm_exidx_test.so.
3871         * testsuite/Makefile.in: Regenerate.
3872         (check_SCRIPTS): Add pr12826.sh
3873         (check_DATA): Add pr12826.stdout
3874         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3875         * testsuite/pr12826.sh: New file.
3876         * testsuite/pr12826_1.s: Ditto.
3877         * testsuite/pr12826_1.s: Ditto.
3878
3879 2011-05-30  Ian Lance Taylor  <iant@google.com>
3880
3881         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3882         sections.
3883
3884 2011-05-29  Ian Lance Taylor  <iant@google.com>
3885
3886         PR gold/12804
3887         * testsuite/Makefile.am: Use different file name for two_file_test
3888         temporary file for each incremental test.
3889         * testsuite/Makefile.in: Rebuild.
3890
3891 2011-05-29  Ian Lance Taylor  <iant@google.com>
3892
3893         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3894         binary input file is empty.
3895
3896 2011-05-27  Ian Lance Taylor  <iant@google.com>
3897
3898         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3899         (ver_test_9.so): Likewise.
3900         * testsuite/Makefile.in: Rebuild.
3901
3902 2011-05-26 Cary Coutant  <ccoutant@google.com>
3903
3904         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3905         * incremental.cc (Incremental_inputs::report_input_section): Fix
3906         comment, indentation.
3907         (Incremental_inputs::report_comdat_group): New function.
3908         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3909         of data for incremental input file entry.
3910         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3911         group count, COMDAT group signatures.
3912         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3913         an unchanged input file.
3914         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3915         Initialize new data member.
3916         (Incremental_object_entry::add_comdat_group): New function.
3917         (Incremental_object_entry::get_comdat_group_count): New function.
3918         (Incremental_object_entry::get_comdat_signature_key): New function.
3919         (Incremental_object_entry::groups_): New data member.
3920         (Incremental_inputs::report_comdat_group): New function.
3921         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3922         data for incremental input file entry.
3923         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3924         (Incremental_input_entry_reader::get_input_section): Adjust size of
3925         data for incremental input file entry.
3926         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3927         (Incremental_input_entry_reader::get_comdat_group_signature): New
3928         function.
3929         * object.cc (Sized_relobj::include_section_group): Report kept
3930         COMDAT groups for incremental links.
3931
3932 2011-05-24  David Meyer  <pdox@google.com>
3933
3934         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3935         with name parameter.  Add found_name parameter.
3936         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3937         * dirsearch.h (class Dirsearch): Update declaration.
3938
3939 2011-05-24  Ian Lance Taylor  <iant@google.com>
3940
3941         * archive.cc (Library_base::should_include_member): Pull in object
3942         from archive if it defines the entry symbol.
3943         * parameters.cc (Parameters::entry): New function.
3944         * parameters.h (class Parameters): Declare entry.
3945         * output.h (class Output_file_header): Remove entry_ field.
3946         * output.cc (Output_file_header::Output_file_header): Remove entry
3947         parameter.  Change all callers.
3948         (Output_file_header::entry): Use parameters->entry.
3949         * gold.cc (queue_middle_tasks): Likewise.
3950         * plugin.cc (Plugin_hook::run): Likewise.
3951
3952 2011-05-24 Cary Coutant  <ccoutant@google.com>
3953
3954         * gold.cc (queue_initial_tasks): Pass incremental base filename
3955         to Output_file::open_base_file; don't print error message.
3956         * incremental-dump.cc (main): Adjust call to
3957         Output_file::open_for_modification.
3958         * incremental-dump.cc (main): Likewise.
3959         * incremental.cc (Incremental_inputs::report_command_line):
3960         Ignore --incremental-base option when comparing command lines.
3961         Ignore parameter when given as separate argument.
3962         * options.h (class General_options): Add --incremental-base.
3963         * output.cc (Output_file::Output_file):
3964         (Output_file::open_base_file): Add base_name and writable parameters;
3965         read base file into new file; print error message here.
3966         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3967         callers.
3968         * output.h (Output_file::open_for_modification): Rename to...
3969         (Output_file::open_base_file): ...this; add base_name and
3970         writable parameters; adjust all callers.
3971         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3972         callers.
3973         * testsuite/Makefile.am (incremental_test_4): Test
3974         --incremental-base.
3975         * testsuite/Makefile.in: Regenerate.
3976
3977 2011-05-24 Cary Coutant  <ccoutant@google.com>
3978
3979         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3980         incremental_test_4.
3981         * testsuite/Makefile.in: Regenerate.
3982         * testsuite/two_file_test_1_v1.cc: New test source file.
3983         * testsuite/two_file_test_1b_v1.cc: New test source file.
3984         * testsuite/two_file_test_2_v1.cc: New test source file.
3985
3986 2011-05-24 Cary Coutant  <ccoutant@google.com>
3987
3988         * dynobj.h (Dynobj::do_dynobj): New function.
3989         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3990         flag and soname for shared objects.
3991         * incremental.cc (Incremental_inputs::report_object): Make
3992         either Incremental_object_entry or Incremental_dynobj_entry; add
3993         soname to string table.
3994         (Incremental_inputs::report_input_section): Add assertion.
3995         (Output_section_incremental_inputs::set_final_data_size): Adjust
3996         type of input file entry for shared libraries; adjust size of
3997         shared library info entry.
3998         (Output_section_incremental_inputs::write_input_files): Write
3999         as_needed flag for shared libraries.
4000         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4001         of input file entry for shared libraries; write soname.
4002         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4003         soname from incremental info.
4004         * incremental.h (enum Incremental_input_flags): Add
4005         INCREMENTAL_INPUT_AS_NEEDED.
4006         (Incremental_input_entry::Incremental_input_entry): Initialize new
4007         data member.
4008         (Incremental_input_entry::set_as_needed): New function.
4009         (Incremental_input_entry::as_needed): New function.
4010         (Incremental_input_entry::do_dynobj_entry): New function.
4011         (Incremental_input_entry::as_needed_): New data member.
4012         (Incremental_object_entry::Incremental_object_entry): Don't check
4013         for shared library.
4014         (Incremental_object_entry::do_type): Likewise.
4015         (class Incremental_dynobj_entry): New class.
4016         (Incremental_input_entry_reader::as_needed): New function.
4017         (Incremental_input_entry_reader::get_soname): New function.
4018         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4019         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4020         size of shared library info entry.
4021         * layout.cc (Layout::finish_dynamic_section): Don't test for
4022         incremental link when adding DT_NEEDED entries.
4023         * object.h (Object::Object): Initialize new data member.
4024         (Object::dynobj): New function.
4025         (Object::set_as_needed): New function.
4026         (Object::as_needed): New function.
4027         (Object::do_dynobj): New function.
4028         (Object::as_needed_): New data member.
4029
4030 2011-05-24 Cary Coutant  <ccoutant@google.com>
4031
4032         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4033         info; adjust display of GOT entries.
4034         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4035         vector of input objects; remove file_status_.
4036         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4037         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4038         got_plt reader; call target hooks to reserve GOT entries.
4039         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4040         of input file info header and GOT info entry.
4041         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4042         relocation info.
4043         (Got_plt_view_info::got_descriptor): Remove.
4044         (Got_plt_view_info::sym_index): New data member.
4045         (Got_plt_view_info::input_index): New data member.
4046         (Local_got_offset_visitor::visit): Write input file index.
4047         (Global_got_offset_visitor::visit): Write 0 for input file index.
4048         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4049         with sym_index and input_index.
4050         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4051         incremental info GOT entry; replace got_descriptor with input_index.
4052         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4053         map from input file index to object.
4054         (Sized_relobj_incr::do_layout): Replace direct data member reference
4055         with accessor function.
4056         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4057         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4058         Adjust size of input file info header.
4059         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4060         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4061         (Incremental_input_entry_reader::get_input_section): Adjust size of
4062         input file info header.
4063         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4064         of incremental info GOT entry.
4065         (Incremental_got_plt_reader::get_got_desc): Remove.
4066         (Incremental_got_plt_reader::get_got_symndx): New function.
4067         (Incremental_got_plt_reader::get_got_input_index): New function.
4068         (Sized_incremental_binary::Sized_incremental_binary): Remove
4069         file_status_; add input_objects_.
4070         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4071         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4072         (Sized_incremental_binary::file_is_unchanged): Remove.
4073         (Sized_incremental_binary::set_input_object): New function.
4074         (Sized_incremental_binary::input_object): New function.
4075         (Sized_incremental_binary::file_status_): Remove.
4076         (Sized_incremental_binary::input_objects_): New data member.
4077         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4078         references.
4079         (Sized_relobj_incr::invalid_address): Move to base class.
4080         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4081         class.
4082         (Sized_relobj_incr::do_output_section_offset): Likewise.
4083         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4084         (Sized_relobj_incr::section_offsets_): Likewise.
4085         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4086         function.
4087         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4088         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4089         with accessor function.
4090         (Sized_relobj_file::do_layout): Likewise.
4091         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4092         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4093         (Sized_relobj_file::compute_final_local_value): Replace refs to
4094         section_offsets_ with accessor function.
4095         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4096         * object.h (Relobj::Relobj): Initialize new data members.
4097         (Relobj::add_dyn_reloc): New function.
4098         (Relobj::first_dyn_reloc): New function.
4099         (Relobj::dyn_reloc_count): New function.
4100         (Relobj::first_dyn_reloc_): New data member.
4101         (Relobj::dyn_reloc_count_): New data member.
4102         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4103         references.
4104         (Sized_relobj::Address): New typedef.
4105         (Sized_relobj::invalid_address): Move here from child class.
4106         (Sized_relobj::Sized_relobj): Initialize new data members.
4107         (Sized_relobj::sized_relobj): New function.
4108         (Sized_relobj::is_output_section_offset_invalid): Move here from
4109         child class.
4110         (Sized_relobj::get_output_section_offset): Likewise.
4111         (Sized_relobj::local_has_got_offset): Likewise.
4112         (Sized_relobj::local_got_offset): Likewise.
4113         (Sized_relobj::set_local_got_offset): Likewise.
4114         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4115         (Sized_relobj::clear_got_offsets): New function.
4116         (Sized_relobj::section_offsets): Move here from child class.
4117         (Sized_relobj::do_output_section_offset): Likewise.
4118         (Sized_relobj::do_set_section_offset): Likewise.
4119         (Sized_relobj::Local_got_offsets): Likewise.
4120         (Sized_relobj::local_got_offsets_): Likewise.
4121         (Sized_relobj::section_offsets_): Likewise.
4122         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4123         references.
4124         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4125         class.
4126         (Sized_relobj_file::sized_relobj): New function
4127         (Sized_relobj_file::local_has_got_offset): Move to base class.
4128         (Sized_relobj_file::local_got_offset): Likewise.
4129         (Sized_relobj_file::set_local_got_offset): Likewise.
4130         (Sized_relobj_file::get_output_section_offset): Likewise.
4131         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4132         (Sized_relobj_file::do_output_section_offset): Likewise.
4133         (Sized_relobj_file::do_set_section_offset): Likewise.
4134         (Sized_relobj_file::Local_got_offsets): Likewise.
4135         (Sized_relobj_file::local_got_offsets_): Likewise.
4136         (Sized_relobj_file::section_offsets_): Likewise.
4137         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4138         (all constructors).
4139         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4140         (Output_reloc::get_symbol_index): Likewise.
4141         (Output_reloc::local_section_offset): Likewise.
4142         (Output_reloc::get_address): Likewise.
4143         (Output_reloc::symbol_value): Likewise.
4144         (Output_data_got::reserve_slot): Move to class definition.
4145         (Output_data_got::reserve_local): New function.
4146         (Output_data_got::reserve_slot_for_global): Remove.
4147         (Output_data_got::reserve_global): New function.
4148         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4149         (all constructors, two instantiations).
4150         (Output_reloc::get_relobj): New function (two instantiations).
4151         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4152         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4153         (Output_data_reloc::add_global): Adjust type of relobj.
4154         (Output_data_reloc::add_global_relative): Likewise.
4155         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4156         (Output_data_reloc::add_local): Likewise.
4157         (Output_data_reloc::add_local_relative): Likewise.
4158         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4159         (Output_data_reloc::add_local_section): Likewise.
4160         (Output_data_reloc::add_output_section): Likewise.
4161         (Output_data_reloc::add_absolute): Likewise.
4162         (Output_data_reloc::add_target_specific): Likewise.
4163         (Output_data_got::reserve_slot): Move definition here.
4164         (Output_data_got::reserve_local): New function.
4165         (Output_data_got::reserve_global): New function.
4166         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4167         section_offsets_ with accessor function.
4168         (Sized_relobj_file::write_sections): Likewise.
4169         (Sized_relobj_file::do_relocate_sections): Likewise.
4170         * target.h (Sized_target::reserve_local_got_entry): New function.
4171         (Sized_target::reserve_global_got_entry): New function.
4172         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4173         (Target_x86_64::reserve_global_got_entry): New function.
4174         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4175
4176 2011-05-23 Cary Coutant  <ccoutant@google.com>
4177
4178         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4179         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4180         bit when checking got_type.
4181         * incremental.cc (Sized_incremental_binary::setup_readers):
4182         Store symbol table and string table locations; initialize bit vector
4183         of file status flags.
4184         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4185         unchanged files.
4186         (Sized_incremental_binary::do_process_got_plt): New function.
4187         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4188         (Output_section_incremental_inputs::set_final_data_size): Record
4189         file index for each input file.
4190         (Output_section_incremental_inputs::write_got_plt): Store file index
4191         instead of input entry offset for each GOT entry.
4192         * incremental.h
4193         (Incremental_input_entry::Incremental_input_entry): Initialize new
4194         data member.
4195         (Incremental_input_entry::set_offset): Store file index.
4196         (Incremental_input_entry::get_file_index): New function.
4197         (Incremental_input_entry::file_index_): New data member.
4198         (Incremental_binary::process_got_plt): New function.
4199         (Incremental_binary::do_process_got_plt): New function.
4200         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4201         data members.
4202         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4203         (Sized_incremental_binary::set_file_is_unchanged): New function.
4204         (Sized_incremental_binary::file_is_unchanged): New function.
4205         (Sized_incremental_binary::do_process_got_plt): New function.
4206         (Sized_incremental_binary::file_status_): New data member.
4207         (Sized_incremental_binary::main_symtab_loc_): New data member.
4208         (Sized_incremental_binary::main_strtab_loc_): New data member.
4209         * output.cc (Output_data_got::Got_entry::write): Add case
4210         RESERVED_CODE.
4211         (Output_data_got::add_global): Call add_got_entry.
4212         (Output_data_got::add_global_plt): Likewise.
4213         (Output_data_got::add_global_with_rel): Likewise.
4214         (Output_data_got::add_global_with_rela): Likewise.
4215         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4216         (Output_data_got::add_global_pair_with_rela): Likewise.
4217         (Output_data_got::add_local): Call add_got_entry.
4218         (Output_data_got::add_local_plt): Likewise.
4219         (Output_data_got::add_local_with_rel): Likewise.
4220         (Output_data_got::add_local_with_rela): Likewise.
4221         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4222         (Output_data_got::add_local_pair_with_rela): Likewise.
4223         (Output_data_got::reserve_slot): New function.
4224         (Output_data_got::reserve_slot_for_global): New function.
4225         (Output_data_got::add_got_entry): New function.
4226         (Output_data_got::add_got_entry_pair): New function.
4227         (Output_section::add_output_section_data): Edit FIXME.
4228         * output.h
4229         (Output_section_data_build::Output_section_data_build): New
4230         constructor with size parameter.
4231         (Output_data_space::Output_data_space): Likewise.
4232         (Output_data_got::Output_data_got): Initialize new data member; new
4233         constructor with size parameter.
4234         (Output_data_got::add_constant): Call add_got_entry.
4235         (Output_data_got::reserve_slot): New function.
4236         (Output_data_got::reserve_slot_for_global): New function.
4237         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4238         (Output_data_got::add_got_entry): New function.
4239         (Output_data_got::add_got_entry_pair): New function.
4240         (Output_data_got::free_list_): New data member.
4241         * target.h (Sized_target::init_got_plt_for_update): New function.
4242         (Sized_target::register_global_plt_entry): New function.
4243         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4244         Initialize new data member; call init; add constructor with PLT count.
4245         (Output_data_plt_x86_64::init): New function.
4246         (Output_data_plt_x86_64::add_relocation): New function.
4247         (Output_data_plt_x86_64::reserve_slot): New function.
4248         (Output_data_plt_x86_64::free_list_): New data member.
4249         (Target_x86_64::init_got_plt_for_update): New function.
4250         (Target_x86_64::register_global_plt_entry): New function.
4251         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4252         incremental updates.
4253         (Output_data_plt_x86_64::add_relocation): New function.
4254         * testsuite/object_unittest.cc (Object_test): Set default options.
4255
4256 2011-05-16  Ian Lance Taylor  <iant@google.com>
4257
4258         * options.h (class General_options): Make -i a synonym for -r.
4259
4260 2011-05-16  Ian Lance Taylor  <iant@google.com>
4261
4262         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4263
4264 2011-05-10 Cary Coutant  <ccoutant@google.com>
4265
4266         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4267         strip_all (-s).
4268
4269 2011-05-06  Ian Lance Taylor  <iant@google.com>
4270
4271         * layout.cc (Layout::layout): If the output section flags change,
4272         update the ordering.
4273
4274 2011-04-25 Cary Coutant  <ccoutant@google.com>
4275
4276         * incremental-dump.cc (dump_incremental_inputs): Print local
4277         symbol info for each input file.
4278         * incremental.cc
4279         (Output_section_incremental_inputs::set_final_data_size): Add local
4280         symbol info to input file entries in incremental info.
4281         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4282         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4283         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4284         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4285         implementation.
4286         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4287         (Sized_incr_relobj::do_relocate): Write the local symbols.
4288         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4289         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4290         Adjust size of input file header.
4291         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4292         (Incremental_inputs_reader::get_local_symbol_count): New function.
4293         (Incremental_inputs_reader::get_input_section): Adjust size of input
4294         file header.
4295         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4296         (Sized_incr_relobj::This): New typedef.
4297         (Sized_incr_relobj::sym_size): New const data member.
4298         (Sized_incr_relobj::Local_symbol): New struct.
4299         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4300         (Sized_incr_relobj::do_local_symbol_offset): New function.
4301         (Sized_incr_relobj::local_symbol_count_): New data member.
4302         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4303         (Sized_incr_relobj::local_symbol_index_): New data member.
4304         (Sized_incr_relobj::local_symbol_offset_): New data member.
4305         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4306         (Sized_incr_relobj::local_symbols_): New data member.
4307         * object.h (Relobj::output_local_symbol_count): New function.
4308         (Relobj::local_symbol_offset): New function.
4309         (Relobj::do_output_local_symbol_count): New function.
4310         (Relobj::do_local_symbol_offset): New function.
4311         (Sized_relobj::do_output_local_symbol_count): New function.
4312         (Sized_relobj::do_local_symbol_offset): New function.
4313
4314 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4315
4316         * descriptors.cc (set_close_on_exec): New function.
4317         (Descriptors::open): Use set_close_on_exec.
4318         * output.cc (S_ISLNK): Define if not defined.
4319
4320 2011-04-22 Cary Coutant  <ccoutant@google.com>
4321
4322         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4323         global symbol map.
4324         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4325         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4326         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4327         relocations.
4328         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4329         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4330         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4331         * incremental.h
4332         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4333         function.
4334         (Incremental_binary::apply_incremental_relocs): New function.
4335         (Incremental_binary::do_apply_incremental_relocs): New function.
4336         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4337         data member.
4338         (Sized_incremental_binary::add_global_symbol): New function.
4339         (Sized_incremental_binary::global_symbol): New function.
4340         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4341         (Sized_incremental_binary::symbol_map_): New data member.
4342         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4343         * target.h (Sized_target::apply_relocation): New function.
4344         * target-reloc.h (apply_relocation): New function.
4345         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4346
4347 2011-04-22  Doug Kwan  <dougkwan@google.com>
4348
4349         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4350         flag of a SHT_ARM_EXIDX section.
4351         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4352         * testsuite/Makefile.in: Regenerate.
4353         * testsuite/arm_exidx_test.s: New file.
4354         * testsuite/arm_exidx_test.sh: Same.
4355
4356 2011-04-20 Cary Coutant  <ccoutant@google.com>
4357
4358         PR gold/12689
4359         * archive.h (Incremental_archive_entry::Archive_member):
4360         Initialize arg_serial_ (second constructor).
4361
4362 2011-04-17  Ian Lance Taylor  <iant@google.com>
4363
4364         * object.cc (Relocate_info::location): Simplify location string.
4365         * errors.cc (Errors::error_at_location): Don't print program
4366         name.
4367         (Errors::warning_at_location): Likewise.
4368         (Errors::undefined_symbol): Likewise.
4369         * testsuite/debug_msg.sh: Update accordingly.
4370
4371 2011-04-14 Cary Coutant  <ccoutant@google.com>
4372
4373         * gold/layout.cc (Layout::symtab_section_offset): New function.
4374         * gold/layout.h (Layout::symtab_section_offset): New function.
4375         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4376
4377 2011-04-12  Ian Lance Taylor  <iant@google.com>
4378
4379         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4380         with MREMAP_MAYMOVE.
4381         * output.h (class Output_file): Add map_is_allocated_ field.
4382         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4383         not available, provide stubs.  If mremap is not available, #define
4384         it to gold_mremap.
4385         (MREMAP_MAYMOVE): Define if not defined.
4386         (Output_file::Output_file): Initialize map_is_allocated_.
4387         (Output_file::resize): Check map_is_allocated_.
4388         (Output_file::map_anonymous): If mmap fails, use malloc.
4389         (Output_file::unmap): Don't do anything for an anonymous map.
4390         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4391         is not available, provide stubs.
4392         (File_read::View::~View): Use free rather than delete[].
4393         (File_read::make_view): Use malloc rather than new[].  If mmap
4394         fails, use malloc.
4395         (File_read::find_or_make_view): Use malloc rather than new[].
4396         * gold.h: Remove HAVE_REMAP code.
4397         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4398         exists.  Rename mremap to gold_mremap.  If mmap is not available
4399         don't do anything.
4400         * configure, config.in: Rebuild.
4401
4402 2011-04-11  Ian Lance Taylor  <iant@google.com>
4403
4404         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4405         initialize local variable v.
4406
4407 2011-04-11  Cary Coutant  <ccoutant@google.com>
4408
4409         * archive.cc (Archive::include_member): Adjust call to
4410         report_object.
4411         (Add_archive_symbols::run): Track argument serial numbers.
4412         (Lib_group::include_member): Likewise.
4413         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4414         * archive.h (Incremental_archive_entry::Archive_member):
4415         Initialize arg_serial_.
4416         (Archive_member::arg_serial_): New data member.
4417         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4418         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4419         incremental link.
4420         (Sized_dynobj::do_for_all_local_got_entries): New function.
4421         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4422         function.
4423         * fileread.cc (get_mtime): New function.
4424         * fileread.h (get_mtime): New function.
4425         * gold.cc (queue_initial_tasks): Check for incremental update.
4426         (process_incremental_input): New function.
4427         (queue_middle_tasks): Don't force valid target for incremental
4428         update.
4429         * incremental-dump.cc (find_input_containing_global): Adjust
4430         size of symbol info entry.
4431         (dump_incremental_inputs): Dump argument serial number and
4432         in_system_directory flag; bias shndx by 1; print symbol names
4433         when dumping per-file symbol lists; use new symbol info readers.
4434         * incremental.cc
4435         (Output_section_incremental_inputs:update_data_size): New function.
4436         (Sized_incremental_binary::setup_readers): Setup input readers
4437         for each input file; build maps for files added from libraries
4438         and scripts.
4439         (Sized_incremental_binary::check_input_args): New function.
4440         (Sized_incremental_binary::do_check_inputs): Build map of argument
4441         serial numbers to input arguments.
4442         (Sized_incremental_binary::do_file_has_changed): Rename
4443         do_file_is_unchanged to this; compare file modification times.
4444         (Sized_incremental_binary::do_init_layout): New function.
4445         (Sized_incremental_binary::do_reserve_layout): New function.
4446         (Sized_incremental_binary::do_get_input_reader): Remove.
4447         (Sized_incremental_binary::get_symtab_view): New function.
4448         (Incremental_checker::can_incrementally_link_output_file): Remove.
4449         (Incremental_inputs::report_command_line): Exclude --debug options.
4450         (Incremental_inputs::report_archive_begin): Add parameter; track
4451         argument serial numbers; don't put input file entry for archive
4452         before archive members.
4453         (Incremental_inputs::report_archive_end): Put input file entry
4454         for archive after archive members.
4455         (Incremental_inputs::report_object): Add parameter; track argument
4456         serial numbers and in_system_directory flag.
4457         (Incremental_inputs::report_script): Add parameter; track argument
4458         serial numbers.
4459         (Output_section_incremental_inputs::set_final_data_size): Adjust
4460         size of symbol info entry; check for forwarding symbols.
4461         (Output_section_incremental_inputs::write_input_files): Write
4462         in_system_directory flag and argument serial number.
4463         (Output_section_incremental_inputs::write_info_blocks): Map section
4464         indices between incremental info and original input file; store
4465         input section index for each symbol.
4466         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4467         change operator() to visit().
4468         (class Global_got_offset_visitor): Likewise.
4469         (class Global_symbol_visitor_got_plt):
4470         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4471         classes.
4472         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4473         (Sized_incr_relobj::do_read_symbols): New function.
4474         (Sized_incr_relobj::do_layout): New function.
4475         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4476         (Sized_incr_relobj::do_add_symbols): New function.
4477         (Sized_incr_relobj::do_should_include_member): New function.
4478         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4479         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4480         (Sized_incr_relobj::do_section_size): New function.
4481         (Sized_incr_relobj::do_section_name): New function.
4482         (Sized_incr_relobj::do_section_contents): New function.
4483         (Sized_incr_relobj::do_section_flags): New function.
4484         (Sized_incr_relobj::do_section_entsize): New function.
4485         (Sized_incr_relobj::do_section_address): New function.
4486         (Sized_incr_relobj::do_section_type): New function.
4487         (Sized_incr_relobj::do_section_link): New function.
4488         (Sized_incr_relobj::do_section_info): New function.
4489         (Sized_incr_relobj::do_section_addralign): New function.
4490         (Sized_incr_relobj::do_initialize_xindex): New function.
4491         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4492         (Sized_incr_relobj::do_read_relocs): New function.
4493         (Sized_incr_relobj::do_gc_process_relocs): New function.
4494         (Sized_incr_relobj::do_scan_relocs): New function.
4495         (Sized_incr_relobj::do_count_local_symbols): New function.
4496         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4497         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4498         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4499         (Sized_incr_relobj::do_relocate): New function.
4500         (Sized_incr_relobj::do_set_section_offset): New function.
4501         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4502         (Sized_incr_dynobj::do_read_symbols): New function.
4503         (Sized_incr_dynobj::do_layout): New function.
4504         (Sized_incr_dynobj::do_add_symbols): New function.
4505         (Sized_incr_dynobj::do_should_include_member): New function.
4506         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4507         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4508         (Sized_incr_dynobj::do_section_size): New function.
4509         (Sized_incr_dynobj::do_section_name): New function.
4510         (Sized_incr_dynobj::do_section_contents): New function.
4511         (Sized_incr_dynobj::do_section_flags): New function.
4512         (Sized_incr_dynobj::do_section_entsize): New function.
4513         (Sized_incr_dynobj::do_section_address): New function.
4514         (Sized_incr_dynobj::do_section_type): New function.
4515         (Sized_incr_dynobj::do_section_link): New function.
4516         (Sized_incr_dynobj::do_section_info): New function.
4517         (Sized_incr_dynobj::do_section_addralign): New function.
4518         (Sized_incr_dynobj::do_initialize_xindex): New function.
4519         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4520         (make_sized_incremental_object): New function.
4521         (Incremental_library::copy_unused_symbols): New function.
4522         (Incremental_library::do_for_all_unused_symbols): New function.
4523         * incremental.h (enum Incremental_input_flags): New type.
4524         (class Incremental_checker): Remove.
4525         (Incremental_input_entry::Incremental_input_entry): Add argument
4526         serial number.
4527         (Incremental_input_entry::arg_serial): New function.
4528         (Incremental_input_entry::set_is_in_system_directory): New function.
4529         (Incremental_input_entry::is_in_system_directory): New function.
4530         (Incremental_input_entry::arg_serial_): New data member.
4531         (Incremental_input_entry::is_in_system_directory_): New data member.
4532         (class Script_info): Move here from script.h.
4533         (Script_info::Script_info): Add filename parameter.
4534         (Script_info::filename): New function.
4535         (Script_info::filename_): New data member.
4536         (Incremental_script_entry::Incremental_script_entry): Add argument
4537         serial number.
4538         (Incremental_object_entry::Incremental_object_entry): Likewise.
4539         (Incremental_object_entry::add_input_section): Build list of input
4540         sections with map to original shndx.
4541         (Incremental_object_entry::get_input_section_index): New function.
4542         (Incremental_object_entry::shndx_): New data member.
4543         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4544         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4545         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4546         serial number.
4547         (Incremental_inputs::report_archive_begin): Likewise.
4548         (Incremental_inputs::report_object): Likewise.
4549         (Incremental_inputs::report_script): Likewise.
4550         (class Incremental_global_symbol_reader): New class.
4551         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4552         and store flags and input file type.
4553         (Incremental_input_entry_reader::arg_serial): New function.
4554         (Incremental_input_entry_reader::type): Extract type from flags.
4555         (Incremental_input_entry_reader::is_in_system_directory): New function.
4556         (Incremental_input_entry_reader::get_input_section_count): Call
4557         accessor function for type.
4558         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4559         function for type; adjust size of global symbol entry.
4560         (Incremental_input_entry_reader::get_global_symbol_count): Call
4561         accessor function for type.
4562         (Incremental_input_entry_reader::get_object_count): Likewise.
4563         (Incremental_input_entry_reader::get_object_offset): Likewise.
4564         (Incremental_input_entry_reader::get_member_count): Likewise.
4565         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4566         (Incremental_input_entry_reader::get_member_offset): Likewise.
4567         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4568         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4569         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4570         (Incremental_input_entry_reader::get_global_symbol_reader): New
4571         function.
4572         (Incremental_input_entry_reader::get_output_symbol_index): New
4573         function.
4574         (Incremental_input_entry_reader::type_): Remove.
4575         (Incremental_input_entry_reader::flags_): New data member.
4576         (Incremental_inputs_reader::input_file_offset): New function.
4577         (Incremental_inputs_reader::input_file_index): New function.
4578         (Incremental_inputs_reader::input_file): Call input_file_offset.
4579         (Incremental_inputs_reader::input_file_at_offset): New function.
4580         (Incremental_relocs_reader::get_r_type): Reformat.
4581         (Incremental_relocs_reader::get_r_shndx): Reformat.
4582         (Incremental_relocs_reader::get_r_offset): Reformat.
4583         (Incremental_relocs_reader::data): New function.
4584         (Incremental_binary::Incremental_binary): Initialize new data members.
4585         (Incremental_binary::check_inputs): Add cmdline parameter.
4586         (Incremental_binary::file_is_unchanged): Remove.
4587         (Input_reader::arg_serial): New function.
4588         (Input_reader::get_unused_symbol_count): New function.
4589         (Input_reader::get_unused_symbol): New function.
4590         (Input_reader::do_arg_serial): New function.
4591         (Input_reader::do_get_unused_symbol_count): New function.
4592         (Input_reader::do_get_unused_symbol): New function.
4593         (Incremental_binary::input_file_count): New function.
4594         (Incremental_binary::get_input_reader): Change signature to use
4595         index instead of filename.
4596         (Incremental_binary::file_has_changed): New function.
4597         (Incremental_binary::get_input_argument): New function.
4598         (Incremental_binary::get_library): New function.
4599         (Incremental_binary::get_script_info): New function.
4600         (Incremental_binary::init_layout): New function.
4601         (Incremental_binary::reserve_layout): New function.
4602         (Incremental_binary::output_file): New function.
4603         (Incremental_binary::do_check_inputs): New function.
4604         (Incremental_binary::do_file_is_unchanged): Remove.
4605         (Incremental_binary::do_file_has_changed): New function.
4606         (Incremental_binary::do_init_layout): New function.
4607         (Incremental_binary::do_reserve_layout): New function.
4608         (Incremental_binary::do_input_file_count): New function.
4609         (Incremental_binary::do_get_input_reader): Change signature.
4610         (Incremental_binary::input_args_map_): New data member.
4611         (Incremental_binary::library_map_): New data member.
4612         (Incremental_binary::script_map_): New data member.
4613         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4614         new data members.
4615         (Sized_incremental_binary::output_section): New function.
4616         (Sized_incremental_binary::inputs_reader): Add const.
4617         (Sized_incremental_binary::symtab_reader): Add const.
4618         (Sized_incremental_binary::relocs_reader): Add const.
4619         (Sized_incremental_binary::got_plt_reader): Add const.
4620         (Sized_incremental_binary::get_symtab_view): New function.
4621         (Sized_incremental_binary::Inputs_reader): New typedef.
4622         (Sized_incremental_binary::Input_entry_reader): New typedef.
4623         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4624         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4625         (Sized_incremental_binary::do_file_has_changed): New function.
4626         (Sized_incremental_binary::do_init_layout): New function.
4627         (Sized_incremental_binary::do_reserve_layout): New function.
4628         (Sized_input_reader::Inputs_reader): Remove.
4629         (Sized_input_reader::Input_entry_reader): Remove.
4630         (Sized_input_reader::do_arg_serial): New function.
4631         (Sized_input_reader::do_get_unused_symbol_count): New function.
4632         (Sized_input_reader::do_get_unused_symbol): New function.
4633         (Sized_incremental_binary::do_input_file_count): New function.
4634         (Sized_incremental_binary::do_get_input_reader): Change signature;
4635         use index instead of filename.
4636         (Sized_incremental_binary::section_map_): New data member.
4637         (Sized_incremental_binary::input_entry_readers_): New data member.
4638         (class Sized_incr_relobj): New class.
4639         (class Sized_incr_dynobj): New class.
4640         (make_sized_incremental_object): New function.
4641         (class Incremental_library): New class.
4642         * layout.cc (Free_list::num_lists): New static data member.
4643         (Free_list::num_nodes): New static data member.
4644         (Free_list::num_removes): New static data member.
4645         (Free_list::num_remove_visits): New static data member.
4646         (Free_list::num_allocates): New static data member.
4647         (Free_list::num_allocate_visits): New static data member.
4648         (Free_list::init): New function.
4649         (Free_list::remove): New function.
4650         (Free_list::allocate): New function.
4651         (Free_list::dump): New function.
4652         (Free_list::print_stats): New function.
4653         (Layout_task_runner::run): Resize output file for incremental updates.
4654         (Layout::Layout): Initialize new data members.
4655         (Layout::set_incremental_base): New function.
4656         (Layout::init_fixed_output_section): New function.
4657         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4658         incremental updates.
4659         (Layout::create_gold_note): Do not create gold note section for
4660         incremental updates.
4661         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4662         for incremental updates.
4663         (Layout::set_section_offsets): For incremental updates, allocate space
4664         from free list.
4665         (Layout::create_symtab_sections): Layout with offsets relative to
4666         start of section; for incremental updates, allocate space from free
4667         list.
4668         (Layout::create_shdrs): For incremental updates, allocate space from
4669         free list.
4670         (Layout::finish_dynamic_section): For incremental updates, do not
4671         check --as-needed (fixed in subsequent patch).
4672         * layout.h (class Free_list): New class.
4673         (Layout::set_incremental_base): New function.
4674         (Layout::incremental_base): New function.
4675         (Layout::init_fixed_output_section): New function.
4676         (Layout::allocate): New function.
4677         (Layout::incremental_base_): New data member.
4678         (Layout::free_list_): New data member.
4679         * main.cc (main): Print Free_list statistics.
4680         * object.cc (Relobj::finalize_incremental_relocs): Add
4681         clear_counts parameter; clear counts only when clear_counts is set.
4682         (Sized_relobj::Sized_relobj): Initialize new base class.
4683         (Sized_relobj::do_layout): Don't report special sections.
4684         (Sized_relobj::do_for_all_local_got_entries): New function.
4685         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4686         symtab_off to all symbol table offsets.
4687         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4688         * object.h (class Got_offset_list): Move to top of file.
4689         (Object::Object): Allow case where input_file == NULL.
4690         (Object::~Object): Likewise.
4691         (Object::input_file): Assert that input_file != NULL.
4692         (Object::lock): Allow case where input_file == NULL.
4693         (Object::unlock): Likewise.
4694         (Object::is_locked): Likewise.
4695         (Object::token): Likewise.
4696         (Object::release): Likewise.
4697         (Object::is_incremental): New function.
4698         (Object::get_mtime): New function.
4699         (Object::for_all_local_got_entries): New function.
4700         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4701         (Object::set_is_in_system_directory): New function.
4702         (Object::is_in_system_directory): New function.
4703         (Object::do_is_incremental): New function.
4704         (Object::do_get_mtime): New function.
4705         (Object::do_for_all_local_got_entries): New function.
4706         (Object::is_in_system_directory_): New data member.
4707         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4708         (class Sized_relobj_base): New class.
4709         (class Sized_relobj): Derive from Sized_relobj_base.
4710         (class Sized_relobj::Symbols): Redeclare from base class.
4711         (class Sized_relobj::local_got_offset_list): Remove.
4712         (class Sized_relobj::Output_sections): Redeclare from base class.
4713         (class Sized_relobj::do_for_all_local_got_entries): New function.
4714         (class Sized_relobj::write_local_symbols): Add offset parameter.
4715         (class Sized_relobj::local_symbol_offset_): Update comment.
4716         (class Sized_relobj::local_dynsym_offset_): Update comment.
4717         * options.cc (Input_arguments::add_file): Remove const.
4718         * options.h (Input_file_argument::Input_file_argument):
4719         Initialize arg_serial_ (all constructors).
4720         (Input_file_argument::set_arg_serial): New function.
4721         (Input_file_argument::arg_serial): New function.
4722         (Input_file_argument::arg_serial_): New data member.
4723         (Input_arguments::Input_arguments): Initialize file_count_.
4724         (Input_arguments::add_file): Remove const.
4725         (Input_arguments::number_of_input_files): New function.
4726         (Input_arguments::file_count_): New data member.
4727         (Command_line::number_of_input_files): Call
4728         Input_arguments::number_of_input_files.
4729         * output.cc (Output_segment_headers::Output_segment_headers):
4730         Set current size.
4731         (Output_section::Input_section::current_data_size): New function.
4732         (Output_section::Output_section): Initialize new data members.
4733         (Output_section::add_input_section): Don't do merge sections for
4734         an incremental link; allocate space from free list for an
4735         incremental update.
4736         (Output_section::add_output_section_data): Allocate space from
4737         free list for an incremental update.
4738         (Output_section::update_data_size): New function.
4739         (Output_section::set_fixed_layout): New function.
4740         (Output_section::reserve): New function.
4741         (Output_segment::set_section_addresses): Remove const.
4742         (Output_segment::set_section_list_addresses): Remove const; allocate
4743         space from free list for an incremental update.
4744         (Output_segment::set_offset): Adjust size of RELRO segment for an
4745         incremental update.
4746         * output.h (Output_data::current_data_size): Move here from
4747         child classes.
4748         (Output_data::pre_finalize_data_size): New function.
4749         (Output_data::update_data_size): New function.
4750         (Output_section_headers::update_data_size): new function.
4751         (Output_section_data_build::current_data_size): Move to Output_data.
4752         (Output_data_strtab::update_data_size): New function.
4753         (Output_section::current_data_size): Move to Output_data.
4754         (Output_section::set_fixed_layout): New function.
4755         (Output_section::has_fixed_layout): New function.
4756         (Output_section::reserve): New function.
4757         (Output_section::update_data_size): New function.
4758         (Output_section::has_fixed_layout_): New data member.
4759         (Output_section::free_list_): New data member.
4760         (Output_segment::set_section_addresses): Remove const.
4761         (Output_segment::set_section_list_addresses): Remove const.
4762         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4763         New function.
4764         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4765         New function.
4766         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4767         parameter when calling Add_symbols constructor; store argument
4768         serial number for members of a lib group.
4769         (Add_symbols::locks): Allow case where token == NULL.
4770         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4771         (Read_member::~Read_member): New function.
4772         (Read_member::is_runnable): New function.
4773         (Read_member::locks): New function.
4774         (Read_member::run): New function.
4775         (Check_script::~Check_script): New function.
4776         (Check_script::is_runnable): New function.
4777         (Check_script::locks): New function.
4778         (Check_script::run): New function.
4779         (Check_library::~Check_library): New function.
4780         (Check_library::is_runnable): New function.
4781         (Check_library::locks): New function.
4782         (Check_library::run): New function.
4783         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4784         (Add_symbols::library_): New data member.
4785         (class Read_member): New class.
4786         (class Check_script): New class.
4787         (class Check_library): New class.
4788         * reloc.cc (Read_relocs::is_runnable): Allow case where
4789         token == NULL.
4790         (Read_relocs::locks): Likewise.
4791         (Scan_relocs::locks): Likewise.
4792         (Relocate_task::locks): Likewise.
4793         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4794         to clear counters.
4795         (Sized_relobj::incremental_relocs_scan): Fix comment.
4796         (Sized_relobj::do_relocate): Pass output file offset to
4797         write_local_symbols.
4798         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4799         from class declaration.
4800         * script.cc (read_input_script): Allocate Script_info; pass
4801         argument serial number to report_script.
4802         * script.h (class Script_info): Move to incremental.h.
4803         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4804         * symtab.h (Symbol_table::add_from_incrobj): New function.
4805         (Symbol_table::set_file_offset): New function.
4806
4807 2011-04-05  Cary Coutant  <ccoutant@google.com>
4808
4809         * incremental-dump.cc (dump_incremental_inputs): Change signature
4810         to take a Sized_incremental_binary; change caller.  Use readers
4811         in Sized_incremental_binary.
4812         * incremental.cc
4813         (Sized_incremental_binary::find_incremental_inputs_sections):
4814         Rename do_find_incremental_inputs_sections to this.
4815         (Sized_incremental_binary::setup_readers): New function.
4816         (Sized_incremental_binary::do_check_inputs): Check
4817         has_incremental_info_ flag; move setup code to setup_readers;
4818         use input readers.
4819         (Sized_incremental_binary::do_file_is_unchanged): New function.
4820         (Sized_incremental_binary::do_get_input_reader): New function.
4821         * incremental.h (class Incremental_binary): Move to end of file.
4822         (Incremental_binary::file_is_unchanged): New function.
4823         (Incremental_binary::do_file_is_unchanged): New function.
4824         (Incremental_binary::Input_reader): New class.
4825         (Incremental_binary::get_input_reader): New function.
4826         (class Sized_incremental_binary): Move to end of file.
4827         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4828         input section reader classes.
4829         (Sized_incremental_binary::has_incremental_info): New function.
4830         (Sized_incremental_binary::inputs_reader): New function.
4831         (Sized_incremental_binary::symtab_reader): New function.
4832         (Sized_incremental_binary::relocs_reader): New function.
4833         (Sized_incremental_binary::got_plt_reader): New function.
4834         (Sized_incremental_binary::do_file_is_unchanged): New function.
4835         (Sized_incremental_binary::Sized_input_reader): New class.
4836         (Sized_incremental_binary::get_input_reader): New function.
4837         (Sized_incremental_binary::find_incremental_inputs_sections):
4838         Rename do_find_incremental_inputs_sections to this.
4839         (Sized_incremental_binary::setup_readers): New function.
4840         (Sized_incremental_binary::has_incremental_info_): New data member.
4841         (Sized_incremental_binary::inputs_reader_): New data member.
4842         (Sized_incremental_binary::symtab_reader_): New data member.
4843         (Sized_incremental_binary::relocs_reader_): New data member.
4844         (Sized_incremental_binary::got_plt_reader_): New data member.
4845         (Sized_incremental_binary::current_input_file_): New data member.
4846
4847 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4848
4849         PR gold/12640
4850         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4851         violation.
4852
4853 2011-03-30  Cary Coutant  <ccoutant@google.com>
4854
4855         * archive.cc (Archive::include_member): Adjust call to report_object.
4856         (Add_archive_symbols::run): Add script_info to call to
4857         report_archive_begin.
4858         (Lib_group::include_member): Adjust call to report_object.
4859         (Add_lib_group_symbols::run): Adjust call to report_object.
4860         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4861         blocks.  Add object count for script input files.
4862         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4863         script_info parameter; change all callers.
4864         (Incremental_inputs::report_object): Add script_info parameter;
4865         change all callers.
4866         (Incremental_inputs::report_script): Store backpointer to
4867         incremental info entry.
4868         (Output_section_incremental_inputs::set_final_data_size): Record
4869         additional information for scripts.
4870         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4871         * incremental.h (Incremental_script_entry::add_object): New function.
4872         (Incremental_script_entry::get_object_count): New function.
4873         (Incremental_script_entry::get_object): New function.
4874         (Incremental_script_entry::objects_): New data member; adjust
4875         constructor.
4876         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4877         (Incremental_inputs::report_object): Add script_info parameter.
4878         (Incremental_inputs_reader::get_object_count): New function.
4879         (Incremental_inputs_reader::get_object_offset): New function.
4880         * options.cc (Input_arguments::add_file): Return reference to
4881         new input argument.
4882         * options.h (Input_argument::set_script_info): New function.
4883         (Input_argument::script_info): New function.
4884         (Input_argument::script_info_): New data member; adjust all
4885         constructors.
4886         (Input_file_group::add_file): Return reference to new input argument.
4887         (Input_file_lib::add_file): Likewise.
4888         (Input_arguments::add_file): Likewise.
4889         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4890         * script.cc (Parser_closure::Parser_closure): Add script_info
4891         parameter; adjust all callers.
4892         (Parser_closure::script_info): New function.
4893         (Parser_closure::script_info_): New data member.
4894         (read_input_script): Report scripts earlier to incremental info.
4895         (script_add_file): Set script_info in Input_argument.
4896         (script_add_library): Likewise.
4897         * script.h (Script_options::Script_info): Rewrite class.
4898
4899 2011-03-29  Cary Coutant  <ccoutant@google.com>
4900
4901         * archive.cc (Library_base::should_include_member): Move
4902         method here from class Archive.
4903         (Archive::Archive): Initialize base class.
4904         (Archive::should_include_member): Move to base class.
4905         (Archive::do_for_all_unused_symbols): New function.
4906         (Add_archive_symbols::run): Remove redundant access to
4907         incremental_inputs.
4908         (Lib_group::Lib_group): Initialize base class.
4909         (Lib_group::do_filename): New function.
4910         (Lib_group::include_member): Pass pointer to Lib_group to
4911         report_object.
4912         (Lib_group::do_for_all_unused_symbols): New function.
4913         (Add_lib_group_symbols::run): Report archive information for
4914         incremental links.
4915         * archive.h (class Library_base): New base class.
4916         (class Archive): Derive from Library_base.
4917         (Archive::filename): Move to base class.
4918         (Archive::set_incremental_info): Likewise.
4919         (Archive::incremental_info): Likewise.
4920         (Archive::Should_include): Likewise.
4921         (Archive::should_include_member): Likewise.
4922         (Archive::Armap_entry): Remove.
4923         (Archive::Unused_symbol_iterator): Remove.
4924         (Archive::unused_symbols_begin): Remove.
4925         (Archive::unused_symbols_end): Remove.
4926         (Archive::do_filename): New function.
4927         (Archive::do_get_mtime): New function.
4928         (Archive::do_for_all_unused_symbols): New function.
4929         (Archive::task_): Move to base class.
4930         (Archive::incremental_info_): Likewise.
4931         (class Lib_group): Derive from Library_base.
4932         (Lib_group::do_filename): New function.
4933         (Lib_group::do_get_mtime): New function.
4934         (Lib_group::do_for_all_unused_symbols): New function.
4935         (Lib_group::task_): Move to base class.
4936         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4937         function.
4938         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4939         function.
4940         * incremental.cc (Incremental_inputs::report_archive_begin):
4941         Use Library_base; call library's get_mtime; add incremental inputs
4942         entry before members.
4943         (class Unused_symbol_visitor): New class.
4944         (Incremental_inputs::report_archive_end): Use Library_base; use
4945         visitor class to record unused symbols; don't add incremental inputs
4946         entry after members.
4947         (Incremental_inputs::report_object): Use Library_base.
4948         * incremental.h
4949         (Incremental_archive_entry::Incremental_archive_entry): Remove
4950         unused Archive parameter.
4951         (Incremental_inputs::report_archive_begin): Use Library_base.
4952         (Incremental_inputs::report_archive_end): Likewise.
4953         (Incremental_inputs::report_object): Likewise.
4954         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4955         function.
4956         * object.h (Object::for_all_global_symbols): New function.
4957         (Object::do_for_all_global_symbols): New function.
4958         (Sized_relobj::do_for_all_global_symbols): New function.
4959         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4960         function.
4961         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4962         function.
4963
4964 2011-03-27  Ian Lance Taylor  <iant@google.com>
4965
4966         * archive.cc (Archive::interpret_header): Return -1 if something
4967         goes wrong.  Change callers accordingly.
4968
4969 2011-03-25  Cary Coutant  <ccoutant@google.com>
4970
4971         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4972         * testsuite/Makefile.in: Regenerate.
4973
4974 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4975
4976         * plugin.cc (get_view): New.
4977         (Plugin::load): Pass get_view to the plugin.
4978         (Plugin_manager::get_view): New.
4979
4980 2011-03-21  Ian Lance Taylor  <iant@google.com>
4981
4982         * testsuite/final_layout.sh: Rewrite to not use dc.
4983         * testsuite/relro_test.sh: Fail if dc is not present.
4984
4985 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4986
4987         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4988         Change == to -eq.
4989         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4990         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4991         Change == to -eq.
4992         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4993         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4994
4995 2011-03-14  Ian Lance Taylor  <iant@google.com>
4996
4997         * script-sections.cc (Sort_output_sections::script_compare):
4998         Rename from is_before, change return type.
4999         (Sort_output_sections::operator()): Adjust accordingly.
5000
5001 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5002
5003         PR gold/12572
5004         * testsuite/odr_violation2.cc: Add comment to make all error line
5005         numbers double digits.
5006         * testsuite/debug_msg.sh: Adjust expected errors.
5007
5008 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5009
5010         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5011         but mark earlier ones as non-canonical
5012         (offset_to_iterator): Update search target and example
5013         (do_addr2line): Return extra lines in a vector*
5014         (format_file_lineno): Extract from do_addr2line
5015         (one_addr2line): Add vector* out-param
5016         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5017         when a lineno entry appeared last for its instruction
5018         (Dwarf_line_info): Add vector* out-param
5019         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5020         * symtab.cc (Odr_violation_compare): Include the lineno in the
5021         comparison again.
5022         (linenos_from_loc): New. Combine the canonical line for an
5023         address with its other lines.
5024         (True_if_intersect): New. Helper functor to make
5025         std::set_intersection a query.
5026         (detect_odr_violations): Compare sets of lines instead of just
5027         one line for each function. This became less deterministic, but
5028         has fewer false positives.
5029         * symtab.h: Declarations.
5030         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5031         mix an optimized and non-optimized object in the same binary
5032         (odr_violation2.so): Same.
5033         * testsuite/Makefile.in: Regenerate from Makefile.am.
5034         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5035         * testsuite/debug_msg.sh: Update line numbers and add
5036         assertions.
5037         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5038         non-optimized context.
5039         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5040         isn't inlined, and use OdrDerived in an optimized context.
5041         * testsuite/odr_header1.h: Defines OdrDerived, where
5042         optimization will change the
5043         first-instruction-in-the-destructor's file and line number.
5044         * testsuite/odr_header2.h: Defines OdrBase.
5045
5046 2011-03-09  Ian Lance Taylor  <iant@google.com>
5047
5048         * fileread.cc (File_read::clear_views): Don't delete the whole
5049         file view.
5050
5051 2011-03-08  Ian Lance Taylor  <iant@google.com>
5052
5053         PR gold/12525
5054         * fileread.cc: #include <climits>.
5055         (GOLD_IOV_MAX): Define.
5056         (File_read::read_multiple): Limit number of entries by iov_max.
5057         * fileread.h (class File_read): Always set max_readv_entries to
5058         128.
5059
5060 2011-03-07  Ian Lance Taylor  <iant@google.com>
5061
5062         PR gold/12525
5063         * options.h (class General_options): Add -dy and -dn.
5064
5065 2011-03-02  Cary Coutant  <ccoutant@google.com>
5066
5067         * testsuite/script_test_9.t: Add TLS segment.
5068
5069 2011-03-02  Simon Baldwin  <simonb@google.com>
5070
5071         * configure.ac: Add check for gnu_indirect_function support in
5072         the toolchain building binutils.
5073         * configure: Rebuild.
5074
5075 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5076
5077         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5078         plugin only symbols.
5079         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5080         in plugin files as not needed in the symbol table.
5081
5082 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5083
5084         * output.cc (Output_section::add_input_section): Delay fill
5085         generation for section ordering.
5086
5087 2011-02-09  Ian Lance Taylor  <iant@google.com>
5088
5089         PR gold/12316
5090         * object.h (class Sized_relobj): Remove clear_local_symbols.
5091         * reloc.cc (Sized_relobj::do_relocate): Don't call
5092         clear_local_symbols.
5093
5094 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5095
5096         * plugin.cc (is_visible_from_outside): Return true for symbols
5097         in the -u option.
5098
5099 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5100
5101         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5102         filename.
5103
5104 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5105
5106         * icf.h (is_section_foldable_candidate): Change type of parameter
5107         to std::string.
5108         * icf.cc (Icf::find_identical_sections): Change type of local variable
5109         section_name to be std::string.
5110         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5111
5112 2011-01-25  Ian Lance Taylor  <iant@google.com>
5113
5114         * script.cc (script_add_extern): Rewrite to use
5115         add_symbol_reference.
5116
5117 2011-01-25  Doug Kwan  <dougkwan@google.com>
5118
5119         * icf.cc (get_section_contents): Always lock section's object.
5120
5121 2011-01-24  Ian Lance Taylor  <iant@google.com>
5122
5123         * options.h (class General_options): Accept
5124         --no-detect-odr-violations.
5125
5126 2011-01-24  Ian Lance Taylor  <iant@google.com>
5127
5128         * version.cc (version_string): Bump to 1.11.
5129
5130 2011-01-24  Ian Lance Taylor  <iant@google.com>
5131
5132         * plugin.cc (class Plugin_rescan): Define new class.
5133         (Plugin_manager::claim_file): Set any_claimed_.
5134         (Plugin_manager::save_archive): New function.
5135         (Plugin_manager::save_input_group): New function.
5136         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5137         necessary.
5138         (Plugin_manager::new_undefined_symbol): New function.
5139         (Plugin_manager::rescan): New function.
5140         (Plugin_manager::rescannable_defines): New function.
5141         (Plugin_manager::add_input_file): Set any_added_.
5142         * plugin.h (class Plugin_manager): define new fields rescannable_,
5143         undefined_symbols_, any_claimed_, and any_added_.  Declare
5144         Plugin_rescan as friend.  Declare new functions.
5145         (Plugin_manager::Rescannable): Define type.
5146         (Plugin_manager::Rescannable_list): Define type.
5147         (Plugin_manager::Undefined_symbol_list): Define type.
5148         (Plugin_manager::Plugin_manager): Initialize new fields.
5149         * archive.cc (Archive::defines_symbol): New function.
5150         (Add_archive_symbols::run): Pass archive to plugins if any.
5151         * archive.h (class Archive): Declare defines_symbol.
5152         * readsyms.cc (Input_group::~Input_group): New function.
5153         (Finish_group::run): Pass input_group to plugins if any.
5154         * readsyms.h (class Input_group): Declare destructor.
5155         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5156         any.
5157
5158 2011-01-10  Ian Lance Taylor  <iant@google.com>
5159
5160         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5161         section as relro.
5162         (Layout::set_segment_offsets): Reset increase_relro before calling
5163         set_section_addresses a second time.
5164
5165 2011-01-04  Cary Coutant  <ccoutant@google.com>
5166
5167         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5168         sections before NOBITS sections.
5169
5170 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5171
5172         * version.cc (print_version): Update copyright to 2011.
5173
5174 2010-12-23  Cary Coutant  <ccoutant@google.com>
5175
5176         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5177         of OS to this->add.  Add OD parameter to second form of the function.
5178
5179 2010-12-20  Ian Lance Taylor  <iant@google.com>
5180
5181         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5182         second of two consecutive entries with same offset.
5183
5184 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5185
5186         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5187         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5188         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5189         to avoid unneeded links against $(LDADD).
5190         * testsuite/Makefile.in: Regenerate.
5191
5192 2010-12-15  Ian Lance Taylor  <iant@google.com>
5193
5194         PR gold/12324
5195         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5196         for R_X86_64_32 and R_X86_64_PC32.
5197         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5198         ver_matching_def_pic.o.
5199         (ver_matching_def_pic.o): New target.
5200
5201 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5202
5203         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5204         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5205         Move definition before File_read::View member definitions.
5206         (File_read::View::~View): Initialize and hold lock before
5207         updating current_mapped_bytes.
5208
5209 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5210
5211         * dwarf_reader.cc: Remove outdated comment.
5212         * gold-threads.cc: Fix typo in error message.
5213         * archive.cc: Fix typos in comments.
5214         * archive.h: Likewise.
5215         * arm-reloc-property.cc: Likewise.
5216         * arm-reloc-property.h: Likewise.
5217         * arm-reloc.def: Likewise.
5218         * arm.cc: Likewise.
5219         * attributes.h: Likewise.
5220         * cref.cc: Likewise.
5221         * ehframe.cc: Likewise.
5222         * fileread.h: Likewise.
5223         * gold.h: Likewise.
5224         * i386.cc: Likewise.
5225         * icf.cc: Likewise.
5226         * incremental.h: Likewise.
5227         * int_encoding.cc: Likewise.
5228         * layout.h: Likewise.
5229         * main.cc: Likewise.
5230         * merge.h: Likewise.
5231         * object.cc: Likewise.
5232         * object.h: Likewise.
5233         * options.cc: Likewise.
5234         * readsyms.cc: Likewise.
5235         * reduced_debug_output.cc: Likewise.
5236         * reloc.cc: Likewise.
5237         * script-sections.cc: Likewise.
5238         * sparc.cc: Likewise.
5239         * symtab.h: Likewise.
5240         * target-reloc.h: Likewise.
5241         * target.cc: Likewise.
5242         * target.h: Likewise.
5243         * timer.cc: Likewise.
5244         * timer.h: Likewise.
5245         * x86_64.cc: Likewise.
5246
5247 2010-12-09  Cary Coutant  <ccoutant@google.com>
5248
5249         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5250         stack.
5251         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5252         parameter; change all callers.
5253         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5254         * options.h (warn_execstack): New option.
5255
5256 2010-12-07  Doug Kwan  <dougkwan@google.com>
5257
5258         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5259         like function call relocations.
5260
5261 2010-12-07  Ian Lance Taylor  <iant@google.com>
5262
5263         * archive.cc (Archive::get_elf_object_for_member): Permit
5264         punconfigured to be NULL.
5265         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5266         (Archive::include_member): Pass NULL to get_elf_object_for_member
5267         if we searched for the archive and this is the first included
5268         object.
5269
5270 2010-12-01  Ian Lance Taylor  <iant@google.com>
5271
5272         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5273         track_relocs_type_ field.
5274         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5275         Set track_relocs_type_.
5276         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5277         contents when using RELA relocs.
5278         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5279         reloc_map_.
5280         * reloc.cc (Track_relocs::next_addend): New function.
5281         * reloc.h (class Track_relocs): Declare next_addend.
5282
5283 2010-12-01  Ian Lance Taylor  <iant@google.com>
5284
5285         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5286         virtual destructor.
5287
5288 2010-12-01  Ian Lance Taylor  <iant@google.com>
5289
5290         * README: Update compilers known to work and fail.
5291
5292 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5293
5294         * configure.in: For --enable-gold, handle value `default' instead of
5295         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5296         not the default.
5297         * configure: Regenerate.
5298
5299 2010-11-18  Doug Kwan  <dougkwan@google.com>
5300
5301         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5302         and right_alignment to be zero.  Store result alignment only if it is
5303         greater than existing alignment.
5304
5305 2010-11-16  Cary Coutant  <ccoutant@google.com>
5306
5307         PR gold/12220
5308         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5309         Check for ".zdebug_line".
5310
5311 2010-11-16  Doug Kwan  <dougkwan@google.com>
5312             Cary Coutant  <ccoutant@google.com>
5313
5314         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5315         by reference; adjust all callers.
5316         * output.cc (Output_segment::set_section_addresses): Adjust references
5317         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5318         list is empty.
5319         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5320         end at page boundary.
5321
5322 2010-11-16  Cary Coutant  <ccoutant@google.com>
5323
5324         PR gold/12220
5325         * layout.cc (Layout::choose_output_section): Transform names of
5326         compressed sections even when using a script with a SECTIONS clause.
5327         (Layout::output_section_name): Remove code to transform
5328         compressed debug section names.
5329         * output.cc (Output_section::add_input_section): Use uncompressed
5330         section size when tracking input sections.
5331
5332 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5333
5334         * symtab.h (Symbol::NON_PIC_REF): Remove.
5335         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5336         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5337         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5338         (Symbol::use_plt_offset): Take a flags argument and pass it
5339         directly to needs_dynamic_reloc.  Restrict check for undefined
5340         weak symbols to function calls.
5341         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5342         (Target_arm::Scan::global): Use it.
5343         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5344         (Target_arm::Relocate::relocate): Likewise.
5345         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5346         parameter with an r_type parameter.  Use get_reference_flags
5347         to get the flags.
5348         (Target_arm::Relocate::relocate): Update accordingly.
5349         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5350         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5351         (Target_i386::Scan::global): Likewise.
5352         (Target_i386::Relocate::relocate): Likewise.
5353         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5354         parameter with an r_type parameter.  Use get_reference_flags
5355         to get the flags.
5356         (Target_i386::Relocate::relocate): Update accordingly.
5357         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5358         (Target_powerpc::Scan::global): Use it.
5359         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5360         (Target_powerpc::Relocate::relocate): Likewise.
5361         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5362         (Target_sparc::Scan::global): Use it.
5363         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5364         (Target_sparc::Relocate::relocate): Likewise.
5365         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5366         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5367         (Target_x86_64::Scan::global): Likewise.
5368         (Target_x86_64::Relocate::relocate): Likewise.
5369
5370 2010-11-08  Doug Kwan  <dougkwan@google.com>
5371             Cary Coutant  <ccoutant@google.com>
5372
5373         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5374         (Arm_exidx_merge_section::section_contents_): New data member.
5375         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5376         (Arm_input_section::~Arm_input_section): De-allocate memory.
5377         (Arm_input_section::original_contents_): New data member.
5378         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5379         in parameters instead of calling Object::section_contents without
5380         locking.
5381         (Arm_output_section::group_section): New parameter TASK.  Pass it
5382         to callees that need locking objects.
5383         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5384         to lock EXIDX input sections.  Fix a formatting issue.  Call
5385         Arm_exidx_merged_section::build_contents to create merged section
5386         contents.
5387         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5388         to lock object of stub table owner.
5389         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5390         TEXT_SIZE to initialize data member TEXT_SIZE_.
5391         (Arm_exidx_input_section::addralign): Fix typo in comment.
5392         (Arm_exidx_input_section::text_size): New method.
5393         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5394         that require locking objects.  Lock objects before scanning for stubs
5395         and updating local symbols.
5396         (Arm_input_section<big_endian>::init): Copy contents of original
5397         input section.
5398         (Arm_input_section<big_endian>::do_write): Use saved contents of
5399         original input section instead of calling Object::section_contents
5400         without locking.
5401         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5402         size without calling Object::section_size().
5403         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5404         for size.  Allocate a buffer for merged EXIDX entries.
5405         (Arm_exidx_merged_section::build_contents): New method.
5406         (Arm_exidx_merged_section::do_write): Move merge section contents
5407         building code to Arm_exidx_merged_section::build_contetns.  Write
5408         out contetns in buffer instead of building it on the fly.
5409         (Arm_relobj::make_exidx_input_section): Also pass text section size
5410         to Arm_exidx_input_section constructor.
5411         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5412         (Arm_dynobj::do_read_symbols): Fix memory leak.
5413         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5414         * target.h: (class Task): Add forward declaration.
5415         (Target::relax): Add new parameter TASK and pass it to
5416         Target::do_relax().
5417         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5418
5419 2010-11-05  Cary Coutant  <ccoutant@google.com>
5420
5421         PR gold/10708
5422         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5423         object when reading from the file.
5424         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5425         second layout pass.
5426         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5427         when reading section contents.
5428         (get_section_contents): Likewise.
5429         (icf::find_identical_sections): Likewise.
5430         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5431         object when reading from the file.
5432         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5433         the object when doing deferred section layout.
5434
5435 2010-11-03  Nick Clifton  <nickc@redhat.com>
5436
5437         PR gold/12001
5438         * script.h (class Symbol_assignment: name): New member.  Returns
5439         the name of the symbol.
5440         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5441         Returns true if the given symbol name is on the list of
5442         assignments wating to be processed.
5443         * archive.cc (should_incldue_member): If the symbol is undefined,
5444         check to see if it is on the list of symbols pending assignment.
5445
5446 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5447
5448         * script-sections.cc (Script_sections::find_memory_region): Check
5449         for a NULL output section pointer.
5450
5451 2010-10-29  Doug Kwan  <dougkwan@google.com>
5452
5453         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5454         Output_section::add_relaxed_input_section.
5455         * output.cc (Output_section::add_relaxed_input_section): Add new
5456         arguments LAYOUT and NAME.  Set section order index.
5457         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5458         Copy section order index.
5459         * output.h (Output_section::add_relaxed_input_section): Add new
5460         arguments LAYOUT and NAME.
5461
5462 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5463
5464         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5465         NATIVE_OR_CROSS_LINKER.
5466         * testsuite/Makefile.in: Regenerate.
5467
5468 2010-10-20  Doug Kwan  <dougkwan@google.com>
5469
5470         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5471         without SHF_LINK_ORDER flags.
5472         * layout.cc (Layout::choose_output_section): Do not filter
5473         SHF_LINK_ORDER flag in a relocatable link.
5474
5475 2010-10-17  Cary Coutant  <ccoutant@google.com>
5476
5477         * output.h (Output_segment::set_section_addresses): Change function
5478         signature.  Update all callers.
5479         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5480         sections.
5481         (Output_segment::set_section_addresses): Align after last TLS
5482         section.  Add padding before last relro section instead of after.
5483
5484 2010-10-17  Doug Kwan  <dougkwan@google.com>
5485
5486         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5487         GOT output section to be writable.
5488
5489 2010-10-14  Cary Coutant  <ccoutant@google.com>
5490
5491         * debug.h (DEBUG_INCREMENTAL): New flag.
5492         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5493         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5494         mode.
5495         * incremental.cc (report_command_line): Ignore all forms of
5496         --incremental.
5497         * layout.cc (Layout::Layout): Check parameters for incremental link
5498         mode.
5499         * options.cc (General_options::parse_incremental): New function.
5500         (General_options::parse_no_incremental): New function.
5501         (General_options::parse_incremental_full): New function.
5502         (General_options::parse_incremental_update): New function.
5503         (General_options::incremental_mode_): New data member.
5504         (General_options::finalize): Check incremental_mode_.
5505         * options.h (General_options): Update help text for --incremental.
5506         Add --no-incremental, --incremental-full, --incremental-update.
5507         (General_options::Incremental_mode): New enum type.
5508         (General_options::incremental_mode): New function.
5509         (General_options::incremental_mode_): New data member.
5510         * parameters.cc (Parameters::incremental_mode_): New data member.
5511         (Parameters::set_options): Set incremental_mode_.
5512         (Parameters::set_incremental_full): New function.
5513         (Parameters::incremental): New function.
5514         (Parameters::incremental_update): New function.
5515         (set_parameters_incremental_full): New function.
5516         * parameters.h (Parameters::set_incremental_full): New function.
5517         (Parameters::incremental): New function.
5518         (Parameters::incremental_update): New function.
5519         (Parameters::incremental_mode_): New data member.
5520         (set_parameters_incremental_full): New function.
5521         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5522         incremental link mode.
5523         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5524         (Sized_relobj::do_relocate_sections): Likewise.
5525         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5526         option.
5527         * testsuite/Makefile.in: Regenerate.
5528         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5529
5530 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5531
5532         * script-sections.h (class Script_sections): Make
5533         Sections_elements typedef public.
5534         * script-sections.cc (class Sort_output_sections): Add elements_
5535         field.  Add constructor which sets it; change all callers.
5536         (Sort_output_sections::is_before): New function.
5537         (Sort_output_sections::operator()): Call is_before.
5538         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5539         conditional.
5540         * testsuite/script_test_10.sh: New test. Test script section
5541         order.
5542         * testsuite/script_test_10.t: Likewise.
5543         * testsuite/script_test_10.s: Likewise.
5544         * testsuite/Makefile.am: Wrap the cross linker tests and the
5545         common tests into NATIVE_OR_CROSS_LINKER.
5546         (check_SCRIPTS): Add script_test_10.sh.
5547         (check_DATA): Add script_test_10.stdout.
5548         (script_test_10.o, script_test_10): New targets.
5549         (script_test_10.stdout): New target.
5550         * configure, testsuite/Makefile.in: Regenerate.
5551
5552 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5553
5554         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5555         error for the deprecated relocations.
5556         (Target_arm::Scan::global): Likewise.
5557         (Target_arm::Relocate::relocate): Likewise.
5558
5559 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5560
5561         * fileread.cc (Input_file::find_file): Initialize *found_name
5562         and *namep when using the fallback search for case 4.
5563
5564 2010-10-11  Cary Coutant  <ccoutant@google.com>
5565
5566         * options.h (class General_options): Redefine -z lazy as an alias for
5567         the negation of -z now.
5568
5569 2010-10-11  Ian Lance Taylor  <iant@google.com>
5570
5571         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5572         binding.
5573
5574 2010-10-06  Nick Clifton  <nickc@redhat.com>
5575
5576         * script-sections.cc(class Memory_region): Remove
5577         current_lma_offset_ field.  Rename current_vma_offset_ to
5578         current_offset_.  Add last_section_ field.
5579         (Memory_region::get_current_vma_address): Rename to
5580         get_current_address.
5581         (Memory_region::get_current_lma_address): Delete.
5582         (Memory_region::increment_vma_offset): Rename to
5583         increment_offset.
5584         (Memory_region::increment_lma_offset): Delete.
5585         (Memory_region::attributes_compatible): New method.  Returns
5586         true if the provided section is compatible with the region.
5587         (Memory_region::get_last_section): New method.  Returns the last
5588         section to use the region.
5589         (Memory_region::set_last_section): New method.  Stores the last
5590         section to use the region.
5591         (Script_sections::block_in_region): New method.  Returns true if
5592         a block of memory is contained within a region.
5593         (Script_sections::find_memory_region): New method.  Locates a
5594         memory region to be used to set a VMA or LMA address.
5595         (Output_section_definition::set_section_addresses): Add code to
5596         check for addresses set by memory regions.
5597         (Output_segment::set_section_addresses): Remove memory region
5598         walking code.
5599         (Script_sections::create_segment): Add a warning if a header
5600         segment is created outside of any region.
5601         * script-sections.h (class Script_sections): Add prototypes for
5602         find_memory_region and block_in_region methods.
5603         * testsuite/memory_test.s: Use .long instead of .word.
5604         * testsuite/memory_test.t: Add some more output sections.
5605         * testsuite/memory_test.sh: Update expected output.
5606
5607 2010-10-02  Doug Kwan  <dougkwan@google.com>
5608
5609         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5610         defintion to symtab.h
5611         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5612         declaration to defintion.
5613
5614 2010-10-01  Nick Clifton  <nickc@redhat.com>
5615
5616         * expression.cc (eval): Replace dummy argument with NULL.
5617         (eval_maybe_dot): Check for a NULL result section pointer.
5618         (Symbol_expression::value): Likewise.
5619         (Dot_expression::value): Likewise.
5620         (BINARY_EXPRESSION): Likewise.
5621         (Max_expression::value): Likewise.
5622         (Min_expression::value): Likewise.
5623         (Absolute_expression::value): Likewise.
5624         (Addr_expression::value_from_output_section): Likewise.
5625         (Loaddddr_expression::value_from_output_section): Likewise.
5626         (Segment_start_expression::value): Likewise.
5627         * script-sections.cc
5628         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5629         argument with NULL.
5630         (Sections_elememt_dot_assignment::set_section_addresses):
5631         Likewise.
5632         (Output_data_expression::do_write_to_buffer): Likewise.
5633         (Output_section_definition::finalize_symbols): Likewise.
5634         (Output_section_definition::set_section_addresses): Likewise.
5635
5636 2010-09-30  Doug Kwan  <dougkwan@google.com>
5637
5638         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5639
5640 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5641
5642         * target.h (Target::can_icf_inline_merge_sections): New virtual
5643         function.
5644         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5645         virtual function.
5646         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5647         virtual function.
5648         * icf.cc (get_section_contents): Inline merge sections only when
5649         target allows it.
5650
5651 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5652
5653         * configure: Regenerate.
5654
5655 2010-09-17  Ian Lance Taylor  <iant@google.com>
5656
5657         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5658         * testsuite/Makefile.am (memory_test.o): New target.
5659         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5660         memory_test.t.
5661         * testsuite/Makefile.in: Rebuild.
5662
5663 2010-09-17  Doug Kwan  <dougkwan@google.com>
5664
5665         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5666         defintion if relocation uses GOT entries of the symbol.
5667         * testsuite/icf_safe_test.sh: Fix test.
5668         * testsuite/icf_safe_so_test.sh: Fix test.
5669
5670 2010-09-16  Cary Coutant  <ccoutant@google.com>
5671
5672         * script_sections.cc (class Memory_region): Remove "NULL" from
5673         vector initializations.
5674
5675 2010-09-15  Cary Coutant  <ccoutant@google.com>
5676
5677         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5678         Resolve forwarding symbols.
5679
5680 2010-09-15  Doug Kwan  <dougkwan@google.com>
5681
5682         * gold/testsuite/script_test_3.t: Add ARM special sections.
5683         * gold/testsuite/script_test_4.t: Same.
5684         * gold/testsuite/script_test_5.t: Same.
5685         * gold/testsuite/script_test_6.t: Same.
5686         * gold/testsuite/script_test_7.t: Same.
5687         * gold/testsuite/script_test_7.t: Same.
5688         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5689
5690 2010-09-14  Cary Coutant  <ccoutant@google.com>
5691
5692         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5693         (Target_x86_64::Relocate::relocate_tls): Replace check for
5694         saw_tls_block_reloc_ with test for executable section.
5695
5696 2010-09-12  Cary Coutant  <ccoutant@google.com>
5697
5698         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5699         position-independent executables to shared libraries need dynamic
5700         relocations.
5701         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5702         position-independent executables.
5703         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5704         * testsuite/Makefile.in: Regenerate.
5705
5706 2010-09-10  Nick Clifton  <nickc@redhat.com>
5707
5708         PR gold/11997
5709         * testsuite/memory_test.t: Discard any sections that are not
5710         needed.
5711
5712 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5713
5714         PR gold/11996
5715         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5716         "This::" to work around a bug in gcc 4.2.
5717
5718         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5719
5720 2010-09-09  Rafael Espindola  <espindola@google.com>
5721
5722         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5723         sections with different PF_X flags in the same segment.
5724         (Layout::find_first_load_seg): Search all segments to find the first
5725         one.
5726         * options.h (rosegment): New.
5727
5728 2010-09-08  Rafael Espindola  <espindola@google.com>
5729
5730         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5731
5732 2010-09-08  Doug Kwan  <dougkwan@google.com>
5733
5734         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5735         (Arm_relobj::do_relocate_sections): Add new parameter for output
5736         file to match the parent.
5737         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5738         of local symbols instead of input values.  Update code to track
5739         changes in gold::relocate_section.
5740         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5741         (Sized_relobj::compute_final_local_value_internal): New methods.
5742         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5743         body into private version of Sized_relobj::compute_final_local_value.
5744         Call the inline method.
5745         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5746         merged symbol value if there is one.
5747         (Symbol_value::has_output_value): New method defintiion.
5748         (Sized_relobj::Compute_final_local_value_status): New enum type.
5749         (Sized_relobj::compute_final_local_value): New methods.
5750         (Sized_relobj::compute_final_local_value_internal): New methods.
5751         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5752         and arm_cortex_a8.sh.
5753         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5754         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5755         New tests.
5756         * Makefile.in: Regenerate.
5757         * testsuite/arm_bl_out_of_range.s: Update test.
5758         * testsuite/thumb_bl_out_of_range.s: Ditto.
5759         * testsuite/thumb_blx_out_of_range.s: Ditto.
5760         * testsuite/arm_branch_out_of_range.sh: New file.
5761         * testsuite/arm_cortex_a8.sh: Ditto.
5762         * testsuite/arm_cortex_a8_b.s: Ditto.
5763         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5764         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5765         * testsuite/arm_cortex_a8_bl.s: Ditto.
5766         * testsuite/arm_cortex_a8_blx.s: Ditto.
5767         * testsuite/arm_cortex_a8_local.s: Ditto.
5768         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5769         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5770
5771 2010-09-08  Rafael Espindola  <espindola@google.com>
5772
5773         * Makefile.am (memory_test.stdout): Run readelf with -W.
5774         * Makefile.in: Regenerate.
5775         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5776         64 bit output.
5777
5778 2010-09-08  Rafael Espindola  <espindola@google.com>
5779
5780         * script-sections.cc (Script_sections::add_memory_region): Convert
5781         field precision to int.
5782         * script.cc (script_set_section_region, script_set_section_region):
5783         Convert field precision to int.
5784
5785 2010-09-08  Rafael Espindola  <espindola@google.com>
5786
5787         * arm.cc (do_finalize_sections): Create the __exidx_start and
5788         __exdix_end symbols even when the section is missing.
5789
5790 2010-09-08  Nick Clifton  <nickc@redhat.com>
5791
5792         * README: Remove claim that MEMORY is not supported.
5793         * expression.cc (script_exp_function_origin)
5794         (script_exp_function_length): Move from here to ...
5795         * script.cc: ... here.
5796         (script_set_section_region, script_add_memory)
5797         (script_parse_memory_attr, script_include_directive): New
5798         functions.
5799         * script-sections.cc
5800         (class Memory_region): New class.
5801         (class Output_section_definition): Add set_memory_region,
5802         set_section_vma, set_section_lma and get_section_name methods.
5803         (class Script_Sections): Add add_memory_region,
5804         find_memory_region, find_memory_region_origin,
5805         find_memory_region_length and set_memory_region methods.
5806         Have set_section_addresses method walk the list of set memory
5807         regions.
5808         Extend the print methos to display memory regions.
5809         * script-sections.h: Add prototypes for new methods.
5810         Add enum for MEMORY region attributes.
5811         * yyscript.y: Add support for parsing MEMORY regions.
5812         * script-c.h: Add prototypes for new functions.
5813         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5814         * testsuite/Makefile.in: Regenerate.
5815         * testsuite/memory_test.sh: New script.
5816         * testsuite/memory_test.s: New assembler source file.
5817         * testsuite/memory_test.t: New linker script.
5818
5819 2010-08-27  Doug Kwan  <dougkwan@google.com>
5820
5821         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5822         reference override an existing dynamic weak reference.
5823         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5824         * testsuite/Makefile.in: Regenerate.
5825         * testsuite/dyn_weak_ref.sh: New file.
5826         * testsuite/dyn_weak_ref_1.c: Ditto.
5827         * testsuite/dyn_weak_ref_2.c: Ditto.
5828
5829 2010-08-27  Ian Lance Taylor  <iant@google.com>
5830
5831         * incremental.h (class Incremental_input_entry): Add virtual
5832         destructor.
5833
5834 2010-08-27  Ian Lance Taylor  <iant@google.com>
5835
5836         * testsuite/start_lib_test_3.c: Mark t3 as used.
5837
5838 2010-08-27  Nick Clifton  <nickc@redhat.com>
5839
5840         * options.cc (version_script): Fix small typo in previous
5841         whitespace tidyup.
5842
5843 2010-08-25  Nick Clifton  <nickc@redhat.com>
5844
5845         * archive.cc: Formatting fixes: Remove whitespace between
5846         typename and following asterisk.  Remove whitespace between
5847         function name and opening parenthesis.
5848         * archive.h: Likewise.
5849         * arm.cc: Likewise.
5850         * attributes.cc: Likewise.
5851         * attributes.h: Likewise.
5852         * common.cc: Likewise.
5853         * copy-relocs.cc: Likewise.
5854         * dirsearch.h: Likewise.
5855         * dynobj.cc: Likewise.
5856         * ehframe.cc: Likewise.
5857         * ehframe.h: Likewise.
5858         * expression.cc: Likewise.
5859         * fileread.cc: Likewise.
5860         * fileread.h: Likewise.
5861         * gc.h: Likewise.
5862         * gold-threads.cc: Likewise.
5863         * gold.cc: Likewise.
5864         * i386.cc: Likewise.
5865         * icf.h: Likewise.
5866         * incremental-dump.cc: Likewise.
5867         * incremental.cc: Likewise.
5868         * layout.cc: Likewise.
5869         * layout.h: Likewise.
5870         * main.cc: Likewise.
5871         * merge.cc: Likewise.
5872         * merge.h: Likewise.
5873         * object.cc: Likewise.
5874         * object.h: Likewise.
5875         * options.cc: Likewise.
5876         * options.h: Likewise.
5877         * output.cc: Likewise.
5878         * output.h: Likewise.
5879         * plugin.cc: Likewise.
5880         * plugin.h: Likewise.
5881         * powerpc.cc: Likewise.
5882         * reloc.cc: Likewise.
5883         * script-c.h: Likewise.
5884         * script-sections.cc: Likewise.
5885         * script.cc: Likewise.
5886         * stringpool.cc: Likewise.
5887         * symtab.cc: Likewise.
5888         * symtab.h: Likewise.
5889         * target.cc: Likewise.
5890         * timer.cc: Likewise.
5891         * timer.h: Likewise.
5892         * version.cc: Likewise.
5893         * x86_64.cc: Likewise.
5894
5895 2010-08-24  Nick Clifton  <nickc@redhat.com>
5896
5897         PR 11899
5898         * layout.cc (segment_precedes): Sort segments by their physical
5899         addresses, if they have been set.
5900
5901 2010-08-23  Cary Coutant  <ccoutant@google.com>
5902
5903         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5904         symbols data.
5905         (Lib_group::include_member): Unlock object after deleting its
5906         symbols data.
5907         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5908         the bug fixed here.
5909
5910 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5911             Cary Coutant  <ccoutant@google.com>
5912
5913         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5914         constructor, and set_blocker.
5915         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5916         readsyms_blocker_.
5917         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5918         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5919         * testsuite/Makefile.am (start_lib_test): New test case.
5920         * testsuite/Makefile.in: Regenerate.
5921         * testsuite/start_lib_test_main.c: New file.
5922         * testsuite/start_lib_test_1.c: New file.
5923         * testsuite/start_lib_test_2.c: New file.
5924         * testsuite/start_lib_test_3.c: New file.
5925
5926 2010-08-19  Ian Lance Taylor  <iant@google.com>
5927
5928         * Makefile.in: Rebuild with automake 1.11.1.
5929         * aclocal.m4: Likewise.
5930         * testsuite/Makefile.in: Likewise.
5931
5932 2010-08-19  Ian Lance Taylor  <iant@google.com>
5933
5934         PR 10893
5935         * i386.cc (class Output_data_plt_i386): Update declarations.
5936         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5937         local_ifuncs_ fields.
5938         (Target_i386::do_plt_section_for_global): New function.
5939         (Target_i386::do_plt_section_for_local): New function.
5940         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5941         parameter; change all callers.  Initialize global_ifuncs_ and
5942         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5943         __rel_iplt_end.
5944         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5945         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5946         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5947         symbols.
5948         (Target_i386::make_plt_section): New function, broken out of
5949         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5950         (Target_i386::make_plt_entry): Call make_plt_section.
5951         (Target_i386::make_local_ifunc_plt_entry): New function.
5952         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5953         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5954         R_386_IRELATIVE to switch.
5955         (Target_i386::Scan::global): Likewise.
5956         (Target_i386::Relocate::relocate): Likewise.
5957         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5958         switch.
5959         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5960         (Target_x86_64::do_plt_section_for_global): New function.
5961         (Target_x86_64::do_plt_section_for_local): New function.
5962         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5963         parameter; change all callers.  If doing a static link define
5964         __rela_iplt_start and __rela_iplt_end.
5965         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5966         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5967         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5968         to point to .plt.
5969         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5970         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5971         switch.
5972         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5973         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5974         R_X86_64_IRELATIVE to switch.
5975         (Target_x86_64::Scan::global): Likewise.
5976         (Target_x86_64::Relocate::relocate): Likewise.
5977         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5978         switch.
5979         * target.h (class Target): Add plt_section_for_global and
5980         plt_section_for_local functions.  Add do_plt_section_for_global
5981         and do_plt_section_for_local virtual functions.
5982         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5983         clarifying comments.
5984         (Symbol::use_plt_offset): Handle IFUNC symbol.
5985         * object.cc (Sized_relobj::Sized_relobj): Initialize
5986         local_plt_offsets_.
5987         (Sized_relobj::local_has_plt_offset): New function.
5988         (Sized_relobj::local_plt_offset): New function.
5989         (Sized_relobj::set_local_plt_offset): New function.
5990         (Sized_relobj::do_count): Handle IFUNC symbol.
5991         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5992         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5993         is_ifunc_symbol functions.
5994         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5995         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5996         local_plt_offsets_ field.
5997         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5998         * output.h (class Output_section_data): Add non-const
5999         output_section function.
6000         (class Output_data_got): Update declarations.
6001         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6002         Add use_plt_offset parameter to global and local constructors.
6003         Change all callers.  Change local_sym_index_ field to 31 bits.
6004         Change GSYM_CODE and CONSTANT_CODE accordingly.
6005         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6006         doing a static link don't set sh_link field.
6007         (Output_data_got::Got_entry::write): Use PLT offset if
6008         appropriate.
6009         (Output_data_got::add_global_plt): New function.
6010         (Output_data_got::add_local_plt): New function.
6011         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6012         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6013         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6014         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6015         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6016         IFUNC conditional.
6017         * testsuite/ifunc-sel.h: New file.
6018         * testsuite/ifuncmain1.c: New file.
6019         * testsuite/ifuncmain1vis.c: New file.
6020         * testsuite/ifuncmod1.c: New file.
6021         * testsuite/ifuncdep2.c: New file.
6022         * testsuite/ifuncmain2.c: New file.
6023         * testsuite/ifuncmain3.c: New file.
6024         * testsuite/ifuncmod3.c: New file.
6025         * testsuite/ifuncmain4.c: New file.
6026         * testsuite/ifuncmain5.c: New file.
6027         * testsuite/ifuncmod5.c: New file.
6028         * testsuite/ifuncmain6pie.c: New file.
6029         * testsuite/ifuncmod6.c: New file.
6030         * testsuite/ifuncmain7.c: New file.
6031         * configure, testsuite/Makefile.in: Rebuild.
6032
6033 2010-08-18  Ian Lance Taylor  <iant@google.com>
6034
6035         * incremental.cc
6036         (Output_section_incremental_inputs::write_input_files): Add cast
6037         to avoid signed/unsigned comparison warning.
6038         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6039
6040 2010-08-12  Cary Coutant  <ccoutant@google.com>
6041
6042         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6043
6044 2010-08-13  Ian Lance Taylor  <iant@google.com>
6045
6046         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6047
6048 2010-08-12  Cary Coutant  <ccoutant@google.com>
6049             Doug Kwan  <dougkwan@google.com>
6050
6051         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6052         defintion overrides non-weak undef, remember that the original undef
6053         is not weak.
6054         * symtab.cc (Symbol_table::sized_write_global): For undef without
6055         an original weak binding, set binding to global in output.
6056         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6057         * testsuite/Makefile.in: Regenerate.
6058         * testsuite/strong_ref_weak_def.sh: New file.
6059         * testsuite/strong_ref_weak_def_1.c: Ditto.
6060         * testsuite/strong_ref_weak_def_2.c: Ditto.
6061
6062 2010-08-12  Cary Coutant  <ccoutant@google.com>
6063
6064         * testsuite/incremental_test.sh: Rewrite.
6065         * testsuite/incremental_test_1.c: Rewrite.
6066         * testsuite/incremental_test_2.c: Rewrite.
6067
6068 2010-08-12  Cary Coutant  <ccoutant@google.com>
6069
6070         * arm.cc (Target_arm::got_size): Add const.
6071         (Target_arm::got_entry_count): New function.
6072         (Target_arm::plt_entry_count): New function.
6073         (Target_arm::first_plt_entry_offset): New function.
6074         (Target_arm::plt_entry_size): New function.
6075         (Output_data_plt_arm::entry_count): New function.
6076         (Output_data_plt_arm::first_plt_entry_offset): New function.
6077         (Output_data_plt_arm::get_plt_entry_size): New function.
6078         * i386.cc (Target_i386::got_size): Add const.
6079         (Target_i386::got_entry_count): New function.
6080         (Target_i386::plt_entry_count): New function.
6081         (Target_i386::first_plt_entry_offset): New function.
6082         (Target_i386::plt_entry_size): New function.
6083         (Output_data_plt_i386::entry_count): New function.
6084         (Output_data_plt_i386::first_plt_entry_offset): New function.
6085         (Output_data_plt_i386::get_plt_entry_size): New function.
6086         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6087         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6088         * incremental.cc: Include target.h.
6089         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6090         parameter.  Adjust all callers.  Find incremental_got_plt section.
6091         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6092         section.
6093         (Output_section_incremental_inputs::set_final_data_size): Calculate
6094         size of incremental_got_plt section.
6095         (Output_section_incremental_inputs::do_write): Write the
6096         incremental_got_plt section.
6097         (Got_plt_view_info): New struct.
6098         (Local_got_offset_visitor): New class.
6099         (Global_got_offset_visitor): New class.
6100         (Global_symbol_visitor_got_plt): New class.
6101         (Output_section_incremental_inputs::write_got_plt): New function.
6102         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6103         Add parameter.  Adjust all callers.
6104         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6105         (Incremental_inputs::got_plt_section): New function.
6106         (Incremental_inputs::got_plt_section_): New data member.
6107         (Incremental_got_plt_reader): New class.
6108         * layout.cc (Layout::create_incremental_info_sections): Add the
6109         incremental_got_plt section.
6110         * object.h (Got_offset_list::get_list): New function.
6111         (Got offset_list::for_all_got_offsets): New function.
6112         (Sized_relobj::local_got_offset_list): New function.
6113         * powerpc.cc (Target_powerpc::got_size): Add const.
6114         (Target_powerpc::got_entry_count): New function.
6115         (Target_powerpc::plt_entry_count): New function.
6116         (Target_powerpc::first_plt_entry_offset): New function.
6117         (Target_powerpc::plt_entry_size): New function.
6118         (Output_data_plt_powerpc::entry_count): New function.
6119         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6120         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6121         * sparc.cc (Target_sparc::got_size): Add const.
6122         (Target_sparc::got_entry_count): New function.
6123         (Target_sparc::plt_entry_count): New function.
6124         (Target_sparc::first_plt_entry_offset): New function.
6125         (Target_sparc::plt_entry_size): New function.
6126         (Output_data_plt_sparc::entry_count): New function.
6127         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6128         (Output_data_plt_sparc::get_plt_entry_size): New function.
6129         * symtab.h (Symbol::got_offset_list): New function.
6130         (Symbol_table::for_all_symbols): New function.
6131         * target.h (Sized_target::got_entry_count): New function.
6132         (Sized_target::plt_entry_count): New function.
6133         (Sized_target::plt_entry_size): New function.
6134         * x86_64.cc (Target_x86_64::got_size): Add const.
6135         (Target_x86_64::got_entry_count): New function.
6136         (Target_x86_64::plt_entry_count): New function.
6137         (Target_x86_64::first_plt_entry_offset): New function.
6138         (Target_x86_64::plt_entry_size): New function.
6139         (Output_data_plt_x86_64::entry_count): New function.
6140         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6141         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6142
6143 2010-08-12  Cary Coutant  <ccoutant@google.com>
6144
6145         * archive.cc: Include incremental.h.
6146         (Archive::Archive): Initialize incremental_info_.
6147         (Archive::include_member): Record archive members in incremental info.
6148         (Add_archive_symbols::run): Record begin and end of an archive in
6149         incremental info.
6150         (Lib_group::include_member): Record objects in incremental info.
6151         * archive.h (Incremental_archive_entry): Forward declaration.
6152         (Archive::set_incremental_info): New member function.
6153         (Archive::incremental_info): New member function.
6154         (Archive::Unused_symbol_iterator): New class.
6155         (Archive::unused_symbols_begin): New member function.
6156         (Archive::unused_symbols_end): New member function.
6157         (Archive::incremental_info_): New data member.
6158         * incremental-dump.cc (find_input_containing_global): New function.
6159         (dump_incremental_inputs): Dump new incremental info sections.
6160         * incremental.cc: Include symtab.h.
6161         (Output_section_incremental_inputs): New class.
6162         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6163         new incremental info sections.
6164         (Sized_incremental_binary::do_check_inputs): Likewise.
6165         (Incremental_inputs::report_archive): Remove.
6166         (Incremental_inputs::report_archive_begin): New function.
6167         (Incremental_inputs::report_archive_end): New function.
6168         (Incremental_inputs::report_object): New function.
6169         (Incremental_inputs::finalize_inputs): Remove.
6170         (Incremental_inputs::report_input_section): New function.
6171         (Incremental_inputs::report_script): Rewrite.
6172         (Incremental_inputs::finalize): Do nothing but finalize string table.
6173         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6174         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6175         (Incremental_inputs::create_data_sections): New function.
6176         (Incremental_inputs::relocs_entsize): New function.
6177         (Output_section_incremental_inputs::set_final_data_size): New function.
6178         (Output_section_incremental_inputs::do_write): New function.
6179         (Output_section_incremental_inputs::write_header): New function.
6180         (Output_section_incremental_inputs::write_input_files): New function.
6181         (Output_section_incremental_inputs::write_info_blocks): New function.
6182         (Output_section_incremental_inputs::write_symtab): New function.
6183         * incremental.h (Incremental_script_entry): Forward declaration.
6184         (Incremental_object_entry): Forward declaration.
6185         (Incremental_archive_entry): Forward declaration.
6186         (Incremental_inputs): Forward declaration.
6187         (Incremental_inputs_header_data): Remove.
6188         (Incremental_inputs_header): Remove.
6189         (Incremental_inputs_header_write): Remove.
6190         (Incremental_inputs_entry_data): Remove.
6191         (Incremental_inputs_entry): Remove.
6192         (Incremental_inputs_entry_write): Remove.
6193         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6194         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6195         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6196         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6197         Likewise.
6198         (Incremental_input_entry): New class.
6199         (Incremental_script_entry): New class.
6200         (Incremental_object_entry): New class.
6201         (Incremental_archive_entry): New class.
6202         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6203         (Incremental_inputs::report_inputs): Remove.
6204         (Incremental_inputs::report_archive): Remove.
6205         (Incremental_inputs::report_archive_begin): New function.
6206         (Incremental_inputs::report_archive_end): New function.
6207         (Incremental_inputs::report_object): Change prototype.
6208         (Incremental_inputs::report_input_section): New function.
6209         (Incremental_inputs::report_script): Change prototype.
6210         (Incremental_inputs::get_reloc_count): New function.
6211         (Incremental_inputs::set_reloc_count): New function.
6212         (Incremental_inputs::create_data_sections): New function.
6213         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6214         (Incremental_inputs::inputs_section): New function.
6215         (Incremental_inputs::symtab_section): New function.
6216         (Incremental_inputs::relocs_section): New function.
6217         (Incremental_inputs::get_stringpool): Add const.
6218         (Incremental_inputs::command_line): Add const.
6219         (Incremental_inputs::inputs): Remove.
6220         (Incremental_inputs::command_line_key): New function.
6221         (Incremental_inputs::input_file_count): New function.
6222         (Incremental_inputs::input_files): New function.
6223         (Incremental_inputs::relocs_entsize): New function.
6224         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6225         (Incremental_inputs::finalize_inputs): Remove.
6226         (Incremental_inputs::Input_info): Remove.
6227         (Incremental_inputs::lock_): Remove.
6228         (Incremental_inputs::inputs_): Change type.
6229         (Incremental_inputs::inputs_map_): Remove.
6230         (Incremental_inputs::current_object_entry_): New data member.
6231         (Incremental_inputs::inputs_section_): New data member.
6232         (Incremental_inputs::symtab_section_): New data member.
6233         (Incremental_inputs::relocs_section_): New data member.
6234         (Incremental_inputs::reloc_count_): New data member.
6235         (Incremental_inputs_reader): New class.
6236         (Incremental_symtab_reader): New class.
6237         (Incremental_relocs_reader): New class.
6238         * layout.cc (Layout::finalize): Move finalization of incremental info
6239         and creation of incremental info sections to follow finalization of
6240         symbol table.  Set offsets for postprocessing sections.
6241         (Layout::create_incremental_info_sections): Call
6242         Incremental_inputs::create_data_sections.  Add incremental symtab
6243         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6244         sections to layout after input sections.
6245         * layout.h (struct Timespec): Forward declaration.
6246         (Layout::incremental_inputs): Add const.
6247         (Layout::create_incremental_info_sections): Add parameter.
6248         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6249         * object.cc: Include incremental.h.
6250         (Relobj::finalize_incremental_relocs): New function.
6251         (Sized_relobj::do_layout): Record input sections in incremental info.
6252         * object.h (Object::output_section): New function.
6253         (Object::output_section_offset): Moved from Relobj.
6254         (Object::get_incremental_reloc_base): New function.
6255         (Object::get_incremental_reloc_count): New function.
6256         (Object::do_output_section): New function.
6257         (Object::do_output_section_offset): Moved from Relobj.
6258         (Object::do_get_incremental_reloc_base): New function.
6259         (Object::do_get_incremental_reloc_count): New function.
6260         (Object::Object): Initialize new data members.
6261         (Relobj::output_section): Renamed do_output_section and moved to
6262         protected.
6263         (Relobj::output_section_offset): Moved to Object.
6264         (Relobj::do_get_incremental_reloc_base): New function.
6265         (Relobj::do_get_incremental_reloc_count): New function.
6266         (Relobj::allocate_incremental_reloc_counts): New function.
6267         (Relobj::count_incremental_reloc): New function.
6268         (Relobj::finalize_incremental_relocs): New function.
6269         (Relobj::next_incremental_reloc_index): New function.
6270         (Relobj::reloc_counts_): New data member.
6271         (Relobj::reloc_bases_): New data member.
6272         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6273         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6274         (Sized_relobj::incremental_relocs_scan): New function.
6275         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6276         (Sized_relobj::incremental_relocs_write): New function.
6277         (Sized_relobj::incremental_relocs_write_reltype): New function.
6278         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6279         incremental link.
6280         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6281         archives and object files elsewhere.
6282         (Add_symbols::run): Report object files here.
6283         (Finish_group::run): Report end of archive at end of group.
6284         * reloc.cc: Include layout.h, incremental.h.
6285         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6286         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6287         (Sized_relobj::incremental_relocs_scan): New function.
6288         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6289         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6290         (Sized_relobj::incremental_relocs_write): New function.
6291         (Sized_relobj::incremental_relocs_write_reltype): New function.
6292         * script.cc (read_input_script): Rewrite test for incremental link.
6293         Change call to Incremental_inputs::report_script.
6294         * symtab.h (Symbol_table::first_global_index): New function.
6295         (Symbol_table::output_count): New function.
6296
6297 2010-08-12  Doug Kwan  <dougkwan@google.com>
6298
6299         * arm.cc (Target_arm::merge_object_attributes): Check command line
6300         options --no-wchar-size-warning and --no-enum-size-warning.
6301         * options.h (General_options): Add ld-compatible options
6302         --no-enum-size-warning and --no-wchar-size-warning.
6303
6304 2010-08-04  Ian Lance Taylor  <iant@google.com>
6305
6306         * x86_64.cc (Target_x86_64::Scan::local): Use
6307         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6308         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6309         (Target_x86_64::Scan::global): Likewise.
6310         (Target_x86_64::Relocate::relocate): Likewise.
6311         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6312         Likewise.
6313
6314 2010-08-03  Cary Coutant  <ccoutant@google.com>
6315
6316         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6317         to reserve space in merged_strings vector. Keep total input size
6318         for stats.
6319         (Output_merge_string::do_print_merge_stats): Print total input size.
6320         * merge.h (Output_merge_string): Add input_size_ field.
6321         * stringpool.cc (Stringpool_template::string_length): Move
6322         implementations out of Stringpool_template class and place in
6323         stringpool.h.
6324         * stringpool.h (string_length): Move out of Stringpool_template.
6325
6326 2010-08-03  Ian Lance Taylor  <iant@google.com>
6327
6328         PR 11712
6329         * layout.cc (relaxation_loop_body): If address of load segment is
6330         set, adjust address to include headers if possible.
6331
6332 2010-08-03  Ian Lance Taylor  <iant@google.com>
6333
6334         * version.cc (version_string): Bump to 1.10.
6335
6336 2010-08-03  Ian Lance Taylor  <iant@google.com>
6337
6338         PR 11805
6339         * layout.h (enum Output_section_order): Define.
6340         (class Layout): Update declarations.
6341         * layout.cc (Layout::get_output_section): Add order parameter.
6342         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6343         is_first_non_relro parameters.  Change all callers.
6344         (Layout::choose_output_section): Likewise.
6345         (Layout::add_output_section_data): Likewise.
6346         (Layout::make_output_section): Likewise.  Set order.
6347         (Layout::default_section_order): New function.
6348         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6349         * output.cc (Output_section::Output_section): Initialize order_.
6350         Don't initialize deleted fields.
6351         (Output_segment::Output_segment): Don't initialize deleted
6352         fields.
6353         (Output_segment::add_output_section_to_load): New function
6354         replacing add_output_section.  Change all callers to call this or
6355         add_output_section_to_nonload.
6356         (Output_segment::add_output_section_to_nonload): New function.
6357         (Output_segment::remove_output_section): Rewrite.
6358         (Output_segment::add_initial_output_data): Likewise.
6359         (Output_segment::has_any_data_sections): Likewise.
6360         (Output_segment::is_first_section_relro): Likewise.
6361         (Output_segment::maximum_alignment): Likewise.
6362         (Output_segment::has_dynamic_reloc): New function replacing
6363         dynamic_reloc_count.  Change all callers.
6364         (Output_segment::has_dynamic_reloc_list): New function replacing
6365         dynamic_reloc_count_list.  Change all callers.
6366         (Output_segment::set_section_addresses): Rewrite.
6367         (Output_segment::set_offset): Rewrite.
6368         (Output_segment::find_first_and_last_list): Remove.
6369         (Output_segment::set_tls_offsets): Rewrite.
6370         (Output_segment::first_section_load_address): Likewise.
6371         (Output_segment::output_section_count): Likewise.
6372         (Output_segment::section_with_lowest_load_address): Likewise.
6373         (Output_segment::write_section_headers): Likewise.
6374         (Output_segment::print_sections_to_map): Likewise.
6375         * output.h (class Output_data): Remove dynamic_reloc_count_
6376         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6377         (Output_data::add_dynamic_reloc): Rewrite.
6378         (Output_data::has_dynamic_reloc): New function.
6379         (Output_data::dynamic_reloc_count): Remove.
6380         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6381         is_last_relro_, is_first_non_relro_, is_interp_,
6382         is_dynamic_linker_section_ fields.  Add order and set_order
6383         functions.  Remove is_relro_local, set_is_relro_local,
6384         is_last_relro, set_is_last_relro, is_first_non_relro,
6385         set_is_first_non_relro functions, is_interp, set_is_interp,
6386         is_dynamic_linker_section, and set_is_dynamic_linker_section
6387         functions.
6388         (class Output_segment): Change Output_data_list from std::list to
6389         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6390         output_bss_ fields.  Update declarations.
6391
6392 2010-08-02  Ian Lance Taylor  <iant@google.com>
6393
6394         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6395         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6396         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6397
6398 2010-08-02  Ian Lance Taylor  <iant@google.com>
6399
6400         PR 11855
6401         * script.cc (Script_options::Script_options): Initialize
6402         symbol_definitions_ and symbol_references_.
6403         (Script_options::add_symbol_assignment): Update
6404         symbol_definitions_ and symbol_references_.
6405         (Script_options::add_symbol_reference): New function.
6406         (script_symbol): New function.
6407         * script.h (class Script_options): Add symbol_definitions_ and
6408         symbol_references_ fields.
6409         (Script_options::referenced_const_iterator): New type.
6410         (Script_options::referenced_begin): New function.
6411         (Script_options::referenced_end): New function.
6412         (Script_options::is_referenced): New function.
6413         (Script_options::any_unreferenced): New function.
6414         * script-c.h (script_symbol): Declare.
6415         * yyscript.y (exp): Call script_symbol.
6416         * symtab.cc: Include "script.h".
6417         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6418         Change all callers.  Check symbols referenced by scripts.
6419         (Symbol_table::add_undefined_symbols_from_command_line): Add
6420         layout parameter.  Change all callers.
6421         (Symbol_table::do_add_undefined_symbols_from_command_line):
6422         Likewise.  Break out loop body.  Check symbols referenced by
6423         scripts.
6424         (Symbol_table::add_undefined_symbol_from_command_line): New
6425         function broken out of
6426         do_add_undefined_symbols_from_command_line.
6427         * symtab.h (class Symbol_table): Update declarations.
6428         * archive.cc: Include "layout.h".
6429         (Archive::should_include_member): Add layout parameter.  Change
6430         all callers.  Check for symbol mentioned in expression.
6431         * archive.h (class Archive): Update declaration.
6432         * object.cc (Sized_relobj::do_should_include_member): Add layout
6433         parameter.
6434         * object.h (Object::should_include_member): Add layout parameter.
6435         Change all callers.
6436         (Object::do_should_include_member): Add layout parameter.
6437         (class Sized_relobj): Update declaration.
6438         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6439         parameter.
6440         * dynobj.h (class Sized_dynobj): Update declaration.
6441         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6442         layout parameter.
6443         * plugin.h (class Sized_pluginobj): Update declaration.
6444
6445 2010-08-02  Ian Lance Taylor  <iant@google.com>
6446
6447         PR 11866
6448         * output.cc (Output_segment::set_offset): Search for the first and
6449         last sections rather than assuming that the list is in order.
6450         (Output_segment::find_first_and_last_list): New function.
6451         * output.h (class Output_segment): Update declarations.
6452         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6453         (relro_strip_test_SOURCES): New variable.
6454         (relro_strip_test_DEPENDENCIES): New variable.
6455         (relro_strip_test_LDFLAGS): New variable.
6456         (relro_strip_test_LDADD): New variable.
6457         (relro_strip_test.so): New target.
6458
6459 2010-08-02  Ian Lance Taylor  <iant@google.com>
6460
6461         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6462         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6463         (Target_i386::got_tlsdesc_section): New function.
6464         (Target_i386::got_section): Create space for GOT entries for
6465         TLSDESC relocations.
6466         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6467         R_386_TLS_GOTDESC.
6468         (Target_i386::Scan::global): Likewise.
6469         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6470         using TLSDESC GOT.
6471         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6472         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6473         (Target_x86_64::got_tlsdesc_section): New function.
6474         (Target_x86_64::got_section): Create space for GOT entries for
6475         TLSDESC relocations.
6476         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6477         R_386_TLS_GOTDESC.
6478         (Target_x86_64::Scan::global): Likewise.
6479         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6480         using TLSDESC GOT.
6481
6482 2010-08-02  Ian Lance Taylor  <iant@google.com>
6483
6484         * testsuite/final_layout.sh: Use dc to convert from hex to
6485         decimal.
6486
6487 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6488
6489         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6490         paramter to the call to gold::gc_process_relocs.
6491         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6492         paramter to the call to gold::gc_process_relocs.
6493         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6494         parameter to the call to gold::gc_process_relocs.
6495         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6496         template parameter to the call to gold::gc_process_relocs.
6497         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6498         paramter to the call to gold::gc_process_relocs.
6499         * gc.h (get_embedded_addend_size): New function.
6500         (gc_process_relocs): Save the size of the reloc for use by ICF.
6501         * icf.cc (get_section_contents): Get the addend from the text section
6502         for SHT_REL relocation sections.
6503         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6504         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6505         * int_encoding.h (read_from_pointer): New overloaded function.
6506         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6507         * testsuite/icf_sht_rel_addend_test.sh: New file.
6508         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6509         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6510
6511 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6512
6513         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6514         * Makefile.in: Regenerate.
6515         * testsuite/Makefile.in: Regenerate.
6516
6517 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6518
6519         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6520         * gold/testsuite/debug_msg.cc: Likewise.
6521         * gold/testsuite/odr_violation1.cc
6522         * gold/testsuite/odr_violation2.cc
6523
6524 2010-07-21  Cary Coutant  <ccoutant@google.com>
6525
6526         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6527         string, and length fields.
6528         (Output_merge_string::Merged_strings_list): New type.
6529         (Output_merge_string::Merged_strings_lists): New typedef.
6530         (Output_merge_string): Replace merged_strings_ with
6531         merged_strings_lists_.
6532         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6533         Merged_strings_list per input object and section.  Don't store pointer
6534         to the string.  Don't store length with each merged string entry.
6535         (Output_merge_string::finalize_merged_data): Loop over list of merged
6536         strings lists.  Recompute length of each merged string.
6537
6538 2010-07-15  Cary Coutant  <ccoutant@google.com>
6539
6540         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6541         here.
6542
6543 2010-07-14  Ian Lance Taylor  <iant@google.com>
6544
6545         * descriptors.cc (Descriptors::open): Report correct name in error
6546         message.
6547
6548 2010-07-13  Doug Kwan  <dougkwan@google.com>
6549
6550         * arm.cc (Arm_input_section::Arm_input_section): For a
6551         SHT_ARM_EXIDX section, always keeps the input sections.
6552         (Arm_input_section::set_exidx_section_link): New method.
6553         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6554         has_errors_ to false.
6555         (Arm_exidx_input_section::has_errors,
6556         Arm_exidx_input_section::set_has_errors): New methods.
6557         (Arm_exidx_input_section::has_errors_): New data member.
6558         (Arm_relobj::get_exidx_shndx_list): New method.
6559         (Arm_output_section::append_text_sections_to_list): Do not skip
6560         section without SHF_EXECINSTR.
6561         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6562         errors.
6563         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6564         section header.  Make error messages more verbose.  Check for
6565         a non-executable section linked to an EXIDX section.
6566         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6567         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6568         check that there is no deferred EXIDX section if we exit early.
6569         Instead of not making an EXIDX section in case of an error, make one
6570         and set the has_errors flag of it.
6571         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6572         in a relocatable link.
6573         (Target_arm::do_relax): Look for the EXIDX output section instead of
6574         assuming that it is called .ARM.exidx.
6575         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6576         section list.  Do not check for SHF_EXECINSTR section flags but
6577         skip any input section with errors.
6578         * output.cc (Output_section::Output_section): Initialize
6579         always_keeps_input_sections_ to false.
6580         (Output_section::add_input_section): Check for
6581         always_keeps_input_sections_.
6582         *  output.h (Output_section::always_keeps_input_sections,
6583         Output_section::set_always_keeps_input_sections): New methods.
6584         (Output_section::always_keeps_input_sections): New data member.
6585
6586 2010-07-13  Rafael Espindola  <espindola@google.com>
6587
6588         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6589         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6590
6591 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6592             Ian Lance Taylor  <iant@google.com>
6593
6594         * output.h (Output_section_lookup_maps::add_merge_section):
6595         Correct check of whether value was inserted.
6596         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6597         (Output_section_lookup_maps::add_relaxed_input_section):
6598         Likewise.
6599         * arm.cc (Target_arm::got_section): Remove used local os.
6600         * i386.cc (Target_i386::got_section): Likewise.
6601         * x86_64.cc (Target_x86_64::got_section): Likewise.
6602         * sparc.cc (Target_sparc::got_section): Likewise.
6603         (Target_sparc::relocate): Remove unused local have_got_offset.
6604         * powerpc.cc (Target_powerpc::relocate): Likewise.
6605
6606 2010-07-13  Ian Lance Taylor  <iant@google.com>
6607
6608         * compressed_output.cc (zlib_decompress): Fix signature in
6609         !HAVE_ZLIB_H case.
6610
6611         * archive.cc (Archive::include_member): Unlock an external member
6612         of a thin archive.  Don't bother to delete an object we know is
6613         NULL.
6614
6615 2010-07-12  Cary Coutant  <ccoutant@google.com>
6616
6617         * compressed_output.cc (zlib_decompress): New function.
6618         (get_uncompressed_size): New function.
6619         (decompress_input_section): New function.
6620         * compressed_output.h (get_uncompressed_size): New function.
6621         (decompress_input_section): New function.
6622         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6623         Handle compressed debug sections.
6624         * layout.cc (is_compressed_debug_section): New function.
6625         (Layout::output_section_name): Map compressed section names to
6626         canonical names.
6627         * layout.h (is_compressed_debug_section): New function.
6628         (is_debug_info_section): Recognize compressed debug sections.
6629         * merge.cc: Include compressed_output.h.
6630         (Output_merge_data::do_add_input_section): Handle compressed
6631         debug sections.
6632         (Output_merge_string::do_add_input_section): Handle compressed
6633         debug sections.
6634         * object.cc: Include compressed_output.h.
6635         (Sized_relobj::Sized_relobj): Initialize new data members.
6636         (build_compressed_section_map): New function.
6637         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6638         * object.h (Object::section_is_compressed): New method.
6639         (Object::do_section_is_compressed): New method.
6640         (Sized_relobj::Compressed_section_map): New type.
6641         (Sized_relobj::do_section_is_compressed): New method.
6642         (Sized_relobj::compressed_sections_): New data member.
6643         * output.cc (Output_section::add_input_section): Handle compressed
6644         debug sections.
6645         * reloc.cc: Include compressed_output.h.
6646         (Sized_relobj::write_sections): Handle compressed debug sections.
6647
6648 2010-07-08  Cary Coutant  <ccoutant@google.com>
6649
6650         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6651         weak when resolving to a dynamic def.
6652         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6653         for weak undef/dynamic def cases. Adjust callers.
6654         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6655         undef_binding_weak_.
6656         (Symbol_table::sized_write_globals): Adjust symbol binding.
6657         (Symbol_table::sized_write_symbol): Add binding parameter.
6658         * symtab.h (Symbol::set_undef_binding): New method.
6659         (Symbol::is_undef_binding_weak): New method.
6660         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6661         (Symbol_table::should_override): Add new parameter.
6662         (Symbol_table::sized_write_symbol): Add new parameter.
6663
6664         * testsuite/weak_undef_file1.cc: Add new test case.
6665         * testsuite/weak_undef_file2.cc: Fix header comment.
6666         * testsuite/weak_undef_test.cc: Add new test case.
6667
6668 2010-06-29  Doug Kwan  <dougkwan@google.com>
6669
6670         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6671         Initialize USE_SYMBOL_.
6672         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6673         definition.
6674         (Arm_reloc_property::uses_symbol_): New data member declaration.
6675         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6676         uses symbol value and symbol is undefined but not weakly undefined.
6677
6678 2010-06-28  Rafael Espindola  <espindola@google.com>
6679
6680         * plugin.cc (Plugin::load): Use dlerror.
6681
6682 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6683
6684         * symtab.cc (detect_odr_violations): When reporting an ODR
6685         violation, report an object where the symbol is defined.
6686
6687 2010-06-25  Doug Kwan  <dougkwan@google.com>
6688
6689         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6690         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6691         definition.
6692         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6693         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6694         target hook to detect function points.
6695         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6696         * icf.h (Icf::check_section_for_function_pointers): Change type of
6697         parameter SECTION_NAME to const reference to std::string.  Use
6698         target hook to determine if section may have unsafe pointers.
6699         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6700         method definition.
6701
6702 2010-06-21  Rafael Espindola  <espindola@google.com>
6703
6704         * fileread.cc (Input_file::find_fie): New
6705         (Input_file::open): Use Input_file::find_fie.
6706         * fileread.h (Input_file::find_fie): New
6707         * plugin.cc (set_extra_library_path): New.
6708         (Plugin::load): Add set_extra_library_path to the transfer vector.
6709         (Plugin_manager::set_extra_library_path): New.
6710         (Plugin_manager::add_input_file): Use the extra search path if set.
6711         (set_extra_library_path(): New.
6712         * plugin.h (Plugin_manager): Add set_extra_library_path and
6713         extra_search_path_.
6714
6715 2010-06-19  Cary Coutant  <ccoutant@google.com>
6716
6717         * layout.cc (gdb_sections): Add .debug_types.
6718         (lines_only_debug_sections): Likewise.
6719
6720 2010-06-18  Rafael Espindola  <espindola@google.com>
6721
6722         * plugin.cc (add_input_file,add_input_library)
6723         (Plugin_manager::add_input_file): Make filename arguments const.
6724         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6725         const.
6726
6727 2010-06-16  Doug Kwan  <dougkwan@google.com>
6728
6729         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6730         .ARM.attributes section if we have not merged any input
6731         attributes sections.
6732
6733 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6734
6735         * arm.cc: Allow combining objects with no EABI version
6736         information.
6737
6738 2010-06-15  Rafael Espindola  <espindola@google.com>
6739
6740         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6741
6742 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6743
6744         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6745         (struct iovec): Correct !HAVE_READV definition.
6746
6747 2010-06-10  Cary Coutant  <ccoutant@google.com>
6748
6749         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6750         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6751         reloc sections.
6752         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6753
6754         PR 11683
6755         * symtab.h (Symbol::is_placeholder): New member function.
6756         * target-reloc.h (relocate_section): Check for placeholder symbols.
6757
6758         * testsuite/Makefile.am (plugin_test_8): New test.
6759         (plugin_test_9): New test.
6760         * testsuite/Makefile.in: Regenerate.
6761
6762 2010-06-09  Nick Clifton  <nickc@redhat.com>
6763
6764         * yyscript.y (input_list_element): Allow strings prefixed with
6765         the '-' character.  Treat these as libraries.
6766         * script.cc (script_add_library): New function.  Adds a library
6767         specified by "-l<name>" found in an input script.
6768         * script-c.h: Add prototype for script_add_library.
6769
6770 2010-06-07  Doug Kwan  <dougkwan@google.com>
6771
6772         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6773         Restrict stub-group size to be within long conditional branch
6774         range when working around cortex-A8 erratum.
6775
6776 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6777
6778         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6779         #ifdef typo.
6780
6781 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6782
6783         PR gold/11658
6784         * output.cc
6785         (Output_section::Input_section_sort_entry::compare_section_ordering):
6786         Change to return non-zero correctly.
6787         (Output_section::Input_section_sort_section_order_index_compare
6788         ::operator()): Change to fix ambiguity in comparisons.
6789
6790 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6791
6792         * gold.h (is_wildcard_string): New function.
6793         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6794         (Layout::layout_eh_frame): Ditto.
6795         (Layout::find_section_order_index): New method.
6796         (Layout::read_layout_from_file): New method.
6797         * layout.h (Layout::find_section_order_index): New method.
6798         (Layout::read_layout_from_file): New method.
6799         (Layout::input_section_position_): New private member.
6800         (Layout::input_section_glob_): New private member.
6801         * main.cc (main): Call read_layout_from_file here.
6802         * options.h (--section-ordering-file): New option.
6803         * output.cc (Output_section::input_section_order_specified_): New
6804         member.
6805         (Output_section::Output_section): Initialize new member.
6806         (Output_section::add_input_section): Add new parameter.
6807         Keep input sections when --section-ordering-file is used.
6808         (Output_section::set_final_data_size): Sort input sections when
6809         section ordering file is specified.
6810         (Output_section::Input_section_sort_entry): Add new parameter.
6811         Check sorting type.
6812         (Output_section::Input_section_sort_entry::compare_section_ordering):
6813         New method.
6814         (Output_section::Input_section_sort_compare::operator()): Change to
6815         consider section_order_index.
6816         (Output_section::Input_section_sort_init_fini_compare::operator()):
6817         Change to consider section_order_index.
6818         (Output_section::Input_section_sort_section_order_index_compare
6819         ::operator()): New method.
6820         (Output_section::sort_attached_input_sections): Change to sort
6821         according to section order when specified.
6822         (Output_section::add_input_section<32, true>): Add new parameter.
6823         (Output_section::add_input_section<64, true>): Add new parameter.
6824         (Output_section::add_input_section<32, false>): Add new parameter.
6825         (Output_section::add_input_section<64, false>): Add new parameter.
6826         * output.h (Output_section::add_input_section): Add new parameter.
6827         (Output_section::input_section_order_specified): New
6828         method.
6829         (Output_section::set_input_section_order_specified): New method.
6830         (Input_section::Input_section): Initialize section_order_index_.
6831         (Input_section::section_order_index): New method.
6832         (Input_section::set_section_order_index): New method.
6833         (Input_section::section_order_index_): New member.
6834         (Input_section::Input_section_sort_section_order_index_compare): New
6835         struct.
6836         (Output_section::input_section_order_specified_): New member.
6837         * script-sections.cc (is_wildcard_string): Delete and move modified
6838         method to gold.h.
6839         (Output_section_element_input::Output_section_element_input): Modify
6840         call to is_wildcard_string.
6841         (Output_section_element_input::Input_section_pattern
6842         ::Input_section_pattern): Ditto.
6843         (Output_section_element_input::Output_section_element_input): Ditto.
6844         * testsuite/Makefile.am (final_layout): New test case.
6845         * testsuite/Makefile.in: Regenerate.
6846         * testsuite/final_layout.cc: New file.
6847         * testsuite/final_layout.sh: New file.
6848
6849 2010-06-01  Rafael Espindola  <espindola@google.com>
6850
6851         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6852
6853 2010-06-01  Rafael Espindola  <espindola@google.com>
6854
6855         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6856         visibility of symbols.
6857
6858 2010-05-27  Doug Kwan  <dougkwan@google.com>
6859
6860         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6861         from start of output section instead of address for a local symbol
6862         in a merged or relaxed section when doing a relocatable link.
6863
6864 2010-05-26  Rafael Espindola  <espindola@google.com>
6865
6866         PR 11604
6867         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6868         adding sections the garbage collector removed.
6869         * gold/testsuite/Makefile.am: Add test.
6870         * gold/testsuite/Makefile.in: Regenerate.
6871         * gold/testsuite/plugin_test_7.sh: New.
6872         * gold/testsuite/plugin_test_7_1.c: New.
6873         * gold/testsuite/plugin_test_7_2.c: New.
6874
6875 2010-05-26  Rafael Espindola  <espindola@google.com>
6876
6877         * script-sections.cc (Output_section_definition::set_section_addresses):
6878         Check for --section-start.
6879
6880 2010-05-26  Doug Kwan  <dougkwan@google.com>
6881
6882         * arm.cc (Arm_scan_relocatable_relocs): New class.
6883         (Target_arm::relocate_special_relocatable): New method.
6884         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6885         (Arm_relocate_functions::thumb_branch_common): Same.
6886         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6887         instead of Default_scan_relocatable_relocs.
6888         * target-reloc.h (relocate_for_relocatable): Let target handle
6889         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6890         * target.h (Sized_target::relocate_special_relocatable): New method.
6891
6892 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6893
6894         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6895
6896 2010-05-23  Doug Kwan  <dougkwan@google.com>
6897
6898         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6899         instead of a cast.
6900         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6901         with a direct branch, not a conditional branch, to a stub.
6902         * merge.cc (Output_merge_base::record_input_section): New method
6903         defintion.
6904         (Output_merge_data::do_add_input_section): Record input section if
6905         keeps-input-sections flag is set.
6906         (Output_merge_string::do_add_input_section): Ditto.
6907         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6908         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6909         INPUT_SECTIONS_.
6910         (Output_merge_base::keeps_input_sections,
6911         Output_merge_base::set_keeps_input_sections,
6912         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6913         method definitions.
6914         (Output_merge_base::Input_sections): New type declaration.
6915         (Output_merge_base::input_sections_begin,
6916         Output_merge_base::input_sections_end,
6917         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6918         (Output_merge_base::bool keeps_input_sections_,
6919         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6920         Output_merge_base::input_sections_): New data members.
6921         (Output_merge_data::do_set_keeps_input_sections): New method
6922         defintion.
6923         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6924         * output.cc (Output_section::Input_section::relobj): Move method
6925         defintion from class declaration to here and handle merge sections.
6926         (Output_section::Input_section::shndx): Ditto.
6927         (Output_section::Output_section): Remove initializations of removed
6928         data members and initialize new data member LOOKUP_MAPS_.
6929         (Output_section::add_input_section): Set keeps-input-sections flag
6930         for a newly created merge output section as appropriate.  Adjust code
6931         to use Output_section_lookup_maps class.
6932         (Output_section::add_relaxed_input_section): Adjst code for lookup
6933         maps code refactoring.
6934         (Output_section::add_merge_input_section): Add a new parameter
6935         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6936         class.  If adding input section to a newly created merge output
6937         section fails, remove the new merge section.
6938         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6939         Adjust code for use of the Output_section_lookup_maps class.
6940         (Output_section::find_merge_section): Ditto.
6941         (Output_section::build_lookup_maps): New method defintion.
6942         (Output_section::find_relaxed_input_section): Adjust code to use
6943         Output_section_lookup_maps class.
6944         (Output_section::get_input_sections): Export merge sections.  Adjust
6945         code to use Output_section_lookup_maps class.
6946         (Output_section:::add_script_input_section): Adjust code to use
6947         Output_section_lookup_maps class.  Update lookup maps for merge
6948         sections also.
6949         (Output_section::discard_states): Use Output_section_lookup_maps.
6950         (Output_section::restore_states): Same.
6951         * output.h (Merge_section_properties): Move class defintion out of
6952         Output_section.
6953         (Output_section_lookup_maps): New class.
6954         (Output_section::Input_section::is_merge_section): New method
6955         defintion.
6956         (Output_section::Input_section::relobj): Move defintion out of class
6957         defintion.  Declare method only.
6958         (Output_section::Input_section::shndx): Ditto.
6959         (Output_section::Input_section::output_merge_base): New method defintion.
6960         (Output_section::Input_section::u2_.pomb): New union field.
6961         (Output_section::Merge_section_by_properties_map,
6962         Output_section::Output_section_data_by_input_section_map,
6963         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6964         Remove types.
6965         (Output_section::add_merge_input_section): Add new parameter
6966         KEEPS_INPUT_SECTIONS.
6967         (Output_section::build_lookup_maps): New method declaration.
6968         (Output_section::merge_section_map_,
6969         Output_section::merge_section_by_properties_map_,
6970         Output_section::relaxed_input_section_map_,
6971         Output_section::is_relaxed_input_section_map_valid_): Remove data
6972         members.
6973         (Output_section::lookup_maps_): New data member.
6974
6975 2010-05-21  Doug Kwan  <dougkwan@google.com>
6976
6977         PR gold/11619
6978         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6979         avoid a compilation error.
6980
6981 2010-05-19  Rafael Espindola  <espindola@google.com>
6982
6983         * script-sections.cc (Output_section_definition::allocate_to_segment):
6984         Update the phdrs_list even when the output section is NULL.
6985         * testsuite/Makefile.am: Add test.
6986         * testsuite/Makefile.in: Regenerate.
6987         * testsuite/script_test_9.cc: New.
6988         * testsuite/script_test_9.sh: New.
6989         * testsuite/script_test_9.t: New.
6990
6991 2010-05-19  Doug Kwan  <dougkwan@google.com>
6992
6993         * arm.cc (Arm_input_section::original_size): New method.
6994         (Arm_input_section::do_addralign): Add a cast.
6995         (Arm_input_section::do_output_offset): Remove static cast.
6996         (Arm_input_section::original_addralign,
6997          Arm_input_section::original_size_): Change type to uint32_t.
6998         (Arm_input_section::init): Add safe casts for section alignment
6999         and size.
7000         (Arm_input_section::set_final_data_size): Do not set address and
7001         offset of stub table.
7002         (Arm_output_section::fix_exidx_coverage): Change use of of
7003         Output_section::Simple_input_section to that of
7004         Output_section::Input_section.
7005         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7006         except for the first pass.
7007         * output.cc (Output_section::get_input_sections): Change type of
7008         input_sections to std::list<Input_section>.
7009         (Output_section::add_script_input_section): Rename from
7010         Output_section::add_simple_input_section.  Change type of SIS
7011         parameter from Simple_input_section to Input_section.
7012         * output.h (Output_section::Simple_input_section): Remove class.
7013         (Output_section::Input_section): Change class visibility to public.
7014         (Output_section::Input_section::addralign): Use stored alignments
7015         for special input sections if set.
7016         (Output_section::Input_section::set_addralign): New method.
7017         (Output_section::get_input_sections): Change parameter type from
7018         list of Simple_input_section to list of Input_section.
7019         (Output_section::add_script_input_section): Rename from
7020         Output_section::add_simple_input_section. Change first parameter's
7021         type from Simple_input_section to Input_section and remove the
7022         second and third parameters.
7023         * script-sections.cc (Input_section::Input_section_list): Change
7024         type to list of Output_section::Input_section/
7025         (Input_section_info::Input_section_info): Change parameter type of
7026         INPUT_SECTION to Output_section::Input_section.
7027         (Input_section_info::input_section): Change return type.
7028         (Input_section_info::input_section_): Change type to
7029         Output_section::Input_section.
7030         (Output_section_element_input::set_section_addresses): Adjust code
7031         to use Output_section::Input_section instead of
7032         Output_section::Simple_input_section.  Adjust code for renaming
7033         of Output_section::add_simple_input_section.
7034         (Orphan_output_section::set_section_addresses): Ditto.
7035
7036 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7037
7038         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7039         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7040
7041 2010-05-18  Rafael Espindola  <espindola@google.com>
7042
7043         * options.cc (General_options::finalize): Handle -nostdlib.
7044         * options.h (nostdlib): New option.
7045         * script.cc (script_add_search_dir): Handle -nostdlib.
7046
7047 2010-05-12  Doug Kwan  <dougkwan@google.com>
7048
7049         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7050         attributes section only if there no attributes section after merging.
7051         (Target_arm::merge_object_attributes): Move value of
7052         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7053         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7054         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7055         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7056         and arm_attr_merge_7.stdout.
7057         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7058         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7059         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7060         arm_attr_merge_7b.o): New rules.
7061         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7062         arm_attr_merge_7
7063         * testsuite/Makefile.in: Regenerate.
7064         * testsuite/arm_attr_merge.sh: New file.
7065         * testsuite/arm_attr_merge_[67][ab].s: Same.
7066
7067 2010-05-05  Nick Clifton  <nickc@redhat.com>
7068
7069         * po/es.po: Updated Spanish translation.
7070
7071 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7072
7073         * Makefile.am (install-exec-local): Properly install gold as
7074         default cross linker.
7075         * Makefile.in: Regenerated.
7076
7077 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7078             Nick Clifton  <nickc@redhat.com>
7079
7080         * configure.ac (install_as_default): Define and set to false
7081         unless --enable-gold or --enable-gold=both/gold has been
7082         specified.
7083         * configure: Regenerate.
7084
7085         * Makefile.am (install-exec-local): Install the executable as
7086         'ld.gold'.  If install_as_default is true then also install it as
7087         'ld'.
7088         * Makefile.in: Regenerated.
7089
7090 2010-04-24  Ian Lance Taylor  <iant@google.com>
7091
7092         * layout.cc (Layout::layout_reloc): In relocatable link don't
7093         combine reloc sections for grouped sections.
7094
7095 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7096
7097         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7098         sections that are not ordinary to icf.
7099         * icf.cc (get_section_contents): Handle relocation pointing to section
7100         with no object or shndx information.
7101         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7102         * testsuite/Makefile.in: Regenerate.
7103         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7104         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7105
7106 2010-04-22  Ian Lance Taylor  <iant@google.com>
7107
7108         * expression.cc (Expression::Expression_eval_info): Add
7109         result_alignment_pointer field.
7110         (Expression::eval_with_dot): Add result_alignment_pointer
7111         parameter.  Change all callers.
7112         (Expression::eval_maybe_dot): Likewise.
7113         (class Binary_expression): Add alignment_pointer parameter to
7114         left_value and right_value.  Change all callers.
7115         (BINARY_EXPRESSION): Set result alignment.
7116         (class Trinary_expression): Add alignment_pointer parameter to
7117         arg2_value and arg3_value.  Change all callers.
7118         (Trinary_cond::value): Set result alignment.
7119         (Max_expression::value, Min_expression::value): Likewise.
7120         (Align_expression::value): Likewise.
7121         * script-sections.cc (class Sections_element): Add dot_alignment
7122         parameter to set_section_addresses virtual function.  Update
7123         instantiations.
7124         (class Output_section_element): Likewise.
7125         (Script_sections::create_segments): Add dot_alignment parameter.
7126         Change all callers.
7127         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7128         (Script_sections::set_phdrs_clause_addresses): Likewise.
7129         * script-sections.h: Update declarations.
7130         * script.h: Update declarations.
7131         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7132         min_p_align.
7133         * testsuite/script_test_3.t: Set large alignment.
7134         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7135         segment has expected alignment.
7136
7137 2010-04-22  Nick Clifton  <nickc@redhat.com>
7138
7139         * po/gold.pot: Updated by the Translation project.
7140         * po/vi.po: Updated Vietnamese translation.
7141
7142 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7143
7144         * testsuite/Makefile.am (check_PROGRAMS): Add
7145         icf_virtual_function_folding_test.
7146         * testsuite/Makefile.in: Regenerated.
7147
7148 2010-04-15  Andrew Haley  <aph@redhat.com>
7149
7150         * options.h (merge_exidx_entries): New option.
7151         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7152         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7153         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7154         (Target_arm::merge_exidx_entries): New function.
7155         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7156         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7157         to Arm_exidx_fixup constructor.
7158         Add new arg, merge_exidx_entries.
7159         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7160         Arm_output_section::fix_exidx_coverage.
7161
7162 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7163
7164         * icf.cc (get_section_contents): Check for preemptible functions.
7165         Ignore addend when appropriate.
7166         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7167         section folded.
7168         (add_from_relobj): Check for section folded.
7169         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7170         * symtab.h (should_add_dynsym_entry): Add new parameter.
7171         * target-reloc.h (scan_relocs): Check for section folded.
7172         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7173         Check reloc types for function pointers in shared objects.
7174         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7175         case.
7176         (icf_preemptible_functions_test): New test case.
7177         (icf_string_merge_test): New test case.
7178         * testsuite.Makefile.in: Regenerate.
7179         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7180         bar_glob.  Refactor code.
7181         * testsuite/icf_preemptible_functions_test.cc: New file.
7182         * testsuite/icf_preemptible_functions_test.sh: New file.
7183         * testsuite/icf_string_merge_test.cc: New file.
7184         * testsuite/icf_string_merge_test.sh: New file.
7185         * testsuite/icf_virtual_function_folding_test.cc: New file.
7186         * testsuite/icf_virtual_function_folding_test.sh: New file.
7187
7188 2010-04-14  Doug Kwan  <dougkwan@google.com>
7189
7190         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7191         for local symbol recounting if we remove a section due to ICF.
7192         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7193         there are no regular objects in input.
7194
7195 2010-04-13  Doug Kwan  <dougkwan@google.com>
7196
7197         * arm.cc (Arm_input_section::set_final_data_size): Compute
7198         accurate final data size instead of using current data size.
7199
7200 2010-04-09  Doug Kwan  <dougkwan@google.com>
7201
7202         * layout.cc (Layout::choose_output_section): Handle script section
7203         types.
7204         (Layout::make_output_section_for_script): Add section type parameter.
7205         Handle script section types.
7206         * layout.h (Layout::make_output_section_for_script): Add section
7207         type parameter.
7208         * output.cc (Output_section::Output_section): Initialize data member
7209         is_noload_.
7210         (Output_section::do_reset_address_and_file_offset): Do not set address
7211         to 0 if section is a NOLOAD section.
7212         * output.h (Output_section::is_noload): New method.
7213         (Output_section::set_is_noload): Ditto.
7214         (Output_section::is_noload_): New data member.
7215         * script-c.h (Script_section_type): New enum type.
7216         (struct Parser_output_section_header): Add new file section_type.
7217         * script-sections.cc (Sections_element::output_section_name): Add
7218         parameter for returning script section type.
7219         (Output_section_definition::output_section_name): Ditto.
7220         (Output_section_definition::section_type)P; New method.
7221         (Output_section_definiton::script_section_type_name): Ditto.
7222         (Output_section_definition::script_section_type_): New data member.
7223         (Output_section_definition::Output_section_definition): Initialize
7224         data member Output_section_definition::script_section_type_.
7225         (Output_section_definition::create_sections): Pass script section type
7226         to Layout::make_output_section_for_script.
7227         (Output_section_definition::output_section_name): Return script
7228         section type to caller.
7229         (Output_section_definition::set_section_address): Do not advance
7230         dot value and load address if section type is NOLOAD.  Set address
7231         of NOLOAD sections regardless of section flags.
7232         (Output_section_definition::print): Print section type if it is
7233         not SCRIPT_SECTION_TYPE_NONE.
7234         (Output_section_definition::section_type): New method.
7235         (Output_section_definition::script_section_type_name): Ditto.
7236         (Script_sections::output_section_name): Add new parameter
7237         PSECTION_TYPE for returning script section type.  Pass it to
7238         section elements.  Handle discard sections.
7239         (Sort_output_sections::operator()): Handle NOLOAD sections.
7240         * script-sections.h (Script_sections::Section_type): New enum type.
7241         (Script_sections::output_section_name): Add a new parameter for
7242         returning script section type.
7243         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7244         INFO and NOLOAD.
7245         * yyscript.y (union): Add new field SECTION_TYPE.
7246         (COPY, DSECT, INFO, NOLOAD): New tokens.
7247         (opt_address_and_section_type): Change type to output_section_header.
7248         (section_type): New non-terminal
7249         (section_header): Handle section type.
7250         (opt_address_and_section_type): Return section type value.
7251
7252 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7253
7254         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7255         * testsuite/plugin_common_test_2.c (foo): Likewise.
7256
7257 2010-04-08  Doug Kwan  <dougkwan@google.com>
7258
7259         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7260         Output_merge_data.
7261         * output.cc (Output_section::add_merge_input_section): Simplify
7262         code and return status of Output_merge_base::add_input_section.
7263         Update merge section map only if Output_merge_base::add_input_section
7264         returns true.
7265
7266 2010-04-07  Doug Kwan  <dougkwan@google.com>
7267
7268         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7269         if section is marked as containing instructions but has no mapping
7270         symbols.
7271         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7272         correct section index.
7273         (Arm_relobj::find_linked_text_section): Ditto.
7274
7275 2010-04-07  Cary Coutant  <ccoutant@google.com>
7276
7277         * archive.cc (include_member): Destroy Read_symbols_data object before
7278         releasing file.
7279         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7280         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7281         (Read_symbols_data::~Read_symbols_data) New destructor.
7282         (Section_relocs::Section_relocs) New constructor.
7283         (Section_relocs::~Section_relocs) New destructor.
7284         (Read_relocs_data::Read_relocs_data) New constructor.
7285         (Read_relocs_data::~Read_relocs_data) New destructor.
7286         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7287         pointers to NULL after deleting.
7288
7289 2010-04-07  Doug Kwan  <dougkwan@google.com>
7290
7291         * arm.cc: Replace "endianity" with "endianness" in comments.
7292         (Arm_exidx_cantunwind): Ditto.
7293         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7294         (Arm_relobj::merge_flags_and_attributes): New method.
7295         (Arm_relobj::merge_flags_and_attributes_): New data member.
7296         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7297         (Arm_relobj::scan_sections_for_stubs): Ditto.
7298         (Arm_relobj::do_read_symbols): Check to see if we really want to
7299         merge processor-specific flags and attributes.  Exit early if
7300         an object is empty except for section names and the undefined symbol.
7301         (Target_arm::do_finalize_sections): Move check for ELF format to
7302         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7303         attributes from a regular object only when we have determined that
7304         it is aapropriate.  Do not create an .ARM.attributes section in
7305         output if there is no regular input object.
7306         (Target_arm::merge_processor_specific_flags): Check
7307         --warn-mismatch before printing any error.
7308         (Target_arm::merge_object_attributes): Ditto.
7309         * gold.cc (queue_middle_tasks): Handle the case in which there is
7310         no regular object in input.
7311         * options.cc (General_options::parse_EB): New method.
7312         (General_options::parse_EL): Same.
7313         (General_options::General_options): Initialize endianness_.
7314         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7315         New options.
7316         (General_options::Endianness): New enum.
7317         (General_options::endianness): New method.
7318         (General_options::endianness_): New data member.
7319         * parameters.cc (Parameters::set_options): Check target endianness.
7320         (Parameters::set_target_once): Ditto.
7321         (Parameters::check_target_endianness): New method.
7322         (parameters_force_valid_target): If either -EL or -EB is specified,
7323         use it to define endianness of default target.
7324         * parameters.h (Parameters::check_target_endianness): New method
7325         declaration.
7326         * target.h (class Target): Change "endianity" to "endianness"
7327         in comments.
7328
7329 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7330
7331         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7332         * configure: Regenerate.
7333         * Makefile.in: Regenerate.
7334         * testsuite/Makefile.in: Regenerate.
7335
7336 2010-04-06  Cary Coutant  <ccoutant@google.com>
7337
7338         gcc PR lto/42757
7339         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7340         prevailing definitions of common symbols.
7341         * testsuite/plugin_test_6.sh: New test case.
7342         * testsuite/plugin_common_test_1.c: New test case.
7343         * testsuite/plugin_common_test_2.c: New test case.
7344         * testsuite/Makefile.am (plugin_test_6): New test case.
7345         * testsuite/Makefile.in: Regenerate.
7346
7347 2010-04-06  Nick Clifton  <nickc@redhat.com>
7348
7349         * po/vi.po: New Vietnamese translation.
7350
7351 2010-03-30  Doug Kwan  <dougkwan@google.com>
7352
7353         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7354
7355 2010-03-25  Doug Kwan  <dougkwan@google.com>
7356
7357         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7358         to avoid a conversion warning on a 32-bit host.
7359
7360 2010-03-24  Ian Lance Taylor  <iant@google.com>
7361
7362         * testsuite/script_test_3.t: Add a TLS segment.
7363         * testsuite/Makefile.am (check_PROGRAMS): Add
7364         tls_phdrs_script_test.
7365         (tls_phdrs_script_test_SOURCES): Define.
7366         (tls_phdrs_script_test_DEPENDENCIES): Define.
7367         (tls_phdrs_script_test_LDFLAGS): Define.
7368         (tls_phdrs_script_test_LDADD): Define.
7369         * testsuite/Makefile.in: Rebuild.
7370
7371 2010-03-23  Cary Coutant  <ccoutant@google.com>
7372
7373         * fileread.cc (find_or_make_view): Fix comment.
7374
7375 2010-03-23  Ian Lance Taylor  <iant@google.com>
7376
7377         * script-sections.cc (class Orphan_section_placement): Define
7378         PLACE_TLS and PLACE_TLS_BSS.
7379         (Orphan_section_placement::Orphan_section_placement): Initialize
7380         new places.
7381         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7382         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7383         (tls_script_test_SOURCES): Define.
7384         (tls_script_test_DEPENDENCIES): Define.
7385         (tls_script_test_LDFLAGS): Define.
7386         (tls_script_test_LDADD): Define.
7387         * testsuite/Makefile.in: Rebuild.
7388
7389 2010-03-22  Doug Kwan  <dougkwan@google.com>
7390
7391         * arm.cc (Arm_relocate_functions::abs8,
7392         Arm_relocate_functions::abs16): Use correct check for overflow
7393         specified in the ARM ELF specs.
7394         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7395         target of a BLX instruction specially.
7396         (Reloc_stub::stub_type_for_reloc): Ditto.
7397         (Relocate::relocate): Use symbolic names instead of numeric relocation
7398         codes to report error.
7399         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7400         workaround.
7401         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7402         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7403         thumb2_blx_out_of_range.stdout
7404         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7405         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7406         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7407         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7408         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7409         thumb2_blx_in_range, thumb2_blx_in_range.o,
7410         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7411         thumb2_blx_out_of_range.o): New rules.
7412         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7413         thumb2_blx_in_range and thumb2_blx_out_of_range.
7414         * testsuite/Makefile.in: Regenerate.
7415         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7416         * testsuite/thumb_blx_in_range.s: New file.
7417         * testsuite/thumb_blx_out_of_range.s: New file.
7418
7419 2010-03-22  Rafael Espindola  <espindola@google.com>
7420
7421         * archive.cc (Should_include): Move to archive.h.
7422         (should_include_member): Make it a member of Archive.
7423         (Lib_group): New.
7424         (Add_lib_group_symbols): New.
7425         * archive.h: Include options.h.
7426         (Archive_member): Moved from Archive.
7427         (Should_include): Moved from archive.cc.
7428         (Lib_group): New.
7429         (Add_lib_group_symbols): New.
7430         * dynobj.cc (do_should_include_member): New.
7431         * dynobj.h (do_should_include_member): New.
7432         * gold.cc (queue_initial_tasks): Update call to queue.
7433         * main.cc (main): Print lib group stats.
7434         * object.cc (do_should_include_member): New.
7435         * object.h: Include archive.h.
7436         (Object::should_include_member): New.
7437         (Object::do_should_include_member): New.
7438         (Sized_relobj::do_should_include_member): New.
7439         * options.cc (General_options::parse_start_lib): New.
7440         (General_options::parse_end_lib): New.
7441         (Input_arguments::add_file): Handle lib groups.
7442         (Input_arguments::start_group): Check we are not in a lib.
7443         (Input_arguments::start_lib): New.
7444         (Input_arguments::end_lib): New.
7445         * options.h (General_options): Add start_lib and end_lib.
7446         (Input_argument::lib_): New.
7447         (Input_argument::lib): New.
7448         (Input_argument::is_lib): New.
7449         (Input_file_lib): New.
7450         (Input_arguments::in_lib_): New.
7451         (Input_arguments::in_lib): New.
7452         (Input_arguments::start_lib): New.
7453         (Input_arguments::end_lib_): New.
7454         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7455         in unused members as preempted.
7456         (Sized_pluginobj::do_should_include_member): New.
7457         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7458         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7459         return the blocker.
7460         (Read_symbols::do_whole_lib_group): New.
7461         (Read_symbols::do_lib_group): New.
7462         (Read_symbols::do_read_symbols): Handle lib groups.
7463         (Read_symbols::get_name): Handle lib groups.
7464         * readsyms.h (Read_symbols): Add an archive member pointer.
7465         (Read_symbols::do_whole_lib_group): New.
7466         (Read_symbols::do_lib_group): New.
7467         (Read_symbols::member_): New.
7468         * script.cc (read_input_script): Update call to queue_soon.
7469
7470 2010-03-19  Doug Kwan  <dougkwan@google.com>
7471
7472         * arm.cc (Stub_table::Stub_table): Initialize new data members
7473         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7474         (Stub_table::add_reloc_stub): Assign stub offset and update
7475         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7476         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7477         New data members.
7478         (Stub_table::update_data_size_and_addralign): Use
7479         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7480         instead of going over all reloc stubs.
7481         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7482         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7483         Stringpool_template::offset_ to size of Stringpool_char.
7484         (Stringpool_template::new_key_offset): Remove code to initialize
7485         Stringpool_template::offset_.
7486         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7487         Stringpool_template::offset_ to zero.
7488
7489 2010-03-15  Doug Kwan  <dougkwan@google.com>
7490
7491         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7492         offset_.
7493         (Stringpool_template::new_key_offset): New method.
7494         (Stringpool_template::add_string): Assign offsets when adding new
7495         strings.
7496         (Stringpool_template::set_string_offsets): Do not set string offsets
7497         when not optimizing.
7498         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7499         member size_.
7500         (Chunked_vector::clear): Clear size_.
7501         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7502         (Chunked_vector::size): Return size_.
7503         (Chunked_vector::push_back): Use size_ to find insert position.
7504         (Chunked_vector::size_): New data member.
7505         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7506         (Stringpool_template::new_key_offset): New method declaration.
7507         (Stringpool_template::offset_): New data member.
7508
7509 2010-03-15   Rafael Espindola  <espindola@google.com>
7510
7511         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7512         Add_symbols' constructor.
7513         * readsyms.h (Add_symbols): Remove the input_group member.
7514
7515 2010-03-10  Ian Lance Taylor  <iant@google.com>
7516
7517         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7518         target to ask whether a reference to a symbol requires a stack
7519         split.
7520         * target.h (Target::is_call_to_non_split): New function.
7521         (Target::do_is_call_to_non_split): Declare virtual function.
7522         * target.cc: Include "symtab.h".
7523         (Target::do_is_call_to_non_split): New function.
7524         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7525
7526 2010-03-10  Cary Coutant  <ccoutant@google.com>
7527
7528         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7529         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7530         (File_read::open[2]): Add whole_file_view_ to list of views.
7531         (File_read::make_view): Remove test of whole_file_view_.
7532         (File_read::find_or_make_view): Create whole_file_view_ if
7533         necessary.
7534         (File_read::clear_views): Replace bool parameter with enum;
7535         adjust all callers.  Don't delete views with permanent data;
7536         do delete cached views and views from archives if
7537         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7538         if clearing the corresponding view.
7539         * fileread.h (File_read::Clear_views_mode): New enum.
7540         (File_read::View::is_permanent_view): New method.
7541         (File_read::clear_views): Replace bool parameter
7542         with enum; adjust all callers.
7543         * options.h (General_options): Change keep_files_mapped option;
7544         add map_whole_files.
7545         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7546         releasing the file.
7547         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7548         the file.
7549
7550 2010-03-10  David S. Miller  <davem@davemloft.net>
7551
7552         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7553
7554 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7555
7556         * icf.cc (get_section_contents): Add '@' marker after processing the
7557         merge reloc.
7558
7559 2010-03-08  Doug Kwan  <dougkwan@google.com>
7560
7561         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7562         due to a conversion warning.
7563         (Arm_relobj::update_output_local_symbol_count): Check for local
7564         symbol with unset output index.
7565
7566 2010-03-05  Ian Lance Taylor  <iant@google.com>
7567
7568         * options.h (class General_options): Add --spare-dynamic-tags.
7569         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7570         --spare-dynamic-tags.
7571
7572 2010-03-05  Ian Lance Taylor  <iant@google.com>
7573
7574         * incremental.cc: Include "libiberty.h".
7575
7576 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7577
7578         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7579         function, is_info_ member.
7580         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7581         (Versions::Versions): Update caller.
7582         (Versions::define_base_version): Likewise.
7583         (Versions::add_def): Likewise.
7584
7585 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7586
7587         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7588         (Scan::possible_function_pointer_reloc): New function.
7589         (Scan::local_reloc_may_be_function_pointer): Change to call
7590         possible_function_pointer_reloc.
7591         (Scan::global_reloc_may_be_function_pointer): Ditto.
7592         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7593         relocations in ".data.rel.ro._ZTV" section.
7594         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7595         * testsuite/icf_safe_so_test.cc: Ditto.
7596         * testsuite/icf_safe_test.cc: Ditto.
7597         * testsuite/icf_safe_test.sh: Ditto.
7598
7599 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7600             Ian Lance Taylor  <iant@google.com>
7601
7602         * target-reloc.h (relocate_section): Check the symbol table index
7603         for -1U before setting the local symbol index.
7604         (scan_relocatable_relocs): If copying the relocation, record that
7605         the local symbol is required.
7606         * object.h (Symbol_value::is_output_symtab_index_set): New
7607         function.
7608         (Symbol_value::may_be_discarded_from_output_symtab): New
7609         function.
7610         (Symbol_value::has_output_symtab_entry): New function.
7611         (Symbol_value::needs_output_symtab_entry): Remove.
7612         (Symbol_value::output_symtab_index): Make sure the symbol index is
7613         set.
7614         (Symbol_value::set_output_symtab_index): Make sure the symbol
7615         index is not set.  Make sure the new index is valid.
7616         (Symbol_value::set_must_have_output_symtab_entry): New function.
7617         (Symbol_value::has_output_dynsym_entry): New function.
7618         (Symbol_value::set_output_dynsym_index): Make sure the new index
7619         is valid.
7620         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7621         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7622         local symbol if permitted.
7623         (Sized_relobj::do_finalize_local_symbols): Call
7624         is_output_symtab_index_set rather than needs_output_symtab_entry.
7625         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7626         rather than needs_output_symtab_entry.  Call
7627         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7628         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7629         is_output_symtab_index_set rather than needs_output_symtab_entry.
7630         * testsuite/discard_locals_relocatable_test.c: New file.
7631         * testsuite/discard_locals_test.sh: Test -r.
7632         * testsuite/Makefile.am (check_DATA): Add
7633         discard_locals_relocatable_test1.syms,
7634         discard_local_relocatable_test2.syms.
7635         (MOSTLYCLEANFILES): Likewise.  Also add
7636         discard_locals_relocatable_test1.lout and
7637         discard_locals_relocatable_test2.out.
7638         (discard_locals_relocatable_test1.syms): New target.
7639         (discard_locals_relocatable_test.o): New target.
7640         (discard_locals_relocatable_test1.out): New target.
7641         (discard_locals_relocatable_test2.syms): New target.
7642         (discard_locals_relocatable_test2.out): New target.
7643         (various): Add missing ../ld-new dependencies.
7644         * testsuite/Makefile.in: Rebuild.
7645
7646 2010-03-03  Nick Clifton  <nickc@redhat.com>
7647
7648         * po/fi.po: New Finnish translation.
7649
7650 2010-03-01  Doug Kwan  <dougkwan@google.com>
7651
7652         * layout.cc (Layout::Layout): Force section types of .init_array*,
7653         .preinit_array* and .fini_array* sections.
7654         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7655         Fix check of return value of std::string::find.().
7656         (Output_section::Input_section_sort_compare::operator()): Remove
7657         comment about .init_array.
7658         (Output_section::Input_section_sort_init_fini_compare::operator()):
7659         New method.
7660         (Output_section::sort_attached_input_sections): Handle .init_array
7661         and .fini_array specially.
7662         * output.h (Output_section::Inut_section_sort_compare): Update
7663         comment.
7664         (Output_section::Input_section_sort_init_fini_compare): New struct.
7665
7666 2010-02-26  Doug Kwan  <dougkwan@google.com>
7667
7668         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7669         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7670         * testsuite/debug_msg.sh: Avoid matching source line number for
7671         use of global variable undef_int.
7672
7673 2010-02-26  Doug Kwan  <dougkwan@google.com>
7674
7675         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7676         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7677         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7678         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7679         * options.cc (General_options::General_options): Initialize member
7680         fix_v4bx_.
7681         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7682         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7683         and rm_no_fix_v4bx.stdout
7684         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7685         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7686         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7687         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7688         and arm_no_fix_v4bx.
7689         * Makefile.in: Regenerate.
7690         * testsuite/arm_fix_v4bx.s: New file.
7691         * testsuite/arm_fix_v4bx.sh: Ditto.
7692
7693 2010-02-24  Doug Kwan  <dougkwan@google.com>
7694
7695         * arm.cc (Target_arm::got_section): Make the .got section the first
7696         non RELRO section in the data segment.
7697         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7698         suffixes of section names.
7699
7700 2010-02-24  Doug Kwan  <dougkwan@google.com>
7701
7702         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7703         flags and attributes merging if an input file is a binary file.
7704         * fileread.cc (Input_file::open): Record format of original file.
7705         * fileread.h (Input_file::Format): New enum type.
7706         (Input_file::Input_file): Initialize data member format_.
7707         (Input_file::format): New method definition.
7708         (Input_file::format_):: New data member.
7709
7710 2010-02-24  Doug Kwan  <dougkwan@google.com>
7711
7712         * arm.cc (Arm_output_data_got): New class.
7713         (ARM_TCB_SIZE): New constant
7714         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7715         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7716         If user uses a script with a SECTIONS clause, issue only a warning
7717         for a misplaced EXIDX input section.  Otherwise, issue an error.
7718         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7719         garbage collection.
7720         (Target_arm::got_mode_index_entry): Handle static linking.
7721         (Target_arm::Scan::local): Ditto.
7722         (Target_arm::Scan::global): Ditto.
7723         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7724         all incorrectly implemented relocations.
7725         (Target_arm::fix_exidx_coverage): Pass layout to
7726         Arm_output_section::fix_exidx_coverage.
7727         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7728         from ".ARM.exidx." and ".ARM.extab.".
7729
7730 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7731
7732         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7733         section if it does not already exist.
7734         * attributes.cc (Attributes_section_data::Attributes_section_data):
7735         Don't crash if size is zero.
7736
7737 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7738             Ian Lance Taylor  <iant@google.com>
7739
7740         * gold.cc (queue_middle_tasks): If no input files were opened,
7741         exit.
7742         * workqueue.h (Task_function::Task_function): Assert that there is
7743         a blocker.
7744
7745 2010-02-22  Doug Kwan  <dougkwan@google.com>
7746
7747         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7748         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7749         types to avoid warnings due to different uint64_t implementations
7750         on different hosts.
7751
7752 2010-02-21  Doug Kwan  <dougkwan@google.com>
7753
7754         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7755         handling of the maximum backward branch offset.
7756         (Arm_relocate_functions::thumb_branch_common): Ditto.
7757         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7758         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7759         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7760         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7761         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7762         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7763         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7764         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7765         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7766         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7767         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7768         thumb2_bl_out_of_range.o): New rules.
7769         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7770         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7771         thumb2_bl_out_of_range
7772         * testsuite/Makefile.in: Regenerate.
7773         * testsuite/arm_bl_in_range.s: New file.
7774         * testsuite/arm_bl_out_of_range.s: Ditto.
7775         * testsuite/arm_branch_in_range.sh: Ditto.
7776         * testsuite/arm_branch_range.t: Ditto.
7777         * testsuite/thumb2_branch_range.t: Ditto.
7778         * testsuite/thumb_bl_in_range.s: Ditto.
7779         * testsuite/thumb_bl_out_of_range.s: Ditto.
7780         * testsuite/thumb_branch_range.t: Ditto.
7781
7782 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7783
7784         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7785         Add reloc offset information.
7786         * icf.cc (get_section_contents): Change iterators to point to the new
7787         vectors. Add reloc offset information to the contents.
7788         * icf.h (Icf::Sections_reachable_info): New typedef.
7789         (Icf::Sections_reachable_list): New typedef.
7790         (Icf::Offset_info): New typedef.
7791         (Icf::Reloc_info): New struct typedef.
7792         (Icf::Reloc_info_list): New typedef.
7793         (Icf::symbol_reloc_list): Delete method.
7794         (Icf::addend_reloc_list): Delete method.
7795         (Icf::section_reloc_list): Delete method.
7796         (Icf::reloc_info_list): New method.
7797         (Icf::reloc_info_list_): New member.
7798
7799 2010-02-19  Doug Kwan  <dougkwan@google.com>
7800
7801         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7802         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7803         * arm.cc (Arm_relocation_functions): New forward declaration.
7804         (Target_arm::Target_arm): Initialize new data members
7805         got_mod_index_offset_ and tls_base_symbol_defined_.
7806         (Target_arm::Relocate::relocate_tls): New method.
7807         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7808          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7809         New methods.
7810         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7811         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7812         (Target_arm::got_mod_index_offset_,
7813         Target_arm::tls_base_symbol_defined_): New data members.
7814         (Target_arm::Scan::local, Target::Scan::global,
7815         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7816         relocations.
7817
7818 2010-02-18  Doug Kwan  <dougkwan@google.com>
7819
7820         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7821         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7822         text section as a parameter becuase some broken tools may not set
7823         the link in section header.
7824         (Target_arm::has_got_section): New method.
7825         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7826         without any mapping symbol as data only.  Remove warning.
7827         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7828         link in its section header, try to discover the link by inspecting the
7829         REL31 relocation at the beginning of the section.
7830         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7831         in error message.
7832         (Target_arm::Scan::global): Treat any reference to the symbol
7833         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7834
7835 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7836
7837         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7838         (Scan::global_reloc_may_be_function_pointer): New function.
7839         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7840         (Scan::global_reloc_may_be_function_pointer): New function.
7841         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7842         (Scan::global_reloc_may_be_function_pointer): New function.
7843         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7844         (Scan::global_reloc_may_be_function_pointer): New function.
7845         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7846         (Scan::global_reloc_may_be_function_pointer): New function.
7847         (Scan::possible_function_pointer_reloc): New function.
7848         (Target_x86_64::can_check_for_function_pointers): New function.
7849         * gc.h (gc_process_relocs): Scan relocation types to determine if
7850         function pointers were taken for targets that support it.
7851         * icf.cc (Icf::find_identical_sections): Include functions for
7852         folding in safe ICF whose pointer is not taken.
7853         * icf.h (Secn_fptr_taken_set): New typedef.
7854         (fptr_section_id_): New member.
7855         (section_has_function_pointers): New function.
7856         (set_section_has_function_pointers): New function.
7857         (check_section_for_function_pointers): New function.
7858         * options.h: Fix comment for safe ICF option.
7859         * target.h (can_check_for_function_pointers): New function.
7860         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7861         Modify icf_safe_test for X86-64.
7862         * testsuite/Makefile.in: Regenerate.
7863         * testsuite/icf_safe_so_test.cc: New file.
7864         * testsuite/icf_safe_so_test.sh: New file.
7865         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7866         (main): Change to take pointer to function kept_func_3.
7867         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7868         folding is done correctly for X86-64.
7869
7870 2010-02-12  David S. Miller  <davem@davemloft.net>
7871
7872         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7873         is_symbolless parameter.
7874         (Output_reloc<SHT_REL>::is_symbolless): New.
7875         (Output_reloc<SHT_REL>::is_symbolless_): New.
7876         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7877         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7878         (Output_reloc<SHT_RELA>::is_symbolless): New.
7879         (Output_data_reloc::add_global): Handle is_symbolless.
7880         (Output_data_reloc::add_global_relative): Likewise.
7881         (Output_data_reloc::add_local): Likewise.
7882         (Output_data_reloc::add_local_relative): Likewise.
7883         (Output_data_reloc::add_symbolless_global_addend): New.
7884         (Output_data_reloc::add_symbolless_local_addend): New.
7885         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7886         is_symbolless.
7887         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7888         instead of ->is_relative_
7889         (Output_reloc::write): Likewise.
7890         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7891         (Output_reloc::write_rel): Simplify.
7892
7893         * sparc.cc (Target_sparc::Scan::local): Use
7894         ->add_symbolless_local_addend as needed.
7895         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7896         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7897         based upon relocation offset.
7898
7899 2010-02-11  Doug Kwan  <dougkwan@google.com>
7900
7901         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7902         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7903         beginning of function.
7904         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7905         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7906         parameter is_32bit in calls to should_apply_static_reloc.
7907         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7908         (check_DATA): Add arm_abs_global.stdout.
7909         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7910         arm_abs_global.stdout): New rules.
7911         (MOSTLLYCLEANFILES): Add arm_abs_global
7912         * Makefile.in: Regenerate.
7913         * testsuite/arm_abs_global.s: New file.
7914         * testsuite/arm_abs_global.sh: Ditto.
7915         * testsuite/arm_abs_lib.s: Ditto.
7916
7917 2010-02-11  Ian Lance Taylor  <iant@google.com>
7918
7919         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7920         Read_relocs task.
7921         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7922         Allocate_commons_task first.
7923         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7924         task, rather than symtab_lock_.
7925         (Gc_process_relocs::~Gc_process_relocs): New function.
7926         (Gc_process_relocs::is_runnable): Check this_blocker_.
7927         (Gc_process_relocs::locks): Use next_blocker_ rather than
7928         blocker_.
7929         (Scan_relocs::~Scan_relocs): New function.
7930         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7931         symtab_lock_.
7932         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7933         next_blocker_.
7934         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7935         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7936         constructor accordingly.
7937         (class Gc_process_relocs): Likewise.
7938         (class Scan_relocs): Likewise.
7939         * common.h (class Allocate_commons_task): Remove symtab_lock_
7940         field, and corresponding constructor parameter.
7941         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7942         symtab_lock_.
7943         (Allocate_commons_task::locks): Likewise.
7944
7945 2010-02-11  Ian Lance Taylor  <iant@google.com>
7946
7947         * gold-threads.h (class Once): Define.
7948         (class Initialize_lock): Rewrite as child of Once.
7949         * gold-threads.cc (class Once_initialize): Define.
7950         (once_pointer_control): New static variable.
7951         (once_pointer, once_arg): New static variables.
7952         (c_run_once): New static function.
7953         (Once::Once, Once::run_once, Once::internal_run): New functions.
7954         (class Initialize_lock_once): Remove.
7955         (initialize_lock_control): Remove.
7956         (initialize_lock_pointer): Remove.
7957         (initialize_lock_once): Remove.
7958         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7959         (Initialize_lock::initialize): Rewrite.
7960         (Initialize_lock::do_run_once): New function.
7961         * archive.cc (Archive::interpret_header): Only clear name if it is
7962         not already empty.
7963         * fileread.cc: Include "gold-threads.h"
7964         (file_counts_lock): New static variable.
7965         (file_counts_initialize_lock): Likewise.
7966         (File_read::release): Only increment counts when using --stats.
7967         Use a lock around the increment.
7968         * parameters.cc (class Set_parameters_target_once): Define.
7969         (set_parameters_target_once): New static variable.
7970         (Parameters::Parameters): Move here from parameters.h.
7971         (Parameters::set_target): Rewrite.
7972         (Parameters::set_target_once): New function.
7973         (Parameters::clear_target): Move here and rewrite.
7974         * parameters.h (class Parameters): Update declarations.  Add
7975         set_parameters_target_once_ field.
7976         (Parameters::Parameters): Move to parameters.cc.
7977         (Parameters::clear_target): Likewise.
7978         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7979         task.
7980         (Start_group::~Start_group): New function.
7981         (Start_group::is_runnable): New function.
7982         (Start_group::locks, Start_group::run): New functions.
7983         (Finish_group::run): Change saw_undefined to size_t.
7984         * readsyms.h (class Start_group): Define.
7985         (class Finish_group): Change saw_undefined_ field to size_t.
7986         (Finish_group::Finish_group): Remove saw_undefined and
7987         this_blocker parameters.  Change all callers.
7988         (Finish_group::set_saw_undefined): New function.
7989         (Finish_group::set_blocker): New function.
7990         * symtab.h (class Symbol_table): Change saw_undefined to return
7991         size_t.  Change saw_undefined_ field to size_t.
7992         * target-select.cc (Set_target_once::do_run_once): New function.
7993         (Target_selector::Target_selector): Initialize set_target_once_
7994         field.  Don't initialize lock_ and initialize_lock_ fields.
7995         (Target_selector::instantiate_target): Rewrite.
7996         (Target_selector::set_target): New function.
7997         * target-select.h (class Set_target_once): Define.
7998         (class Target_selector): Update declarations.  Make
7999         Set_target_once a friend.  Remove lock_ and initialize_lock_
8000         fields.  Add set_target_once_ field.
8001
8002 2010-02-10  Ian Lance Taylor  <iant@google.com>
8003
8004         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8005         queueing any tasks.
8006         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8007         (queue_middle_tasks): Add all blockers before queueing any tasks.
8008         (queue_final_tasks): Likewise.
8009         * token.h (Task_token::add_blockers): New function.
8010         * object.h (Input_objects::number_of_relobjs): New function.
8011
8012 2010-02-10  Ian Lance Taylor  <iant@google.com>
8013
8014         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8015         shared, not if not position independent.
8016         * x86_64.cc (Relocate::relocate_tls): Likewise.
8017         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8018         (tls_pie_pic_test): New target.
8019         * testsuite/Makefile.in: Rebuild.
8020
8021         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8022         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8023         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8024         * testsuite/Makefile.in: Rebuild.
8025
8026 2010-02-09  David S. Miller  <davem@davemloft.net>
8027
8028         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8029         R_SPARC_RELATIVE using ->add_local_relative().
8030         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8031
8032         * output.h (Output_data_dynamic::add_section_size): New method
8033         that takes two Output_data objects.
8034         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8035         entry param.  Handle it in initializers.
8036         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8037         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8038         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8039         arg.
8040         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8041         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8042         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8043         for dynrel_includes_plt.
8044         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8045         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8046         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8047         before .rela.plt
8048         (Target_sparc::do_finalize_sections): Update to pass true for
8049         dynrel_includes_plt.
8050         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8051         output before .rela.plt
8052         (Target_powerpc::do_finalize_sections): Update to pass true for
8053         dynrel_includes_plt when 32-bit.
8054
8055 2010-02-08  Doug Kwan  <dougkwan@google.com>
8056
8057         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8058         method.
8059         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8060         Arm_relobj::scan_section_for_cortex_a8_stubs,
8061         Arm_relobj::do_relocation_section): Instead of calling
8062         Output_section::output_address, use faster
8063         Arm_relobj::simple_input_section_output_address.
8064
8065 2010-02-08  David S. Miller  <davem@davemloft.net>
8066
8067         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8068         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8069         relocation helper function.
8070
8071         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8072         just like R_SPARC_GOT{10,13,22}.
8073         (Target_sparc::Scan::local): Likewise.
8074         (Target_sparc::Relocate:relocate): Likewise.
8075
8076 2010-02-06  Ian Lance Taylor  <iant@google.com>
8077
8078         * configure.ac: Rewrite targetobjs duplicate removal code to use
8079         only shell constructs.
8080         * configure: Rebuild.
8081
8082 2010-02-05  Doug Kwan  <dougkwan@google.com>
8083
8084         PR 11247
8085         * arm.cc (Arm_relobj::section_is_scannable): New method.
8086         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8087         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8088
8089 2010-02-04  Doug Kwan  <dougkwan@google.com>
8090
8091         PR 11247
8092         * arm-reloc-property.cc (cstdio): Include.
8093         * configure.ac (targetobjs): Remove duplicates.
8094         * configure: Regenerate.
8095         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8096         big and little endian version for a given address size.
8097
8098 2010-02-03  Doug Kwan  <dougkwan@google.com>
8099
8100         * arm-reloc-property.cc
8101         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8102         definition.
8103         * arm-reloc-property.h
8104         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8105         New method definition.
8106         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8107         declaration.
8108         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8109         overflow to N.
8110         (GOT_PREL): Change implemented to Y.
8111         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8112         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8113         (Arm_relocate_functions::movw_abs_nc): Remove method.
8114         (Arm_relocate_functions::movt_abs): Ditto.
8115         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8116         (Arm_relocate_functions::thm_movt_abs): Ditto.
8117         (Arm_relocate_functions::movw_rel_nc): Ditto.
8118         (Arm_relocate_functions::movw_rel): Ditto.
8119         (Arm_relocate_functions::movt_rel): Ditto.
8120         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8121         (Arm_relocate_functions:thm_movw_rel): Ditto.
8122         (Arm_relocate_functions:thm_movt_rel): Ditto.
8123         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8124         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8125         New method definitions.
8126         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8127         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8128         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8129         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8130         (Target_arm::Relocate::relocate): Check for non-static or
8131         unimplemented relocation code and exit early.  Change calls to
8132         Target_arm::reloc_uses_thumb_bit and
8133         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8134         instead.  Refactor code to handle similar relocations to increase
8135         code sharing.  Remove check for unsupported relocation code in switch
8136         statement.
8137         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8138         relocation property table to find out size.  Change error message to
8139         print out the name of a relocation code instead of the numeric value.
8140         (Target_arm::scan_reloc_for_stub): Use relocation property table
8141         instead of calling Target_arm::reloc_uses_thumb_bit().
8142
8143 2010-02-02  Doug Kwan  <dougkwan@google.com>
8144
8145         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8146         types of relaxed input section.
8147
8148 2010-02-02  Doug Kwan  <dougkwan@google.com>
8149
8150         * Makefile.am (HFILES): Add arm-reloc-property.h.
8151         (DEFFILES): New.
8152         (TARGETSOURCES): Add arm-reloc-property.cc
8153         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8154         (libgold_a_SOURCES): $(DEFFILES)
8155         * Makefile.in: Regenerate.
8156         * arm-reloc-property.cc: New file.
8157         * arm-reloc-property.h: New file.
8158         * arm-reloc.def: New file.
8159         * arm.cc: Update comments.
8160         (arm-reloc-property.h): New included header.
8161         (arm_reloc_property_table): New global variable.
8162         (Target_arm::do_select_as_default_target): New method definition.
8163         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8164         arm-reloc-property to targ_extra_obj.
8165         * parameters.cc (set_parameters_target): Call
8166         Target::select_as_default_target().
8167         * target.h (Target::select_as_default_target): New method definition.
8168         (Target::do_select_as_default_target): Same.
8169
8170 2010-02-01  Doug Kwan  <dougkwan@google.com>
8171
8172         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8173         first_output_text_section_.
8174         (Arm_exidx_fixup::first_output_text_section): New method definition.
8175         (Arm_exidx_fixup::first_output_text_section_): New data member.
8176         (Arm_exidx_fixup::process_exidx_section): Record the first text
8177         output section seen.
8178         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8179         and entsize in output section header.
8180
8181 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8182
8183         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8184         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8185         (Arm_relocate_functions::thm_alu11): New Method.
8186         (Arm_relocate_functions::thm_pc8): New Method.
8187         (Arm_relocate_functions::thm_pc12): New Method.
8188         (Target_arm::Scan::local): Handle the relocations.
8189         (Target_arm::Scan::global): Likewise.
8190         (Target_arm::Relocate::relocate): Likewise.
8191         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8192
8193 2010-01-29  Doug Kwan  <dougkwan@google.com>
8194
8195         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8196         of relocation types as ld.
8197
8198 2010-01-29  Doug Kwan  <dougkwan@google.com>
8199
8200         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8201         to public.
8202         (Arm_relocate_functions::thumb_branch_common): Ditto.
8203         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8204         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8205         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8206         Arm_relocate_functions::jump24): Remove.
8207         (Target_arm::Relocate::relocate): Adjust code to call
8208         Arm_relocation_functions::arm_branch_common and
8209         Arm_relocation_functions::thumb_branch_common instead of their removed
8210         wrappers.  Merge switch-cases together to reduce source code size.
8211
8212 2010-01-29  Doug Kwan  <dougkwan@google.com>
8213
8214         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8215         output_local_symbol_count_needs_update_.
8216         (Arm_relobj::output_local_symbol_count_needs_update,
8217          Arm_relobj::set_output_local_symbol_count_needs_update,
8218          Arm_relobj::update_output_local_symbol_count): New methods.
8219         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8220         member.
8221         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8222         of pointed function as in a R_ARM_PREL31 relocation.
8223         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8224         for output local symbol count updating.
8225         (Target_arm::do_relax): Update output local symbol counts in objects
8226         if necessary.
8227         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8228
8229 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8230
8231         * arm.cc: Added support for the ARM relocations:
8232         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8233         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8234         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8235         movw_prel_nc).
8236         (Arm_relocate_functions::movw_rel): New method.
8237         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8238         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8239         thm_movw_prel_nc).
8240         (Arm_relocate_functions::thm_movw_rel): New method.
8241         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8242         thm_movt_prel).
8243         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8244         relocations.
8245         (Target_arm::Scan::global): Likewise.
8246         (Target_arm::Relocate::relocate): Likewise.
8247         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8248         Likewise.
8249
8250 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8251
8252         * arm.cc: Added support for ARM group relocations.
8253         (Target_arm::reloc_needs_sym_origin): New method.
8254         (Arm_relocate_functions::calc_grp_kn): New method.
8255         (Arm_relocate_functions::calc_grp_residual): New method.
8256         (Arm_relocate_functions::calc_grp_gn): New method.
8257         (Arm_relocate_functions::arm_grp_alu): New Method.
8258         (Arm_relocate_functions::arm_grp_ldr): New Method.
8259         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8260         (Arm_relocate_functions::arm_grp_ldc): New Method.
8261         (Target_arm::Scan::local): Handle the ARM group relocations.
8262         (Target_arm::Scan::global): Likewise.
8263         (Target_arm::Relocate::relocate): Likewise.
8264         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8265         Likewise.
8266
8267 2010-01-26  Doug Kwan  <dougkwan@google.com>
8268
8269         * arm.cc (set): Include.
8270         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8271         pointer type.
8272         (Arm_output_section::Text_section_list): New type.
8273         (Arm_output_section::append_text_sections_to_list): New method.
8274         (Arm_output_section::fix_exidx_coverage): Ditto.
8275         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8276         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8277         Relobj::set_section_offset() instead of
8278         Sized_relobj::invalidate_section_offset().
8279         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8280         parameter for section headers. Ignore relocation sections for
8281         unallocated sections and EXIDX sections.
8282         (Target_arm::fix_exidx_coverage): New method.
8283         (Target_arm::output_section_address_less_than): New type.
8284         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8285         linked text section instead of the EXIDX section.
8286         (Arm_output_section::create_stub_group): Add an assertion to check
8287         that this is not an EXIDX output section.
8288         (Arm_output_section::append_text_sections_to_list): New method.
8289         (Arm_output_section::fix_exidx_coverage): Ditto.
8290         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8291         Arm_relobj::section_needs_reloc_stub_scanning.
8292         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8293         first pass.
8294         (Target_arm::fix_exidx_coverage): New method.
8295         * object.h (Relobj::set_output_section): New method.
8296         (Sized_relobj::invalidate_section_offset): Remove method.
8297         (Sized_relobj::do_invalidate_section_offset): Remove method.
8298         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8299
8300 2010-01-25  Doug Kwan  <dougkwan@google.com>
8301
8302         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8303         Fix warning due to signed and unsigned comparison on a 32-bit host.
8304
8305 2010-01-22  Doug Kwan  <dougkwan@google.com>
8306
8307         * arm.cc (Target_arm::do_relax): Record an output section for section
8308         offset adjustment it contains any stub table that has changed.
8309         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8310         offsets in an output section if necessary.
8311         * output.cc (Output_section::Output_section): Initialize
8312         section_offsets_need_adjustments_.
8313         (Output_section::add_input_section_for_script): Renamed to
8314         Output_section::add_simple_input_section.
8315         (Output_section::save_states): Add a comment.
8316         (Output_section::discard_states): New method defintion.
8317         (Output_section::adjust_section_offsets): Same.
8318         * output.h (Output_section::add_input_section_for_script): Renamed to
8319         Output_section::add_simple_input_section.
8320         (Output_section::discard_states): New method declaration.
8321         (Output_section::adjust_section_offsets): Same.
8322         (Output_section::section_offsets_need_adjustment,
8323         Output_section::set_section_offsets_need_adjustment): New method
8324         definitions.
8325         (Output_section::section_offsets_need_adjustment_): New data member.
8326         * script-sections.cc
8327         (Output_section_element_input::set_section_address): Adjust code for
8328         renaming of Output_section::add_input_section_for_script.
8329         (Orphan_output_section::set_section_address): Same.
8330
8331 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8332
8333         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8334         Fix_v4bx enum values .
8335         * gold/options.h (General_options): New option definitions.
8336         (General_options::fix_v4bx): New method.
8337         (General_options::Fix_v4bx): New enum.
8338         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8339         (General_options::parse_fix_v4bx_interworking): New method.
8340
8341 2010-01-22  Doug Kwan  <dougkwan@google.com>
8342
8343         * arm.cc (Arm_exidx_fixup): New class.
8344
8345 2010-01-21  Doug Kwan  <dougkwan@google.com>
8346
8347         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8348         classes.
8349         (Arm_exidx_section_offset_map): New type.
8350
8351 2010-01-21  Doug Kwan  <dougkwan@google.com>
8352
8353         * arm.cc (Arm_exidx_input_section): New class.
8354         (Arm_relobj::exidx_input_section_by_link,
8355         Arm_relobj::exidx_input_section_by_shndx,
8356         Arm_relobj::make_exidx_input_section): New methods.
8357         (read_arm_attributes_section): Remove.
8358         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8359         information about them.
8360         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8361         to here.
8362
8363 2010-01-20  Doug Kwan  <dougkwan@google.com>
8364
8365         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8366         Input_section_specifier to Section_id.
8367         (Target_arm::new_arm_input_section: Adjust code for change of key
8368         type.
8369         (Target_arm::find_arm_input_section): Ditto.
8370         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8371         (Section_id): Remove.
8372         (Garbage_collection::Section_id_hash): Remove.
8373         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8374         (Section_id): Remove.
8375         (Icf::Section_id_hash): Remove.
8376         * object.h (Section_id, Const_section_id, Section_id_hash,
8377         Const_section_id_hash): New type definitions.
8378         * output.cc (Output_section::add_relaxed_input_section): Change to
8379         use Const_section_id instead of Input_section_specifier as key type.
8380         (Output_section::add_merge_input_section): Ditto.
8381         (Output_section::build_relaxation_map): Change to use Section_id
8382         instead of Input_section_specifier as key type.
8383         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8384         Ditto.
8385         (Output_section::convert_input_sections_to_relaxed_sections): Change
8386         to use Const_section_id instead of Input_section_specifier as key type.
8387         (Output_section::find_merge_section): Ditto.
8388         (Output_section::find_relaxed_input_section): Ditto.
8389         * output.h (Input_section_specifier): Remove class.
8390         (Output_section::Output_section_data_by_input_section_map): Change
8391         key type to Const_section_id.
8392         (Output_section::Output_relaxed_input_section_by_input_section_map):
8393         Ditto.
8394         (Output_section::Relaxation_map): Change key type to Section_id.
8395
8396 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8397
8398         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8399         (class Arm_v4bx_stub): New class.
8400         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8401         (Stub_factory::make_arm_v4bx_stub): New method.
8402         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8403         (Stub_table::empty): Handle v4bx stubs.
8404         (Stub_table::add_arm_v4bx_stub): New method.
8405         (Stub_table::find_arm_v4bx_stub): New method.
8406         (Arm_relocate_functions::v4bx): New method.
8407         (Target_arm::fix_v4bx): New method.
8408         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8409         (Stub_table::relocate_stubs): Likewise.
8410         (Stub_table::do_write): Likewise.
8411         (Stub_table::update_data_size_and_addralign): Likewise.
8412         (Stub_table::finalize_stubs):  Likewise.
8413         (Target_arm::Scan::local): Likewise.
8414         (Target_arm::Scan::global): Likewise.
8415         (Target_arm::do_finalize_sections): Likewise.
8416         (Target_arm::Relocate::relocate): Likewise.
8417         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8418         Likewise.
8419         (Target_arm::scan_reloc_for_stub): Likewise.
8420         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8421
8422 2010-01-19  Ian Lance Taylor  <iant@google.com>
8423
8424         * output.cc (Output_section_headers::do_sized_write): Write large
8425         segment count to sh_info field.
8426         (Output_file_header::do_sized_write): For large segment count,
8427         write PN_XNUM to e_phnum field.
8428
8429 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8430
8431         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8432         (Arm_relocate_functions::thm_jump8): New function.
8433         (Arm_relocate_functions::thm_jump11): New function.
8434         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8435         R_ARM_THM_JUMP11.
8436         (Target_arm::Scan::global): Likewise.
8437         (Target_arm::Relocate::relocate): Likewise.
8438         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8439         Likewise.
8440
8441 2010-01-14  Doug Kwan  <dougkwan@google.com>
8442
8443         * arm.cc (map, utility): Include headers.
8444         (Target_arm::apply_cortex_a8_workaround): New method.
8445         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8446         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8447         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8448         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8449         the --[no-]fix-cortex-a8 command line options.
8450         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8451         (Target_arm::relocate_stub): Use addend in instruction template.
8452         * options.h (DEFINE_bool): Set the user-set flag.
8453         (General_options): Add --[no-]-fix-cortex options.
8454         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8455         : Update fast look-up map after conversion.
8456
8457 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8458
8459         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8460         in the first pass of do_layout.
8461
8462 2010-01-13  Doug Kwan  <dougkwan@google.com>
8463
8464         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8465         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8466         apparent compiler problem of not folding static constant integral
8467         data members of elfcpp::Elf_sizes<32>.
8468
8469 2010-01-13  Doug Kwan  <dougkwan@google.com>
8470
8471         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8472         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8473         Arm_relobj::scan_section_for_cortex_a8_erratum,
8474         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8475         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8476         sections to scan for relocation stubs into a new method
8477         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8478         relocation and Cortex-A8 stub scanning.
8479         (Target_arm::do_relax): Force stubs to be after stubbed sections
8480         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8481         the beginning of a new relaxation pass.  Update a comment.
8482         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8483
8484 2010-01-12  Ian Lance Taylor  <iant@google.com>
8485
8486         * target-reloc.h (visibility_error): New inline function.
8487         (relocate_section): Call visibility_error.
8488         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8489         (MOSTLYCLEANFILES): Likewise.
8490         (protected_4_pic.o, protected_3.err): New targets.
8491         * testsuite/protected_4.cc: New file.
8492
8493 2010-01-12  Doug Kwan  <dougkwan@google.com>
8494
8495         * arm.cc (Cortex_a8_reloc): New class.
8496         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8497         and cortex_a8_relocs_info_.
8498         (Target_arm::fix_cortex_a8): New method definition.
8499         (Target_arm::Cortex_a8_relocs_info): New type.
8500         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8501         New data member declarations.
8502         (Target_arm::scan_reloc_for_stub): Record information about
8503         relocations for THUMB branches that might be exempted from the
8504         Cortex-A8 workaround.
8505         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8506         at the beginning of a relaxation pass.
8507
8508 2010-01-12  Doug Kwan  <dougkwan@google.com>
8509
8510         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8511         (Arm_relobj::Mapping_symbol_position,
8512          Arm_reloj::Mapping_symbol_position_less,
8513          Arm_relobj::Mapping_symbols_info): New types.
8514         (Target_arm::is_mapping_symbol_name): New method definition.
8515         (Arm_relobj::do_count_local_symbols): Save information about mapping
8516         symbols.
8517
8518 2010-01-11  Doug Kwan  <dougkwan@google.com>
8519
8520         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8521         Arm_relocate_functions::thumb32_branch_upper,
8522         Arm_relocate_functions::thumb32_branch_lower,
8523         Arm_relocate_functions::thumb32_cond_branch_offset,
8524         Arm_relocate_functions::thumb32_cond_branch_upper,
8525         Arm_relocate_functions::thumb32_cond_branch_lower,
8526         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8527         branch offset encoding.
8528         (Arm_relocate_functions::thumb_branch_common): Use new branch
8529         offset encoding methods to avoid code duplication.
8530         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8531         (Stub_addend_reader::operator()): Use new branch encoding method
8532         to avoid code duplication.
8533
8534 2010-01-11  Doug Kwan  <dougkwan@google.com>
8535
8536         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8537         (Target_arm::do_finalize_sections): Define special EXIDX section
8538         symbols only if referenced.
8539         * gc.h (Garbage_collection::add_reference): New method.
8540         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8541         code duplication.
8542
8543 2010-01-11  Ian Lance Taylor  <iant@google.com>
8544
8545         * script.cc (Version_script_info::build_expression_list_lookup):
8546         Change complaing about duplicate wildcard match from error to
8547         warning.
8548
8549         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8550         of 2009-12-30.
8551         (Version_script_info::Version_script_info): Initialize globs_,
8552         default_version_, default_is_global_, and exact_.  Don't
8553         initialize globals_ or locals_.
8554         (Version_script_info::build_lookup_tables): Build local symbols
8555         first.
8556         (Version_script_info::unquote): New function.
8557         (Version_script_info::add_exact_match): New function.
8558         (Version_script_info::build_expression_list_lookup): Remove lookup
8559         parameter.  Add is_global parameter.  Change all callers.  Handle
8560         wildcard pattern specially.  Unquote pattern.  Call
8561         add_exact_match.
8562         (Version_script_info::get_name_to_match): New function.
8563         (Version_script_info::get_symbol_version): New function.
8564         (Version_script_info::get_symbol_version_helper): Remove.
8565         (Version_script_info::check_unmatched_names): Call unquote.
8566         * script.h (class Version_script_info): Change get_symbol_version
8567         to be non-inline and add is_global parameter; change all callers.
8568         Rewrite symbol_is_local.  Update declarations.  Define struct
8569         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8570         Remove globals_ and locals_ members.  Add exact_, globs_,
8571         default_version_, is_global_.
8572         (Version_script_info::Glob): Remove pattern, add expression and
8573         is_global.  Update constructor.  Change all callers.
8574         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8575         default version.
8576         (Versions::symbol_section_contents): If a symbol is undefined, or
8577         defined in a dynamic object, set the version index to
8578         VER_NDX_LOCAL.
8579         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8580         symbol_is_local.
8581         (Symbol_table::add_from_pluginobj): Likewise.
8582         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8583
8584 2010-01-11  Doug Kwan  <dougkwan@google.com>
8585
8586         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8587         (incremental_dump_LDADD): Add linking option for libintl.
8588         * Makefile.in: Regenerate.
8589
8590 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8591
8592         PR gold/11144
8593         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8594         instead of -Ds.
8595         * testsuite/Makefile.in: Regenerated.
8596
8597 2010-01-10  Doug Kwan  <dougkwan@google.com>
8598
8599         * options.h (DEFINE_var): Use parentheses around argument varname__
8600         in macro body to avoid any unintended subsequent substitutions.
8601
8602 2010-01-10  Ian Lance Taylor  <iant@google.com>
8603
8604         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8605         candidates before doing symbol resolution.
8606
8607         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8608         ODR candidates if only one is weak.
8609
8610 2010-01-08  Ian Lance Taylor  <iant@google.com>
8611
8612         * script.cc (Version_script_info::build_expression_list_lookup):
8613         Don't warn about ambiguous version, just record the ambiguity.
8614         (Version_script_info::get_symbol_version_helper): Give error if
8615         version is ambiguous.
8616
8617 2010-01-08  Doug Kwan  <dougkwan@google.com>
8618
8619         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8620         prev_data_size_ and prev_addralign_.  Remove initializer for
8621         deleted data member has_been_changed_.
8622         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8623         to determine if the table is empty.
8624         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8625         Remove.
8626         (Stub_table::add_reloc_stub): Define method in class definition
8627         instead of just declaring it there.
8628         (Stub_table::add_cortex_a8_stub): New method definition.
8629         (Stub_table::update_data_size_and_addralign): Ditto.
8630         (Stub_table::finalize_stubs): Ditto.
8631         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8632         (Stub_table::do_addralign_): Return address alignment in the
8633         (Stub_table::do_reset_address_and_file_offset): Define method in
8634         class definition instead of declaring it there.  Set current data
8635         size to be the data size of the previous pass.
8636         (Stub_table::set_final_data_size): Use current data size as the
8637         final data size.
8638         (Stub_table::relocate_stub): Change parameter type of stub from
8639         Reloc_stub pointer to Stub pointer.
8640         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8641         (Stub_table::Cortex_a8_stub_list): New typedef.
8642         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8643          Stub_table::prev_addralign_): New data member.
8644         (Arm_relobj::Arm_relobj): Initialize data member
8645         section_has_cortex_a8_workaround_.
8646         (Arm_relobj::section_has_cortex_a8_workaround,
8647          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8648          definitions.
8649         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8650         declarations.
8651         (Target_arm::relocate_stub): Change parameter type of stub from
8652         Reloc_stub pointer to Stub pointer.
8653         (Insn_template::size, Insn_template::alignment): Handle
8654         THUMB16_SPECIAL_TYPE.
8655         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8656          Stub_table::update_data_size_and_addralign,
8657          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8658         definitions.
8659         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8660         (Stub_table::do_write): Ditto.
8661         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8662
8663 2010-01-08  Ian Lance Taylor  <iant@google.com>
8664
8665         PR 11108
8666         * symtab.h (class Symbol): Remove fields is_target_special_ and
8667         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8668         (Symbol::is_defined_in_discarded_section): New function.
8669         (Symbol::set_is_defined_in_discarded_section): New function.
8670         (Symbol::has_plt_offset): Rewrite.
8671         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8672         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8673         Don't initialize is_target_special_ or has_plt_offset_.
8674         Initialize is_defined_in_discarded_section_.
8675         (Symbol_table::add_from_relobj): If appropriate, set
8676         is_defined_in_discarded_section.
8677         * resolve.cc (Symbol::override_base_with_special): Don't test
8678         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8679         * target-reloc.h (relocate_section): Do special handling for
8680         symbols defined in discarded sections for global symbols as well
8681         as local symbols.
8682
8683 2010-01-08  Ian Lance Taylor  <iant@google.com>
8684
8685         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8686         the SHT_SYMTAB case.
8687
8688 2010-01-08  Ian Lance Taylor  <iant@google.com>
8689
8690         * object.cc (Sized_relobj::do_layout): Don't get confused if
8691         layout_eh_frame returns NULL.
8692
8693 2010-01-08  Ian Lance Taylor  <iant@google.com>
8694
8695         PR 11084
8696         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8697         dynamic symbol table, use the normal symbol table.
8698         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8699         symbol table.
8700
8701 2010-01-08  Ian Lance Taylor  <iant@google.com>
8702
8703         PR 11072
8704         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8705         sections.
8706
8707 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8708
8709         * version.cc (print_version): Change to "Copyright 2010".
8710
8711 2010-01-08  Ian Lance Taylor  <iant@google.com>
8712
8713         PR 10287
8714         PR 11063
8715         * i386.cc (class Target_i386): Change return type of plt_section
8716         to be non-const.
8717         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8718         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8719         tls_desc_rel_ field.
8720         (Output_data_plt_i386::rel_tls_desc): New function.
8721         (Target_i386::rel_tls_desc_section): New function.
8722         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8723         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8724         R_386_TLS_DESC reloc in rel_tls_desc_section.
8725         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8726         Define struct Tlsdesc_info.
8727         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8728         (Target_x86_64::do_reloc_symbol_index): New function.
8729         (Target_x86_64::add_tlsdesc_info): New function.
8730         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8731         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8732         tlsdesc_rel_ field.
8733         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8734         all callers.
8735         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8736         (Target_x86_64::rela_tlsdesc_section): New function.
8737         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8738         handling.
8739         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8740         (Target_x86_64::do_reloc_addend): New function.
8741         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8742         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8743         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8744         (Output_reloc::type): New function.
8745         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8746         (Output_reloc::is_target_specific): New function.
8747         (Output_reloc::target_arg): New function.
8748         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8749         absolute relocs and target specific relocs.
8750         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8751         add_target_specific.
8752         (class Output_data_reloc) [SHT_RELA]: Likewise.
8753         * output.cc (Output_reloc::Output_reloc): Add four new versions
8754         for absolute relocs and target specific relocs.
8755         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8756         (Output_reloc::get_symbol_index): Likewise.
8757         (Output_reloc::local_section_offset): Check that local_sym_index_
8758         is not TARGET_CODE or 0.
8759         (Output_reloc::symbol_value): Likewise.
8760         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8761         reloc.
8762         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8763         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8764         functions.
8765         * layout.cc (add_target_dynamic_tags): Use output section for
8766         DT_PLTRELSZ and DT_JMPREL.
8767
8768 2010-01-07  Ian Lance Taylor  <iant@google.com>
8769
8770         PR 11061
8771         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8772         function.
8773         (class Output_data_reloc_generic): Define.
8774         (class Output_data_reloc_base): Change base class to
8775         Output_data_reloc_generic.  Change add() method to call
8776         bump_relative_reloc_count for a relative reloc.  Remove
8777         sort_relocs_ field.
8778         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8779         to sort_relocs().
8780         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8781         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8782         appropriate.
8783         * layout.h (class Layout): Update declaration.
8784
8785 2010-01-07  Ian Lance Taylor  <iant@google.com>
8786
8787         * output.h (class Output_data): Add const version of
8788         output_section and do_output_section.
8789         (class Output_section_data): Add const version of
8790         do_output_section.
8791         (class Output_section): Likewise.
8792         * layout.cc (Layout::add_target_dynamic_tags): New function.
8793         * layout.h (class Layout): Update declarations.
8794         * arm.cc (Target_arm::do_finalize_sections): Use
8795         add_target_dynamic_tags.
8796         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8797         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8798         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8799         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8800
8801 2010-01-07  Ian Lance Taylor  <iant@google.com>
8802
8803         PR 11042
8804         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8805         object as needed.
8806
8807 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8808             Ian Lance Taylor  <iant@google.com>
8809
8810         PR 11019
8811         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8812         Xindex::read_symtab_xindex.
8813
8814 2010-01-07  Doug Kwan  <dougkwan@google.com>
8815
8816         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8817         (Insn_template::thumb16_bcond_insn): New method declaration.
8818         (Insn_template): Fix spelling.
8819         (Stub::thumb16_special): New method declaration.
8820         (Stub::do_write): Define virtual method which was previously pure
8821         virtual.
8822         (Stub::do_thumb16_special): New method declaration.
8823         (Stub::do_fixed_endian_write): New template member.
8824         (Reloc_stub::do_write): Remove.
8825         (Reloc_stub::do_fixed_endian_write): Remove.
8826         (Cortex_a8_stub): New class definition.
8827         (Stub_factory::make_cortex_a8_stub): New method definition.
8828         (Stub_factory::Stub_factory): Add missing static storage class
8829         qualifier for elf32_arm_stub_a8_veneer_blx.
8830
8831 2010-01-07  Ian Lance Taylor  <iant@google.com>
8832
8833         PR 10980
8834         * options.h (class General_options): Add --warn-unresolved-symbols
8835         and --error-unresolved-symbols.
8836         * errors.cc (Errors::undefined_symbol): Implement
8837         --warn-unresolved-symbols.
8838
8839         * options.h (class General_options): Add -z text and -z textoff.
8840         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8841
8842 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8843
8844         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8845         (Garbage_collection::cident_sections): New function.
8846         (Garbage_collection::add_cident_section): New function.
8847         (Garbage_collection::cident_sections_): New member.
8848         (gc_process_relocs): Add references to sections whose names are C
8849         identifiers.
8850         * gold.h (cident_section_start_prefix): New constant.
8851         (cident_section_stop_prefix): New constant.
8852         (is_cident): New function.
8853         * layout.cc (Layout::define_section_symbols): Replace string constants
8854         with the newly defined constants.
8855         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8856         C identifiers.
8857         * testsuite/Makefile.am: Add gc_orphan_section_test.
8858         * testsuite/Makefile.in: Regenerate.
8859         * testsuite/gc_orphan_section_test.cc: New file.
8860         * testsuite/gc_orphan_section_test.sh: New file.
8861
8862 2010-01-06  Ian Lance Taylor  <iant@google.com>
8863
8864         PR 10980
8865         * options.h (class General_options): Add --warn-shared-textrel.
8866         * layout.cc (Layout::finish_dynamic_section): Implement
8867         --warn-shared-textrel.
8868
8869         PR 10980
8870         * options.h (class General_options): Add --warn-multiple-gp.
8871
8872 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8873
8874         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8875         $(THREADSLIB) and $(LIBDL).
8876         * Makefile.in: Rebuild.
8877
8878 2010-01-06  Ian Lance Taylor  <iant@google.com>
8879
8880         PR 10980
8881         * options.cc (General_options::parse_section_start): New function.
8882         (General_options::section_start): New function.
8883         (General_options::General_options): Initialize all members.
8884         * options.h: Include <map>
8885         (class General_options): Add --section-start.  Add section_starts_
8886         member.
8887         * layout.cc (Layout::attach_allocated_section_to_segment): If
8888         --section-start was used, set the address of the segment.  Remove
8889         local sort_sections.
8890         (Layout::relaxation_loop_body): If the address of the load segment
8891         has been set by --section-start, don't use it.
8892         * output.h (Output_segment::update_flags_for_output_section): New
8893         function.
8894         * output.cc (Output_segment::add_output_section): Call
8895         update_flags_for_output_section.
8896
8897 2010-01-05  Ian Lance Taylor  <iant@google.com>
8898
8899         PR 10980
8900         * options.h (class General_options): Add --undefined-version.
8901         * script.cc (struct Version_expression): Add was_matched_by_symbol
8902         field.
8903         (Version_script_info::matched_symbol): New function.
8904         (Version_script_info::get_symbol_version_helper): Call
8905         matched_symbol.
8906         (Version_script_info::check_unmatched_names): New function.
8907         * script.h (class Version_script_info): Update declarations.
8908         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8909
8910         * options.h (class General_options): Use DEFINE_bool_alias for
8911         allow_multiple_definition.
8912         * resolve.cc (Symbol_table::should_override): Don't test
8913         allow_multiple_definition.
8914
8915         PR 10980
8916         * options.h (class General_options): Add --cref.
8917         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8918         until after printing cref table.
8919         * cref.cc: Include "symtab.h".
8920         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8921         (Cref_table_compare::operator()): New function.
8922         (Cref_inputs::gather_cref): New function.
8923         (filecol): New static const.
8924         (Cref_inputs::print_cref): New function.
8925         (Cref::print_cref): New function.
8926         * cref.h: Include <cstdio>.
8927         (class Cref): Update declarations.
8928         * mapfile.h (Mapfile::file): New function.
8929         * object.h (class Object): Define Symbols.  Declare virtual
8930         do_get_global_symbols.
8931         (Object::get_global_symbols): New function.
8932         * object.cc (Input_objects::add_object): Pass object to cref_ if
8933         --cref.
8934         (Input_objects::archive_start): Likewise.
8935         (Input_objects::archive_stop): Likewise.
8936         (Input_objects::print_cref): New function.
8937         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8938         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8939         --cref.
8940         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8941         function.
8942         * plugin.h (class Sized_pluginobj): Update declarations.
8943
8944 2010-01-05  Ian Lance Taylor  <iant@google.com>
8945
8946         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8947         to is_default_version.  Rename insdef to insdefault.
8948         (Symbol_table::add_from_relobj): Rename def to is_default_version
8949         and local to is_forced_local.
8950         (Symbol_table::add_from_pluginobj): Likewise.
8951         (Symbol_table::add_from_dynobj): Likewise.
8952         (Symbol_table::define_special_symbol): Rename insdef to
8953         insdefault.
8954
8955 2010-01-04  Ian Lance Taylor  <iant@google.com>
8956
8957         PR 10980
8958         * options.h (class General_options): Add
8959         --allow-multiple-definition and -z muldefs.
8960         * resolve.cc (Symbol_table::should_override): Don't warn about a
8961         multiple symbol definition if --allow-multiple-definition or -z
8962         muldefs.
8963
8964         PR 10980
8965         * options.h (class General_options): Add --add-needed and
8966         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8967         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8968         error if --copy-dt-needed-entries aka --add-needed is used and
8969         would cause a change in behaviour.
8970
8971         PR 10980
8972         * options.h (class General_options): Add -G as a short version of
8973         --shared.  Add no-op options -assert, -g, and -i.
8974
8975 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8976
8977         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8978         check for .text or .gnu.linkonce.t sections.
8979         * icf.cc (Icf::find_identical_sections): Ditto.
8980         Change the detection for mangled function name within the section
8981         name.
8982         * icf.h (is_section_foldable_candidate): New function.
8983
8984 2009-12-30  Ian Lance Taylor  <iant@google.com>
8985
8986         PR 10980
8987         * options.h (class General_options): Permit two dashes with
8988         --retain-symbols-file.
8989
8990 2009-12-30  Ian Lance Taylor  <iant@google.com>
8991
8992         PR 10979
8993         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8994         don't put the file header and segment headers in the text
8995         segment.
8996
8997         PR 10979
8998         * common.cc (Sort_commons::operator()): Stabilize sort when both
8999         entries are NULL.
9000         (Symbol_table::do_allocate_commons_list): When allocating common
9001         symbols, skip a symbol which is no longer common.
9002         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9003         an object before checking its type.
9004         * testsuite/common_test_2.c: New file.
9005         * testsuite/common_test_3.c: New file.
9006         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9007         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9008         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9009         (common_test_2_pic.o, common_test_2.so): New targets.
9010         (common_test_3_pic.o, common_test_3.so): New targets.
9011         * testsuite/Makefile.in: Rebuild.
9012
9013         PR 10979
9014         * script.cc (read_input_script): If we see a new SECTIONS clause,
9015         and we have added an input section, give an error.
9016         * layout.h (class Layout): Add have_added_input_section function.
9017         Add have_added_input_section_ field.
9018         * layout.cc (Layout::Layout): Initialize
9019         have_added_input_section_.
9020         (Layout::layout): Set have_added_input_section_.
9021         (Layout::layout_eh_frame): Likewise.
9022
9023 2009-12-30  Ian Lance Taylor  <iant@google.com>
9024
9025         PR 10931
9026         * options.h (class General_options): Add --sort-common option.
9027         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9028         * common.cc (Sort_common): Add sort_order parameter to
9029         constructor.  Add sort_order_ field.
9030         (Sort_commons::operator): Check sort_order_.
9031         (Symbol_table::allocate_commons): Determine the sort order.
9032         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9033         Change all callers.
9034         (Symbol_table::do_allocate_commons_list): Likewise.
9035
9036 2009-12-30  Ian Lance Taylor  <iant@google.com>
9037
9038         PR 10916
9039         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9040         symbols from this object, don't change the visibility of an
9041         undefined symbol.
9042         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9043
9044 2009-12-30  Ian Lance Taylor  <iant@google.com>
9045
9046         PR 10861
9047         * script.h (class Version_script_info): Define Language enum.
9048         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9049         new fields globals_, locals_, and is_finalized_.
9050         * script.cc: Various formatting fixes.
9051         (class Parser_closure): Change language_stack_ from a vector of
9052         std::string to one of Version_script_info::Language.  Adjust all
9053         uses accordingly.
9054         (class Lazy_demangler): Remove.
9055         (struct Version_expression): Change language from std::string to
9056         Version_script_info::Language.
9057         (Version_script_info::Version_script_info): New function.
9058         (Version_script_info::~Version_script_info): Don't call clear.
9059         (Version_script_info::finalize): New function.
9060         (Version_script_info::build_lookup_tables): New function.
9061         (Version_script_info::build_expression_list_lookup): New
9062         function.
9063         (Version_script_info::get_symbol_version_helper): Rewrite to use
9064         lookup tables.
9065         (Version_script_info::print_expression_list): Adjust to use
9066         Version_script_info::Language.
9067         (script_push_lex_into_version_mode): Check that the version script
9068         has not been finalized.
9069         (version_script_push_lang): Change language string to
9070         Version_script_info::Language.
9071         * options.cc (Command_line::version_script): New function.
9072         * options.h (class General_options): Add finalize_dynamic_list
9073         function.  Change version_script from declaration to definition.
9074         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9075         * testsuite/version_script.map: Remove duplicate def of foo.
9076         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9077         version_script.map.
9078         * testsuite/Makefile.in: Rebuild.
9079
9080 2009-12-30  Ian Lance Taylor  <iant@google.com>
9081
9082         PR 10843
9083         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9084         if the input symbol index is 0, make the output symbol index 0.
9085
9086 2009-12-30  Ian Lance Taylor  <iant@google.com>
9087
9088         PR 10670
9089         * options.h (class General_options): Add -x/--discard-all.
9090         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9091         --discard-all.  If the local symbol needs a dynamic entry, check
9092         that before handling --discard-locals.
9093
9094 2009-12-30  Ian Lance Taylor  <iant@google.com>
9095
9096         PR 10450
9097         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9098         flags to PF_R.
9099         (Output_segment::add_output_section): Don't change the flags if
9100         the type is PT_TLS.
9101
9102         PR 10450
9103         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9104         GNU hash table if they need a dynamic value.  Otherwise, don't add
9105         them if they are defined in a dynamic object or are forced local.
9106
9107 2009-12-29  Ian Lance Taylor  <iant@google.com>
9108
9109         PR 10450
9110         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9111         .gnu.hash table for a 32-bit target.
9112
9113         PR 10450
9114         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9115         regular and a dynamic object only needs a dynamic symbol table
9116         entry if it is externally visible.
9117
9118         PR 10450
9119         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9120         constructor.  Add global_offset_table_ field.
9121         (Target_i386::got_section): Set global_offset_table_.
9122         (Target_i386::do_finalize_sections): Set global_offset_table_
9123         size.
9124         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9125         in constructor.  Add global_offset_table_ field.
9126         (Target_x86_64::got_section): Set global_offset_table_.
9127         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9128         size.
9129
9130         * layout.cc (Layout::Layout): Initialize increase_relro_.
9131         (Layout::get_output_section): Add is_relro, is_last_relro, and
9132         is_first_non_relro parameters.  Change all callers.
9133         (Layout::choose_output_section): Likewise.
9134         (Layout::add_output_section_data): Likewise.
9135         (Layout::make_output_section): Likewise.
9136         (Layout::set_segment_offsets): Clear increase_relro when using a
9137         linker script.
9138         * layout.h (class Layout): Add increase_relro method.  Add
9139         increase_relro_ field.  Update declarations.
9140         * output.cc (Output_section::Output_section): Initialize
9141         is_last_relro_ and is_first_non_relro_.
9142         (Output_segment::add_output_section): Group relro sections is
9143         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9144         (Output_segment::maximum_alignment): Remove relro handling.
9145         (Output_segment::set_section_addresses): Add increase_relro
9146         parameter.  Change all callers.  Add initial alignment to align
9147         relro sections on separate page.  Remove old relro handling.
9148         (Output_segment::set_section_list_addresses): Remove in_relro
9149         parameter.  Change all callers.
9150         (Output_segment::set_offset): Add increase parameter.  Change all
9151         callers.  Remove old relro handling.
9152         * output.h (class Output_section): Add new methods: is_last_relro,
9153         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9154         Add is_last_relro_ and is_first_non_relro_ fields.
9155         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9156         Create separate .got.plt section.  Call increase_relro.
9157         * x86_64.cc (Target_x86_64::got_section): Likewise.
9158         * testsuite/relro_script_test.t: Add .got.plt.
9159
9160         PR 10450
9161         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9162         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9163         (Layout::finalize): Call set_dynamic_symbol_size.
9164         (Layout::set_dynamic_symbol_size): New function.
9165         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9166         set_dynamic_symbol_size.
9167
9168         PR 10450
9169         * output.h (class Output_section): Add is_entsize_zero_ field.
9170         * output.cc (Output_section::Output_section): Initialize
9171         is_entsize_zero_.
9172         (Output_section::set_entsize): If two different entsizes are
9173         requested, force it to zero.
9174         (Output_section::add_input_section): Set flags for .debug_str
9175         before updating section flags.  Set entsize.
9176         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9177         and SHF_STRING if all input sections have those flags.
9178
9179 2009-12-29   Rafael Espindola  <espindola@google.com>
9180
9181         * main.cc (main): Fix the sys time reporting.
9182         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9183         reporting.
9184
9185 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9186
9187         * options.cc (General_options::parse_version): Allow -v to exit
9188         without an error if there is nothing to link.
9189
9190 2009-12-29  Ian Lance Taylor  <iant@google.com>
9191
9192         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9193         using a version of gcc before 4.1.
9194         * configure: Rebuild.
9195
9196 2009-12-28  Chris Demetriou  <cgd@google.com>
9197
9198         * attributes.cc (Output_attributes_section_data::do_write): Use
9199         std::vector::front rather than std::vector::data.
9200
9201 2009-12-28  Ian Lance Taylor  <iant@google.com>
9202
9203         * symtab.h (class Symbol_table): Add enum Defined.
9204         * resolve.cc (Symbol_table::should_override): Add defined
9205         parameter.  Change all callers.  Test whether object is NULL
9206         before calling a method on it.
9207         (Symbol_table::report_resolve_problem): Add defined parameter.
9208         Change all callers.
9209         (Symbol_table::should_override_with_special): Likewise.
9210         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9211         parameter.  Change all callers.
9212         (Symbol_table::do_define_in_output_data): Likewise.
9213         (Symbol_table::define_in_output_segment): Likewise.
9214         (Symbol_table::do_define_in_output_segment): Likewise.
9215         (Symbol_table::define_as_constant): Likewise.
9216         (Symbol_table::do_define_as_constant): Likewise.
9217         * script.h (class Symbol_assignment): Add is_defsym parameter to
9218         constructor; change all callers.
9219         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9220         parameter.  Change all callers.  Add is_defsym_ field.
9221         (class Parser_closure): Add parsing_defsym parameter to
9222         constructor; change all callers.  Add parsing_defsym accessor
9223         function.  Add parsing_defsym_ field.
9224
9225 2009-12-28  Ian Lance Taylor  <iant@google.com>
9226
9227         * gold.cc (queue_middle_tasks): Fix formatting.
9228         * object.cc (Relobj::is_section_name_included): Likewise.
9229
9230 2009-12-23  Ian Lance Taylor  <iant@google.com>
9231
9232         * i386.cc (Target_i386::do_calls_non_split): Recognize
9233         -fsplit-stack prologue for a function with a static chain.
9234         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9235         -fsplit-stack prologue when using %r11.
9236
9237 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9238
9239         * options.cc (General_options::parse_version): Make -v continue and do
9240         the link like GNU ld does.
9241
9242 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9243
9244         * Makefile.am (CCFILES): Add timer.cc.
9245         (HFILES): Add timer.h.
9246         * configure.ac: Check for sysconf and times.
9247         * main.cc: include timer.h.
9248         (main): Use Timer instead of get_run_time.
9249         * timer.cc: New.
9250         * timer.h: New.
9251         * workqueue.cc: include timer.h.
9252         (Workqueue::find_and_run_task):
9253         Report user, sys and wall time.
9254         * Makefile.in: Regenerate.
9255         * config.in: Regenerate.
9256         * configure: Regenerate.
9257
9258 2009-12-16  Doug Kwan  <dougkwan@google.com>
9259
9260         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9261         sections.
9262         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9263         relaxed input sections.
9264         * output.cc (Output_section::find_relaxed_input_section): Change
9265         return type to Output_relaxed_input_section pointer.  Adjust code
9266         for new type of relaxed_input_section_map_.
9267         * output.h (Output_section::find_relaxed_input_section): Change
9268         return type to Output_relaxed_input_section pointer.
9269         (Output_section::Output_relaxed_input_section_by_input_section_map):
9270         New type.
9271         (Output_section::relaxed_input_section_map_): Change type to
9272         Output_section::Output_relaxed_input_section_by_input_section_map.
9273         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9274         input section.
9275
9276 2009-12-15  Ian Lance Taylor  <iant@google.com>
9277
9278         * layout.cc (Layout::create_shstrtab): Only write out after input
9279         sections if we are compressing debug sections.
9280
9281 2009-12-15  Ian Lance Taylor  <iant@google.com>
9282
9283         * archive.cc (Archive::add_symbols): Only look up a symbol without
9284         a version if there is, in fact, a version.
9285
9286 2009-12-14  Ian Lance Taylor  <iant@google.com>
9287
9288         Revert -Wshadow changes, all changes from:
9289         2009-12-11  Doug Kwan  <dougkwan@google.com>
9290         2009-12-11  Nick Clifton  <nickc@redhat.com>
9291         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9292
9293 2009-12-11  Doug Kwan  <dougkwan@google.com>
9294
9295         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9296         due to -Wshadow.
9297         * attributes.cc (Object_attribute::size): Ditto.
9298         (Attributes_section_data::size): Ditto.
9299         (Attributes_section_data::Attributes_section_data): Ditto.
9300         (Output_attributes_section_data::do_write): Ditto.
9301         * attributes.h (Object_attribute::set_type): Ditto.
9302         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9303
9304 2009-12-11  Nick Clifton  <nickc@redhat.com>
9305
9306         * archive.cc: Fix shadowed variable warnings.
9307         * arm.cc: Likewise.
9308         * compressed_output.cc: Likewise.
9309         * compressed_output.h: Likewise.
9310         * configure: Likewise.
9311         * dwarf_reader.cc: Likewise.
9312         * dynobj.cc: Likewise.
9313         * dynobj.h: Likewise.
9314         * ehframe.cc: Likewise.
9315         * ehframe.h: Likewise.
9316         * errors.cc: Likewise.
9317         * expression.cc: Likewise.
9318         * fileread.cc: Likewise.
9319         * fileread.h: Likewise.
9320         * freebsd.h: Likewise.
9321         * i386.cc: Likewise.
9322         * icf.cc: Likewise.
9323         * incremental.h: Likewise.
9324         * layout.cc: Likewise.
9325         * layout.h: Likewise.
9326         * mapfile.cc: Likewise.
9327         * merge.cc: Likewise.
9328         * merge.h: Likewise.
9329         * object.cc: Likewise.
9330         * object.h: Likewise.
9331         * options.h: Likewise.
9332         * output.cc: Likewise.
9333         * output.h: Likewise.
9334         * parameters.cc: Likewise.
9335         * plugin.cc: Likewise.
9336         * powerpc.cc: Likewise.
9337         * reduced_debug_output.cc: Likewise.
9338         * reduced_debug_output.h: Likewise.
9339         * reloc.cc: Likewise.
9340         * reloc.h: Likewise.
9341         * resolve.cc: Likewise.
9342         * script-sections.cc: Likewise.
9343         * script.cc: Likewise.
9344         * script.h: Likewise.
9345         * sparc.cc: Likewise.
9346         * symtab.cc: Likewise.
9347         * symtab.h: Likewise.
9348         * target-select.cc: Likewise.
9349         * target-select.h: Likewise.
9350         * token.h: Likewise.
9351         * workqueue.cc: Likewise.
9352         * workqueue.h: Likewise.
9353         * x86_64.cc: Likewise.
9354
9355 2009-12-10  Doug Kwan  <dougkwan@google.com>
9356
9357         * arm.cc (attributes.h): New include.
9358         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9359         (Arm_relobj::~Arm_relobj): Delete object pointed by
9360         attributes_section_data_.
9361         (Arm_relobj::attributes_section_data): New method definition.
9362         (Arm_relobj::attributes_section_data_): New data member declaration.
9363         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9364         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9365         attributes_section_data_.
9366         (Arm_dynobj::attributes_section_data): New method definition.
9367         (Arm_dynobj::attributes_section_data_): New data member declaration.
9368         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9369         initialization value of may_use_blx_ to false.
9370         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9371         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9372         object attributes to compute results instead of hard-coding.
9373         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9374         Target_arm::get_secondary_compatible_arch,
9375         Target_arm::set_secondary_compatible_arch
9376         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9377         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9378         New method declarations.
9379         (Target_arm::get_aeabi_object_attribute): New method definition.
9380         (Target_arm::attributes_section_data_): New data member declaration.
9381         (read_arm_attributes_section): New template definition.
9382         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9383         (Arm_dynobj::do_read_symbols): Ditto.
9384         (Target_arm::do_finalize_sections): Merge attributes sections from
9385         input.  Check for BLX use after attributes section merging.
9386         Fix __exidx_start and __exidx_end visibility.  Create an
9387         .ARM.attributes section if necessary.
9388         (Target_arm::get_secondary_compatible_arch,
9389         Target_arm::set_secondary_compatible_arch,
9390         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9391         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9392         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9393         New method definitions.
9394
9395 2009-12-09  Ian Lance Taylor  <iant@google.com>
9396
9397         * plugin.cc (Plugin::load): Don't cast from void* to a function
9398         pointer.
9399
9400 2009-12-09  Ian Lance Taylor  <iant@google.com>
9401
9402         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9403         information fields.
9404
9405 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9406
9407         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9408         Replace two_file_shared_1.so with two_file_shared_2.so.
9409         * testsuite/Makefile.in: Regenerated.
9410
9411 2009-12-08  Doug Kwan  <dougkwan@google.com>
9412
9413         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9414         (HFILES): Add attributes.h and int_encoding.h.
9415         * Makefile.in: Regenerate.
9416         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9417         function definitions to int_encoding.cc
9418         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9419         prototypes to int_encoding.h
9420         * reduced_debug_output.cc (int_encoding.h): New include.
9421         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9422         function definitions to int_encoding.cc
9423         (insert_into_vector, read_from_pointer): Move template definitions to
9424         int_encoding.h
9425         * attributes.cc: New file.
9426         * attributes.h: New file.
9427         * int_encoding.cc: New file.
9428         * int_encoding.h: New file.
9429
9430 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9431
9432         PR gold/11055
9433         * incremental-dump.cc (dump_incremental_inputs): New.
9434         (main): Use dump_incremental_inputs.
9435
9436 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9437
9438         PR gold/10893
9439         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9440         checking elfcpp::STT_FUNC.
9441         (Target_i386::Relocate::relocate): Likewise.
9442         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9443
9444         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9445         symbols from shared libraries into normal FUNC symbols.
9446
9447         * symtab.h (Symbol): Add is_func and use it.
9448
9449 2009-12-05  Doug Kwan  <dougkwan@google.com>
9450
9451         * arm.cc (Target_arm::arm_info): Initialize new fields
9452         attributes_section and attributes_vendor.
9453         * i386.cc (Target_i386::i386_info): Same.
9454         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9455         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9456         fields attributes_section and attributes_vendor.
9457         * sparc.cc (Target_sparc::sparc_info): Same.
9458         * target.h (Target::attributes_section, Target::attributes_vendor,
9459         Target::is_attributes_section, Target::attribute_arg_type,
9460         Target::attributes_order): New method definitions.
9461         (Target::Target_info::attributes_section,
9462         Target::Target_info::attributes_vendor): New fields.
9463         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9464         virtual method definitions.
9465         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9466         attributes_section and attributes_vendor.
9467         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9468
9469 2009-12-05  Doug Kwan  <dougkwan@google.com>
9470
9471         * arm.cc: Update comments about interworking and stub generation.
9472         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9473         considered as non-PIC.
9474         (Arm_relocate_functions::base_abs): Fix formatting.
9475         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9476         of function to use GOT entry address instead of offset.
9477         (Target_arm::Scan::global): Issue an error if a symbol would need a
9478         PLT does not get one because it is untyped.  Remove code to create
9479         dynamic symbols for relative branches.
9480         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9481         takes unsigned integer instead of boolean.
9482
9483 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9484
9485         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9486         (two_file_test_LDADD): Likewise.
9487         (common_test_1_LDADD): Likewise.
9488         (exception_test_LDADD) Likewise.
9489         (weak_test_LDADD): Likewise.
9490         (many_sections_test_LDADD): Likewise.
9491         (initpri1_LDADD): Likewise.
9492         (script_test_1_LDADD): Likewise.
9493         (script_test_2_LDADD): Likewise.
9494         (justsyms_LDADD): Likewise.
9495         (binary_test_LDADD): Likewise.
9496         (large_LDADD): Likewise.
9497         * testsuite/Makefile.in: Regenerated.
9498
9499 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9500
9501         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9502         (Symbol_table::override_with_special): Likewise.
9503         (Symbol_table::add_from_object): Likewise.
9504
9505 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9506
9507         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9508         Don't set the data_offset twice.
9509
9510 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9511
9512         * testsuite/Makefile.in: Regenerate.
9513
9514 2009-12-03  Doug Kwan  <dougkwan@google.com>
9515
9516         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9517         (Target_arm::do_finalize_sections): Add parameter for symbol table
9518         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9519         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9520         parameter for symbol table pointer.
9521         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9522         an additional parameter for a pointer to symbol table.
9523         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9524         parameter for a symbol table pointer.
9525         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9526         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9527         Ditto.
9528         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9529         parameter for a symbol table pointer.
9530
9531 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9532
9533         * incremental.cc (Incremental_inputs_header)
9534         (Incremental_inputs_header_write, Incremental_inputs_entry)
9535         (Incremental_inputs_entry_write): Move ...
9536         * incremental.h (Incremental_inputs_header)
9537         (Incremental_inputs_header_write, Incremental_inputs_entry)
9538         (Incremental_inputs_entry_write): here.
9539
9540 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9541
9542         * incremental.cc (make_sized_incremental_binary): Set the target.
9543         Error if it is incompatible.
9544         * output.h (Output_file): Add filename method.
9545
9546 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9547
9548         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9549         from the get_* methods.
9550
9551 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9552
9553         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9554         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9555         Write 0 for the data_offset of scripts.
9556
9557 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9558
9559         * testsuite/Makefile.am: Add the incremental_test.sh test.
9560         * testsuite/incremental_test.sh: New.
9561         * testsuite/incremental_test_1.c: New.
9562         * testsuite/incremental_test_2.c: New.
9563
9564 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9565
9566         * incremental-dump.cc (main): Fix typos.
9567
9568 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9569
9570         PR gold/11025
9571         * incremental-dump.cc (main): Use llu to print 64 bit values.
9572
9573 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9574             H.J. Lu  <hongjiu.lu@intel.com>
9575
9576         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9577         $(LIBDL).
9578         (incremental_dump_LDADD): Likewise.
9579         * Makefile.in: Regenerated.
9580
9581 2009-11-25  Doug Kwan  <dougkwan@google.com>
9582
9583         Revert:
9584
9585         2009-11-25  Doug Kwan  <dougkwan@google.com>
9586
9587                 * arm.cc (Target_arm::Target_arm): Move method definition
9588                 outside of class definition.  Add code to handle
9589                 --target1-rel, --target1-abs and --target2= options.
9590                 (Target_arm::get_reloc_reloc_type): Change method to be
9591                 non-static and const.
9592                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9593                 New data member declaration.
9594                 (Target_arm::Scan::local, Target_arm::Scan::global,
9595                 Target_arm::Relocate::relocate,
9596                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9597                 Adjust call to Target_arm::get_real_reloc_type.
9598                 (Target_arm::get_real_reloc_type): Use command line options
9599                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9600                 * options.h (--target1-rel, --target1-abs, --target2): New
9601                 ARM-only options.
9602
9603 2009-11-25  Doug Kwan  <dougkwan@google.com>
9604
9605         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9606         class definition.  Add code to handle --target1-rel, --target1-abs
9607         and --target2= options.
9608         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9609         and const.
9610         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9611         member declaration.
9612         (Target_arm::Scan::local, Target_arm::Scan::global,
9613         Target_arm::Relocate::relocate,
9614         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9615         call to Target_arm::get_real_reloc_type.
9616         (Target_arm::get_real_reloc_type): Use command line options to
9617         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9618         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9619         options.
9620
9621 2009-11-25  Doug Kwan  <dougkwan@google.com>
9622
9623         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9624         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9625         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9626         formatting.
9627         (Arm_relocate_functions::thm_call): Replace body with a call to
9628         Arm_relocate_functions::thumb_branch_common.
9629         (Arm_relocate_functions::thm_jump24,
9630         Arm_relocate_functions::thm_xpc22): New method definitions.
9631         (Arm_relocate_functions::thumb_branch_common): New method definition.
9632         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9633         operator.
9634         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9635         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9636
9637 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9638
9639         * Makefile.am: Build incremental-dump
9640         * Makefile.in: Regenerate.
9641         * incremental-dump.cc: New.
9642         * incremental.cc (Incremental_inputs_header_data,
9643         Incremental_inputs_entry_data): Move to incremental.h
9644         * incremental.h: (Incremental_inputs_header_data,
9645         Incremental_inputs_entry_data): Move from incremental.cc
9646
9647 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9648
9649         * incremental.cc (Incremental_inputs_header,
9650         Incremental_inputs_header_write, Incremental_inputs_entry,
9651         Incremental_inputs_entry_write): Add a typedef with the data type.
9652
9653 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9654
9655         * incremental.cc (Incremental_inputs_header,
9656         Incremental_inputs_header_write, Incremental_inputs_entry,
9657         Incremental_inputs_entry_write): Update comment about which
9658         type has the filed descriptions.
9659
9660 2009-11-15  Doug Kwan  <dougkwan@google.com>
9661
9662         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9663         (Arm_relocate_functions::arm_branch_common): Change method defintion
9664         in class definition to a method declaration and update list of formal
9665         parameters.
9666         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9667         Arm_relocation_functions::jump24): Adjust call to
9668         Arm_relocate_functions::arm_branch_common.  Update list of formal
9669         parameters.
9670         (Arm_relocate_functions::xpc25): New method definition.
9671         (Arm_relocate_functions::arm_branch_common): Move method defintion
9672         out from class definition.  Use stubs for mode-switching and extending
9673         branch ranges.
9674         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9675         specially.  Change code to enable use of stubs in ARM branches.
9676
9677 2009-11-10  Doug Kwan  <dougkwan@google.com>
9678
9679         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9680         in method declaration.
9681         (Target_arm::relocate_stub): New method declaration.
9682         (Target_arm::default_target): Change to return a pointer instead of
9683         a const reference.
9684         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9685         Target_arm::default_target.
9686         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9687         method definition.
9688         (Target_arm::relocate_section): Adjust view.
9689         (Target_arm::relocate_stub): New method definition.
9690
9691 2009-11-10  Doug Kwan  <dougkwan@google.com>
9692
9693         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9694         a format warning.
9695         * incremental.cc (open_incremental_binary): Initialized local
9696         variables to avoid warnings.
9697         * object.cc (make_elf_object): Ditto.
9698         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9699         a format warning.
9700
9701 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9702
9703         PR gold/10930
9704         * testsuite/plugin_test.c: Include "config.h".
9705
9706 2009-11-09  Doug Kwan  <dougkwan@google.com>
9707
9708         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9709         (arm_symbol_value): Remove.
9710         (Arm_relocate_functions::arm_branch_common,
9711         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9712         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9713         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9714         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9715         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9716         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9717         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9718         Arm_relocate_functions::thm_mobw_abs_nc,
9719         Arm_relocate_functions::thm_mov_abs,
9720         Arm_relocate_functions::movw_prel_nc,
9721         Arm_relocate_functions::thm_movt_abs,
9722         Arm_relocate_functions::movt_prel,
9723         Arm_relocate_functions::thm_movw_prel_nc,
9724         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9725         (Target_arm::Relocate::relocate): Only decompose address into two
9726         parts if relocation type uses the thumb-bit and pass the actual
9727         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9728         calls to methods in Arm_relocate_functions for this change.
9729
9730 2009-11-08  Ian Lance Taylor  <iant@google.com>
9731
9732         PR 10925
9733         * reloc.cc: Instantiate
9734         Sized_relobj::initialize_input_to_output_maps and
9735         Sized_relobj:free_input_to_output_maps.
9736
9737 2009-11-06  Ian Lance Taylor  <iant@google.com>
9738
9739         PR 10876
9740         * defstd.cc (in_segment): Set only_if_ref true for "end".
9741
9742 2009-11-06  Doug Kwan  <dougkwan@google.com>
9743
9744         * arm.cc (class Reloc_stub): Correct a comment.
9745         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9746         (Target_arm::scan_section_for_stubs): New method declaration.
9747         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9748         Change methods from private to protected.
9749         (Target_arm::do_may_relax): New method definition.
9750         (Target_arm::do_relax, Target_arm::group_sections,
9751         Target_arm::scan_reloc_for_stub,
9752         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9753         (Target_arm::arm_input_section_map_): New data member declaration.
9754         (Target_arm::scan_reloc_for_stub,
9755         Target_arm::scan_reloc_section_for_stubs,
9756         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9757         Target_arm::do_relax): New method definitions.
9758
9759 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9760
9761         * configure.ac: Check for (struct stat)::st_mtim
9762         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9763         * config.in: Regenerate.
9764         * configure: Regenerate.
9765
9766 2009-11-05  Ian Lance Taylor  <iant@google.com>
9767
9768         PR 10910
9769         * output.cc (Output_segment::add_output_section): Add missing
9770         return statement.
9771
9772 2009-11-04  Ian Lance Taylor  <iant@google.com>
9773
9774         PR 10880
9775         * object.h (class Object): Add is_needed and set_is_needed
9776         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9777         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9778         defined in a dynamic object and referenced by a regular object,
9779         set is_needed for the dynamic object.
9780         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9781         if the file is marked with as_needed and it is not needed.
9782
9783 2009-11-04  Ian Lance Taylor  <iant@google.com>
9784
9785         PR 10887
9786         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9787         tags if data is discarded by linker script.
9788         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9789         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9790         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9791         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9792
9793 2009-11-04  Ian Lance Taylor  <iant@google.com>
9794
9795         * layout.cc (Layout::get_output_section): Add is_interp and
9796         is_dynamic_linker_section parameters.  Change all callers.
9797         (Layout::choose_output_section): Likewise.
9798         (Layout::make_output_section): Likewise.
9799         (Layout::add_output_section_data): Add is_dynamic_linker_section
9800         parameter.  Change all callers.
9801         * layout.h (class Layout): Update declarations.
9802         * output.h (class Output_section): Add is_interp, set_is_interp,
9803         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9804         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9805         generate_code_fills_at_write_ to a bitfield.
9806         * output.cc (Output_section::Output_sections): Initialize new
9807         fields.
9808         (Output_segment::add_output_section): Add do_sort parameter.
9809         Change all callers.
9810
9811 2009-11-03  Ian Lance Taylor  <iant@google.com>
9812
9813         PR 10860
9814         * options.h (class General_options): Add --warn-common.
9815         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9816         merging two common symbols.
9817         (Symbol_table::should_override): Handle --warn-common when merging
9818         a common symbol with a defined symbol.  Use report_resolve_problem
9819         for multiple definitions.
9820         (Symbol_table::report_resolve_problem): New function.
9821         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9822
9823 2009-11-03  Doug Kwan  <dougkwan@google.com>
9824
9825         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9826         stub_factory_.
9827         (Target_arm::stub_factory): New method definition.
9828         (Target_arm::new_arm_input_section,
9829         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9830         Target_arm::reloc_uses_thumb_bit): New method declarations.
9831         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9832         New type definitions.
9833         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9834         member declarations.
9835         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9836         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9837         New method definitions.
9838
9839 2009-11-03  Ian Lance Taylor  <iant@google.com>
9840
9841         * options.h (class General_options): Add --warn_constructors.
9842
9843 2009-11-03  Ian Lance Taylor  <iant@google.com>
9844
9845         PR 10893
9846         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9847         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9848
9849 2009-11-03  Ian Lance Taylor  <iant@google.com>
9850
9851         PR 10895
9852         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9853         --msgid-bugs-address.
9854         (install-pdf): New target.
9855         (install-data_yes): Look up one directory to find mkinstalldirs.
9856
9857 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9858
9859         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9860         tree.
9861
9862 2009-10-30  Doug Kwan  <dougkwan@google.com>
9863
9864         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9865
9866 2009-10-30  Doug Kwan  <dougkwan@google.com>
9867
9868         * arm.cc (Stub_addend_reader): New struct template definition
9869         and partial specializations.
9870         (Stub_addend_reader::operator()): New method definition for a
9871         partially specialized template.
9872
9873 2009-10-30  Doug Kwan  <dougkwan@google.com>
9874
9875         * arm.cc (Arm_relobj::processor_specific_flags): New method
9876         definition.
9877         (Arm_relobj::do_read_symbols): New method declaration.
9878         (Arm_relobj::processor_specific_flags_): New data member declaration.
9879         (Arm_dynobj): New class definition.
9880         (Target_arm::do_finalize_sections): Add input_objects parameter.
9881         (Target_arm::do_adjust_elf_header): New method declaration.
9882         (Target_arm::are_eabi_versions_compatible,
9883         (Target_arm::merge_processor_specific_flags): New method declaration.
9884         (Target_arm::do_make_elf_object): New overloaded method definitions
9885         and declaration.
9886         (Arm_relobj::do_read_symbols): New method definition.
9887         (Arm_dynobj::do_read_symbols): Ditto.
9888         (Target_arm::do_finalize_sections): Add input_objects parameters.
9889         Merge processor-specific flags from all input objects.
9890         (Target_arm::are_eabi_versions_compatible,
9891         Target_arm::merge_processor_specific_flags,
9892         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9893         New method definitions.
9894         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9895         Input_objects pointer type parameter.
9896         * layout.cc (Layout::finalize): Pass input objects to target's.
9897         finalize_sections function.
9898         * output.cc (Output_file_header::do_sized_write): Set ELF file
9899         header's processor-specific flags.
9900         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9901         Input_objects pointer type parameter.
9902         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9903         * target.h (Input_objects): New forward class declaration.
9904         (Target::processor_specific_flags,
9905         Target::are_processor_specific_flags_sect): New method definitions.
9906         (Target::finalize_sections): Add input_objects parameter.
9907         (Target::Target): Initialize processor_specific_flags_ and
9908         are_processor_specific_flags_set_.
9909         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9910         parameter.
9911         (Target::set_processor_specific_flags): New method definition.
9912         (Target::processor_specific_flags_,
9913         Target::are_processor_specific_flags_set_): New data member
9914         declarations.
9915         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9916         Input_objects pointer type parameter.
9917
9918 2009-10-30  Doug Kwan  <dougkwan@google.com>
9919
9920         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9921
9922 2009-10-28  Ian Lance Taylor  <iant@google.com>
9923
9924         * object.h (class Relobj): Drop options parameter from
9925         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9926         do_scan_relocs, do_relocate.  Change all callers.
9927         (class Sized_relobj): Drop options parameters from
9928         do_gc_process_relocs, do_scan_relocs, do_relocate,
9929         do_relocate_sections, relocate_sections, emit_relocs_scan,
9930         emit_relocs_scan_reltype.  Change all callers.
9931         (struct Relocate_info): Remove options field and all references to
9932         it.
9933         * reloc.h (class Read_relocs): Remove options constructor
9934         parameter and options_ field.  Change all callers.
9935         (class Gc_process_relocs, class Scan_relocs): Likewise.
9936         (class Relocate_task): Likewise.
9937         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9938         all callers.
9939         (scan_relocatable_relocs): Likewise.
9940         * target.h (class Sized_target): Remove options parameter from
9941         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9942         all callers.
9943         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9944         callers.
9945         * arm.cc: Update functions to remove options parameters.
9946         * i386.cc: Likewise.
9947         * powerpc.cc: Likewise.
9948         * sparc.cc: Likewise.
9949         * x86_64.cc: Likewise.
9950         * testsuite/testfile.cc: Likewise.
9951
9952 2009-10-28  Doug Kwan  <dougkwan@google.com>
9953
9954         * arm.cc (Arm_relobj): New class definition.
9955         (Arm_relobj::scan_sections_for_stubs,
9956         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9957         New method definitions.
9958
9959 2009-10-28  Cary Coutant  <ccoutant@google.com>
9960
9961         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9962         (Plugin::cleanup_done_): New member.
9963         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9964         (Plugin_manager::cleanup_done_): Remove.
9965         (Plugin_manager::add_input_file): Edit error message.
9966         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9967         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9968
9969 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9970
9971         * fileread.cc: (File_read::View::~View): Use the new
9972         data_ownership_ filed.
9973         (File_read::~File_read): Dispose the new whole_file_view_.
9974         (File_read::open): Mmap the whole file if needed.
9975         (File_read::open): Use whole_file_view_ instead of contents_.
9976         (File_read::find_view): Use whole_file_view_ if applicable.
9977         (File_read::do_read): Use whole_file_view_ instead of contents_.
9978         (File_read::make_view): Use whole_file_view_ instead of contents_,
9979         update File_read::View::View call.
9980         (File_read::find_or_make_view): Update File_read::View::View
9981         call.
9982         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9983         remove contents_
9984         (File_read::View::Data_ownership): New enum.
9985         (File_read::View::View): Replace bool mapped_ with Data_ownership
9986         argument.
9987         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9988         (File_read::View::data_ownership_): New field.
9989         (File_read::contents_): Remove (replaced by whole_file_view_).
9990         (File_read::whole_file_view_): New field.
9991         * options.h (class General_options): Add --keep-files-mapped.
9992
9993 2009-10-27  Cary Coutant  <ccoutant@google.com>
9994
9995         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9996         * testsuite/Makefile.am (plugin_test_5): New test case.
9997         * testsuite/Makefile.in: Regenerate.
9998
9999 2009-10-25  Doug Kwan  <dougkwan@google.com>
10000
10001         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10002         from private to protected to allow access by child class.
10003         (Sized_relobj::do_relocate_sections): New method declaration.
10004         (Sized_relobj::relocate_sections): Virtualize.
10005         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10006         Sized_relobj::relocate_sections.  Instantiate template explicitly
10007         for different target sizes and endianity.
10008
10009 2009-10-24  Doug Kwan  <dougkwan@google.com>
10010
10011         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10012         (Arm_input_section::as_arm_input_section): New method.
10013         (Arm_output_section): New class definition.
10014         (Arm_output_section::create_stub_group,
10015         Arm_output_section::group_sections): New method definitions.
10016
10017 2009-10-22  Doug Kwan  <dougkwan@google.com>
10018
10019         * arm.cc (Arm_input_section): New class definition.
10020         (Arm_input_section::init, Arm_input_section:do_write,
10021         Arm_input_section::set_final_data_size,
10022         Arm_input_section::do_reset_address_and_file_offset): New method
10023         definitions.
10024
10025 2009-10-21  Doug Kwan  <dougkwan@google.com>
10026
10027         * arm.cc (Stub_table, Arm_input_section): New forward class
10028         declarations.
10029         (Stub_table): New class defintion.
10030         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10031         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10032         New method definition.
10033
10034 2009-10-21  Doug Kwan  <dougkwan@google.com>
10035
10036         * arm.cc: Update copyright comments.
10037         (Target_arm): New forward class template declaration.
10038         (Arm_address): New type.
10039         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10040         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10041         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10042         constants.
10043         (Insn_template): Same.
10044         (DEF_STUBS): New macro.
10045         (Stub_type): New enum type.
10046         (Stub_template): New class definition.
10047         (Stub): Same.
10048         (Reloc_stub): Same.
10049         (Stub_factory): Same.
10050         (Target_arm::Target_arm): Initialize may_use_blx_ and
10051         should_force_pic_veneer_.
10052         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10053         Target_arm::should_force_pic_veneer,
10054         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10055         Target_arm::using_thumb_only, Target_arm:;default_target): New
10056         method defintions.
10057         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10058         New data member declarations.
10059         (Insn_template::size, Insn_template::alignment): New method defintions.
10060         (Stub_template::Stub_template): New method definition.
10061         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10062         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10063         (Stub_factory::Stub_factory): New method definition.
10064         * gold.h (string_hash): New template.
10065         * output.h (Input_section_specifier::hash_value): Use
10066         gold::string_hash.
10067         (Input_section_specifier::string_hash): Remove.
10068         * stringpool.cc (Stringpool_template::string_hash): Use
10069         gold::string_hash.
10070
10071 2009-10-20  Doug Kwan  <dougkwan@google.com>
10072
10073         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10074         symbols of relaxed input sections.
10075         * output.h (Output_section::find_relaxed_input_section): Make
10076         method public.
10077
10078 2009-10-16  Doug Kwan  <dougkwan@google.com>
10079
10080         * dynobj.cc (Versions::Versions): Initialize version_script_.
10081         Only insert base version symbol definition for a shared object
10082         if version script defines any version versions.
10083         (Versions::define_base_version): New method definition.
10084         (Versions::add_def): Check that base version is not needed.
10085         (Versions::add_need): Define base version lazily.
10086         * dynobj.h (Versions::define_base_version): New method declaration.
10087         (Versions::needs_base_version_): New data member declaration.
10088         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10089         (check_DATA): Add no_version_test.stdout.
10090         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10091         New make rules.
10092         * testsuite/Makefile.in: Regenerate.
10093         * testsuite/no_version_test.c: New file.
10094         * testsuite/no_version_test.sh: Ditto.
10095
10096 2009-10-16  Doug Kwan  <dougkwan@google.com>
10097
10098         * expression.cc (class Segment_start_expression): New class definition.
10099         (Segment_start_expression::value): New method definition.
10100         (script_exp_function_segment_start): Return a new
10101         Segment_start_expression.
10102         * gold/script-c.h (script_saw_segment_start_expression): New function
10103         prototype.
10104         * script-sections.cc (Script_sections::Script_sections): Initialize
10105         SAW_SEGMENT_START_EXPRESSION_ to false.
10106         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10107         and -Tbbs options to specify section addresses if given in
10108         command line and no SEGMENT_START expression is seen in a script.
10109         * script-sections.h (Script_sections::saw_segment_start_expression,
10110         Script_sections::set_saw_segment_start_expression): New method
10111         definition.
10112         (Script_sections::saw_segment_start_expression_): New data member
10113         declaration.
10114         * script.cc (script_saw_segment_start_expression): New function.
10115         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10116         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10117         script_test_7.sh and script_test_8.sh.
10118         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10119         script_test_8.stdout.
10120         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10121         (script_test_6, script_test_6.stdout, script_test_7,
10122         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10123         * Makefile.in: Regenerate.
10124         * testsuite/script_test_6.sh: New file.
10125         * testsuite/script_test_6.t: Same.
10126         * testsuite/script_test_7.sh: Same.
10127         * testsuite/script_test_7.t: Same.
10128         * testsuite/script_test_8.sh: Same.
10129
10130 2009-10-16  Doug Kwan  <dougkwan@google.com>
10131
10132         * output.cc (Output_segment::set_section_list_address): Cast
10133         expressions to unsigned long long type to avoid format warnings.
10134
10135 2009-10-15  Ian Lance Taylor  <iant@google.com>
10136
10137         * script.cc (Script_options::add_symbol_assignment): Always add a
10138         dot assignment to script_sections_.
10139         * script-sections.cc (Script_sections::add_dot_assignment):
10140         Initialize if necessary.
10141
10142         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10143         program headers with no load segment if there is a linker script.
10144
10145         * layout.cc (Layout::set_segment_offsets): Align the file offset
10146         to the segment aligment for -N or -n with no load segment.
10147         * output.cc (Output_segment::add_output_section): Don't crash if
10148         the first section is a TLS section.
10149         (Output_segment::set_section_list_addresses): Print an error
10150         message if the address moves backward in a linker script.
10151         * script-sections.cc
10152         (Output_section_element_input::set_section_addresses): Don't
10153         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10154         (Orphan_output_section::set_section_addresses): Likewise.
10155
10156 2009-10-15  Doug Kwan  <dougkwan@google.com>
10157
10158         * layout.cc (Layout::finish_dynamic_section): Generate tags
10159         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10160         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10161         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10162
10163 2009-10-14  Ian Lance Taylor  <iant@google.com>
10164
10165         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10166         fields.
10167         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10168         data_shdr fields of relinfo.
10169         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10170         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10171         R_386_TLS_LDO_32, adjust based on section flags.
10172         (Target_i386::Relocate::fix_up_ldo): Remove.
10173
10174 2009-10-13  Ian Lance Taylor  <iant@google.com>
10175
10176         Add support for -pie.
10177         * options.h (class General_options): Add -pie and
10178         --pic-executable.
10179         (General_options::output_is_position_independent): Test -pie.
10180         (General_options::output_is_executable): Return true if not shared
10181         and not relocatable.
10182         (General_options::output_is_pie): Remove.
10183         * options.cc (General_options::finalize): Reject incompatible uses
10184         of -pie.
10185         * gold.cc (queue_middle_tasks): A -pie link is not static.
10186         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10187         * symtab.cc (Symbol::final_value_is_known): Return false if
10188         output_is_position_independent.
10189         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10190         output_is_position_independent.
10191         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10192         output_is_position_independent.
10193         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10194         output_is_position_independent.
10195         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10196         two_file_pie_test.
10197         (basic_pie_test.o, basic_pie_test): New targets.
10198         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10199         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10200         (two_file_pie_test): New target.
10201         * testsuite/Makefile.in: Rebuild.
10202         * README: Remove note saying that -pie is not supported.
10203
10204 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10205
10206         * options.h (class General_options): Add -init and -fini.
10207         * layout.cc (Layout::finish_dynamic_section): Emit
10208         given init and fini functions.
10209
10210 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10211
10212         * gc.h (gc_process_relocs): Check if icf is enabled using new
10213         function.
10214         * gold.cc (queue_initial_tasks): Likewise.
10215         (queue_middle_tasks): Likewise.
10216         * object.cc (do_layout): Likewise.
10217         * symtab.cc (is_section_folded): Likewise.
10218         * main.cc (main): Likewise.
10219         * reloc.cc (Read_relocs::run): Likewise.
10220         (Sized_relobj::do_scan_relocs): Likewise.
10221         * icf.cc (is_function_ctor_or_dtor): New function.
10222         (Icf::find_identical_sections): Check if function is ctor or dtor when
10223         safe icf is chosen.
10224         * options.h (General_options::icf): Change option to be an enum.
10225         (Icf_status): New enum.
10226         (icf_enabled): New method.
10227         (icf_safe_folding): New method.
10228         (set_icf_status): New method.
10229         (icf_status_): New variable.
10230         * (options.cc) (General_options::finalize): Set icf_status_.
10231         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10232         icf_test and icf_keep_unique_test to use the --icf enum flag.
10233         * testsuite/icf_safe_test.sh: New file.
10234         * testsuite/icf_safe_test.cc: New file.
10235
10236 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10237
10238         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10239         includes to gc.h and icf.h.
10240         * arm.cc: Include gc.h.
10241         * gold.cc: Likewise.
10242         * i386.cc: Likewise.
10243         * powerpc.cc: Likewise.
10244         * sparc.cc: Likewise.
10245         * x86_64.cc: Likewise.
10246         * gc.h: Include icf.h.
10247
10248 2009-10-11  Ian Lance Taylor  <iant@google.com>
10249
10250         * plugin.cc: Include "gold.h" before other header files.
10251
10252 2009-10-10  Chris Demetriou  <cgd@google.com>
10253
10254         * options.h (Input_file_argument::Input_file_type): New enum.
10255         (Input_file_argument::is_lib_): Replace with...
10256         (Input_file_argument::type_): New member.
10257         (Input_file_argument::Input_file_argument): Take Input_file_type
10258         'type' rather than boolean 'is_lib' as second argument.
10259         (Input_file_argument::is_lib): Use type_.
10260         (Input_file_argument::is_searched_file): New function.
10261         (Input_file_argument::may_need_search): Handle is_searched_file.
10262         * options.cc (General_options::parse_library): Support -l:filename.
10263         (General_options::parse_just_symbols): Update for Input_file_argument
10264         changes.
10265         (Command_line::process): Likewise.
10266         * archive.cc (Archive::get_file_and_offset): Likewise.
10267         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10268         * script.cc (read_script_file, script_add_file): Likewise.
10269         * fileread.cc (Input_file::Input_file): Likewise.
10270         (Input_file::will_search_for): Handle is_searched_file.
10271         (Input_file::open): Likewise.
10272         * readsyms.cc (Read_symbols::get_name): Likewise.
10273         * testsuite/Makefile.am (searched_file_test): New test.
10274         * testsuite/Makefile.in: Regenerate.
10275         * testsuite/searched_file_test.cc: New file.
10276         * testsuite/searched_file_test_lib.cc: New file.
10277
10278 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10279             Ian Lance Taylor  <iant@google.com>
10280
10281         * descriptor.cc: Include <cstdio> and "binary-io.h".
10282         (Descriptors::open): Open the files in binary mode always.
10283         * script.cc (Lex::get_token): Treat \r as whitespace.
10284
10285 2009-10-09  Ian Lance Taylor  <iant@google.com>
10286
10287         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10288
10289 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10290             Ian Lance Taylor  <iant@google.com>
10291
10292         * configure.ac: Check for readv function also.
10293         * fileread.cc (readv): Define if not HAVE_READV.
10294         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10295         does not exist.
10296         * config.in: Regenerate.
10297         * configure: Regenerate.
10298
10299 2009-10-09  Doug Kwan  <dougkwan@google.com>
10300
10301         * layout.cc (Layout::make_output_section): Call target hook to make
10302         ordinary output section.
10303         (Layout::finalize): Adjust parameter list of call the
10304         Target::may_relax().
10305         * layout.h (class Layout::section_list): New method.
10306         * merge.h (Output_merge_base::entsize): Change visibility to public.
10307         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10308         New methods.
10309         (Output_merge_string::do_is_string): New method.
10310         * object.cc (Sized_relobj::do_setup): renamed from
10311         Sized_relobj::set_up.
10312         * object.h (Sized_relobj::adjust_shndx,
10313         Sized_relobj::initializ_input_to_output_maps,
10314         Sized_relobj::free_input_to_output_maps): Change visibilities to
10315         protected.
10316         (Sized_relobj::setup): Virtualize.
10317         (Sized_relobj::do_setup): New method declaration.
10318         (Sized_relobj::invalidate_section_offset,
10319         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10320         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10321         * options.cc (parse_int): New function.
10322         * options.h (parse_int): New declaration.
10323         (DEFINE_int): New macro.
10324         (stub_group_size): New option.
10325         * output.cc (Output_section::Output_section): Initialize memebers
10326         merge_section_map_, merge_section_by_properties_map_,
10327         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10328         (Output_section::add_input_section): Handled deferred code-fill
10329         generation and remove an old comment.
10330         (Output_section::add_relaxed_input_section): New method definition.
10331         (Output_section::add_merge_input_section): Use merge section by
10332         properties map to speed to search.  Update merge section maps
10333         as appropriate.
10334         (Output_section::build_relaxation_map): New method definition.
10335         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10336         Same.
10337         (Output_section::relax_input_section): Renamed to
10338         Output_section::convert_input_sections_to_relaxed_sections and change
10339         interface to take a vector of pointers to relaxed sections.
10340         (Output_section::find_merge_section,
10341         Output_section::find_relaxed_input_section): New method definitions.
10342         (Output_section::is_input_address_mapped,
10343         Output_section::output_offset, Output_section::output_address):
10344         Use output section data maps to speed up searching.
10345         (Output_section::find_starting_output_address): Add comments.
10346         (Output_section::do_write,
10347         Output_section::write_to_postprocessing_buffer): Do code-fill
10348         generation as appropriate.
10349         (Output_section::get_input_sections): Invalidate relaxed input section
10350         map.
10351         (Output_section::restore_states): Adjust type of checkpoint .
10352         Invalidate relaxed input section map.
10353         * output.h (Output_merge_base): New class declaration.
10354         (Input_section_specifier): New class defintion.
10355         (class Output_relaxed_input_section) Change base class to
10356         Output_section_data_build.
10357         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10358         base class initializer.
10359         (Output_section::add_relaxed_input_section): New method declaration.
10360         (Output_section::Input_section): Change visibility to protected.
10361         (Output_section::Input_section::relobj,
10362         Output_section::Input_section::shndx): Handle relaxed input sections.
10363         Output_section::input_sections) Change visibility to protected.  Also
10364         define overload to return a non-const pointer.
10365         (Output_section::Merge_section_properties): New class defintion.
10366         (Output_section::Merge_section_by_properties_map,
10367         Output_section::Output_section_data_by_input_section_map,
10368         Output_section::Relaxation_map): New types.
10369         (Output_section::relax_input_section): Rename method to
10370         Output_section::convert_input_sections_to_relaxed_sections and change
10371         interface to take a vector of relaxed section pointers.
10372         (Output_section::find_merge_section,
10373         Output_section::find_relaxed_input_section,
10374         Output_section::build_relaxation_map,
10375         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10376         New method declarations.
10377         (Output_section::merge_section_map_
10378         Output_section::merge_section_by_properties_map_,
10379         Output_section::relaxed_input_section_map_,
10380         Output_section::is_relaxed_input_section_map_valid_,
10381         Output_section::generate_code_fills_at_write_): New data members.
10382         * script-sections.cc
10383         (Output_section_element_input::set_section_addresses): Call
10384         current_data_size and addralign methods of relaxed input sections.
10385         (Orphan_output_section::set_section_addresses): Call current_data_size
10386         and addralign methods of relaxed input sections.
10387         * symtab.cc (Symbol_table::compute_final_value): Extract template
10388         from the body of Symbol_table::sized_finalize_symbol.
10389         (Symbol_table::sized_finalized_symbol): Call
10390         Symbol_table::compute_final_value.
10391         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10392         (Symbol_table::compute_final_value): New templated method declaration.
10393         * target.cc (Target::do_make_output_section): New method defintion.
10394         * target.h (Target::make_output_section): New method declaration.
10395         (Target::relax): Add more parameters for input objects, symbol table
10396         and layout.  Adjust call to do_relax.
10397         (Target::do_make_output_section): New method declaration.
10398         (Target::do_relax): Add parameters for input objects, symbol table
10399         and layout.
10400
10401 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10402
10403         * pread.c: Include stdio.h.
10404
10405 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10406
10407         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10408         defined.
10409
10410 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10411
10412         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10413         Change read_shndx type to unsigned int.
10414         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10415         int.
10416         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10417         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10418         Change read_shndx type to unsigned int.
10419         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10420         int.
10421         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10422         * layout.cc (Layout::create_symtab_sections): Cast the result of
10423         local_symcount * symsize to off_t in the gold_assert.
10424
10425 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10426
10427         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10428         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10429         R_ARM_BASE_ABS.
10430         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10431         (Arm_relocate_functions::thm_abs5): New function.
10432         (Arm_relocate_functions::abs12): New function.
10433         (Arm_relocate_functions::abs16): New function.
10434         (Arm_relocate_functions::base_abs): New function.
10435         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10436         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10437         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10438         R_ARM_BASE_ABS.
10439         (Scan::global): Likewise.
10440         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10441         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10442         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10443         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10444         R_ARM_BASE_ABS.
10445
10446 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10447
10448         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10449         (Arm_relocate_functions::movt_prel): New function.
10450         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10451         (Arm_relocate_functions::thm_movt_prel): New function.
10452         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10453         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10454         (Scan::global, Relocate::relocate): Likewise.
10455         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10456
10457 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10458
10459         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10460         Incremental_checker.
10461         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10462         unsigned int.
10463         (class Incremental_inputs_header): New class.
10464         (Incremental_inputs_header_writer): Edit comment.
10465         (Incremental_inputs_entry): New class.
10466         (Incremental_inputs_entry_writer): Edit comment.
10467         (Sized_incremental_binary::do_find_incremental_inputs_section):
10468         Add *strtab_shndx parameter, fill it.
10469         (Sized_incremental_binary::do_check_inputs): New method.
10470         (Incremental_checker::can_incrementally_link_output_file): Use
10471         Sized_incremental_binary::check_inputs.
10472         (Incremental_inputs::report_command_line): Save command line in
10473         command_line_.
10474         * incremental.h:
10475         (Incremental_binary::find_incremental_inputs_section): New
10476         method.
10477         (Incremental_binary::do_find_incremental_inputs_section): Add
10478         strtab_shndx parameter.
10479         (Incremental_binary::do_check_inputs): New pure virtual method.
10480         (Sized_incremental_binary::do_check_inputs): Declare.
10481         (Incremental_checker::Incremental_checker): Add incremental_inputs
10482         parameter, use it to initialize incremental_inputs_.
10483         (Incremental_checker::incremental_inputs_): New field.
10484         (Incremental_checker::command_line): New method.
10485         (Incremental_checker::inputs): New method.
10486         (Incremental_checker::command_line_): New field.
10487
10488 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10489
10490         * incremental.cc: Include <cstdarg> and "target-select.h".
10491         (vexplain_no_incremental): New function.
10492         (explain_no_incremental): New function.
10493         (Incremental_binary::error): New method.
10494         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10495         method.
10496         (make_sized_incremental_binary): New function.
10497         (open_incremental_binary): New function.
10498         (can_incrementally_link_file): Add checks if output is ELF and has
10499         inputs section.
10500         * incremental.h: Include "elfcpp_file.h" and "output.h".
10501         (Incremental_binary): New class.
10502         (Sized_incremental_binary): New class.
10503         (open_incremental_binary): Declare.
10504         * object.cc (is_elf_object): Use
10505         elfcpp::Elf_recognizer::is_elf_file.
10506         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10507         * output.h (Output_file::filesize): New method.
10508
10509 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10510
10511         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10512         New function.
10513         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10514         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10515         function.
10516         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10517         function.
10518         (Arm_relocate_functions::movw_abs_nc): New function.
10519         (Arm_relocate_functions::movt_abs): New function.
10520         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10521         (Arm_relocate_functions::thm_movt_abs): New function.
10522         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10523         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10524         (Scan::global): Likewise.
10525         (Relocate::relocate): Likewise.
10526         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10527
10528 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10529
10530         * arm.cc (Arm_relocate_functions::got_prel) New function.
10531         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10532         (Relocate::relocate): Likewise.
10533         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10534
10535 2009-10-06  Ian Lance Taylor  <iant@google.com>
10536
10537         * options.h (class General_options): Define
10538         split_stack_adjust_size parameter.
10539         * object.h (class Object): Add uses_split_stack_ and
10540         has_no_split_stack_ fields.  Add uses_split_stack and
10541         has_no_split_stack accessor functions.  Declare
10542         handle_split_stack_section.
10543         (class Reloc_symbol_changes): Define.
10544         (class Sized_relobj): Define Function_offsets.  Declare
10545         split_stack_adjust, split_stack_adjust_reltype, and
10546         find_functions.
10547         * object.cc (Object::handle_split_stack_section): New function.
10548         (Sized_relobj::do_layout): Call handle_split_stack_section.
10549         * dynobj.cc (Sized_dynobj::do_layout): Call
10550         handle_split_stack_section.
10551         * reloc.cc (Sized_relobj::relocate_sections): Call
10552         split_stack_adjust for executable sections in split_stack
10553         objects.  Pass reloc_map to relocate_section.
10554         (Sized_relobj::split_stack_adjust): New function.
10555         (Sized_relobj::split_stack_adjust_reltype): New function.
10556         (Sized_relobj::find_functions): New function.
10557         * target-reloc.h: Include "object.h".
10558         (relocate_section): Add reloc_symbol_changes parameter.  Change
10559         all callers.
10560         * target.h (class Target): Add calls_non_split method.  Declare
10561         do_calls_non_split virtual method.  Declare match_view and
10562         set_view_to_nop.
10563         * target.cc: Include "elfcpp.h".
10564         (Target::do_calls_non_split): New function.
10565         (Target::match_view): New function.
10566         (Target::set_view_to_nop): New function.
10567         * gold.cc (queue_middle_tasks): Give an error if mixing
10568         split-stack and non-split-stack objects with -r.
10569         * i386.cc (Target_i386::relocate_section): Add
10570         reloc_symbol_changes parameter.
10571         (Target_i386::do_calls_non_split): New function.
10572         * x86_64.cc (Target_x86_64::relocate_section): Add
10573         reloc_symbol_changes parameter.
10574         (Target_x86_64::do_calls_non_split): New function.
10575         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10576         parameter.
10577         * powerpc.cc (Target_powerpc::relocate_section): Add
10578         reloc_symbol_changes parameter.
10579         * sparc.cc (Target_sparc::relocate_section): Add
10580         reloc_symbol_changes parameter.
10581         * configure.ac: Call AM_CONDITIONAL for the default target.
10582         * configure: Rebuild.
10583         * testsuite/Makefile.am (TEST_AS): New variable.
10584         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10585         (check_DATA): Add split_i386 and split_x86_64 files.
10586         (SPLIT_DEFSYMS): Define.
10587         (split_i386_[1234n].o): New targets.
10588         (split_i386_[124]): New targets.
10589         (split_i386_[1234r].stdout): New targets.
10590         (split_x86_64_[1234n].o): New targets.
10591         (split_x86_64_[124]): New targets.
10592         (split_x86_64_[1234r].stdout): New targets.
10593         (MOSTLYCLEANFILES): Add new executables.
10594         * testsuite/split_i386.sh: New file.
10595         * testsuite/split_x86_64.sh: New file.
10596         * testsuite/split_i386_1.s: New file.
10597         * testsuite/split_i386_2.s: New file.
10598         * testsuite/split_i386_3.s: New file.
10599         * testsuite/split_i386_4.s: New file.
10600         * testsuite/split_i386_n.s: New file.
10601         * testsuite/split_x86_64_1.s: New file.
10602         * testsuite/split_x86_64_2.s: New file.
10603         * testsuite/split_x86_64_3.s: New file.
10604         * testsuite/split_x86_64_4.s: New file.
10605         * testsuite/split_x86_64_n.s: New file.
10606         * testsuite/testfile.cc (Target_test): Update relocation_section
10607         function.
10608         * testsuite/Makefile.in: Rebuild.
10609
10610 2009-10-06  Ian Lance Taylor  <iant@google.com>
10611
10612         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10613         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10614         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10615         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10616         the address on ldo_addrs_.
10617         (Target_i386::Relocate::fix_up_ldo): New function.
10618
10619 2009-10-06   Rafael Espindola  <espindola@google.com>
10620
10621         * plugin.cc (add_input_library): New.
10622         (Plugin::load): Add add_input_library to tv.
10623         (Plugin_manager::add_input_file): Add the is_lib argument.
10624         (add_input_file): Update call to Plugin_manager::add_input_file.
10625         (add_input_library): New.
10626         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10627
10628 2009-09-30  Doug Kwan  <dougkwan@google.com>
10629
10630         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10631         symbol and call Symbol::may_need_copy_reloc to determine if
10632         a copy reloc is needed.
10633         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10634         nocopyreloc is given in command line.
10635         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10636         given in command line.
10637         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10638         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10639         of the removed Target_i386::may_need_copy_reloc.
10640         * options.h (copyreloc): New option with default value false.
10641         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10642         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10643         instead of the removed Target_powerpc::may_need_copy_reloc.
10644         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10645         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10646         instead of the removed Target_sparc::may_need_copy_reloc.
10647         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10648         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10649         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10650         instead of the removed Target_x86_64::may_need_copy_reloc.
10651
10652 2009-09-30  Ian Lance Taylor  <iant@google.com>
10653
10654         * object.h (class Object): Remove target_ field, and target,
10655         sized_target, and set_target methods.
10656         (Object::sized_target): Remove.
10657         (class Sized_relobj): Update declarations.  Remove sized_target.
10658         * object.cc (Sized_relobj::setup): Remove target parameter.
10659         Change all callers.
10660         (Input_objects::add_object): Don't do anything with the target.
10661         (make_elf_sized_object): Add punconfigured parameter.  Change all
10662         callers.  Set or test parameter target.
10663         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10664         Change all callers.
10665         * parameters.cc (Parameters::set_target): Change parameter type to
10666         be non-const.
10667         (Parameters::default_target): Remove.
10668         (set_parameters_target): Change parameter type to be non-const.
10669         (parameters_force_valid_target): New function.
10670         (parameters_clear_target): New function.
10671         * parameters.h (class Parameters): Update declarations.  Remove
10672         default_target method.  Add sized_target and clear_target
10673         methods.  Change target_ to be non-const.
10674         (set_parameters_target): Update declaration.
10675         (parameters_force_valid_target): Declare.
10676         (parameters_clear_target): Declare.
10677         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10678         as NULL if we aren't searching.
10679         (Add_symbols::run): Don't check for compatible target.
10680         * fileread.cc (Input_file::open_binary): Call
10681         parameters_force_valid_target.
10682         * gold.cc (queue_middle_tasks): Likewise.
10683         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10684         set_target on object.
10685         * dynobj.h (class Sized_dynobj): Update declarations.
10686         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10687         make_elf_object returns NULL.
10688         (Archive::include_member): Don't check whether object target is
10689         compatible.
10690         * output.cc (Output_section::add_input_section): Get target from
10691         parameters.
10692         (Output_section::relax_input_section): Likewise.
10693         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10694         parameters.
10695         (Sized_relobj::do_scan_relocs): Likewise.
10696         (Sized_relobj::relocate_sections): Likewise.
10697         * resolve.cc (Symbol_table::resolve): Likewise.
10698         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10699         parameter.  Change all callers.
10700         (Symbol_table::add_from_object): Get target from parameters.
10701         (Symbol_table::add_from_relobj): Don't check object target.
10702         (Symbol_table::add_from_dynobj): Likewise.
10703         (Symbol_table::define_special_symbol): Get target from
10704         parameters.
10705         * symtab.h (class Symbol_table): Update declaration.
10706         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10707         parameter.  Change all callers.  Clear parameter target.
10708         (Binary_test): Test target here.
10709         * testsuite/object_unittest.cc (gold_testsuite): Remove
10710         target_test_pointer parameter.  Change all callers.
10711         (Object_test): Test target here.
10712
10713 2009-09-26  Ian Lance Taylor  <iant@google.com>
10714
10715         * testsuite/initpri1.c: Don't try to use constructor priorities if
10716         compiling with gcc before 4.3.
10717
10718 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10719
10720         * testsuite/retain_symbols_file_test.sh (check_present): Change
10721         output file name to retain_symbols_file_test.stdout.
10722         (check_absent): Likewise.
10723
10724 2009-09-18  Craig Silverstein  <csilvers@google.com>
10725
10726         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10727         * options.cc: Include <cerrno> and <fstream>.
10728         (General_options::finalize): Parse -retain-symbols-file tag.
10729         * options.h: New flag.
10730         (General_options): New method should_retain_symbol, new
10731         variable symbols_to_retain.
10732         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10733         should_retain_symbol map.
10734         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10735         * testsuite/Makefile.in: Regenerate.
10736         * testsuite/retain_symbols_file_test.sh: New file.
10737
10738 2009-09-18  Nick Clifton  <nickc@redhat.com>
10739
10740         * po/es.po: Updated Spanish translation.
10741
10742 2009-09-17  Doug Kwan  <dougkwan@google.com>
10743
10744         * debug.h (DEBUG_RELAXATION): New constant.
10745         (DEBUG_ALL): Add DEBUG_RELAXATION.
10746         (debug_string_to_enum): Add relaxation debug option.
10747         * layout.cc
10748         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10749         Layout::Relaxation_debug_check::read_sections,
10750         Layout::Relaxation_debug_check::read_sections): New method definitions.
10751         (Layout::Layout): Initialize data members
10752         record_output_section_data_from_scrips_,
10753         script_output_section_data_list_ and relaxation_debug_check_.
10754         (Layout::save_segments, Layout::restore_segments,
10755         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10756         Layout::relaxation_loop_body): New method definitions.
10757         (Layout::finalize): Support relaxation.  Move section layout code to
10758         Layout::relaxation_loop_body.
10759         (Layout::set_asection_address_from_script): Move code for orphan
10760         section placement out.
10761         (Layout::place_orphan_sections_in_script): New method definition.
10762         * layout.h (Output_segment_headers, Output_file_header):
10763         New forward class declarations.
10764         (Layout::~Layout): Define.
10765         (Layout::new_output_section_data_from_script): New method definition.
10766         (Layout::place_orphan_sections_in_script): New method declaration.
10767         (Layout::Segment_states): New type declaration.
10768         (Layout::save_segments, Layout::restore_segments,
10769         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10770         Layout::relaxation_loop_body): New method declarations.
10771         (Layout::Output_section_data_list): New type declaration.
10772         (Layout::Relaxation_debug_check): New class definition.
10773         (Layout::record_output_section_data_from_script_,
10774         Layout::script_output_section_data_list_, Layout::segment_states_,
10775         Layout::relaxation_debug_check_): New data members.
10776         * output.cc: (Output_section_headers::do_size): New method definition.
10777         (Output_section_headers::Output_section_headers): Move size
10778         computation to Output_section_headers::do_size.
10779         (Output_segment_headers::do_size): New method definition.
10780         (Output_file_header::Output_file_header): Move size computation to
10781         Output_file_header::do_size and call it.
10782         (Output_file_header::do_size): New method definition.
10783         (Output_data_group::Output_data_group): Adjust call to
10784         Output_section_data.
10785         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10786         (Output_symtab_xindex::do_write): Add array bound check.
10787         (Output_section::Input_section::print_to_mapfile): Handle
10788         RELAXED_INPUT_SECTION_CODE.
10789         (Output_section::Output_section): Initialize data member checkpoint_.
10790         (Output_section::~Output_section): Delete checkpoint object pointed
10791         by checkpoint_.
10792         (Output_section::add_input_section): Always add an Input_section if
10793         relaxing.
10794         (Output_section::add_merge_input_section): Add assert.
10795         (Output_section::relax_input_section): New method definition.
10796         (Output_section::set_final_data_size): Set load address to zero for
10797         an unallocated section.
10798         (Output_section::do_address_and_file_offset_have_reset_values):
10799         New method definition.
10800         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10801         Handle relaxed input section.
10802         (Output_section::sort_attached_input_sections): Checkpoint input
10803         section list lazily.
10804         (Output_section::get_input_sections): Change type of input_sections to
10805         list of Simple_input_section pointers.  Checkpoint input section list
10806         lazily.  Also handle relaxed input sections.
10807         (Output_section::add_input_section_for_script): Take a reference to
10808         a Simple_input_section object instead of Relobj pointer and section
10809         index as parameter.  Handle relaxed input sections.
10810         (Output_section::save_states, Output_section::restore_states): New
10811         method definitions.
10812         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10813         (Output_data::is_data_size_fixed): New method definition.
10814         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10815         if it is fixed.
10816         (Output_data::address_and_file_offset_have_reset_values): New method
10817         definition.
10818         (Output_data::do_address_and_file_offset_have_reset_values): New method
10819         definition.
10820         (Output_data::set_data_size): Check that data size is not fixed.
10821         (Output_data::fix_data_size): New method definition.
10822         (Output_data::is_data_size_fixed_): New data member.
10823         (Output_section_headers::set_final_data_size): New method definition.
10824         (Output_section_headers::do_size): New method declaration.
10825         (Output_segment_headers::set_final_data_size): New method definition.
10826         (Output_segment_headers::do_size): New method declaration.
10827         (Output_file_header::set_final_data_size)::New method definition.
10828         (Output_file_header::do_size)::New method declaration.
10829         (Output_section_data::Output_section_data): Add new parameter
10830         is_data_size_fixed and use it to fix data size.
10831         (Output_data_const::Output_data_const): Adjust call to base class
10832         constructor and fix data size.
10833         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10834         base class constructor and fix data size.
10835         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10836         base class constructor and fix data size.
10837         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10838         class constructor and fix data size.
10839         (Output_data_group::set_final_data_size): New method definition.
10840         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10841         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10842         class constructor and fix data size.
10843         (Output_relaxed_input_section): New class definition.
10844         (Output_section::Simple_input_section): New class definition.
10845         (Output_section::get_input_sections): Adjust parameter list.
10846         (Output_section::add_input_section_for_script): Same.
10847         (Output_section::save_states, Output_section::restore_states,
10848         Output_section::do_address_and_file_offset_have_reset_values,
10849         (Output_section::Input_section::Input_section): Handle
10850         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10851         Output_relaxed_input_section.
10852         (Output_section::Input_section::is_input_section,
10853         Output_section::Input_section::set_output_section): Handle relaxed
10854         input section.
10855         (Output_section::Input_section::is_relaxed_input_section,
10856         Output_section::Input_section::output_section_data,
10857         Output_section::Input_section::relaxed_input_section): New method
10858         definitions.
10859         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10860         value.
10861         (Output_section::Input_section::u1_): Update comments.
10862         (Output_section::Input_section::u2_): Add new union member poris.
10863         (Output_section::Checkpoint_output_section): New classs definition.
10864         (Output_section::relax_input_section): New method declaration.
10865         (Output_section::checkpoint_): New data member.
10866         (Output_segment): Update comments.
10867         (Output_segment::Output_segment): Un-privatize copy constructor.
10868         (Output_segment::operator=): Un-privatize.
10869         * script-sections.cc (Output_section_element::Input_section_list):
10870         Change element type to Output_section::Simple_input_section.
10871         (Output_section_element_dot_assignment::set_section_addresses):
10872         Register output section data for relaxation clean up.
10873         (Output_data_exression::Output_data_expression): Adjust call to base
10874         constructor to fix data size.
10875         (Output_section_element_data::set_section_addresses): Register
10876         Output_data_expression object for relaxation clean up.
10877         (struct Input_section_info): Replace Relobj pointer and section index
10878         pair with Output_section::Simple_input_section and Convert struct to a
10879         class.
10880         (Input_section_sorter::operator()): Adjust access to
10881         Input_section_info data member to use accessors.
10882         (Output_section_element_input::set_section_addresses): Use layout
10883         parameter.  Adjust code to use Output_section::Simple_input_section
10884         and Input_secction_info classes.  Register filler for relaxation
10885         clean up.
10886         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10887         and section index pair with Output_section::Simple_input_section
10888         class.  Adjust code accordingly.
10889         (Phdrs_element::release_segment): New method definition.
10890         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10891         segment list.
10892         (Script_sections::release_segments): New method definition.
10893         * gold/script-sections.h (Script_sections::release_segments): New
10894         method declaration.
10895         * gold/target.h (Target::may_relax, Target::relax,
10896         Target::do_may_relax, Target::do_relax): New method definitions.
10897
10898 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10899
10900         * arm.cc (has_signed_unsigned_overflow): New function.
10901         (Arm_relocate_functions::abs8): New function.
10902         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10903         (Target_arm::Scan::global): Likewise.
10904         (Target_arm::relocate::relocate): Likewise.
10905         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10906         Likewise.
10907
10908 2009-09-16  Cary Coutant  <ccoutant@google.com>
10909
10910         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10911         * testsuite/Makefile.in: Regenerate.
10912
10913 2009-09-11  Nick Clifton  <nickc@redhat.com>
10914
10915         * po/gold.pot: Updated by the Translation project.
10916
10917 2009-09-08  Cary Coutant  <ccoutant@google.com>
10918
10919         * output.cc (Output_file::open): Add execute permission to empty file.
10920         * testsuite/Makefile.am (permission_test): New test.
10921         * testsuite/Makefile.in: Regenerate.
10922
10923 2009-09-02  Ian Lance Taylor  <iant@google.com>
10924
10925         * output.cc (Output_file::resize): Call map_no_anonymous rather
10926         than map.
10927
10928 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10929
10930         * gold.cc: Include "incremental.h".
10931         (queue_initial_tasks): Call Incremental_checker methods.
10932         * incremental.cc: Include "output.h".
10933         (Incremental_checker::can_incrementally_link_output_file): New
10934         method.
10935         * incremental.h (Incremental_checker): New class.
10936
10937         * output.cc (Output_file::open_for_modification): New method.
10938         (Output_file::map_anonymous): Changed return type to bool.  Record
10939         map in base_ field.
10940         (Output_file::map_no_anonymous): New method, broken out of map.
10941         (Output_file::map): Use map_no_anonymous and map_anonymous.
10942         * output.h (class Output_file): Update declarations.
10943
10944 2009-08-24  Cary Coutant  <ccoutant@google.com>
10945
10946         * options.h (Command_line::Pre_options): New class.
10947         (Command_line::pre_options): New member.
10948         * options.cc (gold::options::ready_to_register): New variable.
10949         (One_option::register_option): Do nothing if not registering options.
10950         Assert if same short option registered twice.
10951         (General_options::General_options): Turn off option registration when
10952         done constructing.
10953         (Command_line::Pre_options::Pre_options): New constructor.
10954
10955 2009-08-24  Cary Coutant  <ccoutant@google.com>
10956
10957         * options.h (General_options::no_keep_memory): Remove incorrect
10958         short option.
10959
10960 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10961
10962         * Makefile.am (am__skiplex, am__skipyacc): New.
10963         * Makefile.in: Regenerate.
10964
10965 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10966
10967         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10968         (INCLUDES): ... this.
10969         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10970         (AM_CPPFLAGS): Renamed from ...
10971         (INCLUDE): ... this.
10972         * Makefile.in, testsuite/Makefile.in: Regenerate.
10973
10974         * Makefile.in: Regenerate.
10975         * aclocal.m4: Likewise.
10976         * config.in: Likewise.
10977         * configure: Likewise.
10978         * testsuite/Makefile.in: Likewise.
10979
10980         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10981         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10982         * Makefile.in: Regenerate.
10983         * testsuite/Makefile.in: Regenerate.
10984
10985 2009-08-19  Cary Coutant  <ccoutant@google.com>
10986
10987         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10988         symbols in shared libraries overridden by hidden or internal symbols
10989         in the main program.
10990
10991 2009-08-19  Chris Demetriou  <cgd@google.com>
10992
10993         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10994         checking source file names in error messages.
10995
10996 2009-08-18  Doug Kwan  <dougkwan@google.com>
10997
10998         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10999         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11000         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11001         an elfcpp::Ehdr as parameter.
11002         * object.cc (Object::set_target): Remove the version that looks up
11003         a target and sets it.
11004         (Sized_relobj::setup): Take a Target object instead of
11005         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11006         (make_elf_sized_object): Find target and ask target to
11007         make an ELF object.
11008         * object.h: (Object::set_target): Remove the version that looks up
11009         a target and sets it.
11010         (Sized_relobj::setup): Take a Target object instead of
11011         an elfcpp:Ehdr as parameter.
11012         * target.cc: Include dynobj.h.
11013         (Target::do_make_elf_object_implementation): New.
11014         (Target::do_make_elf_object): New.
11015         * target.h (Target::make_elf_object): New template declaration.
11016         (Target::do_make_elf_object): New method declarations.
11017         (Target::do_make_elf_object_implementation): New template declaration.
11018
11019 2009-08-14  Ian Lance Taylor  <iant@google.com>
11020
11021         * gold.h (FUNCTION_NAME): Define.
11022         (gold_unreachable): Use FUNCTION_NAME.
11023
11024 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11025
11026         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11027         symbol in the --keep-unique list is not found.
11028
11029 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11030
11031         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11032         been maked as --keep-unique.
11033         (Icf::unfold_section): New function.
11034         * icf.h (Icf::unfold_section): New function.
11035         * options.h (General_options::keep_unique): New option.
11036         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11037         * testsuite/Makefile.in: Regenerate.
11038         * testsuite/icf_keep_unique_test.sh: New file.
11039         * testsuite/icf_keep_unique_test.cc: New file.
11040
11041 2009-08-12  Cary Coutant  <ccoutant@google.com>
11042
11043         PR 10471
11044         * resolve.cc (Symbol_table::resolve): Check for references from
11045         dynamic objects to hidden and internal symbols.
11046         * testsuite/Makefile.am (hidden_test.sh): New test.
11047         * testsuite/Makefile.in: Regenerate.
11048         * testsuite/hidden_test.sh: New script.
11049         * testsuite/hidden_test_1.c: New test source.
11050         * testsuite/hidden_test_main.c: New test source.
11051
11052 2009-08-11  Doug Kwan  <dougkwan@google.com>
11053
11054         * arm.cc: Update comments.
11055         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11056         segment to locate the .ARM.exidx section if present.
11057
11058 2009-08-09  Doug Kwan  <dougkwan@google.com>
11059
11060         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11061         patch.
11062
11063 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11064         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11065         compiler warnings.
11066
11067 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11068
11069         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11070         valid tls_segment only for non-debug-section relocations.
11071         * testsuite/Makefile.am: Add gc_tls_test.
11072         * testsuite/Makefile.in: Regenerate.
11073         * testsuite/gc_tls_test.cc: New file.
11074         * testsuite/gc_tls_test.sh: New file.
11075
11076 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11077
11078         * icf.cc: New file.
11079         * icf.h: New file.
11080         * Makefile.am (CCFILES): Add icf.cc.
11081         (HFILES): Add icf.h
11082         * Makefile.in: Regenerate.
11083         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11084         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11085         section, symbol and addend information for the relocs.
11086         * gold.cc (queue_middle_tasks): Call identical code folding.
11087         * gold.h: Add defines for multimap.
11088         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11089         to the call of finalize_local_symbols.
11090         * main.cc (main): Create object of class Icf.
11091         * object.cc (Sized_relobj::do_layout): Allow this function to be
11092         called twice during icf.
11093         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11094         to sections marked as identical by icf.
11095         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11096         when available.
11097         (Sized_relobj::do_section_entsize): New function.
11098         * object.h (Object::section_entsize): New function.
11099         (Object::do_section_entsize): New pure virtual function.
11100         (Relobj::finalize_local_symbols): Add new parameter.
11101         (Relobj::do_section_entsize): New function.
11102         * options.h (General_options::icf): New option.
11103         (General_options::icf_iterations): New option.
11104         (General_options::print_icf_sections): New option.
11105         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11106         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11107         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11108         icf.
11109         * symtab.cc (Symbol_table::is_section_folded): New function.
11110         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11111         to sections marked as identical by icf.
11112         * symtab.h (Symbol_table::set_icf): New function.
11113         (Symbol_table::icf): New function.
11114         (Symbol_table::is_section_folded): New function.
11115         (Symbol_table::icf_): New data member.
11116         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11117         * testsuite/Makefile.am: Add commands to build icf_test.
11118         * testsuite/Makefile.in: Regenerate.
11119         * testsuite/icf_test.sh: New file.
11120         * testsuite/icf_test.cc: New file.
11121
11122 2009-07-24  Chris Demetriou  <cgd@google.com>
11123
11124         * layout.cc (is_compressible_debug_section): Fix incorrect
11125         comment about compressed section names.
11126
11127 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11128
11129         PR 10419
11130         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11131
11132 2009-07-16  Ian Lance Taylor  <iant@google.com>
11133
11134         PR 10400
11135         * layout.h: #include <map>.
11136         (class Kept_section): Change from struct to class.  Add accessors
11137         and setters.  Add section size to Comdat_group mapping.  Change
11138         Comdat_group to std::map.  Add is_comdat_ field.  Add
11139         linkonce_size field in union.
11140         (class Layout): Update declaration of find_or_add_kept_section.
11141         Don't declare find_kept_object.
11142         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11143         parameter.  Add object, shndx, is_comdat, and is_group_name
11144         parameters.  Change all callers.  Adjust for new Kept_section.
11145         (Layout::find_kept_object): Remove.
11146         * object.cc (Sized_relobj::include_section_group): Update use of
11147         Kept_section.  Rename secnum to shndx.  Only record
11148         Kept_comdat_section if sections are the same size.
11149         (Sized_relobj::include_linkonce_section): Update use of
11150         Kept_section.  Only record Kept_comdat_section if sections are the
11151         same size.  Set size of linkonce section.
11152         (Sized_relobj::map_to_kept_section): Update call to
11153         get_kept_comdat_section.
11154         * object.h (class Sized_relobj): Rename fields in
11155         Kept_comdat_section to drop trailing underscores; change object
11156         field to Relobj*.  Change Kept_comdat_section_table to store
11157         struct rather than pointer.
11158         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11159         Add kept_object and kept_shndx parameters.  Change all callers.
11160         (Sized_relobj::get_kept_comdat_section): Change return type to
11161         bool.  Add kept_object and kept_shndx parameters.  Change all
11162         callers.
11163         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11164         Layout::find_or_add_kept_section.
11165
11166 2009-07-09  Ian Lance Taylor  <iant@google.com>
11167
11168         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11169         Reserve space in the hash table.
11170
11171 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11172
11173         * fileread.cc (File_read::get_mtime): New method.
11174         * fileread.h (Timespec): New structure.
11175         (File_read::get_mtime): New method.
11176         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11177         Renamed from timestamp_nsec.
11178         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11179         Elf_Xword.
11180         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11181         timestamp_nsec.
11182         (Incremental_inputs::report_archive): Save mtime; style fix.
11183         (Incremental_inputs::report_obejct): Save mtime; style fix.
11184         (Incremental_inputs::report_script): Save mtime; style fix.
11185         (Incremental_inputs::finalize_inputs): Style fix.
11186         (Incremental_inputs::finalize): Style fix.
11187         (Incremental_inputs::create_input_section_data): Store inputs
11188         mtime.
11189         * incremental.h (Incremental_inputs::report_script): Add mtime
11190         argument.
11191         (Incremental_inputs::Input_info::Input_info): Intialize only one
11192         union member.
11193         (Incremental_inputs::Input_info::archive): Move to nameless
11194         union.
11195         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11196         (Incremental_inputs::Input_info::script): Move to nameless union.
11197         (Incremental_inputs::mtime): New field.
11198         * script.cc (read_input_script): Pass file mtime to
11199         Incremental_input.
11200         * script.h (Script_info::inputs): Style fix.
11201
11202 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11203
11204         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11205         instead of 32.
11206
11207 2009-06-24  Ian Lance Taylor  <iant@google.com>
11208
11209         PR 10156
11210         * layout.cc (Layout::choose_output_section): If we find an
11211         existing section, update the flags.
11212         (Layout::create_notes): New function, broken out of
11213         Layout::finalize.
11214         (Layout::finalize): Don't create note sections.
11215         (Layout::create_note): Don't crash if linker script discards
11216         section.
11217         (Layout::create_gold_note): Likewise.
11218         (Layout::create_build_id): Likewise.  Don't set
11219         after_input_sections on the section.
11220         (Layout::create_executable_stack_info): Remove target parameter.
11221         Change caller.
11222         * layout.h (class Layout): Declare create_notes.  Update
11223         declaration of create_executable_stack_info.
11224         * gold.cc (queue_middle_tasks): Call create_notes.
11225         * output.cc (Output_section::update_flags_for_input_section): Move
11226         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11227         invalid.
11228         * output.h (Output_data::mark_address_invalid): New function.
11229         (class Output_section): Only declare, not define,
11230         update_flags_for_input_section.  Remove set_flags.
11231
11232 2009-06-24  Ian Lance Taylor  <iant@google.com>
11233
11234         * script-sections.cc (Output_section_definition::
11235         set_section_addresses): Rename shadowing local load_address to
11236         laddr.
11237
11238 2009-06-24  Ian Lance Taylor  <iant@google.com>
11239
11240         PR 10244
11241         * reloc.cc (relocate_sections): Skip empty relocation sections.
11242
11243 2009-06-23  Ian Lance Taylor  <iant@google.com>
11244
11245         PR 10156
11246         * layout.cc (Layout::create_note): Use choose_output_section
11247         rather than make_output_section.
11248
11249 2009-06-23  Ian Lance Taylor  <iant@google.com>
11250
11251         PR 10237
11252         * options.cc (General_options::parse_V): Set printed_version_.
11253         (General_options::General_options): Initialize printed_version_.
11254         * options.h (class General_options): Add printed_version_ field.
11255         * gold.cc (queue_initial_tasks): If there are no input files,
11256         don't give a fatal error if we printed the version information.
11257         (queue_middle_tasks): If using -r with a shared object, give a
11258         fatal error rather than an ordinary error.
11259
11260 2009-06-23  Ian Lance Taylor  <iant@google.com>
11261
11262         PR 10219
11263         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11264         (Layout::make_output_section): Set have_stabstr_section_ if we see
11265         a .stab*str section.
11266         (Layout::finalize): Call link_stabs_sections.
11267         (Layout::link_stabs_sections): New file.
11268         * layout.h (class Layout): Add have_stabstr_section_ field.
11269         Declare link_stabs_sections.
11270
11271 2009-06-23  Doug Kwan  <dougkwan@google.com>
11272
11273         * Makefile.am (libgold_a_LIBADD): New.
11274         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11275         * Makefile.in: Regenerate.
11276         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11277         * configure: Regenerate.
11278         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11279         * fileread.cc: Include sys/state.h
11280         * gold.h: Declare memmem and strndup if found missing.
11281         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11282
11283 2009-06-23  Ian Lance Taylor  <iant@google.com>
11284
11285         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11286         * configure: Rebuild.
11287
11288 2009-06-23  Ian Lance Taylor  <iant@google.com>
11289
11290         PR 10147
11291         * object.cc (Object::section_contents): Don't try to get a view if
11292         the section has length zero.
11293         (Object::handle_gnu_warning_section): If the section is empty, use
11294         the name of the section as the warning.
11295
11296 2009-06-23  Ian Lance Taylor  <iant@google.com>
11297
11298         PR 10133
11299         * stringpool.h (class Stringpool_template): Add optimize_ field.
11300         (Stringpool_template::set_optimize): New function.
11301         * stringpool.cc (Stringpool_template::Stringpool_template):
11302         Initialize optimize_ field.
11303         (Stringpool_template::set_string_offsets): Test local optimize
11304         fild rather than parameter.
11305         * layout.cc (Layout::Layout): Call set_optimize on the section
11306         name stringpool.
11307
11308 2009-06-22  Ian Lance Taylor  <iant@google.com>
11309
11310         PR 10030
11311         * yyscript.y: Parse TARGET.
11312         * script.cc (script_set_target): New function.
11313         * script-c.h (script_set_target): Declare.
11314         * options.cc (General_options::string_to_object_format): Rename
11315         from string_to_object_format in anonymous namespace.  Change
11316         callers.
11317         * options.h (class General_options): Declare
11318         string_to_object_format.
11319
11320 2009-06-22  Ian Lance Taylor  <iant@google.com>
11321
11322         * script-sections.cc (Script_sections::create_segments): Don't put
11323         program headers in a PT_LOAD segment if -n or -N.
11324
11325 2009-06-22  Ian Lance Taylor  <iant@google.com>
11326
11327         PR 10141
11328         * options.h (class General_options): Add -z lazy and -z now.  Sort
11329         -z options into alphabetical order.
11330         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11331
11332 2009-06-21  Ian Lance Taylor  <iant@google.com>
11333
11334         * layout.cc (Layout::make_output_section): Call
11335         Target::new_output_section.
11336         (Layout::attach_allocated_section_to_segment): Put large section
11337         sections in a separate load segment with the large segment flag
11338         set.
11339         (Layout::segment_precedes): Sort large data segments after other
11340         load segments.
11341         (align_file_offset): New static function.
11342         (Layout::set_segment_offsets): Use align_file_offset.
11343         * output.h (class Output_section): Add is_small_section_ and
11344         is_large_section_ fields.
11345         (Output_section::is_small_section): New function.
11346         (Output_section::set_is_small_section):  New function.
11347         (Output_section::is_large_section): New function.
11348         (Output_section::set_is_large_section): New function.
11349         (Output_section::is_large_data_section): New function.
11350         (class Output_segment): Add is_large_data_segment_ field.
11351         (Output_segment::is_large_data_segment): New function.
11352         (Output_segment::set_is_large_data_segment): New function.
11353         * output.cc (Output_section::Output_section): Initialize new
11354         fields.
11355         (Output_segment::Output_segment): Likewise.
11356         (Output_segment::add_output_section): Add assertion that large
11357         data sections always go in large data segments.  Force small data
11358         sections to the end of the list of data sections.  Force small BSS
11359         sections to the start of the list of BSS sections.  For large BSS
11360         sections to the end of the list of BSS sections.
11361         * symtab.h (class Symbol): Declare is_common_shndx.
11362         (Symbol::is_defined): Check Symbol::is_common_shndx.
11363         (Symbol::is_common): Likewise.
11364         (class Symbol_table): Define enum Commons_section_type.  Update
11365         declarations.  Add small_commons_ and large_commons_ fields.
11366         * symtab.cc (Symbol::is_common_shndx): New function.
11367         (Symbol_table::Symbol_table): Initialize new fields.
11368         (Symbol_table::add_from_object): Put small and large common
11369         symbols in the right list.
11370         (Symbol_table::sized_finalized_symbol): Check
11371         Symbol::is_common_shndx.
11372         (Symbol_table::sized_write_globals): Likewise.
11373         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11374         common symbol lists.  Don't call do_allocate_commons_list if the
11375         list is empty.
11376         (Symbol_table::do_allocate_commons_list): Remove is_tls
11377         parameter.  Add comons_section_type parameter.  Change all
11378         callers.  Handle small and large common symbols.
11379         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11380         Symbol::is_common_shndx.
11381         * resolve.cc (symbol_to_bits): Likewise.
11382         * target.h (Target::small_common_shndx): New function.
11383         (Target::small_common_section_flags): New function.
11384         (Target::large_common_shndx): New function.
11385         (Target::large_common_section_flags): New function.
11386         (Target::new_output_section): New function.
11387         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11388         small_common_section_flags, and large_common_section_flags
11389         fields.
11390         (Target::do_new_output_section): New virtual function.
11391         * arm.cc (Target_arm::arm_info): Initialize new fields.
11392         * i386.cc (Target_i386::i386_info): Likewise.
11393         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11394         Likewise.
11395         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11396         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11397         (Target_x86_64::do_new_output_section): New function.
11398         * configure.ac: Define conditional MCMODEL_MEDIUM.
11399         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11400         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11401         (large_LDFLAGS): Define.
11402         * testsuite/large.c: New file.
11403         * testsuite/testfile.cc (Target_test::test_target_info):
11404         Initialize new fields.
11405         * configure, testsuite/Makefile.in: Rebuild.
11406
11407 2009-06-05  Doug Kwan  <dougkwan@google.com>
11408
11409         * Makefile.am (CCFILES): Add target.cc.
11410         * Makefile.in: Regenerate.
11411         * i386.cc (class Target_i386): Define new virtual method to
11412         override do_is_local_label_name in parent.
11413         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11414         local symbols if --discard-locals or -X is given.
11415         * options.h (class General_options): Declare new options
11416         '--discard-locals' and '-X' for discarding locals.
11417         * target.h (class Target): Define new methods is_local_label_name.
11418         Declare new virtual method do_is_local_label_name.
11419         * target.cc: New file.
11420         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11421         (check_SCRIPTS): Add discard_locals_test.sh.
11422         (check_DATA): Add discard_local_tests.syms.
11423         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11424         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11425         * testsuite/Makefile.in: Regenerate.
11426         * testsuite/discard_locals_test.c: New file.
11427         * testsuite/discard_locals_test.sh: Same.
11428
11429 2009-06-05  Doug Kwan  <dougkwan@google.com>
11430
11431         * object.cc (Sized_relobj::Sized_relobj): Initialize
11432         discarded_eh_frame_shndx_ to -1U.
11433         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11434         section.
11435         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11436         a discarded .eh_frame section.
11437         (Sized_relobj::do_finalize_local_symbols): Ditto.
11438         * object.h (class Sized_relobj): Declare new member
11439         discarded_eh_frame_shndx_.
11440         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11441         (local_labels_test.o, local_labels_test): New rules.
11442         * testsuite/Makefile.in: Regenerate.
11443
11444 2009-06-04  Doug Kwan  <dougkwan@google.com>
11445
11446         * layout.cc (Layout::section_name_mapping): Add mapping for
11447         special ARM sections.
11448
11449 2009-06-03  Doug Kwan  <dougkwan@google.com>
11450
11451         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11452         (utils::has_overflow): Same.
11453
11454 2009-06-03  Ian Lance Taylor  <iant@google.com>
11455
11456         * layout.cc (Layout::section_name_mapping): New array, replacing
11457         Layout::linkonce_mapping.
11458         (Layout::section_name_mapping_count): New variable, replacing
11459         Layout::linkonce_mapping_count.
11460         (Layout::linkonce_output_name): Remove.
11461         (Layout::output_section_name): Rewrite.
11462         * layout.h (class Layout): Rename Linkonce_mapping to
11463         Section_name_mapping, linkonce_mapping to section_name_mapping,
11464         linkonce_mapping_count to section_name_mapping_count.  Don't
11465         declare linkonce_output_name.
11466
11467 2009-06-03  Doug Kwan  <dougkwan@google.com>
11468
11469         * gold/arm.cc (namespace utils): New.
11470         (Target_arm::reloc_is_non_pic): Define new method.
11471         (class Arm_relocate_functions): New.
11472         (Target_arm::Relocate::relocate): Handle relocation types used by
11473         Android.
11474
11475 2009-06-03  Ian Lance Taylor  <iant@google.com>
11476
11477         * arm.cc (Target_arm::scan::global): Use || instead of |.
11478
11479 2009-06-02  Doug Kwan  <dougkwan@google.com>
11480
11481         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11482         issued_non_pic_error_.
11483         (class Target_arm::Scan): Declare new method check_non_pic.
11484         Define new method symbol_needs_plt_entry.
11485         Declare new data member issued_non_pic_error_.
11486         (class Target_arm::Relocate): Declare new method
11487         should_apply_static_reloc.
11488         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11489         (Target_arm::Scan::check_non_pic): Define new method.
11490         (Target_arm::Scan::local): Handle a small subset of reloc types used
11491         by Android.
11492         (Target_arm::Scan::local): Same.
11493         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11494
11495 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11496
11497         * incremental.cc (Incremental_inputs::report_command_line): Filter
11498         out --incremental-* options.
11499
11500 2009-05-29  Doug Kwan  <dougkwan@google.com>
11501
11502         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11503         template class.
11504         (class Target_arm): Update comment.
11505         (Target_arm::Target_arm): Initialize new data members GOT_,
11506         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11507         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11508         and Target_arm::rel_dyn_section.
11509         Declare new_enum Target_arm::Got_type.
11510         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11511         and DYNBSS_.
11512         Update commments for member do_dynsym_value.
11513         (Target_arm::got_size, Target_arm::plt_section,
11514         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11515         new methods inside class defintion.
11516         (Target_arm::got_section): Define new method.
11517         (Target_arm::rel_dyn_section): Same.
11518         (Output_data_plt_arm): New template class.
11519         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11520         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11521         (Output_data_plt_arm::add_entry): Same.
11522         (Output_data_plt_arm::first_plt_entry): Define new
11523         static data member for PLT instruction template.
11524         (Output_data_plt_arm::plt_entry): Same.
11525         (Output_data_plt_arm::do_write): Define new method.
11526         (Target_arm::make_plt_entry): Same.
11527         (Target_arm::do_finalize_sections): Same.
11528         (Target_arm::do_dynsym_value): Same.
11529
11530 2009-05-28  Doug Kwan  <dougkwan@google.com>
11531
11532         * Makefile.am (TARGETSOURCES): Add arm.cc.
11533         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11534         * Makefile.in: Regenerate.
11535         * arm.cc: New file.
11536         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11537
11538 2009-05-26  Doug Kwan  <dougkwan@google.com>
11539
11540         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11541         (General_options::check_excluded_libs): Strip off directories in
11542         archive name before matching like GNU ld does.
11543         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11544         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11545         (exclude_libs_test_LDFLAGS): Add linker option
11546         -Wl,--exclude-libs,libexclude_libs_test_3
11547         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11548         an explicit archive without using -l.
11549         (alt/libexclude_libs_test_3.a): New make rule.
11550         * testsuite/Makefile.in: Regenerate.
11551         * testsuite/exclude_libs_test.c : Declare lib3_default().
11552         (main): Call it.
11553         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11554         * exclude_libs_test_3.c: New file.
11555
11556 2009-05-26  Nick Clifton  <nickc@redhat.com>
11557
11558         * po/id.po: New Indonesian translation.
11559         * po/gold.pot: Updated template file.
11560
11561 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11562
11563         * testsuite/Makefile.am: Add -ffunction-sections to compile
11564         gc_comdat_test files.  Add -Wl,--gc-sections to build
11565         gc_comdat_test.
11566         * testsuite/Makefile.in: Regenerate.
11567         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11568
11569 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11570
11571         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11572         kept comdat section was garbage collected.
11573         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11574         * testsuite/Makefile.in: Regenerate.
11575         * testsuite/gc_comdat_test.sh: New file.
11576         * testsuite/gc_comdat_test_1.cc: New file.
11577         * testsuite/gc_comdat_test_2.cc: New file.
11578
11579 2009-05-19  Doug Kwan  <dougkwan@google.com>
11580
11581         * archive.cc (Archive::Archive): Move constructor from archive.h
11582         to here.  Initialize no_export_.
11583         (Archive::get_elf_object_for_member): Set no_export flag of object.
11584         * archive.h (Archive::Archive): Move constructor body to
11585         archive.cc.
11586         (Archive::no_export): New method.
11587         (Archive::no_export_): New field.
11588         * object.h (Object::Object): Initialize no_export_ to false.
11589         (Object::no_export, Object::set_no_export): New methods.
11590         (Object::no_export_): New field.
11591         * options.cc (General_options::parse_exclude_libs): New method.
11592         (General_options::check_excluded_libs) Same.
11593         * options.h (exclude_libs): New option.
11594         (General_options::check_excluded_libs): New method declaration.
11595         (General_options::excluded_libs_): New field.
11596         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11597         default or protected visibility if an object has no-export flag set.
11598         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11599         (check_SCRIPTS): Add exclude_libs_test.sh.
11600         (check_DATA): Add exclude_libs_test.syms.
11601         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11602         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11603         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11604         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11605         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11606         libexclude_libs_test_2.a): New rules.
11607         * testsuite/Makefile.in: Regenerate.
11608         * testsuite/exclude_libs_test.c: New file.
11609         * testsuite/exclude_libs_test.sh: Ditto.
11610         * testsuite/exclude_libs_test_1.c: Ditto.
11611         * testsuite/exclude_libs_test_2.c: Ditto.
11612
11613 2009-05-15  Ian Lance Taylor  <iant@google.com>
11614
11615         * configure.ac: Check for declarations for cases where libiberty.h
11616         checks HAVE_DECL_xxx.
11617         * configure, config.in: Rebuild.
11618
11619 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11620
11621         * gold.h (Incremental_argument_list): Remove (invalid) forward
11622         declaration.
11623         * incremental.cc (Incremental_inputs::report_achive): New method.
11624         (Incremental_inputs::report_object): New method.
11625         (Incremental_inputs::report_script): New method.
11626         (Incremental_inputs::finalize_inputs): New method.
11627         (Incremental_inputs::finalize): Call finalize_inputs().
11628         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11629         Create inputs entries.
11630         * incremental.h (Incremental_input_type): New enum.
11631         (Incremental_inputs::Incremental_input): Initialize new fields.
11632         (Incremental_inputs::report_inputs): New method.
11633         (Incremental_inputs::report_achive): New method.
11634         (Incremental_inputs::report_object): New method.
11635         (Incremental_inputs::report_script): New method.
11636         (Incremental_inputs::finalize_inputs): New method.
11637         (Incremental_inputs::Input_info): New struct.
11638         (Incremental_inputs::Input_info_map): New typedef.
11639         (Incremental_inputs::lock_): New field.
11640         (Incremental_inputs::Inputs_): New field.
11641         (Incremental_inputs::Inputs_map): New field.
11642         * main.cc (main): Call Incremental_input::report_inputs.
11643         * options.h (Input_argument_list): Typedef moved from
11644         Input_arguments.
11645         (Input_file_group::Files): Remove, use ::Input_argument_list.
11646         (Input_file_group::Input_argument_list): Remove, use
11647         ::Input_argument_list.
11648         * plugin.cc (Plugin_manager::add_input_file): Add error in
11649         incremental build.
11650         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11651         functions.
11652         * script.cc (read_input_script): Call
11653         Incremental_input::report_script.
11654         * script.h (Script_info): New class.
11655
11656 2009-04-27  Ian Lance Taylor  <iant@google.com>
11657
11658         * x86_64.cc (do_adjust_output_section): Set entsize to
11659         plt_entry_size.
11660
11661 2009-04-23  Elliott Hughes  <enh@google.com>
11662
11663         * output.cc (Output_file::close): After short writes, continue
11664         writing from the correct offset in the buffer being written.
11665
11666 2009-04-23  Chris Demetriou  <cgd@google.com>
11667
11668         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11669         * configure: Regenerate.
11670         * config.in: Regenerate.
11671         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11672         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11673
11674 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11675
11676         * incremental.cc (Incremental_inputs_header_data): Renamed from
11677         Incremental_input_header_data.
11678         (Incremental_inputs_header_data::data_size): New field.
11679         (Incremental_inputs_header_data::put_input_file_count): Renamed
11680         from input_file_count.
11681         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11682         from command_line_offset.
11683         (Incremental_inputs_header_data::put_reserved): Renamed from
11684         put_reserved.
11685         (Incremental_inputs_entry_data): Renamed from
11686         Incremental_input_entry_data.
11687         (Incremental_inputs_entry_data::data_size): New field.
11688         (Incremental_inputs::report_command_line): New method.
11689         (Incremental_inputs::finalize): New method.
11690         (Incremental_inputs::create_incremental_inputs_data): New method.
11691         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11692         * incremental.h: New file.
11693         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11694         (Layout::finalize): Create incremental inputs section in
11695         incremental builds.
11696         (Layout::create_incremental_info_sections): New method.
11697         * layout.h (Layout::incremental_inputs): New method.
11698         (Layout::create_incremental_info_sections): New method.
11699         (Layout::incremental_inputs_): New field.
11700         * main.cc (main): Notify Incremental_input of the command line.
11701
11702 2009-04-01  Ian Lance Taylor  <iant@google.com>
11703             Mikolaj Zalewski  <mikolajz@google.com>
11704
11705         * gold.h (reserve_unordered_map): Define, three versions, one for
11706         each version of Unordered_map.
11707         * layout.cc (Layout::Layout): Remove options parameter.  Add
11708         number_of_input_files parameter.  Don't initialize options_.
11709         Initialize number_of_input_files_ and resized_signatures_.  Move
11710         sections_are_attached_.
11711         (Layout::layout_group): Reserve space for group_signatures_.
11712         (Layout::find_or_add_kept_section): Change name parameter to be a
11713         reference.  Resize signatures_ map when it gets large enough.
11714         (Layout::layout_eh_frame): Use parameters->options() instead of
11715         this->options_.
11716         (Layout::make_output_section): Likewise.
11717         (Layout::attach_allocated_section_to_segment): Likewise.
11718         (Layout::finalize, Layout::create_executable_stack): Likewise.
11719         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11720         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11721         * layout.h (class Layout): Update declarations.  Remove options_
11722         field.  Add number_of_input_files_ and resized_signatures_
11723         fields.  Move sections_are_attached_ field.
11724         * main.cc (main): Pass number of input files to Layout
11725         constructor.  Don't pass options.
11726
11727 2009-03-30  Ian Lance Taylor  <iant@google.com>
11728
11729         * ffsll.c (ffsll): Correct implementation.
11730
11731 2009-03-27  Ian Lance Taylor  <iant@google.com>
11732
11733         * ffsll.c: New file.
11734         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11735         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11736         * ftruncate.c (ftruncate): Declare before definition.
11737         * mremap.c (mremap): Likewise.
11738         * pread.c (pread): Likewise.
11739         * configure, Makefile.in, config.in: Rebuild.
11740
11741         * mremap.c: New file.
11742         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11743         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11744         (mremap): Declare if HAVE_MREMAP is not defined.
11745         * configure, Makefile.in, config.in: Rebuild.
11746
11747 2009-03-27  Cary Coutant  <ccoutant@google.com>
11748
11749         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11750         position independent.
11751         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11752         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11753
11754 2009-03-24  Cary Coutant  <ccoutant@google.com>
11755
11756         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11757         an executable.
11758         (needs_dynamic_reloc): Likewise.
11759
11760 2009-03-24  Ian Lance Taylor  <iant@google.com>
11761
11762         * yyscript.y (file_cmd): Recognize EXTERN.
11763         (extern_name_list, extern_name_list_body): New nonterminals.
11764         * script.cc (script_add_extern): Define.
11765         * script-c.h (script_add_extern): Declare.
11766
11767 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11768
11769         * object.cc (is_elf_object): Define.
11770         * object.h (is_elf_object): Declare.
11771         * archive.cc (Archive::get_elf_object_for_member): Call
11772         is_elf_object.
11773         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11774
11775 2009-03-24  Elliott Hughes  <enh@google.com>
11776
11777         * output.cc (Output_file::map_anonymous): Define.
11778         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11779         try an anonymous one.  Report the size if the mmap fails.
11780         * output.h (class Output_file): Declare map_anonymous.
11781
11782 2009-03-24  Ian Lance Taylor  <iant@google.com>
11783
11784         * target-select.cc (instantiate_target): Don't acquire the lock if
11785         the instantiated_target_ field has already been set.
11786
11787 2009-03-23  Ian Lance Taylor  <iant@google.com>
11788
11789         * gold-threads.h (class Initialize_lock): Define.
11790         * gold-threads.cc (class Initialize_lock_once): Define.
11791         (initialize_lock_control): New static variable.
11792         (initialize_lock_pointer): New static variable.
11793         (initialize_lock_once): New static function.
11794         (Initialize_lock::Initialize_lock): Define.
11795         (Initialize_lock::initialize): Define.
11796         * target-select.h: Include "gold-threads.h".
11797         (class Target_selector): Add lock_ and initialize_lock_ fields.
11798         Don't define instantiate_target, just declare it.
11799         * target-select.cc (Target_selector::Target_selector): Initialize
11800         new fields.
11801         (Target_selector::instantiate_target): Define.
11802         * descriptors.h: Include "gold-threads.h".
11803         (class Descriptors): Add initialize_lock_ field.
11804         * descriptors.cc (Descriptors::Descriptors): Initialize new
11805         field.
11806         (Descriptors::open): Use initialize_lock_ field
11807         * errors.h (class Errors): Add initialize_lock_ field.
11808         * errors.cc (Errors::Errors): Initialize new field.
11809         (Errors::initialize_lock): Use initialize_lock_ field.
11810         * powerpc.cc (class Target_selector_powerpc): Remove
11811         instantiated_target_ field.  In do_recognize call
11812         instantiate_target rather than do_instantiate_target.  In
11813         do_instantiate_target just allocate a new target.
11814         * sparc.cc (class Target_selector_sparc): Likewise.
11815
11816         * freebsd.h: New file.
11817         * i386.cc: Include "freebsd.h".
11818         (Target_i386): Derive from Target_freebsd rather than
11819         Sized_target.
11820         (Target_selector_i386): Derive from Target_selector_freebsd rather
11821         than Target_selector.
11822         * x86_64.cc: Include "freebsd.h".
11823         (Target_x86_64): Derive from Target_freebsd rather than
11824         Sized_target.
11825         (Target_selector_x86_64): Derive from Target_selector_freebsd
11826         rather than Target_selector.
11827         * target.h (class Target): Add adjust_elf_header and
11828         do_adjust_elf_header.
11829         * output.cc (Output_file_header:: do_sized_write): Call target
11830         adjust_elf_header routine.
11831         * configure.tgt: Set targ_osabi.
11832         * configure.ac: Define GOLD_DEFAULT_OSABI.
11833         * parameters.cc (Parameters::default_target): Pass
11834         GOLD_DEFAULT_OSABI to select_target.
11835         * target-select.h (class Target_selector): Make instantiate_target
11836         protected rather than private.
11837         * Makefile.am (HFILES): Add freebsd.h.
11838         * configure, Makefile.in, config.in: Rebuild.
11839
11840         * merge.cc (do_add_input_section): Correct pend value.  Change
11841         message about last entry not being null terminated from error to
11842         warning.
11843
11844 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11845
11846         * incremental.cc: New file.
11847         * Makefile.am (CCFILES): Add incremental.cc.
11848         * Makefile.in: Rebuild.
11849
11850 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11851
11852         * layout.cc (Layout::output_section_name): Preserve names
11853         of '.note.' sections.
11854
11855 2009-03-19  Ian Lance Taylor  <iant@google.com>
11856
11857         * descriptors.cc (Descriptors::open): Check that the options are
11858         valid before using them.
11859
11860 2009-03-18  Ian Lance Taylor  <iant@google.com>
11861
11862         * script-sections.h: Include <list>.
11863         (class Script_sections): Change Sections_elements from std::vector
11864         to std::list.  Typedef public Elements_iterator.  Add
11865         orphan_section_placement_, data_segment_align_start_, and
11866         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11867         field.
11868         * script-sections.cc (class Orphan_section_placement): New class.
11869         (class Sections_element): Add virtual functions is_relro and
11870         orphan_section_init.  Remove virtual function place_orphan_here.
11871         (class Output_section_definition): Add is_relro and
11872         orphan_section_init.  Remove place_orphan_here.
11873         (class Orphan_output_section): Likewise.
11874         (Script_sections::Script_sections): Update for field changes.
11875         (Script_sections::data_segment_align): Set saw_data_segment_align_
11876         and data_segment_align_start_, not data_segment_align_index.
11877         (Script_sections::data_segment_relro_end): Check
11878         saw_data_segment_align_.  Use data_segment_align_start_ rather
11879         than data_segment_align_index_.
11880         (Script_sections::place_orphan): Rewrite to use
11881         Orphan_section_placement.
11882
11883 2009-03-17  Ian Lance Taylor  <iant@google.com>
11884
11885         * archive.cc (Archive::add_symbols): Check for a version attached
11886         to the symbol name in the archive map.
11887         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11888         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11889         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11890         (ver_test_11.a): New target.
11891         * testsuite/Makefile.in: Rebuild.
11892
11893         * configure.ac: Check for chsize and posix_fallocate.  Replace
11894         ftruncate.
11895         * ftruncate.c: New file, from gnulib.
11896         * output.cc (posix_fallocate): Define dummy version if not
11897         HAVE_POSIX_FALLOCATE.
11898         (Output_file::map): Call posix_fallocate rather than lseek and
11899         write.
11900         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11901         * configure, Makefile.in, config.in: Rebuild.
11902
11903 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11904
11905         * layout.h (Layout::create_note): Add section_name parameter.
11906         * layout.cc (Layout::create_note): Likewise.
11907         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11908
11909 2009-03-17  Ian Lance Taylor  <iant@google.com>
11910
11911         * descriptors.cc: Include "options.h".
11912         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11913         (Descriptors::open): Always use O_CLOEXEC when opening a new
11914         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11915         then set FD_CLOEXEC.
11916
11917         * sparc.cc (class Target_sparc): Add has_got_section.
11918         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11919         make sure we have a GOT section.
11920
11921         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11922         (Target_sparc::Scan::local): Likewise.
11923         (Target_sparc::Scan::global): Likewise.
11924         (Target_sparc::Relocate::relocate): Likewise.
11925         (Target_sparc::Relocate::relocate_tls): Likewise.
11926
11927         * symtab.cc (Symbol_table::define_default_version): New function,
11928         broken out of add_from_object.
11929         (Symbol_table::add_from_object): Call define_default_version.
11930         (Symbol_table::define_special_symbol): Add resolve_oldsym
11931         parameter.  Change all callers.  If the version for a symbol comes
11932         from a version script, resolve it with the symbol with the same
11933         name with no version.  Also add the symbol without a version if
11934         appropriate.
11935         (do_define_in_output_data): If resolving with oldsym, don't delete
11936         sym.
11937         (do_define_in_output_segment): Likewise.
11938         (do_define_as_constant): Likewise.
11939         * symtab.h (class Symbol_table): Update declarations.
11940
11941 2009-03-13  Ian Lance Taylor  <iant@google.com>
11942
11943         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11944         (Read_symbols::requeue): New function.
11945         (Read_symbols::do_read_symbols): If make_elf_object fails because
11946         the target type is not configured, and the file was searched for,
11947         issue a warning and retry with the next directory.
11948         (Add_symbols::run): If the file has an incompatible format, and
11949         it was searched for, requeue the Read_symbols task.  On error,
11950         release the object.
11951         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11952         dirindex parameter to constructor.  Change all callers.  Declare
11953         incompatible_warning and requeue.
11954         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11955         input_argument_ and input_group_ fields.  Add them to
11956         constructor.  Change all callers.
11957         (class Read_script): Add dirindex_ field.  Add it to constructor.
11958         Change all callers.
11959         * archive.cc (Archive::setup): Remove input_objects parameter.
11960         Change all callers.
11961         (Archive::get_file_and_offset): Likewise.
11962         (Archive::read_all_symbols): Likewise.
11963         (Archive::read_symbols): Likewise.
11964         (Archive::get_elf_object_for_member): Remove input_objects
11965         parameter.  Add punconfigured parameter.  Change all callers.
11966         (Archive::add_symbols): Change return type to bool.  Check return
11967         value of include_member.
11968         (Archive::include_all_members): Likewise.
11969         (Archive::include_member): Change return type to bool.  Return
11970         false if first included object has incompatible target.  Set
11971         included_member_ field.
11972         (Add_archive_symbols::run): If add_symbols returns false, requeue
11973         Read_symbols task.
11974         * archive.h (class Archive): Add included_member_ field.
11975         Initialize it in constructor.  Add input_file and searched_for
11976         methods.  Update declarations.
11977         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11978         input_argument_ fields.  Add them to constructor.  Change all
11979         callers.
11980         * script.cc: Include "target-select.h".
11981         (class Parser_closure): Add skip_on_incompatible_target_ and
11982         found_incompatible_target_ fields.  Add
11983         skip_on_incompatible_target parameter to constructor.  Change all
11984         callers.  Add methods skip_on_incompatible_target,
11985         clear_skip_on_incompatible_target, found_incompatible_target, and
11986         set_found_incompatible_target.
11987         (read_input_script): Add dirindex parameter.  Change all callers.
11988         If parser finds an incompatible target, requeue Read_symbols
11989         task.
11990         (script_set_symbol): Clear skip_on_incompatible_target in
11991         closure.
11992         (script_add_assertion, script_parse_option): Likewise.
11993         (script_start_sections, script_add_phdr): Likewise.
11994         (script_check_output_format): New function.
11995         * script.h (read_input_script): Update declaration.
11996         * script-c.h (script_check_output_format): Declare.
11997         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11998         (ignore_cmd): Remove OUTPUT_FORMAT.
11999         * fileread.cc (Input_file::Input_file): Add explicit this.
12000         (Input_file::will_search_for): New function.
12001         (Input_file::open): Add pindex parameter.  Change all callers.
12002         * fileread.h (class Input_file): Add input_file_argument method.
12003         Declare will_search_for.  Update declarations.
12004         * object.cc (make_elf_object): Add punconfigured parameter.
12005         Change all callers.
12006         * object.h (class Object): Make input_file public.  Add
12007         searched_for method.
12008         (make_elf_object): Update declaration.
12009         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12010         restart search.
12011         * dirsearch.h (class Dirsearch): Update declaration.
12012         * options.h (class General_options): Add --warn-search-mismatch.
12013         * parameters.cc (Parameters::is_compatible_target): New function.
12014         * parameters.h (class Parameters): Declare is_compatible_target.
12015         * workqueue.cc (Workqueue::add_blocker): New function.
12016         * workqueue.h (class Workqueue): Declare add_blocker.
12017
12018         * fileread.cc (Input_file::open): Remove options parameter.
12019         Change all callers.
12020         (Input_file::open_binary): Likewise.
12021         * script.cc (read_input_script): Likewise.
12022         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12023         options parameter from constructor.  Change all callers.
12024         (class Read_script): Likewise.
12025         * fileread.h (class Input_file): Update declarations.
12026         * script.h (read_input_script): Update declaration.
12027
12028 2009-03-10  Nick Clifton  <nickc@redhat.com>
12029
12030         * po/es.po: New Spanish translation.
12031
12032 2009-03-06  Cary Coutant  <ccoutant@google.com>
12033
12034         * options.cc (parse_short_option): Keep dash_z from registering itself.
12035
12036 2009-03-03  Ian Lance Taylor  <iant@google.com>
12037
12038         PR 9918
12039         * target-reloc.h (relocate_section): Pass output_section to
12040         relocate.
12041         * i386.cc (Target_i386::should_apply_static_reloc): Add
12042         output_section parameter.  Change all callers.
12043         (Target_i386::Relocate::relocate): Add output_section parameter.
12044         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12045         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12046         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12047         * testsuite/two_file_shared.sh: New script.
12048         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12049         (check_DATA): Add two_file_shared.dbg.
12050         (two_file_shared.dbg): New target.
12051         * testsuite/Makefile.in: Rebuild.
12052
12053 2009-03-01  Ian Lance Taylor  <iant@google.com>
12054
12055         * configure.ac: Check for byteswap.h.
12056         * configure: Rebuild.
12057         * config.in: Rebuild.
12058
12059 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12060
12061         * layout.cc (Layout::find_or_add_kept_section): New function.
12062         (Layout::add_comdat): Removed.
12063         * layout.h (struct Kept_section): Move out of class Layout.
12064         Remove trailing underscores from field names.  Add group_sections
12065         field.  Rename group_ field to is_group.  Change all uses.
12066         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12067         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12068         comdat_groups_ field.
12069         (Sized_relobj::include_section_group): Use
12070         find_or_add_kept_section and Kept_section::group_sections.
12071         (Sized_relobj::include_linkonce_section): Likewise.
12072         * object.cc (class Sized_relobj): Don't define Comdat_group or
12073         Comdat_group_table.  Remove find_comdat_group and
12074         add_comdat_group.  Remove comdat_groups_ field.
12075         * plugin.cc (include_comdat_group): Use
12076         Layout::find_or_add_kept_section.
12077
12078 2009-02-28  Ian Lance Taylor  <iant@google.com>
12079
12080         * README: --gc-sections and map files are now supported.  Document
12081         some build requirements.
12082
12083         PR 6992
12084         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12085         relocatable link set the value of the section symbol to zero.
12086         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12087         relocatable link don't include the section address in the local
12088         symbol value.
12089
12090 2009-02-27  Ian Lance Taylor  <iant@google.com>
12091
12092         PR 6811
12093         * options.h (class Search_directory): Add is_system_directory.
12094         (class General_options): Declare is_in_system_directory.
12095         * options.cc (get_relative_sysroot): Make static.
12096         (get_default_sysroot): Make static.
12097         (General_optoins::is_in_system_directory): New function.
12098         * fileread.cc (Input_file::is_in_system_directory): New function.
12099         * fileread.h (class Input_file): Declare is_in_system_directory.
12100         * object.h (class Object): Add is_in_system_directory.
12101         (class Input_objects): Remove system_library_directory_ field.
12102         * object.cc (Input_objects::add_object): Don't set
12103         system_library_directory_.
12104         (input_objects::found_in_system_library_directory): Remove.
12105         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12106         parameter.  Change all callers.
12107         (Symbol_table::sized_write_globals): Likewise.
12108         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12109         Call Object::is_in_system_directory.
12110         * symtab.h (class Symbol_table): Update declarations.
12111
12112         PR 5990
12113         * descriptors.h (Open_descriptor): Add is_on_stack field.
12114         * descriptors.cc (Descriptors::open): If the descriptor is on the
12115         top of the stack, remove it.  Initialize is_on_stack field.
12116         (Descriptors::release): Only add pod to stack if it is not on the
12117         stack already.
12118         (Descriptors::close_some_descriptor): Clear stack_next and
12119         is_on_stack fields.
12120
12121         PR 7091
12122         * output.cc (Output_section::find_starting_output_address): Rename
12123         from starting_output_address; add PADDR parameter; change return
12124         type.
12125         * output.h (class Output_section): Declare
12126         find_starting_output_address instead of starting_output_address.
12127         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12128         section symbol for which we can't find a merge section.
12129
12130         PR 9836
12131         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12132         hidden or internal, force the symbol to be local.
12133         * resolve.cc (Symbol::override_visibility): Define.
12134         (Symbol::override_base): Use override_visibility.
12135         (Symbol_table::resolve): Likewise.
12136         (Symbol::override_base_with_special): Likewise.
12137         (Symbol_table::override_with_special): If the visibility is hidden
12138         or internal, force the symbol to be local.
12139         * symtab.h (class Symbol): Add set_visibility and
12140         override_visibility.
12141         * testsuite/ver_test_1.sh: New file.
12142         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12143         (check_DATA): Add ver_test_1.syms.
12144         (ver_test_1.syms): New target.
12145         * testsuite/Makefile.in: Rebuild.
12146
12147 2009-02-25  Cary Coutant  <ccoutant@google.com>
12148
12149         * layout.cc (Layout::choose_output_section): Don't rename sections
12150         when using a linker script that has a SECTIONS clause.
12151         * Makefile.in: Regenerate.
12152
12153         * testsuite/Makefile.am (script_test_5.sh): New test case.
12154         * testsuite/Makefile.in: Regenerate.
12155         * testsuite/script_test_5.cc: New file.
12156         * testsuite/script_test_5.sh: New file.
12157         * testsuite/script_test_5.t: New file.
12158
12159 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12160
12161         * archive.cc (Archive::include_member): Update calls to add_symbols.
12162         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12163         the Layout argument.
12164         * dynobj.h (do_add_symbols): Add the Layout argument.
12165         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12166         Layout argument.
12167         * object.h (Object::add_symbols): Add the Layout argument.
12168         (Object::do_add_symbols): Add the Layout argument.
12169         (Sized_relobj::do_add_symbols): Add the Layout argument.
12170         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12171         Unify the two versions.
12172         (Add_plugin_symbols): Remove.
12173         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12174         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12175         (Add_plugin_symbols): Remove.
12176         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12177         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12178         (Add_symbols::run): Make it work with Pulginobj.
12179
12180 2009-02-06  Ian Lance Taylor  <iant@google.com>
12181
12182         * object.cc (Sized_relobj::do_layout): Make info message start
12183         with lower case letter.
12184
12185 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12186
12187         * binary.cc: Fix file comment.
12188
12189         * options.h (enum Incremental_disposition): Define.
12190         (class General_options): Add new options: --incremental,
12191         --incremental_changed, --incremental_unchanged,
12192         --incremental_unknown.  Add incremental_disposition_ and
12193         implicit_incremental_ fields.
12194         (General_options::incremental_disposition): New function.
12195         (class Position_dependent_options): Add incremental_disposition
12196         option.
12197         (Position_dependent_options::copy_from_options): Set incremental
12198         dispositions.
12199         * options.cc (General_options::parse_incremental_changed): New
12200         function.
12201         (General_options::parse_incremental_unchanged): New function.
12202         (General_options::parse_incremental_unknown): New function.
12203         (General_options::General_options): Initialize new fields
12204         incremental_disposition_ and implicit_incremental_.
12205         (General_options::finalize): Check for uasge of --incremental-*
12206         without --incremental.
12207
12208 2009-02-06  Chris Demetriou  <cgd@google.com>
12209
12210         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12211         pointer and to report location as the file name associated with
12212         the symbol.
12213         (gold_undefined_symbol_at_location): New function to replace the
12214         old gold_undefined_symbol functionality.
12215         * target-reloc.h (relocate_section): Update to use
12216         gold_undefined_symbol_at_location.
12217         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12218         Call gold_undefined_symbol function rather than gold_error.
12219         * errors.h (Errors::undefined_symbol): Take location as a
12220         string, rather than calculating it from a relocation.
12221         * errors.cc (Errors::fatal): Print "fatal error:" before the
12222         formatted message.
12223         (Errors::error, Errors::error_at_location): Print "error: "
12224         before the formatted message.
12225         (Errors::undefined_symbol): Take location as a string, rather
12226         than calculating it from a relocation.
12227         (gold_undefined_symbol_at_location): New function akin to
12228         old gold_undefined_symbol, calculates location from relocation.
12229         (gold_undefined_symbol): Change to take only a Symbol pointer
12230         and to report location as the file name associated with the symbol.
12231         * testsuite/debug_msg.sh: Update for changed error messages.
12232         * testsuite/undef_symbol.sh: Likewise.
12233
12234 2009-02-04  Duncan Sands  <baldrick@free.fr>
12235
12236         PR 9812
12237         * reduced_debug_output.h
12238         (Output_reduced_debug_abbrev_section::failed): Use format for
12239         gold_warning.
12240         (Output_reduced_debug_info_section::faild): Likewise.
12241
12242 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12243
12244         * script.cc (Lazy_demangler): New class.
12245         (Version_script_info::get_symbol_version_helper): Demangle a
12246         symbol only once.
12247
12248 2009-01-29  Cary Coutant  <ccoutant@google.com>
12249
12250         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12251         to __tls_get_addr.
12252         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12253
12254 2009-01-28  Ian Lance Taylor  <iant@google.com>
12255
12256         * version.cc (version_string): Bump to 1.9.
12257
12258         * gold.h: Include <cstring> and <stdint.h>.
12259         * version.cc: Include <cstdio>.
12260         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12261         warning.
12262         * reduced_debug_output.cc (insert_into_vector): Rename from
12263         Insert_into_vector; change all callers.  Use Swap_unaligned to
12264         avoid aliasing issue; remove union since it is unnecessary.
12265
12266 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12267
12268         * Makefile.am (CCFILES): Add gc.cc.
12269         (HFILES): Add gc.h.
12270         * Makefile.in: Regenerate.
12271         * gold.cc (Gc_runner): New class.
12272         (queue_initial_tasks): Call garbage collection related tasks
12273         when corresponding options are invoked.
12274         (queue_middle_gc_tasks): New function.
12275         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12276         processed early before laying out sections during garbage collection.
12277         * gold.h (queue_middle_gc_tasks): New function.
12278         (is_prefix_of): Move from "layout.cc".
12279         * i386.cc (Target_i386::gc_process_relocs): New function.
12280         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12281         * main.cc (main): Create object of class "Garbage_collection".
12282         * object.cc (Relobj::copy_symbols_data): New function.
12283         (Relobj::is_section_name_included): New function.
12284         (Sized_relobj::do_layout): Allow this function to be called twice
12285         during garbage collection and defer layout of section during the
12286         first call.
12287         * object.h (Relobj::get_symbols_data): New function.
12288         (Relobj::is_section_name_included): New function.
12289         (Relobj::copy_symbols_data): New function.
12290         (Relobj::set_symbols_data): New function.
12291         (Relobj::get_relocs_data): New function.
12292         (Relobj::set_relocs_data): New function.
12293         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12294         (Relobj::gc_process_relocs): New function.
12295         (Relobj::do_gc_process_relocs): New pure virtual function.
12296         (Relobj::sd_): New data member.
12297         (Sized_relobj::is_output_section_offset_invalid): New function.
12298         (Sized_relobj::do_gc_process_relocs): New function.
12299         * options.h (General_options::gc_sections): Modify to not be a no-op.
12300         (General_options::print_gc_sections): New option.
12301         * plugin.cc (Plugin_finish::run): Remove function call to
12302         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12303         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12304         * reloc.cc (Read_relocs::run): Add task to process relocs and
12305         determine unreferenced sections when doing garbage collection.
12306         (Gc_process_relocs): New class.
12307         (Sized_relobj::do_gc_process_relocs): New function.
12308         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12309         sections that are garbage collected.
12310         * reloc.h (Gc_process_relocs): New class.
12311         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12312         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12313         symbols whose corresponding sections are garbage collected.
12314         (Symbol_table::Symbol_table): Add new parameter for the garbage
12315         collection object.
12316         (Symbol_table::gc_mark_undef_symbols): New function.
12317         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12318         (Symbol_table::gc_mark_dyn_syms): New function.
12319         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12320         as garbage.
12321         (Symbol_table::add_from_object): Likewise.
12322         (Symbol_table::add_from_relobj): When building shared objects, do not
12323         treat externally visible symbols as garbage.
12324         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12325         table information for static and relocatable links.
12326         * symtab.h (Symbol_table::set_gc): New function.
12327         (Symbol_table::gc): New function.
12328         (Symbol_table::gc_mark_undef_symbols): New function.
12329         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12330         (Symbol_table::gc_mark_dyn_syms): New function.
12331         (Symbol_table::gc_): New data member.
12332         * target.h (Sized_target::gc_process_relocs): New pure virtual
12333         function.
12334         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12335         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12336
12337 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12338
12339         * options.h (General_options::gc_sections): Define as a no-op for now.
12340         (General_options::no_keep_memory): Ditto.
12341         (General_options::Bshareable): Define.
12342         * options.cc (General_options::finalize): Honor -Bshareable.
12343
12344 2009-01-20  Andreas Schwab  <schwab@suse.de>
12345
12346         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12347         read the value in the contents, since we don't use it.  Use the
12348         template endianness when writing.
12349         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12350
12351 2009-01-19  Andreas Schwab  <schwab@suse.de>
12352
12353         * configure.tgt (powerpc64-*): Fix targ_obj.
12354
12355 2009-01-15  Ian Lance Taylor  <iant@google.com>
12356
12357         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12358         local symbols when stripping all symbols.
12359
12360 2009-01-14  Cary Coutant  <ccoutant@google.com>
12361
12362         * output.cc (Output_reloc): Add explicit instantiations.
12363
12364 2009-01-14  Cary Coutant  <ccoutant@google.com>
12365
12366         * archive.cc (Archive::get_elf_object_for_member): Remove call
12367         to File_read::claim_for_plugin.
12368         * descriptors.cc (Descriptors::open): Remove reference to
12369         is_claimed.
12370         (Descriptors::claim_for_plugin): Remove.
12371         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12372         (Descriptors::is_claimed): Remove.
12373         (claim_descriptor_for_plugin): Remove.
12374         * fileread.cc (File_read::claim_for_plugin): Remove.
12375         * fileread.h (File_read::claim_for_plugin): Remove.
12376         (File_read::descriptor): Reopen descriptor if necessary.
12377         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12378         (Plugin_manager::all_symbols_read): Add task parameter. Change
12379         all callers.
12380         (Plugin_manager::get_input_file): New function.
12381         (Plugin_manager::release_input_file): New function.
12382         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12383         corresponding data member.
12384         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12385         and pass to base constructor. Change all callers.
12386         (get_input_file, release_input_file): New functions.
12387         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12388         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12389         (Plugin_manager::all_symbols_read): Add task parameter.
12390         (Plugin_manager::get_input_file): New function.
12391         (Plugin_manager::release_input_file): New function.
12392         (Plugin_manager::task_): New data member.
12393         (Pluginobj::Pluginobj): Add filesize parameter.
12394         (Pluginobj::filename): New function.
12395         (Pluginobj::descriptor): New function.
12396         (Pluginobj::filesize): New function.
12397         (Pluginobj::filesize_): New data member.
12398         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12399         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12400         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12401
12402         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12403         with archive libraries.
12404         * testsuite/Makefile.in: Regenerate.
12405         * testsuite/plugin_test.c (struct sym_info): New type.
12406         (get_input_file, release_input_file): New static variables.
12407         (onload): Capture new transfer vector entries.
12408         (claim_file_hook): Stop reading at end of file according to filesize.
12409         Factor out parsing of readelf output into separate function.
12410         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12411         APIs and get the source file name from the symbol table.  Convert
12412         source file name to corresponding object file name.  Print info
12413         message when adding new input files.
12414         (parse_readelf_line): New function.
12415         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12416         * testsuite/plugin_test_2.sh: Likewise.
12417         * testsuite/plugin_test_3.sh: Likewise.
12418         * testsuite/plugin_test_4.sh: New test case.
12419
12420 2009-01-07  Ian Lance Taylor  <iant@google.com>
12421
12422         * version.cc (version_string): Bump to 1.8.
12423
12424 2008-12-23  Cary Coutant  <ccoutant@google.com>
12425
12426         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12427         * plugin.cc (Plugin_manager::finish): Rename as
12428         layout_deferred_objects.  Move cleanup to separate function.
12429         (Plugin_manager::cleanup): New function.
12430         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12431         separately.
12432         * plugin.h (Plugin_manager::finish): Rename as
12433         layout_deferred_objects.
12434         (Plugin_manager::cleanup): New function.
12435         (Plugin_manager::cleanup_done): New field.
12436
12437 2008-12-23  Cary Coutant  <ccoutant@google.com>
12438
12439         * plugin.cc (is_visible_from_outside): New function.
12440         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12441         so we don't return "IR only" status for exported symbols or -r links.
12442
12443         * testsuite/Makefile.am (plugin_test_3): New test case.
12444         * testsuite/Makefile.in: Regenerate.
12445         * testsuite/plugin_test_3.sh: New file.
12446
12447 2008-12-22  Cary Coutant  <ccoutant@google.com>
12448
12449         * object.cc (Sized_relobj::layout_section): New function.
12450         (Sized_relobj::do_layout): Defer layout of input sections until after
12451         plugin has provided replacement files.
12452         (Sized_relobj::do_layout_deferred_sections): New function.
12453         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12454         (Relobj::layout_deferred_sections): New function.
12455         (Relobj::do_layout_deferred_sections): New function.
12456         (Sized_relobj::do_layout_deferred_sections): New function.
12457         (Sized_relobj::layout_section): New function.
12458         (Sized_relobj::Deferred_layout): New structure.
12459         (Sized_relobj::deferred_layout_): New field.
12460         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12461         Change all callers.  Layout deferred sections.
12462         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12463         references.
12464         (Plugin_hook::run): Move code from do_plugin_hook inline.
12465         (Plugin_hook::do_plugin_hook): Remove.
12466         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12467         (Plugin_manager::finish): Renamed, was cleanup.
12468         (Plugin_manager::should_defer_layout): New function.
12469         (Plugin_manager::add_deferred_layout_object): New function.
12470         (Plugin_manager::Deferred_layout_list): New type.
12471         (Plugin_manager::deferred_layout_objects_): New field.
12472         (Plugin_hook::do_plugin_hook): Remove.
12473
12474 2008-12-17  Ian Lance Taylor  <iant@google.com>
12475
12476         * options.h (class General_options): Add --no case for
12477         --export-dynamic.
12478
12479 2008-12-16  Cary Coutant  <ccoutant@google.com>
12480
12481         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12482         vector.
12483         (Plugin_manager::claim_file): Create plugin object even if
12484         plugin did not call the add_symbols callback.
12485         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12486         asking for more symbols than were added.
12487         * testsuite/Makefile.am (plugin_test_1): Add test case with
12488         no global symbols.
12489         (empty.syms): New target.
12490         * testsuite/Makefile.in: Regenerate.
12491         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12492         message. Don't call add_symbols if no globals.
12493         (all_symbols_read_hook): Don't provide replacement for empty
12494         claimed file.
12495
12496 2008-12-12  Ian Lance Taylor  <iant@google.com>
12497
12498         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12499         r_type == 0 for a local symbol with r_sym == 0.
12500         (scan_relocatable_relocs): Pass r_sym to
12501         local_non_section_strategy.
12502         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12503         r_sym parameter.
12504
12505         * configure.ac: Update test for TLS descriptors: they are
12506         supported as of glibc 2.9.
12507         * configure: Rebuild.
12508
12509 2008-12-11  Ian Lance Taylor  <iant@google.com>
12510
12511         PR 7091
12512         * target-reloc.h (Default_scan_relocatable_relocs): For each
12513         function, map r_type == 0 to RELOC_DISCARD.
12514
12515 2008-12-10  Cary Coutant  <ccoutant@google.com>
12516
12517         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12518         object to override a kept COMDAT group from a plugin object.
12519
12520 2008-12-09  Ian Lance Taylor  <iant@google.com>
12521
12522         PR 7088
12523         * yyscript.y (file_cmd): Handle INPUT.
12524
12525         * testsuite/initpri1.c: Change all declarations to be full
12526         prototypes by adding void, to avoid compiler warnings.
12527
12528 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12529
12530         * options.cc (General_options::parse_plugin_opt): New.
12531         (General_options::add_plugin): The argument now is just the filename.
12532         (General_options::add_plugin_option): New.
12533         * options.h (plugin_opt): New.
12534         (add_plugin): Change argument name.
12535         (add_plugin_option): New.
12536         * plugin.cc (Plugin::load): Don't parse the plugin option.
12537         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12538         (Plugin::add_option): New.
12539         (Plugin::args_): Change type.
12540         (Plugin::filename_): New.
12541         (Plugin_manager::add_plugin_option): New.
12542         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12543         * testsuite/Makefile.in: Regenerate.
12544
12545 2008-12-05  Cary Coutant  <ccoutant@google.com>
12546
12547         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12548         Handle --strip-lto-sections option.
12549         * options.h (strip_lto_sections): New option.
12550
12551 2008-12-01  Cary Coutant  <ccoutant@google.com>
12552
12553         * plugin.cc (ld_plugin_message): Change format parameter to const.
12554         Fix mismatch between new[] and delete.
12555
12556 2008-11-14  Cary Coutant  <ccoutant@google.com>
12557
12558         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12559         instead of -1U.
12560
12561 2008-11-05  Craig Silverstein  <csilvers@google.com>
12562
12563         * options.cc (General_options::parse_dynamic_list): New function.
12564         * options.h (General_options): New flags dynamic_list,
12565         dynamic_list_data, dynamic_list_cpp_new, and
12566         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12567         (General_options::in_dynamic_list): New function.
12568         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12569         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12570         (Lex::can_continue_name): Likewise.
12571         (yylex): Likewise.
12572         (read_script_file): New parameter script_options.
12573         (read_dynamic_list): New function.
12574         (Script_options::define_dynamic_list): New function.
12575         (dynamic_list_keyword_parsecodes): New variable.
12576         (dynamic_list_keywords): New variable.
12577         * script.h (Script_options::define_dynamic_list): New function
12578         prototype.
12579         (read_dynamic_list): New function prototype.
12580         * symtab.cc (strprefix): New macro.
12581         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12582         dynamic_list_data, dynamic_list_cpp_new, and
12583         dynamic_list_cpp_typeinfo.
12584         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12585         (dynamic_list_expr): New rule.
12586         (dynamic_list_nodes): Likewise.
12587         (dynamic_list_node): Likewise.
12588         * testsuite/Makefile.am (dynamic_list): New test.
12589         * testsuite/Makefile.in: Regenerated.
12590         * testsuite/dynamic_list.t: New file.
12591         * testsuite/dynamic_list.sh: New file.
12592
12593 2008-11-05  Craig Silverstein  <csilvers@google.com>
12594
12595         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12596         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12597         (t11_last): Likewise.
12598         * testsuite/ver_test_6.c (main): Likewise.
12599
12600 2008-10-07  Cary Coutant  <ccoutant@google.com>
12601
12602         * options.c (General_options::finalize): Add check for -static and
12603         -shared.
12604         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12605         is not empty.
12606
12607 2008-10-02  Cary Coutant  <ccoutant@google.com>
12608
12609         * plugin.cc (make_sized_plugin_object): Fix conditional
12610         compilation to work when not all targets are enabled.
12611
12612 2008-09-29  Cary Coutant  <ccoutant@google.com>
12613
12614         * archive.cc (Archive::get_file_and_offset): Use filename instead
12615         of name to get library path.
12616         (Archive::include_member): Unlock external member of a thin archive.
12617
12618         * testsuite/Makefile.am (TEST_AR): New variable.
12619         (thin_archive_test_1): New test.
12620         (thin_archive_test_2): New test.
12621         * testsuite/Makefile.in: Regenerate.
12622         * testsuite/thin_archive_main.cc: New file.
12623         * testsuite/thin_archive_test_1.cc: New file.
12624         * testsuite/thin_archive_test_2.cc: New file.
12625         * testsuite/thin_archive_test_3.cc: New file.
12626         * testsuite/thin_archive_test_4.cc: New file.
12627
12628 2008-09-29  Cary Coutant  <ccoutant@google.com>
12629
12630         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12631         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12632         instead of -1U.
12633         (Sized_relobj::do_finalize_local_symbols): Likewise.
12634         (Sized_relobj::map_to_kept_section): Likewise.
12635         * object.h (Sized_relobj::invalid_address): New constant.
12636         (Sized_relobj::do_output_section_offset): Check for invalid_address
12637         and return -1ULL.
12638         * output.cc (Output_reloc::local_section_offset): Use constant
12639         invalid_address instead of -1U.
12640         (Output_reloc::get_address): Likewise.
12641         (Output_section::output_address): Change -1U to -1ULL.
12642         * output.h (Output_reloc::invalid_address): New constant.
12643         * reloc.cc (Sized_relobj::write_sections): Use constant
12644         invalid_address instead of -1U.
12645         (Sized_relobj::relocate_sections): Likewise.
12646         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12647         values for merge sections.
12648         * target-reloc.h (relocate_for_relocatable): Use constant
12649         invalid_address instead of -1U.
12650
12651 2008-09-19  Cary Coutant  <ccoutant@google.com>
12652
12653         Add plugin functionality for link-time optimization (LTO).
12654         * configure.ac (plugins): Add --enable-plugins option.
12655         * configure: Regenerate.
12656         * config.in: Regenerate.
12657         * Makefile.am (LIBDL): New variable.
12658         (CCFILES): Add plugin.cc.
12659         (HFILES): Add plugin.h.
12660         (ldadd_var): Add LIBDL.
12661         * Makefile.in: Regenerate.
12662
12663         * archive.cc: Include "plugin.h".
12664         (Archive::setup): Don't preread archive symbols when using a plugin.
12665         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12666         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12667         files.
12668         (Archive::include_member): Add symbols from plugin objects.
12669         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12670         * descriptors.cc (Descriptors::open): Check for file descriptors
12671         abandoned by plugins.
12672         (Descriptors::claim_for_plugin): New function.
12673         * descriptors.h (Descriptors::claim_for_plugin): New function.
12674         (Open_descriptor::is_claimed): New field.
12675         (claim_descriptor_for_plugin): New function.
12676         * fileread.cc (File_read::claim_for_plugin): New function.
12677         * fileread.h (File_read::claim_for_plugin): New function.
12678         (File_read::descriptor): New function.
12679         * gold.cc: Include "plugin.h".
12680         (queue_initial_tasks): Add task to call plugin hooks for generating
12681         new object files.
12682         * main.cc: Include "plugin.h".
12683         (main): Load plugin libraries.
12684         * object.h (Pluginobj): Declare.
12685         (Object::pluginobj): New function.
12686         (Object::do_pluginobj): New function.
12687         (Object::set_target): New function.
12688         * options.cc: Include "plugin.h".
12689         (General_options::parse_plugin): New function.
12690         (General_options::General_options): Initialize plugins_ field.
12691         (General_options::add_plugin): New function.
12692         * options.h (Plugin_manager): Declare.
12693         (General_options): Add --plugin option.
12694         (General_options::has_plugins): New function.
12695         (General_options::plugins): New function.
12696         (General_options::add_plugin): New function.
12697         (General_options::plugins_): New field.
12698         * plugin.cc: New file.
12699         * plugin.h: New file.
12700         * readsyms.cc: Include "plugin.h".
12701         (Read_symbols::do_read_symbols): Check for archive before checking
12702         for ELF file.  Call plugin hooks to claim files.
12703         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12704         from a real object file; force override when processing replacement
12705         files.
12706         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12707         (Symbol::init_base_object): Likewise.
12708         (Symbol::init_base_output_data): Likewise.
12709         (Symbol::init_base_output_segment): Likewise.
12710         (Symbol::init_base_constant): Likewise.
12711         (Symbol::init_base_undefined): Likewise.
12712         (Symbol::output_section): Assert that object is not a plugin.
12713         (Symbol_table::add_from_pluginobj): New function.
12714         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12715         undefined.
12716         (Symbol_table::sized_write_globals): Likewise.
12717         (Symbol_table::add_from_pluginobj): Instantiate template.
12718         * symtab.h (Sized_pluginobj): Declare.
12719         (Symbol::in_real_elf): New function.
12720         (Symbol::set_in_real_elf): New function.
12721         (Symbol::in_real_elf_): New field.
12722         (Symbol_table::add_from_pluginobj): New function.
12723
12724         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12725         (LIBDL): New variable.
12726         (LDADD): Add LIBDL.
12727         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12728         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12729         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12730         (MOSTLYCLEANFILES): Likewise.
12731         * testsuite/Makefile.in: Regenerate.
12732         * testsuite/plugin_test.c: New file.
12733         * testsuite/plugin_test_1.sh: New file.
12734         * testsuite/plugin_test_2.sh: New file.
12735
12736 2008-09-16  Ian Lance Taylor  <iant@google.com>
12737
12738         * target-reloc.h (relocate_section): Check whether a symbol is
12739         defined by the ABI before reporting an undefined symbol error.
12740         * target.h (Target::is_defined_by_abi): Make parameter const.
12741         (Target::do_is_defined_by_abi): Likewise.
12742         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12743         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12744         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12745         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12746         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12747         * testsuite/Makefile.in: Rebuild.
12748
12749         * fileread.cc (make_view): Add casts to avoid warning.
12750
12751 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12752
12753         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12754         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12755
12756 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12757
12758         * options.h (General_options::output_is_executable): New.
12759         (General_options::output_is_pie): New.
12760         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12761         for shared libraries.
12762         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12763
12764 2008-09-11  Chris Demetriou  <cgd@google.com>
12765
12766         * options.h (origin): New -z option.
12767         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12768         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12769         in DT_FLAGS_1.
12770
12771 2008-09-05  Cary Coutant  <ccoutant@google.com>
12772
12773         * fileread.cc (File_read::make_view): Add check for attempt to map
12774         beyond end of file.
12775
12776 2008-09-05  Cary Coutant  <ccoutant@google.com>
12777
12778         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12779         explicit instantiations.
12780
12781 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12782
12783         PR gold/6858
12784         * options.cc (General_options::finalize): Allow undefined symbols
12785         in shlibs if linking -shared.
12786
12787         PR gold/6859
12788         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12789         symbols as not needing a dynsym entry.
12790
12791 2008-08-20  Craig Silverstein  <csilvers@google.com>
12792
12793         * fileread.cc (File_read::open): Do not lock the file unless it
12794         was successfully opened.
12795
12796 2008-08-14  Cary Coutant  <ccoutant@google.com>
12797
12798         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12799         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12800         * testsuite/tls_test.cc (struct int128): 128-bit struct
12801         for testing TLS relocs with non-zero addend.
12802         (v12): New TLS variable.
12803         (t12): New test.
12804         (t_last): Add check for v12.
12805         * testsuite/tls_test.h (t12): New function.
12806         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12807
12808 2008-08-13  Ian Lance Taylor  <iant@google.com>
12809
12810         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12811         set tls_segment_ or relro_segment_.
12812         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12813         when appropriate.
12814         * output.h (Output_section::clear_is_relro): New function.
12815         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12816         sections specially even when output_data_ is empty.
12817         (Output_segment::maximum_alignment): When first section is relro,
12818         only force alignment for PT_LOAD segments.
12819         * script.cc (script_data_segment_align): New function.
12820         (script_data_segment_relro_end): New function.
12821         * script-c.h (script_data_segment_align): Declare.
12822         (script_data_segment_relro_end): Declare.
12823         * script-sections.h (class Script_sections): Declare
12824         data_segment_align and data_segment_relro_end.  Add fields
12825         segment_align_index_ and saw_relro_end_.
12826         * script-sections.cc (class Sections_element): Add set_is_relro
12827         virtual function.  Add new bool* parameter to place_orphan_here.
12828         Add get_output_section virtual function.
12829         (class Output_section_definition): Add set_is_relro.  Add new
12830         bool* parameter to place_orphan_here.  Add get_output_section.
12831         Add is_relro_ field.
12832         (Output_section_definition::Output_section_definition): Initialize
12833         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12834         and is_relro_ fields.
12835         (Output_section_definition::place_orphan_here): Add is_relro
12836         parameter.
12837         (Output_section_definition::set_section_addresses): Set relro for
12838         output section.
12839         (Output_section_definition::alternate_constraint): Likewise.
12840         (class Orphan_output_section): Add new bool* parameter to
12841         place_orphan_here.  Add get_output_section.
12842         (Orphan_output_section::place_orphan_here): Add is_relro
12843         parameter.
12844         (Script_sections::Script_sections): Initialize
12845         data_segment_align_index_ and saw_relro_end_.
12846         (Script_sections::data_segment_align): New function.
12847         (Script_sections::data_segment_relro_end): New function.
12848         (Script_sections::place_orphan): Set or clear is_relro.
12849         (Script_sections::set_section_addresses): Force alignment of first
12850         TLS section.
12851         * yyscript.y (exp): Call script_data_segment_align and
12852         script_data_segment_relro_end.
12853         * testsuite/relro_script_test.t: New file.
12854         * testsuite/relro_test.cc (using_script): Declare.
12855         (t1, t2): Test using_script.
12856         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12857         (relro_script_test_SOURCES): Define.
12858         (relro_script_test_DEPENDENCIES): Define.
12859         (relro_script_test_LDFLAGS): Define.
12860         (relro_script_test_LDADD): Define.
12861         (relro_script_test.so): New target.
12862         * testsuite/Makefile.in: Rebuild.
12863
12864 2008-08-06  Cary Coutant <ccoutant@google.com>
12865
12866         * archive.cc (Archive::total_archives, Archive::total_members)
12867         (Archive::total_members_loaded): New variables.
12868         (Archive::setup): Add parameter.  Add option to preread
12869         archive symbols.
12870         (Archive::read_armap): Add counter.
12871         (Archive::get_file_and_offset): New function.
12872         (Archive::get_elf_object_for_member): New function.
12873         (Archive::read_all_symbols): New function.
12874         (Archive::read_symbols): New function.
12875         (Archive::add_symbols): Add counters.
12876         (Archive::include_all_members): Use armap to find members if it's
12877         already built.
12878         (Archive::include_member): Skip reading symbols if already read.
12879         Factored code into Archive::get_file_and_offset and
12880         Archive::get_elf_object_for_member.  Changed call to
12881         Mapfile::report_include_archive_member.
12882         (Archive::print_stats): New function.
12883         * archive.h: Declare Object and Read_symbols_data classes.
12884         (Archive::Archive): Add initializers for new members.
12885         (Archive::setup): Add parameter.
12886         (Archive::print_stats): New function.
12887         (Archive::total_archives, Archive::total_members)
12888         (Archive::total_members_loaded): New variables.
12889         (Archive::get_file_and_offset): New function.
12890         (Archive::get_elf_object_for_member): New function.
12891         (Archive::read_all_symbols): New function.
12892         (Archive::read_symbols): New function.
12893         (Archive::Archive_member): New class.
12894         (Archive::members_): New member.
12895         (Archive::num_members_): New member.
12896         * main.cc: Include archive.h.
12897         (main): Call Archive::print_stats.
12898         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12899         archive parameter; member_name is now the fully-decorated name.
12900         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12901         * options.h: (General_options): Add --preread-archive-symbols option.
12902         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12903         Archive::setup.
12904
12905 2008-08-04  Ian Lance Taylor  <iant@google.com>
12906
12907         * symtab.h (Symbol::use_plt_offset): New function.
12908         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12909         * powerpc.cc (Relocate::relocate): Likewise.
12910         * sparc.cc (Relocate::relocate): Likewise.
12911         * x86_64.cc (Relocate::relocate): Likewise.
12912         * testsuite/weak_plt.sh: New test.
12913         * testsuite/weak_plt_main.cc: New test.
12914         * testsuite/weak_plt_shared.cc: New test.
12915         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12916         (check_PROGRAMS): Add weak_plt.
12917         (check_DATA): Add weak_plt_shared.so.
12918         (weak_plt_main_pic.o, weak_plt): New targets.
12919         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12920         * testsuite/Makefile.in: Rebuild.
12921
12922         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12923         gcctestdir/ld.
12924         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12925         * testsuite/Makefile.in: Rebuild.
12926
12927 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12928
12929         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12930         * Makefile.in: Regenerate.
12931         * po/POTFILES.in: Regenerate.
12932
12933 2008-07-29  Ian Lance Taylor  <iant@google.com>
12934
12935         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12936         symbols before other symbols.
12937         * testsuite/script_test_2.cc (test_addr): Declare.
12938         (test_addr_alias): Declare.
12939         (main): Check that test_addr and test_addr_alias have the right
12940         values.
12941         * testsuite/script_test_2.t: Define test_addr_alias and
12942         test_addr.
12943
12944 2008-07-24  Ian Lance Taylor  <iant@google.com>
12945
12946         PR 5990
12947         * descriptors.cc: New file.
12948         * descriptors.h: New file.
12949         * gold-threads.h (class Hold_optional_lock): New class.
12950         * fileread.cc: Include "descriptors.h".
12951         (File_read::~File_read): Release descriptor rather than closing
12952         it.
12953         (File_read::open) [file]: Call open_descriptor rather than open.
12954         Set is_descriptor_opened_.
12955         (File_read::open) [memory]: Assert that descriptor is not open.
12956         (File_read::reopen_descriptor): New function.
12957         (File_read::release): Release descriptor.
12958         (File_read::do_read): Make non-const.  Reopen descriptor.
12959         (File_read::read): Make non-const.
12960         (File_read::make_view): Reopen descriptor.
12961         (File_read::do_readv): Likewise.
12962         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12963         Update declarations.
12964         * layout.cc: Include "descriptors.h".
12965         (Layout::create_build_id): Use open_descriptor rather than open.
12966         * output.cc: Include "descriptors.h".
12967         (Output_file::open): Use open_descriptor rather than open.
12968         * archive.cc (Archive::const_iterator): Change Archive to be
12969         non-const.
12970         (Archive::begin, Archive::end): Make non-const.
12971         (Archive::count_members): Likewise.
12972         * archive.h (class Archive): Update declarations.
12973         * object.h (Object::read): Make non-const.
12974         * Makefile.am (CCFILES): Add descriptors.cc.
12975         (HFILES): Add descriptors.h.
12976         * Makefile.in: Rebuild.
12977
12978         PR 6716
12979         * gold.h: Always include <clocale>.  Add Solaris workarounds
12980         following code in binutils/sysdep.h.
12981
12982         PR 6048
12983         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12984         this->eh_frame_hdr_ is NULL before using it.
12985
12986         * dynobj.cc (Versions::Versions): Update comment.
12987
12988         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12989         the base version name.
12990
12991         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12992         array size plus one.
12993         (Stringpool_template::set_string_offsets): Subtract one from key
12994         before using it as an array index.
12995         (Stringpool_template::get_offset_with_length): Likewise.
12996         (Stringpool_template::write_to_buffer): Likewise.
12997         * stringpool.h (Stringpool_template::get_offset_from_key):
12998         Likewise.
12999
13000 2008-07-23  Ian Lance Taylor  <iant@google.com>
13001
13002         PR 6658
13003         * object.h (Merged_symbol_value::value): Do our best to handle a
13004         negative addend.
13005
13006         PR 6647
13007         * script.cc (Version_script_info::get_versions): Don't add empty
13008         version tag to return value.
13009         (Version_script_info::get_symbol_version_helper): Change return
13010         type to bool.  Add pversion parameter.  Change all callers.
13011         (script_register_vers_node): Don't require a non-NULL tag.
13012         * script.h (class Version_script_info): Update declarations.
13013         (Version_script_info::get_symbol_version): Change return type to
13014         bool.  Add version parameter.  Change all callers.
13015         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13016         handling.  Handle an empty version from a version script.
13017         (Symbol_table::define_special_symbol): Likewise.
13018         * testsuite/ver_test_10.script: New file.
13019         * testsuite/ver_test_10.sh: New file.
13020         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13021         (check_DATA): Add ver_test_10.syms.
13022         (ver_test_10.syms, ver_test_10.so): New target.
13023         * testsuite/Makefile.in: Rebuild.
13024
13025 2008-07-23  Simon Baldwin  <simonb@google.com>
13026
13027         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13028         to zero for undefined symbols from dynamic libraries.
13029
13030 2008-07-23  Ian Lance Taylor  <iant@google.com>
13031
13032         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13033         Change all callers.
13034         * symtab.h (class Symbol_table): Update declaration.
13035         * testsuite/ver_test_9.cc: New file.
13036         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13037         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13038         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13039         (ver_test_9.so, ver_test_9.o): New targets.
13040         * testsuite/Makefile.in: Rebuild.
13041
13042 2008-07-22  Ian Lance Taylor  <iant@google.com>
13043
13044         * options.h (class General_options): Define --check-sections.
13045         * layout.cc (Layout::set_segment_offsets): Handle
13046         --check-sections.
13047
13048         * options.h (class General_options): Define -n/--nmagic and
13049         -N/--omagic.
13050         * options.cc (General_options::finalize): For -n/--nmagic or
13051         -N/--omagic, set -static.
13052         * layout.cc (Layout::attach_allocated_section_to_segment): If
13053         -N/--omagic, don't put read-only and read-write sections in
13054         different segments.
13055         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13056         finding a read-only segment.
13057         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13058         don't set the minimum segment alignment to the common page size,
13059         and don't set the file offset to the address modulo the page size.
13060         * script-sections.cc (Script_sections::create_segments): If
13061         -n/--omagic, don't put read-only and read-write sections in
13062         different segments.
13063
13064         * cref.cc: New file.
13065         * cref.h: New file.
13066         * options.h (class General_options): Add --print-symbol-counts.
13067         * main.cc (main): Issue defined symbol report if requested.
13068         * archive.cc (Archive::interpret_header): Make into a const member
13069         function.
13070         (Archive::add_symbols): Call Input_objects::archive_start and
13071         archive_stop.
13072         (Archive::const_iterator): Define new class.
13073         (Archive::begin, Archive::end): New functions.
13074         (Archive::include_all_members): Rewrite to use iterator.
13075         (Archive::count_members): New function.
13076         * archive.h (class Archive): Update declarations.
13077         (Archive::filename): New function.
13078         * object.cc: Include "cref.h".
13079         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13080         (Sized_relobj::do_get_global_symbol_counts): New function.
13081         (Input_objects::add_object): Add object to cross-referencer.
13082         (Input_objects::archive_start): New function.
13083         (Input_objects::archive_stop): New function.
13084         (Input_objects::print_symbol_counts): New function.
13085         * object.h: Declare Cref and Archive.
13086         (Object::get_global_symbol_counts): New function.
13087         (Object::do_get_global_symbol_counts): New pure virtual function.
13088         (class Sized_relobj): Add defined_count_ field.  Update
13089         declarations.
13090         (class Input_objects): Add cref_ field.  Update constructor.
13091         Update declarations.
13092         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13093         defined_count_.
13094         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13095         symbol counts.
13096         (Sized_dynobj::do_get_global_symbol_counts): New function.
13097         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13098         defined_count_.  Update declarations.  Define Symbols typedef.
13099         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13100         parameter.  Change all callers.
13101         (Symbol_table::add_from_dynobj): Add sympointers and defined
13102         parameters.  Change all callers.
13103         * symtab.h (class Symbol_table): Update declarations.
13104         * Makefile.am (CCFILES): Add cref.cc.
13105         (HFILES): Add cref.h.
13106         * Makefile.in: Rebuild.
13107
13108 2008-07-22  Simon Baldwin  <simonb@google.com>
13109
13110         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13111         to zero when writing undefined symbols.
13112
13113 2008-07-22  Ian Lance Taylor  <iant@google.com>
13114
13115         * output.cc (Output_section::add_input_section): Don't try to
13116         merge empty merge sections.
13117
13118 2008-07-21  Craig Silverstein  <csilvers@google.com>
13119
13120         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13121         Include symbol version in error message.
13122
13123 2008-07-20  Chris Demetriou  <cgd@google.com>
13124
13125         * configure.ac (gold_cv_c_random_seed): New configured variable.
13126         (RANDOM_SEED_CFLAGS): New substituted variable.
13127         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13128         * configure: Rebuild.
13129         * Makefile.in: Likewise.
13130         * testsuite/Makefile.in: Likewise.
13131
13132 2008-07-18  Ian Lance Taylor  <iant@google.com>
13133
13134         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13135         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13136         * testsuite/ver_test_main.cc (main): Call t4.
13137         (t4, t4_2a): Define.
13138         * testsuite/ver_test_2.cc (t4_2): Define.
13139         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13140         * testsuite/ver_test_4.cc (t4_2a): Define.
13141         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13142         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13143
13144 2008-07-17  Ian Lance Taylor  <iant@google.com>
13145
13146         * dynobj.cc (Versions::add_def): If we give an error about a
13147         missing version, go ahead and create the version anyhow.
13148
13149 2008-07-10  Ian Lance Taylor  <iant@google.com>
13150
13151         Handle output sections with more than 0x7fffffff bytes.
13152         * object.h (class Relobj): Change map_to_output_ to
13153         output_sections_, and just keep a section pointer.  Change all
13154         uses.  Move comdat group support to Sized_relobj.
13155         (Relobj::is_section_specially_mapped): Remove.
13156         (Relobj::output_section): Remove poff parameter.  Change all
13157         callers.
13158         (Relobj::output_section_offset): New function.
13159         (Relobj::set_section_offset): Rewrite.
13160         (Relobj::map_to_output): Remove.
13161         (Relobj::output_sections): New function.
13162         (Relobj::do_output_section_offset): New pure virtual function.
13163         (Relobj::do_set_section_offset): Likewise.
13164         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13165         group support from Relobj.  Update declarations.
13166         (Sized_relobj::get_output_section_offset): New function.
13167         (Sized_relobj::do_output_section_offset): New function.
13168         (Sized_relobj::do_set_section_offset): New function.
13169         * object.cc (Relobj::output_section_address): Remove.
13170         (Sized_relobj::Sized_relobj): Initialize new fields.
13171         (Sized_relobj::include_section_group): Cast find_kept_object to
13172         Sized_relobj.
13173         (Sized_relobj::include_linkonce_section): Likewise.
13174         (Sized_relobj::do_layout): Use separate arrays for output section
13175         and output offset.
13176         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13177         output_sections.
13178         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13179         output_sections and section_offsets.
13180         (Sized_relobj::write_local_symbols): Likewise.
13181         (map_to_kept_section): Compute output address directly.
13182         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13183         output_sections and section_offsets.
13184         (Sized_relobj::write_sections): Likewise.
13185         (Sized_relobj::relocate_sections): Likewise.
13186         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13187         * output.h (class Output_reloc): Update declarations.  Change
13188         u2_.relobj to Sized_relobj*.
13189         (class Output_data_reloc): Change add functions to use
13190         Sized_relobj*.
13191         * output.cc (Output_reloc::Output_reloc): Change relobj to
13192         Sized_relobj*.
13193         (Output_reloc::local_section_offset): Change return type to
13194         Elf_Addr.  Use get_output_section_offset.
13195         (Output_reloc::get_address): Likewise.
13196         (Output_section::is_input_address_mapped): Don't call
13197         is_section_specially_mapped.
13198         (Output_section::output_offset): Likewise.
13199         (Output_section::output_address): Likewise.
13200         (Output_section::starting_output_address): Likewise.
13201         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13202         parameter to Sized_relobj*.
13203         (Copy_relocs::need_copy_reloc): Likewise.
13204         (Copy_relocs::save): Likewise.
13205         * copy-relocs.h (class Copy_relocs): Update declarations.
13206         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13207         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13208         * target-reloc.h (relocate_for_relocatable): Change
13209         offset_in_output_section type to Elf_Addr.  Change code that uses
13210         it as well.
13211         * layout.cc (Layout::layout): Always set *off.
13212         * mapfile.cc (Mapfile::print_input_section): Use
13213         output_section_offset.
13214         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13215         Sized_relobj*.
13216         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13217         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13218         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13219
13220 2008-07-03  Ian Lance Taylor  <iant@google.com>
13221
13222         * layout.cc (Layout::include_section): Do not discard unrecognized
13223         SHT_STRTAB sections.
13224
13225 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13226
13227         * script.cc (Lex::can_continue_name): Make '?' allowable in
13228         version-script names.
13229         * testsuite/version_script.map: Change glob pattern to use '?'
13230
13231 2008-06-30  Manish Singh  <yosh@gimp.org>
13232
13233         PR 6585
13234         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13235         Correct typo.
13236
13237 2008-06-30  Ian Lance Taylor  <iant@google.com>
13238
13239         PR 6660
13240         PR 6682
13241         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13242         versions]: Don't try to read the value in the contents, since we
13243         don't use it.  Use the template endianness when writing.
13244
13245 2008-06-25  Cary Coutant  <ccoutant@google.com>
13246
13247         * fileread.cc (File_read::make_view): Assert on zero-length view.
13248         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13249         symbol table when there are no symbols to read.
13250
13251 2008-06-23  Craig Silverstein  <csilvers@google.com>
13252
13253         * version.cc (version_string): Bump to 1.7
13254
13255 2008-06-18  Craig Silverstein  <csilvers@google.com>
13256
13257         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13258         constant 0xFFFF to type Valtype.
13259         (Powerpc_relocate_functions::rel16_ha): Likewise.
13260
13261 2008-06-17  Ian Lance Taylor  <iant@google.com>
13262
13263         * output.h (Output_section::Input_section): Initialize p2align_ to
13264         zero for Output_section_data constructors.
13265         (Output_section::Input_section::addralign): If not an input
13266         section, return the alignment of the Output_section_data.
13267         * testsuite/copy_test.cc: New file.
13268         * testsuite/copy_test_1.cc: New file.
13269         * testsuite/copy_test_2.cc: New file.
13270         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13271         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13272         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13273         (copy_test_1_pic.o, copy_test_1.so): New targets.
13274         (copy_test_2_pic.o, copy_test_2.so): New targets.
13275         * testsuite/Makefile.in: Rebuild.
13276
13277         * script-sections.cc (Script_sections::place_orphan): Initialize
13278         local variable exact.
13279
13280 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13281
13282         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13283
13284 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13285             David S. Miller  <davem@davemloft.net>
13286
13287         * powerpc.cc: New file.
13288         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13289         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13290         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13291         * Makefile.in: Rebuild.
13292
13293 2008-06-09  Ian Lance Taylor  <iant@google.com>
13294
13295         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13296         <exception>.
13297         (throwing, orig_terminate): New static variables.
13298         (terminate_handler): New static function.
13299         (t2): Set terminate handler.
13300
13301 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13302
13303         PR 6584
13304         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13305         alignment.
13306
13307 2008-05-30  Cary Coutant  <ccoutant@google.com>
13308
13309         * archive.cc (Archive::include_all_members) Correct to step
13310         over symbol table and extended name table in thin archives.
13311
13312 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13313
13314         PR 6407
13315         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13316         calculation.
13317
13318 2008-05-28  Caleb Howe  <cshowe@google.com>
13319
13320         * reduced_debug_output.cc: New file.
13321         * reduced_debug_output.h: New file.
13322         * options.h (class General_options): Add --strip-debug-non-line.
13323         * options.cc (General_options::finalize): Add strip_debug_non_line
13324         to the strip heirarchy.
13325         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13326         fields.
13327         * layout.cc: Include "reduced_debug_output.h".
13328         (Layout::Layout): Initialize new fields.
13329         (line_only_debug_sections): New static array.
13330         (is_lines_only_debug_sections): New static inline function.
13331         (Layout::include_section): Handle --strip-debug-non-line.
13332         (Layout::make_output_section): If --strip-debug-non-line, build
13333         new output sections for .debug_abbrev and .debug_info.
13334         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13335         gold.  Warn about possible overflow.
13336         (read_signed_LEB_128): Likewise.
13337         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13338         (read_signed_LEB_128): Declare.
13339         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13340         (HFILES): Add reduced_debug_output.h.
13341         * Makefile.in: Rebuild.
13342
13343 2008-05-21  Ian Lance Taylor  <iant@google.com>
13344
13345         * mapfile.cc: New file.
13346         * mapfile.h: New file.
13347         * options.h (class General_options): Add -M/--print-map and -Map.
13348         * options.cc (General_options::finalize): Make -M equivalent to
13349         -Map -.
13350         * main.cc: Include <cstdio> and "mapfile.h".
13351         (main): Open mapfile if requested.
13352         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13353         constructor.  Change caller.
13354         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13355         (queue_middle_tasks): Likewise.
13356         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13357         declarations.
13358         * archive.cc: Include "mapfile.h".
13359         (Archive::add_symbols): Add mapfile parameter.  Change all
13360         callers.  Pass mapfile, symbol, and reason to include_member.
13361         (Archive::include_all_members): Add mapfile parameter.  Change all
13362         callers.
13363         (Archive::include_member): Add mapfile, sym, and why parameters.
13364         Change all callers.  Report inclusion to map file.
13365         * archive.h: Include "fileread.h".
13366         (class Archive): Update declarations.
13367         (Archive::file): New const method.
13368         (class Add_archive_symbols): Add mapfile_ field.  Update
13369         constructor.  Change all callers.
13370         * readsyms.h (class Read_symbols): Likewise.
13371         (class Finish_group): Likewise.
13372         (class Read_script): Likewise.
13373         * common.cc: Include "mapfile.h".
13374         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13375         all callers.
13376         (Symbol_table::do_allocate_commons): Likewise.
13377         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13378         symbol allocation to mapfile.
13379         * common.h (class Allocate_commons_task): Add mapfile_ field.
13380         Update constructor.  Change all callers.
13381         * symtab.h (class Symbol_table): Update declarations.
13382         * layout.cc: Include "mapfile.h".
13383         (Layout_task_runner::run): Print information to mapfile.
13384         (Layout::create_gold_note): Change Output_data_fixed_space to
13385         Output_data_zero_fill.
13386         (Layout::create_build_id): Likewise.
13387         (Layout::print_to_mapfile): New function.
13388         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13389         constructor.  Change caller.
13390         (class Layout): Declare print_to_mapfile.
13391         * output.cc (Output_section::Input_section::print_to_mapfile): New
13392         function.
13393         (Output_section::add_input_section): If producing a map, always
13394         add to input_sections_ list.
13395         (Output_section::do_print_to_mapfile): New function.
13396         (Output_segment::print_sections_to_mapfile): New function.
13397         (Output_segment::print_section_list_to_mapfile): New function.
13398         * output.h: Include "mapfile.h".
13399         (Output_data::print_to_mapfile): New function.
13400         (Output_data::do_print_to_mapfile): New virtual function.
13401         (Output_segment_headers::do_print_to_mapfile): New function.
13402         (Output_file_header::do_print_to_mapfile): New function.
13403         (Output_data_const::do_print_to_mapfile): New function.
13404         (class Output_data_const_buffer): Add map_name_ field.  Update
13405         constructor.  Change all callers.  Add do_print_to_mapfile
13406         function.
13407         (class Output_data_fixed_space): Likewise.
13408         (class Output_data_space): Likewise.
13409         (class Output_data_zero_fill): New class.
13410         (Output_data_strtab::do_print_to_mapfile): New function.
13411         (Output_data_reloc_base::do_print_to_mapfile): New function.
13412         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13413         (Output_data_group::do_print_to_mapfile): New function.
13414         (Output_data_got::do_print_to_mapfile): New function.
13415         (Output_data_dynamic::do_print_to_mapfile): New function.
13416         (Output_symtab_xindex::do_print_to_mapfile): New function.
13417         (class Output_section): Declare do_print_to_mapflie.  Declare
13418         print_to_mapfile in Input_section.
13419         (class Output_segment): Declare new functions.
13420         * object.h (Sized_relobj::symbol_count): New function.
13421         * script-sections.cc
13422         (Output_section_element_dot_assignment::set_section_addresses):
13423         Change Output_data_fixed_space to Output_data_zero_fill.
13424         (Output_data_expression::do_print_to_mapfile): New function.
13425         * script.cc (read_input_script): Add mapfile parameter.  Change
13426         all callers.
13427         * script.h (read_input_script): Update declaration.
13428         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13429         (Eh_frame::do_print_to_mapfile): New function.
13430         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13431         (Output_merge_string::do_print_to_mapfile): New function.
13432         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13433         function.
13434         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13435         function.
13436         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13437         function.
13438         * Makefile.am (CCFILES): Add mapfile.cc.
13439         (HFILES): Add mapfile.h.
13440         * Makefile.in: Rebuild.
13441
13442 2008-05-19  Ian Lance Taylor  <iant@google.com>
13443
13444         * options.h (class General_options): Add -z relro.
13445         * layout.cc (Layout::Layout): Initialize relro_segment_.
13446         (Layout::add_output_section_data): Return the output section.
13447         (Layout::make_output_section): Rcognize relro sections and mark
13448         them appropriately.
13449         (Layout::attach_allocated_section_to_segment): Put relro sections
13450         in a PT_GNU_RELRO segment.
13451         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13452         section as relro.
13453         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13454         PT_TLS segments.
13455         (Layout::linkonce_mapping): Map d.rel.ro.local to
13456         .data.rel.ro.local.
13457         (Layout::output_section_name): Us .data.rel.ro.local for any
13458         section which begins with that.
13459         * layout.h (class Layout): Update add_output_section_data
13460         declaration.  Add relro_segment_ field.
13461         * output.cc (Output_section::Output_section): Initialize is_relro_
13462         and is_relro_local_ fields.
13463         (Output_segment::add_output_section): Group relro sections.
13464         (Output_segment::is_first_section_relro): New function.
13465         (Output_segment::maximum_alignment): If there is a relro section,
13466         align the segment to the common page size.
13467         (Output_segment::set_section_addresses): Track whether we are
13468         looking at relro sections.  If the last section is a relro
13469         section, align to the common page size.
13470         (Output_segment::set_section_list_addresses): Add in_relro
13471         parameter.  Change all callers.  Align to the page size when
13472         moving from relro to non-relro section.
13473         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13474         segment.
13475         * output.h (class Output_section): Add is_relro_ and
13476         is_relro_local_ fields.
13477         (Output_section::is_relro): New function.
13478         (Output_section::set_is_relro): New function.
13479         (Output_section::is_relro_local): New function.
13480         (Output_section::set_is_relro_local): New function.
13481         (class Output_segment): Update declarations.
13482         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13483         * sparc.cc (Target_sparc::got_section): Likewise.
13484         * x86_64.cc (Target_x86_64::got_section): Likewise.
13485         * testsuite/relro_test_main.cc: New file.
13486         * testsuite/relro_test.cc: New file.
13487         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13488         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13489         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13490         (relro_test.so, relro_test_pic.o): New targets.
13491         * testsuite/Makefile.in: Rebuild.
13492
13493 2008-05-16  Ian Lance Taylor  <iant@google.com>
13494
13495         * output.cc (Output_segment::add_output_section): Remove front
13496         parameter.
13497         * output.h (class Output_segment): Remove
13498         add_initial_output_section and overloaded add_output_section.
13499         Update declaration of remaining add_output_section.
13500         * layout.cc (Layout::create_interp): Call add_output_section
13501         rather than add_initial_output_section.
13502         (Layout::finish_dynamic_section): Likewise.
13503
13504         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13505         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13506         know the dynamic type.
13507         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13508         field.  Initialize it in constructor.
13509         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13510         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13511         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13512         reloc.
13513
13514         * output.cc (Output_reloc::get_address): Change return type to
13515         Elf_Addr.
13516         * output.h (class Output_reloc): Update get_address declaration.
13517         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13518         for section addresses.
13519
13520 2008-05-09  Ian Lance Taylor  <iant@google.com>
13521
13522         PR 6493
13523         * gold.cc (gold_nomem): Use return value of write.
13524
13525 2008-05-08  Ian Lance Taylor  <iant@google.com>
13526
13527         * symtab.c (Symbol::init_base_output_data): Add version
13528         parameter.  Change all callers.
13529         (Symbol::init_base_output_segment): Likewise.
13530         (Symbol::init_base_constant): Likewise.
13531         (Symbol::init_base_undefined): Likewise.
13532         (Sized_symbol::init_output_data): Likewise.
13533         (Sized_symbol::init_output_segment): Likewise.
13534         (Sized_symbol::init_constant): Likewise.
13535         (Sized_symbol::init_undefined): Likewise.
13536         (Symbol_table::do_define_in_output_data): If the new symbol has a
13537         version, mark it as the default.
13538         (Symbol_table::do_define_in_output_segment): Likewise.
13539         (Symbol_table::do_define_as_constant): Likewise.
13540         * symtab.h (class Symbol): Update declarations.
13541         (class Sized_symbol): Likewise.
13542         * resolve.cc (Symbol::override_version): New function.
13543         (Symbol::override_base): Call override_version.
13544         (Symbol::override_base_with_special): Likewise.
13545         * testsuite/ver_script_8.script: New file.
13546         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13547         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13548         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13549         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13550
13551 2008-05-06  Ian Lance Taylor  <iant@google.com>
13552
13553         PR 6049
13554         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13555         functions.
13556         (class General_options): Remove existing --undefined, and add
13557         --no-undefined instead.  Add new --undefined as synonym for -u.
13558         * archive.cc (Archive::add_symbols): Check whether symbol was
13559         named with -u.
13560         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13561         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13562         all uses.  Add IS_UNDEFINED.  Update declarations to split
13563         different versions of init_base.  Declare init_base_undefined.
13564         (Symbol::is_defined): Handle IS_UNDEFINED.
13565         (Symbol::is_undefined): Likewise.
13566         (Symbol::is_weak_undefined): Call is_undefined.
13567         (Symbol::is_absolute): Handle IS_CONSTANT.
13568         (class Sized_symbol): Update declarations to split different
13569         versions of init.  Declare init_undefined.
13570         (class Symbol_table): Declare new functions.
13571         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13572         Change all callers.
13573         (Symbol::init_base_output_data): Likewise.
13574         (Symbol::init_base_output_segment): Likewise.
13575         (Symbol::init_base_constant): Likewise.
13576         (Symbol::init_base_undefined): New function.
13577         (Sized_symbol::init_object): Rename from init.  Change all
13578         callers.
13579         (Sized_symbol::init_output_data): Likewise.
13580         (Sized_symbol::init_output_segment): Likewise.
13581         (Sized_symbol::init_constant): Likewise.
13582         (Sized_symbol::init_undefined): New function.
13583         (Symbol_table::add_undefined_symbols_from_command_line): New
13584         function.
13585         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13586         function.
13587         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13588         (Symbol::output_section): Likewise.
13589         (Symbol::set_output_section): Likewise.
13590         (Symbol_table::sized_finalize_symbol): Likewise.
13591         (Symbol_table::sized_write_globals): Likewise.
13592         * resolve.cc (Symbol_table::should_override): Likewise.
13593         (Symbol::override_base_with_special): Likewise.
13594
13595         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13596         symbol, change it to have default visibility.
13597         * testsuite/protected_1.cc: New file.
13598         * testsuite/protected_2.cc: New file.
13599         * testsuite/protected_3.cc: New file.
13600         * testsuite/protected_main_1.cc: New file.
13601         * testsuite/protected_main_2.cc: New file.
13602         * testsuite/protected_main_3.cc: New file.
13603         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13604         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13605         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13606         (protected_1.so): New target.
13607         (protected_1_pic.o, protected_2_pic.o): New targets.
13608         (protected_3_pic.o): New target.
13609         (check_PROGRAMS): Add protected_2.
13610         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13611         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13612         * testsuite/Makefile.in: Rebuild.
13613
13614         * options.h (DEFINE_var): Add set_user_set_##varname__.
13615         (DEFINE_bool_alias): New macro.
13616         (class General_options): Define -Bstatic using DEFINE_bool_alias
13617         rather than DEFINE_special.  Add --undefined as an alias for -z
13618         defs.
13619         * options.cc (General_options::parse_Bstatic): Remove.
13620
13621         * options.h (class General_options): Add --fatal-warnings.
13622         * main.cc (main): Implement --fatal-warnings.
13623         * errors.h (Errors::warning_count): New function.
13624
13625         * options.h (class General_options): Add -Bsymbolic-functions.
13626         * symtab.h (Symbol::is_preemptible): Check for
13627         -Bsymbolic-functions.
13628
13629 2008-05-05  Ian Lance Taylor  <iant@google.com>
13630
13631         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13632         as noVARNAME rather than no-VARNAME.
13633         (class General_options): Add option -z combreloc.
13634         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13635         get_address.
13636         (Output_reloc::sort_before) [SHT_REL]: New function.
13637         (Output_reloc::sort_before) [SHT_RELA]: New function.
13638         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13639         Sort_relocs_comparison.
13640         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13641         parameter.  Change all callers.
13642         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13643         sort_relocs parameter.  Change all callers.
13644         * output.cc (Output_reloc::get_address): New function, broken out
13645         of write_rel.
13646         (Output_reloc::write_rel): Call it.
13647         (Output_reloc::compare): New function.
13648         (Output_data_reloc_base::do_write): Optionally sort relocs.
13649
13650         * configure.ac: If targ_extra_obj is set, link it in.
13651         * configure.tgt: Initialize all variables.
13652         (x86_64*): Set targ_extra_obj and targ_extra_size.
13653         * configure: Rebuild.
13654
13655         * object.cc (Sized_relobj::include_section_group): Adjust section
13656         indexes read from group data.  Build vector to pass to
13657         layout_group.
13658         * layout.cc (Layout::layout_group): Add flags and shndxes
13659         parameters.  Remove contents parameter.  Change caller.  Update
13660         explicit instantiations.
13661         * layout.h (class Layout): Update layout_group declaration.
13662         * output.cc (Output_data_group::Output_data_group): Add flags and
13663         input_shndxes parameters.  Remove contents parameter.  Change
13664         caller.
13665         (Output_data_group::do_write): Change input_sections_ to
13666         input_shndxes_.
13667         * output.h (class Output_data_group): Update constructor
13668         declaration.  Rename input_sections_ to input_shndxes_.
13669         * testsuite/many_sections_test.cc: Add template.
13670
13671 2008-04-30  Cary Coutant  <ccoutant@google.com>
13672
13673         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13674
13675         * layout.cc (Layout::include_section): Refactored check for debug
13676         info section.
13677         (Layout::add_comdat): Add new parameters.  Change type
13678         of signature parameter.  Add object and shndx to signatures table.
13679         (Layout::find_kept_object): New function.
13680         * layout.h: Include <cstring>.
13681         (Layout::is_debug_info_section): New function.
13682         (Layout::add_comdat): Add new parameters.
13683         (Layout::find_kept_object): New function.
13684         (Layout::Kept_section): New struct.
13685         (Layout::Signatures): Change type of map range.
13686         * object.cc (Relobj::output_section_address): New function.
13687         (Sized_relobj::include_section_group): Add new parameters.  Change
13688         calls to Layout::add_comdat.  Change to build table of kept comdat
13689         groups and table mapping discarded sections to kept sections.
13690         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13691         (Sized_relobj::do_layout): Change calls to include_section_group and
13692         include_linkonce_section.
13693         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13694         value to zero when section is discarded.
13695         (Sized_relobj::map_to_kept_section): New function.
13696         * object.h (Relobj::output_section_address): New function.
13697         (Relobj::Comdat_group): New type.
13698         (Relobj::find_comdat_group): New function.
13699         (Relobj::Comdat_group_table): New type.
13700         (Relobj::Kept_comdat_section): New type.
13701         (Relobj::Kept_comdat_section_table): New type.
13702         (Relobj::add_comdat_group): New function.
13703         (Relobj::set_kept_comdat_section): New function.
13704         (Relobj::get_kept_comdat_section): New function.
13705         (Relobj::comdat_groups_): New field.
13706         (Relobj::kept_comdat_sections_): New field.
13707         (Symbol_value::input_value): Update comment.
13708         (Sized_relobj::map_to_kept_section) New function.
13709         (Sized_relobj::include_linkonce_section): Add new parameter.
13710         * target-reloc.h (Comdat_behavior): New type.
13711         (get_comdat_behavior): New function.
13712         (relocate_section): Add code to map a discarded section to the
13713         corresponding kept section when applying a relocation.
13714
13715 2008-04-30  Craig Silverstein  <csilvers@google.com>
13716
13717         * dwarf_reader.cc (next_generation_count): New static var.
13718         (Addr2line_cache_entry): New struct.
13719         (addr2line_cache): New static var.
13720         (Dwarf_line_info::one_addr2line): Added caching.
13721         (Dwarf_line_info::clear_addr2line_cache): New function.
13722         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13723         cache-size parameter.
13724         (Dwarf_line_info::one_addr2line_cache): New function.
13725         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13726         new cache-size argument to one_addr2line(), and clear cache.
13727
13728 2008-04-28  Cary Coutant  <ccoutant@google.com>
13729
13730         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13731         R_386_PC8 relocations.
13732
13733 2008-04-23  Ian Lance Taylor  <iant@google.com>
13734
13735         * object.cc (Sized_relobj::include_section_group): Check for
13736         invalid section group.
13737
13738         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13739         header size.
13740
13741         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13742         than read for file header.
13743         * archive.cc (Archive::include_member): Likewise.
13744
13745 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13746
13747         * aclocal.m4: Regenerate.
13748         * configure: Regenerate.
13749
13750 2008-04-19  Ian Lance Taylor  <iant@google.com>
13751
13752         * version.cc (version_string): Bump to 1.6.
13753
13754         * testsuite/Makefile.am (many_sections_r_test): New target.
13755         (many_sections_r_test_SOURCES): Remove.
13756         (many_sections_r_test_DEPENDENCIES): Remove.
13757         (many_sections_r_test_LDFLAGS): Remove.
13758         (many_sections_r_test_LDADD): Remove.
13759
13760         * object.cc (Sized_relobj::do_add_symbols): Always pass
13761         local_symbol_count_ to add_from_relobj.
13762
13763         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13764         every thousand variables.
13765         * testsuite/Makefile.in: Rebuild.
13766
13767         * object.cc (Xindex::initialize_symtab_xindex): New function.
13768         (Xindex::read_symtab_xindex): New function.
13769         (Xindex::sym_xindex_to_shndx): New function.
13770         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13771         available.
13772         (Sized_relobj::do_initialize_xindex): New function.
13773         (Sized_relobj::do_read_symbols): Adjust section links.
13774         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13775         parameter.  Change all callers.
13776         (Sized_relobj::include_section_group): Adjust section links and
13777         symbol section indexes.
13778         (Sized_relobj::do_layout): Adjust section links.
13779         (Sized_relobj::do_count_local_symbols): Adjust section links and
13780         symbol section indexes.
13781         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13782         ordinary and special symbols.
13783         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13784         dynsym_xindex parameters.  Change all callers.  Adjust section
13785         links.  Use SHN_XINDEX when needed.
13786         (Sized_relobj::get_symbol_location_info): Adjust section links.
13787         Don't get fooled by special symbols.
13788         * object.h (class Xindex): Define.
13789         (class Object): Add xindex_ parameter.  Declare virtual functoin
13790         do_initialize_xindex.
13791         (Object::adjust_sym_shndx): New function.
13792         (Object::set_xindex): New protected function.
13793         (class Symbol_value): Add is_ordinary_shndx_ field.
13794         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13795         (Symbol_value::value): Assert ordinary section.
13796         (Symbol_value::initialize_input_to_output_map): Likewise.
13797         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13798         Change all callers.
13799         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13800         all callers.
13801         (class Sized_relobj): Update declarations.
13802         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13803         parameter.  Change all callers.
13804         (Sized_relobj::adjust_shndx): New function.
13805         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13806         field.
13807         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13808         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13809         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13810         (Sized_dynobj::read_dynsym_section): Adjust section links.
13811         (Sized_dynobj::read_dynamic): Likewise.
13812         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13813         section links.
13814         (Sized_dynobj::do_initialize_xindex): New function.
13815         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13816         do_initialize_xindex.
13817         (Sized_dynobj::adjust_shndx): New function.
13818         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13819         dynsym_xindex_ fields.
13820         (Layout::finalize): Add a call to set_section_indexes before
13821         creating the symtab sections.
13822         (Layout::set_section_indexes): Don't do anything if the section
13823         already has a section index.
13824         (Layout::create_symtab_sections): Add shnum parameter.  Change
13825         caller.  Create .symtab_shndx section if needed.
13826         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13827         caller.
13828         (Layout::allocated_output_section_count): New function.
13829         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13830         needed.
13831         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13832         fields.  Update declarations.
13833         (Layout::symtab_xindex): New function.
13834         (Layout::dynsym_xindex): New function.
13835         (class Write_symbols_task): Add layout_ field.
13836         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13837         Change caller.
13838         * output.cc (Output_section_headers::Output_section_headers): Add
13839         shstrtab_section parameter.  Change all callers.
13840         (Output_section_headers::do_sized_write): Store overflow values
13841         for section count and section string table section index in
13842         section header zero.
13843         (Output_file_header::do_sized_write): Check for overflow of
13844         section count and section string table section index.
13845         (Output_symtab_xindex::do_write): New function.
13846         (Output_symtab_xindex::endian_do_write): New function.
13847         * output.h (class Output_section_headers): Add shstrtab_section_.
13848         Update declarations.
13849         (class Output_symtab_xindex): Define.
13850         (Output_section::has_out_shndx): New function.
13851         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13852         field.
13853         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13854         Change all callers.
13855         (Sized_symbol::init): Likewise.
13856         (Symbol::output_section): Check for ordinary symbol.
13857         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13858         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13859         callers.
13860         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13861         Change all callers.  Simplify handling of symbols from sections
13862         not included in the link.
13863         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13864         distinction.
13865         (Weak_alias_sorter::operator()): Assert that symbols are
13866         ordinary.
13867         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13868         distinction.
13869         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13870         parameters.  Change all callers.
13871         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13872         symbol distinction.  Use SHN_XINDEX when needed.
13873         (Symbol_table::write_section_symbol): Add symtab_xindex
13874         parameter.  Change all callers.
13875         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13876         SHN_XINDEX when needed.
13877         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13878         declarations.
13879         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13880         (Symbol::is_defined): Check is_ordinary.
13881         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13882         (Symbol::is_absolute, Symbol::is_common): Likewise.
13883         (class Sized_symbol): Update declarations.
13884         (class Symbol_table): Update declarations.
13885         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13886         parameters.  Change all callers.
13887         (Sized_symbol::override): Likewise.
13888         (Symbol_table::override): Likewise.
13889         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13890         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13891         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13892         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13893         to be in an ordinary section.
13894         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13895         object and is_ordinary parameters.  Change all callers.
13896         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13897         Change all callers.  Don't add undefined or non-ordinary symbols
13898         to reloc_map_.
13899         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13900         Change all callers.
13901         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13902         declarations.
13903         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13904         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13905         (Sized_relobj::relocate_sections): Likewise.
13906         * target-reloc.h (scan_relocs): Adjust section symbol index.
13907         (scan_relocatable_relocs): Likewise.
13908         * i386.cc (Scan::local): Check for ordinary symbols.
13909         * sparc.cc (Scan::local): Likewise.
13910         * x86_64.cc (Scan::local): Likewise.
13911         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13912         to symbol_section_and_value.
13913         * testsuite/many_sections_test.cc: New file.
13914         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13915         (check_PROGRAMS): Add many_sections_test.
13916         (many_sections_test_SOURCES): Define.
13917         (many_sections_test_DEPENDENCIES): Define.
13918         (many_sections_test_LDFLAGS): Define.
13919         (BUILT_SOURCES): Add many_sections_define.h.
13920         (many_sections_define.h): New target.
13921         (BUILT_SOURCES): Add many_sections_check.h.
13922         (many_sections_check.h): New target.
13923         (check_PROGRAMS): Add many_sections_r_test.
13924         (many_sections_r_test_SOURCES): Define.
13925         (many_sections_r_test_DEPENDENCIES): Define.
13926         (many_sections_r_test_LDFLAGS): Define.
13927         (many_sections_r_test_LDADD): Define.
13928         (many_sections_r_test.o): New target.
13929         * testsuite/Makefile.in: Rebuild.
13930
13931 2008-04-17  Cary Coutant  <ccoutant@google.com>
13932
13933         * errors.cc (Errors::info): New function.
13934         (gold_info): New function.
13935         * errors.h (Errors::info): New function.
13936         * gold.h (gold_info): New function.
13937         * object.cc (Input_objects::add_object): Print trace output.
13938         * options.cc (options::parse_set): New function.
13939         (General_options::parse_wrap): Deleted.
13940         (General_options::General_options): Deleted initializer.
13941         * options.h (options::String_set): New typedef.
13942         (options::parse_set): New function.
13943         (DEFINE_set): New macro.
13944         (General_options::wrap): Changed to use DEFINE_set. Changed
13945         callers of any_wrap_symbols and is_wrap_symbol.
13946         (General_options::trace, General_options::trace_symbol):
13947         New options.
13948         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13949         (General_options::wrap_symbols_): Deleted.
13950         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13951
13952 2008-04-17  David S. Miller  <davem@davemloft.net>
13953
13954         * options.cc (General_options::parse_V): New function.
13955         * options.h: Add entries for -V and -Qy.
13956
13957 2008-04-17  Ian Lance Taylor  <iant@google.com>
13958
13959         * common.cc (Symbol_table::allocate_commons): Remove options
13960         parameter.  Change caller.
13961         (Symbol_table::do_allocate_commons): Remove options parameter.
13962         Change caller.  Just call do_allocate_commons_list twice.
13963         (Symbol_table::do_allocate_commons_list): New function, broken out
13964         of do_allocate_commons.
13965         * common.h (class Allocate_commons_task): Remove options_ field.
13966         Update constructor.
13967         * symtab.cc (Symbol_table::Symbol_table): Initialize
13968         tls_commons_.
13969         (Symbol_table::add_from_object): Put TLS common symbols on
13970         tls_commons_ list.
13971         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13972         which are IN_OUTPUT_DATA.
13973         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13974         allocate_commons and do_allocate_commons declarations.  Declare
13975         do_allocate_commons_list.
13976         * gold.cc (queue_middle_tasks): Update creation of
13977         Allocate_commons_task to not pass options.
13978         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13979         (TLS_TEST_C_FLAGS): New variable.
13980         (tls_test_c_pic.o): New target.
13981         (tls_test_shared.so): Link in tls_test_c_pic.o.
13982         (tls_test_c_pic_ie.o): New target.
13983         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13984         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13985         (tls_test_c.o): New target.
13986         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13987         (tls_pic_test_LDADD): Likewise.
13988         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13989         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13990         (tls_test_c_gnu2.o): New target.
13991         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13992         tls_test_c_gnu2.o.
13993         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13994         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13995         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13996         * testsuite/tls_test.cc: Include "config.h".
13997         (t_last): Call t11_last.
13998         * testsuite/tls_test.h (t11, t11_last): Declare.
13999         * testsuite/tls_test_c.c: New file.
14000         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14001         * configure.ac: Check for OpenMP support.
14002         * configure, config.in, Makefile.in: Rebuild.
14003         * testsuite/Makefile.in: Rebuild.
14004
14005 2008-04-16  Cary Coutant  <ccoutant@google.com>
14006
14007         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14008         (Target_i386::tls_base_symbol_defined_): New field.
14009         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14010         (Target_i386::Scan::global): Likewise.
14011         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14012         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14013         (Target_x86_64::tls_base_symbol_defined_): New field.
14014         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14015         (Target_x86_64::Scan::global): Likewise.
14016
14017 2008-04-16  Cary Coutant  <ccoutant@google.com>
14018
14019         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14020         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14021         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14022         building shared libraries.
14023         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14024         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14025         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14026         * testsuite/Makefile.in: Rebuild.
14027         * testsuite/weak_undef.h: New file.
14028         * testsuite/weak_undef_file1.cc: Add extra test cases.
14029         * testsuite/weak_undef_file2.cc: Likewise.
14030         * testsuite/weak_undef_test.cc: Likewise.
14031
14032 2008-04-16  David S. Miller  <davem@davemloft.net>
14033
14034         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14035         Add issued_non_pic_error_ field.  Declare check_non_pic.
14036         (Target_sparc::Scan::check_non_pic): New function.
14037         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14038         (Target_sparc::Scan::global): Likewise.
14039
14040         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14041         * configure: Rebuild.
14042
14043         * options.h (DEFINE_enable): New macro.
14044         (new_dtags): New enable option.
14045         (initfirst, interpose, loadfltr, nodefaultlib,
14046         nodelete, nodlopen, nodump): New -z options.
14047         * layout.cc (Layout:finish_dynamic_section): If new
14048         dtags enabled, emit DT_RUNPATH.  Also, emit a
14049         DT_FLAGS_1 containing any specified -z flags.
14050
14051 2008-04-16  Ian Lance Taylor  <iant@google.com>
14052
14053         * copy-relocs.cc: New file.
14054         * copy-relocs.h: New file.
14055         * reloc.cc: Remove Copy_relocs code.
14056         * reloc.h: Likewise.
14057         * reloc-types.h (struct Reloc_types) [both versions]: Add
14058         get_reloc_addend_noerror.
14059         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14060         variants of add_global which take an addend which must be zero.
14061         * i386.cc: Include "copy-relocs.h".
14062         (class Target_i386): Change type of copy_relocs_ to variable,
14063         update initializer.
14064         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14065         Change all callers.
14066         (Target_i386::do_finalize_sections): Change handling of
14067         copy_relocs_.
14068         * sparc.cc: Include "copy-relocs.h".
14069         (class Target_sparc): Change type of copy_relocs_ to variable,
14070         update initializer.
14071         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14072         Change all callers.
14073         (Target_sparc::do_finalize_sections): Change handling of
14074         copy_relocs_.
14075         * x86_64.cc: Include "copy-relocs.h".
14076         (class Target_x86_64): Change type of copy_relocs_ to variable,
14077         update initializer.
14078         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14079         class.  Change all callers.
14080         (Target_x86_64::do_finalize_sections): Change handling of
14081         copy_relocs_.
14082         * Makefile.am (CCFILES): Add copy-relocs.cc.
14083         (HFILES): Add copy-relocs.h.
14084
14085         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14086
14087         * testsuite/script_test_4.sh: Permit leading zeroes.
14088
14089 2008-04-15  Ian Lance Taylor  <iant@google.com>
14090
14091         * script-sections.cc (Script_sections::create_segments): Use
14092         header_size_adjustment even when there is enough room for the
14093         headers.
14094         * testsuite/script_test_4.sh: New file.
14095         * testsuite/script_test_4.t: New file.
14096         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14097         (check_DATA): Add script_test_4.stdout.
14098         (MOSTLYCLEANFILES): Likewise.
14099         (script_test_4): New target.
14100         (script_test_4.stdout): New target.
14101         * testsuite/Makefile.in: Rebuild.
14102
14103         * sparc.cc: Add definitions for Output_data_plt_sparc class
14104         constants.
14105
14106 2008-04-14  David S. Miller  <davem@davemloft.net>
14107
14108         * sparc.cc: New file.
14109         * Makefile.am (TARGETSOURCES): Add sparc.cc
14110         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14111         * configure.tgt: Document targ_extra_size and
14112         targ_extra_big_endian.  Add entries for sparc-* and
14113         sparc64-*.
14114         * configure.ac: Handle targ_extra_size and
14115         targ_extra_big_endian.
14116         * Makefile.in: Rebuild.
14117         * configure: Likewise.
14118         * po/POTFILES.in: Likewise.
14119         * po/gold.pot: Likewise.
14120
14121 2008-04-14  Ian Lance Taylor  <iant@google.com>
14122
14123         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14124         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14125         in the name/type/flags to section mapping.  Don't call
14126         allocate_output_section.
14127         (Layout::choose_output_section): Change parameter from adjust_name
14128         to is_input_section.  Don't permit input sections after sections
14129         are attached to segments.  Don't call allocate_output_section.
14130         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14131         not write_enable_output_section.
14132         (Layout::make_output_section): Don't push to
14133         unattached_section_list_ nor call attach_to_segment.  Call
14134         attach_section_to_segment if sections are attached.
14135         (Layout::attach_sections_to_segments): New function.
14136         (Layout::attach_section_to_segment): New function.
14137         (Layout::attach_allocated_section_to_segment): Rename from
14138         attach_to_segment.  Remove flags parameter.
14139         (Layout::allocate_output_section): Remove function.
14140         (Layout::write_enable_output_section): Remove function.
14141         * layout.h (class Layout): Update for above changes.  Add new
14142         field sections_are_attached_.
14143         * output.h (Output_section::update_flags_for_input_section): New
14144         function.
14145         * output.cc (Output_section::add_input_section): Call
14146         update_flags_for_input_section.
14147         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14148
14149 2008-04-11  Cary Coutant  <ccoutant@google.com>
14150
14151         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14152         thought unnecessary.
14153         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14154
14155 2008-04-11  Ian Lance Taylor  <iant@google.com>
14156
14157         * output.h (class Output_section_data): Remove inline definition
14158         of set_addralign.
14159         * output.cc (Output_section_data::set_addralign): New function.
14160
14161 2008-04-11  Cary Coutant  <ccoutant@google.com>
14162
14163         Add support for TLS descriptors for i386 and x86_64.
14164         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14165         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14166         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14167         GOT_TYPE_TLS_DESC.
14168         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14169         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14170         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14171         relocations.
14172         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14173         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14174         Fix problem with initial-exec relocations.
14175         (Target_i386::Relocate::relocate_tls): Likewise.
14176         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14177         relaxation.
14178         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14179         support for section-plus-offset dynamic table entries.
14180         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14181         (Output_data_dynamic::Dynamic_entry): Add support for
14182         section-plus-offset dynamic table entries.
14183         (Output_data_dynamic::Classification): Likewise.
14184         (Output_data_dynamic::classification_): Renamed offset_.
14185         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14186         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14187         (Target_x86_64::make_plt_section): New function.
14188         (Target_x86_64::reserve_tlsdesc_entries): New function.
14189         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14190         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14191         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14192         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14193         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14194         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14195         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14196         add extra PLT entry for TLS descriptors.
14197         (Output_data_plt_x86_64::got_): New field.
14198         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14199         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14200         fields.
14201         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14202         descriptors.
14203         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14204         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14205         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14206         R_386_TLS_DESC_CALL relocations.
14207         (Target_x86_64::Scan::global): Likewise.
14208         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14209         for TLS descriptors.
14210         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14211         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14212         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14213         GD-to-IE relaxation.
14214         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14215         and TLS_DESCRIPTORS.
14216         * Makefile.in: Rebuild.
14217         * configure: Rebuild.
14218         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14219         (tls_test_shared2.so): New target.
14220         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14221         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14222         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14223         (tls_shared_gd_to_ie_test_LDADD): New variable.
14224         (tls_shared_gnu2_gd_to_ie_test): New target.
14225         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14226         New targets.
14227         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14228         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14229         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14230         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14231         (tls_shared_gnu2_test): New target.
14232         (tls_test_gnu2_shared.so): New target.
14233         (tls_shared_gnu2_test_SOURCES): New variable.
14234         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14235         (tls_shared_gnu2_test_LDFLAGS): New variable.
14236         (tls_shared_gnu2_test_LDADD): New variable.
14237         * testsuite/Makefile.in: Rebuild.
14238         * testsuite/Makefile.
14239
14240 2008-04-11  Ian Lance Taylor  <iant@google.com>
14241
14242         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14243         justsyms.t.
14244         * testsuite/Makefile.in: Rebuild.
14245
14246         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14247         long.
14248         * testsuite/script_test_2.cc (main): Adjust test.
14249
14250 2008-04-11  David S. Miller  <davem@davemloft.net>
14251             Ian Lance Taylor  <iant@google.com>
14252
14253         * options.h (General_options): Add entries for '-Y' and
14254         '-relax'.
14255         * options.cc (General_options:finalize): If -Y was used, add those
14256         entries to the library path instead of the default "/lib" and
14257         "/usr/lib".
14258
14259 2008-04-11  David S. Miller  <davem@davemloft.net>
14260
14261         * testsuite/justsyms.t: Start at 0x100.
14262         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14263         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14264         long.
14265         * testsuite/script_test_2.cc: Adjust string and section length
14266         checks.
14267
14268 2008-04-09  Ian Lance Taylor  <iant@google.com>
14269
14270         PR gold/5996
14271         * script-sections.cc (Sections_element::allocate_to_segment): Add
14272         orphan parameter.
14273         (Output_section_definition::allocate_to_segment): Likewise.
14274         (Orphan_output_section::allocate_to_segment): Likewise.
14275         (Script_sections::attach_sections_using_phdrs_clause): Don't
14276         propagate non-PT_LOAD segments to orphan sections.
14277         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14278         readelf rather than objdump.
14279         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14280         .interp section and PT_INTERP segment are the same size.
14281         * testsuite/Makefile.in: Rebuild.
14282
14283         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14284         aliases for symbols defined in the same object.
14285         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14286         (weak_alias_test_SOURCES): New variable.
14287         (weak_alias_test_DEPENDENCIES): New variable.
14288         (weak_alias_test_LDFLAGS): New variable.
14289         (weak_alias_test_LDADD): New variable.
14290         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14291         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14292         (weak_alias_test_3.o): New target.
14293         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14294         * testsuite/weak_alias_test_main.cc: New file.
14295         * testsuite/weak_alias_test_1.cc: New file.
14296         * testsuite/weak_alias_test_2.cc: New file.
14297         * testsuite/weak_alias_test_3.cc: New file.
14298
14299 2008-04-08  Ian Lance Taylor  <iant@google.com>
14300
14301         * options.h (class General_options): Add --noinhibit-exec option.
14302         * main.cc (main): Check --noinhibit-exec.
14303
14304         * options.h (class General_options): Define --wrap as a special
14305         option.  Add wrap_symbols_ field.
14306         (General_options::any_wrap_symbols): New function.
14307         (General_options::is_wrap_symbol): New function.
14308         * options.cc (General_options::parse_wrap): New function.
14309         (General_options::General_options): Initialize wrap_symbols_.
14310         * symtab.cc (Symbol_table::wrap_symbol): New function.
14311         (Symbol_table::add_from_object): Handle --wrap.
14312         * symtab.h (class Symbol_table): Declare wrap_symbol.
14313         * target.h (Target::wrap_char): New function.
14314         (Target::Target_info): Add wrap_char field.
14315         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14316         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14317         * testsuite/testfile.cc (Target_test::test_target_info):
14318         Likewise.
14319
14320         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14321         there is one.
14322
14323         * layout.h (class Layout): Add added_eh_frame_data_ field.
14324         * layout.cc (Layout::Layout): Initialize new field.
14325         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14326         output section until we find a section we merged successfully.
14327         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14328         that the size be non-zero.
14329
14330         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14331         qualifier.
14332
14333 2008-04-08  Craig Silverstein  <csilvers@google.com>
14334
14335         * configure.ac: Export new conditional variable HAVE_ZLIB.
14336         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14337         on HAVE_ZLIB.
14338         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14339         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14340
14341 2008-04-07  Ian Lance Taylor  <iant@google.com>
14342
14343         * version.cc (version_string): Set to "1.5".
14344
14345         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14346         Add issued_non_pic_error_ field.  Declare check_non_pic.
14347         (Target_x86_64::Scan::check_non_pic): New function.
14348         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14349         (Target_x86_64::Scan::global): Likewise.
14350
14351         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14352         addend parameter.  Change caller.  Handle merge sections.
14353         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14354         Address to Addend.  Don't add in the result of
14355         local_section_offset, pass down the addend and use the returned
14356         value.
14357         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14358         Update declarations of local_section_offset and symbol_value.
14359         * testsuite/two_file_test_1.cc (t18): New function.
14360         * testsuite/two_file_test_2.cc (f18): New function.
14361         * testsuite/two_file_test_main.cc (main): Call t18.
14362         * testsuite/two_file_test.h (t18, f18): Declare.
14363
14364         * configure.ac: Don't test for objdump, c++filt, or readelf.
14365         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14366         conditionals.
14367         (TEST_READELF): New variable.
14368         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14369         (check_PROGRAMS): Add two_file_strip_test.
14370         (two_file_strip_test): New target.
14371         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14372         (two_file_same_shared_strip_test_SOURCES): New variable.
14373         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14374         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14375         (two_file_same_shared_strip_test_LDADD): New variable.
14376         (two_file_shared_strip.so): New target.
14377         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14378         (ver_test_5.syms, ver_test_7.syms): Likewise.
14379         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14380         (strip_test_3.stdout): Use TEST_OBJDUMP.
14381         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14382
14383 2008-04-04  Cary Coutant  <ccoutant@google.com>
14384
14385         * symtab.h (Symbol::is_weak_undefined): New function.
14386         (Symbol::is_strong_undefined): New function.
14387         (Symbol::is_absolute): New function.
14388         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14389         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14390         absolute symbols.
14391         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14392         (weak_undef_test): New target.
14393         * testsuite/Makefile.in: Rebuild.
14394         * testsuite/weak_undef_file1.cc: New file.
14395         * testsuite/weak_undef_file2.cc: New file.
14396         * testsuite/weak_undef_test.cc: New file.
14397
14398 2008-04-03  Craig Silverstein  <csilvers@google.com>
14399
14400         * compressed_output.h (class Output_compressed_section): Use
14401         unsigned buffer.
14402         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14403         add zlib header.
14404         (zlib_compressed_suffix): Removed.
14405         (Output_compressed_section::set_final_data_size): Use unsigned
14406         buffers.
14407         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14408         Fix linker invocation.
14409         (flagstest_o_specialfile_and_compress_debug_sections):
14410         Likewise.
14411         * testsuite/Makefile.in: Regenerated.
14412
14413 2008-04-02  David S. Miller  <davem@davemloft.net>
14414
14415         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14416         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14417
14418 2008-04-02  Craig Silverstein  <csilvers@google.com>
14419
14420         * TODO: New file.
14421
14422 2008-04-02  Ian Lance Taylor  <iant@google.com>
14423
14424         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14425         parameters.  Update for new key type to views_.  Change all
14426         callers.
14427         (File_read::read): Adjust for byteshift in returned view.
14428         (File_read::add_view): New function, broken out of
14429         find_and_make_view.
14430         (File_read::make_view): New function, broken out of
14431         find_and_make_view.
14432         (File_read::find_or_make_view): Add offset and aligned
14433         parameters.  Rewrite accordingly.  Change all callers.
14434         (File_read::get_view): Add offset and aligned parameters.  Adjust
14435         for byteshift in return value.
14436         (File_read::get_lasting_view): Likewise.
14437         * fileread.h (class File_read): Update declarations.
14438         (class File_read::View): Add byteshift_ field.  Add byteshift to
14439         constructor.  Add byteshift method.
14440         * archive.h (Archive::clear_uncached_views): New function.
14441         (Archive::get_view): Add aligned parameter.  Change all callers.
14442         * object.h (Object::get_view): Add aligned parameter.  Change all
14443         callers.
14444         (Object::get_lasting_view): Likewise.
14445
14446         * fileread.cc (File_read::release): Don't call clear_views if
14447         there are multiple objects.
14448         * fileread.h (File_read::clear_uncached_views): New function.
14449         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14450         on the archive.
14451
14452 2008-03-31  Cary Coutant  <ccoutant@google.com>
14453
14454         Add thin archive support.
14455         * archive.cc (Archive::armagt): New const.
14456         (Archive::setup): Remove task parameter and calls to unlock.
14457         (Archive::unlock_nested_archives): New function.
14458         (Archive::read_header): Add nested_off parameter. Change
14459         all callers.
14460         (Archive::interpret_header): Likewise.
14461         (Archive::include_all_members): Change to handle thin
14462         archives.
14463         (Archive::include_member): Likewise.
14464         * archive.h (Archive::Archive): Add new parameters and
14465         initializers.
14466         (Archive::armagt): New const.
14467         (Archive::setup): Remove task parameter.
14468         (Archive::unlock_nested_archives): New function.
14469         (Archive::read_header): Add nested_off parameter.
14470         (Archive::interpret_header): Likewise.
14471         (Archive::Nested_archive_table): New typedef.
14472         (Archive::is_thin_archive_): New field.
14473         (Archive::nested_archives_): New field.
14474         (Archive::options_): New field.
14475         (Archive::dirpath_): New field.
14476         (Archive::task_): New field.
14477         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14478         for thin archives.  Pass additional parameters to
14479         Archive::Archive.  Unlock the archive file after calling
14480         Archive::setup.
14481
14482 2008-03-29  Ian Lance Taylor  <iant@google.com>
14483
14484         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14485         version symbol to be local.
14486         * testsuite/ver_test_4.sh: New file.
14487         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14488         (check_DATA): Add ver_test_4.syms.
14489         (ver_test_4.syms): New target.
14490         * testsuite/Makefile.in: Rebuild.
14491
14492         * output.cc
14493         (Output_section::Input_section_sort_entry::has_priority): New
14494         function.
14495         (Output_section::Input_section_sort_entry::match_file_name): New
14496         function.
14497         (Output_section::Input_section_sort_entry::match_section_name):
14498         Remove.
14499         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14500         Remove.
14501         (Output_section::Input_section_sort_entry::match_section_file):
14502         Remove.
14503         (Output_section::Input_section_sort_compare::operator()): Rewrite
14504         using new Input_section_sort_entry functions.  Sort crtbegin and
14505         crtend first.  Sort sections with no priority before sections with
14506         a priority.
14507         * testsuite/initpri1.c (d3): Check j != 4.
14508         (cd5): New constructor/destructor function.
14509         (main): Check j != 2.
14510
14511         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14512         new symbol when resolving, don't call set_is_default.
14513         * testsuite/ver_test_7.cc: New file.
14514         * testsuite/ver_test_7.sh: New file.
14515         * testsuite/Makefile.am (ver_test_7.so): New target.
14516         (ver_test_7.o): New target.
14517         (check_SCRIPTS): Add ver_test_7.sh.
14518         (check_DATA): Add ver_test_7.syms.
14519         (ver_test_7.syms): New target.
14520
14521 2008-03-28  Ian Lance Taylor  <iant@google.com>
14522
14523         * layout.cc (Layout::layout): If we see an input section with a
14524         name that needs sorting, set the must_sort flag for the output
14525         section.
14526         (Layout::make_output_section): If the name of the output section
14527         indicates that it might require sorting, set the may_sort flag.
14528         * output.h (Output_section::may_sort_attached_input_sections): New
14529         function.
14530         (Output_section::set_may_sort_attached_input_sections): New
14531         function.
14532         (Output_section::must_sort_attached_input_sections): New
14533         function.
14534         (Output_section::set_must_sort_attached_input_sections): New
14535         function.
14536         (class Output_section): Declare Input_section_sort_entry.  Define
14537         Input_section_sort_compare.  Declare
14538         sort_attached_input_sections.  Add new fields:
14539         may_sort_attached_input_sections_,
14540         must_sort_attached_input_sections_,
14541         attached_input_sections_are_sorted_.
14542         * output.cc (Output_section::Output_section): Initialize new
14543         fields.
14544         (Output_section::add_input_section): Add an entry to
14545         input_sections_ if may_sort or must_sort are true.
14546         (Output_section::set_final_data_size): Call
14547         sort_attached_input_sections if necessary.
14548         (Output_section::Input_section_sort_entry): Define new class.
14549         (Output_section::Input_section_sort_compare::operator()): New
14550         function.
14551         (Output_section::sort_attached_input_sections): New function.
14552         * configure.ac: Check whether the compiler supports constructor
14553         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14554         * testsuite/initpri1.c: New file.
14555         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14556         CONSTRUCTOR_PRIORITY.
14557         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14558         (initpri1_LDFLAGS): New variable.
14559         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14560
14561 2008-03-27  Ian Lance Taylor  <iant@google.com>
14562
14563         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14564         * testsuite/common_test_1.c: New file.
14565         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14566         (common_test_1_SOURCES): New variable.
14567         (common_test_1_DEPENDENCIES): New variable.
14568         (common_test_1_LDFLAGS): New variable.
14569
14570         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14571         and commons_ correctly when NAME/VERSION does not override
14572         NAME/NULL.
14573         * testsuite/ver_test_6.c: New file.
14574         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14575         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14576         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14577
14578 2008-03-26  Ian Lance Taylor  <iant@google.com>
14579
14580         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14581         of an undefined symbol from a version script.
14582         * testsuite/Makefile.am (ver_test_5.so): New target.
14583         (ver_test_5.o): New target.
14584         (check_SCRIPTS): Add ver_test_5.sh.
14585         (check_DATA): Add ver_test_5.syms.
14586         (ver_test_5.syms): New target.
14587         * testsuite/ver_test_5.cc: New file.
14588         * testsuite/ver_test_5.script: New file.
14589         * testsuite/ver_test_5.sh: New file.
14590         * Makefile.in, testsuite/Makefile.in: Rebuild.
14591
14592         PR gold/5986
14593         Fix problems building gold with gcc 4.3.0.
14594         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14595         (gold_error_at_location, gold_warning_at_location): Use it.
14596         * configure.ac: Check whether we can compile and use a template
14597         function with a printf attribute.
14598         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14599         when jumping over bytes.
14600         * object.cc: Instantiate Object::read_section_data.
14601         * debug.h: Include <cstring>
14602         * dwarf_reader.cc: Include <algorithm>
14603         * main.cc: Include <cstring>.
14604         * options.cc: Include <cstring>.
14605         * output.cc: Include <cstring>.
14606         * script.cc: Include <cstring>.
14607         * script.h: Include <string>.
14608         * symtab.cc: Include <cstring> and <algorithm>.
14609         * target-select.cc: Include <cstring>.
14610         * version.cc: Include <string>.
14611         * testsuite/testmain.cc: Include <cstdlib>.
14612         * configure, config.in: Rebuild.
14613
14614 2008-03-25  Ian Lance Taylor  <iant@google.com>
14615
14616         * options.cc: Include "../bfd/bfdver.h".
14617         (options::help): Print bug reporting address.
14618
14619         * version.cc (print_version): Adjust output for current value of
14620         BFD_VERSION_STRING.
14621
14622         * NEWS: New file.
14623
14624         * options.cc (options::help): Print list of supported targets.
14625         * target-select.h: Include <vector>.
14626         (class Target_selector): Make machine_, size_, and is_big_endian_
14627         fields const.  Add bfd_name_ and instantiated_target_ fields.
14628         (Target_selector::Target_selector): Add bfd_name parameter.
14629         (Target_selector::recognize): Make non-virtual, call
14630         do_recognize.
14631         (Target_selector::recognize_by_name): Make non-virtual, call
14632         do_recognize_by_name.
14633         (Target_selector::supported_names): New function.
14634         (Target_selector::bfd_name): New function.
14635         (Target_selector::do_instantiate_target): New pure virtual
14636         function.
14637         (Target_selector::do_recognize): New virtual function.
14638         (Target_selector::do_recognize_by_name): New virtual function.
14639         (Target_selector::instantiate_target): New private function.
14640         (supported_target_names): Declare.
14641         * target-select.cc (Target_selector::Target_selector): Update for
14642         new parameter and fields.
14643         (select_target_by_name): Check that the name matches before
14644         calling recognize_by_name.
14645         (supported_target_names): New function.
14646         * i386.cc (class Target_selector_i386): Update Target_selector
14647         constructor call.  Remove recognize and recognize_by_name.  Add
14648         do_instantiate_target.
14649         * x86_64.cc (class Target_selector_x86_64): Likewise.
14650         * testsuite/testfile.cc (class Target_selector_test): Update for
14651         changes to Target_selector.
14652
14653         * README: Rewrite, with some notes on unsupported features.
14654
14655 2008-03-24  Cary Coutant  <ccoutant@google.com>
14656
14657         * i386.cc (Target_i386::Got_type): New enum declaration.
14658         (Target_i386::Scan::local): Updated callers of Output_data_got
14659         member functions.
14660         (Target_i386::Scan::global): Likewise.
14661         (Target_i386::Relocate::relocate): Likewise.
14662         (Target_i386::Relocate::relocate_tls): Likewise.
14663         * object.h (Got_offset_list): New class.
14664         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14665         (Sized_relobj::local_got_offset): Likewise.
14666         (Sized_relobj::set_local_got_offset): Likewise.
14667         (Sized_relobj::local_has_tls_got_offset): Removed.
14668         (Sized_relobj::local_tls_got_offset): Removed.
14669         (Sized_relobj::set_local_tls_got_offset): Removed.
14670         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14671         * output.cc (Output_data_got::add_global): Added got_type parameter.
14672         (Output_data_got::add_global_with_rel): Likewise.
14673         (Output_data_got::add_global_with_rela): Likewise.
14674         (Output_data_got::add_global_pair_with_rel): New function.
14675         (Output_data_got::add_global_pair_with_rela): New function.
14676         (Output_data_got::add_local): Added got_type parameter.
14677         (Output_data_got::add_local_with_rel): Likewise.
14678         (Output_data_got::add_local_with_rela): Likewise.
14679         (Output_data_got::add_local_pair_with_rel): New function.
14680         (Output_data_got::add_local_pair_with_rela): New function.
14681         (Output_data_got::add_global_tls): Removed.
14682         (Output_data_got::add_global_tls_with_rel): Removed.
14683         (Output_data_got::add_global_tls_with_rela): Removed.
14684         (Output_data_got::add_local_tls): Removed.
14685         (Output_data_got::add_local_tls_with_rel): Removed.
14686         (Output_data_got::add_local_tls_with_rela): Removed.
14687         * output.h (Output_data_got::add_global): Added got_type parameter.
14688         (Output_data_got::add_global_with_rel): Likewise.
14689         (Output_data_got::add_global_with_rela): Likewise.
14690         (Output_data_got::add_global_pair_with_rel): New function.
14691         (Output_data_got::add_global_pair_with_rela): New function.
14692         (Output_data_got::add_local): Added got_type parameter.
14693         (Output_data_got::add_local_with_rel): Likewise.
14694         (Output_data_got::add_local_with_rela): Likewise.
14695         (Output_data_got::add_local_pair_with_rel): New function.
14696         (Output_data_got::add_local_pair_with_rela): New function.
14697         (Output_data_got::add_global_tls): Removed.
14698         (Output_data_got::add_global_tls_with_rel): Removed.
14699         (Output_data_got::add_global_tls_with_rela): Removed.
14700         (Output_data_got::add_local_tls): Removed.
14701         (Output_data_got::add_local_tls_with_rel): Removed.
14702         (Output_data_got::add_local_tls_with_rela): Removed.
14703         * resolve.cc (Symbol::override_base_with_special): Removed
14704         reference to has_got_offset_ field.
14705         * symtab.cc (Symbol::init_fields): Replaced initialization
14706         of got_offset_ with got_offsets_.  Removed initialization
14707         of has_got_offset_
14708         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14709         (Symbol::got_offset): Likewise.
14710         (Symbol::set_got_offset): Likewise.
14711         (Symbol::has_tls_got_offset): Removed.
14712         (Symbol::tls_got_offset): Removed.
14713         (Symbol::set_tls_got_offset): Removed.
14714         (Symbol::got_offset_): Removed.
14715         (Symbol::tls_mod_got_offset_): Removed.
14716         (Symbol::tls_pair_got_offset_): Removed.
14717         (Symbol::got_offsets_): New field.
14718         (Symbol::has_got_offset): Removed.
14719         (Symbol::has_tls_mod_got_offset): Removed.
14720         (Symbol::has_tls_pair_got_offset): Removed.
14721         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14722         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14723         member functions.
14724         (Target_x86_64::Scan::global): Likewise.
14725         (Target_x86_64::Relocate::relocate): Likewise.
14726         (Target_x86_64::Relocate::relocate_tls): Likewise.
14727
14728 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14729
14730         * yyscript.y: Fix spelling error in comment.
14731
14732 2008-03-24  Ian Lance Taylor  <iant@google.com>
14733
14734         * options.h (class General_options): Define build_id option.
14735         * layout.h (class Layout): Declare write_build_id, create_note,
14736         create_build_id.  Add build_id_note_ member.
14737         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14738         "libiberty.h", "md5.h", "sha1.h".
14739         (Layout::Layout): Initialize eh_frame_data_,
14740         eh_frame_hdr_section_, and build_id_note_.
14741         (Layout::finalize): Call create_build_id.
14742         (Layout::create_note): New function, broken out of
14743         Layout::create_gold_note.
14744         (Layout::create_gold_note): Call create_note.
14745         (Layout::create_build_id): New function.
14746         (Layout::write_build_id): New function.
14747         (Close_task_runner::run): Call write_build_id.
14748
14749         * x86_64.cc: Correct license to GPLv3.
14750
14751 2008-03-23  Ian Lance Taylor  <iant@google.com>
14752
14753         * options.cc: Include "demangle.h".
14754         (parse_optional_string): New function.
14755         (parse_long_option): Handle takes_optional_argument.
14756         (parse_short_option): Update dash_z initializer.  Handle
14757         takes_optional_argument.
14758         (General_options::General_options): Initialize do_demangle_.
14759         (General_options::finalize): Set do_demangle_.  Handle demangling
14760         style.
14761         * options.h (parse_optional_string): Declare.
14762         (struct One_option): Add optional_arg field.  Update constructor.
14763         Update call constructor calls.  Add takes_optional_argument
14764         function.
14765         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14766         (DEFINE_optional_string): Define.
14767         (General_options::demangle): Change from DEFINE_bool to
14768         DEFINE_optional_string.
14769         (General_options::no_demangle): New function.
14770         (General_options::do_demangle): New function.
14771         (General_options::set_do_demangle): New function.
14772         (General_options::execstack_status_): Move definition to end of
14773         class definition.
14774         (General_options::static_): Likewise.
14775         (General_options::do_demangle_): New field.
14776         * object.cc (big_endian>::get_symbol_location_info): Call
14777         Options::do_demangle, not Options::demangle.
14778         * symtab.cc (demangle): Likewise.
14779
14780 2008-03-22  Ian Lance Taylor  <iant@google.com>
14781
14782         * gold.h: Include <cstddef> and <sys/types.h>
14783         * options.h: Include <cstring>.
14784
14785 2008-03-21  Ian Lance Taylor  <iant@google.com>
14786
14787         * Added source code to GNU binutils.
14788 \f
14789 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14790
14791 Copying and distribution of this file, with or without modification,
14792 are permitted in any medium without royalty provided the copyright
14793 notice and this notice are preserved.
14794
14795 Local Variables:
14796 mode: change-log
14797 left-margin: 8
14798 fill-column: 74
14799 version-control: never
14800 End: