gold/
[external/binutils.git] / gold / ChangeLog
1 2013-05-13  Cary Coutant  <ccoutant@google.com>
2
3         * configure.ac: Export DEFAULT_TARGET.
4         * configure: Regenerate.
5         * Makefile.in: Regenerate.
6         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
7         * testsuite/Makefile.in: Regenerate.
8         * testsuite/debug_msg.sh: Delete duplicate tests.
9         Don't check undef_int error message match for powerpc where the
10         source file and line number aren't available.
11
12 2013-05-10  Roland McGrath  <mcgrathr@google.com>
13
14         * options.h (General_options): Add --rosegment-gap option.
15         * options.cc (finalize): --rosegment-gap implies --rosegment.
16         * layout.cc (set_segment_offsets): Let user option override
17         target->rosegment_gap().
18
19 2013-05-10  Roland McGrath  <mcgrathr@google.com>
20
21         * options.h (General_options): Remove leading space from help
22         messages for -nostdlib and --rosegment.
23
24 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
25
26         PR ld/15365
27         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
28
29 2013-05-03  Alan Modra  <amodra@gmail.com>
30
31         * merge.cc (Output_merge_string::do_add_input_section): Correct
32         scan for number of strings.  Rename vars to avoid shadowing.
33         Include missing terminator in input_size_.
34
35 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
36
37         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
38         Restore empty string handling.
39
40 2013-05-01  Cary Coutant  <ccoutant@google.com>
41
42         * stringpool.cc (Stringpool_template::new_key_offset): Fix
43         uninitialized warning.
44
45 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
46
47         * output.cc (Output_section::add_merge_input_section): Allow
48         to merge sections if the alignment is more than character size.
49         * merge.h (Output_merge_string::Output_merge_string): Remove
50         assert.
51         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
52         only not-null strings. Check the alignment of strings.
53         * stringpool.h
54         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
55         alignment as the argument.
56         (Stringpool_template<Stringpool_char>::addralign_): New class member.
57         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
58         Align non-zero length strings according to the addralign_.
59         (Stringpool_template<Stringpool_char>::set_string_offsets):
60         Updating offsets according to the given alignment.
61         * testsuite/Makefile.am (text_section_grouping): Test if string
62         literals are getting merged.
63         * testsuite/Makefile.in: Regenerate.
64         * testsuite/merge_string_literals_1.c: New file.
65         * testsuite/merge_string_literals_2.c: Ditto.
66         * testsuite/merge_string_literals.sh: Ditto.
67
68 2013-04-26  Ian Lance Taylor  <iant@google.com>
69
70         * target-reloc.h (relocate_section): If the reloc offset is out of
71         range, pass VIEW as NULL to relocate.relocate.
72         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
73         * i386.cc (Target_i386::Relocate::relocate): Likewise.
74         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
75         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
76         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
77         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
78
79 2013-04-26  Geoff Pike  <gpike@chromium.org>
80
81         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
82         * layout.cc (Hash_task): New class.
83         (Layout::queue_build_id_tasks): New function.
84         (Layout::write_build_id): Handle single-thread portion of build ID
85         computation.  (In some cases, all of it is single-threaded.)  Replace
86         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
87         functionality in fewer lines of code.
88         * layout.h (Layout::queue_build_id_tasks): New function declaration.
89         * options.h (General_options): make "--build-id" default to tree
90         rather than sha1.  Add two new options related to --build-id=tree:
91         --build-id-chunk-size-for-treehash and
92         --build-id-min-file-size-for-treehash.
93         * Makefile.am: add testing of --build-id=tree and related new options
94         (these tests will be invoked by "make check").
95         * Makefile.in: Regenerate.
96
97 2013-04-25  Alan Modra  <amodra@gmail.com>
98
99         * configure.tgt: Add powerpcle and powerpc64le.
100
101 2013-04-22  Alan Modra  <amodra@gmail.com>
102
103         PR gold/15355
104         * layout.cc (Layout::segment_precedes): Allow more than one
105         segment with the same type and flags.
106
107 2013-04-15  Cary Coutant  <ccoutant@google.com>
108
109         * layout.cc (Layout::set_relocatable_section_offsets): Don't
110         allocate space in file for BSS sections.
111
112 2013-04-15  Cary Coutant  <ccoutant@google.com>
113
114         * script-sections.cc (Orphan_output_section): Reset address
115         to zero after each orphaned section for relocatable links.
116
117 2013-04-15  Cary Coutant  <ccoutant@google.com>
118
119         * symtab.cc (Symbol_table::sized_write_globals): Subtract
120         section starting address for relocatable link.
121         * testsuite/Makefile.am (script_test_11): New test.
122         * testsuite/Makefile.in: Regenerate.
123         * testsuite/script_test_11.c: New source file.
124         * testsuite/script_test_11.t: New linker script.
125
126 2013-04-13  Alan Modra  <amodra@gmail.com>
127
128         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
129         owner when sections are not adjacent and exceed group size.
130         (Target_powerpc::group_sections): Handle corner case.
131         (Target_powerpc::Branch_info::make_stub): Handle case where
132         stub table doesn't exist due to branches in non-exec sections.
133         (Target_powerpc::Relocate::relocate): Likewise.
134
135 2013-04-11  Alan Modra  <amodra@gmail.com>
136
137         PR gold/15354
138         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
139         .branch_lt to match bfd ld.  Adjust comments throughout file.
140
141 2013-04-04  Ian Lance Taylor  <iant@google.com>
142
143         GCC PR c++/56840
144         * object.cc (do_layout_deferred_sections): Handle .eh_frame
145         sections before checking whether they are included in the link.
146
147 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
148
149         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
150         object before calling the plugin claim_file handler.  Pass the elf
151         object of the archive to the plugin. Delete the elf object if the
152         plugin claims the file.
153
154 2013-03-21  Alan Modra  <amodra@gmail.com>
155
156         * layout.cc (Layout::set_segment_offsets): Accept writable .text
157         segment when omagic.
158
159 2013-03-21  Alan Modra  <amodra@gmail.com>
160
161         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
162         comparison warning.
163         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
164         uninitialized" warning.
165
166 2013-03-20  Alan Modra  <amodra@gmail.com>
167
168         * symtab.h (Symbol::clear_version): New function.
169         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
170         is_needed by weak references.  Clear version for symbols defined
171         in as-needed objects that are not needed.
172
173 2013-03-15  Alan Modra  <amodra@gmail.com>
174
175         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
176         static and public.  Add report_err param.  Return false for data refs.
177         (Target_powerpc::rela_dyn_section): New overloaded function.
178         (Target_powerpc::plt_, iplt_): Elucidate.
179         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
180         (Output_data_plt_powerpc::do_write): Don't write .iplt.
181         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
182         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
183         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
184         push_branch and make_plt_entry for ifunc syms when
185         reloc_needs_plt_for_ifunc.
186         (Target_powerpc::Relocate::relocate): Don't use plt entry value
187         for ifunc unless reloc_needs_plt_for_ifunc.
188
189 2013-03-15  Alan Modra  <amodra@gmail.com>
190
191         * gc.h (gc_process_relocs): Don't look through function descriptors.
192         * icf.cc (get_section_contents): Do so here instead.
193
194 2013-03-13  Alan Modra  <amodra@gmail.com>
195
196         * powerpc.cc (is_branch_reloc): Forward declare.
197         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
198         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
199         false for 64-bit, true for 32-bit non-branch relocs.
200         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
201         * testsuite/Makefile.am (icf_test): Use linker map file instead of
202         nm output.
203         (icf_safe_test): Generate linker map file as well as nm output.
204         (icf_safe_so_test): Likewise.
205         * testsuite/Makefile.in: Regenerate.
206         * testsuite/icf_test.sh: Parse linker map file to determine
207         section folding.
208         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
209         * testsuite/icf_safe_so_test.sh: Likewise.
210         (X86_32_or_ARM_specific_safe_fold): Merge into..
211         (arch_specific_safe_fold): ..this.
212         (X86_64_specific_safe_fold): Delete unused function.
213
214 2013-03-12  Alan Modra  <amodra@gmail.com>
215
216         * gc.h (gc_process_relocs): Look through function descriptors
217         to determine shndx, symvalue and addend used by ICF.  Tidy
218         variable duplication.
219
220 2013-03-11  Alan Modra  <amodra@gmail.com>
221
222         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
223         * layout.cc (Layout_task_runner::run): ..to here.
224         * symtab.h (struct Symbol_location): Extract from..
225         (class Symbol_table): ..here.
226         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
227         * target.h (class Target): Add function_location and
228         do_function_location functions.
229         (class Sized_target): Add do_function_location.
230         * object.h (class Sized_relobj_file): Move find_shdr..
231         (class Object): ..to here.
232         * object.cc: Likewise.  Update to suit.  Instantiate.
233         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
234         * powerpc.cc (class Powerpc_dynobj): New.
235         (Target_powerpc::do_function_location): New function.
236         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
237         (Powerpc_dynobj::do_read_symbols): New function.
238         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
239
240 2013-03-08  Ian Lance Taylor  <iant@google.com>
241
242         * options.cc (General_options::string_to_object_format): Accept
243         "default".
244
245 2013-03-08  Alan Modra  <amodra@gmail.com>
246
247         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
248         pointer to Post_fde.
249         (struct Post_fde): Move definition to here..
250         * ehframe.cc (struct Post_fde): ..from here.
251         (Cie::write): Don't alloc Post_fde.
252         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
253
254 2013-03-07  Alan Modra  <amodra@gmail.com>
255
256         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
257         relocation referencing .LC0.
258         * testsuite/discard_locals_test.sh: Remove FIXMEs.
259
260 2013-03-07  Alan Modra  <amodra@gmail.com>
261
262         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
263         always_inline.  Add assembly for powerpc to avoid GOT.
264
265 2013-03-07  Alan Modra  <amodra@gmail.com>
266
267         * testsuite/script_test_10.sh: Don't test .bss section
268         header number.
269
270 2013-03-06  Alan Modra  <amodra@gmail.com>
271
272         * powerpc.cc (class Powerpc_relobj): Move some member functions.
273         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
274         all callers.  Handle folded sections.
275         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
276         to Powerpc_relobj.
277         (Global_symbol_visitor_opd::operator()): Likewise.
278
279 2013-03-04  Alan Modra  <amodra@gmail.com>
280
281         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
282         * testsuite/Makefile.in: Regenerate.
283
284 2013-03-01  Cary Coutant  <ccoutant@google.com>
285
286         Add dwp support for v2 DWARF package file format.
287         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
288         tu_length parameter.  Adjust all callers.
289         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
290         * dwp.cc: Include dwarf.h.
291         (Section_bounds): New struct type.
292         (Unit_set): New struct type.
293         (Dwo_file::Dwo_file): Initialize new data member.
294         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
295         Combine and rename to...
296         (Dwo_file::read_unit_index): ...this.
297         (Dwo_file::sized_read_compunit_index)
298         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
299         (Dwo_file::sized_read_unit_index): ...this.
300         (Dwo_file::copy_section): Remove section_name, is_str_offsets
301         parameters; add section_id parameter.
302         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
303         (Dwo_file::add_unit_set): ...this.
304         (Dwo_file::shndx_map_): Remove.
305         (Dwo_file::sect_offsets_): New data member.
306         (Dwp_output_file::Dwp_output_file): Initialize new data members.
307         (Dwp_output_file::add_section): Rename to...
308         (Dwp_output_file::add_contribution): ...this.
309         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
310         (Dwp_output_file::add_tu_set): Likewise.
311         (Dwp_output_file::Contribution): New type.
312         (Dwp_output_file::Section::contributions): New data member.
313         (Dwp_output_file::Cu_or_tu_set): Remove.
314         (Dwp_output_file::Section::Section): New ctor.
315         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
316         (Dwp_output_file::Dwp_index::Section_table): New type.
317         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
318         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
319         parameter.
320         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
321         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
322         (Dwp_output_file::Dwp_index::section_table): New member function.
323         (Dwp_output_file::Dwp_index::section_table_end): New member function.
324         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
325         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
326         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
327         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
328         (Dwp_output_file::Dwp_index::section_table_): New data member.
329         (Dwp_output_file::Dwp_index::section_mask_): New data member.
330         (Dwp_output_file::add_output_section): New member function.
331         (Dwp_output_file::write_new_section): New member function.
332         (Dwp_output_file::write_contributions): New member function.
333         (Dwp_output_file::section_id_map_): New data member.
334         (class Dwo_id_info_reader): Remove.
335         (class Unit_reader): New class.
336         (get_dwarf_section_name): New function.
337         (Dwo_file::read_executable): Adjust initializations of class data.
338         (Dwo_file::read): Add support for v2 package file format.
339         (Dwo_file::read_unit_index): Likewise.
340         (Dwo_file::sized_read_unit_index): Likewise.
341         (Dwo_file::copy_section): Likewise.
342         (Dwo_file::add_unit_set): Likewise.
343         (Dwp_output_file::add_output_section): Likewise.
344         (Dwp_output_file::add_contribution): Likewise.
345         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
346         for empty slot.
347         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
348         file format.
349         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
350         slot.
351         (Dwp_output_file::initialize): Remove unused function.
352         (Dwp_output_file::finalize): Add support for v2 package file format.
353         (Dwp_output_file::write_index): Likewise.
354         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
355         function prototype.
356
357 2013-03-01  Cary Coutant  <ccoutant@google.com>
358
359         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
360         function into class definition in header file.
361         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
362         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
363         New function.
364         (Dwarf_info_reader::check_buffer): Move here from .cc file.
365
366 2013-02-28  Alan Modra  <amodra@gmail.com>
367
368         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
369         * target.cc (Target::do_plt_fde_location): New function.
370         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
371         accessor function, and constructor param.
372         (struct Post_fde, Post_fdes): Declare.
373         (Cie::write): Add post_fdes param.
374         * ehframe.cc (Fde::write): Use plt_fde_location.
375         (struct Post_fde): Define.
376         (Cie::write): Stash FDEs added post merge mapping.
377         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
378         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
379         (Eh_frame::do_sized_write): Arrange to write post map FDES after
380         other FDEs.
381         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
382         (Target_powerpc::has_glink): New function.
383         (Target_powerpc::do_relax): Add eh_frame info for stubs.
384         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
385         glink_eh_frame_fde_32, default_fde): New data.
386         (Stub_table::eh_frame_added_): New var.
387         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
388         Make const.
389         (Stub_table::add_eh_frame): New function.
390         (Output_data_glink::add_eh_frame): New function.
391         (Target_powerpc::make_glink_section): Call add_eh_frame.
392
393 2013-02-15  Ian Lance Taylor  <iant@google.com>
394
395         * options.h (DEFINE_uint64_alias): Define.
396         (class General_options): Add -Ttext-segment as an alias for
397         -Ttext.
398
399 2013-02-15  Alan Modra  <amodra@gmail.com>
400
401         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
402         (Stub_table::do_write): ..here, two places.
403         (Stub_table::plt_call_size): Use it here too.
404
405 2013-02-11  Ian Lance Taylor  <iant@google.com>
406
407         * descriptors.cc (Descriptors::close_all): New function.
408         * descriptors.h (class Descriptors): Declare close_all.
409         (close_all_descriptors): New inline function.
410         * plugin.cc: Include "descriptors.h".
411         (Plugin_manager::cleanup): Call close_all_descriptors.
412
413 2013-02-06  Alan Modra  <amodra@gmail.com>
414
415         * README: Update coding style link.
416
417 2013-01-28  Cary Coutant  <ccoutant@google.com>
418
419         * dwp.cc (File_list): New typedef.
420         (Dwo_name_info_reader): New class.
421         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
422         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
423         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
424         (Dwo_file::read_executable): New function.
425         (Dwo_file::read): Move common setup code to ...
426         (Dwo_file::make_object): ... here.
427         (dwp_options): Add --exec/-e.
428         (usage): Likewise.
429         (main): Likewise.
430
431 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
432
433         * layout.cc (Layout::layout): Check for option text_reorder.
434         (Layout::make_output_section): Ditto.
435         * options.h (text_reorder): New option.
436         * output.cc (Input_section_sort_compare): Remove special ordering
437         of section names.
438         (Output_section::
439          Input_section_sort_section_name_special_ordering_compare::
440          operator()): New function.
441         (Output_section::sort_attached_input_sections): Use new sort function
442         for .text.
443         * output.h (Input_section_sort_section_name_special_ordering_compare):
444         New struct.
445         * testsuite/Makefile.am (text_section_grouping): Test option
446         --no-text-reorder
447         * testsuite/Makefile.in: Regenerate.
448         * testsuite/text_section_grouping.sh: Check order of functions without
449         default text reordering.
450
451 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
452
453         * options.h (General_options): Change default to true for new_dtags.
454
455 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
456
457         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
458         when enable_new_dtags is false.  Only add DT_RUNPATH when
459         enable_new_dtags is true.
460
461 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
462
463         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
464         used in declaration and definition consistent.
465         (Target_powerpc::symval_for_branch): Ditto.
466
467 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
468
469         * testsuite/plugin_final_layout.cc: Fix comment.
470
471 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
472
473         * layout.cc (Layout::layout): Do not do default sorting for
474         text sections when section ordering is specified.
475         (make_output_section): Ditto.
476         * testsuite/plugin_final_layout.cc: Name the function sections
477         to catch reordering issues.
478
479 2013-01-15  Alan Modra  <amodra@gmail.com>
480
481         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
482         plt-thread-safe.
483
484 2013-01-15  Alan Modra  <amodra@gmail.com>
485
486         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
487         * testsuite/Makefile.in: Regenerate.
488
489 2013-01-14  Alan Modra  <amodra@gmail.com>
490
491         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
492         * testsuite/Makefile.in: Regenerate.
493
494 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
495
496         PR bfd/14430
497         Fix mingw gold build with plugins enabled
498         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
499         * configure.ac: Export DLOPEN_LIBS and add headers check.
500         * plugin.cc: Handle non-dlfcn case.
501         * Makefile.in: Regenerate.
502         * config.in: Regenerate.
503         * configure: Regenerate.
504         * testsuite/Makefile.in: Regenerate.
505
506 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
507
508         * output.h (sort_attached_input_sections): Change to be public.
509         * script-sections.cc
510         (Output_section_definition::set_section_addresses): Sort
511         attached input sections according to section order before linker
512         script assigns section addresses.
513         (Orphan_output_section::set_section_addresses): Sort
514         attached input sections according to section order before linker
515         script assigns section addresses.
516         * Makefile.am (final_layout.sh): Use a simple linker script to
517         check if section ordering still works.
518         * Makefile.in: Regenerate.
519
520 2013-01-09  Ben Cheng  <bccheng@google.com>
521
522         * arm.cc (Target_arm::attributes_accept_div): New function.
523         (Target_arm::attributes_forbid_div): New function.
524         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
525         attribute using the same new functions as what bfd/elf32_arm.c
526         does.
527
528 2013-01-07  Cary Coutant  <ccoutant@google.com>
529
530         PR gold/14993
531         * output.cc (Output_section::add_input_section): For incremental
532         updates, don't track input sections that are allocated from patch
533         space.
534
535 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
536             Ian Lance Taylor  <iant@google.com>
537
538         PR gold/14897
539         * configure.ac (--enable-ld): Removed.
540         (install_as_default): Set to yes only for --enable-gold=default
541         or --disable-ld.
542         * configure: Regenerated.
543
544 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
545
546         * options.h (General_options): Add -fuse-ld= for GCC linker
547         option compatibility.
548
549 2013-01-04  Cary Coutant  <ccoutant@google.com>
550
551         * configure.ac: Fix typo restoring CXXFLAGS.
552         * configure: Regenerate.
553
554 2013-01-04  Cary Coutant  <ccoutant@google.com>
555
556         * testsuite/Makefile.am (CXXLINK_S): New macro.
557         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
558         * testsuite/Makefile.in: Regenerate.
559
560 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
561
562         * version.cc (print_version): Update copyright year to 2013.
563
564 2012-12-20  Ian Lance Taylor  <iant@google.com>
565
566         * layout.cc (Layout::special_ordering_of_input_section): New
567         function.
568         (Layout::layout): If input section requires special ordering, must
569         sort input sections.
570         (Layout::make_output_section): May sort .text input sections.
571         (Layout::is_section_name_prefix_grouped): Remove.
572         * layout.h (class Layout): Declare
573         special_ordering_of_input_section.  Don't declare
574         is_section_name_prefix_grouped.
575         * output.cc (Output_section::add_input_section): Revert last
576         change.
577         (Output_section::Input_section_sort::match_file_name): Don't crash
578         if called on output section data.
579         (Output_section::Input_section_sort_compare): Sort based on
580         special ordering.
581         (Output_section::Input_section_sort_section_order_index_compare):
582         Revert last patch.
583         (Output_section::sort_attached_input_sections): Likewise.
584
585 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
586
587         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
588         * layout.h (Layout::is_section_name_prefix_grouped): New function.
589         * output.cc (Output_section::add_input_section): Check if section
590         name contains special prefix.  Keep input sections to sort such
591         sections.
592         (Output_section::Input_section_sort_section_order_index_compare
593          ::operator()): Group sections according to prefixes.
594         (Output_section::sort_attached_input_sections): Add condition to
595         Input_section_entry constructor call.
596         * testsuite/Makefile.am (text_section_grouping): New test.
597         * testsuite/Makefile.in: Regenerate.
598         * testsuite/text_section_grouping.cc: New file.
599         * testsuite/text_section_grouping.sh: New file.
600
601 2012-12-17  Nick Clifton  <nickc@redhat.com>
602
603         * Makefile.am: Add copyright notice.
604         * NEWS: Likewise.
605         * README: Likewise.
606         * configure.ac: Likewise.
607         * ftruncate.c: Likewise.
608         * Makefile.in: Regenerate.
609
610 2012-12-14  Cary Coutant  <ccoutant@google.com>
611
612         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
613         --no-as-needed flag.
614         (exception_separate_shared_12_test): Likewise.
615         (incremental_copy_test): Likewise.
616         * testsuite/Makefile.in: Regenerate.
617
618 2012-12-14  Cary Coutant  <ccoutant@google.com>
619
620         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
621         (Dwp_output_file::Dwp_index::enter_set): Add assert.
622
623 2012-12-12  Alan Modra  <amodra@gmail.com>
624
625         * powerpc.cc (class Track_tls): New.
626         (class Relocate, class Scan): Inherit Track_tls.
627         (Target_powerpc::Scan::local, global): Track tls optimization
628         and avoid creating plt entry for __tls_get_addr if all uses
629         are optimized away.
630         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
631
632 2012-12-12  Alan Modra  <amodra@gmail.com>
633
634         * options.h (General_options): Add --toc-sort/--no-toc-sort.
635         Replace no_toc_optimize with toc_optimize.
636         * output.h (Output_section::input_sections): Provide non-const variant.
637         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
638         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
639         accessors.
640         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
641         (class Sort_toc_sections): New.
642         (Target_powerpc::do_finalize_sections): Sort toc sections.
643         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
644
645 2012-12-10  Roland McGrath  <mcgrathr@google.com>
646
647         * testsuite/binary_unittest.cc (read_all): New function.
648         (Sized_binary_test): Use it instead of ::read.
649         * fileread.cc (do_read): Don't assume pread always reads the whole
650         amount in a single call.
651
652 2012-12-10  Alan Modra  <amodra@gmail.com>
653
654         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
655         Set EM_PPC64 or EM_PPC here.
656         (Target_selector_powerpc::do_recognize): Delete.
657
658 2012-12-10  Alan Modra  <amodra@gmail.com>
659
660         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
661         stub_table_.
662         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
663
664 2012-12-07  Roland McGrath  <mcgrathr@google.com>
665
666         * testsuite/binary_unittest.cc (Sized_binary_test):
667         Use open_descriptor rather than ::open.
668
669 2012-12-07  Alan Modra  <amodra@gmail.com>
670
671         * powerpc.cc (Stub_table::do_write): Delete redundant Address
672         typedef and invalid_address constant.
673         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
674         instantiate constants.
675
676 2012-12-06  Roland McGrath  <mcgrathr@google.com>
677
678         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
679         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
680         * aclocal.m4: Regenerate.
681         * configure: Regenerate.
682         * Makefile.in: Regenerate.
683         * testsuite/Makefile.in: Regenerate.
684
685 2012-12-07  Alan Modra  <amodra@gmail.com>
686
687         * options.h (General_options): Add no_toc_optimize.
688         * powerpc.cc (ok_lo_toc_insn): New function.
689         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
690
691 2012-12-06  Alan Modra  <amodra@gmail.com>
692
693         * options.h (General_options): Add plt_align, plt_static_chain,
694         plt_thread_safe.  Update stub_group_size help text.
695         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
696         for new plt_thread_safe_ var.
697         (use_plt_offset): Correct comments.
698         (Target_powerpc::do_relax): Look for thread creation symbols to
699         determine default plt_thread_safe value.  Clear plt call stubs
700         as well as branch stubs each iteration.
701         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
702         insn constants.
703         (l, hi, ha, write_insn): Move earlier.
704         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
705         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
706         plt stubs too.
707         (Stub_table::update_size): Adjust.
708         (Stub_table::prev_size, set_prev_size): Delete.
709         (Stub_table::stub_align): Let --plt-align affect result.
710         (Stub_table::plt_call_size): Calculate sizes for various stubs.
711         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
712         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
713         (Stub_table::do_write): Support more stub variants.
714
715 2012-12-04  Alan Modra  <amodra@gmail.com>
716
717         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
718         (Target_powerpc::do_define_standard_symbols): New function.
719
720 2012-12-03  Alan Modra  <amodra@gmail.com>
721
722         * output.h: Formatting, whitespace.
723
724 2012-12-03  Alan Modra  <amodra@gmail.com>
725
726         * layout.h (Layout::get_executable_sections): Declare.
727         * layout.cc (Layout::get_executable_sections): New function.
728         * arm.cc (Target_arm::group_sections): Use it.
729         (Arm_output_section::group_sections): Delete now redundant test.
730         * output.cc (Output_reloc::Output_reloc): Add is_relative.
731         param to handle relative relocs.
732         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
733         (Output_data_reloc::add_absolute): Adjust.
734         (Output_data_reloc::add_relative): New function.
735         (Output_data::reset_data_size): New function.
736         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
737         (Output_section::set_addralign): New function.
738         (Output_section::checkpoint_set_addralign): New function.
739         (Output_section::clear_section_offsets_need_adjustment): New function.
740         (Output_section::input_sections): Make public.
741         * powerpc.cc (class Output_data_brlt_powerpc): New.
742         (class Stub_table, class Stub_control): New.
743         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
744         stub_table_, set_stub_table, stub_table): New vectors and accessor
745         functions.
746         (Target_powerpc::do_may_relax, do_relax, push_branch,
747         new_stub_table, stub_tables, brlt_section, group_sections,
748         add_branch_lookup_table, find_branch_lookup_table,
749         write_branch_lookup_table, make_brlt_section): New functions.
750         (Target_powerpc::struct Sort_sections, class Branch_info): New.
751         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
752         branch_info_): New vars.
753         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
754         make call stubs here.
755         (Output_data_glink): Remove all call stub handling from this class.
756         (Target_powerpc::Scan::local, global): Save interesting branch
757         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
758         (Target_powerpc::do_finalize_sections): Only make reg save/restore
759         functions on final link.
760         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
761         Handle long branch destinations too.
762         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
763         do_plt_address_for_local): Adjust lookup of plt call stubs.
764
765 2012-11-30  Alan Modra  <amodra@gmail.com>
766
767         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
768         relocs against protected symbols when building 32-bit shared libs.
769
770 2012-11-30  Alan Modra  <amodra@gmail.com>
771
772         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
773         param.  Call got_section() to make .got.  Update all callers
774         and their callers and so on.
775
776 2012-11-30  Alan Modra  <amodra@gmail.com>
777
778         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
779         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
780         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
781         value if it already exists.
782
783 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
784
785         PR gold/14858
786         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
787
788 2012-11-14  Roland McGrath  <mcgrathr@google.com>
789
790         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
791         than bfc instruction for data sandboxing.
792
793 2012-11-08  Alan Modra  <amodra@gmail.com>
794
795         * po/POTFILES.in: Regenerate.
796
797 2012-11-05  Alan Modra  <amodra@gmail.com>
798
799         * configure.ac: Apply 2012-09-10 change to config.in here.
800         * configure: Regenerate.
801
802 2012-11-05  Alan Modra  <amodra@gmail.com>
803
804         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
805         (struct Opd_ent): Use "Address" rather than "Offset".
806         (Output_data_got_powerpc::got_base_offset): Return Valtype.
807         (Target_powerpc::got_section): Make public.
808         (Target_powerpc::scan_relocs): Move code setting symbols..
809         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
810         Create _SDA_BASE_ only when referenced.
811
812 2012-11-02  Roland McGrath  <mcgrathr@google.com>
813
814         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
815         from last change.
816
817 2012-11-01  Roland McGrath  <mcgrathr@google.com>
818
819         * target.h (Sized_target::relocate_relocs): Use Elf_Off
820         for offset_in_output_section parameter.
821         (Sized_target::relocate_special_relocatable): Likewise.
822         * arm.cc (Target_arm::relocate_relocs): Likewise.
823         (Target_arm::relocate_special_relocatable): Likewise.
824         * i386.cc (Target_i386::relocate_relocs): Likewise.
825         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
826         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
827         * target-reloc.h (relocate_relocs): Likewise.
828         * testsuite/testfile.cc (Target_test): Likewise.
829         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
830         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
831
832         * system.h: Move inclusion of <clocale> to after <libintl.h> in
833         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
834
835         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
836         parameter, which is unused in the [!F_SETFD] case.
837
838         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
839         SYMNDX to off_t before comparing it to this->data_size().
840         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
841         * incremental.cc (Output_section_incremental_inputs::do_write):
842         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
843
844         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
845
846 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
847
848         * gold.cc (Target_arm::do_adjust_elf_header): Add the
849         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
850         in EABI_VER5.
851
852 2012-10-29  Cary Coutant  <ccoutant@google.com>
853
854         * dwp.cc (usage): Add file and exit status parameters;
855         add --help and --version options.
856         (print_version): New function.
857         (main): Add --help and --version options.
858
859 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
860
861         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
862         final_layout_sequence.txt.
863         * testsuite/Makefile.in: Regenerated.
864
865 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
866
867         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
868         COMPILE generated by automake.
869         (LINK1): Likewise.
870         (CXXCOMPILE1): Likewise.
871         (CXXLINK1): Likewise.
872         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
873         (LINK): Likewise.
874         (CXXCOMPILE): Likewise.
875         (CXXLINK): Likewise.
876         * testsuite/Makefile.in: Regenerated.
877
878 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
879
880         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
881         on bad fwrite return.
882
883 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
884
885         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
886         on val.
887
888 2012-10-23  Cary Coutant  <ccoutant@google.com>
889
890         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
891         * testsuite/Makefile.in: Regenerate.
892         * testsuite/dwp_test.h: New source file.
893         * testsuite/dwp_test_1.cc: New source file.
894         * testsuite/dwp_test_1.s: New source file.
895         * testsuite/dwp_test_1.sh: New source file.
896         * testsuite/dwp_test_1b.cc: New source file.
897         * testsuite/dwp_test_1b.s: New source file.
898         * testsuite/dwp_test_2.cc: New source file.
899         * testsuite/dwp_test_2.s: New source file.
900         * testsuite/dwp_test_2.sh: New source file.
901         * testsuite/dwp_test_main.cc: New source file.
902         * testsuite/dwp_test_main.s: New source file.
903
904 2012-10-23  Cary Coutant  <ccoutant@google.com>
905
906         * dwp.h: New header file.
907         * dwp.cc: New source file.
908         * gold.h: Move shared declarations to system.h.
909         * system.h: New header file.
910         * Makefile.am: Add dwp.
911         * Makefile.in: Regenerate.
912
913 2012-10-23  Cary Coutant  <ccoutant@google.com>
914
915         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
916         Dwarf_info_reader::read_from_pointer.
917         (Dwarf_pubnames_table::read_header): Likewise.
918         (Dwarf_pubnames_table::next_name): Likewise.
919         (Dwarf_die::read_attributes): Likewise.
920         (Dwarf_die::skip_attributes): Likewise.
921         (Dwarf_info_reader::read_from_pointer): New function template.
922         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
923         (Dwarf_pubnames_table): Likewise.
924         (Dwarf_info_reader::read_from_pointer): New function template.
925         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
926         Dwarf_pubnames_table ctor.
927
928 2012-10-23  Cary Coutant  <ccoutant@google.com>
929
930         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
931         abbrev_shndx.
932         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
933         abbrev_shndx_.
934         (Dwarf_info_reader::set_abbrev_shndx): New method.
935         (Dwarf_info_reader::abbrev_shndx_): New data member.
936
937 2012-10-23  Cary Coutant  <ccoutant@google.com>
938
939         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
940         from object, not parameters.
941         (Dwarf_info_reader::parse): Likewise.
942         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
943         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
944         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
945         methods.
946
947 2012-10-23  Cary Coutant  <ccoutant@google.com>
948
949         * fileread.cc (Input_file::Input_file): New constructor.
950         * fileread.h (class Input_file): Add new constructor.
951
952 2012-10-18  Alan Modra  <amodra@gmail.com>
953
954         PR gold/14727
955         * object.cc (Relobj::is_section_name_included): Also match
956         .sdata personality section.
957
958 2012-10-18  Alan Modra  <amodra@gmail.com>
959
960         * target-reloc.h (class Default_comdat_behavior): New, package up..
961         (get_comdat_behaviour): ..this.
962         (relocate_section): Add Relocate_comdat_behavior template arg,
963         adjust code to suit.
964         * arm.cc (Target_arm::relocate_section): Adjust to suit.
965         (Target_arm::scan_reloc_section): Likewise.
966         * i386.cc (Target_i386::relocate_section): Likewise.
967         * sparc.cc (Target_sparc::relocate_section): Likewise.
968         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
969         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
970         * powerpc.cc (class Relocate_comdat_behavior): New.
971         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
972         gold::relocate_section with new template arg.
973
974 2012-10-18  Alan Modra  <amodra@gmail.com>
975
976         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
977         dynamic relocs for GOT_TPREL got entries, without symbol if
978         resolving locally.
979         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
980         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
981         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
982
983 2012-10-17  Alan Modra  <amodra@gmail.com>
984
985         PR gold/14726
986         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
987
988 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
989
990         * layout.cc (Layout::include_section): Keep sections marked
991         SHF_EXCLUDE when doing relocatable links.
992
993 2012-10-16  Alan Modra  <amodra@gmail.com>
994
995         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
996         (Target_powerpc::do_finalize_sections): Call it.
997         (Output_data_save_res): New class and supporting functions.
998         (Target_powerpc::symval_for_branch): Only look up .opd entry for
999         normal symbols defined in object files.
1000
1001 2012-10-12  Alan Modra  <amodra@gmail.com>
1002
1003         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1004         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1005         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1006         section if scan_opd_relocs not yet called.
1007         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1008
1009 2012-10-12  Alan Modra  <amodra@gmail.com>
1010
1011         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1012         add_local_ifunc_entry): Revert last change.
1013         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1014
1015 2012-10-05  Alan Modra  <amodra@gmail.com>
1016
1017         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1018         do_plt_address_for_global): New functions.
1019         (Output_data_got_powerpc::do_write): Don't segfault when linking
1020         statically.
1021         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1022         add_local_ifunc_entry): Return true on adding entry..
1023         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1024         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1025         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1026         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1027         set up symbols here.
1028         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1029         syms here.  Do so even when no .iplt.  Don't segfault when linking
1030         statically.
1031         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1032         new variants without reloc param.
1033         (Glink_sym_ent::Glink_sym_ent): Likewise.
1034         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1035         reloc when refs will resolve to plt call stub.
1036         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1037         R_PPC_PLTREL24 to resolve locally.
1038         (Target_powerpc::Scan::global): Correct ifunc handling.
1039         (Target_powerpc::Relocate::relocate): Correct local sym glink
1040         lookup.  Don't destroy "value" when we have a plt call stub,
1041         and when checking plt call validity.
1042         (Target_powerpc::do_dynsym_value): Simplify.
1043
1044 2012-10-05  Alan Modra  <amodra@gmail.com>
1045
1046         * i386.cc (Output_data_plt_i386::address_for_global,
1047         address_for_local): Add plt offset to returned value.  Adjust uses.
1048         * sparc.cc (Output_data_plt_sparc::address_for_global,
1049         address_for_local): Likewise.
1050         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1051         address_for_local): Likewise.
1052         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1053         address_for_local): Likewise.
1054         * target.h (Target::plt_address_for_global, plt_address_for_local):
1055         Update comment.
1056         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1057         (Output_data_got::Got_entry::write): Nor here.
1058         * output.h: Comment fix.
1059
1060 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1061
1062         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1063         global_offset_table_ value for larget got.
1064         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1065
1066 2012-09-29  Alan Modra  <amodra@gmail.com>
1067
1068         * powerpc.cc (Target_powerpc::iplt_): New output section.
1069         (Target_powerpc::iplt_section, make_iplt_section,
1070         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1071         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1072         Target_powerpc::plt_entry_count): Count iplt entries too.
1073         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1074         reloc section in constructor.  New params.
1075         (Target_powerpc::make_plt_section): Create reloc section here instead.
1076         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1077         functions.
1078         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1079         (Output_data_glink::add_entry, find_entry): New functions to
1080         deal with local syms.
1081         (Glink_sym_ent): Add support for local syms.
1082         (Output_data_glink::do_write): Handle ifunc plt entries.
1083         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1084         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1085         (Target_powerpc::Relocate::relocate): Likewise.
1086         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1087
1088 2012-09-25  Alan Modra  <amodra@gmail.com>
1089
1090         * object.h (Sized_relobj_file::adjust_local_symbol,
1091         do_adjust_local_symbol): New functions.
1092         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1093         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1094         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1095         and irregular opd entry spacing.
1096         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1097         (Global_symbol_visitor_opd): New functor.
1098         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1099         on deleted opd entries.
1100
1101 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1102
1103         * tilegx.cc: New file.
1104         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1105         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1106         * configure.tgt: Add entries for tilegx*.
1107         * configure.ac: Likewise.
1108         * Makefile.in: Rebuild.
1109         * configure: Likewise.
1110         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1111         tilegx.
1112
1113 2012-09-13  Alan Modra  <amodra@gmail.com>
1114
1115         * target-reloc.h (scan_relocs): Call scan.local for relocs
1116         against symbols in discarded sections.  Pass is_discarded
1117         param.
1118         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1119         Add is_discarded param.
1120         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1121         is_discarded to flag opd entry as discarded.  Don't emit dyn
1122         relocs on such entries.
1123         (Target_powerpc::Scan::global): Similarly detect and handle
1124         such opd entries.
1125         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1126         opd_ent_.  Update all uses.
1127         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1128         (Target_powerpc::relocate_section): Zero out discarded opd
1129         entry relocs.
1130
1131 2012-09-12  Ian Lance Taylor  <iant@google.com>
1132
1133         PR gold/14570
1134         * output.cc: Rename Output_data_got template parameter from size
1135         to got_size for all functions.  Compile all variants of
1136         Output_data_got.
1137         (Output_data_got::Got_entry::write): Correct use of size for
1138         symbol value.  Use local_is_tls rather than casting to
1139         Sized_relobj_file.
1140         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1141         (class Sized_relobj_file): Add do_local_is_tls.
1142         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1143
1144 2012-09-11  Alan Modra  <amodra@gmail.com>
1145
1146         PR gold/14566
1147         * layout.cc (Layout::set_segment_offsets): When using
1148         common-page-size alignment, ensure we are on a new max-page-size
1149         page.
1150         * output.cc (Output_segment::set_section_addresses): Use
1151         abi_pagesize, not common_pagesize for relro boundary.
1152         (Output_segment::set_offset): Likewise.
1153
1154 2012-09-11  Alan Modra  <amodra@gmail.com>
1155
1156         * output.h (Output_data_got::add_global_tls, add_local_tls,
1157         add_local_tls_pair): New functions.
1158         (Output_data_got::add_local_pair_with_rel): Remove second
1159         reloc param.  Expand comment.
1160         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1161         use_plt_or_tls_offset_, similarly for constructor param.
1162         (Output_data_got::Got_entry::write): Add got_index param.
1163         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1164         add_local_tls_pair): New functions.
1165         (Output_data_got::Got_entry::write): Handle tls symbols
1166         with use_plt_or_tls_offset_ set specially.
1167         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1168         (Output_data_got::do_write): Replace iterator with index, pass
1169         index to entry write function.
1170         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1171         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1172         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1173         call.
1174         * i386.cc (Target_i386::Scan::local): Likewise.
1175         * sparc.cc (Target_sparc::Scan::local): Likewise.
1176         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1177         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1178         do_tls_offset_for_global): New functions.
1179         (Target_powerpc::Scan::local): Correct TLS relocations and got
1180         entry values.
1181         (Target_powerpc::Scan::global): Don't emit unnecessary
1182         dynamic relocations on TLS GOT entries.
1183
1184 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1185
1186         * config.in: Disable sanity check for kfreebsd.
1187
1188 2012-09-10  Sterling Augustine  <saugustine@google.com>
1189
1190         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1191         (Gdb_index::pubtypes_read): New parameter.
1192         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1193         to calls.
1194         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1195         pubtypes_object_.
1196
1197 2012-09-09  Alan Modra  <amodra@gmail.com>
1198
1199         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1200         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1201         * gc.h (gc_process_relocs): Call target gc_add_reference.
1202         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1203         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1204         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1205         unnecessary cast.
1206         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1207         to cater for when we don't need code offset.  Update use.
1208         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1209         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1210         set_opd_valid): New functions.
1211         (Target_powerpc::do_gc_add_reference): New function.
1212         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1213         stashed refs.
1214         (Target_powerpc::do_gc_mark_symbol): New function.
1215
1216 2012-09-06  Cary Coutant  <ccoutant@google.com>
1217
1218         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1219         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1220         (Dwarf_die::skip_attributes): Likewise.
1221         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1222         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1223         (main): Call it.
1224         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1225
1226 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1227
1228         * testsuite/script_test_3.t: Add .got.plt output section
1229         statement.
1230         * testsuite/script_test_4.t: Likewise.
1231
1232 2012-09-05  Alan Modra  <amodra@gmail.com>
1233
1234         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1235         update all uses and lose "enum" when using type.
1236
1237 2012-09-05  Alan Modra  <amodra@gmail.com>
1238
1239         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1240         * configure: Regenerate.
1241         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1242         (plugin_final_layout.stdout): Likewise.
1243         (memory_test): Set page sizes to 0x1000.
1244         * testsuite/Makefile.in: Regenerate.
1245         * testsuite/discard_locals_test.sh: Add FIXME comment.
1246         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1247         * testsuite/pr14265.t: Add .got output section statement.
1248         * testsuite/script_test_2.t: Likewise.
1249         * testsuite/script_test_3.t: Likewise.
1250         * testsuite/script_test_4.t: Likewise.
1251         * testsuite/script_test_5.t: Likewise.
1252         * testsuite/script_test_6.t: Likewise.
1253         * testsuite/script_test_7.t: Likewise.
1254         * testsuite/script_test_9.t: Likewise.
1255
1256 2012-09-05  Alan Modra  <amodra@gmail.com>
1257
1258         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1259         (Powerpc_relocate_functions::Status): New typedef.
1260         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1261         (Target_powerpc::Scan::local): Handle REL64.
1262         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1263         for REL32 and REL64.
1264         (Target_powerpc::symval_for_branch): New function, extracted from..
1265         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1266         checks.  Report overflow errors.
1267
1268 2012-09-05  Alan Modra  <amodra@gmail.com>
1269
1270         * object.h (Sized_relobj_file::emit_relocs): Delete.
1271         (Sized_relobj_file::emit_relocs_reltype): Delete.
1272         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1273         relocate_relocs for --emit-relocs.
1274         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1275         * output.h: Update comment.
1276         (Output_segment::first_section): New function.
1277         (Output_segment::first_section_load_address): Use first_section.
1278         * output.cc (Output_segment::first_section): New function extracted..
1279         (Output_segment::first_section_load_address): ..from here.  Delete.
1280         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1281         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1282         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1283         adjust call to target.h function.
1284         * i386.cc (Target_i386): Likewise.
1285         * sparc.cc (Target_sparc): Likewise.
1286         * x86_64.cc (Target_x86_64): Likewise.
1287         * powerpc.cc (Target_powerpc): Likewise.
1288         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1289         first tls section has section symbol for optimised local dynamic
1290         output relocs.
1291         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1292         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1293         optimised tls code.
1294         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1295         Rename to relocate_relocs.  Update error message.
1296
1297 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1298
1299         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1300         --just-symbols.
1301
1302 2012-08-31  Alan Modra  <amodra@gmail.com>
1303
1304         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1305         (Powerpc_relobj::toc_base_offset): New stub function.
1306         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1307         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1308         (Target_powerpc::Relocate::enum skip_tls): New.
1309         (Target_powerpc::call_tls_get_addr_): New var.
1310         (Target_powerpc::is_branch_reloc): Move to file scope.
1311         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1312         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1313         New functions.
1314         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1315         (powerpc_info): Correct common_pagesize for ppc64.
1316         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1317         (Powerpc_relocate_functions): Add overflow check enums and functions.
1318         Add non-shift version of rela, rela_ua.  Delete all rel public
1319         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1320         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1321         addr16_ha3, addr14 functions.
1322         (Output_data_got_powerpc::add_constant_pair): New function.
1323         (Output_data_got_powerpc::got_base_offset): Likewise.
1324         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1325         (instruction constants): Sort, add some more.
1326         (Output_data_glink::do_write): Add and use Address typedef.  Use
1327         object->toc_base_offset() stub for 64-bit.
1328         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1329         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1330         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1331         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1332         Always treat .opd relocs as against locally defined symbol.
1333         Correct condition for RELATIVE relocs.
1334         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1335         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1336         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1337         calculations.  Handle TLS relocs, and more.  Add overflow
1338         checking and adjust for Powerpc_relocate_functions changes.
1339         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1340         Reinstate --emit-relocs code with FIXME.
1341
1342 2012-08-30  Alan Modra  <amodra@gmail.com>
1343
1344         * layout.cc (Layout::set_segment_offsets): Set p_align to
1345         abi_pagesize, not common_pagesize.
1346         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1347         to determine whether file header can go in segment.
1348
1349 2012-08-30  Alan Modra  <amodra@gmail.com>
1350
1351         * output.h (Output_reloc::Output_reloc <output section>): Add
1352         is_relative param.  Adjust calls.
1353         (Output_reloc::add_output_section_relative): New functions.
1354         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1355         is_relative.
1356         (Output_reloc::symbol_value): Handle SECTION_CODE.
1357
1358 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1359
1360         * gold.cc (queue_middle_tasks): Call layout again when unique
1361         segments for sections is desired.
1362         * layout.cc (Layout::Layout): Initialize new members.
1363         (Layout::get_output_section_flags): New function.
1364         (Layout::choose_output_section): Call get_output_section_flags.
1365         (Layout::layout): Make output section for mapping to a unique segment.
1366         (Layout::insert_section_segment_map): New function.
1367         (Layout::attach_allocated_section_to_segment): Make unique segment for
1368         output sections marked so.
1369         (Layout::segment_precedes): Check for unique segments when sorting.
1370         * layout.h (Layout::Unique_segment_info): New struct.
1371         (Layout::Section_segment_map): New typedef.
1372         (Layout::insert_section_segment_map): New function.
1373         (Layout::get_output_section_flags): New function.
1374         (Layout::is_unique_segment_for_sections_specified): New function.
1375         (Layout::set_unique_segment_for_sections_specified): New function.
1376         (Layout::unique_segment_for_sections_specified_): New member.
1377         (Layout::section_segment_map_): New member.
1378         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1379         Rename is_gc_pass_one to is_pass_one.
1380         Rename is_gc_pass_two to is_pass_two.
1381         Rename is_gc_or_icf to is_two_pass.
1382         Check for which pass based on whether symbols data is present.
1383         Make it two pass when unique segments for sections is desired.
1384         * output.cc (Output_section::Output_section): Initialize new
1385         members.
1386         * output.h (Output_section::is_unique_segment): New function.
1387         (Output_section::set_is_unique_segment): New function.
1388         (Output_section::is_unique_segment_): New member.
1389         (Output_section::extra_segment_flags): New function.
1390         (Output_section::set_extra_segment_flags): New function.
1391         (Output_section::extra_segment_flags_): New member.
1392         (Output_section::segment_alignment): New function.
1393         (Output_section::set_segment_alignment): New function.
1394         (Output_section::segment_alignment_): New member.
1395         (Output_segment::Output_segment): Initialize is_unique_segment_.
1396         (Output_segment::is_unique_segment): New function.
1397         (Output_segment::set_is_unique_segment): New function.
1398         (Output_segment::is_unique_segment_): New member.
1399         * plugin.cc (allow_unique_segment_for_sections): New function.
1400         (unique_segment_for_sections): New function.
1401         (Plugin::load): Add new functions to transfer vector.
1402         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1403         * Makefile.in: Regenerate.
1404         * testsuite/plugin_final_layout.sh: Check if unique segment
1405         functionality works.
1406         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1407         are available.
1408         (allow_unique_segment_for_sections): New global.
1409         (unique_segment_for_sections): New global.
1410         (claim_file_hook): Call allow_unique_segment_for_sections.
1411         (all_symbols_read_hook): Call unique_segment_for_sections.
1412
1413 2012-08-22  Cary Coutant  <ccoutant@google.com>
1414
1415         * layout.cc (Layout::include_section): Don't assert on GROUP
1416         sections with --emit-relocs.
1417
1418 2012-08-21  Cary Coutant  <ccoutant@google.com>
1419
1420         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1421         if --export-dynamic-symbol names an undef symbol.
1422
1423 2012-08-18  Alan Modra  <amodra@gmail.com>
1424
1425         * powerpc.cc: Formatting and white space.
1426         (Powerpc_relobj): Rename got2_section_ to special_.
1427         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1428         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1429         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1430         (Target_powerpc): Add Address typedef and invalid_address.  Use
1431         throughout.
1432         (Target_powerpc::is_branch_reloc): New function.
1433         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1434         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1435         for dst_mask, value and addend.
1436         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1437         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1438         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1439         uint16_t for 24-bit offset.  Use get_output_section_offset and
1440         check return.
1441         (Target_powerpc::Scan::local): Handle more relocs.
1442         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1443         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1444         Plug in toc restoring insn after plt calls.  Translate branches
1445         to function descriptor symbols to corresponding entry point.
1446         (Target_powerpc::relocate_for_relocatable): Check return from
1447         get_output_section_offset.
1448         * symtab.h: Comment typo.
1449
1450 2012-08-14  Ian Lance Taylor  <iant@google.com>
1451
1452         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1453         unsupported_relocal_local to call unsupported_reloc_global.
1454
1455 2012-08-14  Nick Clifton  <nickc@redhat.com>
1456
1457         PR ld/14265
1458         * script-sections.cc (Sections_element::output_section_name): Add
1459         keep return parameter.
1460         (Output_section_element::match_name): Add keep return parameter.
1461         Return the value of the keep_ member.
1462         * script-sections.h (class Output_section): Update
1463         output_section_name prototype.
1464         * layout.cc (Layout::keep_input_section): New public member
1465         function.
1466         (Layout::choose_output_section): Pass keep parameter to
1467         output_section_name.
1468         * layout.h (class Layout): Add keep_input_section.
1469         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1470         sections.
1471         * testsuite/Makefile.am: Add a test.
1472         * testsuite/Makefile.in: Regenerate.
1473         * testsuite/pr14265.c: Source file for the test.
1474         * testsuite/pr14265.t: Linker script for the test.
1475         * testsuite/pr14265.sh: Shell script for the test.
1476
1477 2012-08-14  Alan Modra  <amodra@gmail.com>
1478
1479         * target.h (Target::output_section_name): New function.
1480         (Target::do_output_section_name): New function.
1481         * layout.cc (Layout::choose_output_section): Call the above.
1482         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1483
1484 2012-08-14  Alan Modra  <amodra@gmail.com>
1485
1486         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1487         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1488         for replace_constant call.
1489         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1490         (Output_data_glink::do_print_to_mapfile): New function.
1491         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1492         (Target_powerpc::Relocate::relocate): Likewise.
1493
1494 2012-08-14  Alan Modra  <amodra@gmail.com>
1495
1496         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1497         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1498         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1499         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1500         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1501         here.
1502         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1503         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1504         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1505         here.
1506         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1507         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1508
1509 2012-08-12  Alan Modra  <amodra@gmail.com>
1510
1511         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1512         (glink insn constants): Use uint32_t.
1513         (Output_data_glink::add_entry): Use insert, not [] operator.
1514
1515 2012-08-11  Alan Modra  <amodra@gmail.com>
1516
1517         * object.h (Sized_relobj_file::find_shdr): New function.
1518         (Sized_relobj_file::find_special_sections): New function.
1519         * object.cc (Sized_relobj_file::find_shdr): New function.
1520         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1521         (Sized_relobj_file::find_special_sections): New function, split out..
1522         (Sized_relobj_file::do_read_symbols): ..from here.
1523         * output.h (Output_data_got::replace_constant): New function.
1524         (Output_data_got::num_entries): New function.
1525         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1526         (Output_data_got::got_offset): Protected rather than private.
1527         (Output_data_got::replace_got_entry): New function.
1528         * output.cc (Output_data_got::replace_got_entry): New function.
1529         * powerpc.cc (class Powerpc_relobj): New.
1530         (class Powerpc_relocate_functions): Delete all psymval variants or
1531         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1532         Implement _ha functions using corresponding _hi function.
1533         (Powerpc_relobj::find_special_sections): New function.
1534         (Target_powerpc::do_make_elf_object): New function.
1535         (class Output_data_got_powerpc): New.
1536         (class Output_data_glink): New.
1537         (class Powerpc_scan_relocatable_reloc): New.
1538         Many more changes througout file.
1539
1540 2012-08-09  Nick Clifton  <nickc@redhat.com>
1541
1542         * po/vi.po: Updated Vietnamese translation.
1543
1544 2012-08-07  Ian Lance Taylor  <iant@google.com>
1545
1546         * layout.cc (Layout::add_target_dynamic_tags): If
1547         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1548         plt_rel.
1549
1550 2012-07-30  Nick Clifton  <nickc@redhat.com>
1551
1552         * po/gold.pot: Updated template.
1553         * po/es.po: Updated Spanish translation.
1554
1555 2012-07-18  Cary Coutant  <ccoutant@google.com>
1556
1557         PR gold/14344
1558         * configure.ac: Add check for -gpubnames support.
1559         * configure: Regenerate.
1560         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1561         support; force -gno-pubnames.
1562         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1563         support.
1564         (gdb_index_test_4): New test.
1565         * testsuite/Makefile.in: Regenerate.
1566         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1567         * testsuite/gdb_index_test_2.sh: Likewise.
1568         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1569         * testsuite/gdb_index_test_4.sh: New script.
1570         * testsuite/gdb_index_test_comm.sh: New script with common code;
1571         don't look for space after colon.
1572
1573 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1574
1575         * gold.cc (queue_middle_tasks): Update function order only after
1576         deferred objects due to plugins are processed.
1577
1578 2012-07-11  Ian Lance Taylor  <iant@google.com>
1579
1580         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1581         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1582         (Target_arm::scan_reloc_for_stub): Likewise.
1583         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1584         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1585         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1586         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1587         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1588
1589 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1590             Ian Lance Taylor  <iant@google.com>
1591
1592         PR gold/14309
1593         * configure.ac: Test whether std::tr1::hash<off_t> works.
1594         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1595         needed.
1596         * output.h (class Output_fill): Add virtual destructor.
1597         * configure, config.in: Rebuild.
1598
1599 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1600
1601         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1602
1603 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1604
1605         * plugin.cc (Plugin::load): Handle position independent executables.
1606
1607 2012-06-06  Cary Coutant  <ccoutant@google.com>
1608
1609         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1610         add .debug_macro.
1611         (lines_only_debug_sections): Likewise.
1612         (gdb_fast_lookup_sections): New static array.
1613         (is_gdb_debug_section): Rename formal parameter.
1614         (is_lines_only_debug_section): Likewise.
1615         (is_gdb_fast_lookup_section): New function.
1616         (Layout::include_section): Check for ".zdebug_" prefix; pass
1617         section name suffix to is_gdb_debug_section, et al.; check for
1618         fast-lookup sections when building .gdb_index.
1619         * options.h (--strip-debug-gdb): Update GDB version number.
1620
1621 2012-06-06  Cary Coutant  <ccoutant@google.com>
1622
1623         * configure.ac: Add check for fallocate.
1624         * configure: Regenerate.
1625         * config.in: Regenerate.
1626
1627         * options.h (class General_options): Add --mmap-output-file and
1628         --posix-fallocate options.
1629         * output.cc: (posix_fallocate): Remove; replace with...
1630         (gold_fallocate): New function.
1631         (Output_file::map_no_anonymous): Call gold_fallocate.
1632         (Output_file::map): Check --mmap-output-file option.
1633
1634 2012-06-05  Jing Yu  <jingyu@google.com>
1635
1636         * gold.h (textdomain): Add do {} to empty while(0).
1637         (bindtextdomain): Likewise.
1638
1639 2012-06-04  Cary Coutant  <ccoutant@google.com>
1640
1641         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1642         has_dynsym_index.
1643
1644 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1645
1646         * symtab.cc (Symbol_table::define_special_symbol):
1647         Initialize *poldsym to prevent uninitialized variable errors.
1648
1649 2012-05-23  Cary Coutant  <ccoutant@google.com>
1650
1651         * layout.cc (Layout::section_name_mapping): Add rules to handle
1652         exact match on .data.rel.ro.local or .data.rel.ro.
1653         (Layout::output_section_name): Check for exact matches.
1654
1655 2012-05-23  Cary Coutant  <ccoutant@google.com>
1656
1657         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1658         more carefully.
1659
1660 2012-05-22  Cary Coutant  <ccoutant@google.com>
1661
1662         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1663         object before exporting symbol.
1664
1665 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1666
1667         * testsuite/tls_test.cc: Include "config.h" first.
1668         * testsuite/tls_test_c.c: Likewise.
1669
1670 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1671             Nick Clifton  <nickc@redhat.com>
1672
1673         PR 14072
1674         * configure.in: Add check that sysdep.h has been included before
1675         any system header files.
1676         * configure: Regenerate.
1677         * config.in: Regenerate.
1678
1679 2012-05-14  Cary Coutant  <ccoutant@google.com>
1680
1681         * layout.cc (Layout::make_output_section): Mark .tdata section
1682         as RELRO.
1683         * testsuite/relro_test.cc: Add a TLS variable.
1684
1685 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1686
1687         PR gold/14091
1688         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1689         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1690         R_X86_64_64.
1691
1692 2012-05-08  Cary Coutant  <ccoutant@google.com>
1693
1694         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1695         (lines_only_debug_sections): Likewise.
1696
1697 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1698
1699         * nacl.cc: New file.
1700         * nacl.h: New file.
1701         * Makefile.am (CCFILES, HFILES): Add them.
1702         * Makefile.in: Regenerate.
1703         * i386.cc (Output_data_plt_i386_nacl): New class.
1704         (Output_data_plt_i386_nacl_exec): New class.
1705         (Output_data_plt_i386_nacl_dyn): New class.
1706         (Target_i386_nacl): New class.
1707         (Target_selector_i386_nacl): New class.
1708         (target_selector_i386): Use it instead of Target_selector_i386.
1709         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1710         (Target_x86_64_nacl): New class.
1711         (Target_selector_x86_64_nacl): New class.
1712         (target_selector_x86_64, target_selector_x32): Use it instead of
1713         Target_selector_x86_64.
1714         * arm.cc (Output_data_plt_arm_nacl): New class.
1715         (Target_arm_nacl): New class.
1716         (Target_selector_arm_nacl): New class.
1717         (target_selector_arm, target_selector_armbe): Use it instead of
1718         Target_selector_arm.
1719
1720         * target-select.cc (select_target): Take new Input_file* and off_t
1721         arguments, pass them on to recognize method of selector.
1722         * object.cc (make_elf_sized_object): Update caller.
1723         * parameters.cc (parameters_force_valid_target): Likewise.
1724         * incremental.cc (make_sized_incremental_binary): Likewise.
1725         * target-select.h: Update decl.
1726         (Target_selector::recognize): Take new Input_file* argument,
1727         pass it on to do_recognize.
1728         (Target_selector::do_recognize): Take new Input_file* argument.
1729         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1730         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1731         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1732         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1733
1734         * target.h (Target::Target_info): New members isolate_execinstr
1735         and rosegment_gap.
1736         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1737         * arm.cc (Target_arm::arm_info): Update initializer.
1738         * i386.cc (Target_i386::i386_info): Likewise.
1739         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1740         * sparc.cc (Target_sparc::sparc_info): Likewise.
1741         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1742         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1743         * layout.cc (Layout::attach_allocated_section_to_segment):
1744         Take new const Target* argument.  If target->isolate_execinstr(), act
1745         like --rosegment.
1746         (Layout::find_first_load_seg): Take new const Target* argument;
1747         if target->isolate_execinstr(), reject PF_X segments.
1748         (Layout::relaxation_loop_body): Update caller.
1749         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1750         reset file offset to zero when we hit LOAD_SEG, and then do a second
1751         loop over the segments before LOAD_SEG to reassign offsets after
1752         addresses have been determined.  Handle target->rosegment_gap().
1753         (Layout::attach_section_to_segment): Take new const Target* argument;
1754         pass it to attach_allocated_section_to_segment.
1755         (Layout::make_output_section): Update caller.
1756         (Layout::attach_sections_to_segments): Take new const Target* argument;
1757         pass it to attach_section_to_segment.
1758         * gold.cc (queue_middle_tasks): Update caller.
1759         * layout.h (Layout): Update method decls with new arguments.
1760
1761         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1762         Target_info pointer to use.
1763         (Target_arm::do_make_data_plt): New virtual method.
1764         (Target_arm::make_data_plt): New method that calls it.
1765         (Target_arm::make_plt_entry): Use it.
1766         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1767         for the section alignment.
1768         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1769         method.
1770         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1771         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1772         method.
1773         (Output_data_plt_arm::get_plt_entry_size): Call it.
1774         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1775         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1776         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1777         method.
1778         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1779         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1780         method instead of sizeof(plt_entry).
1781         (Output_data_plt_arm::add_entry): Likewise.
1782         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1783         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1784         than static method.
1785         (Target_arm::plt_entry_size): Likewise.
1786         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1787         Move to ...
1788         (Output_data_plt_arm_standard): ... here, new class.
1789         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1790         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1791         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1792
1793         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1794         Take additional argument for the PLT entry size.
1795         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1796         Use get_plt_entry_size method rather than plt_entry_size variable.
1797         (Output_data_plt_x86_64::reserve_slot): Likewise.
1798         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1799         (Output_data_plt_x86_64::add_entry): Likewise.
1800         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1801         (Output_data_plt_x86_64::address_for_global): Likewise.
1802         (Output_data_plt_x86_64::address_for_local): Likewise.
1803         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1804         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1805         Make method non-static.
1806         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1807         method.
1808         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1809         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1810         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1811         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1812         virtual method.
1813         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1814         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1815         virtual method.
1816         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1817         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1818         virtual method.
1819         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1820         (Output_data_plt_x86_64::plt_entry_size)
1821         (Output_data_plt_x86_64::first_plt_entry)
1822         (Output_data_plt_x86_64::plt_entry)
1823         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1824         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1825         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1826         (Output_data_plt_x86_64_standard): ... here, new class.
1827         (Target_x86_64::Target_x86_64): Take optional argument for the
1828         Target_info pointer to use.
1829         (Target_x86_64::do_make_data_plt): New virtual method.
1830         (Target_x86_64::make_data_plt): New method to call it.
1831         (Target_x86_64::init_got_plt_for_update): Use that.
1832         Call this->plt_->add_eh_frame method here.
1833         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1834         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1835         rather than static method.
1836         (Target_x86_64::plt_entry_size): Likewise.
1837         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1838         rather than plt_entry_size variable.  Move guts of PLT filling to...
1839         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1840         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1841         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1842
1843         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1844         additional argument for the section alignment.
1845         Don't do add_eh_frame_for_plt here.
1846         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1847         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1848         variable.
1849         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1850         method.
1851         (Output_data_plt_i386::get_plt_entry_size): Call it.
1852         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1853         (Output_data_plt_i386::add_eh_frame): New method to call it.
1854         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1855         method.
1856         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1857         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1858         method.
1859         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1860         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1861         method instead of plt_entry_size.
1862         (Output_data_plt_i386::plt_entry_size)
1863         (Output_data_plt_i386::plt_eh_frame_fde_size)
1864         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1865         (Output_data_plt_i386_standard): ... here, new class.
1866         (Output_data_plt_i386_exec): New class.
1867         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1868         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1869         (Output_data_plt_i386::exec_plt_entry): Move to ...
1870         (Output_data_plt_i386_exec::plt_entry): ... here.
1871         (Output_data_plt_i386_dyn): New class.
1872         (Output_data_plt_i386::first_plt_entry): Move to ...
1873         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1874         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1875         (Output_data_plt_i386_dyn::plt_entry): ... here.
1876         (Target_i386::Target_i386): Take optional argument for the Target_info
1877         pointer to use.
1878         (Target_i386::do_make_data_plt): New virtual method.
1879         (Target_i386::make_data_plt): New method to call it.
1880         (Target_i386::make_plt_section): Use that.
1881         Call this->plt_->add_eh_frame method here.
1882         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1883         rather than plt_entry_size variable.
1884         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1885         (Output_data_plt_i386::address_for_local): Likewise.
1886         (Output_data_plt_i386::do_write): Likewise.
1887         Move guts of PLT filling to...
1888         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1889         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1890         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1891         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1892
1893 2012-05-01  Cary Coutant  <ccoutant@google.com>
1894
1895         * dwarf_reader.cc (Dwarf_die::read_attributes)
1896         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1897         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1898         * reduced_debug_output.cc
1899         (Output_reduced_debug_info_section::get_die_end): Remove
1900         DW_FORM_GNU_ref_index.  Add default case.
1901
1902 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1903
1904         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1905         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1906         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1907         DW_AT_high_pc as offset from DW_AT_low_pc.
1908
1909         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1910         * testsuite/Makefile.in: Regenerate.
1911         * testsuite/gdb_index_test_3.c: New test source file.
1912         * testsuite/gdb_index_test_3.sh: New test source file.
1913
1914 2012-04-25  Ian Lance Taylor  <iant@google.com>
1915
1916         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1917         pointer.
1918         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1919         as a class, not a struct.
1920         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1921         (Target_arm::apply_cortex_a8_workaround): Likewise.
1922         * gc.h: Declare Reloc_types as a struct, not a class.
1923         * object.h: Declare Symbols_data as a struct.
1924         * reloc.h: Declare Read_relocs_data as a struct.
1925         * target.h: Declare Relocate_info as a struct.
1926
1927 2012-04-24  David S. Miller  <davem@davemloft.net>
1928
1929         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1930         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1931         and R_SPARC_WPLT30.
1932
1933 2012-04-24  Cary Coutant  <ccoutant@google.com>
1934
1935         * incremental-dump.cc (find_input_containing_global): Replace
1936         magic number with symbolic constant.
1937         (dump_incremental_inputs): Update version number.
1938         * incremental.cc (Output_section_incremental_inputs): Update version
1939         number; import symbolic constants from Incremental_inputs_reader.
1940         (Incremental_inputs::create_data_sections): Align relocations
1941         section correctly for 64-bit targets.
1942         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1943         constants; add padding.
1944         (Output_section_incremental_inputs::write_header): Add assert for
1945         header_size.
1946         (Output_section_incremental_inputs::write_input_files): Add assert
1947         for input_entry_size.
1948         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1949         add assert for object_info_size, input_section_entry_size,
1950         global_sym_entry_size.
1951         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1952         for data structure sizes; use them.
1953         (Incremental_input_entry_reader): Import symbolic constants from
1954         Incremental_inputs_reader; use them.
1955
1956 2012-04-23  David S. Miller  <davem@davemloft.net>
1957
1958         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1959         and elf_flags_set_.
1960         (Target_sparc::Target_sparc): Initialize new fields.
1961         (Target_sparc::do_make_elf_object): New function.
1962         (Target_sparc::do_adjust_elf_header): New function.
1963
1964 2012-04-23  Cary Coutant  <ccoutant@google.com>
1965
1966         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1967         CU range table of gdb index.
1968
1969 2012-04-20  David S. Miller  <davem@davemloft.net>
1970
1971         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1972         instead of false.
1973
1974 2012-04-16  David S. Miller  <davem@davemloft.net>
1975
1976         * sparc.cc (Target_sparc::got_address): New function.
1977         (Sparc_relocate_functions::gdop_hix22): New function.
1978         (Sparc_relocate_functions::gdop_lox10): New function.
1979         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1980         relocs.
1981         (Target_sparc::Scan::local): Likewise if the global symbol is not
1982         preemptible and is not IFUNC.
1983         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1984         transformations for local and non-preemptible non-IFUNC global
1985         symbols.
1986
1987         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1988         writing out 64-bit part of ranges.
1989
1990         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1991         -fpic and -fpie respectively.
1992         * Makefile.in: Regenerate.
1993
1994         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1995         (Target_sparc::Target_sparc): Initialize new field.
1996         (Target_sparc::do_plt_section_for_global): New function.
1997         (Target_sparc::do_plt_section_for_local): New function.
1998         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1999         (Target_sparc::make_plt_section): New function, broken out of
2000         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2001         (Target_sparc::make_plt_entry): Call make_plt_section.
2002         (Target_sparc::make_local_ifunc_plt_entry): New function.
2003         (Target_sparc::rela_ifunc_section): New function.
2004         (Target_sparc::plt_section): Remove const.
2005         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2006         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2007         and ifunc_count_ fields.
2008         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2009         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2010         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2011         (Output_data_plt_sparc::rela_ifunc): New function.
2012         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2013         (Output_data_plt_sparc::has_ifunc_section): New function.
2014         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2015         (Output_data_plt_sparc::address_for_global): New function.
2016         (Output_data_plt_sparc::address_for_local): New function.
2017         (Output_data_plt_sparc::plt_index_to_offset): New function.
2018         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2019         and entry_count.
2020         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2021         entry_count.
2022         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2023         R_SPARC_JMP_IREL to switch.
2024         (Target_sparc::Scan::check_non_pic): Likewise.
2025         (Target_sparc::Scan::local): Handle IFUNC symbols.
2026         (Target_sparc::Scan::local): Likewise.
2027         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2028         and plt_address_for_local.
2029         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2030         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2031
2032         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2033         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2034         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2035         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2036         global relocs too.
2037         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2038         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2039         calls.
2040         * sparc.cc (Target_sparc::Scan::global): Likewise.
2041         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2042
2043 2012-04-16  Cary Coutant  <ccoutant@google.com>
2044
2045         * archive.cc (Library_base::should_include_member): Check for
2046         --export-dynamic-symbol.
2047         * options.h (class General_options): Add --export-dynamic-symbol.
2048         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2049         --export-dynamic-symbol.
2050         (Symbol_table::gc_mark_undef_symbols): Likewise.
2051         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2052
2053 2012-04-12  David S. Miller  <davem@davemloft.net>
2054
2055         * sparc.cc (Reloc::wdisp10): New relocation method.
2056         (Reloc::h34): Likewise.
2057         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2058         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2059         R_SPARC_WDISP10.
2060         (Target_sparc::Scan::local): Likewise.
2061         (Target_sparc::Scan::global): Likewise.
2062         (Target_sparc::Relocate::relocate): Likewise.
2063
2064 2012-04-09  Cary Coutant  <ccoutant@google.com>
2065
2066         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2067         low_pc == 0.
2068
2069 2012-04-06  Ian Lance Taylor  <iant@google.com>
2070
2071         * timer.cc: #include <unistd.h>.
2072
2073 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2074
2075         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2076         * config.in: Regenerate.
2077         * configure: Regenerate.
2078
2079 2012-04-05  Nick Clifton  <nickc@redhat.com>
2080
2081         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2082         (AM_LC_MESSAGES): Add.
2083         * aclocal.m4: Regenerate.
2084         * config.in: Regenerate.
2085         * configure: Regenerate.
2086
2087 2012-03-21  Cary Coutant  <ccoutant@google.com>
2088
2089         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2090         * Makefile.in: Regenerate.
2091         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2092         (Sized_elf_reloc_mapper::symbol_section): New function.
2093         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2094         (make_elf_reloc_mapper): New function.
2095         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2096         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2097         (Dwarf_abbrev_table::do_get_abbrev): New function.
2098         (Dwarf_ranges_table::read_ranges_table): New function.
2099         (Dwarf_ranges_table::read_range_list): New function.
2100         (Dwarf_pubnames_table::read_section): New function.
2101         (Dwarf_pubnames_table::read_header): New function.
2102         (Dwarf_pubnames_table::next_name): New function.
2103         (Dwarf_die::Dwarf_die): New function.
2104         (Dwarf_die::read_attributes): New function.
2105         (Dwarf_die::skip_attributes): New function.
2106         (Dwarf_die::set_name): New function.
2107         (Dwarf_die::set_linkage_name): New function.
2108         (Dwarf_die::attribute): New function.
2109         (Dwarf_die::string_attribute): New function.
2110         (Dwarf_die::int_attribute): New function.
2111         (Dwarf_die::uint_attribute): New function.
2112         (Dwarf_die::ref_attribute): New function.
2113         (Dwarf_die::child_offset): New function.
2114         (Dwarf_die::sibling_offset): New function.
2115         (Dwarf_info_reader::check_buffer): New function.
2116         (Dwarf_info_reader::parse): New function.
2117         (Dwarf_info_reader::do_parse): New function.
2118         (Dwarf_info_reader::do_read_string_table): New function.
2119         (Dwarf_info_reader::lookup_reloc): New function.
2120         (Dwarf_info_reader::get_string): New function.
2121         (Dwarf_info_reader::visit_compilation_unit): New function.
2122         (Dwarf_info_reader::visit_type_unit): New function.
2123         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2124         Sized_elf_reloc_mapper.
2125         (Sized_dwarf_line_info::symbol_section): Remove function.
2126         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2127         (Sized_dwarf_line_info::read_line_mappings): Remove object
2128         parameter, adjust callers.
2129         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2130         * dwarf_reader.h: Include <sys/types.h>.
2131         (class Track_relocs): Remove forward declaration.
2132         (class Elf_reloc_mapper): New class.
2133         (class Sized_elf_reloc_mapper): New class.
2134         (class Dwarf_abbrev_table): New class.
2135         (class Dwarf_range_list): New class.
2136         (class Dwarf_ranges_table): New class.
2137         (class Dwarf_pubnames_table): New class.
2138         (class Dwarf_die): New class.
2139         (class Dwarf_info_reader): New class.
2140         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2141         (Sized_dwarf_line_info::symbol_section): Remove member function.
2142         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2143         base class.
2144         * gdb-index.cc: New source file.
2145         * gdb-index.h: New source file.
2146         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2147         and .debug_types sections, call Layout::add_to_gdb_index.
2148         (Sized_relobj_incr::do_section_name): Implement.
2149         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2150         return type; Implement.
2151         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2152         return type.
2153         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2154         parameter list and return type.
2155         (Sized_incr_dynobj::do_section_contents): Likewise.
2156         * layout.cc: Include gdb-index.h.
2157         (Layout::Layout): Initialize gdb_index_data_.
2158         (Layout::init_fixed_output_section): Check for .gdb_index section.
2159         (Layout::add_to_gdb_index): New function. Instantiate.
2160         * layout.h: Add forward declaration for class Gdb_index.
2161         (Layout::add_to_gdb_index): New member function.
2162         (Layout::gdb_index_data_): New data member.
2163         * main.cc: Include gdb-index.h.
2164         (main): Print statistics for gdb index.
2165         * object.cc (Object::section_contents): Move code into
2166         do_section_contents.
2167         (need_decompressed_section): Check for sections needed when building
2168         gdb index.
2169         (build_compressed_section_map): Likewise.
2170         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2171         gdb index.
2172         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2173         sections; call Layout::add_to_gdb_index.
2174         (Sized_relobj_file::do_decompressed_section_contents): Call
2175         do_section_contents directly.
2176         * object.h (Object::do_section_contents): Adjust parameter list and
2177         return type.
2178         (Object::do_decompressed_section_contents): Call do_section_contents
2179         directly.
2180         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2181         return type.
2182         * options.h (class General_options): Add --gdb-index option.
2183         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2184         list and return type.
2185         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2186         * reloc.h (Track_relocs::checkpoint): New function.
2187         (Track_relocs::reset): New function.
2188
2189         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2190         New test cases.
2191         * testsuite/Makefile.in: Regenerate.
2192         * testsuite/gdb_index_test.cc: New test source file.
2193         * testsuite/gdb_index_test_1.sh: New test source file.
2194         * testsuite/gdb_index_test_2.sh: New test source file.
2195
2196 2012-03-19  Doug Kwan  <dougkwan@google.com>
2197
2198         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2199         (Target_arm::do_finalize_sections): Remove code which defines
2200         __exidx_start and __exidx_end.  Make symbol table parameter
2201         anonymous as it is not used.
2202         * gold.cc (queue_middle_tasks): Call target hook to define any
2203         target-specific symbols.
2204         * target.h (Target::define_standard_symbols): New method.
2205         (Target::do_define_standard_symbols): Same.
2206         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2207         * testsuite/Makefile.in: Regenerate.
2208         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2209         and __exidx_end.
2210         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2211         relocations are generated for __exidx_start and __exidx_end.
2212
2213 2012-03-16  Doug Kwan  <dougkwan@google.com>
2214
2215         * testsuite/Makefile.am: Disable test initpri3b.
2216         * testsuite/Makefile.in: Regenerate.
2217
2218 2012-03-15  Doug Kwan  <dougkwan@google.com>
2219
2220         * arm.cc (Target_arm::got_section): Make .got section read-only
2221         if -z now is given.
2222
2223 2012-03-15  Ian Lance Taylor  <iant@google.com>
2224
2225         PR gold/13850
2226         * layout.cc (Layout::make_output_section): Correctly mark
2227         SHT_INIT_ARRAY, et. al., as relro.
2228
2229 2012-03-14  Doug Kwan  <dougkwan@google.com>
2230
2231         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2232         dynamic relocations for protected symbols in shared objects.
2233
2234 2012-03-13  Ian Lance Taylor  <iant@google.com>
2235
2236         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2237         keep the larger alignment.
2238
2239 2012-03-12  Cary Coutant  <ccoutant@google.com>
2240
2241         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2242         handling of DW_LNE_define_file.
2243
2244 2012-03-12  Cary Coutant  <ccoutant@google.com>
2245
2246         * reduced_debug_output.cc
2247         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2248         codes to switch.
2249
2250 2012-02-29  Cary Coutant  <ccoutant@google.com>
2251
2252         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2253
2254 2012-02-29  Cary Coutant  <ccoutant@google.com>
2255
2256         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2257         Call Object::decompressed_section_contents.
2258         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2259         New dtor.
2260         (Sized_dwarf_line_info::buffer_start_): New data member.
2261         * merge.cc (Output_merge_data::do_add_input_section): Call
2262         Object::decompressed_section_contents.
2263         (Output_merge_string::do_add_input_section): Likewise.
2264         * object.cc (need_decompressed_section): New function.
2265         (build_compressed_section_map): Decompress sections needed later.
2266         (Sized_relobj_file::do_decompressed_section_contents): New function.
2267         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2268         * object.h (Object::decompressed_section_contents): New function.
2269         (Object::discard_decompressed_sections): New function.
2270         (Object::do_decompressed_section_contents): New function.
2271         (Object::do_discard_decompressed_sections): New function.
2272         (Compressed_section_info): New type.
2273         (Compressed_section_map): Include decompressed section contents.
2274         (Sized_relobj_file::do_decompressed_section_contents): New function.
2275         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2276
2277 2012-02-16  Cary Coutant  <ccoutant@google.com>
2278
2279         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2280         * testsuite/Makefile.in: Regenerate.
2281
2282 2012-02-14  Cary Coutant  <ccoutant@google.com>
2283
2284         * options.cc (General_options::finalize): Disallow -pie and -static.
2285
2286 2012-02-03  Doug Kwan  <dougkwan@google.com>
2287
2288         * arm.cc (Arm_relocate_functions::abs8,
2289         Arm_relocate_functions::abs16): Use
2290         Bits::has_signed_unsigned_overflow32.
2291         (Arm_relocate_functions::thm_abs8): Correct range of
2292         overflow check.
2293         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2294         in assertions.
2295
2296 2012-02-02  Doug Kwan  <dougkwan@google.com>
2297
2298         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2299         position independent outputs, not just shared objects.
2300
2301 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2302
2303         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2304         * configure: Regenerated.
2305
2306 2012-01-27  Ian Lance Taylor  <iant@google.com>
2307
2308         * reloc.h (Bits): New class with static functions, copied from
2309         namespace utils in arm.cc.
2310         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2311         instead.
2312
2313 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2314
2315         * incremental.cc (write_info_blocks): Correct relocation offset.
2316
2317 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2318
2319         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2320         (Relocate::tls_gd_to_le): Likewise.
2321
2322 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2323
2324         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2325
2326 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2327
2328         * configure.ac: Check if -mcmodel=medium works.
2329         * configure: Regenerated.
2330
2331 2012-01-24  Cary Coutant  <ccoutant@google.com>
2332
2333         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2334         definition and ...
2335         (read_unsigned_LEB_128_x): ... this new function.
2336         (read_signed_LEB_128): Replaced with inline definition and ...
2337         (read_signed_LEB_128_x): ... this new function.
2338         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2339         (read_unsigned_LEB_128): Add inline definition.
2340         (read_signed_LEB_128_x): New function.
2341         (read_signed_LEB_128): Add inline definition.
2342         * testsuite/Makefile.am (leb128_unittest): New unit test.
2343         * testsuite/Makefile.in: Regenerate.
2344         * testsuite/leb128_unittest.cc: New unit test.
2345
2346 2012-01-23  Ian Lance Taylor  <iant@google.com>
2347
2348         PR gold/13617
2349         * i386.cc (Target_i386::do_code_fill): When using a jmp
2350         instruction, pad with nop instructions.
2351         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2352
2353 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2354
2355         * x86_64.cc (gc_process_relocs): Add typename on types used in
2356         template.
2357         (scan_relocs): Likewise.
2358         (relocate_section): Likewise.
2359         (apply_relocation): Likewise.
2360
2361 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2362
2363         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2364         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2365         under x32.
2366
2367 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2368
2369         * x86_64.cc: Initial support for x32.
2370
2371 2012-01-03  Cary Coutant  <ccoutant@google.com>
2372
2373         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2374         Use abstract base class for GOT.
2375         * gold/output.h (class Output_data_got_base): New abstract base class.
2376         (class Output_data_got): Derive from new base class, adjust ctors.
2377         (Output_data_got::reserve_slot): Make virtual; rename to
2378         do_reserve_slot; Adjust callers.
2379         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2380         pointer to abstract base class.
2381         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2382
2383 2011-12-18  Ian Lance Taylor  <iant@google.com>
2384
2385         * object.h (Relobj::local_symbol_value): New function.
2386         (Relobj::local_plt_offset): New function.
2387         (Relobj::local_has_got_offset): New function.
2388         (Relobj::local_got_offset): New function.
2389         (Relobj::set_local_got_offset): New function.
2390         (Relobj::do_local_symbol_value): New pure virtual function.
2391         (Relobj::do_local_plt_offset): Likewise.
2392         (Relobj::do_local_has_got_offset): Likewise.
2393         (Relobj::do_local_got_offset): Likewise.
2394         (Relobj::do_set_local_got_offset): Likewise.
2395         (Sized_relobj::do_local_has_got_offset): Rename from
2396         local_has_got_offset.
2397         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2398         (Sized_relobj::do_set_local_got_offset): Rename from
2399         set_local_got_offset.
2400         (Sized_relobj_file::do_local_plt_offset): Rename from
2401         local_plt_offset.
2402         (Sized_relobj_file::do_local_symbol_value): New function.
2403         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2404         local_plt_offset.
2405         * output.cc (Output_data_got::Got_entry::write): Change object to
2406         Relobj.  Use local_symbol_value.
2407         (Output_data_got::add_global_with_rel): Change rel_dyn to
2408         Output_data_reloc_generic*.  Use add_global_generic.
2409         (Output_data_got::add_global_with_rela): Remove.  Change all
2410         callers to use add_global_with_rel.
2411         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2412         Output_data_reloc_generic*.  Use add_global_generic.
2413         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2414         callers to use add_global_pair_with_rel.
2415         (Output_data_got::add_local): Change object to Relobj*.
2416         (Output_data_got::add_local_plt): Likewise.
2417         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2418         change rel_dyn to Output_data_reloc_generic*.  Use
2419         add_local_generic.
2420         (Output_data_got::add_local_with_rela): Remove.  Change all
2421         callers to use all_local_with_rel.
2422         (Output_data_got::add_local_pair_with_rel): Change object to
2423         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2424         add_output_section_generic.
2425         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2426         callers to use add_local_pair_with_rel.
2427         (Output_data_got::reserve_local): Change object to Relobj*.
2428         * output.h: (class Output_data_reloc_generic): Add pure virtual
2429         declarations for add_global_generic, add_local_generic,
2430         add_output_section_generic.
2431         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2432         functions for Output_data_reloc_generic.  Update declarations for
2433         changes listed in output.cc.
2434         (class Output_data_got): Change template parameter to got_size.
2435         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2436         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2437         function.
2438         (Sized_relobj_incr::do_local_plt_offset): New function.
2439         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2440         add_global_generic.
2441
2442 2011-12-17  Cary Coutant  <ccoutant@google.com>
2443
2444         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2445         * resolve.cc (Symbol_table::resolve): Likewise.
2446         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2447         arrays.
2448         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2449
2450 2011-12-16  Ian Lance Taylor  <iant@google.com>
2451
2452         * output.h (Output_data_reloc_generic::add): Only call
2453         add_dynamic_reloc if this is a dynamic reloc section.
2454
2455 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2456
2457         PR gold/13505
2458         * target-reloc.h (apply_relocation): Replace <64, false> with
2459         <size, big_endian>.
2460
2461 2011-11-25  Nick Clifton  <nickc@redhat.com>
2462
2463         * po/it.po: New Italian translation.
2464
2465 2011-11-17  Sterling Augustine  <saugustine@google.com>
2466
2467         * script.cc (script_include_directive): Implement.
2468         (read_script_file): New local variables name and search_path. Update
2469         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2470         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2471         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2472
2473 2011-11-11  Sterling Augustine  <saugustine@google.com>
2474
2475         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2476         (file_or_sections_cmd): Likewise.
2477
2478 2011-11-11  Doug Kwan  <dougkwan@google.com>
2479
2480         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2481         if --just-symbols is given.
2482
2483 2011-11-10  Doug Kwan  <dougkwan@google.com>
2484
2485         PR gold/13362
2486         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2487         when processing data relocs.
2488         * reloc.h (Relocate_functions::rel_unaligned): New method.
2489         (Relocate_functions::pcrel_unaligned): Ditto.
2490         (Relocate_functions::rel32_unaligned): Ditto.
2491         (Relocate_functions::pcrel32_unaligned): Ditto.
2492
2493 2011-11-09  Doug Kwan  <dougkwan@google.com>
2494
2495         PR gold/13362
2496         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2497         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2498         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2499         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2500         (Relocate_functions::rel_unaligned): New.
2501         (Relocate_functions::rel32_unaligned): New.
2502         * target-reloc.h (relocate_for_relocatable): Add code to handle
2503         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2504         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2505         arm_unaligned_reloc_r): New targets.
2506         * testsuite/Makefile.in: Regenerate.
2507         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2508         linking.
2509
2510 2011-11-02  Ian Lance Taylor  <iant@google.com>
2511
2512         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2513         NATIVE_LINKER.
2514         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2515         * options.cc (General_options::finalize): Use library search path
2516         from configure script if specified.  If not native and no sysroot,
2517         only search TOOLLIBDIR.
2518         * options.h (Search_directory::Search_directory): Change name to
2519         const std::string&.
2520         (General_options::add_to_library_path_with_sysroot): Change arg to
2521         const std::string&.
2522         * configure, Makefile.in, config.in: Rebuild.
2523
2524 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2525
2526         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2527         we are working around the ARM1176 Erratum.
2528         * options.h (General_options::fix_arm1176): Add option.
2529         * testsuite/Makefile.am: Add testcases, and keep current ones
2530         working.
2531         * testsuite/Makefile.in: Regenerate.
2532         * testsuite/arm_fix_1176.s: New file.
2533         * testsuite/arm_fix_1176.sh: Likewise.
2534
2535 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2536
2537         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2538         may_use_blx_.
2539         (Target_arm::may_use_blx): Remove method.
2540         (Target_arm::set_may_use_blx): Likewise.
2541         (Target_arm::may_use_v4t_interworking): New method.
2542         (Target_arm::may_use_v5t_interworking): Likewise.
2543         (Target_arm::may_use_blx_): Remove member variable.
2544         (Arm_relocate_functions::arm_branch_common): Check for v5T
2545         interworking.
2546         (Arm_relocate_functions::thumb_branch_common): Likewise.
2547         (Reloc_stub::stub_type_for_reloc): Likewise.
2548         (Target_arm::do_finalize_sections): Correct interworking checks.
2549         * testsuite/Makefile.am: Add new tests.
2550         * testsuite/Makefile.in: Regenerate.
2551         * testsuite/arm_farcall_arm_arm.s: New test.
2552         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2553         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2554         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2555         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2556         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2557         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2558         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2559
2560 2011-10-31  Cary Coutant  <ccoutant@google.com>
2561
2562         PR gold/13023
2563         * expression.cc (Expression::eval_with_dot): Add
2564         is_section_dot_assignment parameter.
2565         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2566         absolute and assigning to dot within a section.
2567         * script-sections.cc
2568         (Output_section_element_assignment::set_section_addresses): Pass
2569         dot_section to set_if_absolute.
2570         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2571         as is_section_dot_assignment flag to eval_with_dot.
2572         (Output_section_element_dot_assignment::set_section_addresses):
2573         Likewise.
2574         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2575         parameter.  Also set value if relative to dot_section; set the
2576         symbol's output_section.
2577         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2578         parameter.  Adjust all callers.
2579         (Expression::eval_maybe_dot): Likewise.
2580         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2581         Adjust all callers.
2582         * testsuite/script_test_2.t: Test assignment of an absolute value
2583         to dot within an output section element.
2584
2585 2011-10-31  Cary Coutant  <ccoutant@google.com>
2586
2587         * options.h (class General_options): Add --[no-]gnu-unique options.
2588         * symtab.cc (Symbol_table::sized_write_globals): Convert
2589         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2590
2591 2011-10-31  Cary Coutant  <ccoutant@google.com>
2592
2593         PR gold/13359
2594         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2595         unnecessary assertion.
2596         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2597
2598 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2599
2600         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2601         gc_mark_symbol.
2602         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2603         gc_mark_symbol.
2604         Change to just keep the section associated with symbol.
2605         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2606         they are externally visible and --export-dynamic is turned on.
2607         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2608
2609 2011-10-19  Ian Lance Taylor  <iant@google.com>
2610
2611         PR gold/13163
2612         * script-sections.cc
2613         (Output_section_element_dot_assignment::needs_output_section): New
2614         function.
2615
2616 2011-10-19  Ian Lance Taylor  <iant@google.com>
2617
2618         PR gold/13204
2619         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2620         --section-start option was seen.
2621         * options.h (General_options::any_section_start): New function.
2622
2623 2011-10-18  David S. Miller  <davem@davemloft.net>
2624
2625         PR binutils/13301
2626         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2627         member to track relocation locations that have moved during TLS
2628         reloc optimizations.
2629         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2630         (Target_sparc::Relocate::relocate): Adjust view down by 4
2631         bytes if it matches reloc_adjust_addr_.
2632         (Target_sparc::Relocate::relocate_tls): Always move the
2633         __tls_get_addr call delay slot instruction forward 4 bytes when
2634         performing relaxation.
2635
2636 2011-10-18  Cary Coutant  <ccoutant@google.com>
2637
2638         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2639         (Output_file::map_no_anonymous): Check for non-zero
2640         return code from posix_fallocate.
2641
2642 2011-10-17  Cary Coutant  <ccoutant@google.com>
2643
2644         PR gold/13245
2645         * plugin.cc (is_visible_from_outside): Check for symbols
2646         referenced from dynamic objects.
2647         * resolve.cc (Symbol_table::resolve): Don't count references
2648         from dynamic objects as references from real ELF files.
2649         * testsuite/plugin_test_2.sh: Adjust expected result.
2650
2651 2011-10-17  Cary Coutant  <ccoutant@google.com>
2652
2653         * gold.cc: Include timer.h.
2654         (queue_middle_tasks): Stamp time.
2655         (queue_final_tasks): Likewise.
2656         * main.cc (main): Store timer in parameters.  Print timers
2657         for each pass.
2658         * parameters.cc (Parameters::Parameters): Initialize timer_.
2659         (Parameters::set_timer): New function.
2660         (set_parameters_timer): New function.
2661         * parameters.h (Parameters::set_timer): New function.
2662         (Parameters::timer): New function.
2663         (Parameters::timer_): New data member.
2664         (set_parameters_timer): New function.
2665         * timer.cc (Timer::stamp): New function.
2666         (Timer::get_pass_time): New function.
2667         * timer.h (Timer::stamp): New function.
2668         (Timer::get_pass_time): New function.
2669         (Timer::pass_times_): New data member.
2670
2671 2011-10-17  Cary Coutant  <ccoutant@google.com>
2672
2673         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2674         task for members of lib groups.
2675
2676 2011-10-17  Cary Coutant  <ccoutant@google.com>
2677
2678         PR gold/13288
2679         * fileread.cc (File_read::find_view): Add assert.
2680         (File_read::make_view): Move bounds check (replace with assert)...
2681         (File_read::find_or_make_view): ... to here.
2682
2683 2011-10-12  Cary Coutant  <ccoutant@google.com>
2684
2685         * output.cc (Output_file::open_base_file): Handle case where
2686         ::read returns less than requested size.
2687
2688 2011-10-10  Cary Coutant  <ccoutant@google.com>
2689
2690         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2691         Initialize defined_count_.
2692         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2693         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2694         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2695         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2696         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2697         * incremental.h (Sized_relobj_incr::defined_count_): New data
2698         member.
2699         (Sized_incr_dynobj::defined_count_): New data member.
2700         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2701         Return zeroes instead of internal error.
2702
2703 2011-10-10  Cary Coutant  <ccoutant@google.com>
2704
2705         PR gold/13249
2706         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2707         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2708         * output.h (class Output_reloc): Add use_plt_offset flag.
2709         (Output_reloc::type_): Adjust size of bit field.
2710         (Output_reloc::use_plt_offset_): New bit field.
2711         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2712         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2713         flag.  Adjust all callers.
2714         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2715         creating RELATIVE relocations.
2716
2717 2011-10-10  Nick Clifton  <nickc@redhat.com>
2718
2719         * po/es.po: Updated Spanish translation.
2720         * po/fi.po: Updated Finnish translation.
2721
2722 2011-10-03   Diego Novillo  <dnovillo@google.com>
2723
2724         * options.cc (parse_uint): Fix dereference of RETVAL.
2725
2726 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2727
2728         * layout.h (section_order_map_): New member.
2729         (get_section_order_map): New member function.
2730         * output.cc (Output_section::add_input_section): Check for patterns
2731         only when --section-ordering-file is specified.
2732         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2733         output_sections have been formed.
2734         * layout.cc (Layout_Layout): Initialize section_order_map_.
2735         * plugin.cc (update_section_order): Store order in order_map. Do not
2736         update the order.
2737         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2738         * testsuite/Makefile.in: Regenerate.
2739         * testsuite/plugin_section_order.c: New file.
2740         * testsuite/plugin_final_layout.cc: New file.
2741         * testsuite/plugin_final_layout.sh: New file.
2742
2743 2011-09-29  Cary Coutant  <ccoutant@google.com>
2744
2745         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2746         Check for NULL.
2747         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2748         symbols during incremental update.
2749         (Symbol_table::add_from_dynobj): Likewise.
2750
2751 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2752             Ian Lance Taylor  <iant@google.com>
2753
2754         * symtab.cc (Symbol_table::define_special_symbol): Always
2755         canonicalize version string.
2756
2757 2011-09-26  Cary Coutant  <ccoutant@google.com>
2758
2759         * gold.cc (queue_initial_tasks): Move option checks ...
2760         * options.cc (General_options::finalize): ... to here. Disable
2761         some options; make others fatal.
2762
2763 2011-09-26  Cary Coutant  <ccoutant@google.com>
2764
2765         gcc PR lto/47247
2766         * plugin.cc (get_symbols_v2): New function.
2767         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2768         (is_referenced_from_outside): New function.
2769         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2770         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2771         (get_symbols): Pass version parameter.
2772         (get_symbols_v2): New function.
2773         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2774         parameter.
2775         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2776         (onload): Add LDPT_GET_SYMBOLS_V2.
2777         (all_symbols_read_hook): Use get_symbols_v2; check for
2778         LDPR_PREVAILING_DEF_IRONLY_EXP.
2779         * testsuite/plugin_test_3.sh: Update expected results.
2780
2781 2011-09-23  Simon Baldwin  <simonb@google.com>
2782
2783         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2784         configuration options.
2785         * configure: Regenerate.
2786         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2787         * Makefile.in: Regenerate.
2788         * testsuite/Makefile.in: Regenerate.
2789
2790 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2791
2792         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2793
2794 2011-09-19  Cary Coutant  <ccoutant@google.com>
2795
2796         * incremental.cc (can_incremental_update): Fix typo in comment.
2797         * incremental.h (can_incremental_update): Likewise.
2798
2799 2011-09-18  Cary Coutant  <ccoutant@google.com>
2800
2801         * incremental.cc (can_incremental_update): New function.
2802         * incremental.h (can_incremental_update): New function.
2803         * layout.cc (Layout::init_fixed_output_section): Call it.
2804         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2805         * object.cc (Sized_relobj_file::do_layout): Call
2806         can_incremental_update.
2807
2808 2011-09-13  Cary Coutant  <ccoutant@google.com>
2809
2810         * configure.ac: Check for glibc support for gnu_indirect_function
2811         support with static linking, setting automake conditional
2812         IFUNC_STATIC.
2813         * Makefile.in: Regenerate.
2814         * configure: Regenerate.
2815
2816         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2817         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2818         for IFUNC_STATIC.
2819         * testsuite/Makefile.in: Regenerate.
2820
2821 2011-09-13  Cary Coutant  <ccoutant@google.com>
2822
2823         * incremental.cc (Sized_relobj_incr::do_layout): Call
2824         report_comdat_group for kept comdat sections.
2825         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2826         * testsuite/Makefile.in: Regenerate.
2827         * testsuite/incr_comdat_test_1.cc: New source file.
2828         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2829         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2830         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2831
2832 2011-09-13  Ian Lance Taylor  <iant@google.com>
2833
2834         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2835         variable external_symbols_offset.
2836
2837 2011-09-12  Ian Lance Taylor  <iant@google.com>
2838
2839         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2840         triggered if object has no symbols.
2841
2842 2011-09-09  David S. Miller  <davem@davemloft.net>
2843
2844         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2845         (Output_fill_debug_line::do_write): Likewise.
2846
2847 2011-08-29  Cary Coutant  <ccoutant@google.com>
2848
2849         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2850         casts to match formatting specs.
2851         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2852
2853 2011-08-26  Cary Coutant  <ccoutant@google.com>
2854
2855         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2856         remaining hole size when allocating.
2857         (Layout::make_output_section): Set fill methods for debug sections.
2858         * layout.h (Free_list::Free_list_node): Move from private to
2859         public.
2860         (Free_list::set_min_hole_size): New function.
2861         (Free_list::begin, Free_list::end): New functions.
2862         (Free_list::min_hole_): New data member.
2863         * output.cc: Include dwarf.h.
2864         (Output_fill_debug_info::do_minimum_hole_size): New function.
2865         (Output_fill_debug_info::do_write): New function.
2866         (Output_fill_debug_line::do_minimum_hole_size): New function.
2867         (Output_fill_debug_line::do_write): New function.
2868         (Output_section::Output_section): Initialize new data member.
2869         (Output_section::set_final_data_size): Ensure patch space is larger
2870         than minimum hole size.
2871         (Output_section::do_write): Fill holes in debug sections.
2872         * output.h (Output_fill): New class.
2873         (Output_fill_debug_info): New class.
2874         (Output_fill_debug_line): New class.
2875         (Output_section::set_free_space_fill): New function.
2876         (Output_section::free_space_fill_): New data member.
2877         * testsuite/Makefile.am (incremental_test_3): Add
2878         --incremental-patch option.
2879         (incremental_test_4): Likewise.
2880         (incremental_test_5): Likewise.
2881         (incremental_test_6): Likewise.
2882         (incremental_copy_test): Likewise.
2883         (incremental_common_test_1): Likewise.
2884         * testsuite/Makefile.in: Regenerate.
2885
2886 2011-08-26  Nick Clifton  <nickc@redhat.com>
2887
2888         * po/es.po: Updated Spanish translation.
2889
2890 2011-08-01  Cary Coutant  <ccoutant@google.com>
2891
2892         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2893         * gold/testsuite/Makefile.in: Regenerate.
2894         * gold/testsuite/justsyms_exec.c: New source file.
2895         * gold/testsuite/justsyms_lib.c: New source file.
2896
2897 2011-08-01  Cary Coutant  <ccoutant@google.com>
2898
2899         * layout.cc (Layout::set_segment_offsets): Don't realign text
2900         segment if -Ttext was specified.
2901         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2902         file type.
2903         * object.h (Sized_relobj_file::e_type): New function.
2904         (Sized_relobj_file::e_type_): New data member.
2905         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2906         base address for ET_EXEC files.
2907         * target.cc (Target::do_make_elf_object_implementation): Allow
2908         ET_EXEC files with --just-symbols option.
2909
2910 2011-07-28  Cary Coutant  <ccoutant@google.com>
2911
2912         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2913         Add thread_number parameter.
2914         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2915         * workqueue-threads.cc
2916         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2917         current thread if its thread number is greater than desired thread
2918         count.
2919         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2920         Add thread_number parameter.
2921         (Workqueue::should_cancel_thread): Likewise.
2922         (Workqueue::find_runnable_or_wait): Pass thread_number to
2923         should_cancel_thread.
2924         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2925         parameter.
2926
2927 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2928
2929         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2930         only after checking if it cannot be forced local.
2931         * symtab.h (is_externally_visible): Check if the symbol is not forced
2932         local.
2933
2934 2011-07-15  Ian Lance Taylor  <iant@google.com>
2935
2936         * options.h (class General_options): Add --print-output-format.
2937         Move -EL next to -EB, for  better --help output.
2938         * target-select.cc: Include <cstdio>, "options.h", and
2939         "parameters.h".
2940         (Target_selector::do_target_bfd_name): New function.
2941         (print_output_format): New function.
2942         * target-select.h (class Target_selector): Update declarations.
2943         (Target_selector::target_bfd_name): New function.
2944         (print_output_format): Declare.
2945         * main.cc: Include "target-select.h".
2946         (main): Handle --print-output-format.
2947         * gold.cc: Include "target-select.h".
2948         (queue_initial_tasks): Handle --print-output-format when there are
2949         no input files.
2950         * parameters.cc (parameters_force_valid_target): Give a better
2951         error message if -EB/-EL does not match target.
2952         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2953         function.
2954
2955 2011-07-15  Ian Lance Taylor  <iant@google.com>
2956
2957         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2958         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2959         (Output_data_plt_i386::do_write): Write address of .dynamic
2960         section to first entry in .got.plt section.
2961         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2962         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2963         Initialize layout_.
2964         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2965         section to first entry in .got.plt section.
2966         * layout.h (Layout::dynamic_section): New function.
2967
2968 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2969
2970         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2971         to claim_file call.
2972         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2973         input_section_position_, and input_section_glob_.
2974         (read_layout_from_file): Call function section_ordering_specified.
2975         * layout.h (is_section_ordering_specified): New function.
2976         (section_ordering_specified): New function.
2977         (section_ordering_specified_): New boolean member.
2978         * main.cc(main): Call load_plugins after layout object is defined.
2979         * output.cc (Output_section::add_input_section): Use
2980         function section_ordering_specified to check if section ordering is
2981         needed.
2982         * output.cc (Output_section::add_relaxed_input_section): Use
2983         function section_ordering_specified to check if section ordering is
2984         needed.
2985         (Output_section::update_section_layout): New function.
2986         (Output_section::sort_attached_input_sections): Check if input section
2987         must be reordered.
2988         * output.h (Output_section::update_section_layout): New function.
2989         * plugin.cc (get_section_count): New function.
2990         (get_section_type): New function.
2991         (get_section_name): New function.
2992         (get_section_contents): New function.
2993         (update_section_order): New function.
2994         (allow_section_ordering): New function.
2995         (Plugin::load): Add the new interfaces to the transfer vector.
2996         (Plugin_manager::load_plugins): New parameter.
2997         (Plugin_manager::all_symbols_read): New parameter.
2998         (Plugin_manager::claim_file): New parameter. Save the elf object for
2999         unclaimed objects.
3000         (Plugin_manager::get_elf_object): New function.
3001         (Plugin_manager::get_view): Change to directly use the bool to check
3002         if get_view is called from claim_file_hook.
3003         * plugin.h (input_objects): New function
3004         (Plugin__manager::load_plugins): New parameter.
3005         (Plugin_manager::claim_file): New parameter.
3006         (Plugin_manager::get_elf_object): New function.
3007         (Plugin_manager::in_claim_file_handler): New function.
3008         (Plugin_manager::in_claim_file_handler_): New member.
3009         (layout): New function.
3010         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3011         handler with an extra parameter. Make the elf object before calling
3012         claim_file handler.
3013         * testsuite/plugin_test.c (get_section_count): New function pointer.
3014         (get_section_type): New function pointer.
3015         (get_section_name): New function pointer.
3016         (get_section_contents): New function pointer.
3017         (update_section_order): New function pointer.
3018         (allow_section_ordering): New function pointer.
3019         (onload): Check if the new interfaces exist.
3020
3021 2011-07-13  Ian Lance Taylor  <iant@google.com>
3022
3023         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3024         relro section.
3025         * x86_64.cc (Target_x86_64::got_section): Likewise.
3026         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3027         (relro_now_test_SOURCES): New variable.
3028         (relro_now_test_DEPENDENCIES): New variable.
3029         (relro_now_test_LDFLAGS): New variable.
3030         (relro_now_test_LDADD): New variable.
3031         (relro_now_test.so): New target.
3032         * testsuite/Makefile.in: Rebuild.
3033
3034 2011-07-12  Ian Lance Taylor  <iant@google.com>
3035
3036         PR gold/12980
3037         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3038         GLOB_DAT relocation rather than a RELATIVE relocation for a
3039         protected symbol when creating a shared library.
3040         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3041         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3042         * testsuite/protected_main_1.cc (main): Test that protected
3043         function has same address.
3044
3045 2011-07-11  Ian Lance Taylor  <iant@google.com>
3046
3047         PR gold/12979
3048         * options.h (class General_options): Add -Bgroup.
3049         * options.cc (General_options::finalize): If -Bgroup is set,
3050         default to --unresolved-symbols=report-all.
3051         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3052         * target-reloc.h (issue_undefined_symbol_error): Handle
3053         --unresolved-symbols=report-all.
3054
3055 2011-07-08  Ian Lance Taylor  <iant@google.com>
3056
3057         PR gold/11985
3058         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3059         if linker script discards key sections.
3060         (Layout::create_dynamic_symtab): Likewise.
3061         (Layout::assign_local_dynsym_offsets): Likewise.
3062         (Layout::sized_create_version_sections): Likewise.
3063         (Layout::create_interp): Likewise.
3064         (Layout::finish_dynamic_section): Likewise.
3065         (Layout::set_dynamic_symbol_size): Likewise.
3066
3067 2011-07-08  Ian Lance Taylor  <iant@google.com>
3068
3069         PR gold/12386
3070         * options.h (class General_options): Add --unresolved-symbols.
3071         * target-reloc.h (issue_undefined_symbol_error): Check
3072         --unresolved-symbols.  Add comments.
3073
3074 2011-07-08  Ian Lance Taylor  <iant@google.com>
3075
3076         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3077         expression more complex.
3078
3079 2011-07-08  Ian Lance Taylor  <iant@google.com>
3080
3081         PR gold/11317
3082         * target-reloc.h (issue_undefined_symbol_error): New inline
3083         function, broken out of relocate_section.
3084         (relocate_section): Call issue_undefined_symbol_error.
3085         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3086         there is no TLS segment if we are about to issue an undefined
3087         symbol error.
3088         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3089
3090 2011-07-08  Ian Lance Taylor  <iant@google.com>
3091
3092         PR gold/12279
3093         * resolve.cc (Symbol_table::should_override): Add fromtype
3094         parameter.  Change all callers.  Give error when linking together
3095         TLS and non-TLS symbol.
3096         (Symbol_table::should_override_with_special): Add fromtype
3097         parameter.  Change all callers.
3098         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3099         there is no TLS segment if we have reported some errors.
3100         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3101
3102 2011-07-08  Ian Lance Taylor  <iant@google.com>
3103
3104         PR gold/12372
3105         * target.h (Target::plt_address_for_global): New function.
3106         (Target::plt_address_for_local): New function.
3107         (Target::plt_section_for_global): Remove.
3108         (Target::plt_section_for_local): Remove.
3109         (Target::do_plt_address_for_global): New virtual function.
3110         (Target::do_plt_address_for_local): New virtual function.
3111         (Target::do_plt_section_for_global): Remove.
3112         (Target::do_plt_section_for_local): Remove.
3113         (Target::register_global_plt_entry): Add Symbol_table and Layout
3114         parameters.
3115         * output.cc (Output_data_got::Got_entry::write): Use
3116         plt_address_for_global and plt_address_for_local.
3117         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3118         address of output section.
3119         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3120         got_irelative_, and irelative_count_ fields.  Update
3121         declarations.
3122         (Output_data_plt_i386::has_irelative_section): New function.
3123         (Output_data_plt_i386::entry_count): Add irelative_count_.
3124         (Output_data_plt_i386::set_final_data_size): Likewise.
3125         (class Target_i386): Add got_irelative_ and rel_irelative_
3126         fields.  Update declarations.
3127         (Target_i386::Target_i386): Initialize new fields.
3128         (Target_i386::do_plt_address_for_global): New function replacing
3129         do_plt_section_for_global.
3130         (Target_i386::do_plt_address_for_local): New function replacing
3131         do_plt_section_for_local.
3132         (Target_i386::got_section): Create got_irelative_.
3133         (Target_i386::rel_irelative_section): New function.
3134         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3135         fields.  Don't define __rel_iplt_{start,end}.
3136         (Output_data_plt_i386::add_entry): Add symtab and layout
3137         parameters.  Change all callers.  Use different PLT and GOT for
3138         IFUNC symbols.
3139         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3140         layout parameters.  Change all callers.  Use different PLT and
3141         GOT.
3142         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3143         (Output_data_plt_i386::rel_irelative): New function.
3144         (Output_data_plt_i386::address_for_global): New function.
3145         (Output_data_plt_i386::address_for_local): New function.
3146         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3147         IRELATIVE GOT when changing IFUNC GOT entries.
3148         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3149         reloc.
3150         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3151         if we didn't create an IRELATIVE GOT.
3152         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3153         plt_address_for_local.
3154         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3155         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3156         got_irelative_, and irelative_count_ fields.  Update
3157         declarations.
3158         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3159         Initialize new fields.  Remove symtab parameter.  Change all
3160         callers.
3161         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3162         irelative_count_.
3163         (Output_data_plt_x86_64::has_irelative_section): New function.
3164         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3165         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3166         fields.  Update declarations.
3167         (Target_x86_64::Target_x86_64): Initialize new fields.
3168         (Target_x86_64::do_plt_address_for_global): New function replacing
3169         do_plt_section_for_global.
3170         (Target_x86_64::do_plt_address_for_local): New function replacing
3171         do_plt_section_for_local.
3172         (Target_x86_64::got_section): Create got_irelative_.
3173         (Target_x86_64::rela_irelative_section): New function.
3174         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3175         all callers.  Don't create __rel_iplt_{start,end}.
3176         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3177         parameters.  Change all callers.  Use different PLT and GOT for
3178         IFUNC symbols.
3179         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3180         layout parameters.  Change all callers.  Use different PLT and
3181         GOT.
3182         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3183         parameters.  Change all callers.  Use different PLT and GOT for
3184         IFUNC symbols.
3185         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3186         (Output_data_plt_x86_64::rela_irelative): New function.
3187         (Output_data_plt_x86_64::address_for_global): New function.
3188         (Output_data_plt_x86_64::address_for_local): New function.
3189         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3190         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3191         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3192         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3193         parameters.
3194         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3195         reloc.
3196         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3197         symbols if we didn't create an IRELATIVE GOT.
3198         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3199         plt_address_for_local.
3200         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3201         * testsuite/ifuncvar1.c: New test file.
3202         * testsuite/ifuncvar2.c: New test file.
3203         * testsuite/ifuncvar3.c: New test file.
3204         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3205         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3206         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3207         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3208         * testsuite/Makefile.in: Rebuild.
3209
3210 2011-07-07  Cary Coutant  <ccoutant@google.com>
3211
3212         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3213         (two_file_test_1_ndebug.o): Likewise.
3214         (two_file_test_1b_ndebug.o): Likewise.
3215         (two_file_test_2_ndebug.o): Likewise.
3216         (two_file_test_main_ndebug.o): Likewise.
3217         (incremental_test_2): Link with no-debug versions.
3218
3219 2011-07-06  Cary Coutant  <ccoutant@google.com>
3220
3221         * gold/incremental.cc
3222         (Output_section_incremental_inputs::write_info_blocks): Check for
3223         hidden and internal symbols.
3224
3225 2011-07-06  Cary Coutant  <ccoutant@google.com>
3226
3227         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3228         Check disposition for startup file.
3229         (Incremental_inputs::report_command_line): Ignore
3230         --incremental-startup-unchanged option.
3231         * options.cc (General_options::parse_incremental_startup_unchanged):
3232         New function.
3233         (General_options::General_options): Initialize new data member.
3234         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3235         (General_options): Add --incremental-startup-unchanged option.
3236         (General_options::incremental_startup_disposition): New function.
3237         (General_options::incremental_startup_disposition_): New data member.
3238
3239 2011-07-06  Cary Coutant  <ccoutant@google.com>
3240
3241         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3242         input file index to Script_info ctor.
3243         (Sized_incremental_binary::do_file_has_changed): Find the
3244         command-line argument for files named in scripts.
3245         * incremental.h (Script_info::Script_info): New ctor
3246         with input file index.
3247         (Script_info::input_file_index): New function.
3248         (Script_info::input_file_index_): New data member.
3249         (Incremental_binary::get_library): Add const.
3250         (Incremental_binary::get_script_info): Add const.
3251         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3252         * testsuite/Makefile.am (incremental_test_5): New test case.
3253         (incremental_test_6): New test case.
3254         * testsuite/Makefile.in: Regenerate.
3255
3256 2011-07-06  Cary Coutant  <ccoutant@google.com>
3257
3258         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3259         debug output when command lines differ.
3260
3261 2011-07-06  Cary Coutant  <ccoutant@google.com>
3262
3263         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3264         --incremental-patch option.
3265         * layout.cc (Free_list::allocate): Extend allocation beyond original
3266         end if enabled.
3267         (Layout::make_output_section): Mark sections that should get
3268         patch space.
3269         * options.cc (parse_percent): New function.
3270         * options.h (parse_percent): New function.
3271         (DEFINE_percent): New macro.
3272         (General_options): Add --incremental-patch option.
3273         * output.cc (Output_section::Output_section): Initialize new data
3274         members.
3275         (Output_section::add_input_section): Print section name when out
3276         of patch space.
3277         (Output_section::add_output_section_data): Likewise.
3278         (Output_section::set_final_data_size): Add patch space when
3279         doing --incremental-full.
3280         (Output_section::do_reset_address_and_file_offset): Remove patch
3281         space.
3282         (Output_segment::set_section_list_addresses): Print debug output
3283         only if --incremental-update.
3284         * output.h (Output_section::set_is_patch_space_allowed): New function.
3285         (Output_section::is_patch_space_allowed_): New data member.
3286         (Output_section::patch_space_): New data member.
3287         * parameters.cc (Parameters::incremental_full): New function.
3288         * parameters.h (Parameters::incremental_full): New function
3289         * testsuite/Makefile.am (incremental_test_2): Add test for
3290         --incremental-patch option.
3291         * testsuite/Makefile.in: Regenerate.
3292         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3293         (t18): Remove function body.
3294
3295 2011-07-05  Doug Kwan  <dougkwan@google.com>
3296
3297         PR gold/12771
3298         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3299         Arm_Address type for relocation result.
3300         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3301         overflow check.
3302         (Arm_relocate_functions::abs32): Use unaligned access.
3303         (Arm_relocate_functions::rel32): Ditto.
3304         (Arm_relocate_functions::prel31): Ditto.
3305         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3306         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3307         static data relocations.
3308         * testsuite/Makefile.in: Regnerate.
3309         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3310
3311 2011-07-05  Ian Lance Taylor  <iant@google.com>
3312
3313         PR gold/12392
3314         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3315         symbols if necessary.
3316         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3317
3318 2011-07-05  Ian Lance Taylor  <iant@google.com>
3319
3320         PR gold/12952
3321         * resolve.cc (Symbol::override_base_with_special): Simply override
3322         version with special symbol version, ignoring previous version.
3323
3324 2011-07-05  Ian Lance Taylor  <iant@google.com>
3325
3326         * object.cc (Sized_relobj_file::include_section_group): Add
3327         information to comment about signature location.
3328
3329 2011-07-02  Ian Lance Taylor  <iant@google.com>
3330
3331         PR gold/12957
3332         * options.h (class General_options): Add -f and -F.
3333         * options.cc (General_options::finalize): Fatal error if -f/-F
3334         are used without -shared.
3335         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3336
3337 2011-07-02  Ian Lance Taylor  <iant@google.com>
3338
3339         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3340
3341 2011-07-01  Ian Lance Taylor  <iant@google.com>
3342
3343         PR gold/12525
3344         PR gold/12952
3345         * resolve.cc (Symbol::override_base_with_special): Don't override
3346         the version if the overriding symbol has a different name.
3347         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3348         all callers.  If we give an error about an undefined version,
3349         define the base version if necessary.
3350         * dynobj.h (class Versions): Update declaration.
3351         * testsuite/weak_alias_test_5.cc: New file.
3352         * testsuite/weak_alias_test.script: New file.
3353         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3354         and versioned_alias have the right value, and call t2.
3355         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3356         weak_alias_test_5.so.
3357         (weak_alias_test_LDADD): Likewise.
3358         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3359         * testsuite/Makefile.in: Rebuild.
3360
3361 2011-07-01  Ian Lance Taylor  <iant@google.com>
3362
3363         PR gold/12525
3364         * options.h (class General_options): Support -z notext.
3365         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3366         -Wl,-z,notext.
3367         (two_file_shared_nonpic.so): Likewise.
3368         (two_file_shared_mixed.so): Likewise.
3369         (two_file_shared_mixed_1.so): Likewise.
3370         (weak_undef_lib_nonpic.so): Likewise.
3371         (alt/weak_undef_lib_nonpic.so): Likewise.
3372         (tls_test_shared_nonpic.so): Likewise.
3373         * testsuite/Makefile.in: Rebuild.
3374
3375 2011-07-01  Ian Lance Taylor  <iant@google.com>
3376
3377         PR gold/12525
3378         * configure.ac: Test whether static linking works, setting
3379         the automake conditional HAVE_STATIC.
3380         * testsuite/Makefile.am: Disable tests using -static if
3381         HAVE_STATIC is not true.
3382         * configure, testsuite/Makefile.in: Rebuild.
3383
3384 2011-07-01  Ian Lance Taylor  <iant@google.com>
3385
3386         PR gold/12525
3387         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3388         Assert if we see DW_EH_PE_indirect.
3389         * target.h (Target::ehframe_datarel_base): New function.
3390         (Target::do_ehframe_datarel_base): New target function.
3391         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3392         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3393         function.
3394
3395 2011-07-01  Ian Lance Taylor  <iant@google.com>
3396
3397         PR gold/12571
3398         * options.h (class General_options): Add
3399         --ld-generated-unwind-info.
3400         * ehframe.cc (Fde::write): Add address parameter.  Change all
3401         callers.  If associated with PLT, fill in address and size.
3402         (Cie::set_output_offset): Only add merge mapping if there is an
3403         object.
3404         (Cie::write): Add address parameter.  Change all callers.
3405         (Eh_frame::add_ehframe_for_plt): New function.
3406         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3407         input_offset_ fields into union u_, with new plt field.
3408         (Fde::Fde): Adjust for new union field.
3409         (Fde::Fde) [Output_data version]: New constructor.
3410         (Fde::add_mapping): Only add merge mapping if there is an object.
3411         (class Cie): Update declarations.
3412         (class Eh_frame): Declare add_ehframe_for_plt.
3413         * layout.cc (Layout::layout_eh_frame): Break out code into
3414         make_eh_frame_section, and call it.
3415         (Layout::make_eh_frame_section): New function.
3416         (Layout::add_eh_frame_for_plt): New function.
3417         * layout.h (class Layout): Update declarations.
3418         * merge.cc (Merge_map::add_mapping): Add assertion.
3419         * i386.cc: Include "dwarf.h".
3420         (class Output_data_plt_i386): Make first_plt_entry,
3421         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3422         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3423         and plt_eh_frame_fde.
3424         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3425         boundary.  Call add_eh_frame_for_plt if appropriate.
3426         * x86_64.cc: Include "dwarf.h".
3427         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3428         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3429         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3430         and plt_eh_frame_fde.
3431         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3432         appropriate.
3433
3434 2011-06-29  Ian Lance Taylor  <iant@google.com>
3435
3436         PR gold/12629
3437         * object.cc (Sized_relobj_file::layout_section): Change shdr
3438         parameter to be const.
3439         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3440         out of do_layout.
3441         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3442         appropriate.  Call layout_eh_frame_section.
3443         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3444         sections.
3445         * object.h (class Sized_relobj_file): Update declarations.
3446
3447 2011-06-29  Ian Lance Taylor  <iant@google.com>
3448
3449         PR gold/12652
3450         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3451         modifier.
3452         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3453
3454 2011-06-29  Ian Lance Taylor  <iant@google.com>
3455
3456         PR gold/12675
3457         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3458         SHT_X86_64_UNWIND.
3459         * layout.cc (Layout::layout_eh_frame): Likewise.
3460
3461 2011-06-29  Ian Lance Taylor  <iant@google.com>
3462
3463         PR gold/12695
3464         * layout.cc (Layout::symtab_section_shndx): New function.
3465         * layout.h (class Layout): Declare symtab_section_shndx.
3466         * output.cc (Output_section::write_header): Call it.
3467
3468 2011-06-29  Ian Lance Taylor  <iant@google.com>
3469
3470         PR gold/12818
3471         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3472         symbols which are not used in a relocation.
3473
3474 2011-06-28  Ian Lance Taylor  <iant@google.com>
3475
3476         PR gold/12898
3477         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3478         script create indistinguishable segments.
3479         (Layout::set_segment_offsets): Use stable_sort when sorting
3480         segments.  Pass this to Compare_segments constructor.
3481         * layout.h (class Layout): Make segment_precedes non-static.
3482         (class Compare_segments): Change from struct to class.  Add
3483         layout_ field.  Add constructor.
3484         * script-sections.cc
3485         (Script_sections::attach_sections_using_phdrs_clause): Rename
3486         local orphan to is_orphan.  Don't report failure to put empty
3487         section in segment.  On attachment failure, report name of
3488         section, and attach to first PT_LOAD segment.
3489
3490 2011-06-28  Ian Lance Taylor  <iant@google.com>
3491
3492         PR gold/12934
3493         * target-select.cc (Target_selector::Target_selector): Add
3494         emulation parameter.  Change all callers.
3495         (select_target_by_bfd_name): Rename from select_target_by_name.
3496         Change all callers.
3497         (select_target_by_emulation): New function.
3498         (supported_emulation_names): New function.
3499         * target-select.h (class Target_selector): Add emulation_ field.
3500         Update declarations.
3501         (Target_selector::recognize_by_bfd_name): Rename from
3502         recognize_by_name.  Change all callers.
3503         (Target_selector::supported_bfd_names): Rename from
3504         supported_names.  Change all callers.
3505         (Target_selector::recognize_by_emulation): New function.
3506         (Target_selector::supported_emulations): New function.
3507         (Target_selector::emulation): New function.
3508         (Target_selector::do_recognize_by_bfd_name): Rename from
3509         do_recognize_by_name.  Change all callers.
3510         (Target_selector::do_supported_bfd_names): Rename from
3511         do_supported_names.  Change all callers.
3512         (Target_selector::do_recognize_by_emulation): New function.
3513         (Target_selector::do_supported_emulations): New function.
3514         (select_target_by_bfd_name): Change name in declaration.
3515         (select_target_by_emulation): Declare.
3516         (supported_emulation_names): Declare.
3517         * parameters.cc (parameters_force_valid_target): Try to find
3518         target based on emulation from -m option.
3519         * options.h (class General_options): Change doc string for -m.
3520         * options.cc (help): Print emulations.
3521         (General_options::parse_V): Likewise.
3522         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3523         Add emulation parameter.  Change all callers.
3524
3525 2011-06-28  Ian Lance Taylor  <iant@google.com>
3526
3527         * target.h (class Target): Add osabi_ field.
3528         (Target::osabi): New function.
3529         (Target::set_osabi): New function.
3530         (Target::Target): Initialize osabi_.
3531         (Target::do_adjust_elf_header): Make pure virtual.
3532         (Sized_target::do_adjust_elf_header): Declare.
3533         * target.cc (Sized_target::do_adjust_elf_header): New function.
3534         (class Sized_target): Instantiate all versions.
3535         * freebsd.h (class Target_freebsd): Remove.
3536         (Target_selector_freebsd::do_recognize): Call set_osabi on
3537         Target.
3538         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3539         (Target_selector_freebsd::set_osabi): Remove.
3540         * i386.cc (class Target_i386): Inherit from Sized_target rather
3541         than Target_freebsd.
3542         * x86_64.cc (class Target_x86_64): Likewise.
3543
3544 2011-06-28  Ian Lance Taylor  <iant@google.com>
3545
3546         * target.h (Target::can_check_for_function_pointers): Rewrite.
3547         Make non-virtual.
3548         (Target::can_icf_inline_merge_sections): Likewise.
3549         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3550         (Target::Target_info): Add can_icf_inline_merge_sections field.
3551         (Target::do_can_check_for_function_pointers): New virtual
3552         function.
3553         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3554         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3555         from can_check_for_function_pointers, move in file.
3556         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3557         section_may_have_icf_unsafe_poineters, move in file.
3558         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3559         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3560         Rename from can_check_for_function_pointers, move in file.
3561         (Target_i386::can_icf_inline_merge_sections): Remove.
3562         (Target_i386::i386_info): Initialize
3563         can_icf_inline_merge_sections.
3564         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3565         Initialize can_icf_inline_merge_sections.
3566         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3567         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3568         Rename from can_check_for_function_pointers, move in file.
3569         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3570         (Target_x86_64::x86_64_info): Initialize
3571         can_icf_inline_merge_sections.
3572         * testsuite/testfile.cc (Target_test::test_target_info):
3573         Likewise.
3574         * icf.cc (get_section_contents): Correct formatting.
3575
3576 2011-06-27  Ian Lance Taylor  <iant@google.com>
3577
3578         * symtab.cc (Symbol::versioned_name): New function.
3579         (Symbol_table::add_to_final_symtab): Use versioned_name when
3580         appropriate.
3581         (Symbol_table::sized_write_symbol): Likewise.
3582         * symtab.h (class Symbol): Declare versioned_name.
3583         * stringpool.h (class Stringpool_template): Add variant of add
3584         which takes a std::basic_string.
3585         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3586         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3587         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3588         (ver_test_12.o): New target.
3589         * testsuite/Makefile.in: Rebuild.
3590
3591 2011-06-27  Doug Kwan  <dougkwan@google.com>
3592
3593         * arm.cc (Arm_relocate_functions::thm_jump8,
3594         Arm_relocate_functions::thm_jump11): Use a wider signed
3595         type to compute offset.
3596         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3597         arm_thm_jump8.
3598         * testsuite/Makefile.in: Regenerate.
3599         * testsuite/arm_branch_in_range.sh: Check test results of
3600         arm_thm_jump11 and arm_thm_jump8.
3601         * testsuite/arm_thm_jump11.s: New test source file.
3602         * testsuite/arm_thm_jump11.t: New linker script.
3603         * testsuite/arm_thm_jump8.s: New test source file.
3604         * testsuite/arm_thm_jump8.t: New linker script.
3605
3606 2011-06-24  Ian Lance Taylor  <iant@google.com>
3607
3608         * layout.cc: Include "object.h".
3609         (ctors_sections_in_init_array): New static variable.
3610         (Layout::is_ctors_in_init_array): New function.
3611         (Layout::layout): Add entry to ctors_sections_in_init_array if
3612         appropriate.
3613         * layout.h (class Layout): Declare is_ctors_in_init_array.
3614         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3615         is_ctors_reverse_view is set.
3616         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3617         all callers.  Set is_ctors_reverse_view field of View_size.
3618         (Sized_relobj_file::reverse_words): New function.
3619         * object.h (Sized_relobj_file::View_size): Add
3620         is_ctors_reverse_view field.
3621         (class Sized_relobj_file): Update declarations.
3622         * testsuite/initpri3.c: New test.
3623         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3624         initpri3b.
3625         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3626         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3627         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3628         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3629         * testsuite/Makefile.in: Rebuild.
3630
3631 2011-06-24  Cary Coutant  <ccoutant@google.com>
3632
3633         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3634         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3635         (debug_msg_cdebug.err): New targets.
3636         * testsuite/Makefile.in: Regenerate.
3637         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3638         Fix checks for link with shared library.
3639
3640 2011-06-24  Doug Kwan  <dougkwan@google.com>
3641
3642         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3643         skip empty text sections.
3644         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3645
3646 2011-06-22  Ian Lance Taylor  <iant@google.com>
3647
3648         PR gold/12910
3649         * options.h (class General_options): Add --ctors-in-init-array.
3650         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3651         friends as SHT_PROGBITS for merging sections.
3652         (Layout::layout): Remove special handling of .init_array and
3653         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3654         and .dtors if ctors_in_init_array.
3655         (Layout::make_output_section): Force correct section types for
3656         .init_array and friends.  Don't sort if doing relocatable link,
3657         Don't sort .ctors and .dtors if ctors_in_init_array.
3658         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3659         (Layout::output_section_name): Add relobj parameter.  Change all
3660         callers.  Handle .ctors. and .dtors. in code rather than table.
3661         Handle .ctors and .dtors if ctors_in_init_array.
3662         (Layout::match_file_name): New function, moved from output.cc.
3663         * layout.h (class Layout): Update declarations.
3664         * output.cc: Include "layout.h".
3665         (Input_section_sort_entry::get_priority): New function.
3666         (Input_section_sort_entry::match_file_name): Just call
3667         Layout::match_file_name.
3668         (Output_section::Input_section_sort_init_fini_compare::operator()):
3669         Handle .ctors and .dtors.  Sort by explicit priority rather than
3670         by name.
3671         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3672         * testsuite/initpri2.c: New test.
3673         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3674         (check_PROGRAMS): Add initpri2.
3675         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3676         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3677         * configure, testsuite/Makefile.in: Rebuild.
3678
3679 2011-06-19  Ian Lance Taylor  <iant@google.com>
3680
3681         PR gold/12880
3682         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3683         .interp section to a PT_INTERP segment even if we have seen a
3684         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3685         clause in a linker script.
3686         (Layout::finalize): Don't create a .interp section if we've
3687         already create a PT_INTERP segment.
3688         (Layout::create_interp): Always call choose_output_section (revert
3689         patch of 2011-06-17).  Don't create PT_INTERP segment.
3690         * script-sections.cc
3691         (Script_sections::create_note_and_tls_segments): Add a .interp
3692         section to a PT_INTERP segment even if we have seen a
3693         --dynamic-linker option.
3694
3695 2011-06-18  Ian Lance Taylor  <iant@google.com>
3696
3697         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3698         merely because a non-PT_LOAD segment has a dynamic reloc.
3699
3700 2011-06-18  Ian Lance Taylor  <iant@google.com>
3701
3702         * layout.cc (Layout::finish_dynamic_section): Don't create
3703         DT_FLAGS entry if not needed.
3704
3705 2011-06-18  Ian Lance Taylor  <iant@google.com>
3706
3707         PR gold/12745
3708         * layout.cc (Layout::layout_eh_frame): Correct handling of
3709         writable .eh_frame section.
3710
3711 2011-06-17  Ian Lance Taylor  <iant@google.com>
3712
3713         PR gold/12893
3714         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3715         symbol is redefined with the exact same object and value.
3716
3717 2011-06-17  Ian Lance Taylor  <iant@google.com>
3718
3719         PR gold/12880
3720         * layout.h (class Layout): Add interp_segment_ field.
3721         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3722         (Layout::attach_allocated_section_to_segment): If making shared
3723         library, put .interp section in PT_INTERP segment.
3724         (Layout::finalize): Also call create_interp if -dynamic-linker
3725         option was used.
3726         (Layout::create_interp): Assert that there is no PT_INTERP
3727         segment.  If not using a SECTIONS clause, use make_output_section.
3728         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3729         * script-sections.cc
3730         (Script_sections::create_note_and_tls_segments): If making shared
3731         library, put .interp section in PT_INTERP segment.
3732
3733 2011-06-17  Ian Lance Taylor  <iant@google.com>
3734
3735         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3736         when making a shared library.
3737
3738 2011-06-17  Ian Lance Taylor  <iant@google.com>
3739
3740         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3741         parameter.  Change all callers.  Don't issue warning about PC32
3742         against locally defined symbol.
3743
3744 2011-06-16  Ian Lance Taylor  <iant@google.com>
3745
3746         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3747         occurs in same object.
3748
3749 2011-06-14  Alan Modra  <amodra@gmail.com>
3750
3751         * po/POTFILES.in: Regenerate.
3752
3753 2011-06-09  Ian Lance Taylor  <iant@google.com>
3754
3755         * script-sections.cc
3756         (Orphan_output_section::set_section_addresses): For a relocatable
3757         link set address to 0.
3758
3759 2011-06-09  Cary Coutant  <ccoutant@google.com>
3760
3761         PR gold/12804
3762         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3763         used with --compress-debug-sections.
3764         * gold/object.cc (Sized_relobj_file::do_layout): Report
3765         uncompressed size of compressed input sections.
3766
3767 2011-06-08  Cary Coutant  <ccoutant@google.com>
3768
3769         PR gold/12804
3770         * testsuite/two_file_test_2_v1.cc: Change initialization of
3771         v2 to keep it in .data.
3772
3773 2011-06-07  Cary Coutant  <ccoutant@google.com>
3774
3775         * common.cc (Symbol_table::do_allocate_commons_list): Call
3776         gold_fallback.
3777         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3778         (Errors::fallback): New function.
3779         (gold_fallback): New function.
3780         * errors.h (Errors::fallback): New function.
3781         * gold.cc (gold_exit): Change status parameter to enum; adjust
3782         all callers.
3783         (queue_initial_tasks): Call gold_fallback.
3784         * gold.h: Include cstdlib.
3785         (Exit_status): New enum type.
3786         (gold_exit): Change status parameter to enum.
3787         (gold_fallback): New function.
3788         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3789         (Layout::create_symtab_sections): Likewise.
3790         (Layout::create_shdrs): Likewise.
3791         * main.cc (main): Adjust call to gold_exit.
3792         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3793         (Output_data_got::add_got_entry_pair): Likewise.
3794         (Output_section::add_input_section): Likewise.
3795         (Output_section::add_output_section_data): Likewise.
3796         (Output_segment::set_section_list_addresses): Likewise.
3797         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3798
3799 2011-06-07  Cary Coutant  <ccoutant@google.com>
3800
3801         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3802         for incremental links.
3803         * output.cc (Output_segment::set_section_list_addresses): Remove
3804         FIXME and test for TLS or BSS.
3805
3806 2011-06-07  Cary Coutant  <ccoutant@google.com>
3807
3808         * testsuite/Makefile.am: Add incremental_copy_test,
3809         incremental_common_test_1.
3810         * testsuite/Makefile.in: Regenerate.
3811         * testsuite/common_test_1_v1.c: New source file.
3812         * testsuite/common_test_1_v2.c: New source file.
3813         * testsuite/copy_test_v1.cc: New source file.
3814
3815 2011-06-07  Cary Coutant  <ccoutant@google.com>
3816
3817         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3818         update, allocate common from bss section's free list.
3819         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3820         linker-defined symbols.
3821         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3822         Skip GOT and PLT entries that are no longer referenced.
3823         (Output_section_incremental_inputs::write_info_blocks): Mark
3824         linker-defined symbols.
3825         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3826         * output.cc (Output_section::allocate): New function.
3827         * output.h (Output_section::allocate): New function.
3828         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3829         linker-defined symbols.
3830         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3831         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3832         (Symbol::init_base_output_data): Likewise.
3833         (Symbol::init_base_output_segment): Likewise.
3834         (Symbol::init_base_constant): Likewise.
3835         (Sized_symbol::init_output_data): Likewise.
3836         (Sized_symbol::init_output_segment): Likewise.
3837         (Sized_symbol::init_constant): Likewise.
3838         (Symbol_table::do_define_in_output_data): Likewise.
3839         (Symbol_table::do_define_in_output_segment): Likewise.
3840         (Symbol_table::do_define_as_constant): Likewise.
3841         * symtab.h (Symbol::is_predefined): New function.
3842         (Symbol::init_base_output_data): Add is_predefined parameter.
3843         (Symbol::init_base_output_segment): Likewise.
3844         (Symbol::init_base_constant): Likewise.
3845         (Symbol::is_predefined_): New data member.
3846         (Sized_symbol::init_output_data): Add is_predefined parameter.
3847         (Sized_symbol::init_output_segment): Likewise.
3848         (Sized_symbol::init_constant): Likewise.
3849         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3850
3851 2011-06-07  Cary Coutant  <ccoutant@google.com>
3852
3853         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3854         instead of emit_copy_reloc.
3855         (Copy_relocs::emit_copy_reloc): Refactor.
3856         (Copy_relocs::make_copy_reloc): New function.
3857         (Copy_relocs::add_copy_reloc): Remove.
3858         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3859         section.
3860         (Copy_relocs::make_copy_reloc): New function.
3861         (Copy_relocs::add_copy_reloc): Remove.
3862         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3863         unchanged input files.
3864         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3865         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3866         Reserve BSS space for COPY relocations.
3867         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3868         (Output_section_incremental_inputs::write_info_blocks): Record
3869         whether a symbol is copied from a shared object.
3870         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3871         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3872         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3873         (Incremental_input_entry_reader::get_output_symbol_index): Add
3874         is_copy parameter.
3875         (Incremental_binary::emit_copy_relocs): New function.
3876         (Incremental_binary::do_emit_copy_relocs): New function.
3877         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3878         new data member.
3879         (Sized_incremental_binary::add_copy_reloc): New function.
3880         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3881         (Sized_incremental_binary::Copy_reloc): New struct.
3882         (Sized_incremental_binary::Copy_relocs): New typedef.
3883         (Sized_incremental_binary::copy_relocs_): New data member.
3884         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3885         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3886         * target.h (Sized_target::emit_copy_reloc): New function.
3887         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3888
3889 2011-06-02  Cary Coutant  <ccoutant@google.com>
3890
3891         PR gold/12163
3892         * gold/archive.cc (Archive::Archive): Initialize new data member.
3893         (Archive::include_all_members): Return if archive has already been
3894         included.
3895         * gold/archive.h (Archive::include_all_members_): New data member.
3896
3897 2011-06-02  Nick Clifton  <nickc@redhat.com>
3898
3899         * dynobj.h: Fix spelling mistake in comment.
3900         * output.cc: Likewise.
3901
3902 2011-05-31  Doug Kwan  <dougkwan@google.com>
3903             Asier Llano
3904
3905         PR gold/12826
3906         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3907         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3908         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3909         redundant arm_exidx_test.so.
3910         * testsuite/Makefile.in: Regenerate.
3911         (check_SCRIPTS): Add pr12826.sh
3912         (check_DATA): Add pr12826.stdout
3913         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3914         * testsuite/pr12826.sh: New file.
3915         * testsuite/pr12826_1.s: Ditto.
3916         * testsuite/pr12826_1.s: Ditto.
3917
3918 2011-05-30  Ian Lance Taylor  <iant@google.com>
3919
3920         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3921         sections.
3922
3923 2011-05-29  Ian Lance Taylor  <iant@google.com>
3924
3925         PR gold/12804
3926         * testsuite/Makefile.am: Use different file name for two_file_test
3927         temporary file for each incremental test.
3928         * testsuite/Makefile.in: Rebuild.
3929
3930 2011-05-29  Ian Lance Taylor  <iant@google.com>
3931
3932         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3933         binary input file is empty.
3934
3935 2011-05-27  Ian Lance Taylor  <iant@google.com>
3936
3937         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3938         (ver_test_9.so): Likewise.
3939         * testsuite/Makefile.in: Rebuild.
3940
3941 2011-05-26 Cary Coutant  <ccoutant@google.com>
3942
3943         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3944         * incremental.cc (Incremental_inputs::report_input_section): Fix
3945         comment, indentation.
3946         (Incremental_inputs::report_comdat_group): New function.
3947         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3948         of data for incremental input file entry.
3949         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3950         group count, COMDAT group signatures.
3951         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3952         an unchanged input file.
3953         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3954         Initialize new data member.
3955         (Incremental_object_entry::add_comdat_group): New function.
3956         (Incremental_object_entry::get_comdat_group_count): New function.
3957         (Incremental_object_entry::get_comdat_signature_key): New function.
3958         (Incremental_object_entry::groups_): New data member.
3959         (Incremental_inputs::report_comdat_group): New function.
3960         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3961         data for incremental input file entry.
3962         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3963         (Incremental_input_entry_reader::get_input_section): Adjust size of
3964         data for incremental input file entry.
3965         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3966         (Incremental_input_entry_reader::get_comdat_group_signature): New
3967         function.
3968         * object.cc (Sized_relobj::include_section_group): Report kept
3969         COMDAT groups for incremental links.
3970
3971 2011-05-24  David Meyer  <pdox@google.com>
3972
3973         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3974         with name parameter.  Add found_name parameter.
3975         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3976         * dirsearch.h (class Dirsearch): Update declaration.
3977
3978 2011-05-24  Ian Lance Taylor  <iant@google.com>
3979
3980         * archive.cc (Library_base::should_include_member): Pull in object
3981         from archive if it defines the entry symbol.
3982         * parameters.cc (Parameters::entry): New function.
3983         * parameters.h (class Parameters): Declare entry.
3984         * output.h (class Output_file_header): Remove entry_ field.
3985         * output.cc (Output_file_header::Output_file_header): Remove entry
3986         parameter.  Change all callers.
3987         (Output_file_header::entry): Use parameters->entry.
3988         * gold.cc (queue_middle_tasks): Likewise.
3989         * plugin.cc (Plugin_hook::run): Likewise.
3990
3991 2011-05-24 Cary Coutant  <ccoutant@google.com>
3992
3993         * gold.cc (queue_initial_tasks): Pass incremental base filename
3994         to Output_file::open_base_file; don't print error message.
3995         * incremental-dump.cc (main): Adjust call to
3996         Output_file::open_for_modification.
3997         * incremental-dump.cc (main): Likewise.
3998         * incremental.cc (Incremental_inputs::report_command_line):
3999         Ignore --incremental-base option when comparing command lines.
4000         Ignore parameter when given as separate argument.
4001         * options.h (class General_options): Add --incremental-base.
4002         * output.cc (Output_file::Output_file):
4003         (Output_file::open_base_file): Add base_name and writable parameters;
4004         read base file into new file; print error message here.
4005         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4006         callers.
4007         * output.h (Output_file::open_for_modification): Rename to...
4008         (Output_file::open_base_file): ...this; add base_name and
4009         writable parameters; adjust all callers.
4010         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4011         callers.
4012         * testsuite/Makefile.am (incremental_test_4): Test
4013         --incremental-base.
4014         * testsuite/Makefile.in: Regenerate.
4015
4016 2011-05-24 Cary Coutant  <ccoutant@google.com>
4017
4018         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4019         incremental_test_4.
4020         * testsuite/Makefile.in: Regenerate.
4021         * testsuite/two_file_test_1_v1.cc: New test source file.
4022         * testsuite/two_file_test_1b_v1.cc: New test source file.
4023         * testsuite/two_file_test_2_v1.cc: New test source file.
4024
4025 2011-05-24 Cary Coutant  <ccoutant@google.com>
4026
4027         * dynobj.h (Dynobj::do_dynobj): New function.
4028         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4029         flag and soname for shared objects.
4030         * incremental.cc (Incremental_inputs::report_object): Make
4031         either Incremental_object_entry or Incremental_dynobj_entry; add
4032         soname to string table.
4033         (Incremental_inputs::report_input_section): Add assertion.
4034         (Output_section_incremental_inputs::set_final_data_size): Adjust
4035         type of input file entry for shared libraries; adjust size of
4036         shared library info entry.
4037         (Output_section_incremental_inputs::write_input_files): Write
4038         as_needed flag for shared libraries.
4039         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4040         of input file entry for shared libraries; write soname.
4041         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4042         soname from incremental info.
4043         * incremental.h (enum Incremental_input_flags): Add
4044         INCREMENTAL_INPUT_AS_NEEDED.
4045         (Incremental_input_entry::Incremental_input_entry): Initialize new
4046         data member.
4047         (Incremental_input_entry::set_as_needed): New function.
4048         (Incremental_input_entry::as_needed): New function.
4049         (Incremental_input_entry::do_dynobj_entry): New function.
4050         (Incremental_input_entry::as_needed_): New data member.
4051         (Incremental_object_entry::Incremental_object_entry): Don't check
4052         for shared library.
4053         (Incremental_object_entry::do_type): Likewise.
4054         (class Incremental_dynobj_entry): New class.
4055         (Incremental_input_entry_reader::as_needed): New function.
4056         (Incremental_input_entry_reader::get_soname): New function.
4057         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4058         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4059         size of shared library info entry.
4060         * layout.cc (Layout::finish_dynamic_section): Don't test for
4061         incremental link when adding DT_NEEDED entries.
4062         * object.h (Object::Object): Initialize new data member.
4063         (Object::dynobj): New function.
4064         (Object::set_as_needed): New function.
4065         (Object::as_needed): New function.
4066         (Object::do_dynobj): New function.
4067         (Object::as_needed_): New data member.
4068
4069 2011-05-24 Cary Coutant  <ccoutant@google.com>
4070
4071         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4072         info; adjust display of GOT entries.
4073         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4074         vector of input objects; remove file_status_.
4075         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4076         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4077         got_plt reader; call target hooks to reserve GOT entries.
4078         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4079         of input file info header and GOT info entry.
4080         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4081         relocation info.
4082         (Got_plt_view_info::got_descriptor): Remove.
4083         (Got_plt_view_info::sym_index): New data member.
4084         (Got_plt_view_info::input_index): New data member.
4085         (Local_got_offset_visitor::visit): Write input file index.
4086         (Global_got_offset_visitor::visit): Write 0 for input file index.
4087         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4088         with sym_index and input_index.
4089         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4090         incremental info GOT entry; replace got_descriptor with input_index.
4091         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4092         map from input file index to object.
4093         (Sized_relobj_incr::do_layout): Replace direct data member reference
4094         with accessor function.
4095         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4096         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4097         Adjust size of input file info header.
4098         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4099         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4100         (Incremental_input_entry_reader::get_input_section): Adjust size of
4101         input file info header.
4102         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4103         of incremental info GOT entry.
4104         (Incremental_got_plt_reader::get_got_desc): Remove.
4105         (Incremental_got_plt_reader::get_got_symndx): New function.
4106         (Incremental_got_plt_reader::get_got_input_index): New function.
4107         (Sized_incremental_binary::Sized_incremental_binary): Remove
4108         file_status_; add input_objects_.
4109         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4110         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4111         (Sized_incremental_binary::file_is_unchanged): Remove.
4112         (Sized_incremental_binary::set_input_object): New function.
4113         (Sized_incremental_binary::input_object): New function.
4114         (Sized_incremental_binary::file_status_): Remove.
4115         (Sized_incremental_binary::input_objects_): New data member.
4116         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4117         references.
4118         (Sized_relobj_incr::invalid_address): Move to base class.
4119         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4120         class.
4121         (Sized_relobj_incr::do_output_section_offset): Likewise.
4122         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4123         (Sized_relobj_incr::section_offsets_): Likewise.
4124         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4125         function.
4126         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4127         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4128         with accessor function.
4129         (Sized_relobj_file::do_layout): Likewise.
4130         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4131         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4132         (Sized_relobj_file::compute_final_local_value): Replace refs to
4133         section_offsets_ with accessor function.
4134         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4135         * object.h (Relobj::Relobj): Initialize new data members.
4136         (Relobj::add_dyn_reloc): New function.
4137         (Relobj::first_dyn_reloc): New function.
4138         (Relobj::dyn_reloc_count): New function.
4139         (Relobj::first_dyn_reloc_): New data member.
4140         (Relobj::dyn_reloc_count_): New data member.
4141         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4142         references.
4143         (Sized_relobj::Address): New typedef.
4144         (Sized_relobj::invalid_address): Move here from child class.
4145         (Sized_relobj::Sized_relobj): Initialize new data members.
4146         (Sized_relobj::sized_relobj): New function.
4147         (Sized_relobj::is_output_section_offset_invalid): Move here from
4148         child class.
4149         (Sized_relobj::get_output_section_offset): Likewise.
4150         (Sized_relobj::local_has_got_offset): Likewise.
4151         (Sized_relobj::local_got_offset): Likewise.
4152         (Sized_relobj::set_local_got_offset): Likewise.
4153         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4154         (Sized_relobj::clear_got_offsets): New function.
4155         (Sized_relobj::section_offsets): Move here from child class.
4156         (Sized_relobj::do_output_section_offset): Likewise.
4157         (Sized_relobj::do_set_section_offset): Likewise.
4158         (Sized_relobj::Local_got_offsets): Likewise.
4159         (Sized_relobj::local_got_offsets_): Likewise.
4160         (Sized_relobj::section_offsets_): Likewise.
4161         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4162         references.
4163         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4164         class.
4165         (Sized_relobj_file::sized_relobj): New function
4166         (Sized_relobj_file::local_has_got_offset): Move to base class.
4167         (Sized_relobj_file::local_got_offset): Likewise.
4168         (Sized_relobj_file::set_local_got_offset): Likewise.
4169         (Sized_relobj_file::get_output_section_offset): Likewise.
4170         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4171         (Sized_relobj_file::do_output_section_offset): Likewise.
4172         (Sized_relobj_file::do_set_section_offset): Likewise.
4173         (Sized_relobj_file::Local_got_offsets): Likewise.
4174         (Sized_relobj_file::local_got_offsets_): Likewise.
4175         (Sized_relobj_file::section_offsets_): Likewise.
4176         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4177         (all constructors).
4178         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4179         (Output_reloc::get_symbol_index): Likewise.
4180         (Output_reloc::local_section_offset): Likewise.
4181         (Output_reloc::get_address): Likewise.
4182         (Output_reloc::symbol_value): Likewise.
4183         (Output_data_got::reserve_slot): Move to class definition.
4184         (Output_data_got::reserve_local): New function.
4185         (Output_data_got::reserve_slot_for_global): Remove.
4186         (Output_data_got::reserve_global): New function.
4187         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4188         (all constructors, two instantiations).
4189         (Output_reloc::get_relobj): New function (two instantiations).
4190         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4191         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4192         (Output_data_reloc::add_global): Adjust type of relobj.
4193         (Output_data_reloc::add_global_relative): Likewise.
4194         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4195         (Output_data_reloc::add_local): Likewise.
4196         (Output_data_reloc::add_local_relative): Likewise.
4197         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4198         (Output_data_reloc::add_local_section): Likewise.
4199         (Output_data_reloc::add_output_section): Likewise.
4200         (Output_data_reloc::add_absolute): Likewise.
4201         (Output_data_reloc::add_target_specific): Likewise.
4202         (Output_data_got::reserve_slot): Move definition here.
4203         (Output_data_got::reserve_local): New function.
4204         (Output_data_got::reserve_global): New function.
4205         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4206         section_offsets_ with accessor function.
4207         (Sized_relobj_file::write_sections): Likewise.
4208         (Sized_relobj_file::do_relocate_sections): Likewise.
4209         * target.h (Sized_target::reserve_local_got_entry): New function.
4210         (Sized_target::reserve_global_got_entry): New function.
4211         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4212         (Target_x86_64::reserve_global_got_entry): New function.
4213         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4214
4215 2011-05-23 Cary Coutant  <ccoutant@google.com>
4216
4217         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4218         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4219         bit when checking got_type.
4220         * incremental.cc (Sized_incremental_binary::setup_readers):
4221         Store symbol table and string table locations; initialize bit vector
4222         of file status flags.
4223         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4224         unchanged files.
4225         (Sized_incremental_binary::do_process_got_plt): New function.
4226         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4227         (Output_section_incremental_inputs::set_final_data_size): Record
4228         file index for each input file.
4229         (Output_section_incremental_inputs::write_got_plt): Store file index
4230         instead of input entry offset for each GOT entry.
4231         * incremental.h
4232         (Incremental_input_entry::Incremental_input_entry): Initialize new
4233         data member.
4234         (Incremental_input_entry::set_offset): Store file index.
4235         (Incremental_input_entry::get_file_index): New function.
4236         (Incremental_input_entry::file_index_): New data member.
4237         (Incremental_binary::process_got_plt): New function.
4238         (Incremental_binary::do_process_got_plt): New function.
4239         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4240         data members.
4241         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4242         (Sized_incremental_binary::set_file_is_unchanged): New function.
4243         (Sized_incremental_binary::file_is_unchanged): New function.
4244         (Sized_incremental_binary::do_process_got_plt): New function.
4245         (Sized_incremental_binary::file_status_): New data member.
4246         (Sized_incremental_binary::main_symtab_loc_): New data member.
4247         (Sized_incremental_binary::main_strtab_loc_): New data member.
4248         * output.cc (Output_data_got::Got_entry::write): Add case
4249         RESERVED_CODE.
4250         (Output_data_got::add_global): Call add_got_entry.
4251         (Output_data_got::add_global_plt): Likewise.
4252         (Output_data_got::add_global_with_rel): Likewise.
4253         (Output_data_got::add_global_with_rela): Likewise.
4254         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4255         (Output_data_got::add_global_pair_with_rela): Likewise.
4256         (Output_data_got::add_local): Call add_got_entry.
4257         (Output_data_got::add_local_plt): Likewise.
4258         (Output_data_got::add_local_with_rel): Likewise.
4259         (Output_data_got::add_local_with_rela): Likewise.
4260         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4261         (Output_data_got::add_local_pair_with_rela): Likewise.
4262         (Output_data_got::reserve_slot): New function.
4263         (Output_data_got::reserve_slot_for_global): New function.
4264         (Output_data_got::add_got_entry): New function.
4265         (Output_data_got::add_got_entry_pair): New function.
4266         (Output_section::add_output_section_data): Edit FIXME.
4267         * output.h
4268         (Output_section_data_build::Output_section_data_build): New
4269         constructor with size parameter.
4270         (Output_data_space::Output_data_space): Likewise.
4271         (Output_data_got::Output_data_got): Initialize new data member; new
4272         constructor with size parameter.
4273         (Output_data_got::add_constant): Call add_got_entry.
4274         (Output_data_got::reserve_slot): New function.
4275         (Output_data_got::reserve_slot_for_global): New function.
4276         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4277         (Output_data_got::add_got_entry): New function.
4278         (Output_data_got::add_got_entry_pair): New function.
4279         (Output_data_got::free_list_): New data member.
4280         * target.h (Sized_target::init_got_plt_for_update): New function.
4281         (Sized_target::register_global_plt_entry): New function.
4282         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4283         Initialize new data member; call init; add constructor with PLT count.
4284         (Output_data_plt_x86_64::init): New function.
4285         (Output_data_plt_x86_64::add_relocation): New function.
4286         (Output_data_plt_x86_64::reserve_slot): New function.
4287         (Output_data_plt_x86_64::free_list_): New data member.
4288         (Target_x86_64::init_got_plt_for_update): New function.
4289         (Target_x86_64::register_global_plt_entry): New function.
4290         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4291         incremental updates.
4292         (Output_data_plt_x86_64::add_relocation): New function.
4293         * testsuite/object_unittest.cc (Object_test): Set default options.
4294
4295 2011-05-16  Ian Lance Taylor  <iant@google.com>
4296
4297         * options.h (class General_options): Make -i a synonym for -r.
4298
4299 2011-05-16  Ian Lance Taylor  <iant@google.com>
4300
4301         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4302
4303 2011-05-10 Cary Coutant  <ccoutant@google.com>
4304
4305         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4306         strip_all (-s).
4307
4308 2011-05-06  Ian Lance Taylor  <iant@google.com>
4309
4310         * layout.cc (Layout::layout): If the output section flags change,
4311         update the ordering.
4312
4313 2011-04-25 Cary Coutant  <ccoutant@google.com>
4314
4315         * incremental-dump.cc (dump_incremental_inputs): Print local
4316         symbol info for each input file.
4317         * incremental.cc
4318         (Output_section_incremental_inputs::set_final_data_size): Add local
4319         symbol info to input file entries in incremental info.
4320         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4321         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4322         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4323         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4324         implementation.
4325         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4326         (Sized_incr_relobj::do_relocate): Write the local symbols.
4327         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4328         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4329         Adjust size of input file header.
4330         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4331         (Incremental_inputs_reader::get_local_symbol_count): New function.
4332         (Incremental_inputs_reader::get_input_section): Adjust size of input
4333         file header.
4334         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4335         (Sized_incr_relobj::This): New typedef.
4336         (Sized_incr_relobj::sym_size): New const data member.
4337         (Sized_incr_relobj::Local_symbol): New struct.
4338         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4339         (Sized_incr_relobj::do_local_symbol_offset): New function.
4340         (Sized_incr_relobj::local_symbol_count_): New data member.
4341         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4342         (Sized_incr_relobj::local_symbol_index_): New data member.
4343         (Sized_incr_relobj::local_symbol_offset_): New data member.
4344         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4345         (Sized_incr_relobj::local_symbols_): New data member.
4346         * object.h (Relobj::output_local_symbol_count): New function.
4347         (Relobj::local_symbol_offset): New function.
4348         (Relobj::do_output_local_symbol_count): New function.
4349         (Relobj::do_local_symbol_offset): New function.
4350         (Sized_relobj::do_output_local_symbol_count): New function.
4351         (Sized_relobj::do_local_symbol_offset): New function.
4352
4353 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4354
4355         * descriptors.cc (set_close_on_exec): New function.
4356         (Descriptors::open): Use set_close_on_exec.
4357         * output.cc (S_ISLNK): Define if not defined.
4358
4359 2011-04-22 Cary Coutant  <ccoutant@google.com>
4360
4361         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4362         global symbol map.
4363         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4364         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4365         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4366         relocations.
4367         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4368         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4369         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4370         * incremental.h
4371         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4372         function.
4373         (Incremental_binary::apply_incremental_relocs): New function.
4374         (Incremental_binary::do_apply_incremental_relocs): New function.
4375         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4376         data member.
4377         (Sized_incremental_binary::add_global_symbol): New function.
4378         (Sized_incremental_binary::global_symbol): New function.
4379         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4380         (Sized_incremental_binary::symbol_map_): New data member.
4381         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4382         * target.h (Sized_target::apply_relocation): New function.
4383         * target-reloc.h (apply_relocation): New function.
4384         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4385
4386 2011-04-22  Doug Kwan  <dougkwan@google.com>
4387
4388         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4389         flag of a SHT_ARM_EXIDX section.
4390         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4391         * testsuite/Makefile.in: Regenerate.
4392         * testsuite/arm_exidx_test.s: New file.
4393         * testsuite/arm_exidx_test.sh: Same.
4394
4395 2011-04-20 Cary Coutant  <ccoutant@google.com>
4396
4397         PR gold/12689
4398         * archive.h (Incremental_archive_entry::Archive_member):
4399         Initialize arg_serial_ (second constructor).
4400
4401 2011-04-17  Ian Lance Taylor  <iant@google.com>
4402
4403         * object.cc (Relocate_info::location): Simplify location string.
4404         * errors.cc (Errors::error_at_location): Don't print program
4405         name.
4406         (Errors::warning_at_location): Likewise.
4407         (Errors::undefined_symbol): Likewise.
4408         * testsuite/debug_msg.sh: Update accordingly.
4409
4410 2011-04-14 Cary Coutant  <ccoutant@google.com>
4411
4412         * gold/layout.cc (Layout::symtab_section_offset): New function.
4413         * gold/layout.h (Layout::symtab_section_offset): New function.
4414         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4415
4416 2011-04-12  Ian Lance Taylor  <iant@google.com>
4417
4418         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4419         with MREMAP_MAYMOVE.
4420         * output.h (class Output_file): Add map_is_allocated_ field.
4421         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4422         not available, provide stubs.  If mremap is not available, #define
4423         it to gold_mremap.
4424         (MREMAP_MAYMOVE): Define if not defined.
4425         (Output_file::Output_file): Initialize map_is_allocated_.
4426         (Output_file::resize): Check map_is_allocated_.
4427         (Output_file::map_anonymous): If mmap fails, use malloc.
4428         (Output_file::unmap): Don't do anything for an anonymous map.
4429         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4430         is not available, provide stubs.
4431         (File_read::View::~View): Use free rather than delete[].
4432         (File_read::make_view): Use malloc rather than new[].  If mmap
4433         fails, use malloc.
4434         (File_read::find_or_make_view): Use malloc rather than new[].
4435         * gold.h: Remove HAVE_REMAP code.
4436         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4437         exists.  Rename mremap to gold_mremap.  If mmap is not available
4438         don't do anything.
4439         * configure, config.in: Rebuild.
4440
4441 2011-04-11  Ian Lance Taylor  <iant@google.com>
4442
4443         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4444         initialize local variable v.
4445
4446 2011-04-11  Cary Coutant  <ccoutant@google.com>
4447
4448         * archive.cc (Archive::include_member): Adjust call to
4449         report_object.
4450         (Add_archive_symbols::run): Track argument serial numbers.
4451         (Lib_group::include_member): Likewise.
4452         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4453         * archive.h (Incremental_archive_entry::Archive_member):
4454         Initialize arg_serial_.
4455         (Archive_member::arg_serial_): New data member.
4456         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4457         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4458         incremental link.
4459         (Sized_dynobj::do_for_all_local_got_entries): New function.
4460         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4461         function.
4462         * fileread.cc (get_mtime): New function.
4463         * fileread.h (get_mtime): New function.
4464         * gold.cc (queue_initial_tasks): Check for incremental update.
4465         (process_incremental_input): New function.
4466         (queue_middle_tasks): Don't force valid target for incremental
4467         update.
4468         * incremental-dump.cc (find_input_containing_global): Adjust
4469         size of symbol info entry.
4470         (dump_incremental_inputs): Dump argument serial number and
4471         in_system_directory flag; bias shndx by 1; print symbol names
4472         when dumping per-file symbol lists; use new symbol info readers.
4473         * incremental.cc
4474         (Output_section_incremental_inputs:update_data_size): New function.
4475         (Sized_incremental_binary::setup_readers): Setup input readers
4476         for each input file; build maps for files added from libraries
4477         and scripts.
4478         (Sized_incremental_binary::check_input_args): New function.
4479         (Sized_incremental_binary::do_check_inputs): Build map of argument
4480         serial numbers to input arguments.
4481         (Sized_incremental_binary::do_file_has_changed): Rename
4482         do_file_is_unchanged to this; compare file modification times.
4483         (Sized_incremental_binary::do_init_layout): New function.
4484         (Sized_incremental_binary::do_reserve_layout): New function.
4485         (Sized_incremental_binary::do_get_input_reader): Remove.
4486         (Sized_incremental_binary::get_symtab_view): New function.
4487         (Incremental_checker::can_incrementally_link_output_file): Remove.
4488         (Incremental_inputs::report_command_line): Exclude --debug options.
4489         (Incremental_inputs::report_archive_begin): Add parameter; track
4490         argument serial numbers; don't put input file entry for archive
4491         before archive members.
4492         (Incremental_inputs::report_archive_end): Put input file entry
4493         for archive after archive members.
4494         (Incremental_inputs::report_object): Add parameter; track argument
4495         serial numbers and in_system_directory flag.
4496         (Incremental_inputs::report_script): Add parameter; track argument
4497         serial numbers.
4498         (Output_section_incremental_inputs::set_final_data_size): Adjust
4499         size of symbol info entry; check for forwarding symbols.
4500         (Output_section_incremental_inputs::write_input_files): Write
4501         in_system_directory flag and argument serial number.
4502         (Output_section_incremental_inputs::write_info_blocks): Map section
4503         indices between incremental info and original input file; store
4504         input section index for each symbol.
4505         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4506         change operator() to visit().
4507         (class Global_got_offset_visitor): Likewise.
4508         (class Global_symbol_visitor_got_plt):
4509         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4510         classes.
4511         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4512         (Sized_incr_relobj::do_read_symbols): New function.
4513         (Sized_incr_relobj::do_layout): New function.
4514         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4515         (Sized_incr_relobj::do_add_symbols): New function.
4516         (Sized_incr_relobj::do_should_include_member): New function.
4517         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4518         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4519         (Sized_incr_relobj::do_section_size): New function.
4520         (Sized_incr_relobj::do_section_name): New function.
4521         (Sized_incr_relobj::do_section_contents): New function.
4522         (Sized_incr_relobj::do_section_flags): New function.
4523         (Sized_incr_relobj::do_section_entsize): New function.
4524         (Sized_incr_relobj::do_section_address): New function.
4525         (Sized_incr_relobj::do_section_type): New function.
4526         (Sized_incr_relobj::do_section_link): New function.
4527         (Sized_incr_relobj::do_section_info): New function.
4528         (Sized_incr_relobj::do_section_addralign): New function.
4529         (Sized_incr_relobj::do_initialize_xindex): New function.
4530         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4531         (Sized_incr_relobj::do_read_relocs): New function.
4532         (Sized_incr_relobj::do_gc_process_relocs): New function.
4533         (Sized_incr_relobj::do_scan_relocs): New function.
4534         (Sized_incr_relobj::do_count_local_symbols): New function.
4535         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4536         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4537         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4538         (Sized_incr_relobj::do_relocate): New function.
4539         (Sized_incr_relobj::do_set_section_offset): New function.
4540         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4541         (Sized_incr_dynobj::do_read_symbols): New function.
4542         (Sized_incr_dynobj::do_layout): New function.
4543         (Sized_incr_dynobj::do_add_symbols): New function.
4544         (Sized_incr_dynobj::do_should_include_member): New function.
4545         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4546         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4547         (Sized_incr_dynobj::do_section_size): New function.
4548         (Sized_incr_dynobj::do_section_name): New function.
4549         (Sized_incr_dynobj::do_section_contents): New function.
4550         (Sized_incr_dynobj::do_section_flags): New function.
4551         (Sized_incr_dynobj::do_section_entsize): New function.
4552         (Sized_incr_dynobj::do_section_address): New function.
4553         (Sized_incr_dynobj::do_section_type): New function.
4554         (Sized_incr_dynobj::do_section_link): New function.
4555         (Sized_incr_dynobj::do_section_info): New function.
4556         (Sized_incr_dynobj::do_section_addralign): New function.
4557         (Sized_incr_dynobj::do_initialize_xindex): New function.
4558         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4559         (make_sized_incremental_object): New function.
4560         (Incremental_library::copy_unused_symbols): New function.
4561         (Incremental_library::do_for_all_unused_symbols): New function.
4562         * incremental.h (enum Incremental_input_flags): New type.
4563         (class Incremental_checker): Remove.
4564         (Incremental_input_entry::Incremental_input_entry): Add argument
4565         serial number.
4566         (Incremental_input_entry::arg_serial): New function.
4567         (Incremental_input_entry::set_is_in_system_directory): New function.
4568         (Incremental_input_entry::is_in_system_directory): New function.
4569         (Incremental_input_entry::arg_serial_): New data member.
4570         (Incremental_input_entry::is_in_system_directory_): New data member.
4571         (class Script_info): Move here from script.h.
4572         (Script_info::Script_info): Add filename parameter.
4573         (Script_info::filename): New function.
4574         (Script_info::filename_): New data member.
4575         (Incremental_script_entry::Incremental_script_entry): Add argument
4576         serial number.
4577         (Incremental_object_entry::Incremental_object_entry): Likewise.
4578         (Incremental_object_entry::add_input_section): Build list of input
4579         sections with map to original shndx.
4580         (Incremental_object_entry::get_input_section_index): New function.
4581         (Incremental_object_entry::shndx_): New data member.
4582         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4583         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4584         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4585         serial number.
4586         (Incremental_inputs::report_archive_begin): Likewise.
4587         (Incremental_inputs::report_object): Likewise.
4588         (Incremental_inputs::report_script): Likewise.
4589         (class Incremental_global_symbol_reader): New class.
4590         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4591         and store flags and input file type.
4592         (Incremental_input_entry_reader::arg_serial): New function.
4593         (Incremental_input_entry_reader::type): Extract type from flags.
4594         (Incremental_input_entry_reader::is_in_system_directory): New function.
4595         (Incremental_input_entry_reader::get_input_section_count): Call
4596         accessor function for type.
4597         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4598         function for type; adjust size of global symbol entry.
4599         (Incremental_input_entry_reader::get_global_symbol_count): Call
4600         accessor function for type.
4601         (Incremental_input_entry_reader::get_object_count): Likewise.
4602         (Incremental_input_entry_reader::get_object_offset): Likewise.
4603         (Incremental_input_entry_reader::get_member_count): Likewise.
4604         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4605         (Incremental_input_entry_reader::get_member_offset): Likewise.
4606         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4607         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4608         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4609         (Incremental_input_entry_reader::get_global_symbol_reader): New
4610         function.
4611         (Incremental_input_entry_reader::get_output_symbol_index): New
4612         function.
4613         (Incremental_input_entry_reader::type_): Remove.
4614         (Incremental_input_entry_reader::flags_): New data member.
4615         (Incremental_inputs_reader::input_file_offset): New function.
4616         (Incremental_inputs_reader::input_file_index): New function.
4617         (Incremental_inputs_reader::input_file): Call input_file_offset.
4618         (Incremental_inputs_reader::input_file_at_offset): New function.
4619         (Incremental_relocs_reader::get_r_type): Reformat.
4620         (Incremental_relocs_reader::get_r_shndx): Reformat.
4621         (Incremental_relocs_reader::get_r_offset): Reformat.
4622         (Incremental_relocs_reader::data): New function.
4623         (Incremental_binary::Incremental_binary): Initialize new data members.
4624         (Incremental_binary::check_inputs): Add cmdline parameter.
4625         (Incremental_binary::file_is_unchanged): Remove.
4626         (Input_reader::arg_serial): New function.
4627         (Input_reader::get_unused_symbol_count): New function.
4628         (Input_reader::get_unused_symbol): New function.
4629         (Input_reader::do_arg_serial): New function.
4630         (Input_reader::do_get_unused_symbol_count): New function.
4631         (Input_reader::do_get_unused_symbol): New function.
4632         (Incremental_binary::input_file_count): New function.
4633         (Incremental_binary::get_input_reader): Change signature to use
4634         index instead of filename.
4635         (Incremental_binary::file_has_changed): New function.
4636         (Incremental_binary::get_input_argument): New function.
4637         (Incremental_binary::get_library): New function.
4638         (Incremental_binary::get_script_info): New function.
4639         (Incremental_binary::init_layout): New function.
4640         (Incremental_binary::reserve_layout): New function.
4641         (Incremental_binary::output_file): New function.
4642         (Incremental_binary::do_check_inputs): New function.
4643         (Incremental_binary::do_file_is_unchanged): Remove.
4644         (Incremental_binary::do_file_has_changed): New function.
4645         (Incremental_binary::do_init_layout): New function.
4646         (Incremental_binary::do_reserve_layout): New function.
4647         (Incremental_binary::do_input_file_count): New function.
4648         (Incremental_binary::do_get_input_reader): Change signature.
4649         (Incremental_binary::input_args_map_): New data member.
4650         (Incremental_binary::library_map_): New data member.
4651         (Incremental_binary::script_map_): New data member.
4652         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4653         new data members.
4654         (Sized_incremental_binary::output_section): New function.
4655         (Sized_incremental_binary::inputs_reader): Add const.
4656         (Sized_incremental_binary::symtab_reader): Add const.
4657         (Sized_incremental_binary::relocs_reader): Add const.
4658         (Sized_incremental_binary::got_plt_reader): Add const.
4659         (Sized_incremental_binary::get_symtab_view): New function.
4660         (Sized_incremental_binary::Inputs_reader): New typedef.
4661         (Sized_incremental_binary::Input_entry_reader): New typedef.
4662         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4663         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4664         (Sized_incremental_binary::do_file_has_changed): New function.
4665         (Sized_incremental_binary::do_init_layout): New function.
4666         (Sized_incremental_binary::do_reserve_layout): New function.
4667         (Sized_input_reader::Inputs_reader): Remove.
4668         (Sized_input_reader::Input_entry_reader): Remove.
4669         (Sized_input_reader::do_arg_serial): New function.
4670         (Sized_input_reader::do_get_unused_symbol_count): New function.
4671         (Sized_input_reader::do_get_unused_symbol): New function.
4672         (Sized_incremental_binary::do_input_file_count): New function.
4673         (Sized_incremental_binary::do_get_input_reader): Change signature;
4674         use index instead of filename.
4675         (Sized_incremental_binary::section_map_): New data member.
4676         (Sized_incremental_binary::input_entry_readers_): New data member.
4677         (class Sized_incr_relobj): New class.
4678         (class Sized_incr_dynobj): New class.
4679         (make_sized_incremental_object): New function.
4680         (class Incremental_library): New class.
4681         * layout.cc (Free_list::num_lists): New static data member.
4682         (Free_list::num_nodes): New static data member.
4683         (Free_list::num_removes): New static data member.
4684         (Free_list::num_remove_visits): New static data member.
4685         (Free_list::num_allocates): New static data member.
4686         (Free_list::num_allocate_visits): New static data member.
4687         (Free_list::init): New function.
4688         (Free_list::remove): New function.
4689         (Free_list::allocate): New function.
4690         (Free_list::dump): New function.
4691         (Free_list::print_stats): New function.
4692         (Layout_task_runner::run): Resize output file for incremental updates.
4693         (Layout::Layout): Initialize new data members.
4694         (Layout::set_incremental_base): New function.
4695         (Layout::init_fixed_output_section): New function.
4696         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4697         incremental updates.
4698         (Layout::create_gold_note): Do not create gold note section for
4699         incremental updates.
4700         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4701         for incremental updates.
4702         (Layout::set_section_offsets): For incremental updates, allocate space
4703         from free list.
4704         (Layout::create_symtab_sections): Layout with offsets relative to
4705         start of section; for incremental updates, allocate space from free
4706         list.
4707         (Layout::create_shdrs): For incremental updates, allocate space from
4708         free list.
4709         (Layout::finish_dynamic_section): For incremental updates, do not
4710         check --as-needed (fixed in subsequent patch).
4711         * layout.h (class Free_list): New class.
4712         (Layout::set_incremental_base): New function.
4713         (Layout::incremental_base): New function.
4714         (Layout::init_fixed_output_section): New function.
4715         (Layout::allocate): New function.
4716         (Layout::incremental_base_): New data member.
4717         (Layout::free_list_): New data member.
4718         * main.cc (main): Print Free_list statistics.
4719         * object.cc (Relobj::finalize_incremental_relocs): Add
4720         clear_counts parameter; clear counts only when clear_counts is set.
4721         (Sized_relobj::Sized_relobj): Initialize new base class.
4722         (Sized_relobj::do_layout): Don't report special sections.
4723         (Sized_relobj::do_for_all_local_got_entries): New function.
4724         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4725         symtab_off to all symbol table offsets.
4726         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4727         * object.h (class Got_offset_list): Move to top of file.
4728         (Object::Object): Allow case where input_file == NULL.
4729         (Object::~Object): Likewise.
4730         (Object::input_file): Assert that input_file != NULL.
4731         (Object::lock): Allow case where input_file == NULL.
4732         (Object::unlock): Likewise.
4733         (Object::is_locked): Likewise.
4734         (Object::token): Likewise.
4735         (Object::release): Likewise.
4736         (Object::is_incremental): New function.
4737         (Object::get_mtime): New function.
4738         (Object::for_all_local_got_entries): New function.
4739         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4740         (Object::set_is_in_system_directory): New function.
4741         (Object::is_in_system_directory): New function.
4742         (Object::do_is_incremental): New function.
4743         (Object::do_get_mtime): New function.
4744         (Object::do_for_all_local_got_entries): New function.
4745         (Object::is_in_system_directory_): New data member.
4746         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4747         (class Sized_relobj_base): New class.
4748         (class Sized_relobj): Derive from Sized_relobj_base.
4749         (class Sized_relobj::Symbols): Redeclare from base class.
4750         (class Sized_relobj::local_got_offset_list): Remove.
4751         (class Sized_relobj::Output_sections): Redeclare from base class.
4752         (class Sized_relobj::do_for_all_local_got_entries): New function.
4753         (class Sized_relobj::write_local_symbols): Add offset parameter.
4754         (class Sized_relobj::local_symbol_offset_): Update comment.
4755         (class Sized_relobj::local_dynsym_offset_): Update comment.
4756         * options.cc (Input_arguments::add_file): Remove const.
4757         * options.h (Input_file_argument::Input_file_argument):
4758         Initialize arg_serial_ (all constructors).
4759         (Input_file_argument::set_arg_serial): New function.
4760         (Input_file_argument::arg_serial): New function.
4761         (Input_file_argument::arg_serial_): New data member.
4762         (Input_arguments::Input_arguments): Initialize file_count_.
4763         (Input_arguments::add_file): Remove const.
4764         (Input_arguments::number_of_input_files): New function.
4765         (Input_arguments::file_count_): New data member.
4766         (Command_line::number_of_input_files): Call
4767         Input_arguments::number_of_input_files.
4768         * output.cc (Output_segment_headers::Output_segment_headers):
4769         Set current size.
4770         (Output_section::Input_section::current_data_size): New function.
4771         (Output_section::Output_section): Initialize new data members.
4772         (Output_section::add_input_section): Don't do merge sections for
4773         an incremental link; allocate space from free list for an
4774         incremental update.
4775         (Output_section::add_output_section_data): Allocate space from
4776         free list for an incremental update.
4777         (Output_section::update_data_size): New function.
4778         (Output_section::set_fixed_layout): New function.
4779         (Output_section::reserve): New function.
4780         (Output_segment::set_section_addresses): Remove const.
4781         (Output_segment::set_section_list_addresses): Remove const; allocate
4782         space from free list for an incremental update.
4783         (Output_segment::set_offset): Adjust size of RELRO segment for an
4784         incremental update.
4785         * output.h (Output_data::current_data_size): Move here from
4786         child classes.
4787         (Output_data::pre_finalize_data_size): New function.
4788         (Output_data::update_data_size): New function.
4789         (Output_section_headers::update_data_size): new function.
4790         (Output_section_data_build::current_data_size): Move to Output_data.
4791         (Output_data_strtab::update_data_size): New function.
4792         (Output_section::current_data_size): Move to Output_data.
4793         (Output_section::set_fixed_layout): New function.
4794         (Output_section::has_fixed_layout): New function.
4795         (Output_section::reserve): New function.
4796         (Output_section::update_data_size): New function.
4797         (Output_section::has_fixed_layout_): New data member.
4798         (Output_section::free_list_): New data member.
4799         (Output_segment::set_section_addresses): Remove const.
4800         (Output_segment::set_section_list_addresses): Remove const.
4801         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4802         New function.
4803         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4804         New function.
4805         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4806         parameter when calling Add_symbols constructor; store argument
4807         serial number for members of a lib group.
4808         (Add_symbols::locks): Allow case where token == NULL.
4809         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4810         (Read_member::~Read_member): New function.
4811         (Read_member::is_runnable): New function.
4812         (Read_member::locks): New function.
4813         (Read_member::run): New function.
4814         (Check_script::~Check_script): New function.
4815         (Check_script::is_runnable): New function.
4816         (Check_script::locks): New function.
4817         (Check_script::run): New function.
4818         (Check_library::~Check_library): New function.
4819         (Check_library::is_runnable): New function.
4820         (Check_library::locks): New function.
4821         (Check_library::run): New function.
4822         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4823         (Add_symbols::library_): New data member.
4824         (class Read_member): New class.
4825         (class Check_script): New class.
4826         (class Check_library): New class.
4827         * reloc.cc (Read_relocs::is_runnable): Allow case where
4828         token == NULL.
4829         (Read_relocs::locks): Likewise.
4830         (Scan_relocs::locks): Likewise.
4831         (Relocate_task::locks): Likewise.
4832         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4833         to clear counters.
4834         (Sized_relobj::incremental_relocs_scan): Fix comment.
4835         (Sized_relobj::do_relocate): Pass output file offset to
4836         write_local_symbols.
4837         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4838         from class declaration.
4839         * script.cc (read_input_script): Allocate Script_info; pass
4840         argument serial number to report_script.
4841         * script.h (class Script_info): Move to incremental.h.
4842         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4843         * symtab.h (Symbol_table::add_from_incrobj): New function.
4844         (Symbol_table::set_file_offset): New function.
4845
4846 2011-04-05  Cary Coutant  <ccoutant@google.com>
4847
4848         * incremental-dump.cc (dump_incremental_inputs): Change signature
4849         to take a Sized_incremental_binary; change caller.  Use readers
4850         in Sized_incremental_binary.
4851         * incremental.cc
4852         (Sized_incremental_binary::find_incremental_inputs_sections):
4853         Rename do_find_incremental_inputs_sections to this.
4854         (Sized_incremental_binary::setup_readers): New function.
4855         (Sized_incremental_binary::do_check_inputs): Check
4856         has_incremental_info_ flag; move setup code to setup_readers;
4857         use input readers.
4858         (Sized_incremental_binary::do_file_is_unchanged): New function.
4859         (Sized_incremental_binary::do_get_input_reader): New function.
4860         * incremental.h (class Incremental_binary): Move to end of file.
4861         (Incremental_binary::file_is_unchanged): New function.
4862         (Incremental_binary::do_file_is_unchanged): New function.
4863         (Incremental_binary::Input_reader): New class.
4864         (Incremental_binary::get_input_reader): New function.
4865         (class Sized_incremental_binary): Move to end of file.
4866         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4867         input section reader classes.
4868         (Sized_incremental_binary::has_incremental_info): New function.
4869         (Sized_incremental_binary::inputs_reader): New function.
4870         (Sized_incremental_binary::symtab_reader): New function.
4871         (Sized_incremental_binary::relocs_reader): New function.
4872         (Sized_incremental_binary::got_plt_reader): New function.
4873         (Sized_incremental_binary::do_file_is_unchanged): New function.
4874         (Sized_incremental_binary::Sized_input_reader): New class.
4875         (Sized_incremental_binary::get_input_reader): New function.
4876         (Sized_incremental_binary::find_incremental_inputs_sections):
4877         Rename do_find_incremental_inputs_sections to this.
4878         (Sized_incremental_binary::setup_readers): New function.
4879         (Sized_incremental_binary::has_incremental_info_): New data member.
4880         (Sized_incremental_binary::inputs_reader_): New data member.
4881         (Sized_incremental_binary::symtab_reader_): New data member.
4882         (Sized_incremental_binary::relocs_reader_): New data member.
4883         (Sized_incremental_binary::got_plt_reader_): New data member.
4884         (Sized_incremental_binary::current_input_file_): New data member.
4885
4886 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4887
4888         PR gold/12640
4889         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4890         violation.
4891
4892 2011-03-30  Cary Coutant  <ccoutant@google.com>
4893
4894         * archive.cc (Archive::include_member): Adjust call to report_object.
4895         (Add_archive_symbols::run): Add script_info to call to
4896         report_archive_begin.
4897         (Lib_group::include_member): Adjust call to report_object.
4898         (Add_lib_group_symbols::run): Adjust call to report_object.
4899         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4900         blocks.  Add object count for script input files.
4901         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4902         script_info parameter; change all callers.
4903         (Incremental_inputs::report_object): Add script_info parameter;
4904         change all callers.
4905         (Incremental_inputs::report_script): Store backpointer to
4906         incremental info entry.
4907         (Output_section_incremental_inputs::set_final_data_size): Record
4908         additional information for scripts.
4909         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4910         * incremental.h (Incremental_script_entry::add_object): New function.
4911         (Incremental_script_entry::get_object_count): New function.
4912         (Incremental_script_entry::get_object): New function.
4913         (Incremental_script_entry::objects_): New data member; adjust
4914         constructor.
4915         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4916         (Incremental_inputs::report_object): Add script_info parameter.
4917         (Incremental_inputs_reader::get_object_count): New function.
4918         (Incremental_inputs_reader::get_object_offset): New function.
4919         * options.cc (Input_arguments::add_file): Return reference to
4920         new input argument.
4921         * options.h (Input_argument::set_script_info): New function.
4922         (Input_argument::script_info): New function.
4923         (Input_argument::script_info_): New data member; adjust all
4924         constructors.
4925         (Input_file_group::add_file): Return reference to new input argument.
4926         (Input_file_lib::add_file): Likewise.
4927         (Input_arguments::add_file): Likewise.
4928         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4929         * script.cc (Parser_closure::Parser_closure): Add script_info
4930         parameter; adjust all callers.
4931         (Parser_closure::script_info): New function.
4932         (Parser_closure::script_info_): New data member.
4933         (read_input_script): Report scripts earlier to incremental info.
4934         (script_add_file): Set script_info in Input_argument.
4935         (script_add_library): Likewise.
4936         * script.h (Script_options::Script_info): Rewrite class.
4937
4938 2011-03-29  Cary Coutant  <ccoutant@google.com>
4939
4940         * archive.cc (Library_base::should_include_member): Move
4941         method here from class Archive.
4942         (Archive::Archive): Initialize base class.
4943         (Archive::should_include_member): Move to base class.
4944         (Archive::do_for_all_unused_symbols): New function.
4945         (Add_archive_symbols::run): Remove redundant access to
4946         incremental_inputs.
4947         (Lib_group::Lib_group): Initialize base class.
4948         (Lib_group::do_filename): New function.
4949         (Lib_group::include_member): Pass pointer to Lib_group to
4950         report_object.
4951         (Lib_group::do_for_all_unused_symbols): New function.
4952         (Add_lib_group_symbols::run): Report archive information for
4953         incremental links.
4954         * archive.h (class Library_base): New base class.
4955         (class Archive): Derive from Library_base.
4956         (Archive::filename): Move to base class.
4957         (Archive::set_incremental_info): Likewise.
4958         (Archive::incremental_info): Likewise.
4959         (Archive::Should_include): Likewise.
4960         (Archive::should_include_member): Likewise.
4961         (Archive::Armap_entry): Remove.
4962         (Archive::Unused_symbol_iterator): Remove.
4963         (Archive::unused_symbols_begin): Remove.
4964         (Archive::unused_symbols_end): Remove.
4965         (Archive::do_filename): New function.
4966         (Archive::do_get_mtime): New function.
4967         (Archive::do_for_all_unused_symbols): New function.
4968         (Archive::task_): Move to base class.
4969         (Archive::incremental_info_): Likewise.
4970         (class Lib_group): Derive from Library_base.
4971         (Lib_group::do_filename): New function.
4972         (Lib_group::do_get_mtime): New function.
4973         (Lib_group::do_for_all_unused_symbols): New function.
4974         (Lib_group::task_): Move to base class.
4975         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4976         function.
4977         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4978         function.
4979         * incremental.cc (Incremental_inputs::report_archive_begin):
4980         Use Library_base; call library's get_mtime; add incremental inputs
4981         entry before members.
4982         (class Unused_symbol_visitor): New class.
4983         (Incremental_inputs::report_archive_end): Use Library_base; use
4984         visitor class to record unused symbols; don't add incremental inputs
4985         entry after members.
4986         (Incremental_inputs::report_object): Use Library_base.
4987         * incremental.h
4988         (Incremental_archive_entry::Incremental_archive_entry): Remove
4989         unused Archive parameter.
4990         (Incremental_inputs::report_archive_begin): Use Library_base.
4991         (Incremental_inputs::report_archive_end): Likewise.
4992         (Incremental_inputs::report_object): Likewise.
4993         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4994         function.
4995         * object.h (Object::for_all_global_symbols): New function.
4996         (Object::do_for_all_global_symbols): New function.
4997         (Sized_relobj::do_for_all_global_symbols): New function.
4998         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4999         function.
5000         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5001         function.
5002
5003 2011-03-27  Ian Lance Taylor  <iant@google.com>
5004
5005         * archive.cc (Archive::interpret_header): Return -1 if something
5006         goes wrong.  Change callers accordingly.
5007
5008 2011-03-25  Cary Coutant  <ccoutant@google.com>
5009
5010         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5011         * testsuite/Makefile.in: Regenerate.
5012
5013 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5014
5015         * plugin.cc (get_view): New.
5016         (Plugin::load): Pass get_view to the plugin.
5017         (Plugin_manager::get_view): New.
5018
5019 2011-03-21  Ian Lance Taylor  <iant@google.com>
5020
5021         * testsuite/final_layout.sh: Rewrite to not use dc.
5022         * testsuite/relro_test.sh: Fail if dc is not present.
5023
5024 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5025
5026         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5027         Change == to -eq.
5028         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5029         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5030         Change == to -eq.
5031         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5032         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5033
5034 2011-03-14  Ian Lance Taylor  <iant@google.com>
5035
5036         * script-sections.cc (Sort_output_sections::script_compare):
5037         Rename from is_before, change return type.
5038         (Sort_output_sections::operator()): Adjust accordingly.
5039
5040 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5041
5042         PR gold/12572
5043         * testsuite/odr_violation2.cc: Add comment to make all error line
5044         numbers double digits.
5045         * testsuite/debug_msg.sh: Adjust expected errors.
5046
5047 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5048
5049         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5050         but mark earlier ones as non-canonical
5051         (offset_to_iterator): Update search target and example
5052         (do_addr2line): Return extra lines in a vector*
5053         (format_file_lineno): Extract from do_addr2line
5054         (one_addr2line): Add vector* out-param
5055         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5056         when a lineno entry appeared last for its instruction
5057         (Dwarf_line_info): Add vector* out-param
5058         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5059         * symtab.cc (Odr_violation_compare): Include the lineno in the
5060         comparison again.
5061         (linenos_from_loc): New. Combine the canonical line for an
5062         address with its other lines.
5063         (True_if_intersect): New. Helper functor to make
5064         std::set_intersection a query.
5065         (detect_odr_violations): Compare sets of lines instead of just
5066         one line for each function. This became less deterministic, but
5067         has fewer false positives.
5068         * symtab.h: Declarations.
5069         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5070         mix an optimized and non-optimized object in the same binary
5071         (odr_violation2.so): Same.
5072         * testsuite/Makefile.in: Regenerate from Makefile.am.
5073         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5074         * testsuite/debug_msg.sh: Update line numbers and add
5075         assertions.
5076         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5077         non-optimized context.
5078         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5079         isn't inlined, and use OdrDerived in an optimized context.
5080         * testsuite/odr_header1.h: Defines OdrDerived, where
5081         optimization will change the
5082         first-instruction-in-the-destructor's file and line number.
5083         * testsuite/odr_header2.h: Defines OdrBase.
5084
5085 2011-03-09  Ian Lance Taylor  <iant@google.com>
5086
5087         * fileread.cc (File_read::clear_views): Don't delete the whole
5088         file view.
5089
5090 2011-03-08  Ian Lance Taylor  <iant@google.com>
5091
5092         PR gold/12525
5093         * fileread.cc: #include <climits>.
5094         (GOLD_IOV_MAX): Define.
5095         (File_read::read_multiple): Limit number of entries by iov_max.
5096         * fileread.h (class File_read): Always set max_readv_entries to
5097         128.
5098
5099 2011-03-07  Ian Lance Taylor  <iant@google.com>
5100
5101         PR gold/12525
5102         * options.h (class General_options): Add -dy and -dn.
5103
5104 2011-03-02  Cary Coutant  <ccoutant@google.com>
5105
5106         * testsuite/script_test_9.t: Add TLS segment.
5107
5108 2011-03-02  Simon Baldwin  <simonb@google.com>
5109
5110         * configure.ac: Add check for gnu_indirect_function support in
5111         the toolchain building binutils.
5112         * configure: Rebuild.
5113
5114 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5115
5116         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5117         plugin only symbols.
5118         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5119         in plugin files as not needed in the symbol table.
5120
5121 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5122
5123         * output.cc (Output_section::add_input_section): Delay fill
5124         generation for section ordering.
5125
5126 2011-02-09  Ian Lance Taylor  <iant@google.com>
5127
5128         PR gold/12316
5129         * object.h (class Sized_relobj): Remove clear_local_symbols.
5130         * reloc.cc (Sized_relobj::do_relocate): Don't call
5131         clear_local_symbols.
5132
5133 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5134
5135         * plugin.cc (is_visible_from_outside): Return true for symbols
5136         in the -u option.
5137
5138 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5139
5140         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5141         filename.
5142
5143 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5144
5145         * icf.h (is_section_foldable_candidate): Change type of parameter
5146         to std::string.
5147         * icf.cc (Icf::find_identical_sections): Change type of local variable
5148         section_name to be std::string.
5149         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5150
5151 2011-01-25  Ian Lance Taylor  <iant@google.com>
5152
5153         * script.cc (script_add_extern): Rewrite to use
5154         add_symbol_reference.
5155
5156 2011-01-25  Doug Kwan  <dougkwan@google.com>
5157
5158         * icf.cc (get_section_contents): Always lock section's object.
5159
5160 2011-01-24  Ian Lance Taylor  <iant@google.com>
5161
5162         * options.h (class General_options): Accept
5163         --no-detect-odr-violations.
5164
5165 2011-01-24  Ian Lance Taylor  <iant@google.com>
5166
5167         * version.cc (version_string): Bump to 1.11.
5168
5169 2011-01-24  Ian Lance Taylor  <iant@google.com>
5170
5171         * plugin.cc (class Plugin_rescan): Define new class.
5172         (Plugin_manager::claim_file): Set any_claimed_.
5173         (Plugin_manager::save_archive): New function.
5174         (Plugin_manager::save_input_group): New function.
5175         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5176         necessary.
5177         (Plugin_manager::new_undefined_symbol): New function.
5178         (Plugin_manager::rescan): New function.
5179         (Plugin_manager::rescannable_defines): New function.
5180         (Plugin_manager::add_input_file): Set any_added_.
5181         * plugin.h (class Plugin_manager): define new fields rescannable_,
5182         undefined_symbols_, any_claimed_, and any_added_.  Declare
5183         Plugin_rescan as friend.  Declare new functions.
5184         (Plugin_manager::Rescannable): Define type.
5185         (Plugin_manager::Rescannable_list): Define type.
5186         (Plugin_manager::Undefined_symbol_list): Define type.
5187         (Plugin_manager::Plugin_manager): Initialize new fields.
5188         * archive.cc (Archive::defines_symbol): New function.
5189         (Add_archive_symbols::run): Pass archive to plugins if any.
5190         * archive.h (class Archive): Declare defines_symbol.
5191         * readsyms.cc (Input_group::~Input_group): New function.
5192         (Finish_group::run): Pass input_group to plugins if any.
5193         * readsyms.h (class Input_group): Declare destructor.
5194         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5195         any.
5196
5197 2011-01-10  Ian Lance Taylor  <iant@google.com>
5198
5199         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5200         section as relro.
5201         (Layout::set_segment_offsets): Reset increase_relro before calling
5202         set_section_addresses a second time.
5203
5204 2011-01-04  Cary Coutant  <ccoutant@google.com>
5205
5206         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5207         sections before NOBITS sections.
5208
5209 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5210
5211         * version.cc (print_version): Update copyright to 2011.
5212
5213 2010-12-23  Cary Coutant  <ccoutant@google.com>
5214
5215         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5216         of OS to this->add.  Add OD parameter to second form of the function.
5217
5218 2010-12-20  Ian Lance Taylor  <iant@google.com>
5219
5220         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5221         second of two consecutive entries with same offset.
5222
5223 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5224
5225         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5226         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5227         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5228         to avoid unneeded links against $(LDADD).
5229         * testsuite/Makefile.in: Regenerate.
5230
5231 2010-12-15  Ian Lance Taylor  <iant@google.com>
5232
5233         PR gold/12324
5234         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5235         for R_X86_64_32 and R_X86_64_PC32.
5236         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5237         ver_matching_def_pic.o.
5238         (ver_matching_def_pic.o): New target.
5239
5240 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5241
5242         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5243         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5244         Move definition before File_read::View member definitions.
5245         (File_read::View::~View): Initialize and hold lock before
5246         updating current_mapped_bytes.
5247
5248 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5249
5250         * dwarf_reader.cc: Remove outdated comment.
5251         * gold-threads.cc: Fix typo in error message.
5252         * archive.cc: Fix typos in comments.
5253         * archive.h: Likewise.
5254         * arm-reloc-property.cc: Likewise.
5255         * arm-reloc-property.h: Likewise.
5256         * arm-reloc.def: Likewise.
5257         * arm.cc: Likewise.
5258         * attributes.h: Likewise.
5259         * cref.cc: Likewise.
5260         * ehframe.cc: Likewise.
5261         * fileread.h: Likewise.
5262         * gold.h: Likewise.
5263         * i386.cc: Likewise.
5264         * icf.cc: Likewise.
5265         * incremental.h: Likewise.
5266         * int_encoding.cc: Likewise.
5267         * layout.h: Likewise.
5268         * main.cc: Likewise.
5269         * merge.h: Likewise.
5270         * object.cc: Likewise.
5271         * object.h: Likewise.
5272         * options.cc: Likewise.
5273         * readsyms.cc: Likewise.
5274         * reduced_debug_output.cc: Likewise.
5275         * reloc.cc: Likewise.
5276         * script-sections.cc: Likewise.
5277         * sparc.cc: Likewise.
5278         * symtab.h: Likewise.
5279         * target-reloc.h: Likewise.
5280         * target.cc: Likewise.
5281         * target.h: Likewise.
5282         * timer.cc: Likewise.
5283         * timer.h: Likewise.
5284         * x86_64.cc: Likewise.
5285
5286 2010-12-09  Cary Coutant  <ccoutant@google.com>
5287
5288         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5289         stack.
5290         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5291         parameter; change all callers.
5292         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5293         * options.h (warn_execstack): New option.
5294
5295 2010-12-07  Doug Kwan  <dougkwan@google.com>
5296
5297         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5298         like function call relocations.
5299
5300 2010-12-07  Ian Lance Taylor  <iant@google.com>
5301
5302         * archive.cc (Archive::get_elf_object_for_member): Permit
5303         punconfigured to be NULL.
5304         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5305         (Archive::include_member): Pass NULL to get_elf_object_for_member
5306         if we searched for the archive and this is the first included
5307         object.
5308
5309 2010-12-01  Ian Lance Taylor  <iant@google.com>
5310
5311         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5312         track_relocs_type_ field.
5313         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5314         Set track_relocs_type_.
5315         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5316         contents when using RELA relocs.
5317         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5318         reloc_map_.
5319         * reloc.cc (Track_relocs::next_addend): New function.
5320         * reloc.h (class Track_relocs): Declare next_addend.
5321
5322 2010-12-01  Ian Lance Taylor  <iant@google.com>
5323
5324         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5325         virtual destructor.
5326
5327 2010-12-01  Ian Lance Taylor  <iant@google.com>
5328
5329         * README: Update compilers known to work and fail.
5330
5331 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5332
5333         * configure.in: For --enable-gold, handle value `default' instead of
5334         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5335         not the default.
5336         * configure: Regenerate.
5337
5338 2010-11-18  Doug Kwan  <dougkwan@google.com>
5339
5340         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5341         and right_alignment to be zero.  Store result alignment only if it is
5342         greater than existing alignment.
5343
5344 2010-11-16  Cary Coutant  <ccoutant@google.com>
5345
5346         PR gold/12220
5347         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5348         Check for ".zdebug_line".
5349
5350 2010-11-16  Doug Kwan  <dougkwan@google.com>
5351             Cary Coutant  <ccoutant@google.com>
5352
5353         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5354         by reference; adjust all callers.
5355         * output.cc (Output_segment::set_section_addresses): Adjust references
5356         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5357         list is empty.
5358         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5359         end at page boundary.
5360
5361 2010-11-16  Cary Coutant  <ccoutant@google.com>
5362
5363         PR gold/12220
5364         * layout.cc (Layout::choose_output_section): Transform names of
5365         compressed sections even when using a script with a SECTIONS clause.
5366         (Layout::output_section_name): Remove code to transform
5367         compressed debug section names.
5368         * output.cc (Output_section::add_input_section): Use uncompressed
5369         section size when tracking input sections.
5370
5371 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5372
5373         * symtab.h (Symbol::NON_PIC_REF): Remove.
5374         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5375         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5376         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5377         (Symbol::use_plt_offset): Take a flags argument and pass it
5378         directly to needs_dynamic_reloc.  Restrict check for undefined
5379         weak symbols to function calls.
5380         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5381         (Target_arm::Scan::global): Use it.
5382         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5383         (Target_arm::Relocate::relocate): Likewise.
5384         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5385         parameter with an r_type parameter.  Use get_reference_flags
5386         to get the flags.
5387         (Target_arm::Relocate::relocate): Update accordingly.
5388         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5389         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5390         (Target_i386::Scan::global): Likewise.
5391         (Target_i386::Relocate::relocate): Likewise.
5392         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5393         parameter with an r_type parameter.  Use get_reference_flags
5394         to get the flags.
5395         (Target_i386::Relocate::relocate): Update accordingly.
5396         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5397         (Target_powerpc::Scan::global): Use it.
5398         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5399         (Target_powerpc::Relocate::relocate): Likewise.
5400         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5401         (Target_sparc::Scan::global): Use it.
5402         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5403         (Target_sparc::Relocate::relocate): Likewise.
5404         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5405         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5406         (Target_x86_64::Scan::global): Likewise.
5407         (Target_x86_64::Relocate::relocate): Likewise.
5408
5409 2010-11-08  Doug Kwan  <dougkwan@google.com>
5410             Cary Coutant  <ccoutant@google.com>
5411
5412         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5413         (Arm_exidx_merge_section::section_contents_): New data member.
5414         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5415         (Arm_input_section::~Arm_input_section): De-allocate memory.
5416         (Arm_input_section::original_contents_): New data member.
5417         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5418         in parameters instead of calling Object::section_contents without
5419         locking.
5420         (Arm_output_section::group_section): New parameter TASK.  Pass it
5421         to callees that need locking objects.
5422         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5423         to lock EXIDX input sections.  Fix a formatting issue.  Call
5424         Arm_exidx_merged_section::build_contents to create merged section
5425         contents.
5426         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5427         to lock object of stub table owner.
5428         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5429         TEXT_SIZE to initialize data member TEXT_SIZE_.
5430         (Arm_exidx_input_section::addralign): Fix typo in comment.
5431         (Arm_exidx_input_section::text_size): New method.
5432         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5433         that require locking objects.  Lock objects before scanning for stubs
5434         and updating local symbols.
5435         (Arm_input_section<big_endian>::init): Copy contents of original
5436         input section.
5437         (Arm_input_section<big_endian>::do_write): Use saved contents of
5438         original input section instead of calling Object::section_contents
5439         without locking.
5440         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5441         size without calling Object::section_size().
5442         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5443         for size.  Allocate a buffer for merged EXIDX entries.
5444         (Arm_exidx_merged_section::build_contents): New method.
5445         (Arm_exidx_merged_section::do_write): Move merge section contents
5446         building code to Arm_exidx_merged_section::build_contetns.  Write
5447         out contetns in buffer instead of building it on the fly.
5448         (Arm_relobj::make_exidx_input_section): Also pass text section size
5449         to Arm_exidx_input_section constructor.
5450         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5451         (Arm_dynobj::do_read_symbols): Fix memory leak.
5452         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5453         * target.h: (class Task): Add forward declaration.
5454         (Target::relax): Add new parameter TASK and pass it to
5455         Target::do_relax().
5456         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5457
5458 2010-11-05  Cary Coutant  <ccoutant@google.com>
5459
5460         PR gold/10708
5461         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5462         object when reading from the file.
5463         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5464         second layout pass.
5465         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5466         when reading section contents.
5467         (get_section_contents): Likewise.
5468         (icf::find_identical_sections): Likewise.
5469         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5470         object when reading from the file.
5471         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5472         the object when doing deferred section layout.
5473
5474 2010-11-03  Nick Clifton  <nickc@redhat.com>
5475
5476         PR gold/12001
5477         * script.h (class Symbol_assignment: name): New member.  Returns
5478         the name of the symbol.
5479         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5480         Returns true if the given symbol name is on the list of
5481         assignments wating to be processed.
5482         * archive.cc (should_incldue_member): If the symbol is undefined,
5483         check to see if it is on the list of symbols pending assignment.
5484
5485 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5486
5487         * script-sections.cc (Script_sections::find_memory_region): Check
5488         for a NULL output section pointer.
5489
5490 2010-10-29  Doug Kwan  <dougkwan@google.com>
5491
5492         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5493         Output_section::add_relaxed_input_section.
5494         * output.cc (Output_section::add_relaxed_input_section): Add new
5495         arguments LAYOUT and NAME.  Set section order index.
5496         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5497         Copy section order index.
5498         * output.h (Output_section::add_relaxed_input_section): Add new
5499         arguments LAYOUT and NAME.
5500
5501 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5502
5503         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5504         NATIVE_OR_CROSS_LINKER.
5505         * testsuite/Makefile.in: Regenerate.
5506
5507 2010-10-20  Doug Kwan  <dougkwan@google.com>
5508
5509         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5510         without SHF_LINK_ORDER flags.
5511         * layout.cc (Layout::choose_output_section): Do not filter
5512         SHF_LINK_ORDER flag in a relocatable link.
5513
5514 2010-10-17  Cary Coutant  <ccoutant@google.com>
5515
5516         * output.h (Output_segment::set_section_addresses): Change function
5517         signature.  Update all callers.
5518         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5519         sections.
5520         (Output_segment::set_section_addresses): Align after last TLS
5521         section.  Add padding before last relro section instead of after.
5522
5523 2010-10-17  Doug Kwan  <dougkwan@google.com>
5524
5525         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5526         GOT output section to be writable.
5527
5528 2010-10-14  Cary Coutant  <ccoutant@google.com>
5529
5530         * debug.h (DEBUG_INCREMENTAL): New flag.
5531         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5532         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5533         mode.
5534         * incremental.cc (report_command_line): Ignore all forms of
5535         --incremental.
5536         * layout.cc (Layout::Layout): Check parameters for incremental link
5537         mode.
5538         * options.cc (General_options::parse_incremental): New function.
5539         (General_options::parse_no_incremental): New function.
5540         (General_options::parse_incremental_full): New function.
5541         (General_options::parse_incremental_update): New function.
5542         (General_options::incremental_mode_): New data member.
5543         (General_options::finalize): Check incremental_mode_.
5544         * options.h (General_options): Update help text for --incremental.
5545         Add --no-incremental, --incremental-full, --incremental-update.
5546         (General_options::Incremental_mode): New enum type.
5547         (General_options::incremental_mode): New function.
5548         (General_options::incremental_mode_): New data member.
5549         * parameters.cc (Parameters::incremental_mode_): New data member.
5550         (Parameters::set_options): Set incremental_mode_.
5551         (Parameters::set_incremental_full): New function.
5552         (Parameters::incremental): New function.
5553         (Parameters::incremental_update): New function.
5554         (set_parameters_incremental_full): New function.
5555         * parameters.h (Parameters::set_incremental_full): New function.
5556         (Parameters::incremental): New function.
5557         (Parameters::incremental_update): New function.
5558         (Parameters::incremental_mode_): New data member.
5559         (set_parameters_incremental_full): New function.
5560         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5561         incremental link mode.
5562         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5563         (Sized_relobj::do_relocate_sections): Likewise.
5564         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5565         option.
5566         * testsuite/Makefile.in: Regenerate.
5567         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5568
5569 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5570
5571         * script-sections.h (class Script_sections): Make
5572         Sections_elements typedef public.
5573         * script-sections.cc (class Sort_output_sections): Add elements_
5574         field.  Add constructor which sets it; change all callers.
5575         (Sort_output_sections::is_before): New function.
5576         (Sort_output_sections::operator()): Call is_before.
5577         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5578         conditional.
5579         * testsuite/script_test_10.sh: New test. Test script section
5580         order.
5581         * testsuite/script_test_10.t: Likewise.
5582         * testsuite/script_test_10.s: Likewise.
5583         * testsuite/Makefile.am: Wrap the cross linker tests and the
5584         common tests into NATIVE_OR_CROSS_LINKER.
5585         (check_SCRIPTS): Add script_test_10.sh.
5586         (check_DATA): Add script_test_10.stdout.
5587         (script_test_10.o, script_test_10): New targets.
5588         (script_test_10.stdout): New target.
5589         * configure, testsuite/Makefile.in: Regenerate.
5590
5591 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5592
5593         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5594         error for the deprecated relocations.
5595         (Target_arm::Scan::global): Likewise.
5596         (Target_arm::Relocate::relocate): Likewise.
5597
5598 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5599
5600         * fileread.cc (Input_file::find_file): Initialize *found_name
5601         and *namep when using the fallback search for case 4.
5602
5603 2010-10-11  Cary Coutant  <ccoutant@google.com>
5604
5605         * options.h (class General_options): Redefine -z lazy as an alias for
5606         the negation of -z now.
5607
5608 2010-10-11  Ian Lance Taylor  <iant@google.com>
5609
5610         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5611         binding.
5612
5613 2010-10-06  Nick Clifton  <nickc@redhat.com>
5614
5615         * script-sections.cc(class Memory_region): Remove
5616         current_lma_offset_ field.  Rename current_vma_offset_ to
5617         current_offset_.  Add last_section_ field.
5618         (Memory_region::get_current_vma_address): Rename to
5619         get_current_address.
5620         (Memory_region::get_current_lma_address): Delete.
5621         (Memory_region::increment_vma_offset): Rename to
5622         increment_offset.
5623         (Memory_region::increment_lma_offset): Delete.
5624         (Memory_region::attributes_compatible): New method.  Returns
5625         true if the provided section is compatible with the region.
5626         (Memory_region::get_last_section): New method.  Returns the last
5627         section to use the region.
5628         (Memory_region::set_last_section): New method.  Stores the last
5629         section to use the region.
5630         (Script_sections::block_in_region): New method.  Returns true if
5631         a block of memory is contained within a region.
5632         (Script_sections::find_memory_region): New method.  Locates a
5633         memory region to be used to set a VMA or LMA address.
5634         (Output_section_definition::set_section_addresses): Add code to
5635         check for addresses set by memory regions.
5636         (Output_segment::set_section_addresses): Remove memory region
5637         walking code.
5638         (Script_sections::create_segment): Add a warning if a header
5639         segment is created outside of any region.
5640         * script-sections.h (class Script_sections): Add prototypes for
5641         find_memory_region and block_in_region methods.
5642         * testsuite/memory_test.s: Use .long instead of .word.
5643         * testsuite/memory_test.t: Add some more output sections.
5644         * testsuite/memory_test.sh: Update expected output.
5645
5646 2010-10-02  Doug Kwan  <dougkwan@google.com>
5647
5648         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5649         defintion to symtab.h
5650         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5651         declaration to defintion.
5652
5653 2010-10-01  Nick Clifton  <nickc@redhat.com>
5654
5655         * expression.cc (eval): Replace dummy argument with NULL.
5656         (eval_maybe_dot): Check for a NULL result section pointer.
5657         (Symbol_expression::value): Likewise.
5658         (Dot_expression::value): Likewise.
5659         (BINARY_EXPRESSION): Likewise.
5660         (Max_expression::value): Likewise.
5661         (Min_expression::value): Likewise.
5662         (Absolute_expression::value): Likewise.
5663         (Addr_expression::value_from_output_section): Likewise.
5664         (Loaddddr_expression::value_from_output_section): Likewise.
5665         (Segment_start_expression::value): Likewise.
5666         * script-sections.cc
5667         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5668         argument with NULL.
5669         (Sections_elememt_dot_assignment::set_section_addresses):
5670         Likewise.
5671         (Output_data_expression::do_write_to_buffer): Likewise.
5672         (Output_section_definition::finalize_symbols): Likewise.
5673         (Output_section_definition::set_section_addresses): Likewise.
5674
5675 2010-09-30  Doug Kwan  <dougkwan@google.com>
5676
5677         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5678
5679 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5680
5681         * target.h (Target::can_icf_inline_merge_sections): New virtual
5682         function.
5683         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5684         virtual function.
5685         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5686         virtual function.
5687         * icf.cc (get_section_contents): Inline merge sections only when
5688         target allows it.
5689
5690 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5691
5692         * configure: Regenerate.
5693
5694 2010-09-17  Ian Lance Taylor  <iant@google.com>
5695
5696         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5697         * testsuite/Makefile.am (memory_test.o): New target.
5698         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5699         memory_test.t.
5700         * testsuite/Makefile.in: Rebuild.
5701
5702 2010-09-17  Doug Kwan  <dougkwan@google.com>
5703
5704         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5705         defintion if relocation uses GOT entries of the symbol.
5706         * testsuite/icf_safe_test.sh: Fix test.
5707         * testsuite/icf_safe_so_test.sh: Fix test.
5708
5709 2010-09-16  Cary Coutant  <ccoutant@google.com>
5710
5711         * script_sections.cc (class Memory_region): Remove "NULL" from
5712         vector initializations.
5713
5714 2010-09-15  Cary Coutant  <ccoutant@google.com>
5715
5716         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5717         Resolve forwarding symbols.
5718
5719 2010-09-15  Doug Kwan  <dougkwan@google.com>
5720
5721         * gold/testsuite/script_test_3.t: Add ARM special sections.
5722         * gold/testsuite/script_test_4.t: Same.
5723         * gold/testsuite/script_test_5.t: Same.
5724         * gold/testsuite/script_test_6.t: Same.
5725         * gold/testsuite/script_test_7.t: Same.
5726         * gold/testsuite/script_test_7.t: Same.
5727         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5728
5729 2010-09-14  Cary Coutant  <ccoutant@google.com>
5730
5731         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5732         (Target_x86_64::Relocate::relocate_tls): Replace check for
5733         saw_tls_block_reloc_ with test for executable section.
5734
5735 2010-09-12  Cary Coutant  <ccoutant@google.com>
5736
5737         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5738         position-independent executables to shared libraries need dynamic
5739         relocations.
5740         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5741         position-independent executables.
5742         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5743         * testsuite/Makefile.in: Regenerate.
5744
5745 2010-09-10  Nick Clifton  <nickc@redhat.com>
5746
5747         PR gold/11997
5748         * testsuite/memory_test.t: Discard any sections that are not
5749         needed.
5750
5751 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5752
5753         PR gold/11996
5754         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5755         "This::" to work around a bug in gcc 4.2.
5756
5757         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5758
5759 2010-09-09  Rafael Espindola  <espindola@google.com>
5760
5761         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5762         sections with different PF_X flags in the same segment.
5763         (Layout::find_first_load_seg): Search all segments to find the first
5764         one.
5765         * options.h (rosegment): New.
5766
5767 2010-09-08  Rafael Espindola  <espindola@google.com>
5768
5769         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5770
5771 2010-09-08  Doug Kwan  <dougkwan@google.com>
5772
5773         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5774         (Arm_relobj::do_relocate_sections): Add new parameter for output
5775         file to match the parent.
5776         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5777         of local symbols instead of input values.  Update code to track
5778         changes in gold::relocate_section.
5779         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5780         (Sized_relobj::compute_final_local_value_internal): New methods.
5781         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5782         body into private version of Sized_relobj::compute_final_local_value.
5783         Call the inline method.
5784         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5785         merged symbol value if there is one.
5786         (Symbol_value::has_output_value): New method defintiion.
5787         (Sized_relobj::Compute_final_local_value_status): New enum type.
5788         (Sized_relobj::compute_final_local_value): New methods.
5789         (Sized_relobj::compute_final_local_value_internal): New methods.
5790         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5791         and arm_cortex_a8.sh.
5792         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5793         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5794         New tests.
5795         * Makefile.in: Regenerate.
5796         * testsuite/arm_bl_out_of_range.s: Update test.
5797         * testsuite/thumb_bl_out_of_range.s: Ditto.
5798         * testsuite/thumb_blx_out_of_range.s: Ditto.
5799         * testsuite/arm_branch_out_of_range.sh: New file.
5800         * testsuite/arm_cortex_a8.sh: Ditto.
5801         * testsuite/arm_cortex_a8_b.s: Ditto.
5802         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5803         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5804         * testsuite/arm_cortex_a8_bl.s: Ditto.
5805         * testsuite/arm_cortex_a8_blx.s: Ditto.
5806         * testsuite/arm_cortex_a8_local.s: Ditto.
5807         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5808         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5809
5810 2010-09-08  Rafael Espindola  <espindola@google.com>
5811
5812         * Makefile.am (memory_test.stdout): Run readelf with -W.
5813         * Makefile.in: Regenerate.
5814         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5815         64 bit output.
5816
5817 2010-09-08  Rafael Espindola  <espindola@google.com>
5818
5819         * script-sections.cc (Script_sections::add_memory_region): Convert
5820         field precision to int.
5821         * script.cc (script_set_section_region, script_set_section_region):
5822         Convert field precision to int.
5823
5824 2010-09-08  Rafael Espindola  <espindola@google.com>
5825
5826         * arm.cc (do_finalize_sections): Create the __exidx_start and
5827         __exdix_end symbols even when the section is missing.
5828
5829 2010-09-08  Nick Clifton  <nickc@redhat.com>
5830
5831         * README: Remove claim that MEMORY is not supported.
5832         * expression.cc (script_exp_function_origin)
5833         (script_exp_function_length): Move from here to ...
5834         * script.cc: ... here.
5835         (script_set_section_region, script_add_memory)
5836         (script_parse_memory_attr, script_include_directive): New
5837         functions.
5838         * script-sections.cc
5839         (class Memory_region): New class.
5840         (class Output_section_definition): Add set_memory_region,
5841         set_section_vma, set_section_lma and get_section_name methods.
5842         (class Script_Sections): Add add_memory_region,
5843         find_memory_region, find_memory_region_origin,
5844         find_memory_region_length and set_memory_region methods.
5845         Have set_section_addresses method walk the list of set memory
5846         regions.
5847         Extend the print methos to display memory regions.
5848         * script-sections.h: Add prototypes for new methods.
5849         Add enum for MEMORY region attributes.
5850         * yyscript.y: Add support for parsing MEMORY regions.
5851         * script-c.h: Add prototypes for new functions.
5852         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5853         * testsuite/Makefile.in: Regenerate.
5854         * testsuite/memory_test.sh: New script.
5855         * testsuite/memory_test.s: New assembler source file.
5856         * testsuite/memory_test.t: New linker script.
5857
5858 2010-08-27  Doug Kwan  <dougkwan@google.com>
5859
5860         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5861         reference override an existing dynamic weak reference.
5862         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5863         * testsuite/Makefile.in: Regenerate.
5864         * testsuite/dyn_weak_ref.sh: New file.
5865         * testsuite/dyn_weak_ref_1.c: Ditto.
5866         * testsuite/dyn_weak_ref_2.c: Ditto.
5867
5868 2010-08-27  Ian Lance Taylor  <iant@google.com>
5869
5870         * incremental.h (class Incremental_input_entry): Add virtual
5871         destructor.
5872
5873 2010-08-27  Ian Lance Taylor  <iant@google.com>
5874
5875         * testsuite/start_lib_test_3.c: Mark t3 as used.
5876
5877 2010-08-27  Nick Clifton  <nickc@redhat.com>
5878
5879         * options.cc (version_script): Fix small typo in previous
5880         whitespace tidyup.
5881
5882 2010-08-25  Nick Clifton  <nickc@redhat.com>
5883
5884         * archive.cc: Formatting fixes: Remove whitespace between
5885         typename and following asterisk.  Remove whitespace between
5886         function name and opening parenthesis.
5887         * archive.h: Likewise.
5888         * arm.cc: Likewise.
5889         * attributes.cc: Likewise.
5890         * attributes.h: Likewise.
5891         * common.cc: Likewise.
5892         * copy-relocs.cc: Likewise.
5893         * dirsearch.h: Likewise.
5894         * dynobj.cc: Likewise.
5895         * ehframe.cc: Likewise.
5896         * ehframe.h: Likewise.
5897         * expression.cc: Likewise.
5898         * fileread.cc: Likewise.
5899         * fileread.h: Likewise.
5900         * gc.h: Likewise.
5901         * gold-threads.cc: Likewise.
5902         * gold.cc: Likewise.
5903         * i386.cc: Likewise.
5904         * icf.h: Likewise.
5905         * incremental-dump.cc: Likewise.
5906         * incremental.cc: Likewise.
5907         * layout.cc: Likewise.
5908         * layout.h: Likewise.
5909         * main.cc: Likewise.
5910         * merge.cc: Likewise.
5911         * merge.h: Likewise.
5912         * object.cc: Likewise.
5913         * object.h: Likewise.
5914         * options.cc: Likewise.
5915         * options.h: Likewise.
5916         * output.cc: Likewise.
5917         * output.h: Likewise.
5918         * plugin.cc: Likewise.
5919         * plugin.h: Likewise.
5920         * powerpc.cc: Likewise.
5921         * reloc.cc: Likewise.
5922         * script-c.h: Likewise.
5923         * script-sections.cc: Likewise.
5924         * script.cc: Likewise.
5925         * stringpool.cc: Likewise.
5926         * symtab.cc: Likewise.
5927         * symtab.h: Likewise.
5928         * target.cc: Likewise.
5929         * timer.cc: Likewise.
5930         * timer.h: Likewise.
5931         * version.cc: Likewise.
5932         * x86_64.cc: Likewise.
5933
5934 2010-08-24  Nick Clifton  <nickc@redhat.com>
5935
5936         PR 11899
5937         * layout.cc (segment_precedes): Sort segments by their physical
5938         addresses, if they have been set.
5939
5940 2010-08-23  Cary Coutant  <ccoutant@google.com>
5941
5942         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5943         symbols data.
5944         (Lib_group::include_member): Unlock object after deleting its
5945         symbols data.
5946         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5947         the bug fixed here.
5948
5949 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5950             Cary Coutant  <ccoutant@google.com>
5951
5952         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5953         constructor, and set_blocker.
5954         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5955         readsyms_blocker_.
5956         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5957         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5958         * testsuite/Makefile.am (start_lib_test): New test case.
5959         * testsuite/Makefile.in: Regenerate.
5960         * testsuite/start_lib_test_main.c: New file.
5961         * testsuite/start_lib_test_1.c: New file.
5962         * testsuite/start_lib_test_2.c: New file.
5963         * testsuite/start_lib_test_3.c: New file.
5964
5965 2010-08-19  Ian Lance Taylor  <iant@google.com>
5966
5967         * Makefile.in: Rebuild with automake 1.11.1.
5968         * aclocal.m4: Likewise.
5969         * testsuite/Makefile.in: Likewise.
5970
5971 2010-08-19  Ian Lance Taylor  <iant@google.com>
5972
5973         PR 10893
5974         * i386.cc (class Output_data_plt_i386): Update declarations.
5975         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5976         local_ifuncs_ fields.
5977         (Target_i386::do_plt_section_for_global): New function.
5978         (Target_i386::do_plt_section_for_local): New function.
5979         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5980         parameter; change all callers.  Initialize global_ifuncs_ and
5981         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5982         __rel_iplt_end.
5983         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5984         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5985         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5986         symbols.
5987         (Target_i386::make_plt_section): New function, broken out of
5988         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5989         (Target_i386::make_plt_entry): Call make_plt_section.
5990         (Target_i386::make_local_ifunc_plt_entry): New function.
5991         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5992         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5993         R_386_IRELATIVE to switch.
5994         (Target_i386::Scan::global): Likewise.
5995         (Target_i386::Relocate::relocate): Likewise.
5996         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5997         switch.
5998         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5999         (Target_x86_64::do_plt_section_for_global): New function.
6000         (Target_x86_64::do_plt_section_for_local): New function.
6001         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6002         parameter; change all callers.  If doing a static link define
6003         __rela_iplt_start and __rela_iplt_end.
6004         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6005         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6006         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6007         to point to .plt.
6008         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6009         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6010         switch.
6011         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6012         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6013         R_X86_64_IRELATIVE to switch.
6014         (Target_x86_64::Scan::global): Likewise.
6015         (Target_x86_64::Relocate::relocate): Likewise.
6016         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6017         switch.
6018         * target.h (class Target): Add plt_section_for_global and
6019         plt_section_for_local functions.  Add do_plt_section_for_global
6020         and do_plt_section_for_local virtual functions.
6021         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6022         clarifying comments.
6023         (Symbol::use_plt_offset): Handle IFUNC symbol.
6024         * object.cc (Sized_relobj::Sized_relobj): Initialize
6025         local_plt_offsets_.
6026         (Sized_relobj::local_has_plt_offset): New function.
6027         (Sized_relobj::local_plt_offset): New function.
6028         (Sized_relobj::set_local_plt_offset): New function.
6029         (Sized_relobj::do_count): Handle IFUNC symbol.
6030         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6031         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6032         is_ifunc_symbol functions.
6033         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6034         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6035         local_plt_offsets_ field.
6036         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6037         * output.h (class Output_section_data): Add non-const
6038         output_section function.
6039         (class Output_data_got): Update declarations.
6040         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6041         Add use_plt_offset parameter to global and local constructors.
6042         Change all callers.  Change local_sym_index_ field to 31 bits.
6043         Change GSYM_CODE and CONSTANT_CODE accordingly.
6044         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6045         doing a static link don't set sh_link field.
6046         (Output_data_got::Got_entry::write): Use PLT offset if
6047         appropriate.
6048         (Output_data_got::add_global_plt): New function.
6049         (Output_data_got::add_local_plt): New function.
6050         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6051         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6052         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6053         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6054         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6055         IFUNC conditional.
6056         * testsuite/ifunc-sel.h: New file.
6057         * testsuite/ifuncmain1.c: New file.
6058         * testsuite/ifuncmain1vis.c: New file.
6059         * testsuite/ifuncmod1.c: New file.
6060         * testsuite/ifuncdep2.c: New file.
6061         * testsuite/ifuncmain2.c: New file.
6062         * testsuite/ifuncmain3.c: New file.
6063         * testsuite/ifuncmod3.c: New file.
6064         * testsuite/ifuncmain4.c: New file.
6065         * testsuite/ifuncmain5.c: New file.
6066         * testsuite/ifuncmod5.c: New file.
6067         * testsuite/ifuncmain6pie.c: New file.
6068         * testsuite/ifuncmod6.c: New file.
6069         * testsuite/ifuncmain7.c: New file.
6070         * configure, testsuite/Makefile.in: Rebuild.
6071
6072 2010-08-18  Ian Lance Taylor  <iant@google.com>
6073
6074         * incremental.cc
6075         (Output_section_incremental_inputs::write_input_files): Add cast
6076         to avoid signed/unsigned comparison warning.
6077         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6078
6079 2010-08-12  Cary Coutant  <ccoutant@google.com>
6080
6081         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6082
6083 2010-08-13  Ian Lance Taylor  <iant@google.com>
6084
6085         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6086
6087 2010-08-12  Cary Coutant  <ccoutant@google.com>
6088             Doug Kwan  <dougkwan@google.com>
6089
6090         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6091         defintion overrides non-weak undef, remember that the original undef
6092         is not weak.
6093         * symtab.cc (Symbol_table::sized_write_global): For undef without
6094         an original weak binding, set binding to global in output.
6095         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6096         * testsuite/Makefile.in: Regenerate.
6097         * testsuite/strong_ref_weak_def.sh: New file.
6098         * testsuite/strong_ref_weak_def_1.c: Ditto.
6099         * testsuite/strong_ref_weak_def_2.c: Ditto.
6100
6101 2010-08-12  Cary Coutant  <ccoutant@google.com>
6102
6103         * testsuite/incremental_test.sh: Rewrite.
6104         * testsuite/incremental_test_1.c: Rewrite.
6105         * testsuite/incremental_test_2.c: Rewrite.
6106
6107 2010-08-12  Cary Coutant  <ccoutant@google.com>
6108
6109         * arm.cc (Target_arm::got_size): Add const.
6110         (Target_arm::got_entry_count): New function.
6111         (Target_arm::plt_entry_count): New function.
6112         (Target_arm::first_plt_entry_offset): New function.
6113         (Target_arm::plt_entry_size): New function.
6114         (Output_data_plt_arm::entry_count): New function.
6115         (Output_data_plt_arm::first_plt_entry_offset): New function.
6116         (Output_data_plt_arm::get_plt_entry_size): New function.
6117         * i386.cc (Target_i386::got_size): Add const.
6118         (Target_i386::got_entry_count): New function.
6119         (Target_i386::plt_entry_count): New function.
6120         (Target_i386::first_plt_entry_offset): New function.
6121         (Target_i386::plt_entry_size): New function.
6122         (Output_data_plt_i386::entry_count): New function.
6123         (Output_data_plt_i386::first_plt_entry_offset): New function.
6124         (Output_data_plt_i386::get_plt_entry_size): New function.
6125         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6126         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6127         * incremental.cc: Include target.h.
6128         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6129         parameter.  Adjust all callers.  Find incremental_got_plt section.
6130         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6131         section.
6132         (Output_section_incremental_inputs::set_final_data_size): Calculate
6133         size of incremental_got_plt section.
6134         (Output_section_incremental_inputs::do_write): Write the
6135         incremental_got_plt section.
6136         (Got_plt_view_info): New struct.
6137         (Local_got_offset_visitor): New class.
6138         (Global_got_offset_visitor): New class.
6139         (Global_symbol_visitor_got_plt): New class.
6140         (Output_section_incremental_inputs::write_got_plt): New function.
6141         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6142         Add parameter.  Adjust all callers.
6143         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6144         (Incremental_inputs::got_plt_section): New function.
6145         (Incremental_inputs::got_plt_section_): New data member.
6146         (Incremental_got_plt_reader): New class.
6147         * layout.cc (Layout::create_incremental_info_sections): Add the
6148         incremental_got_plt section.
6149         * object.h (Got_offset_list::get_list): New function.
6150         (Got offset_list::for_all_got_offsets): New function.
6151         (Sized_relobj::local_got_offset_list): New function.
6152         * powerpc.cc (Target_powerpc::got_size): Add const.
6153         (Target_powerpc::got_entry_count): New function.
6154         (Target_powerpc::plt_entry_count): New function.
6155         (Target_powerpc::first_plt_entry_offset): New function.
6156         (Target_powerpc::plt_entry_size): New function.
6157         (Output_data_plt_powerpc::entry_count): New function.
6158         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6159         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6160         * sparc.cc (Target_sparc::got_size): Add const.
6161         (Target_sparc::got_entry_count): New function.
6162         (Target_sparc::plt_entry_count): New function.
6163         (Target_sparc::first_plt_entry_offset): New function.
6164         (Target_sparc::plt_entry_size): New function.
6165         (Output_data_plt_sparc::entry_count): New function.
6166         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6167         (Output_data_plt_sparc::get_plt_entry_size): New function.
6168         * symtab.h (Symbol::got_offset_list): New function.
6169         (Symbol_table::for_all_symbols): New function.
6170         * target.h (Sized_target::got_entry_count): New function.
6171         (Sized_target::plt_entry_count): New function.
6172         (Sized_target::plt_entry_size): New function.
6173         * x86_64.cc (Target_x86_64::got_size): Add const.
6174         (Target_x86_64::got_entry_count): New function.
6175         (Target_x86_64::plt_entry_count): New function.
6176         (Target_x86_64::first_plt_entry_offset): New function.
6177         (Target_x86_64::plt_entry_size): New function.
6178         (Output_data_plt_x86_64::entry_count): New function.
6179         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6180         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6181
6182 2010-08-12  Cary Coutant  <ccoutant@google.com>
6183
6184         * archive.cc: Include incremental.h.
6185         (Archive::Archive): Initialize incremental_info_.
6186         (Archive::include_member): Record archive members in incremental info.
6187         (Add_archive_symbols::run): Record begin and end of an archive in
6188         incremental info.
6189         (Lib_group::include_member): Record objects in incremental info.
6190         * archive.h (Incremental_archive_entry): Forward declaration.
6191         (Archive::set_incremental_info): New member function.
6192         (Archive::incremental_info): New member function.
6193         (Archive::Unused_symbol_iterator): New class.
6194         (Archive::unused_symbols_begin): New member function.
6195         (Archive::unused_symbols_end): New member function.
6196         (Archive::incremental_info_): New data member.
6197         * incremental-dump.cc (find_input_containing_global): New function.
6198         (dump_incremental_inputs): Dump new incremental info sections.
6199         * incremental.cc: Include symtab.h.
6200         (Output_section_incremental_inputs): New class.
6201         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6202         new incremental info sections.
6203         (Sized_incremental_binary::do_check_inputs): Likewise.
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): New function.
6208         (Incremental_inputs::finalize_inputs): Remove.
6209         (Incremental_inputs::report_input_section): New function.
6210         (Incremental_inputs::report_script): Rewrite.
6211         (Incremental_inputs::finalize): Do nothing but finalize string table.
6212         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6213         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6214         (Incremental_inputs::create_data_sections): New function.
6215         (Incremental_inputs::relocs_entsize): New function.
6216         (Output_section_incremental_inputs::set_final_data_size): New function.
6217         (Output_section_incremental_inputs::do_write): New function.
6218         (Output_section_incremental_inputs::write_header): New function.
6219         (Output_section_incremental_inputs::write_input_files): New function.
6220         (Output_section_incremental_inputs::write_info_blocks): New function.
6221         (Output_section_incremental_inputs::write_symtab): New function.
6222         * incremental.h (Incremental_script_entry): Forward declaration.
6223         (Incremental_object_entry): Forward declaration.
6224         (Incremental_archive_entry): Forward declaration.
6225         (Incremental_inputs): Forward declaration.
6226         (Incremental_inputs_header_data): Remove.
6227         (Incremental_inputs_header): Remove.
6228         (Incremental_inputs_header_write): Remove.
6229         (Incremental_inputs_entry_data): Remove.
6230         (Incremental_inputs_entry): Remove.
6231         (Incremental_inputs_entry_write): Remove.
6232         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6233         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6234         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6235         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6236         Likewise.
6237         (Incremental_input_entry): New class.
6238         (Incremental_script_entry): New class.
6239         (Incremental_object_entry): New class.
6240         (Incremental_archive_entry): New class.
6241         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6242         (Incremental_inputs::report_inputs): Remove.
6243         (Incremental_inputs::report_archive): Remove.
6244         (Incremental_inputs::report_archive_begin): New function.
6245         (Incremental_inputs::report_archive_end): New function.
6246         (Incremental_inputs::report_object): Change prototype.
6247         (Incremental_inputs::report_input_section): New function.
6248         (Incremental_inputs::report_script): Change prototype.
6249         (Incremental_inputs::get_reloc_count): New function.
6250         (Incremental_inputs::set_reloc_count): New function.
6251         (Incremental_inputs::create_data_sections): New function.
6252         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6253         (Incremental_inputs::inputs_section): New function.
6254         (Incremental_inputs::symtab_section): New function.
6255         (Incremental_inputs::relocs_section): New function.
6256         (Incremental_inputs::get_stringpool): Add const.
6257         (Incremental_inputs::command_line): Add const.
6258         (Incremental_inputs::inputs): Remove.
6259         (Incremental_inputs::command_line_key): New function.
6260         (Incremental_inputs::input_file_count): New function.
6261         (Incremental_inputs::input_files): New function.
6262         (Incremental_inputs::relocs_entsize): New function.
6263         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6264         (Incremental_inputs::finalize_inputs): Remove.
6265         (Incremental_inputs::Input_info): Remove.
6266         (Incremental_inputs::lock_): Remove.
6267         (Incremental_inputs::inputs_): Change type.
6268         (Incremental_inputs::inputs_map_): Remove.
6269         (Incremental_inputs::current_object_entry_): New data member.
6270         (Incremental_inputs::inputs_section_): New data member.
6271         (Incremental_inputs::symtab_section_): New data member.
6272         (Incremental_inputs::relocs_section_): New data member.
6273         (Incremental_inputs::reloc_count_): New data member.
6274         (Incremental_inputs_reader): New class.
6275         (Incremental_symtab_reader): New class.
6276         (Incremental_relocs_reader): New class.
6277         * layout.cc (Layout::finalize): Move finalization of incremental info
6278         and creation of incremental info sections to follow finalization of
6279         symbol table.  Set offsets for postprocessing sections.
6280         (Layout::create_incremental_info_sections): Call
6281         Incremental_inputs::create_data_sections.  Add incremental symtab
6282         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6283         sections to layout after input sections.
6284         * layout.h (struct Timespec): Forward declaration.
6285         (Layout::incremental_inputs): Add const.
6286         (Layout::create_incremental_info_sections): Add parameter.
6287         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6288         * object.cc: Include incremental.h.
6289         (Relobj::finalize_incremental_relocs): New function.
6290         (Sized_relobj::do_layout): Record input sections in incremental info.
6291         * object.h (Object::output_section): New function.
6292         (Object::output_section_offset): Moved from Relobj.
6293         (Object::get_incremental_reloc_base): New function.
6294         (Object::get_incremental_reloc_count): New function.
6295         (Object::do_output_section): New function.
6296         (Object::do_output_section_offset): Moved from Relobj.
6297         (Object::do_get_incremental_reloc_base): New function.
6298         (Object::do_get_incremental_reloc_count): New function.
6299         (Object::Object): Initialize new data members.
6300         (Relobj::output_section): Renamed do_output_section and moved to
6301         protected.
6302         (Relobj::output_section_offset): Moved to Object.
6303         (Relobj::do_get_incremental_reloc_base): New function.
6304         (Relobj::do_get_incremental_reloc_count): New function.
6305         (Relobj::allocate_incremental_reloc_counts): New function.
6306         (Relobj::count_incremental_reloc): New function.
6307         (Relobj::finalize_incremental_relocs): New function.
6308         (Relobj::next_incremental_reloc_index): New function.
6309         (Relobj::reloc_counts_): New data member.
6310         (Relobj::reloc_bases_): New data member.
6311         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6312         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6313         (Sized_relobj::incremental_relocs_scan): New function.
6314         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6315         (Sized_relobj::incremental_relocs_write): New function.
6316         (Sized_relobj::incremental_relocs_write_reltype): New function.
6317         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6318         incremental link.
6319         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6320         archives and object files elsewhere.
6321         (Add_symbols::run): Report object files here.
6322         (Finish_group::run): Report end of archive at end of group.
6323         * reloc.cc: Include layout.h, incremental.h.
6324         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6325         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6326         (Sized_relobj::incremental_relocs_scan): New function.
6327         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6328         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6329         (Sized_relobj::incremental_relocs_write): New function.
6330         (Sized_relobj::incremental_relocs_write_reltype): New function.
6331         * script.cc (read_input_script): Rewrite test for incremental link.
6332         Change call to Incremental_inputs::report_script.
6333         * symtab.h (Symbol_table::first_global_index): New function.
6334         (Symbol_table::output_count): New function.
6335
6336 2010-08-12  Doug Kwan  <dougkwan@google.com>
6337
6338         * arm.cc (Target_arm::merge_object_attributes): Check command line
6339         options --no-wchar-size-warning and --no-enum-size-warning.
6340         * options.h (General_options): Add ld-compatible options
6341         --no-enum-size-warning and --no-wchar-size-warning.
6342
6343 2010-08-04  Ian Lance Taylor  <iant@google.com>
6344
6345         * x86_64.cc (Target_x86_64::Scan::local): Use
6346         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6347         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6348         (Target_x86_64::Scan::global): Likewise.
6349         (Target_x86_64::Relocate::relocate): Likewise.
6350         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6351         Likewise.
6352
6353 2010-08-03  Cary Coutant  <ccoutant@google.com>
6354
6355         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6356         to reserve space in merged_strings vector. Keep total input size
6357         for stats.
6358         (Output_merge_string::do_print_merge_stats): Print total input size.
6359         * merge.h (Output_merge_string): Add input_size_ field.
6360         * stringpool.cc (Stringpool_template::string_length): Move
6361         implementations out of Stringpool_template class and place in
6362         stringpool.h.
6363         * stringpool.h (string_length): Move out of Stringpool_template.
6364
6365 2010-08-03  Ian Lance Taylor  <iant@google.com>
6366
6367         PR 11712
6368         * layout.cc (relaxation_loop_body): If address of load segment is
6369         set, adjust address to include headers if possible.
6370
6371 2010-08-03  Ian Lance Taylor  <iant@google.com>
6372
6373         * version.cc (version_string): Bump to 1.10.
6374
6375 2010-08-03  Ian Lance Taylor  <iant@google.com>
6376
6377         PR 11805
6378         * layout.h (enum Output_section_order): Define.
6379         (class Layout): Update declarations.
6380         * layout.cc (Layout::get_output_section): Add order parameter.
6381         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6382         is_first_non_relro parameters.  Change all callers.
6383         (Layout::choose_output_section): Likewise.
6384         (Layout::add_output_section_data): Likewise.
6385         (Layout::make_output_section): Likewise.  Set order.
6386         (Layout::default_section_order): New function.
6387         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6388         * output.cc (Output_section::Output_section): Initialize order_.
6389         Don't initialize deleted fields.
6390         (Output_segment::Output_segment): Don't initialize deleted
6391         fields.
6392         (Output_segment::add_output_section_to_load): New function
6393         replacing add_output_section.  Change all callers to call this or
6394         add_output_section_to_nonload.
6395         (Output_segment::add_output_section_to_nonload): New function.
6396         (Output_segment::remove_output_section): Rewrite.
6397         (Output_segment::add_initial_output_data): Likewise.
6398         (Output_segment::has_any_data_sections): Likewise.
6399         (Output_segment::is_first_section_relro): Likewise.
6400         (Output_segment::maximum_alignment): Likewise.
6401         (Output_segment::has_dynamic_reloc): New function replacing
6402         dynamic_reloc_count.  Change all callers.
6403         (Output_segment::has_dynamic_reloc_list): New function replacing
6404         dynamic_reloc_count_list.  Change all callers.
6405         (Output_segment::set_section_addresses): Rewrite.
6406         (Output_segment::set_offset): Rewrite.
6407         (Output_segment::find_first_and_last_list): Remove.
6408         (Output_segment::set_tls_offsets): Rewrite.
6409         (Output_segment::first_section_load_address): Likewise.
6410         (Output_segment::output_section_count): Likewise.
6411         (Output_segment::section_with_lowest_load_address): Likewise.
6412         (Output_segment::write_section_headers): Likewise.
6413         (Output_segment::print_sections_to_map): Likewise.
6414         * output.h (class Output_data): Remove dynamic_reloc_count_
6415         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6416         (Output_data::add_dynamic_reloc): Rewrite.
6417         (Output_data::has_dynamic_reloc): New function.
6418         (Output_data::dynamic_reloc_count): Remove.
6419         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6420         is_last_relro_, is_first_non_relro_, is_interp_,
6421         is_dynamic_linker_section_ fields.  Add order and set_order
6422         functions.  Remove is_relro_local, set_is_relro_local,
6423         is_last_relro, set_is_last_relro, is_first_non_relro,
6424         set_is_first_non_relro functions, is_interp, set_is_interp,
6425         is_dynamic_linker_section, and set_is_dynamic_linker_section
6426         functions.
6427         (class Output_segment): Change Output_data_list from std::list to
6428         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6429         output_bss_ fields.  Update declarations.
6430
6431 2010-08-02  Ian Lance Taylor  <iant@google.com>
6432
6433         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6434         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6435         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6436
6437 2010-08-02  Ian Lance Taylor  <iant@google.com>
6438
6439         PR 11855
6440         * script.cc (Script_options::Script_options): Initialize
6441         symbol_definitions_ and symbol_references_.
6442         (Script_options::add_symbol_assignment): Update
6443         symbol_definitions_ and symbol_references_.
6444         (Script_options::add_symbol_reference): New function.
6445         (script_symbol): New function.
6446         * script.h (class Script_options): Add symbol_definitions_ and
6447         symbol_references_ fields.
6448         (Script_options::referenced_const_iterator): New type.
6449         (Script_options::referenced_begin): New function.
6450         (Script_options::referenced_end): New function.
6451         (Script_options::is_referenced): New function.
6452         (Script_options::any_unreferenced): New function.
6453         * script-c.h (script_symbol): Declare.
6454         * yyscript.y (exp): Call script_symbol.
6455         * symtab.cc: Include "script.h".
6456         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6457         Change all callers.  Check symbols referenced by scripts.
6458         (Symbol_table::add_undefined_symbols_from_command_line): Add
6459         layout parameter.  Change all callers.
6460         (Symbol_table::do_add_undefined_symbols_from_command_line):
6461         Likewise.  Break out loop body.  Check symbols referenced by
6462         scripts.
6463         (Symbol_table::add_undefined_symbol_from_command_line): New
6464         function broken out of
6465         do_add_undefined_symbols_from_command_line.
6466         * symtab.h (class Symbol_table): Update declarations.
6467         * archive.cc: Include "layout.h".
6468         (Archive::should_include_member): Add layout parameter.  Change
6469         all callers.  Check for symbol mentioned in expression.
6470         * archive.h (class Archive): Update declaration.
6471         * object.cc (Sized_relobj::do_should_include_member): Add layout
6472         parameter.
6473         * object.h (Object::should_include_member): Add layout parameter.
6474         Change all callers.
6475         (Object::do_should_include_member): Add layout parameter.
6476         (class Sized_relobj): Update declaration.
6477         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6478         parameter.
6479         * dynobj.h (class Sized_dynobj): Update declaration.
6480         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6481         layout parameter.
6482         * plugin.h (class Sized_pluginobj): Update declaration.
6483
6484 2010-08-02  Ian Lance Taylor  <iant@google.com>
6485
6486         PR 11866
6487         * output.cc (Output_segment::set_offset): Search for the first and
6488         last sections rather than assuming that the list is in order.
6489         (Output_segment::find_first_and_last_list): New function.
6490         * output.h (class Output_segment): Update declarations.
6491         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6492         (relro_strip_test_SOURCES): New variable.
6493         (relro_strip_test_DEPENDENCIES): New variable.
6494         (relro_strip_test_LDFLAGS): New variable.
6495         (relro_strip_test_LDADD): New variable.
6496         (relro_strip_test.so): New target.
6497
6498 2010-08-02  Ian Lance Taylor  <iant@google.com>
6499
6500         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6501         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6502         (Target_i386::got_tlsdesc_section): New function.
6503         (Target_i386::got_section): Create space for GOT entries for
6504         TLSDESC relocations.
6505         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6506         R_386_TLS_GOTDESC.
6507         (Target_i386::Scan::global): Likewise.
6508         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6509         using TLSDESC GOT.
6510         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6511         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6512         (Target_x86_64::got_tlsdesc_section): New function.
6513         (Target_x86_64::got_section): Create space for GOT entries for
6514         TLSDESC relocations.
6515         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6516         R_386_TLS_GOTDESC.
6517         (Target_x86_64::Scan::global): Likewise.
6518         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6519         using TLSDESC GOT.
6520
6521 2010-08-02  Ian Lance Taylor  <iant@google.com>
6522
6523         * testsuite/final_layout.sh: Use dc to convert from hex to
6524         decimal.
6525
6526 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6527
6528         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6529         paramter to the call to gold::gc_process_relocs.
6530         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6531         paramter to the call to gold::gc_process_relocs.
6532         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6533         parameter to the call to gold::gc_process_relocs.
6534         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6535         template parameter to the call to gold::gc_process_relocs.
6536         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6537         paramter to the call to gold::gc_process_relocs.
6538         * gc.h (get_embedded_addend_size): New function.
6539         (gc_process_relocs): Save the size of the reloc for use by ICF.
6540         * icf.cc (get_section_contents): Get the addend from the text section
6541         for SHT_REL relocation sections.
6542         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6543         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6544         * int_encoding.h (read_from_pointer): New overloaded function.
6545         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6546         * testsuite/icf_sht_rel_addend_test.sh: New file.
6547         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6548         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6549
6550 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6551
6552         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6553         * Makefile.in: Regenerate.
6554         * testsuite/Makefile.in: Regenerate.
6555
6556 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6557
6558         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6559         * gold/testsuite/debug_msg.cc: Likewise.
6560         * gold/testsuite/odr_violation1.cc
6561         * gold/testsuite/odr_violation2.cc
6562
6563 2010-07-21  Cary Coutant  <ccoutant@google.com>
6564
6565         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6566         string, and length fields.
6567         (Output_merge_string::Merged_strings_list): New type.
6568         (Output_merge_string::Merged_strings_lists): New typedef.
6569         (Output_merge_string): Replace merged_strings_ with
6570         merged_strings_lists_.
6571         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6572         Merged_strings_list per input object and section.  Don't store pointer
6573         to the string.  Don't store length with each merged string entry.
6574         (Output_merge_string::finalize_merged_data): Loop over list of merged
6575         strings lists.  Recompute length of each merged string.
6576
6577 2010-07-15  Cary Coutant  <ccoutant@google.com>
6578
6579         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6580         here.
6581
6582 2010-07-14  Ian Lance Taylor  <iant@google.com>
6583
6584         * descriptors.cc (Descriptors::open): Report correct name in error
6585         message.
6586
6587 2010-07-13  Doug Kwan  <dougkwan@google.com>
6588
6589         * arm.cc (Arm_input_section::Arm_input_section): For a
6590         SHT_ARM_EXIDX section, always keeps the input sections.
6591         (Arm_input_section::set_exidx_section_link): New method.
6592         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6593         has_errors_ to false.
6594         (Arm_exidx_input_section::has_errors,
6595         Arm_exidx_input_section::set_has_errors): New methods.
6596         (Arm_exidx_input_section::has_errors_): New data member.
6597         (Arm_relobj::get_exidx_shndx_list): New method.
6598         (Arm_output_section::append_text_sections_to_list): Do not skip
6599         section without SHF_EXECINSTR.
6600         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6601         errors.
6602         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6603         section header.  Make error messages more verbose.  Check for
6604         a non-executable section linked to an EXIDX section.
6605         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6606         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6607         check that there is no deferred EXIDX section if we exit early.
6608         Instead of not making an EXIDX section in case of an error, make one
6609         and set the has_errors flag of it.
6610         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6611         in a relocatable link.
6612         (Target_arm::do_relax): Look for the EXIDX output section instead of
6613         assuming that it is called .ARM.exidx.
6614         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6615         section list.  Do not check for SHF_EXECINSTR section flags but
6616         skip any input section with errors.
6617         * output.cc (Output_section::Output_section): Initialize
6618         always_keeps_input_sections_ to false.
6619         (Output_section::add_input_section): Check for
6620         always_keeps_input_sections_.
6621         *  output.h (Output_section::always_keeps_input_sections,
6622         Output_section::set_always_keeps_input_sections): New methods.
6623         (Output_section::always_keeps_input_sections): New data member.
6624
6625 2010-07-13  Rafael Espindola  <espindola@google.com>
6626
6627         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6628         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6629
6630 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6631             Ian Lance Taylor  <iant@google.com>
6632
6633         * output.h (Output_section_lookup_maps::add_merge_section):
6634         Correct check of whether value was inserted.
6635         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6636         (Output_section_lookup_maps::add_relaxed_input_section):
6637         Likewise.
6638         * arm.cc (Target_arm::got_section): Remove used local os.
6639         * i386.cc (Target_i386::got_section): Likewise.
6640         * x86_64.cc (Target_x86_64::got_section): Likewise.
6641         * sparc.cc (Target_sparc::got_section): Likewise.
6642         (Target_sparc::relocate): Remove unused local have_got_offset.
6643         * powerpc.cc (Target_powerpc::relocate): Likewise.
6644
6645 2010-07-13  Ian Lance Taylor  <iant@google.com>
6646
6647         * compressed_output.cc (zlib_decompress): Fix signature in
6648         !HAVE_ZLIB_H case.
6649
6650         * archive.cc (Archive::include_member): Unlock an external member
6651         of a thin archive.  Don't bother to delete an object we know is
6652         NULL.
6653
6654 2010-07-12  Cary Coutant  <ccoutant@google.com>
6655
6656         * compressed_output.cc (zlib_decompress): New function.
6657         (get_uncompressed_size): New function.
6658         (decompress_input_section): New function.
6659         * compressed_output.h (get_uncompressed_size): New function.
6660         (decompress_input_section): New function.
6661         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6662         Handle compressed debug sections.
6663         * layout.cc (is_compressed_debug_section): New function.
6664         (Layout::output_section_name): Map compressed section names to
6665         canonical names.
6666         * layout.h (is_compressed_debug_section): New function.
6667         (is_debug_info_section): Recognize compressed debug sections.
6668         * merge.cc: Include compressed_output.h.
6669         (Output_merge_data::do_add_input_section): Handle compressed
6670         debug sections.
6671         (Output_merge_string::do_add_input_section): Handle compressed
6672         debug sections.
6673         * object.cc: Include compressed_output.h.
6674         (Sized_relobj::Sized_relobj): Initialize new data members.
6675         (build_compressed_section_map): New function.
6676         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6677         * object.h (Object::section_is_compressed): New method.
6678         (Object::do_section_is_compressed): New method.
6679         (Sized_relobj::Compressed_section_map): New type.
6680         (Sized_relobj::do_section_is_compressed): New method.
6681         (Sized_relobj::compressed_sections_): New data member.
6682         * output.cc (Output_section::add_input_section): Handle compressed
6683         debug sections.
6684         * reloc.cc: Include compressed_output.h.
6685         (Sized_relobj::write_sections): Handle compressed debug sections.
6686
6687 2010-07-08  Cary Coutant  <ccoutant@google.com>
6688
6689         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6690         weak when resolving to a dynamic def.
6691         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6692         for weak undef/dynamic def cases. Adjust callers.
6693         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6694         undef_binding_weak_.
6695         (Symbol_table::sized_write_globals): Adjust symbol binding.
6696         (Symbol_table::sized_write_symbol): Add binding parameter.
6697         * symtab.h (Symbol::set_undef_binding): New method.
6698         (Symbol::is_undef_binding_weak): New method.
6699         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6700         (Symbol_table::should_override): Add new parameter.
6701         (Symbol_table::sized_write_symbol): Add new parameter.
6702
6703         * testsuite/weak_undef_file1.cc: Add new test case.
6704         * testsuite/weak_undef_file2.cc: Fix header comment.
6705         * testsuite/weak_undef_test.cc: Add new test case.
6706
6707 2010-06-29  Doug Kwan  <dougkwan@google.com>
6708
6709         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6710         Initialize USE_SYMBOL_.
6711         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6712         definition.
6713         (Arm_reloc_property::uses_symbol_): New data member declaration.
6714         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6715         uses symbol value and symbol is undefined but not weakly undefined.
6716
6717 2010-06-28  Rafael Espindola  <espindola@google.com>
6718
6719         * plugin.cc (Plugin::load): Use dlerror.
6720
6721 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6722
6723         * symtab.cc (detect_odr_violations): When reporting an ODR
6724         violation, report an object where the symbol is defined.
6725
6726 2010-06-25  Doug Kwan  <dougkwan@google.com>
6727
6728         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6729         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6730         definition.
6731         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6732         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6733         target hook to detect function points.
6734         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6735         * icf.h (Icf::check_section_for_function_pointers): Change type of
6736         parameter SECTION_NAME to const reference to std::string.  Use
6737         target hook to determine if section may have unsafe pointers.
6738         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6739         method definition.
6740
6741 2010-06-21  Rafael Espindola  <espindola@google.com>
6742
6743         * fileread.cc (Input_file::find_fie): New
6744         (Input_file::open): Use Input_file::find_fie.
6745         * fileread.h (Input_file::find_fie): New
6746         * plugin.cc (set_extra_library_path): New.
6747         (Plugin::load): Add set_extra_library_path to the transfer vector.
6748         (Plugin_manager::set_extra_library_path): New.
6749         (Plugin_manager::add_input_file): Use the extra search path if set.
6750         (set_extra_library_path(): New.
6751         * plugin.h (Plugin_manager): Add set_extra_library_path and
6752         extra_search_path_.
6753
6754 2010-06-19  Cary Coutant  <ccoutant@google.com>
6755
6756         * layout.cc (gdb_sections): Add .debug_types.
6757         (lines_only_debug_sections): Likewise.
6758
6759 2010-06-18  Rafael Espindola  <espindola@google.com>
6760
6761         * plugin.cc (add_input_file,add_input_library)
6762         (Plugin_manager::add_input_file): Make filename arguments const.
6763         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6764         const.
6765
6766 2010-06-16  Doug Kwan  <dougkwan@google.com>
6767
6768         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6769         .ARM.attributes section if we have not merged any input
6770         attributes sections.
6771
6772 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6773
6774         * arm.cc: Allow combining objects with no EABI version
6775         information.
6776
6777 2010-06-15  Rafael Espindola  <espindola@google.com>
6778
6779         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6780
6781 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6782
6783         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6784         (struct iovec): Correct !HAVE_READV definition.
6785
6786 2010-06-10  Cary Coutant  <ccoutant@google.com>
6787
6788         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6789         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6790         reloc sections.
6791         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6792
6793         PR 11683
6794         * symtab.h (Symbol::is_placeholder): New member function.
6795         * target-reloc.h (relocate_section): Check for placeholder symbols.
6796
6797         * testsuite/Makefile.am (plugin_test_8): New test.
6798         (plugin_test_9): New test.
6799         * testsuite/Makefile.in: Regenerate.
6800
6801 2010-06-09  Nick Clifton  <nickc@redhat.com>
6802
6803         * yyscript.y (input_list_element): Allow strings prefixed with
6804         the '-' character.  Treat these as libraries.
6805         * script.cc (script_add_library): New function.  Adds a library
6806         specified by "-l<name>" found in an input script.
6807         * script-c.h: Add prototype for script_add_library.
6808
6809 2010-06-07  Doug Kwan  <dougkwan@google.com>
6810
6811         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6812         Restrict stub-group size to be within long conditional branch
6813         range when working around cortex-A8 erratum.
6814
6815 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6816
6817         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6818         #ifdef typo.
6819
6820 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6821
6822         PR gold/11658
6823         * output.cc
6824         (Output_section::Input_section_sort_entry::compare_section_ordering):
6825         Change to return non-zero correctly.
6826         (Output_section::Input_section_sort_section_order_index_compare
6827         ::operator()): Change to fix ambiguity in comparisons.
6828
6829 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6830
6831         * gold.h (is_wildcard_string): New function.
6832         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6833         (Layout::layout_eh_frame): Ditto.
6834         (Layout::find_section_order_index): New method.
6835         (Layout::read_layout_from_file): New method.
6836         * layout.h (Layout::find_section_order_index): New method.
6837         (Layout::read_layout_from_file): New method.
6838         (Layout::input_section_position_): New private member.
6839         (Layout::input_section_glob_): New private member.
6840         * main.cc (main): Call read_layout_from_file here.
6841         * options.h (--section-ordering-file): New option.
6842         * output.cc (Output_section::input_section_order_specified_): New
6843         member.
6844         (Output_section::Output_section): Initialize new member.
6845         (Output_section::add_input_section): Add new parameter.
6846         Keep input sections when --section-ordering-file is used.
6847         (Output_section::set_final_data_size): Sort input sections when
6848         section ordering file is specified.
6849         (Output_section::Input_section_sort_entry): Add new parameter.
6850         Check sorting type.
6851         (Output_section::Input_section_sort_entry::compare_section_ordering):
6852         New method.
6853         (Output_section::Input_section_sort_compare::operator()): Change to
6854         consider section_order_index.
6855         (Output_section::Input_section_sort_init_fini_compare::operator()):
6856         Change to consider section_order_index.
6857         (Output_section::Input_section_sort_section_order_index_compare
6858         ::operator()): New method.
6859         (Output_section::sort_attached_input_sections): Change to sort
6860         according to section order when specified.
6861         (Output_section::add_input_section<32, true>): Add new parameter.
6862         (Output_section::add_input_section<64, true>): Add new parameter.
6863         (Output_section::add_input_section<32, false>): Add new parameter.
6864         (Output_section::add_input_section<64, false>): Add new parameter.
6865         * output.h (Output_section::add_input_section): Add new parameter.
6866         (Output_section::input_section_order_specified): New
6867         method.
6868         (Output_section::set_input_section_order_specified): New method.
6869         (Input_section::Input_section): Initialize section_order_index_.
6870         (Input_section::section_order_index): New method.
6871         (Input_section::set_section_order_index): New method.
6872         (Input_section::section_order_index_): New member.
6873         (Input_section::Input_section_sort_section_order_index_compare): New
6874         struct.
6875         (Output_section::input_section_order_specified_): New member.
6876         * script-sections.cc (is_wildcard_string): Delete and move modified
6877         method to gold.h.
6878         (Output_section_element_input::Output_section_element_input): Modify
6879         call to is_wildcard_string.
6880         (Output_section_element_input::Input_section_pattern
6881         ::Input_section_pattern): Ditto.
6882         (Output_section_element_input::Output_section_element_input): Ditto.
6883         * testsuite/Makefile.am (final_layout): New test case.
6884         * testsuite/Makefile.in: Regenerate.
6885         * testsuite/final_layout.cc: New file.
6886         * testsuite/final_layout.sh: New file.
6887
6888 2010-06-01  Rafael Espindola  <espindola@google.com>
6889
6890         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6891
6892 2010-06-01  Rafael Espindola  <espindola@google.com>
6893
6894         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6895         visibility of symbols.
6896
6897 2010-05-27  Doug Kwan  <dougkwan@google.com>
6898
6899         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6900         from start of output section instead of address for a local symbol
6901         in a merged or relaxed section when doing a relocatable link.
6902
6903 2010-05-26  Rafael Espindola  <espindola@google.com>
6904
6905         PR 11604
6906         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6907         adding sections the garbage collector removed.
6908         * gold/testsuite/Makefile.am: Add test.
6909         * gold/testsuite/Makefile.in: Regenerate.
6910         * gold/testsuite/plugin_test_7.sh: New.
6911         * gold/testsuite/plugin_test_7_1.c: New.
6912         * gold/testsuite/plugin_test_7_2.c: New.
6913
6914 2010-05-26  Rafael Espindola  <espindola@google.com>
6915
6916         * script-sections.cc (Output_section_definition::set_section_addresses):
6917         Check for --section-start.
6918
6919 2010-05-26  Doug Kwan  <dougkwan@google.com>
6920
6921         * arm.cc (Arm_scan_relocatable_relocs): New class.
6922         (Target_arm::relocate_special_relocatable): New method.
6923         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6924         (Arm_relocate_functions::thumb_branch_common): Same.
6925         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6926         instead of Default_scan_relocatable_relocs.
6927         * target-reloc.h (relocate_for_relocatable): Let target handle
6928         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6929         * target.h (Sized_target::relocate_special_relocatable): New method.
6930
6931 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6932
6933         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6934
6935 2010-05-23  Doug Kwan  <dougkwan@google.com>
6936
6937         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6938         instead of a cast.
6939         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6940         with a direct branch, not a conditional branch, to a stub.
6941         * merge.cc (Output_merge_base::record_input_section): New method
6942         defintion.
6943         (Output_merge_data::do_add_input_section): Record input section if
6944         keeps-input-sections flag is set.
6945         (Output_merge_string::do_add_input_section): Ditto.
6946         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6947         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6948         INPUT_SECTIONS_.
6949         (Output_merge_base::keeps_input_sections,
6950         Output_merge_base::set_keeps_input_sections,
6951         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6952         method definitions.
6953         (Output_merge_base::Input_sections): New type declaration.
6954         (Output_merge_base::input_sections_begin,
6955         Output_merge_base::input_sections_end,
6956         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6957         (Output_merge_base::bool keeps_input_sections_,
6958         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6959         Output_merge_base::input_sections_): New data members.
6960         (Output_merge_data::do_set_keeps_input_sections): New method
6961         defintion.
6962         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6963         * output.cc (Output_section::Input_section::relobj): Move method
6964         defintion from class declaration to here and handle merge sections.
6965         (Output_section::Input_section::shndx): Ditto.
6966         (Output_section::Output_section): Remove initializations of removed
6967         data members and initialize new data member LOOKUP_MAPS_.
6968         (Output_section::add_input_section): Set keeps-input-sections flag
6969         for a newly created merge output section as appropriate.  Adjust code
6970         to use Output_section_lookup_maps class.
6971         (Output_section::add_relaxed_input_section): Adjst code for lookup
6972         maps code refactoring.
6973         (Output_section::add_merge_input_section): Add a new parameter
6974         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6975         class.  If adding input section to a newly created merge output
6976         section fails, remove the new merge section.
6977         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6978         Adjust code for use of the Output_section_lookup_maps class.
6979         (Output_section::find_merge_section): Ditto.
6980         (Output_section::build_lookup_maps): New method defintion.
6981         (Output_section::find_relaxed_input_section): Adjust code to use
6982         Output_section_lookup_maps class.
6983         (Output_section::get_input_sections): Export merge sections.  Adjust
6984         code to use Output_section_lookup_maps class.
6985         (Output_section:::add_script_input_section): Adjust code to use
6986         Output_section_lookup_maps class.  Update lookup maps for merge
6987         sections also.
6988         (Output_section::discard_states): Use Output_section_lookup_maps.
6989         (Output_section::restore_states): Same.
6990         * output.h (Merge_section_properties): Move class defintion out of
6991         Output_section.
6992         (Output_section_lookup_maps): New class.
6993         (Output_section::Input_section::is_merge_section): New method
6994         defintion.
6995         (Output_section::Input_section::relobj): Move defintion out of class
6996         defintion.  Declare method only.
6997         (Output_section::Input_section::shndx): Ditto.
6998         (Output_section::Input_section::output_merge_base): New method defintion.
6999         (Output_section::Input_section::u2_.pomb): New union field.
7000         (Output_section::Merge_section_by_properties_map,
7001         Output_section::Output_section_data_by_input_section_map,
7002         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7003         Remove types.
7004         (Output_section::add_merge_input_section): Add new parameter
7005         KEEPS_INPUT_SECTIONS.
7006         (Output_section::build_lookup_maps): New method declaration.
7007         (Output_section::merge_section_map_,
7008         Output_section::merge_section_by_properties_map_,
7009         Output_section::relaxed_input_section_map_,
7010         Output_section::is_relaxed_input_section_map_valid_): Remove data
7011         members.
7012         (Output_section::lookup_maps_): New data member.
7013
7014 2010-05-21  Doug Kwan  <dougkwan@google.com>
7015
7016         PR gold/11619
7017         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7018         avoid a compilation error.
7019
7020 2010-05-19  Rafael Espindola  <espindola@google.com>
7021
7022         * script-sections.cc (Output_section_definition::allocate_to_segment):
7023         Update the phdrs_list even when the output section is NULL.
7024         * testsuite/Makefile.am: Add test.
7025         * testsuite/Makefile.in: Regenerate.
7026         * testsuite/script_test_9.cc: New.
7027         * testsuite/script_test_9.sh: New.
7028         * testsuite/script_test_9.t: New.
7029
7030 2010-05-19  Doug Kwan  <dougkwan@google.com>
7031
7032         * arm.cc (Arm_input_section::original_size): New method.
7033         (Arm_input_section::do_addralign): Add a cast.
7034         (Arm_input_section::do_output_offset): Remove static cast.
7035         (Arm_input_section::original_addralign,
7036          Arm_input_section::original_size_): Change type to uint32_t.
7037         (Arm_input_section::init): Add safe casts for section alignment
7038         and size.
7039         (Arm_input_section::set_final_data_size): Do not set address and
7040         offset of stub table.
7041         (Arm_output_section::fix_exidx_coverage): Change use of of
7042         Output_section::Simple_input_section to that of
7043         Output_section::Input_section.
7044         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7045         except for the first pass.
7046         * output.cc (Output_section::get_input_sections): Change type of
7047         input_sections to std::list<Input_section>.
7048         (Output_section::add_script_input_section): Rename from
7049         Output_section::add_simple_input_section.  Change type of SIS
7050         parameter from Simple_input_section to Input_section.
7051         * output.h (Output_section::Simple_input_section): Remove class.
7052         (Output_section::Input_section): Change class visibility to public.
7053         (Output_section::Input_section::addralign): Use stored alignments
7054         for special input sections if set.
7055         (Output_section::Input_section::set_addralign): New method.
7056         (Output_section::get_input_sections): Change parameter type from
7057         list of Simple_input_section to list of Input_section.
7058         (Output_section::add_script_input_section): Rename from
7059         Output_section::add_simple_input_section. Change first parameter's
7060         type from Simple_input_section to Input_section and remove the
7061         second and third parameters.
7062         * script-sections.cc (Input_section::Input_section_list): Change
7063         type to list of Output_section::Input_section/
7064         (Input_section_info::Input_section_info): Change parameter type of
7065         INPUT_SECTION to Output_section::Input_section.
7066         (Input_section_info::input_section): Change return type.
7067         (Input_section_info::input_section_): Change type to
7068         Output_section::Input_section.
7069         (Output_section_element_input::set_section_addresses): Adjust code
7070         to use Output_section::Input_section instead of
7071         Output_section::Simple_input_section.  Adjust code for renaming
7072         of Output_section::add_simple_input_section.
7073         (Orphan_output_section::set_section_addresses): Ditto.
7074
7075 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7076
7077         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7078         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7079
7080 2010-05-18  Rafael Espindola  <espindola@google.com>
7081
7082         * options.cc (General_options::finalize): Handle -nostdlib.
7083         * options.h (nostdlib): New option.
7084         * script.cc (script_add_search_dir): Handle -nostdlib.
7085
7086 2010-05-12  Doug Kwan  <dougkwan@google.com>
7087
7088         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7089         attributes section only if there no attributes section after merging.
7090         (Target_arm::merge_object_attributes): Move value of
7091         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7092         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7093         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7094         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7095         and arm_attr_merge_7.stdout.
7096         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7097         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7098         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7099         arm_attr_merge_7b.o): New rules.
7100         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7101         arm_attr_merge_7
7102         * testsuite/Makefile.in: Regenerate.
7103         * testsuite/arm_attr_merge.sh: New file.
7104         * testsuite/arm_attr_merge_[67][ab].s: Same.
7105
7106 2010-05-05  Nick Clifton  <nickc@redhat.com>
7107
7108         * po/es.po: Updated Spanish translation.
7109
7110 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7111
7112         * Makefile.am (install-exec-local): Properly install gold as
7113         default cross linker.
7114         * Makefile.in: Regenerated.
7115
7116 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7117             Nick Clifton  <nickc@redhat.com>
7118
7119         * configure.ac (install_as_default): Define and set to false
7120         unless --enable-gold or --enable-gold=both/gold has been
7121         specified.
7122         * configure: Regenerate.
7123
7124         * Makefile.am (install-exec-local): Install the executable as
7125         'ld.gold'.  If install_as_default is true then also install it as
7126         'ld'.
7127         * Makefile.in: Regenerated.
7128
7129 2010-04-24  Ian Lance Taylor  <iant@google.com>
7130
7131         * layout.cc (Layout::layout_reloc): In relocatable link don't
7132         combine reloc sections for grouped sections.
7133
7134 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7135
7136         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7137         sections that are not ordinary to icf.
7138         * icf.cc (get_section_contents): Handle relocation pointing to section
7139         with no object or shndx information.
7140         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7141         * testsuite/Makefile.in: Regenerate.
7142         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7143         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7144
7145 2010-04-22  Ian Lance Taylor  <iant@google.com>
7146
7147         * expression.cc (Expression::Expression_eval_info): Add
7148         result_alignment_pointer field.
7149         (Expression::eval_with_dot): Add result_alignment_pointer
7150         parameter.  Change all callers.
7151         (Expression::eval_maybe_dot): Likewise.
7152         (class Binary_expression): Add alignment_pointer parameter to
7153         left_value and right_value.  Change all callers.
7154         (BINARY_EXPRESSION): Set result alignment.
7155         (class Trinary_expression): Add alignment_pointer parameter to
7156         arg2_value and arg3_value.  Change all callers.
7157         (Trinary_cond::value): Set result alignment.
7158         (Max_expression::value, Min_expression::value): Likewise.
7159         (Align_expression::value): Likewise.
7160         * script-sections.cc (class Sections_element): Add dot_alignment
7161         parameter to set_section_addresses virtual function.  Update
7162         instantiations.
7163         (class Output_section_element): Likewise.
7164         (Script_sections::create_segments): Add dot_alignment parameter.
7165         Change all callers.
7166         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7167         (Script_sections::set_phdrs_clause_addresses): Likewise.
7168         * script-sections.h: Update declarations.
7169         * script.h: Update declarations.
7170         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7171         min_p_align.
7172         * testsuite/script_test_3.t: Set large alignment.
7173         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7174         segment has expected alignment.
7175
7176 2010-04-22  Nick Clifton  <nickc@redhat.com>
7177
7178         * po/gold.pot: Updated by the Translation project.
7179         * po/vi.po: Updated Vietnamese translation.
7180
7181 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7182
7183         * testsuite/Makefile.am (check_PROGRAMS): Add
7184         icf_virtual_function_folding_test.
7185         * testsuite/Makefile.in: Regenerated.
7186
7187 2010-04-15  Andrew Haley  <aph@redhat.com>
7188
7189         * options.h (merge_exidx_entries): New option.
7190         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7191         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7192         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7193         (Target_arm::merge_exidx_entries): New function.
7194         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7195         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7196         to Arm_exidx_fixup constructor.
7197         Add new arg, merge_exidx_entries.
7198         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7199         Arm_output_section::fix_exidx_coverage.
7200
7201 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7202
7203         * icf.cc (get_section_contents): Check for preemptible functions.
7204         Ignore addend when appropriate.
7205         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7206         section folded.
7207         (add_from_relobj): Check for section folded.
7208         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7209         * symtab.h (should_add_dynsym_entry): Add new parameter.
7210         * target-reloc.h (scan_relocs): Check for section folded.
7211         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7212         Check reloc types for function pointers in shared objects.
7213         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7214         case.
7215         (icf_preemptible_functions_test): New test case.
7216         (icf_string_merge_test): New test case.
7217         * testsuite.Makefile.in: Regenerate.
7218         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7219         bar_glob.  Refactor code.
7220         * testsuite/icf_preemptible_functions_test.cc: New file.
7221         * testsuite/icf_preemptible_functions_test.sh: New file.
7222         * testsuite/icf_string_merge_test.cc: New file.
7223         * testsuite/icf_string_merge_test.sh: New file.
7224         * testsuite/icf_virtual_function_folding_test.cc: New file.
7225         * testsuite/icf_virtual_function_folding_test.sh: New file.
7226
7227 2010-04-14  Doug Kwan  <dougkwan@google.com>
7228
7229         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7230         for local symbol recounting if we remove a section due to ICF.
7231         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7232         there are no regular objects in input.
7233
7234 2010-04-13  Doug Kwan  <dougkwan@google.com>
7235
7236         * arm.cc (Arm_input_section::set_final_data_size): Compute
7237         accurate final data size instead of using current data size.
7238
7239 2010-04-09  Doug Kwan  <dougkwan@google.com>
7240
7241         * layout.cc (Layout::choose_output_section): Handle script section
7242         types.
7243         (Layout::make_output_section_for_script): Add section type parameter.
7244         Handle script section types.
7245         * layout.h (Layout::make_output_section_for_script): Add section
7246         type parameter.
7247         * output.cc (Output_section::Output_section): Initialize data member
7248         is_noload_.
7249         (Output_section::do_reset_address_and_file_offset): Do not set address
7250         to 0 if section is a NOLOAD section.
7251         * output.h (Output_section::is_noload): New method.
7252         (Output_section::set_is_noload): Ditto.
7253         (Output_section::is_noload_): New data member.
7254         * script-c.h (Script_section_type): New enum type.
7255         (struct Parser_output_section_header): Add new file section_type.
7256         * script-sections.cc (Sections_element::output_section_name): Add
7257         parameter for returning script section type.
7258         (Output_section_definition::output_section_name): Ditto.
7259         (Output_section_definition::section_type)P; New method.
7260         (Output_section_definiton::script_section_type_name): Ditto.
7261         (Output_section_definition::script_section_type_): New data member.
7262         (Output_section_definition::Output_section_definition): Initialize
7263         data member Output_section_definition::script_section_type_.
7264         (Output_section_definition::create_sections): Pass script section type
7265         to Layout::make_output_section_for_script.
7266         (Output_section_definition::output_section_name): Return script
7267         section type to caller.
7268         (Output_section_definition::set_section_address): Do not advance
7269         dot value and load address if section type is NOLOAD.  Set address
7270         of NOLOAD sections regardless of section flags.
7271         (Output_section_definition::print): Print section type if it is
7272         not SCRIPT_SECTION_TYPE_NONE.
7273         (Output_section_definition::section_type): New method.
7274         (Output_section_definition::script_section_type_name): Ditto.
7275         (Script_sections::output_section_name): Add new parameter
7276         PSECTION_TYPE for returning script section type.  Pass it to
7277         section elements.  Handle discard sections.
7278         (Sort_output_sections::operator()): Handle NOLOAD sections.
7279         * script-sections.h (Script_sections::Section_type): New enum type.
7280         (Script_sections::output_section_name): Add a new parameter for
7281         returning script section type.
7282         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7283         INFO and NOLOAD.
7284         * yyscript.y (union): Add new field SECTION_TYPE.
7285         (COPY, DSECT, INFO, NOLOAD): New tokens.
7286         (opt_address_and_section_type): Change type to output_section_header.
7287         (section_type): New non-terminal
7288         (section_header): Handle section type.
7289         (opt_address_and_section_type): Return section type value.
7290
7291 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7292
7293         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7294         * testsuite/plugin_common_test_2.c (foo): Likewise.
7295
7296 2010-04-08  Doug Kwan  <dougkwan@google.com>
7297
7298         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7299         Output_merge_data.
7300         * output.cc (Output_section::add_merge_input_section): Simplify
7301         code and return status of Output_merge_base::add_input_section.
7302         Update merge section map only if Output_merge_base::add_input_section
7303         returns true.
7304
7305 2010-04-07  Doug Kwan  <dougkwan@google.com>
7306
7307         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7308         if section is marked as containing instructions but has no mapping
7309         symbols.
7310         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7311         correct section index.
7312         (Arm_relobj::find_linked_text_section): Ditto.
7313
7314 2010-04-07  Cary Coutant  <ccoutant@google.com>
7315
7316         * archive.cc (include_member): Destroy Read_symbols_data object before
7317         releasing file.
7318         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7319         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7320         (Read_symbols_data::~Read_symbols_data) New destructor.
7321         (Section_relocs::Section_relocs) New constructor.
7322         (Section_relocs::~Section_relocs) New destructor.
7323         (Read_relocs_data::Read_relocs_data) New constructor.
7324         (Read_relocs_data::~Read_relocs_data) New destructor.
7325         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7326         pointers to NULL after deleting.
7327
7328 2010-04-07  Doug Kwan  <dougkwan@google.com>
7329
7330         * arm.cc: Replace "endianity" with "endianness" in comments.
7331         (Arm_exidx_cantunwind): Ditto.
7332         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7333         (Arm_relobj::merge_flags_and_attributes): New method.
7334         (Arm_relobj::merge_flags_and_attributes_): New data member.
7335         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7336         (Arm_relobj::scan_sections_for_stubs): Ditto.
7337         (Arm_relobj::do_read_symbols): Check to see if we really want to
7338         merge processor-specific flags and attributes.  Exit early if
7339         an object is empty except for section names and the undefined symbol.
7340         (Target_arm::do_finalize_sections): Move check for ELF format to
7341         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7342         attributes from a regular object only when we have determined that
7343         it is aapropriate.  Do not create an .ARM.attributes section in
7344         output if there is no regular input object.
7345         (Target_arm::merge_processor_specific_flags): Check
7346         --warn-mismatch before printing any error.
7347         (Target_arm::merge_object_attributes): Ditto.
7348         * gold.cc (queue_middle_tasks): Handle the case in which there is
7349         no regular object in input.
7350         * options.cc (General_options::parse_EB): New method.
7351         (General_options::parse_EL): Same.
7352         (General_options::General_options): Initialize endianness_.
7353         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7354         New options.
7355         (General_options::Endianness): New enum.
7356         (General_options::endianness): New method.
7357         (General_options::endianness_): New data member.
7358         * parameters.cc (Parameters::set_options): Check target endianness.
7359         (Parameters::set_target_once): Ditto.
7360         (Parameters::check_target_endianness): New method.
7361         (parameters_force_valid_target): If either -EL or -EB is specified,
7362         use it to define endianness of default target.
7363         * parameters.h (Parameters::check_target_endianness): New method
7364         declaration.
7365         * target.h (class Target): Change "endianity" to "endianness"
7366         in comments.
7367
7368 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7369
7370         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7371         * configure: Regenerate.
7372         * Makefile.in: Regenerate.
7373         * testsuite/Makefile.in: Regenerate.
7374
7375 2010-04-06  Cary Coutant  <ccoutant@google.com>
7376
7377         gcc PR lto/42757
7378         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7379         prevailing definitions of common symbols.
7380         * testsuite/plugin_test_6.sh: New test case.
7381         * testsuite/plugin_common_test_1.c: New test case.
7382         * testsuite/plugin_common_test_2.c: New test case.
7383         * testsuite/Makefile.am (plugin_test_6): New test case.
7384         * testsuite/Makefile.in: Regenerate.
7385
7386 2010-04-06  Nick Clifton  <nickc@redhat.com>
7387
7388         * po/vi.po: New Vietnamese translation.
7389
7390 2010-03-30  Doug Kwan  <dougkwan@google.com>
7391
7392         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7393
7394 2010-03-25  Doug Kwan  <dougkwan@google.com>
7395
7396         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7397         to avoid a conversion warning on a 32-bit host.
7398
7399 2010-03-24  Ian Lance Taylor  <iant@google.com>
7400
7401         * testsuite/script_test_3.t: Add a TLS segment.
7402         * testsuite/Makefile.am (check_PROGRAMS): Add
7403         tls_phdrs_script_test.
7404         (tls_phdrs_script_test_SOURCES): Define.
7405         (tls_phdrs_script_test_DEPENDENCIES): Define.
7406         (tls_phdrs_script_test_LDFLAGS): Define.
7407         (tls_phdrs_script_test_LDADD): Define.
7408         * testsuite/Makefile.in: Rebuild.
7409
7410 2010-03-23  Cary Coutant  <ccoutant@google.com>
7411
7412         * fileread.cc (find_or_make_view): Fix comment.
7413
7414 2010-03-23  Ian Lance Taylor  <iant@google.com>
7415
7416         * script-sections.cc (class Orphan_section_placement): Define
7417         PLACE_TLS and PLACE_TLS_BSS.
7418         (Orphan_section_placement::Orphan_section_placement): Initialize
7419         new places.
7420         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7421         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7422         (tls_script_test_SOURCES): Define.
7423         (tls_script_test_DEPENDENCIES): Define.
7424         (tls_script_test_LDFLAGS): Define.
7425         (tls_script_test_LDADD): Define.
7426         * testsuite/Makefile.in: Rebuild.
7427
7428 2010-03-22  Doug Kwan  <dougkwan@google.com>
7429
7430         * arm.cc (Arm_relocate_functions::abs8,
7431         Arm_relocate_functions::abs16): Use correct check for overflow
7432         specified in the ARM ELF specs.
7433         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7434         target of a BLX instruction specially.
7435         (Reloc_stub::stub_type_for_reloc): Ditto.
7436         (Relocate::relocate): Use symbolic names instead of numeric relocation
7437         codes to report error.
7438         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7439         workaround.
7440         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7441         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7442         thumb2_blx_out_of_range.stdout
7443         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7444         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7445         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7446         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7447         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7448         thumb2_blx_in_range, thumb2_blx_in_range.o,
7449         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7450         thumb2_blx_out_of_range.o): New rules.
7451         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7452         thumb2_blx_in_range and thumb2_blx_out_of_range.
7453         * testsuite/Makefile.in: Regenerate.
7454         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7455         * testsuite/thumb_blx_in_range.s: New file.
7456         * testsuite/thumb_blx_out_of_range.s: New file.
7457
7458 2010-03-22  Rafael Espindola  <espindola@google.com>
7459
7460         * archive.cc (Should_include): Move to archive.h.
7461         (should_include_member): Make it a member of Archive.
7462         (Lib_group): New.
7463         (Add_lib_group_symbols): New.
7464         * archive.h: Include options.h.
7465         (Archive_member): Moved from Archive.
7466         (Should_include): Moved from archive.cc.
7467         (Lib_group): New.
7468         (Add_lib_group_symbols): New.
7469         * dynobj.cc (do_should_include_member): New.
7470         * dynobj.h (do_should_include_member): New.
7471         * gold.cc (queue_initial_tasks): Update call to queue.
7472         * main.cc (main): Print lib group stats.
7473         * object.cc (do_should_include_member): New.
7474         * object.h: Include archive.h.
7475         (Object::should_include_member): New.
7476         (Object::do_should_include_member): New.
7477         (Sized_relobj::do_should_include_member): New.
7478         * options.cc (General_options::parse_start_lib): New.
7479         (General_options::parse_end_lib): New.
7480         (Input_arguments::add_file): Handle lib groups.
7481         (Input_arguments::start_group): Check we are not in a lib.
7482         (Input_arguments::start_lib): New.
7483         (Input_arguments::end_lib): New.
7484         * options.h (General_options): Add start_lib and end_lib.
7485         (Input_argument::lib_): New.
7486         (Input_argument::lib): New.
7487         (Input_argument::is_lib): New.
7488         (Input_file_lib): New.
7489         (Input_arguments::in_lib_): New.
7490         (Input_arguments::in_lib): New.
7491         (Input_arguments::start_lib): New.
7492         (Input_arguments::end_lib_): New.
7493         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7494         in unused members as preempted.
7495         (Sized_pluginobj::do_should_include_member): New.
7496         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7497         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7498         return the blocker.
7499         (Read_symbols::do_whole_lib_group): New.
7500         (Read_symbols::do_lib_group): New.
7501         (Read_symbols::do_read_symbols): Handle lib groups.
7502         (Read_symbols::get_name): Handle lib groups.
7503         * readsyms.h (Read_symbols): Add an archive member pointer.
7504         (Read_symbols::do_whole_lib_group): New.
7505         (Read_symbols::do_lib_group): New.
7506         (Read_symbols::member_): New.
7507         * script.cc (read_input_script): Update call to queue_soon.
7508
7509 2010-03-19  Doug Kwan  <dougkwan@google.com>
7510
7511         * arm.cc (Stub_table::Stub_table): Initialize new data members
7512         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7513         (Stub_table::add_reloc_stub): Assign stub offset and update
7514         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7515         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7516         New data members.
7517         (Stub_table::update_data_size_and_addralign): Use
7518         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7519         instead of going over all reloc stubs.
7520         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7521         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7522         Stringpool_template::offset_ to size of Stringpool_char.
7523         (Stringpool_template::new_key_offset): Remove code to initialize
7524         Stringpool_template::offset_.
7525         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7526         Stringpool_template::offset_ to zero.
7527
7528 2010-03-15  Doug Kwan  <dougkwan@google.com>
7529
7530         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7531         offset_.
7532         (Stringpool_template::new_key_offset): New method.
7533         (Stringpool_template::add_string): Assign offsets when adding new
7534         strings.
7535         (Stringpool_template::set_string_offsets): Do not set string offsets
7536         when not optimizing.
7537         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7538         member size_.
7539         (Chunked_vector::clear): Clear size_.
7540         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7541         (Chunked_vector::size): Return size_.
7542         (Chunked_vector::push_back): Use size_ to find insert position.
7543         (Chunked_vector::size_): New data member.
7544         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7545         (Stringpool_template::new_key_offset): New method declaration.
7546         (Stringpool_template::offset_): New data member.
7547
7548 2010-03-15   Rafael Espindola  <espindola@google.com>
7549
7550         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7551         Add_symbols' constructor.
7552         * readsyms.h (Add_symbols): Remove the input_group member.
7553
7554 2010-03-10  Ian Lance Taylor  <iant@google.com>
7555
7556         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7557         target to ask whether a reference to a symbol requires a stack
7558         split.
7559         * target.h (Target::is_call_to_non_split): New function.
7560         (Target::do_is_call_to_non_split): Declare virtual function.
7561         * target.cc: Include "symtab.h".
7562         (Target::do_is_call_to_non_split): New function.
7563         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7564
7565 2010-03-10  Cary Coutant  <ccoutant@google.com>
7566
7567         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7568         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7569         (File_read::open[2]): Add whole_file_view_ to list of views.
7570         (File_read::make_view): Remove test of whole_file_view_.
7571         (File_read::find_or_make_view): Create whole_file_view_ if
7572         necessary.
7573         (File_read::clear_views): Replace bool parameter with enum;
7574         adjust all callers.  Don't delete views with permanent data;
7575         do delete cached views and views from archives if
7576         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7577         if clearing the corresponding view.
7578         * fileread.h (File_read::Clear_views_mode): New enum.
7579         (File_read::View::is_permanent_view): New method.
7580         (File_read::clear_views): Replace bool parameter
7581         with enum; adjust all callers.
7582         * options.h (General_options): Change keep_files_mapped option;
7583         add map_whole_files.
7584         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7585         releasing the file.
7586         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7587         the file.
7588
7589 2010-03-10  David S. Miller  <davem@davemloft.net>
7590
7591         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7592
7593 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7594
7595         * icf.cc (get_section_contents): Add '@' marker after processing the
7596         merge reloc.
7597
7598 2010-03-08  Doug Kwan  <dougkwan@google.com>
7599
7600         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7601         due to a conversion warning.
7602         (Arm_relobj::update_output_local_symbol_count): Check for local
7603         symbol with unset output index.
7604
7605 2010-03-05  Ian Lance Taylor  <iant@google.com>
7606
7607         * options.h (class General_options): Add --spare-dynamic-tags.
7608         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7609         --spare-dynamic-tags.
7610
7611 2010-03-05  Ian Lance Taylor  <iant@google.com>
7612
7613         * incremental.cc: Include "libiberty.h".
7614
7615 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7616
7617         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7618         function, is_info_ member.
7619         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7620         (Versions::Versions): Update caller.
7621         (Versions::define_base_version): Likewise.
7622         (Versions::add_def): Likewise.
7623
7624 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7625
7626         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7627         (Scan::possible_function_pointer_reloc): New function.
7628         (Scan::local_reloc_may_be_function_pointer): Change to call
7629         possible_function_pointer_reloc.
7630         (Scan::global_reloc_may_be_function_pointer): Ditto.
7631         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7632         relocations in ".data.rel.ro._ZTV" section.
7633         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7634         * testsuite/icf_safe_so_test.cc: Ditto.
7635         * testsuite/icf_safe_test.cc: Ditto.
7636         * testsuite/icf_safe_test.sh: Ditto.
7637
7638 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7639             Ian Lance Taylor  <iant@google.com>
7640
7641         * target-reloc.h (relocate_section): Check the symbol table index
7642         for -1U before setting the local symbol index.
7643         (scan_relocatable_relocs): If copying the relocation, record that
7644         the local symbol is required.
7645         * object.h (Symbol_value::is_output_symtab_index_set): New
7646         function.
7647         (Symbol_value::may_be_discarded_from_output_symtab): New
7648         function.
7649         (Symbol_value::has_output_symtab_entry): New function.
7650         (Symbol_value::needs_output_symtab_entry): Remove.
7651         (Symbol_value::output_symtab_index): Make sure the symbol index is
7652         set.
7653         (Symbol_value::set_output_symtab_index): Make sure the symbol
7654         index is not set.  Make sure the new index is valid.
7655         (Symbol_value::set_must_have_output_symtab_entry): New function.
7656         (Symbol_value::has_output_dynsym_entry): New function.
7657         (Symbol_value::set_output_dynsym_index): Make sure the new index
7658         is valid.
7659         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7660         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7661         local symbol if permitted.
7662         (Sized_relobj::do_finalize_local_symbols): Call
7663         is_output_symtab_index_set rather than needs_output_symtab_entry.
7664         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7665         rather than needs_output_symtab_entry.  Call
7666         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7667         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7668         is_output_symtab_index_set rather than needs_output_symtab_entry.
7669         * testsuite/discard_locals_relocatable_test.c: New file.
7670         * testsuite/discard_locals_test.sh: Test -r.
7671         * testsuite/Makefile.am (check_DATA): Add
7672         discard_locals_relocatable_test1.syms,
7673         discard_local_relocatable_test2.syms.
7674         (MOSTLYCLEANFILES): Likewise.  Also add
7675         discard_locals_relocatable_test1.lout and
7676         discard_locals_relocatable_test2.out.
7677         (discard_locals_relocatable_test1.syms): New target.
7678         (discard_locals_relocatable_test.o): New target.
7679         (discard_locals_relocatable_test1.out): New target.
7680         (discard_locals_relocatable_test2.syms): New target.
7681         (discard_locals_relocatable_test2.out): New target.
7682         (various): Add missing ../ld-new dependencies.
7683         * testsuite/Makefile.in: Rebuild.
7684
7685 2010-03-03  Nick Clifton  <nickc@redhat.com>
7686
7687         * po/fi.po: New Finnish translation.
7688
7689 2010-03-01  Doug Kwan  <dougkwan@google.com>
7690
7691         * layout.cc (Layout::Layout): Force section types of .init_array*,
7692         .preinit_array* and .fini_array* sections.
7693         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7694         Fix check of return value of std::string::find.().
7695         (Output_section::Input_section_sort_compare::operator()): Remove
7696         comment about .init_array.
7697         (Output_section::Input_section_sort_init_fini_compare::operator()):
7698         New method.
7699         (Output_section::sort_attached_input_sections): Handle .init_array
7700         and .fini_array specially.
7701         * output.h (Output_section::Inut_section_sort_compare): Update
7702         comment.
7703         (Output_section::Input_section_sort_init_fini_compare): New struct.
7704
7705 2010-02-26  Doug Kwan  <dougkwan@google.com>
7706
7707         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7708         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7709         * testsuite/debug_msg.sh: Avoid matching source line number for
7710         use of global variable undef_int.
7711
7712 2010-02-26  Doug Kwan  <dougkwan@google.com>
7713
7714         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7715         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7716         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7717         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7718         * options.cc (General_options::General_options): Initialize member
7719         fix_v4bx_.
7720         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7721         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7722         and rm_no_fix_v4bx.stdout
7723         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7724         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7725         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7726         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7727         and arm_no_fix_v4bx.
7728         * Makefile.in: Regenerate.
7729         * testsuite/arm_fix_v4bx.s: New file.
7730         * testsuite/arm_fix_v4bx.sh: Ditto.
7731
7732 2010-02-24  Doug Kwan  <dougkwan@google.com>
7733
7734         * arm.cc (Target_arm::got_section): Make the .got section the first
7735         non RELRO section in the data segment.
7736         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7737         suffixes of section names.
7738
7739 2010-02-24  Doug Kwan  <dougkwan@google.com>
7740
7741         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7742         flags and attributes merging if an input file is a binary file.
7743         * fileread.cc (Input_file::open): Record format of original file.
7744         * fileread.h (Input_file::Format): New enum type.
7745         (Input_file::Input_file): Initialize data member format_.
7746         (Input_file::format): New method definition.
7747         (Input_file::format_):: New data member.
7748
7749 2010-02-24  Doug Kwan  <dougkwan@google.com>
7750
7751         * arm.cc (Arm_output_data_got): New class.
7752         (ARM_TCB_SIZE): New constant
7753         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7754         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7755         If user uses a script with a SECTIONS clause, issue only a warning
7756         for a misplaced EXIDX input section.  Otherwise, issue an error.
7757         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7758         garbage collection.
7759         (Target_arm::got_mode_index_entry): Handle static linking.
7760         (Target_arm::Scan::local): Ditto.
7761         (Target_arm::Scan::global): Ditto.
7762         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7763         all incorrectly implemented relocations.
7764         (Target_arm::fix_exidx_coverage): Pass layout to
7765         Arm_output_section::fix_exidx_coverage.
7766         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7767         from ".ARM.exidx." and ".ARM.extab.".
7768
7769 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7770
7771         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7772         section if it does not already exist.
7773         * attributes.cc (Attributes_section_data::Attributes_section_data):
7774         Don't crash if size is zero.
7775
7776 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7777             Ian Lance Taylor  <iant@google.com>
7778
7779         * gold.cc (queue_middle_tasks): If no input files were opened,
7780         exit.
7781         * workqueue.h (Task_function::Task_function): Assert that there is
7782         a blocker.
7783
7784 2010-02-22  Doug Kwan  <dougkwan@google.com>
7785
7786         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7787         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7788         types to avoid warnings due to different uint64_t implementations
7789         on different hosts.
7790
7791 2010-02-21  Doug Kwan  <dougkwan@google.com>
7792
7793         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7794         handling of the maximum backward branch offset.
7795         (Arm_relocate_functions::thumb_branch_common): Ditto.
7796         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7797         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7798         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7799         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7800         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7801         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7802         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7803         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7804         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7805         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7806         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7807         thumb2_bl_out_of_range.o): New rules.
7808         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7809         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7810         thumb2_bl_out_of_range
7811         * testsuite/Makefile.in: Regenerate.
7812         * testsuite/arm_bl_in_range.s: New file.
7813         * testsuite/arm_bl_out_of_range.s: Ditto.
7814         * testsuite/arm_branch_in_range.sh: Ditto.
7815         * testsuite/arm_branch_range.t: Ditto.
7816         * testsuite/thumb2_branch_range.t: Ditto.
7817         * testsuite/thumb_bl_in_range.s: Ditto.
7818         * testsuite/thumb_bl_out_of_range.s: Ditto.
7819         * testsuite/thumb_branch_range.t: Ditto.
7820
7821 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7822
7823         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7824         Add reloc offset information.
7825         * icf.cc (get_section_contents): Change iterators to point to the new
7826         vectors. Add reloc offset information to the contents.
7827         * icf.h (Icf::Sections_reachable_info): New typedef.
7828         (Icf::Sections_reachable_list): New typedef.
7829         (Icf::Offset_info): New typedef.
7830         (Icf::Reloc_info): New struct typedef.
7831         (Icf::Reloc_info_list): New typedef.
7832         (Icf::symbol_reloc_list): Delete method.
7833         (Icf::addend_reloc_list): Delete method.
7834         (Icf::section_reloc_list): Delete method.
7835         (Icf::reloc_info_list): New method.
7836         (Icf::reloc_info_list_): New member.
7837
7838 2010-02-19  Doug Kwan  <dougkwan@google.com>
7839
7840         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7841         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7842         * arm.cc (Arm_relocation_functions): New forward declaration.
7843         (Target_arm::Target_arm): Initialize new data members
7844         got_mod_index_offset_ and tls_base_symbol_defined_.
7845         (Target_arm::Relocate::relocate_tls): New method.
7846         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7847          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7848         New methods.
7849         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7850         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7851         (Target_arm::got_mod_index_offset_,
7852         Target_arm::tls_base_symbol_defined_): New data members.
7853         (Target_arm::Scan::local, Target::Scan::global,
7854         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7855         relocations.
7856
7857 2010-02-18  Doug Kwan  <dougkwan@google.com>
7858
7859         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7860         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7861         text section as a parameter becuase some broken tools may not set
7862         the link in section header.
7863         (Target_arm::has_got_section): New method.
7864         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7865         without any mapping symbol as data only.  Remove warning.
7866         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7867         link in its section header, try to discover the link by inspecting the
7868         REL31 relocation at the beginning of the section.
7869         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7870         in error message.
7871         (Target_arm::Scan::global): Treat any reference to the symbol
7872         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7873
7874 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7875
7876         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7877         (Scan::global_reloc_may_be_function_pointer): New function.
7878         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7879         (Scan::global_reloc_may_be_function_pointer): New function.
7880         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7881         (Scan::global_reloc_may_be_function_pointer): New function.
7882         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7883         (Scan::global_reloc_may_be_function_pointer): New function.
7884         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7885         (Scan::global_reloc_may_be_function_pointer): New function.
7886         (Scan::possible_function_pointer_reloc): New function.
7887         (Target_x86_64::can_check_for_function_pointers): New function.
7888         * gc.h (gc_process_relocs): Scan relocation types to determine if
7889         function pointers were taken for targets that support it.
7890         * icf.cc (Icf::find_identical_sections): Include functions for
7891         folding in safe ICF whose pointer is not taken.
7892         * icf.h (Secn_fptr_taken_set): New typedef.
7893         (fptr_section_id_): New member.
7894         (section_has_function_pointers): New function.
7895         (set_section_has_function_pointers): New function.
7896         (check_section_for_function_pointers): New function.
7897         * options.h: Fix comment for safe ICF option.
7898         * target.h (can_check_for_function_pointers): New function.
7899         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7900         Modify icf_safe_test for X86-64.
7901         * testsuite/Makefile.in: Regenerate.
7902         * testsuite/icf_safe_so_test.cc: New file.
7903         * testsuite/icf_safe_so_test.sh: New file.
7904         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7905         (main): Change to take pointer to function kept_func_3.
7906         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7907         folding is done correctly for X86-64.
7908
7909 2010-02-12  David S. Miller  <davem@davemloft.net>
7910
7911         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7912         is_symbolless parameter.
7913         (Output_reloc<SHT_REL>::is_symbolless): New.
7914         (Output_reloc<SHT_REL>::is_symbolless_): New.
7915         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7916         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7917         (Output_reloc<SHT_RELA>::is_symbolless): New.
7918         (Output_data_reloc::add_global): Handle is_symbolless.
7919         (Output_data_reloc::add_global_relative): Likewise.
7920         (Output_data_reloc::add_local): Likewise.
7921         (Output_data_reloc::add_local_relative): Likewise.
7922         (Output_data_reloc::add_symbolless_global_addend): New.
7923         (Output_data_reloc::add_symbolless_local_addend): New.
7924         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7925         is_symbolless.
7926         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7927         instead of ->is_relative_
7928         (Output_reloc::write): Likewise.
7929         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7930         (Output_reloc::write_rel): Simplify.
7931
7932         * sparc.cc (Target_sparc::Scan::local): Use
7933         ->add_symbolless_local_addend as needed.
7934         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7935         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7936         based upon relocation offset.
7937
7938 2010-02-11  Doug Kwan  <dougkwan@google.com>
7939
7940         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7941         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7942         beginning of function.
7943         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7944         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7945         parameter is_32bit in calls to should_apply_static_reloc.
7946         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7947         (check_DATA): Add arm_abs_global.stdout.
7948         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7949         arm_abs_global.stdout): New rules.
7950         (MOSTLLYCLEANFILES): Add arm_abs_global
7951         * Makefile.in: Regenerate.
7952         * testsuite/arm_abs_global.s: New file.
7953         * testsuite/arm_abs_global.sh: Ditto.
7954         * testsuite/arm_abs_lib.s: Ditto.
7955
7956 2010-02-11  Ian Lance Taylor  <iant@google.com>
7957
7958         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7959         Read_relocs task.
7960         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7961         Allocate_commons_task first.
7962         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7963         task, rather than symtab_lock_.
7964         (Gc_process_relocs::~Gc_process_relocs): New function.
7965         (Gc_process_relocs::is_runnable): Check this_blocker_.
7966         (Gc_process_relocs::locks): Use next_blocker_ rather than
7967         blocker_.
7968         (Scan_relocs::~Scan_relocs): New function.
7969         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7970         symtab_lock_.
7971         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7972         next_blocker_.
7973         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7974         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7975         constructor accordingly.
7976         (class Gc_process_relocs): Likewise.
7977         (class Scan_relocs): Likewise.
7978         * common.h (class Allocate_commons_task): Remove symtab_lock_
7979         field, and corresponding constructor parameter.
7980         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7981         symtab_lock_.
7982         (Allocate_commons_task::locks): Likewise.
7983
7984 2010-02-11  Ian Lance Taylor  <iant@google.com>
7985
7986         * gold-threads.h (class Once): Define.
7987         (class Initialize_lock): Rewrite as child of Once.
7988         * gold-threads.cc (class Once_initialize): Define.
7989         (once_pointer_control): New static variable.
7990         (once_pointer, once_arg): New static variables.
7991         (c_run_once): New static function.
7992         (Once::Once, Once::run_once, Once::internal_run): New functions.
7993         (class Initialize_lock_once): Remove.
7994         (initialize_lock_control): Remove.
7995         (initialize_lock_pointer): Remove.
7996         (initialize_lock_once): Remove.
7997         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7998         (Initialize_lock::initialize): Rewrite.
7999         (Initialize_lock::do_run_once): New function.
8000         * archive.cc (Archive::interpret_header): Only clear name if it is
8001         not already empty.
8002         * fileread.cc: Include "gold-threads.h"
8003         (file_counts_lock): New static variable.
8004         (file_counts_initialize_lock): Likewise.
8005         (File_read::release): Only increment counts when using --stats.
8006         Use a lock around the increment.
8007         * parameters.cc (class Set_parameters_target_once): Define.
8008         (set_parameters_target_once): New static variable.
8009         (Parameters::Parameters): Move here from parameters.h.
8010         (Parameters::set_target): Rewrite.
8011         (Parameters::set_target_once): New function.
8012         (Parameters::clear_target): Move here and rewrite.
8013         * parameters.h (class Parameters): Update declarations.  Add
8014         set_parameters_target_once_ field.
8015         (Parameters::Parameters): Move to parameters.cc.
8016         (Parameters::clear_target): Likewise.
8017         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8018         task.
8019         (Start_group::~Start_group): New function.
8020         (Start_group::is_runnable): New function.
8021         (Start_group::locks, Start_group::run): New functions.
8022         (Finish_group::run): Change saw_undefined to size_t.
8023         * readsyms.h (class Start_group): Define.
8024         (class Finish_group): Change saw_undefined_ field to size_t.
8025         (Finish_group::Finish_group): Remove saw_undefined and
8026         this_blocker parameters.  Change all callers.
8027         (Finish_group::set_saw_undefined): New function.
8028         (Finish_group::set_blocker): New function.
8029         * symtab.h (class Symbol_table): Change saw_undefined to return
8030         size_t.  Change saw_undefined_ field to size_t.
8031         * target-select.cc (Set_target_once::do_run_once): New function.
8032         (Target_selector::Target_selector): Initialize set_target_once_
8033         field.  Don't initialize lock_ and initialize_lock_ fields.
8034         (Target_selector::instantiate_target): Rewrite.
8035         (Target_selector::set_target): New function.
8036         * target-select.h (class Set_target_once): Define.
8037         (class Target_selector): Update declarations.  Make
8038         Set_target_once a friend.  Remove lock_ and initialize_lock_
8039         fields.  Add set_target_once_ field.
8040
8041 2010-02-10  Ian Lance Taylor  <iant@google.com>
8042
8043         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8044         queueing any tasks.
8045         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8046         (queue_middle_tasks): Add all blockers before queueing any tasks.
8047         (queue_final_tasks): Likewise.
8048         * token.h (Task_token::add_blockers): New function.
8049         * object.h (Input_objects::number_of_relobjs): New function.
8050
8051 2010-02-10  Ian Lance Taylor  <iant@google.com>
8052
8053         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8054         shared, not if not position independent.
8055         * x86_64.cc (Relocate::relocate_tls): Likewise.
8056         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8057         (tls_pie_pic_test): New target.
8058         * testsuite/Makefile.in: Rebuild.
8059
8060         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8061         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8062         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8063         * testsuite/Makefile.in: Rebuild.
8064
8065 2010-02-09  David S. Miller  <davem@davemloft.net>
8066
8067         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8068         R_SPARC_RELATIVE using ->add_local_relative().
8069         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8070
8071         * output.h (Output_data_dynamic::add_section_size): New method
8072         that takes two Output_data objects.
8073         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8074         entry param.  Handle it in initializers.
8075         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8076         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8077         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8078         arg.
8079         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8080         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8081         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8082         for dynrel_includes_plt.
8083         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8084         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8085         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8086         before .rela.plt
8087         (Target_sparc::do_finalize_sections): Update to pass true for
8088         dynrel_includes_plt.
8089         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8090         output before .rela.plt
8091         (Target_powerpc::do_finalize_sections): Update to pass true for
8092         dynrel_includes_plt when 32-bit.
8093
8094 2010-02-08  Doug Kwan  <dougkwan@google.com>
8095
8096         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8097         method.
8098         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8099         Arm_relobj::scan_section_for_cortex_a8_stubs,
8100         Arm_relobj::do_relocation_section): Instead of calling
8101         Output_section::output_address, use faster
8102         Arm_relobj::simple_input_section_output_address.
8103
8104 2010-02-08  David S. Miller  <davem@davemloft.net>
8105
8106         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8107         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8108         relocation helper function.
8109
8110         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8111         just like R_SPARC_GOT{10,13,22}.
8112         (Target_sparc::Scan::local): Likewise.
8113         (Target_sparc::Relocate:relocate): Likewise.
8114
8115 2010-02-06  Ian Lance Taylor  <iant@google.com>
8116
8117         * configure.ac: Rewrite targetobjs duplicate removal code to use
8118         only shell constructs.
8119         * configure: Rebuild.
8120
8121 2010-02-05  Doug Kwan  <dougkwan@google.com>
8122
8123         PR 11247
8124         * arm.cc (Arm_relobj::section_is_scannable): New method.
8125         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8126         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8127
8128 2010-02-04  Doug Kwan  <dougkwan@google.com>
8129
8130         PR 11247
8131         * arm-reloc-property.cc (cstdio): Include.
8132         * configure.ac (targetobjs): Remove duplicates.
8133         * configure: Regenerate.
8134         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8135         big and little endian version for a given address size.
8136
8137 2010-02-03  Doug Kwan  <dougkwan@google.com>
8138
8139         * arm-reloc-property.cc
8140         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8141         definition.
8142         * arm-reloc-property.h
8143         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8144         New method definition.
8145         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8146         declaration.
8147         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8148         overflow to N.
8149         (GOT_PREL): Change implemented to Y.
8150         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8151         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8152         (Arm_relocate_functions::movw_abs_nc): Remove method.
8153         (Arm_relocate_functions::movt_abs): Ditto.
8154         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8155         (Arm_relocate_functions::thm_movt_abs): Ditto.
8156         (Arm_relocate_functions::movw_rel_nc): Ditto.
8157         (Arm_relocate_functions::movw_rel): Ditto.
8158         (Arm_relocate_functions::movt_rel): Ditto.
8159         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8160         (Arm_relocate_functions:thm_movw_rel): Ditto.
8161         (Arm_relocate_functions:thm_movt_rel): Ditto.
8162         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8163         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8164         New method definitions.
8165         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8166         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8167         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8168         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8169         (Target_arm::Relocate::relocate): Check for non-static or
8170         unimplemented relocation code and exit early.  Change calls to
8171         Target_arm::reloc_uses_thumb_bit and
8172         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8173         instead.  Refactor code to handle similar relocations to increase
8174         code sharing.  Remove check for unsupported relocation code in switch
8175         statement.
8176         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8177         relocation property table to find out size.  Change error message to
8178         print out the name of a relocation code instead of the numeric value.
8179         (Target_arm::scan_reloc_for_stub): Use relocation property table
8180         instead of calling Target_arm::reloc_uses_thumb_bit().
8181
8182 2010-02-02  Doug Kwan  <dougkwan@google.com>
8183
8184         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8185         types of relaxed input section.
8186
8187 2010-02-02  Doug Kwan  <dougkwan@google.com>
8188
8189         * Makefile.am (HFILES): Add arm-reloc-property.h.
8190         (DEFFILES): New.
8191         (TARGETSOURCES): Add arm-reloc-property.cc
8192         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8193         (libgold_a_SOURCES): $(DEFFILES)
8194         * Makefile.in: Regenerate.
8195         * arm-reloc-property.cc: New file.
8196         * arm-reloc-property.h: New file.
8197         * arm-reloc.def: New file.
8198         * arm.cc: Update comments.
8199         (arm-reloc-property.h): New included header.
8200         (arm_reloc_property_table): New global variable.
8201         (Target_arm::do_select_as_default_target): New method definition.
8202         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8203         arm-reloc-property to targ_extra_obj.
8204         * parameters.cc (set_parameters_target): Call
8205         Target::select_as_default_target().
8206         * target.h (Target::select_as_default_target): New method definition.
8207         (Target::do_select_as_default_target): Same.
8208
8209 2010-02-01  Doug Kwan  <dougkwan@google.com>
8210
8211         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8212         first_output_text_section_.
8213         (Arm_exidx_fixup::first_output_text_section): New method definition.
8214         (Arm_exidx_fixup::first_output_text_section_): New data member.
8215         (Arm_exidx_fixup::process_exidx_section): Record the first text
8216         output section seen.
8217         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8218         and entsize in output section header.
8219
8220 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8221
8222         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8223         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8224         (Arm_relocate_functions::thm_alu11): New Method.
8225         (Arm_relocate_functions::thm_pc8): New Method.
8226         (Arm_relocate_functions::thm_pc12): New Method.
8227         (Target_arm::Scan::local): Handle the relocations.
8228         (Target_arm::Scan::global): Likewise.
8229         (Target_arm::Relocate::relocate): Likewise.
8230         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8231
8232 2010-01-29  Doug Kwan  <dougkwan@google.com>
8233
8234         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8235         of relocation types as ld.
8236
8237 2010-01-29  Doug Kwan  <dougkwan@google.com>
8238
8239         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8240         to public.
8241         (Arm_relocate_functions::thumb_branch_common): Ditto.
8242         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8243         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8244         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8245         Arm_relocate_functions::jump24): Remove.
8246         (Target_arm::Relocate::relocate): Adjust code to call
8247         Arm_relocation_functions::arm_branch_common and
8248         Arm_relocation_functions::thumb_branch_common instead of their removed
8249         wrappers.  Merge switch-cases together to reduce source code size.
8250
8251 2010-01-29  Doug Kwan  <dougkwan@google.com>
8252
8253         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8254         output_local_symbol_count_needs_update_.
8255         (Arm_relobj::output_local_symbol_count_needs_update,
8256          Arm_relobj::set_output_local_symbol_count_needs_update,
8257          Arm_relobj::update_output_local_symbol_count): New methods.
8258         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8259         member.
8260         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8261         of pointed function as in a R_ARM_PREL31 relocation.
8262         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8263         for output local symbol count updating.
8264         (Target_arm::do_relax): Update output local symbol counts in objects
8265         if necessary.
8266         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8267
8268 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8269
8270         * arm.cc: Added support for the ARM relocations:
8271         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8272         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8273         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8274         movw_prel_nc).
8275         (Arm_relocate_functions::movw_rel): New method.
8276         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8277         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8278         thm_movw_prel_nc).
8279         (Arm_relocate_functions::thm_movw_rel): New method.
8280         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8281         thm_movt_prel).
8282         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8283         relocations.
8284         (Target_arm::Scan::global): Likewise.
8285         (Target_arm::Relocate::relocate): Likewise.
8286         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8287         Likewise.
8288
8289 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8290
8291         * arm.cc: Added support for ARM group relocations.
8292         (Target_arm::reloc_needs_sym_origin): New method.
8293         (Arm_relocate_functions::calc_grp_kn): New method.
8294         (Arm_relocate_functions::calc_grp_residual): New method.
8295         (Arm_relocate_functions::calc_grp_gn): New method.
8296         (Arm_relocate_functions::arm_grp_alu): New Method.
8297         (Arm_relocate_functions::arm_grp_ldr): New Method.
8298         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8299         (Arm_relocate_functions::arm_grp_ldc): New Method.
8300         (Target_arm::Scan::local): Handle the ARM group relocations.
8301         (Target_arm::Scan::global): Likewise.
8302         (Target_arm::Relocate::relocate): Likewise.
8303         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8304         Likewise.
8305
8306 2010-01-26  Doug Kwan  <dougkwan@google.com>
8307
8308         * arm.cc (set): Include.
8309         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8310         pointer type.
8311         (Arm_output_section::Text_section_list): New type.
8312         (Arm_output_section::append_text_sections_to_list): New method.
8313         (Arm_output_section::fix_exidx_coverage): Ditto.
8314         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8315         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8316         Relobj::set_section_offset() instead of
8317         Sized_relobj::invalidate_section_offset().
8318         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8319         parameter for section headers. Ignore relocation sections for
8320         unallocated sections and EXIDX sections.
8321         (Target_arm::fix_exidx_coverage): New method.
8322         (Target_arm::output_section_address_less_than): New type.
8323         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8324         linked text section instead of the EXIDX section.
8325         (Arm_output_section::create_stub_group): Add an assertion to check
8326         that this is not an EXIDX output section.
8327         (Arm_output_section::append_text_sections_to_list): New method.
8328         (Arm_output_section::fix_exidx_coverage): Ditto.
8329         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8330         Arm_relobj::section_needs_reloc_stub_scanning.
8331         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8332         first pass.
8333         (Target_arm::fix_exidx_coverage): New method.
8334         * object.h (Relobj::set_output_section): New method.
8335         (Sized_relobj::invalidate_section_offset): Remove method.
8336         (Sized_relobj::do_invalidate_section_offset): Remove method.
8337         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8338
8339 2010-01-25  Doug Kwan  <dougkwan@google.com>
8340
8341         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8342         Fix warning due to signed and unsigned comparison on a 32-bit host.
8343
8344 2010-01-22  Doug Kwan  <dougkwan@google.com>
8345
8346         * arm.cc (Target_arm::do_relax): Record an output section for section
8347         offset adjustment it contains any stub table that has changed.
8348         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8349         offsets in an output section if necessary.
8350         * output.cc (Output_section::Output_section): Initialize
8351         section_offsets_need_adjustments_.
8352         (Output_section::add_input_section_for_script): Renamed to
8353         Output_section::add_simple_input_section.
8354         (Output_section::save_states): Add a comment.
8355         (Output_section::discard_states): New method defintion.
8356         (Output_section::adjust_section_offsets): Same.
8357         * output.h (Output_section::add_input_section_for_script): Renamed to
8358         Output_section::add_simple_input_section.
8359         (Output_section::discard_states): New method declaration.
8360         (Output_section::adjust_section_offsets): Same.
8361         (Output_section::section_offsets_need_adjustment,
8362         Output_section::set_section_offsets_need_adjustment): New method
8363         definitions.
8364         (Output_section::section_offsets_need_adjustment_): New data member.
8365         * script-sections.cc
8366         (Output_section_element_input::set_section_address): Adjust code for
8367         renaming of Output_section::add_input_section_for_script.
8368         (Orphan_output_section::set_section_address): Same.
8369
8370 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8371
8372         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8373         Fix_v4bx enum values .
8374         * gold/options.h (General_options): New option definitions.
8375         (General_options::fix_v4bx): New method.
8376         (General_options::Fix_v4bx): New enum.
8377         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8378         (General_options::parse_fix_v4bx_interworking): New method.
8379
8380 2010-01-22  Doug Kwan  <dougkwan@google.com>
8381
8382         * arm.cc (Arm_exidx_fixup): New class.
8383
8384 2010-01-21  Doug Kwan  <dougkwan@google.com>
8385
8386         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8387         classes.
8388         (Arm_exidx_section_offset_map): New type.
8389
8390 2010-01-21  Doug Kwan  <dougkwan@google.com>
8391
8392         * arm.cc (Arm_exidx_input_section): New class.
8393         (Arm_relobj::exidx_input_section_by_link,
8394         Arm_relobj::exidx_input_section_by_shndx,
8395         Arm_relobj::make_exidx_input_section): New methods.
8396         (read_arm_attributes_section): Remove.
8397         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8398         information about them.
8399         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8400         to here.
8401
8402 2010-01-20  Doug Kwan  <dougkwan@google.com>
8403
8404         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8405         Input_section_specifier to Section_id.
8406         (Target_arm::new_arm_input_section: Adjust code for change of key
8407         type.
8408         (Target_arm::find_arm_input_section): Ditto.
8409         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8410         (Section_id): Remove.
8411         (Garbage_collection::Section_id_hash): Remove.
8412         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8413         (Section_id): Remove.
8414         (Icf::Section_id_hash): Remove.
8415         * object.h (Section_id, Const_section_id, Section_id_hash,
8416         Const_section_id_hash): New type definitions.
8417         * output.cc (Output_section::add_relaxed_input_section): Change to
8418         use Const_section_id instead of Input_section_specifier as key type.
8419         (Output_section::add_merge_input_section): Ditto.
8420         (Output_section::build_relaxation_map): Change to use Section_id
8421         instead of Input_section_specifier as key type.
8422         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8423         Ditto.
8424         (Output_section::convert_input_sections_to_relaxed_sections): Change
8425         to use Const_section_id instead of Input_section_specifier as key type.
8426         (Output_section::find_merge_section): Ditto.
8427         (Output_section::find_relaxed_input_section): Ditto.
8428         * output.h (Input_section_specifier): Remove class.
8429         (Output_section::Output_section_data_by_input_section_map): Change
8430         key type to Const_section_id.
8431         (Output_section::Output_relaxed_input_section_by_input_section_map):
8432         Ditto.
8433         (Output_section::Relaxation_map): Change key type to Section_id.
8434
8435 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8436
8437         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8438         (class Arm_v4bx_stub): New class.
8439         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8440         (Stub_factory::make_arm_v4bx_stub): New method.
8441         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8442         (Stub_table::empty): Handle v4bx stubs.
8443         (Stub_table::add_arm_v4bx_stub): New method.
8444         (Stub_table::find_arm_v4bx_stub): New method.
8445         (Arm_relocate_functions::v4bx): New method.
8446         (Target_arm::fix_v4bx): New method.
8447         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8448         (Stub_table::relocate_stubs): Likewise.
8449         (Stub_table::do_write): Likewise.
8450         (Stub_table::update_data_size_and_addralign): Likewise.
8451         (Stub_table::finalize_stubs):  Likewise.
8452         (Target_arm::Scan::local): Likewise.
8453         (Target_arm::Scan::global): Likewise.
8454         (Target_arm::do_finalize_sections): Likewise.
8455         (Target_arm::Relocate::relocate): Likewise.
8456         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8457         Likewise.
8458         (Target_arm::scan_reloc_for_stub): Likewise.
8459         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8460
8461 2010-01-19  Ian Lance Taylor  <iant@google.com>
8462
8463         * output.cc (Output_section_headers::do_sized_write): Write large
8464         segment count to sh_info field.
8465         (Output_file_header::do_sized_write): For large segment count,
8466         write PN_XNUM to e_phnum field.
8467
8468 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8469
8470         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8471         (Arm_relocate_functions::thm_jump8): New function.
8472         (Arm_relocate_functions::thm_jump11): New function.
8473         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8474         R_ARM_THM_JUMP11.
8475         (Target_arm::Scan::global): Likewise.
8476         (Target_arm::Relocate::relocate): Likewise.
8477         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8478         Likewise.
8479
8480 2010-01-14  Doug Kwan  <dougkwan@google.com>
8481
8482         * arm.cc (map, utility): Include headers.
8483         (Target_arm::apply_cortex_a8_workaround): New method.
8484         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8485         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8486         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8487         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8488         the --[no-]fix-cortex-a8 command line options.
8489         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8490         (Target_arm::relocate_stub): Use addend in instruction template.
8491         * options.h (DEFINE_bool): Set the user-set flag.
8492         (General_options): Add --[no-]-fix-cortex options.
8493         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8494         : Update fast look-up map after conversion.
8495
8496 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8497
8498         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8499         in the first pass of do_layout.
8500
8501 2010-01-13  Doug Kwan  <dougkwan@google.com>
8502
8503         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8504         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8505         apparent compiler problem of not folding static constant integral
8506         data members of elfcpp::Elf_sizes<32>.
8507
8508 2010-01-13  Doug Kwan  <dougkwan@google.com>
8509
8510         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8511         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8512         Arm_relobj::scan_section_for_cortex_a8_erratum,
8513         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8514         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8515         sections to scan for relocation stubs into a new method
8516         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8517         relocation and Cortex-A8 stub scanning.
8518         (Target_arm::do_relax): Force stubs to be after stubbed sections
8519         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8520         the beginning of a new relaxation pass.  Update a comment.
8521         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8522
8523 2010-01-12  Ian Lance Taylor  <iant@google.com>
8524
8525         * target-reloc.h (visibility_error): New inline function.
8526         (relocate_section): Call visibility_error.
8527         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8528         (MOSTLYCLEANFILES): Likewise.
8529         (protected_4_pic.o, protected_3.err): New targets.
8530         * testsuite/protected_4.cc: New file.
8531
8532 2010-01-12  Doug Kwan  <dougkwan@google.com>
8533
8534         * arm.cc (Cortex_a8_reloc): New class.
8535         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8536         and cortex_a8_relocs_info_.
8537         (Target_arm::fix_cortex_a8): New method definition.
8538         (Target_arm::Cortex_a8_relocs_info): New type.
8539         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8540         New data member declarations.
8541         (Target_arm::scan_reloc_for_stub): Record information about
8542         relocations for THUMB branches that might be exempted from the
8543         Cortex-A8 workaround.
8544         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8545         at the beginning of a relaxation pass.
8546
8547 2010-01-12  Doug Kwan  <dougkwan@google.com>
8548
8549         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8550         (Arm_relobj::Mapping_symbol_position,
8551          Arm_reloj::Mapping_symbol_position_less,
8552          Arm_relobj::Mapping_symbols_info): New types.
8553         (Target_arm::is_mapping_symbol_name): New method definition.
8554         (Arm_relobj::do_count_local_symbols): Save information about mapping
8555         symbols.
8556
8557 2010-01-11  Doug Kwan  <dougkwan@google.com>
8558
8559         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8560         Arm_relocate_functions::thumb32_branch_upper,
8561         Arm_relocate_functions::thumb32_branch_lower,
8562         Arm_relocate_functions::thumb32_cond_branch_offset,
8563         Arm_relocate_functions::thumb32_cond_branch_upper,
8564         Arm_relocate_functions::thumb32_cond_branch_lower,
8565         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8566         branch offset encoding.
8567         (Arm_relocate_functions::thumb_branch_common): Use new branch
8568         offset encoding methods to avoid code duplication.
8569         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8570         (Stub_addend_reader::operator()): Use new branch encoding method
8571         to avoid code duplication.
8572
8573 2010-01-11  Doug Kwan  <dougkwan@google.com>
8574
8575         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8576         (Target_arm::do_finalize_sections): Define special EXIDX section
8577         symbols only if referenced.
8578         * gc.h (Garbage_collection::add_reference): New method.
8579         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8580         code duplication.
8581
8582 2010-01-11  Ian Lance Taylor  <iant@google.com>
8583
8584         * script.cc (Version_script_info::build_expression_list_lookup):
8585         Change complaing about duplicate wildcard match from error to
8586         warning.
8587
8588         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8589         of 2009-12-30.
8590         (Version_script_info::Version_script_info): Initialize globs_,
8591         default_version_, default_is_global_, and exact_.  Don't
8592         initialize globals_ or locals_.
8593         (Version_script_info::build_lookup_tables): Build local symbols
8594         first.
8595         (Version_script_info::unquote): New function.
8596         (Version_script_info::add_exact_match): New function.
8597         (Version_script_info::build_expression_list_lookup): Remove lookup
8598         parameter.  Add is_global parameter.  Change all callers.  Handle
8599         wildcard pattern specially.  Unquote pattern.  Call
8600         add_exact_match.
8601         (Version_script_info::get_name_to_match): New function.
8602         (Version_script_info::get_symbol_version): New function.
8603         (Version_script_info::get_symbol_version_helper): Remove.
8604         (Version_script_info::check_unmatched_names): Call unquote.
8605         * script.h (class Version_script_info): Change get_symbol_version
8606         to be non-inline and add is_global parameter; change all callers.
8607         Rewrite symbol_is_local.  Update declarations.  Define struct
8608         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8609         Remove globals_ and locals_ members.  Add exact_, globs_,
8610         default_version_, is_global_.
8611         (Version_script_info::Glob): Remove pattern, add expression and
8612         is_global.  Update constructor.  Change all callers.
8613         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8614         default version.
8615         (Versions::symbol_section_contents): If a symbol is undefined, or
8616         defined in a dynamic object, set the version index to
8617         VER_NDX_LOCAL.
8618         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8619         symbol_is_local.
8620         (Symbol_table::add_from_pluginobj): Likewise.
8621         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8622
8623 2010-01-11  Doug Kwan  <dougkwan@google.com>
8624
8625         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8626         (incremental_dump_LDADD): Add linking option for libintl.
8627         * Makefile.in: Regenerate.
8628
8629 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8630
8631         PR gold/11144
8632         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8633         instead of -Ds.
8634         * testsuite/Makefile.in: Regenerated.
8635
8636 2010-01-10  Doug Kwan  <dougkwan@google.com>
8637
8638         * options.h (DEFINE_var): Use parentheses around argument varname__
8639         in macro body to avoid any unintended subsequent substitutions.
8640
8641 2010-01-10  Ian Lance Taylor  <iant@google.com>
8642
8643         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8644         candidates before doing symbol resolution.
8645
8646         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8647         ODR candidates if only one is weak.
8648
8649 2010-01-08  Ian Lance Taylor  <iant@google.com>
8650
8651         * script.cc (Version_script_info::build_expression_list_lookup):
8652         Don't warn about ambiguous version, just record the ambiguity.
8653         (Version_script_info::get_symbol_version_helper): Give error if
8654         version is ambiguous.
8655
8656 2010-01-08  Doug Kwan  <dougkwan@google.com>
8657
8658         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8659         prev_data_size_ and prev_addralign_.  Remove initializer for
8660         deleted data member has_been_changed_.
8661         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8662         to determine if the table is empty.
8663         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8664         Remove.
8665         (Stub_table::add_reloc_stub): Define method in class definition
8666         instead of just declaring it there.
8667         (Stub_table::add_cortex_a8_stub): New method definition.
8668         (Stub_table::update_data_size_and_addralign): Ditto.
8669         (Stub_table::finalize_stubs): Ditto.
8670         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8671         (Stub_table::do_addralign_): Return address alignment in the
8672         (Stub_table::do_reset_address_and_file_offset): Define method in
8673         class definition instead of declaring it there.  Set current data
8674         size to be the data size of the previous pass.
8675         (Stub_table::set_final_data_size): Use current data size as the
8676         final data size.
8677         (Stub_table::relocate_stub): Change parameter type of stub from
8678         Reloc_stub pointer to Stub pointer.
8679         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8680         (Stub_table::Cortex_a8_stub_list): New typedef.
8681         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8682          Stub_table::prev_addralign_): New data member.
8683         (Arm_relobj::Arm_relobj): Initialize data member
8684         section_has_cortex_a8_workaround_.
8685         (Arm_relobj::section_has_cortex_a8_workaround,
8686          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8687          definitions.
8688         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8689         declarations.
8690         (Target_arm::relocate_stub): Change parameter type of stub from
8691         Reloc_stub pointer to Stub pointer.
8692         (Insn_template::size, Insn_template::alignment): Handle
8693         THUMB16_SPECIAL_TYPE.
8694         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8695          Stub_table::update_data_size_and_addralign,
8696          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8697         definitions.
8698         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8699         (Stub_table::do_write): Ditto.
8700         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8701
8702 2010-01-08  Ian Lance Taylor  <iant@google.com>
8703
8704         PR 11108
8705         * symtab.h (class Symbol): Remove fields is_target_special_ and
8706         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8707         (Symbol::is_defined_in_discarded_section): New function.
8708         (Symbol::set_is_defined_in_discarded_section): New function.
8709         (Symbol::has_plt_offset): Rewrite.
8710         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8711         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8712         Don't initialize is_target_special_ or has_plt_offset_.
8713         Initialize is_defined_in_discarded_section_.
8714         (Symbol_table::add_from_relobj): If appropriate, set
8715         is_defined_in_discarded_section.
8716         * resolve.cc (Symbol::override_base_with_special): Don't test
8717         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8718         * target-reloc.h (relocate_section): Do special handling for
8719         symbols defined in discarded sections for global symbols as well
8720         as local symbols.
8721
8722 2010-01-08  Ian Lance Taylor  <iant@google.com>
8723
8724         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8725         the SHT_SYMTAB case.
8726
8727 2010-01-08  Ian Lance Taylor  <iant@google.com>
8728
8729         * object.cc (Sized_relobj::do_layout): Don't get confused if
8730         layout_eh_frame returns NULL.
8731
8732 2010-01-08  Ian Lance Taylor  <iant@google.com>
8733
8734         PR 11084
8735         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8736         dynamic symbol table, use the normal symbol table.
8737         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8738         symbol table.
8739
8740 2010-01-08  Ian Lance Taylor  <iant@google.com>
8741
8742         PR 11072
8743         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8744         sections.
8745
8746 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8747
8748         * version.cc (print_version): Change to "Copyright 2010".
8749
8750 2010-01-08  Ian Lance Taylor  <iant@google.com>
8751
8752         PR 10287
8753         PR 11063
8754         * i386.cc (class Target_i386): Change return type of plt_section
8755         to be non-const.
8756         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8757         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8758         tls_desc_rel_ field.
8759         (Output_data_plt_i386::rel_tls_desc): New function.
8760         (Target_i386::rel_tls_desc_section): New function.
8761         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8762         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8763         R_386_TLS_DESC reloc in rel_tls_desc_section.
8764         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8765         Define struct Tlsdesc_info.
8766         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8767         (Target_x86_64::do_reloc_symbol_index): New function.
8768         (Target_x86_64::add_tlsdesc_info): New function.
8769         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8770         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8771         tlsdesc_rel_ field.
8772         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8773         all callers.
8774         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8775         (Target_x86_64::rela_tlsdesc_section): New function.
8776         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8777         handling.
8778         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8779         (Target_x86_64::do_reloc_addend): New function.
8780         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8781         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8782         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8783         (Output_reloc::type): New function.
8784         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8785         (Output_reloc::is_target_specific): New function.
8786         (Output_reloc::target_arg): New function.
8787         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8788         absolute relocs and target specific relocs.
8789         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8790         add_target_specific.
8791         (class Output_data_reloc) [SHT_RELA]: Likewise.
8792         * output.cc (Output_reloc::Output_reloc): Add four new versions
8793         for absolute relocs and target specific relocs.
8794         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8795         (Output_reloc::get_symbol_index): Likewise.
8796         (Output_reloc::local_section_offset): Check that local_sym_index_
8797         is not TARGET_CODE or 0.
8798         (Output_reloc::symbol_value): Likewise.
8799         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8800         reloc.
8801         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8802         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8803         functions.
8804         * layout.cc (add_target_dynamic_tags): Use output section for
8805         DT_PLTRELSZ and DT_JMPREL.
8806
8807 2010-01-07  Ian Lance Taylor  <iant@google.com>
8808
8809         PR 11061
8810         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8811         function.
8812         (class Output_data_reloc_generic): Define.
8813         (class Output_data_reloc_base): Change base class to
8814         Output_data_reloc_generic.  Change add() method to call
8815         bump_relative_reloc_count for a relative reloc.  Remove
8816         sort_relocs_ field.
8817         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8818         to sort_relocs().
8819         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8820         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8821         appropriate.
8822         * layout.h (class Layout): Update declaration.
8823
8824 2010-01-07  Ian Lance Taylor  <iant@google.com>
8825
8826         * output.h (class Output_data): Add const version of
8827         output_section and do_output_section.
8828         (class Output_section_data): Add const version of
8829         do_output_section.
8830         (class Output_section): Likewise.
8831         * layout.cc (Layout::add_target_dynamic_tags): New function.
8832         * layout.h (class Layout): Update declarations.
8833         * arm.cc (Target_arm::do_finalize_sections): Use
8834         add_target_dynamic_tags.
8835         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8836         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8837         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8838         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8839
8840 2010-01-07  Ian Lance Taylor  <iant@google.com>
8841
8842         PR 11042
8843         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8844         object as needed.
8845
8846 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8847             Ian Lance Taylor  <iant@google.com>
8848
8849         PR 11019
8850         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8851         Xindex::read_symtab_xindex.
8852
8853 2010-01-07  Doug Kwan  <dougkwan@google.com>
8854
8855         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8856         (Insn_template::thumb16_bcond_insn): New method declaration.
8857         (Insn_template): Fix spelling.
8858         (Stub::thumb16_special): New method declaration.
8859         (Stub::do_write): Define virtual method which was previously pure
8860         virtual.
8861         (Stub::do_thumb16_special): New method declaration.
8862         (Stub::do_fixed_endian_write): New template member.
8863         (Reloc_stub::do_write): Remove.
8864         (Reloc_stub::do_fixed_endian_write): Remove.
8865         (Cortex_a8_stub): New class definition.
8866         (Stub_factory::make_cortex_a8_stub): New method definition.
8867         (Stub_factory::Stub_factory): Add missing static storage class
8868         qualifier for elf32_arm_stub_a8_veneer_blx.
8869
8870 2010-01-07  Ian Lance Taylor  <iant@google.com>
8871
8872         PR 10980
8873         * options.h (class General_options): Add --warn-unresolved-symbols
8874         and --error-unresolved-symbols.
8875         * errors.cc (Errors::undefined_symbol): Implement
8876         --warn-unresolved-symbols.
8877
8878         * options.h (class General_options): Add -z text and -z textoff.
8879         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8880
8881 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8882
8883         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8884         (Garbage_collection::cident_sections): New function.
8885         (Garbage_collection::add_cident_section): New function.
8886         (Garbage_collection::cident_sections_): New member.
8887         (gc_process_relocs): Add references to sections whose names are C
8888         identifiers.
8889         * gold.h (cident_section_start_prefix): New constant.
8890         (cident_section_stop_prefix): New constant.
8891         (is_cident): New function.
8892         * layout.cc (Layout::define_section_symbols): Replace string constants
8893         with the newly defined constants.
8894         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8895         C identifiers.
8896         * testsuite/Makefile.am: Add gc_orphan_section_test.
8897         * testsuite/Makefile.in: Regenerate.
8898         * testsuite/gc_orphan_section_test.cc: New file.
8899         * testsuite/gc_orphan_section_test.sh: New file.
8900
8901 2010-01-06  Ian Lance Taylor  <iant@google.com>
8902
8903         PR 10980
8904         * options.h (class General_options): Add --warn-shared-textrel.
8905         * layout.cc (Layout::finish_dynamic_section): Implement
8906         --warn-shared-textrel.
8907
8908         PR 10980
8909         * options.h (class General_options): Add --warn-multiple-gp.
8910
8911 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8912
8913         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8914         $(THREADSLIB) and $(LIBDL).
8915         * Makefile.in: Rebuild.
8916
8917 2010-01-06  Ian Lance Taylor  <iant@google.com>
8918
8919         PR 10980
8920         * options.cc (General_options::parse_section_start): New function.
8921         (General_options::section_start): New function.
8922         (General_options::General_options): Initialize all members.
8923         * options.h: Include <map>
8924         (class General_options): Add --section-start.  Add section_starts_
8925         member.
8926         * layout.cc (Layout::attach_allocated_section_to_segment): If
8927         --section-start was used, set the address of the segment.  Remove
8928         local sort_sections.
8929         (Layout::relaxation_loop_body): If the address of the load segment
8930         has been set by --section-start, don't use it.
8931         * output.h (Output_segment::update_flags_for_output_section): New
8932         function.
8933         * output.cc (Output_segment::add_output_section): Call
8934         update_flags_for_output_section.
8935
8936 2010-01-05  Ian Lance Taylor  <iant@google.com>
8937
8938         PR 10980
8939         * options.h (class General_options): Add --undefined-version.
8940         * script.cc (struct Version_expression): Add was_matched_by_symbol
8941         field.
8942         (Version_script_info::matched_symbol): New function.
8943         (Version_script_info::get_symbol_version_helper): Call
8944         matched_symbol.
8945         (Version_script_info::check_unmatched_names): New function.
8946         * script.h (class Version_script_info): Update declarations.
8947         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8948
8949         * options.h (class General_options): Use DEFINE_bool_alias for
8950         allow_multiple_definition.
8951         * resolve.cc (Symbol_table::should_override): Don't test
8952         allow_multiple_definition.
8953
8954         PR 10980
8955         * options.h (class General_options): Add --cref.
8956         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8957         until after printing cref table.
8958         * cref.cc: Include "symtab.h".
8959         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8960         (Cref_table_compare::operator()): New function.
8961         (Cref_inputs::gather_cref): New function.
8962         (filecol): New static const.
8963         (Cref_inputs::print_cref): New function.
8964         (Cref::print_cref): New function.
8965         * cref.h: Include <cstdio>.
8966         (class Cref): Update declarations.
8967         * mapfile.h (Mapfile::file): New function.
8968         * object.h (class Object): Define Symbols.  Declare virtual
8969         do_get_global_symbols.
8970         (Object::get_global_symbols): New function.
8971         * object.cc (Input_objects::add_object): Pass object to cref_ if
8972         --cref.
8973         (Input_objects::archive_start): Likewise.
8974         (Input_objects::archive_stop): Likewise.
8975         (Input_objects::print_cref): New function.
8976         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8977         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8978         --cref.
8979         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8980         function.
8981         * plugin.h (class Sized_pluginobj): Update declarations.
8982
8983 2010-01-05  Ian Lance Taylor  <iant@google.com>
8984
8985         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8986         to is_default_version.  Rename insdef to insdefault.
8987         (Symbol_table::add_from_relobj): Rename def to is_default_version
8988         and local to is_forced_local.
8989         (Symbol_table::add_from_pluginobj): Likewise.
8990         (Symbol_table::add_from_dynobj): Likewise.
8991         (Symbol_table::define_special_symbol): Rename insdef to
8992         insdefault.
8993
8994 2010-01-04  Ian Lance Taylor  <iant@google.com>
8995
8996         PR 10980
8997         * options.h (class General_options): Add
8998         --allow-multiple-definition and -z muldefs.
8999         * resolve.cc (Symbol_table::should_override): Don't warn about a
9000         multiple symbol definition if --allow-multiple-definition or -z
9001         muldefs.
9002
9003         PR 10980
9004         * options.h (class General_options): Add --add-needed and
9005         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9006         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9007         error if --copy-dt-needed-entries aka --add-needed is used and
9008         would cause a change in behaviour.
9009
9010         PR 10980
9011         * options.h (class General_options): Add -G as a short version of
9012         --shared.  Add no-op options -assert, -g, and -i.
9013
9014 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9015
9016         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9017         check for .text or .gnu.linkonce.t sections.
9018         * icf.cc (Icf::find_identical_sections): Ditto.
9019         Change the detection for mangled function name within the section
9020         name.
9021         * icf.h (is_section_foldable_candidate): New function.
9022
9023 2009-12-30  Ian Lance Taylor  <iant@google.com>
9024
9025         PR 10980
9026         * options.h (class General_options): Permit two dashes with
9027         --retain-symbols-file.
9028
9029 2009-12-30  Ian Lance Taylor  <iant@google.com>
9030
9031         PR 10979
9032         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9033         don't put the file header and segment headers in the text
9034         segment.
9035
9036         PR 10979
9037         * common.cc (Sort_commons::operator()): Stabilize sort when both
9038         entries are NULL.
9039         (Symbol_table::do_allocate_commons_list): When allocating common
9040         symbols, skip a symbol which is no longer common.
9041         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9042         an object before checking its type.
9043         * testsuite/common_test_2.c: New file.
9044         * testsuite/common_test_3.c: New file.
9045         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9046         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9047         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9048         (common_test_2_pic.o, common_test_2.so): New targets.
9049         (common_test_3_pic.o, common_test_3.so): New targets.
9050         * testsuite/Makefile.in: Rebuild.
9051
9052         PR 10979
9053         * script.cc (read_input_script): If we see a new SECTIONS clause,
9054         and we have added an input section, give an error.
9055         * layout.h (class Layout): Add have_added_input_section function.
9056         Add have_added_input_section_ field.
9057         * layout.cc (Layout::Layout): Initialize
9058         have_added_input_section_.
9059         (Layout::layout): Set have_added_input_section_.
9060         (Layout::layout_eh_frame): Likewise.
9061
9062 2009-12-30  Ian Lance Taylor  <iant@google.com>
9063
9064         PR 10931
9065         * options.h (class General_options): Add --sort-common option.
9066         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9067         * common.cc (Sort_common): Add sort_order parameter to
9068         constructor.  Add sort_order_ field.
9069         (Sort_commons::operator): Check sort_order_.
9070         (Symbol_table::allocate_commons): Determine the sort order.
9071         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9072         Change all callers.
9073         (Symbol_table::do_allocate_commons_list): Likewise.
9074
9075 2009-12-30  Ian Lance Taylor  <iant@google.com>
9076
9077         PR 10916
9078         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9079         symbols from this object, don't change the visibility of an
9080         undefined symbol.
9081         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9082
9083 2009-12-30  Ian Lance Taylor  <iant@google.com>
9084
9085         PR 10861
9086         * script.h (class Version_script_info): Define Language enum.
9087         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9088         new fields globals_, locals_, and is_finalized_.
9089         * script.cc: Various formatting fixes.
9090         (class Parser_closure): Change language_stack_ from a vector of
9091         std::string to one of Version_script_info::Language.  Adjust all
9092         uses accordingly.
9093         (class Lazy_demangler): Remove.
9094         (struct Version_expression): Change language from std::string to
9095         Version_script_info::Language.
9096         (Version_script_info::Version_script_info): New function.
9097         (Version_script_info::~Version_script_info): Don't call clear.
9098         (Version_script_info::finalize): New function.
9099         (Version_script_info::build_lookup_tables): New function.
9100         (Version_script_info::build_expression_list_lookup): New
9101         function.
9102         (Version_script_info::get_symbol_version_helper): Rewrite to use
9103         lookup tables.
9104         (Version_script_info::print_expression_list): Adjust to use
9105         Version_script_info::Language.
9106         (script_push_lex_into_version_mode): Check that the version script
9107         has not been finalized.
9108         (version_script_push_lang): Change language string to
9109         Version_script_info::Language.
9110         * options.cc (Command_line::version_script): New function.
9111         * options.h (class General_options): Add finalize_dynamic_list
9112         function.  Change version_script from declaration to definition.
9113         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9114         * testsuite/version_script.map: Remove duplicate def of foo.
9115         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9116         version_script.map.
9117         * testsuite/Makefile.in: Rebuild.
9118
9119 2009-12-30  Ian Lance Taylor  <iant@google.com>
9120
9121         PR 10843
9122         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9123         if the input symbol index is 0, make the output symbol index 0.
9124
9125 2009-12-30  Ian Lance Taylor  <iant@google.com>
9126
9127         PR 10670
9128         * options.h (class General_options): Add -x/--discard-all.
9129         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9130         --discard-all.  If the local symbol needs a dynamic entry, check
9131         that before handling --discard-locals.
9132
9133 2009-12-30  Ian Lance Taylor  <iant@google.com>
9134
9135         PR 10450
9136         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9137         flags to PF_R.
9138         (Output_segment::add_output_section): Don't change the flags if
9139         the type is PT_TLS.
9140
9141         PR 10450
9142         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9143         GNU hash table if they need a dynamic value.  Otherwise, don't add
9144         them if they are defined in a dynamic object or are forced local.
9145
9146 2009-12-29  Ian Lance Taylor  <iant@google.com>
9147
9148         PR 10450
9149         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9150         .gnu.hash table for a 32-bit target.
9151
9152         PR 10450
9153         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9154         regular and a dynamic object only needs a dynamic symbol table
9155         entry if it is externally visible.
9156
9157         PR 10450
9158         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9159         constructor.  Add global_offset_table_ field.
9160         (Target_i386::got_section): Set global_offset_table_.
9161         (Target_i386::do_finalize_sections): Set global_offset_table_
9162         size.
9163         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9164         in constructor.  Add global_offset_table_ field.
9165         (Target_x86_64::got_section): Set global_offset_table_.
9166         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9167         size.
9168
9169         * layout.cc (Layout::Layout): Initialize increase_relro_.
9170         (Layout::get_output_section): Add is_relro, is_last_relro, and
9171         is_first_non_relro parameters.  Change all callers.
9172         (Layout::choose_output_section): Likewise.
9173         (Layout::add_output_section_data): Likewise.
9174         (Layout::make_output_section): Likewise.
9175         (Layout::set_segment_offsets): Clear increase_relro when using a
9176         linker script.
9177         * layout.h (class Layout): Add increase_relro method.  Add
9178         increase_relro_ field.  Update declarations.
9179         * output.cc (Output_section::Output_section): Initialize
9180         is_last_relro_ and is_first_non_relro_.
9181         (Output_segment::add_output_section): Group relro sections is
9182         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9183         (Output_segment::maximum_alignment): Remove relro handling.
9184         (Output_segment::set_section_addresses): Add increase_relro
9185         parameter.  Change all callers.  Add initial alignment to align
9186         relro sections on separate page.  Remove old relro handling.
9187         (Output_segment::set_section_list_addresses): Remove in_relro
9188         parameter.  Change all callers.
9189         (Output_segment::set_offset): Add increase parameter.  Change all
9190         callers.  Remove old relro handling.
9191         * output.h (class Output_section): Add new methods: is_last_relro,
9192         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9193         Add is_last_relro_ and is_first_non_relro_ fields.
9194         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9195         Create separate .got.plt section.  Call increase_relro.
9196         * x86_64.cc (Target_x86_64::got_section): Likewise.
9197         * testsuite/relro_script_test.t: Add .got.plt.
9198
9199         PR 10450
9200         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9201         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9202         (Layout::finalize): Call set_dynamic_symbol_size.
9203         (Layout::set_dynamic_symbol_size): New function.
9204         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9205         set_dynamic_symbol_size.
9206
9207         PR 10450
9208         * output.h (class Output_section): Add is_entsize_zero_ field.
9209         * output.cc (Output_section::Output_section): Initialize
9210         is_entsize_zero_.
9211         (Output_section::set_entsize): If two different entsizes are
9212         requested, force it to zero.
9213         (Output_section::add_input_section): Set flags for .debug_str
9214         before updating section flags.  Set entsize.
9215         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9216         and SHF_STRING if all input sections have those flags.
9217
9218 2009-12-29   Rafael Espindola  <espindola@google.com>
9219
9220         * main.cc (main): Fix the sys time reporting.
9221         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9222         reporting.
9223
9224 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9225
9226         * options.cc (General_options::parse_version): Allow -v to exit
9227         without an error if there is nothing to link.
9228
9229 2009-12-29  Ian Lance Taylor  <iant@google.com>
9230
9231         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9232         using a version of gcc before 4.1.
9233         * configure: Rebuild.
9234
9235 2009-12-28  Chris Demetriou  <cgd@google.com>
9236
9237         * attributes.cc (Output_attributes_section_data::do_write): Use
9238         std::vector::front rather than std::vector::data.
9239
9240 2009-12-28  Ian Lance Taylor  <iant@google.com>
9241
9242         * symtab.h (class Symbol_table): Add enum Defined.
9243         * resolve.cc (Symbol_table::should_override): Add defined
9244         parameter.  Change all callers.  Test whether object is NULL
9245         before calling a method on it.
9246         (Symbol_table::report_resolve_problem): Add defined parameter.
9247         Change all callers.
9248         (Symbol_table::should_override_with_special): Likewise.
9249         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9250         parameter.  Change all callers.
9251         (Symbol_table::do_define_in_output_data): Likewise.
9252         (Symbol_table::define_in_output_segment): Likewise.
9253         (Symbol_table::do_define_in_output_segment): Likewise.
9254         (Symbol_table::define_as_constant): Likewise.
9255         (Symbol_table::do_define_as_constant): Likewise.
9256         * script.h (class Symbol_assignment): Add is_defsym parameter to
9257         constructor; change all callers.
9258         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9259         parameter.  Change all callers.  Add is_defsym_ field.
9260         (class Parser_closure): Add parsing_defsym parameter to
9261         constructor; change all callers.  Add parsing_defsym accessor
9262         function.  Add parsing_defsym_ field.
9263
9264 2009-12-28  Ian Lance Taylor  <iant@google.com>
9265
9266         * gold.cc (queue_middle_tasks): Fix formatting.
9267         * object.cc (Relobj::is_section_name_included): Likewise.
9268
9269 2009-12-23  Ian Lance Taylor  <iant@google.com>
9270
9271         * i386.cc (Target_i386::do_calls_non_split): Recognize
9272         -fsplit-stack prologue for a function with a static chain.
9273         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9274         -fsplit-stack prologue when using %r11.
9275
9276 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9277
9278         * options.cc (General_options::parse_version): Make -v continue and do
9279         the link like GNU ld does.
9280
9281 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9282
9283         * Makefile.am (CCFILES): Add timer.cc.
9284         (HFILES): Add timer.h.
9285         * configure.ac: Check for sysconf and times.
9286         * main.cc: include timer.h.
9287         (main): Use Timer instead of get_run_time.
9288         * timer.cc: New.
9289         * timer.h: New.
9290         * workqueue.cc: include timer.h.
9291         (Workqueue::find_and_run_task):
9292         Report user, sys and wall time.
9293         * Makefile.in: Regenerate.
9294         * config.in: Regenerate.
9295         * configure: Regenerate.
9296
9297 2009-12-16  Doug Kwan  <dougkwan@google.com>
9298
9299         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9300         sections.
9301         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9302         relaxed input sections.
9303         * output.cc (Output_section::find_relaxed_input_section): Change
9304         return type to Output_relaxed_input_section pointer.  Adjust code
9305         for new type of relaxed_input_section_map_.
9306         * output.h (Output_section::find_relaxed_input_section): Change
9307         return type to Output_relaxed_input_section pointer.
9308         (Output_section::Output_relaxed_input_section_by_input_section_map):
9309         New type.
9310         (Output_section::relaxed_input_section_map_): Change type to
9311         Output_section::Output_relaxed_input_section_by_input_section_map.
9312         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9313         input section.
9314
9315 2009-12-15  Ian Lance Taylor  <iant@google.com>
9316
9317         * layout.cc (Layout::create_shstrtab): Only write out after input
9318         sections if we are compressing debug sections.
9319
9320 2009-12-15  Ian Lance Taylor  <iant@google.com>
9321
9322         * archive.cc (Archive::add_symbols): Only look up a symbol without
9323         a version if there is, in fact, a version.
9324
9325 2009-12-14  Ian Lance Taylor  <iant@google.com>
9326
9327         Revert -Wshadow changes, all changes from:
9328         2009-12-11  Doug Kwan  <dougkwan@google.com>
9329         2009-12-11  Nick Clifton  <nickc@redhat.com>
9330         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9331
9332 2009-12-11  Doug Kwan  <dougkwan@google.com>
9333
9334         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9335         due to -Wshadow.
9336         * attributes.cc (Object_attribute::size): Ditto.
9337         (Attributes_section_data::size): Ditto.
9338         (Attributes_section_data::Attributes_section_data): Ditto.
9339         (Output_attributes_section_data::do_write): Ditto.
9340         * attributes.h (Object_attribute::set_type): Ditto.
9341         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9342
9343 2009-12-11  Nick Clifton  <nickc@redhat.com>
9344
9345         * archive.cc: Fix shadowed variable warnings.
9346         * arm.cc: Likewise.
9347         * compressed_output.cc: Likewise.
9348         * compressed_output.h: Likewise.
9349         * configure: Likewise.
9350         * dwarf_reader.cc: Likewise.
9351         * dynobj.cc: Likewise.
9352         * dynobj.h: Likewise.
9353         * ehframe.cc: Likewise.
9354         * ehframe.h: Likewise.
9355         * errors.cc: Likewise.
9356         * expression.cc: Likewise.
9357         * fileread.cc: Likewise.
9358         * fileread.h: Likewise.
9359         * freebsd.h: Likewise.
9360         * i386.cc: Likewise.
9361         * icf.cc: Likewise.
9362         * incremental.h: Likewise.
9363         * layout.cc: Likewise.
9364         * layout.h: Likewise.
9365         * mapfile.cc: Likewise.
9366         * merge.cc: Likewise.
9367         * merge.h: Likewise.
9368         * object.cc: Likewise.
9369         * object.h: Likewise.
9370         * options.h: Likewise.
9371         * output.cc: Likewise.
9372         * output.h: Likewise.
9373         * parameters.cc: Likewise.
9374         * plugin.cc: Likewise.
9375         * powerpc.cc: Likewise.
9376         * reduced_debug_output.cc: Likewise.
9377         * reduced_debug_output.h: Likewise.
9378         * reloc.cc: Likewise.
9379         * reloc.h: Likewise.
9380         * resolve.cc: Likewise.
9381         * script-sections.cc: Likewise.
9382         * script.cc: Likewise.
9383         * script.h: Likewise.
9384         * sparc.cc: Likewise.
9385         * symtab.cc: Likewise.
9386         * symtab.h: Likewise.
9387         * target-select.cc: Likewise.
9388         * target-select.h: Likewise.
9389         * token.h: Likewise.
9390         * workqueue.cc: Likewise.
9391         * workqueue.h: Likewise.
9392         * x86_64.cc: Likewise.
9393
9394 2009-12-10  Doug Kwan  <dougkwan@google.com>
9395
9396         * arm.cc (attributes.h): New include.
9397         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9398         (Arm_relobj::~Arm_relobj): Delete object pointed by
9399         attributes_section_data_.
9400         (Arm_relobj::attributes_section_data): New method definition.
9401         (Arm_relobj::attributes_section_data_): New data member declaration.
9402         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9403         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9404         attributes_section_data_.
9405         (Arm_dynobj::attributes_section_data): New method definition.
9406         (Arm_dynobj::attributes_section_data_): New data member declaration.
9407         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9408         initialization value of may_use_blx_ to false.
9409         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9410         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9411         object attributes to compute results instead of hard-coding.
9412         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9413         Target_arm::get_secondary_compatible_arch,
9414         Target_arm::set_secondary_compatible_arch
9415         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9416         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9417         New method declarations.
9418         (Target_arm::get_aeabi_object_attribute): New method definition.
9419         (Target_arm::attributes_section_data_): New data member declaration.
9420         (read_arm_attributes_section): New template definition.
9421         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9422         (Arm_dynobj::do_read_symbols): Ditto.
9423         (Target_arm::do_finalize_sections): Merge attributes sections from
9424         input.  Check for BLX use after attributes section merging.
9425         Fix __exidx_start and __exidx_end visibility.  Create an
9426         .ARM.attributes section if necessary.
9427         (Target_arm::get_secondary_compatible_arch,
9428         Target_arm::set_secondary_compatible_arch,
9429         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9430         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9431         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9432         New method definitions.
9433
9434 2009-12-09  Ian Lance Taylor  <iant@google.com>
9435
9436         * plugin.cc (Plugin::load): Don't cast from void* to a function
9437         pointer.
9438
9439 2009-12-09  Ian Lance Taylor  <iant@google.com>
9440
9441         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9442         information fields.
9443
9444 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9445
9446         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9447         Replace two_file_shared_1.so with two_file_shared_2.so.
9448         * testsuite/Makefile.in: Regenerated.
9449
9450 2009-12-08  Doug Kwan  <dougkwan@google.com>
9451
9452         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9453         (HFILES): Add attributes.h and int_encoding.h.
9454         * Makefile.in: Regenerate.
9455         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9456         function definitions to int_encoding.cc
9457         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9458         prototypes to int_encoding.h
9459         * reduced_debug_output.cc (int_encoding.h): New include.
9460         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9461         function definitions to int_encoding.cc
9462         (insert_into_vector, read_from_pointer): Move template definitions to
9463         int_encoding.h
9464         * attributes.cc: New file.
9465         * attributes.h: New file.
9466         * int_encoding.cc: New file.
9467         * int_encoding.h: New file.
9468
9469 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9470
9471         PR gold/11055
9472         * incremental-dump.cc (dump_incremental_inputs): New.
9473         (main): Use dump_incremental_inputs.
9474
9475 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9476
9477         PR gold/10893
9478         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9479         checking elfcpp::STT_FUNC.
9480         (Target_i386::Relocate::relocate): Likewise.
9481         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9482
9483         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9484         symbols from shared libraries into normal FUNC symbols.
9485
9486         * symtab.h (Symbol): Add is_func and use it.
9487
9488 2009-12-05  Doug Kwan  <dougkwan@google.com>
9489
9490         * arm.cc (Target_arm::arm_info): Initialize new fields
9491         attributes_section and attributes_vendor.
9492         * i386.cc (Target_i386::i386_info): Same.
9493         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9494         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9495         fields attributes_section and attributes_vendor.
9496         * sparc.cc (Target_sparc::sparc_info): Same.
9497         * target.h (Target::attributes_section, Target::attributes_vendor,
9498         Target::is_attributes_section, Target::attribute_arg_type,
9499         Target::attributes_order): New method definitions.
9500         (Target::Target_info::attributes_section,
9501         Target::Target_info::attributes_vendor): New fields.
9502         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9503         virtual method definitions.
9504         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9505         attributes_section and attributes_vendor.
9506         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9507
9508 2009-12-05  Doug Kwan  <dougkwan@google.com>
9509
9510         * arm.cc: Update comments about interworking and stub generation.
9511         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9512         considered as non-PIC.
9513         (Arm_relocate_functions::base_abs): Fix formatting.
9514         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9515         of function to use GOT entry address instead of offset.
9516         (Target_arm::Scan::global): Issue an error if a symbol would need a
9517         PLT does not get one because it is untyped.  Remove code to create
9518         dynamic symbols for relative branches.
9519         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9520         takes unsigned integer instead of boolean.
9521
9522 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9523
9524         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9525         (two_file_test_LDADD): Likewise.
9526         (common_test_1_LDADD): Likewise.
9527         (exception_test_LDADD) Likewise.
9528         (weak_test_LDADD): Likewise.
9529         (many_sections_test_LDADD): Likewise.
9530         (initpri1_LDADD): Likewise.
9531         (script_test_1_LDADD): Likewise.
9532         (script_test_2_LDADD): Likewise.
9533         (justsyms_LDADD): Likewise.
9534         (binary_test_LDADD): Likewise.
9535         (large_LDADD): Likewise.
9536         * testsuite/Makefile.in: Regenerated.
9537
9538 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9539
9540         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9541         (Symbol_table::override_with_special): Likewise.
9542         (Symbol_table::add_from_object): Likewise.
9543
9544 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9545
9546         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9547         Don't set the data_offset twice.
9548
9549 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9550
9551         * testsuite/Makefile.in: Regenerate.
9552
9553 2009-12-03  Doug Kwan  <dougkwan@google.com>
9554
9555         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9556         (Target_arm::do_finalize_sections): Add parameter for symbol table
9557         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9558         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9559         parameter for symbol table pointer.
9560         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9561         an additional parameter for a pointer to symbol table.
9562         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9563         parameter for a symbol table pointer.
9564         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9565         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9566         Ditto.
9567         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9568         parameter for a symbol table pointer.
9569
9570 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9571
9572         * incremental.cc (Incremental_inputs_header)
9573         (Incremental_inputs_header_write, Incremental_inputs_entry)
9574         (Incremental_inputs_entry_write): Move ...
9575         * incremental.h (Incremental_inputs_header)
9576         (Incremental_inputs_header_write, Incremental_inputs_entry)
9577         (Incremental_inputs_entry_write): here.
9578
9579 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9580
9581         * incremental.cc (make_sized_incremental_binary): Set the target.
9582         Error if it is incompatible.
9583         * output.h (Output_file): Add filename method.
9584
9585 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9586
9587         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9588         from the get_* methods.
9589
9590 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9591
9592         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9593         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9594         Write 0 for the data_offset of scripts.
9595
9596 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9597
9598         * testsuite/Makefile.am: Add the incremental_test.sh test.
9599         * testsuite/incremental_test.sh: New.
9600         * testsuite/incremental_test_1.c: New.
9601         * testsuite/incremental_test_2.c: New.
9602
9603 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9604
9605         * incremental-dump.cc (main): Fix typos.
9606
9607 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9608
9609         PR gold/11025
9610         * incremental-dump.cc (main): Use llu to print 64 bit values.
9611
9612 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9613             H.J. Lu  <hongjiu.lu@intel.com>
9614
9615         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9616         $(LIBDL).
9617         (incremental_dump_LDADD): Likewise.
9618         * Makefile.in: Regenerated.
9619
9620 2009-11-25  Doug Kwan  <dougkwan@google.com>
9621
9622         Revert:
9623
9624         2009-11-25  Doug Kwan  <dougkwan@google.com>
9625
9626                 * arm.cc (Target_arm::Target_arm): Move method definition
9627                 outside of class definition.  Add code to handle
9628                 --target1-rel, --target1-abs and --target2= options.
9629                 (Target_arm::get_reloc_reloc_type): Change method to be
9630                 non-static and const.
9631                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9632                 New data member declaration.
9633                 (Target_arm::Scan::local, Target_arm::Scan::global,
9634                 Target_arm::Relocate::relocate,
9635                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9636                 Adjust call to Target_arm::get_real_reloc_type.
9637                 (Target_arm::get_real_reloc_type): Use command line options
9638                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9639                 * options.h (--target1-rel, --target1-abs, --target2): New
9640                 ARM-only options.
9641
9642 2009-11-25  Doug Kwan  <dougkwan@google.com>
9643
9644         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9645         class definition.  Add code to handle --target1-rel, --target1-abs
9646         and --target2= options.
9647         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9648         and const.
9649         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9650         member declaration.
9651         (Target_arm::Scan::local, Target_arm::Scan::global,
9652         Target_arm::Relocate::relocate,
9653         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9654         call to Target_arm::get_real_reloc_type.
9655         (Target_arm::get_real_reloc_type): Use command line options to
9656         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9657         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9658         options.
9659
9660 2009-11-25  Doug Kwan  <dougkwan@google.com>
9661
9662         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9663         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9664         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9665         formatting.
9666         (Arm_relocate_functions::thm_call): Replace body with a call to
9667         Arm_relocate_functions::thumb_branch_common.
9668         (Arm_relocate_functions::thm_jump24,
9669         Arm_relocate_functions::thm_xpc22): New method definitions.
9670         (Arm_relocate_functions::thumb_branch_common): New method definition.
9671         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9672         operator.
9673         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9674         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9675
9676 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9677
9678         * Makefile.am: Build incremental-dump
9679         * Makefile.in: Regenerate.
9680         * incremental-dump.cc: New.
9681         * incremental.cc (Incremental_inputs_header_data,
9682         Incremental_inputs_entry_data): Move to incremental.h
9683         * incremental.h: (Incremental_inputs_header_data,
9684         Incremental_inputs_entry_data): Move from incremental.cc
9685
9686 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9687
9688         * incremental.cc (Incremental_inputs_header,
9689         Incremental_inputs_header_write, Incremental_inputs_entry,
9690         Incremental_inputs_entry_write): Add a typedef with the data type.
9691
9692 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9693
9694         * incremental.cc (Incremental_inputs_header,
9695         Incremental_inputs_header_write, Incremental_inputs_entry,
9696         Incremental_inputs_entry_write): Update comment about which
9697         type has the filed descriptions.
9698
9699 2009-11-15  Doug Kwan  <dougkwan@google.com>
9700
9701         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9702         (Arm_relocate_functions::arm_branch_common): Change method defintion
9703         in class definition to a method declaration and update list of formal
9704         parameters.
9705         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9706         Arm_relocation_functions::jump24): Adjust call to
9707         Arm_relocate_functions::arm_branch_common.  Update list of formal
9708         parameters.
9709         (Arm_relocate_functions::xpc25): New method definition.
9710         (Arm_relocate_functions::arm_branch_common): Move method defintion
9711         out from class definition.  Use stubs for mode-switching and extending
9712         branch ranges.
9713         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9714         specially.  Change code to enable use of stubs in ARM branches.
9715
9716 2009-11-10  Doug Kwan  <dougkwan@google.com>
9717
9718         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9719         in method declaration.
9720         (Target_arm::relocate_stub): New method declaration.
9721         (Target_arm::default_target): Change to return a pointer instead of
9722         a const reference.
9723         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9724         Target_arm::default_target.
9725         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9726         method definition.
9727         (Target_arm::relocate_section): Adjust view.
9728         (Target_arm::relocate_stub): New method definition.
9729
9730 2009-11-10  Doug Kwan  <dougkwan@google.com>
9731
9732         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9733         a format warning.
9734         * incremental.cc (open_incremental_binary): Initialized local
9735         variables to avoid warnings.
9736         * object.cc (make_elf_object): Ditto.
9737         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9738         a format warning.
9739
9740 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9741
9742         PR gold/10930
9743         * testsuite/plugin_test.c: Include "config.h".
9744
9745 2009-11-09  Doug Kwan  <dougkwan@google.com>
9746
9747         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9748         (arm_symbol_value): Remove.
9749         (Arm_relocate_functions::arm_branch_common,
9750         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9751         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9752         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9753         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9754         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9755         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9756         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9757         Arm_relocate_functions::thm_mobw_abs_nc,
9758         Arm_relocate_functions::thm_mov_abs,
9759         Arm_relocate_functions::movw_prel_nc,
9760         Arm_relocate_functions::thm_movt_abs,
9761         Arm_relocate_functions::movt_prel,
9762         Arm_relocate_functions::thm_movw_prel_nc,
9763         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9764         (Target_arm::Relocate::relocate): Only decompose address into two
9765         parts if relocation type uses the thumb-bit and pass the actual
9766         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9767         calls to methods in Arm_relocate_functions for this change.
9768
9769 2009-11-08  Ian Lance Taylor  <iant@google.com>
9770
9771         PR 10925
9772         * reloc.cc: Instantiate
9773         Sized_relobj::initialize_input_to_output_maps and
9774         Sized_relobj:free_input_to_output_maps.
9775
9776 2009-11-06  Ian Lance Taylor  <iant@google.com>
9777
9778         PR 10876
9779         * defstd.cc (in_segment): Set only_if_ref true for "end".
9780
9781 2009-11-06  Doug Kwan  <dougkwan@google.com>
9782
9783         * arm.cc (class Reloc_stub): Correct a comment.
9784         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9785         (Target_arm::scan_section_for_stubs): New method declaration.
9786         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9787         Change methods from private to protected.
9788         (Target_arm::do_may_relax): New method definition.
9789         (Target_arm::do_relax, Target_arm::group_sections,
9790         Target_arm::scan_reloc_for_stub,
9791         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9792         (Target_arm::arm_input_section_map_): New data member declaration.
9793         (Target_arm::scan_reloc_for_stub,
9794         Target_arm::scan_reloc_section_for_stubs,
9795         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9796         Target_arm::do_relax): New method definitions.
9797
9798 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9799
9800         * configure.ac: Check for (struct stat)::st_mtim
9801         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9802         * config.in: Regenerate.
9803         * configure: Regenerate.
9804
9805 2009-11-05  Ian Lance Taylor  <iant@google.com>
9806
9807         PR 10910
9808         * output.cc (Output_segment::add_output_section): Add missing
9809         return statement.
9810
9811 2009-11-04  Ian Lance Taylor  <iant@google.com>
9812
9813         PR 10880
9814         * object.h (class Object): Add is_needed and set_is_needed
9815         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9816         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9817         defined in a dynamic object and referenced by a regular object,
9818         set is_needed for the dynamic object.
9819         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9820         if the file is marked with as_needed and it is not needed.
9821
9822 2009-11-04  Ian Lance Taylor  <iant@google.com>
9823
9824         PR 10887
9825         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9826         tags if data is discarded by linker script.
9827         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9828         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9829         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9830         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9831
9832 2009-11-04  Ian Lance Taylor  <iant@google.com>
9833
9834         * layout.cc (Layout::get_output_section): Add is_interp and
9835         is_dynamic_linker_section parameters.  Change all callers.
9836         (Layout::choose_output_section): Likewise.
9837         (Layout::make_output_section): Likewise.
9838         (Layout::add_output_section_data): Add is_dynamic_linker_section
9839         parameter.  Change all callers.
9840         * layout.h (class Layout): Update declarations.
9841         * output.h (class Output_section): Add is_interp, set_is_interp,
9842         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9843         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9844         generate_code_fills_at_write_ to a bitfield.
9845         * output.cc (Output_section::Output_sections): Initialize new
9846         fields.
9847         (Output_segment::add_output_section): Add do_sort parameter.
9848         Change all callers.
9849
9850 2009-11-03  Ian Lance Taylor  <iant@google.com>
9851
9852         PR 10860
9853         * options.h (class General_options): Add --warn-common.
9854         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9855         merging two common symbols.
9856         (Symbol_table::should_override): Handle --warn-common when merging
9857         a common symbol with a defined symbol.  Use report_resolve_problem
9858         for multiple definitions.
9859         (Symbol_table::report_resolve_problem): New function.
9860         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9861
9862 2009-11-03  Doug Kwan  <dougkwan@google.com>
9863
9864         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9865         stub_factory_.
9866         (Target_arm::stub_factory): New method definition.
9867         (Target_arm::new_arm_input_section,
9868         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9869         Target_arm::reloc_uses_thumb_bit): New method declarations.
9870         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9871         New type definitions.
9872         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9873         member declarations.
9874         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9875         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9876         New method definitions.
9877
9878 2009-11-03  Ian Lance Taylor  <iant@google.com>
9879
9880         * options.h (class General_options): Add --warn_constructors.
9881
9882 2009-11-03  Ian Lance Taylor  <iant@google.com>
9883
9884         PR 10893
9885         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9886         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9887
9888 2009-11-03  Ian Lance Taylor  <iant@google.com>
9889
9890         PR 10895
9891         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9892         --msgid-bugs-address.
9893         (install-pdf): New target.
9894         (install-data_yes): Look up one directory to find mkinstalldirs.
9895
9896 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9897
9898         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9899         tree.
9900
9901 2009-10-30  Doug Kwan  <dougkwan@google.com>
9902
9903         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9904
9905 2009-10-30  Doug Kwan  <dougkwan@google.com>
9906
9907         * arm.cc (Stub_addend_reader): New struct template definition
9908         and partial specializations.
9909         (Stub_addend_reader::operator()): New method definition for a
9910         partially specialized template.
9911
9912 2009-10-30  Doug Kwan  <dougkwan@google.com>
9913
9914         * arm.cc (Arm_relobj::processor_specific_flags): New method
9915         definition.
9916         (Arm_relobj::do_read_symbols): New method declaration.
9917         (Arm_relobj::processor_specific_flags_): New data member declaration.
9918         (Arm_dynobj): New class definition.
9919         (Target_arm::do_finalize_sections): Add input_objects parameter.
9920         (Target_arm::do_adjust_elf_header): New method declaration.
9921         (Target_arm::are_eabi_versions_compatible,
9922         (Target_arm::merge_processor_specific_flags): New method declaration.
9923         (Target_arm::do_make_elf_object): New overloaded method definitions
9924         and declaration.
9925         (Arm_relobj::do_read_symbols): New method definition.
9926         (Arm_dynobj::do_read_symbols): Ditto.
9927         (Target_arm::do_finalize_sections): Add input_objects parameters.
9928         Merge processor-specific flags from all input objects.
9929         (Target_arm::are_eabi_versions_compatible,
9930         Target_arm::merge_processor_specific_flags,
9931         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9932         New method definitions.
9933         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9934         Input_objects pointer type parameter.
9935         * layout.cc (Layout::finalize): Pass input objects to target's.
9936         finalize_sections function.
9937         * output.cc (Output_file_header::do_sized_write): Set ELF file
9938         header's processor-specific flags.
9939         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9940         Input_objects pointer type parameter.
9941         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9942         * target.h (Input_objects): New forward class declaration.
9943         (Target::processor_specific_flags,
9944         Target::are_processor_specific_flags_sect): New method definitions.
9945         (Target::finalize_sections): Add input_objects parameter.
9946         (Target::Target): Initialize processor_specific_flags_ and
9947         are_processor_specific_flags_set_.
9948         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9949         parameter.
9950         (Target::set_processor_specific_flags): New method definition.
9951         (Target::processor_specific_flags_,
9952         Target::are_processor_specific_flags_set_): New data member
9953         declarations.
9954         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9955         Input_objects pointer type parameter.
9956
9957 2009-10-30  Doug Kwan  <dougkwan@google.com>
9958
9959         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9960
9961 2009-10-28  Ian Lance Taylor  <iant@google.com>
9962
9963         * object.h (class Relobj): Drop options parameter from
9964         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9965         do_scan_relocs, do_relocate.  Change all callers.
9966         (class Sized_relobj): Drop options parameters from
9967         do_gc_process_relocs, do_scan_relocs, do_relocate,
9968         do_relocate_sections, relocate_sections, emit_relocs_scan,
9969         emit_relocs_scan_reltype.  Change all callers.
9970         (struct Relocate_info): Remove options field and all references to
9971         it.
9972         * reloc.h (class Read_relocs): Remove options constructor
9973         parameter and options_ field.  Change all callers.
9974         (class Gc_process_relocs, class Scan_relocs): Likewise.
9975         (class Relocate_task): Likewise.
9976         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9977         all callers.
9978         (scan_relocatable_relocs): Likewise.
9979         * target.h (class Sized_target): Remove options parameter from
9980         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9981         all callers.
9982         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9983         callers.
9984         * arm.cc: Update functions to remove options parameters.
9985         * i386.cc: Likewise.
9986         * powerpc.cc: Likewise.
9987         * sparc.cc: Likewise.
9988         * x86_64.cc: Likewise.
9989         * testsuite/testfile.cc: Likewise.
9990
9991 2009-10-28  Doug Kwan  <dougkwan@google.com>
9992
9993         * arm.cc (Arm_relobj): New class definition.
9994         (Arm_relobj::scan_sections_for_stubs,
9995         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9996         New method definitions.
9997
9998 2009-10-28  Cary Coutant  <ccoutant@google.com>
9999
10000         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10001         (Plugin::cleanup_done_): New member.
10002         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10003         (Plugin_manager::cleanup_done_): Remove.
10004         (Plugin_manager::add_input_file): Edit error message.
10005         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10006         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10007
10008 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10009
10010         * fileread.cc: (File_read::View::~View): Use the new
10011         data_ownership_ filed.
10012         (File_read::~File_read): Dispose the new whole_file_view_.
10013         (File_read::open): Mmap the whole file if needed.
10014         (File_read::open): Use whole_file_view_ instead of contents_.
10015         (File_read::find_view): Use whole_file_view_ if applicable.
10016         (File_read::do_read): Use whole_file_view_ instead of contents_.
10017         (File_read::make_view): Use whole_file_view_ instead of contents_,
10018         update File_read::View::View call.
10019         (File_read::find_or_make_view): Update File_read::View::View
10020         call.
10021         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10022         remove contents_
10023         (File_read::View::Data_ownership): New enum.
10024         (File_read::View::View): Replace bool mapped_ with Data_ownership
10025         argument.
10026         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10027         (File_read::View::data_ownership_): New field.
10028         (File_read::contents_): Remove (replaced by whole_file_view_).
10029         (File_read::whole_file_view_): New field.
10030         * options.h (class General_options): Add --keep-files-mapped.
10031
10032 2009-10-27  Cary Coutant  <ccoutant@google.com>
10033
10034         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10035         * testsuite/Makefile.am (plugin_test_5): New test case.
10036         * testsuite/Makefile.in: Regenerate.
10037
10038 2009-10-25  Doug Kwan  <dougkwan@google.com>
10039
10040         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10041         from private to protected to allow access by child class.
10042         (Sized_relobj::do_relocate_sections): New method declaration.
10043         (Sized_relobj::relocate_sections): Virtualize.
10044         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10045         Sized_relobj::relocate_sections.  Instantiate template explicitly
10046         for different target sizes and endianity.
10047
10048 2009-10-24  Doug Kwan  <dougkwan@google.com>
10049
10050         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10051         (Arm_input_section::as_arm_input_section): New method.
10052         (Arm_output_section): New class definition.
10053         (Arm_output_section::create_stub_group,
10054         Arm_output_section::group_sections): New method definitions.
10055
10056 2009-10-22  Doug Kwan  <dougkwan@google.com>
10057
10058         * arm.cc (Arm_input_section): New class definition.
10059         (Arm_input_section::init, Arm_input_section:do_write,
10060         Arm_input_section::set_final_data_size,
10061         Arm_input_section::do_reset_address_and_file_offset): New method
10062         definitions.
10063
10064 2009-10-21  Doug Kwan  <dougkwan@google.com>
10065
10066         * arm.cc (Stub_table, Arm_input_section): New forward class
10067         declarations.
10068         (Stub_table): New class defintion.
10069         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10070         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10071         New method definition.
10072
10073 2009-10-21  Doug Kwan  <dougkwan@google.com>
10074
10075         * arm.cc: Update copyright comments.
10076         (Target_arm): New forward class template declaration.
10077         (Arm_address): New type.
10078         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10079         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10080         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10081         constants.
10082         (Insn_template): Same.
10083         (DEF_STUBS): New macro.
10084         (Stub_type): New enum type.
10085         (Stub_template): New class definition.
10086         (Stub): Same.
10087         (Reloc_stub): Same.
10088         (Stub_factory): Same.
10089         (Target_arm::Target_arm): Initialize may_use_blx_ and
10090         should_force_pic_veneer_.
10091         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10092         Target_arm::should_force_pic_veneer,
10093         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10094         Target_arm::using_thumb_only, Target_arm:;default_target): New
10095         method defintions.
10096         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10097         New data member declarations.
10098         (Insn_template::size, Insn_template::alignment): New method defintions.
10099         (Stub_template::Stub_template): New method definition.
10100         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10101         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10102         (Stub_factory::Stub_factory): New method definition.
10103         * gold.h (string_hash): New template.
10104         * output.h (Input_section_specifier::hash_value): Use
10105         gold::string_hash.
10106         (Input_section_specifier::string_hash): Remove.
10107         * stringpool.cc (Stringpool_template::string_hash): Use
10108         gold::string_hash.
10109
10110 2009-10-20  Doug Kwan  <dougkwan@google.com>
10111
10112         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10113         symbols of relaxed input sections.
10114         * output.h (Output_section::find_relaxed_input_section): Make
10115         method public.
10116
10117 2009-10-16  Doug Kwan  <dougkwan@google.com>
10118
10119         * dynobj.cc (Versions::Versions): Initialize version_script_.
10120         Only insert base version symbol definition for a shared object
10121         if version script defines any version versions.
10122         (Versions::define_base_version): New method definition.
10123         (Versions::add_def): Check that base version is not needed.
10124         (Versions::add_need): Define base version lazily.
10125         * dynobj.h (Versions::define_base_version): New method declaration.
10126         (Versions::needs_base_version_): New data member declaration.
10127         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10128         (check_DATA): Add no_version_test.stdout.
10129         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10130         New make rules.
10131         * testsuite/Makefile.in: Regenerate.
10132         * testsuite/no_version_test.c: New file.
10133         * testsuite/no_version_test.sh: Ditto.
10134
10135 2009-10-16  Doug Kwan  <dougkwan@google.com>
10136
10137         * expression.cc (class Segment_start_expression): New class definition.
10138         (Segment_start_expression::value): New method definition.
10139         (script_exp_function_segment_start): Return a new
10140         Segment_start_expression.
10141         * gold/script-c.h (script_saw_segment_start_expression): New function
10142         prototype.
10143         * script-sections.cc (Script_sections::Script_sections): Initialize
10144         SAW_SEGMENT_START_EXPRESSION_ to false.
10145         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10146         and -Tbbs options to specify section addresses if given in
10147         command line and no SEGMENT_START expression is seen in a script.
10148         * script-sections.h (Script_sections::saw_segment_start_expression,
10149         Script_sections::set_saw_segment_start_expression): New method
10150         definition.
10151         (Script_sections::saw_segment_start_expression_): New data member
10152         declaration.
10153         * script.cc (script_saw_segment_start_expression): New function.
10154         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10155         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10156         script_test_7.sh and script_test_8.sh.
10157         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10158         script_test_8.stdout.
10159         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10160         (script_test_6, script_test_6.stdout, script_test_7,
10161         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10162         * Makefile.in: Regenerate.
10163         * testsuite/script_test_6.sh: New file.
10164         * testsuite/script_test_6.t: Same.
10165         * testsuite/script_test_7.sh: Same.
10166         * testsuite/script_test_7.t: Same.
10167         * testsuite/script_test_8.sh: Same.
10168
10169 2009-10-16  Doug Kwan  <dougkwan@google.com>
10170
10171         * output.cc (Output_segment::set_section_list_address): Cast
10172         expressions to unsigned long long type to avoid format warnings.
10173
10174 2009-10-15  Ian Lance Taylor  <iant@google.com>
10175
10176         * script.cc (Script_options::add_symbol_assignment): Always add a
10177         dot assignment to script_sections_.
10178         * script-sections.cc (Script_sections::add_dot_assignment):
10179         Initialize if necessary.
10180
10181         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10182         program headers with no load segment if there is a linker script.
10183
10184         * layout.cc (Layout::set_segment_offsets): Align the file offset
10185         to the segment aligment for -N or -n with no load segment.
10186         * output.cc (Output_segment::add_output_section): Don't crash if
10187         the first section is a TLS section.
10188         (Output_segment::set_section_list_addresses): Print an error
10189         message if the address moves backward in a linker script.
10190         * script-sections.cc
10191         (Output_section_element_input::set_section_addresses): Don't
10192         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10193         (Orphan_output_section::set_section_addresses): Likewise.
10194
10195 2009-10-15  Doug Kwan  <dougkwan@google.com>
10196
10197         * layout.cc (Layout::finish_dynamic_section): Generate tags
10198         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10199         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10200         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10201
10202 2009-10-14  Ian Lance Taylor  <iant@google.com>
10203
10204         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10205         fields.
10206         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10207         data_shdr fields of relinfo.
10208         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10209         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10210         R_386_TLS_LDO_32, adjust based on section flags.
10211         (Target_i386::Relocate::fix_up_ldo): Remove.
10212
10213 2009-10-13  Ian Lance Taylor  <iant@google.com>
10214
10215         Add support for -pie.
10216         * options.h (class General_options): Add -pie and
10217         --pic-executable.
10218         (General_options::output_is_position_independent): Test -pie.
10219         (General_options::output_is_executable): Return true if not shared
10220         and not relocatable.
10221         (General_options::output_is_pie): Remove.
10222         * options.cc (General_options::finalize): Reject incompatible uses
10223         of -pie.
10224         * gold.cc (queue_middle_tasks): A -pie link is not static.
10225         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10226         * symtab.cc (Symbol::final_value_is_known): Return false if
10227         output_is_position_independent.
10228         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10229         output_is_position_independent.
10230         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10231         output_is_position_independent.
10232         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10233         output_is_position_independent.
10234         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10235         two_file_pie_test.
10236         (basic_pie_test.o, basic_pie_test): New targets.
10237         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10238         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10239         (two_file_pie_test): New target.
10240         * testsuite/Makefile.in: Rebuild.
10241         * README: Remove note saying that -pie is not supported.
10242
10243 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10244
10245         * options.h (class General_options): Add -init and -fini.
10246         * layout.cc (Layout::finish_dynamic_section): Emit
10247         given init and fini functions.
10248
10249 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10250
10251         * gc.h (gc_process_relocs): Check if icf is enabled using new
10252         function.
10253         * gold.cc (queue_initial_tasks): Likewise.
10254         (queue_middle_tasks): Likewise.
10255         * object.cc (do_layout): Likewise.
10256         * symtab.cc (is_section_folded): Likewise.
10257         * main.cc (main): Likewise.
10258         * reloc.cc (Read_relocs::run): Likewise.
10259         (Sized_relobj::do_scan_relocs): Likewise.
10260         * icf.cc (is_function_ctor_or_dtor): New function.
10261         (Icf::find_identical_sections): Check if function is ctor or dtor when
10262         safe icf is chosen.
10263         * options.h (General_options::icf): Change option to be an enum.
10264         (Icf_status): New enum.
10265         (icf_enabled): New method.
10266         (icf_safe_folding): New method.
10267         (set_icf_status): New method.
10268         (icf_status_): New variable.
10269         * (options.cc) (General_options::finalize): Set icf_status_.
10270         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10271         icf_test and icf_keep_unique_test to use the --icf enum flag.
10272         * testsuite/icf_safe_test.sh: New file.
10273         * testsuite/icf_safe_test.cc: New file.
10274
10275 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10276
10277         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10278         includes to gc.h and icf.h.
10279         * arm.cc: Include gc.h.
10280         * gold.cc: Likewise.
10281         * i386.cc: Likewise.
10282         * powerpc.cc: Likewise.
10283         * sparc.cc: Likewise.
10284         * x86_64.cc: Likewise.
10285         * gc.h: Include icf.h.
10286
10287 2009-10-11  Ian Lance Taylor  <iant@google.com>
10288
10289         * plugin.cc: Include "gold.h" before other header files.
10290
10291 2009-10-10  Chris Demetriou  <cgd@google.com>
10292
10293         * options.h (Input_file_argument::Input_file_type): New enum.
10294         (Input_file_argument::is_lib_): Replace with...
10295         (Input_file_argument::type_): New member.
10296         (Input_file_argument::Input_file_argument): Take Input_file_type
10297         'type' rather than boolean 'is_lib' as second argument.
10298         (Input_file_argument::is_lib): Use type_.
10299         (Input_file_argument::is_searched_file): New function.
10300         (Input_file_argument::may_need_search): Handle is_searched_file.
10301         * options.cc (General_options::parse_library): Support -l:filename.
10302         (General_options::parse_just_symbols): Update for Input_file_argument
10303         changes.
10304         (Command_line::process): Likewise.
10305         * archive.cc (Archive::get_file_and_offset): Likewise.
10306         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10307         * script.cc (read_script_file, script_add_file): Likewise.
10308         * fileread.cc (Input_file::Input_file): Likewise.
10309         (Input_file::will_search_for): Handle is_searched_file.
10310         (Input_file::open): Likewise.
10311         * readsyms.cc (Read_symbols::get_name): Likewise.
10312         * testsuite/Makefile.am (searched_file_test): New test.
10313         * testsuite/Makefile.in: Regenerate.
10314         * testsuite/searched_file_test.cc: New file.
10315         * testsuite/searched_file_test_lib.cc: New file.
10316
10317 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10318             Ian Lance Taylor  <iant@google.com>
10319
10320         * descriptor.cc: Include <cstdio> and "binary-io.h".
10321         (Descriptors::open): Open the files in binary mode always.
10322         * script.cc (Lex::get_token): Treat \r as whitespace.
10323
10324 2009-10-09  Ian Lance Taylor  <iant@google.com>
10325
10326         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10327
10328 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10329             Ian Lance Taylor  <iant@google.com>
10330
10331         * configure.ac: Check for readv function also.
10332         * fileread.cc (readv): Define if not HAVE_READV.
10333         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10334         does not exist.
10335         * config.in: Regenerate.
10336         * configure: Regenerate.
10337
10338 2009-10-09  Doug Kwan  <dougkwan@google.com>
10339
10340         * layout.cc (Layout::make_output_section): Call target hook to make
10341         ordinary output section.
10342         (Layout::finalize): Adjust parameter list of call the
10343         Target::may_relax().
10344         * layout.h (class Layout::section_list): New method.
10345         * merge.h (Output_merge_base::entsize): Change visibility to public.
10346         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10347         New methods.
10348         (Output_merge_string::do_is_string): New method.
10349         * object.cc (Sized_relobj::do_setup): renamed from
10350         Sized_relobj::set_up.
10351         * object.h (Sized_relobj::adjust_shndx,
10352         Sized_relobj::initializ_input_to_output_maps,
10353         Sized_relobj::free_input_to_output_maps): Change visibilities to
10354         protected.
10355         (Sized_relobj::setup): Virtualize.
10356         (Sized_relobj::do_setup): New method declaration.
10357         (Sized_relobj::invalidate_section_offset,
10358         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10359         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10360         * options.cc (parse_int): New function.
10361         * options.h (parse_int): New declaration.
10362         (DEFINE_int): New macro.
10363         (stub_group_size): New option.
10364         * output.cc (Output_section::Output_section): Initialize memebers
10365         merge_section_map_, merge_section_by_properties_map_,
10366         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10367         (Output_section::add_input_section): Handled deferred code-fill
10368         generation and remove an old comment.
10369         (Output_section::add_relaxed_input_section): New method definition.
10370         (Output_section::add_merge_input_section): Use merge section by
10371         properties map to speed to search.  Update merge section maps
10372         as appropriate.
10373         (Output_section::build_relaxation_map): New method definition.
10374         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10375         Same.
10376         (Output_section::relax_input_section): Renamed to
10377         Output_section::convert_input_sections_to_relaxed_sections and change
10378         interface to take a vector of pointers to relaxed sections.
10379         (Output_section::find_merge_section,
10380         Output_section::find_relaxed_input_section): New method definitions.
10381         (Output_section::is_input_address_mapped,
10382         Output_section::output_offset, Output_section::output_address):
10383         Use output section data maps to speed up searching.
10384         (Output_section::find_starting_output_address): Add comments.
10385         (Output_section::do_write,
10386         Output_section::write_to_postprocessing_buffer): Do code-fill
10387         generation as appropriate.
10388         (Output_section::get_input_sections): Invalidate relaxed input section
10389         map.
10390         (Output_section::restore_states): Adjust type of checkpoint .
10391         Invalidate relaxed input section map.
10392         * output.h (Output_merge_base): New class declaration.
10393         (Input_section_specifier): New class defintion.
10394         (class Output_relaxed_input_section) Change base class to
10395         Output_section_data_build.
10396         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10397         base class initializer.
10398         (Output_section::add_relaxed_input_section): New method declaration.
10399         (Output_section::Input_section): Change visibility to protected.
10400         (Output_section::Input_section::relobj,
10401         Output_section::Input_section::shndx): Handle relaxed input sections.
10402         Output_section::input_sections) Change visibility to protected.  Also
10403         define overload to return a non-const pointer.
10404         (Output_section::Merge_section_properties): New class defintion.
10405         (Output_section::Merge_section_by_properties_map,
10406         Output_section::Output_section_data_by_input_section_map,
10407         Output_section::Relaxation_map): New types.
10408         (Output_section::relax_input_section): Rename method to
10409         Output_section::convert_input_sections_to_relaxed_sections and change
10410         interface to take a vector of relaxed section pointers.
10411         (Output_section::find_merge_section,
10412         Output_section::find_relaxed_input_section,
10413         Output_section::build_relaxation_map,
10414         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10415         New method declarations.
10416         (Output_section::merge_section_map_
10417         Output_section::merge_section_by_properties_map_,
10418         Output_section::relaxed_input_section_map_,
10419         Output_section::is_relaxed_input_section_map_valid_,
10420         Output_section::generate_code_fills_at_write_): New data members.
10421         * script-sections.cc
10422         (Output_section_element_input::set_section_addresses): Call
10423         current_data_size and addralign methods of relaxed input sections.
10424         (Orphan_output_section::set_section_addresses): Call current_data_size
10425         and addralign methods of relaxed input sections.
10426         * symtab.cc (Symbol_table::compute_final_value): Extract template
10427         from the body of Symbol_table::sized_finalize_symbol.
10428         (Symbol_table::sized_finalized_symbol): Call
10429         Symbol_table::compute_final_value.
10430         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10431         (Symbol_table::compute_final_value): New templated method declaration.
10432         * target.cc (Target::do_make_output_section): New method defintion.
10433         * target.h (Target::make_output_section): New method declaration.
10434         (Target::relax): Add more parameters for input objects, symbol table
10435         and layout.  Adjust call to do_relax.
10436         (Target::do_make_output_section): New method declaration.
10437         (Target::do_relax): Add parameters for input objects, symbol table
10438         and layout.
10439
10440 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10441
10442         * pread.c: Include stdio.h.
10443
10444 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10445
10446         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10447         defined.
10448
10449 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10450
10451         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10452         Change read_shndx type to unsigned int.
10453         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10454         int.
10455         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10456         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10457         Change read_shndx type to unsigned int.
10458         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10459         int.
10460         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10461         * layout.cc (Layout::create_symtab_sections): Cast the result of
10462         local_symcount * symsize to off_t in the gold_assert.
10463
10464 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10465
10466         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10467         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10468         R_ARM_BASE_ABS.
10469         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10470         (Arm_relocate_functions::thm_abs5): New function.
10471         (Arm_relocate_functions::abs12): New function.
10472         (Arm_relocate_functions::abs16): New function.
10473         (Arm_relocate_functions::base_abs): New function.
10474         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10475         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10476         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10477         R_ARM_BASE_ABS.
10478         (Scan::global): Likewise.
10479         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10480         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10481         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10482         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10483         R_ARM_BASE_ABS.
10484
10485 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10486
10487         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10488         (Arm_relocate_functions::movt_prel): New function.
10489         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10490         (Arm_relocate_functions::thm_movt_prel): New function.
10491         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10492         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10493         (Scan::global, Relocate::relocate): Likewise.
10494         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10495
10496 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10497
10498         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10499         Incremental_checker.
10500         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10501         unsigned int.
10502         (class Incremental_inputs_header): New class.
10503         (Incremental_inputs_header_writer): Edit comment.
10504         (Incremental_inputs_entry): New class.
10505         (Incremental_inputs_entry_writer): Edit comment.
10506         (Sized_incremental_binary::do_find_incremental_inputs_section):
10507         Add *strtab_shndx parameter, fill it.
10508         (Sized_incremental_binary::do_check_inputs): New method.
10509         (Incremental_checker::can_incrementally_link_output_file): Use
10510         Sized_incremental_binary::check_inputs.
10511         (Incremental_inputs::report_command_line): Save command line in
10512         command_line_.
10513         * incremental.h:
10514         (Incremental_binary::find_incremental_inputs_section): New
10515         method.
10516         (Incremental_binary::do_find_incremental_inputs_section): Add
10517         strtab_shndx parameter.
10518         (Incremental_binary::do_check_inputs): New pure virtual method.
10519         (Sized_incremental_binary::do_check_inputs): Declare.
10520         (Incremental_checker::Incremental_checker): Add incremental_inputs
10521         parameter, use it to initialize incremental_inputs_.
10522         (Incremental_checker::incremental_inputs_): New field.
10523         (Incremental_checker::command_line): New method.
10524         (Incremental_checker::inputs): New method.
10525         (Incremental_checker::command_line_): New field.
10526
10527 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10528
10529         * incremental.cc: Include <cstdarg> and "target-select.h".
10530         (vexplain_no_incremental): New function.
10531         (explain_no_incremental): New function.
10532         (Incremental_binary::error): New method.
10533         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10534         method.
10535         (make_sized_incremental_binary): New function.
10536         (open_incremental_binary): New function.
10537         (can_incrementally_link_file): Add checks if output is ELF and has
10538         inputs section.
10539         * incremental.h: Include "elfcpp_file.h" and "output.h".
10540         (Incremental_binary): New class.
10541         (Sized_incremental_binary): New class.
10542         (open_incremental_binary): Declare.
10543         * object.cc (is_elf_object): Use
10544         elfcpp::Elf_recognizer::is_elf_file.
10545         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10546         * output.h (Output_file::filesize): New method.
10547
10548 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10549
10550         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10551         New function.
10552         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10553         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10554         function.
10555         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10556         function.
10557         (Arm_relocate_functions::movw_abs_nc): New function.
10558         (Arm_relocate_functions::movt_abs): New function.
10559         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10560         (Arm_relocate_functions::thm_movt_abs): New function.
10561         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10562         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10563         (Scan::global): Likewise.
10564         (Relocate::relocate): Likewise.
10565         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10566
10567 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10568
10569         * arm.cc (Arm_relocate_functions::got_prel) New function.
10570         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10571         (Relocate::relocate): Likewise.
10572         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10573
10574 2009-10-06  Ian Lance Taylor  <iant@google.com>
10575
10576         * options.h (class General_options): Define
10577         split_stack_adjust_size parameter.
10578         * object.h (class Object): Add uses_split_stack_ and
10579         has_no_split_stack_ fields.  Add uses_split_stack and
10580         has_no_split_stack accessor functions.  Declare
10581         handle_split_stack_section.
10582         (class Reloc_symbol_changes): Define.
10583         (class Sized_relobj): Define Function_offsets.  Declare
10584         split_stack_adjust, split_stack_adjust_reltype, and
10585         find_functions.
10586         * object.cc (Object::handle_split_stack_section): New function.
10587         (Sized_relobj::do_layout): Call handle_split_stack_section.
10588         * dynobj.cc (Sized_dynobj::do_layout): Call
10589         handle_split_stack_section.
10590         * reloc.cc (Sized_relobj::relocate_sections): Call
10591         split_stack_adjust for executable sections in split_stack
10592         objects.  Pass reloc_map to relocate_section.
10593         (Sized_relobj::split_stack_adjust): New function.
10594         (Sized_relobj::split_stack_adjust_reltype): New function.
10595         (Sized_relobj::find_functions): New function.
10596         * target-reloc.h: Include "object.h".
10597         (relocate_section): Add reloc_symbol_changes parameter.  Change
10598         all callers.
10599         * target.h (class Target): Add calls_non_split method.  Declare
10600         do_calls_non_split virtual method.  Declare match_view and
10601         set_view_to_nop.
10602         * target.cc: Include "elfcpp.h".
10603         (Target::do_calls_non_split): New function.
10604         (Target::match_view): New function.
10605         (Target::set_view_to_nop): New function.
10606         * gold.cc (queue_middle_tasks): Give an error if mixing
10607         split-stack and non-split-stack objects with -r.
10608         * i386.cc (Target_i386::relocate_section): Add
10609         reloc_symbol_changes parameter.
10610         (Target_i386::do_calls_non_split): New function.
10611         * x86_64.cc (Target_x86_64::relocate_section): Add
10612         reloc_symbol_changes parameter.
10613         (Target_x86_64::do_calls_non_split): New function.
10614         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10615         parameter.
10616         * powerpc.cc (Target_powerpc::relocate_section): Add
10617         reloc_symbol_changes parameter.
10618         * sparc.cc (Target_sparc::relocate_section): Add
10619         reloc_symbol_changes parameter.
10620         * configure.ac: Call AM_CONDITIONAL for the default target.
10621         * configure: Rebuild.
10622         * testsuite/Makefile.am (TEST_AS): New variable.
10623         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10624         (check_DATA): Add split_i386 and split_x86_64 files.
10625         (SPLIT_DEFSYMS): Define.
10626         (split_i386_[1234n].o): New targets.
10627         (split_i386_[124]): New targets.
10628         (split_i386_[1234r].stdout): New targets.
10629         (split_x86_64_[1234n].o): New targets.
10630         (split_x86_64_[124]): New targets.
10631         (split_x86_64_[1234r].stdout): New targets.
10632         (MOSTLYCLEANFILES): Add new executables.
10633         * testsuite/split_i386.sh: New file.
10634         * testsuite/split_x86_64.sh: New file.
10635         * testsuite/split_i386_1.s: New file.
10636         * testsuite/split_i386_2.s: New file.
10637         * testsuite/split_i386_3.s: New file.
10638         * testsuite/split_i386_4.s: New file.
10639         * testsuite/split_i386_n.s: New file.
10640         * testsuite/split_x86_64_1.s: New file.
10641         * testsuite/split_x86_64_2.s: New file.
10642         * testsuite/split_x86_64_3.s: New file.
10643         * testsuite/split_x86_64_4.s: New file.
10644         * testsuite/split_x86_64_n.s: New file.
10645         * testsuite/testfile.cc (Target_test): Update relocation_section
10646         function.
10647         * testsuite/Makefile.in: Rebuild.
10648
10649 2009-10-06  Ian Lance Taylor  <iant@google.com>
10650
10651         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10652         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10653         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10654         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10655         the address on ldo_addrs_.
10656         (Target_i386::Relocate::fix_up_ldo): New function.
10657
10658 2009-10-06   Rafael Espindola  <espindola@google.com>
10659
10660         * plugin.cc (add_input_library): New.
10661         (Plugin::load): Add add_input_library to tv.
10662         (Plugin_manager::add_input_file): Add the is_lib argument.
10663         (add_input_file): Update call to Plugin_manager::add_input_file.
10664         (add_input_library): New.
10665         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10666
10667 2009-09-30  Doug Kwan  <dougkwan@google.com>
10668
10669         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10670         symbol and call Symbol::may_need_copy_reloc to determine if
10671         a copy reloc is needed.
10672         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10673         nocopyreloc is given in command line.
10674         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10675         given in command line.
10676         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10677         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10678         of the removed Target_i386::may_need_copy_reloc.
10679         * options.h (copyreloc): New option with default value false.
10680         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10681         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10682         instead of the removed Target_powerpc::may_need_copy_reloc.
10683         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10684         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10685         instead of the removed Target_sparc::may_need_copy_reloc.
10686         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10687         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10688         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10689         instead of the removed Target_x86_64::may_need_copy_reloc.
10690
10691 2009-09-30  Ian Lance Taylor  <iant@google.com>
10692
10693         * object.h (class Object): Remove target_ field, and target,
10694         sized_target, and set_target methods.
10695         (Object::sized_target): Remove.
10696         (class Sized_relobj): Update declarations.  Remove sized_target.
10697         * object.cc (Sized_relobj::setup): Remove target parameter.
10698         Change all callers.
10699         (Input_objects::add_object): Don't do anything with the target.
10700         (make_elf_sized_object): Add punconfigured parameter.  Change all
10701         callers.  Set or test parameter target.
10702         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10703         Change all callers.
10704         * parameters.cc (Parameters::set_target): Change parameter type to
10705         be non-const.
10706         (Parameters::default_target): Remove.
10707         (set_parameters_target): Change parameter type to be non-const.
10708         (parameters_force_valid_target): New function.
10709         (parameters_clear_target): New function.
10710         * parameters.h (class Parameters): Update declarations.  Remove
10711         default_target method.  Add sized_target and clear_target
10712         methods.  Change target_ to be non-const.
10713         (set_parameters_target): Update declaration.
10714         (parameters_force_valid_target): Declare.
10715         (parameters_clear_target): Declare.
10716         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10717         as NULL if we aren't searching.
10718         (Add_symbols::run): Don't check for compatible target.
10719         * fileread.cc (Input_file::open_binary): Call
10720         parameters_force_valid_target.
10721         * gold.cc (queue_middle_tasks): Likewise.
10722         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10723         set_target on object.
10724         * dynobj.h (class Sized_dynobj): Update declarations.
10725         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10726         make_elf_object returns NULL.
10727         (Archive::include_member): Don't check whether object target is
10728         compatible.
10729         * output.cc (Output_section::add_input_section): Get target from
10730         parameters.
10731         (Output_section::relax_input_section): Likewise.
10732         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10733         parameters.
10734         (Sized_relobj::do_scan_relocs): Likewise.
10735         (Sized_relobj::relocate_sections): Likewise.
10736         * resolve.cc (Symbol_table::resolve): Likewise.
10737         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10738         parameter.  Change all callers.
10739         (Symbol_table::add_from_object): Get target from parameters.
10740         (Symbol_table::add_from_relobj): Don't check object target.
10741         (Symbol_table::add_from_dynobj): Likewise.
10742         (Symbol_table::define_special_symbol): Get target from
10743         parameters.
10744         * symtab.h (class Symbol_table): Update declaration.
10745         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10746         parameter.  Change all callers.  Clear parameter target.
10747         (Binary_test): Test target here.
10748         * testsuite/object_unittest.cc (gold_testsuite): Remove
10749         target_test_pointer parameter.  Change all callers.
10750         (Object_test): Test target here.
10751
10752 2009-09-26  Ian Lance Taylor  <iant@google.com>
10753
10754         * testsuite/initpri1.c: Don't try to use constructor priorities if
10755         compiling with gcc before 4.3.
10756
10757 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10758
10759         * testsuite/retain_symbols_file_test.sh (check_present): Change
10760         output file name to retain_symbols_file_test.stdout.
10761         (check_absent): Likewise.
10762
10763 2009-09-18  Craig Silverstein  <csilvers@google.com>
10764
10765         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10766         * options.cc: Include <cerrno> and <fstream>.
10767         (General_options::finalize): Parse -retain-symbols-file tag.
10768         * options.h: New flag.
10769         (General_options): New method should_retain_symbol, new
10770         variable symbols_to_retain.
10771         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10772         should_retain_symbol map.
10773         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10774         * testsuite/Makefile.in: Regenerate.
10775         * testsuite/retain_symbols_file_test.sh: New file.
10776
10777 2009-09-18  Nick Clifton  <nickc@redhat.com>
10778
10779         * po/es.po: Updated Spanish translation.
10780
10781 2009-09-17  Doug Kwan  <dougkwan@google.com>
10782
10783         * debug.h (DEBUG_RELAXATION): New constant.
10784         (DEBUG_ALL): Add DEBUG_RELAXATION.
10785         (debug_string_to_enum): Add relaxation debug option.
10786         * layout.cc
10787         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10788         Layout::Relaxation_debug_check::read_sections,
10789         Layout::Relaxation_debug_check::read_sections): New method definitions.
10790         (Layout::Layout): Initialize data members
10791         record_output_section_data_from_scrips_,
10792         script_output_section_data_list_ and relaxation_debug_check_.
10793         (Layout::save_segments, Layout::restore_segments,
10794         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10795         Layout::relaxation_loop_body): New method definitions.
10796         (Layout::finalize): Support relaxation.  Move section layout code to
10797         Layout::relaxation_loop_body.
10798         (Layout::set_asection_address_from_script): Move code for orphan
10799         section placement out.
10800         (Layout::place_orphan_sections_in_script): New method definition.
10801         * layout.h (Output_segment_headers, Output_file_header):
10802         New forward class declarations.
10803         (Layout::~Layout): Define.
10804         (Layout::new_output_section_data_from_script): New method definition.
10805         (Layout::place_orphan_sections_in_script): New method declaration.
10806         (Layout::Segment_states): New type declaration.
10807         (Layout::save_segments, Layout::restore_segments,
10808         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10809         Layout::relaxation_loop_body): New method declarations.
10810         (Layout::Output_section_data_list): New type declaration.
10811         (Layout::Relaxation_debug_check): New class definition.
10812         (Layout::record_output_section_data_from_script_,
10813         Layout::script_output_section_data_list_, Layout::segment_states_,
10814         Layout::relaxation_debug_check_): New data members.
10815         * output.cc: (Output_section_headers::do_size): New method definition.
10816         (Output_section_headers::Output_section_headers): Move size
10817         computation to Output_section_headers::do_size.
10818         (Output_segment_headers::do_size): New method definition.
10819         (Output_file_header::Output_file_header): Move size computation to
10820         Output_file_header::do_size and call it.
10821         (Output_file_header::do_size): New method definition.
10822         (Output_data_group::Output_data_group): Adjust call to
10823         Output_section_data.
10824         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10825         (Output_symtab_xindex::do_write): Add array bound check.
10826         (Output_section::Input_section::print_to_mapfile): Handle
10827         RELAXED_INPUT_SECTION_CODE.
10828         (Output_section::Output_section): Initialize data member checkpoint_.
10829         (Output_section::~Output_section): Delete checkpoint object pointed
10830         by checkpoint_.
10831         (Output_section::add_input_section): Always add an Input_section if
10832         relaxing.
10833         (Output_section::add_merge_input_section): Add assert.
10834         (Output_section::relax_input_section): New method definition.
10835         (Output_section::set_final_data_size): Set load address to zero for
10836         an unallocated section.
10837         (Output_section::do_address_and_file_offset_have_reset_values):
10838         New method definition.
10839         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10840         Handle relaxed input section.
10841         (Output_section::sort_attached_input_sections): Checkpoint input
10842         section list lazily.
10843         (Output_section::get_input_sections): Change type of input_sections to
10844         list of Simple_input_section pointers.  Checkpoint input section list
10845         lazily.  Also handle relaxed input sections.
10846         (Output_section::add_input_section_for_script): Take a reference to
10847         a Simple_input_section object instead of Relobj pointer and section
10848         index as parameter.  Handle relaxed input sections.
10849         (Output_section::save_states, Output_section::restore_states): New
10850         method definitions.
10851         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10852         (Output_data::is_data_size_fixed): New method definition.
10853         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10854         if it is fixed.
10855         (Output_data::address_and_file_offset_have_reset_values): New method
10856         definition.
10857         (Output_data::do_address_and_file_offset_have_reset_values): New method
10858         definition.
10859         (Output_data::set_data_size): Check that data size is not fixed.
10860         (Output_data::fix_data_size): New method definition.
10861         (Output_data::is_data_size_fixed_): New data member.
10862         (Output_section_headers::set_final_data_size): New method definition.
10863         (Output_section_headers::do_size): New method declaration.
10864         (Output_segment_headers::set_final_data_size): New method definition.
10865         (Output_segment_headers::do_size): New method declaration.
10866         (Output_file_header::set_final_data_size)::New method definition.
10867         (Output_file_header::do_size)::New method declaration.
10868         (Output_section_data::Output_section_data): Add new parameter
10869         is_data_size_fixed and use it to fix data size.
10870         (Output_data_const::Output_data_const): Adjust call to base class
10871         constructor and fix data size.
10872         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10873         base class constructor and fix data size.
10874         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10875         base class constructor and fix data size.
10876         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10877         class constructor and fix data size.
10878         (Output_data_group::set_final_data_size): New method definition.
10879         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10880         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10881         class constructor and fix data size.
10882         (Output_relaxed_input_section): New class definition.
10883         (Output_section::Simple_input_section): New class definition.
10884         (Output_section::get_input_sections): Adjust parameter list.
10885         (Output_section::add_input_section_for_script): Same.
10886         (Output_section::save_states, Output_section::restore_states,
10887         Output_section::do_address_and_file_offset_have_reset_values,
10888         (Output_section::Input_section::Input_section): Handle
10889         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10890         Output_relaxed_input_section.
10891         (Output_section::Input_section::is_input_section,
10892         Output_section::Input_section::set_output_section): Handle relaxed
10893         input section.
10894         (Output_section::Input_section::is_relaxed_input_section,
10895         Output_section::Input_section::output_section_data,
10896         Output_section::Input_section::relaxed_input_section): New method
10897         definitions.
10898         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10899         value.
10900         (Output_section::Input_section::u1_): Update comments.
10901         (Output_section::Input_section::u2_): Add new union member poris.
10902         (Output_section::Checkpoint_output_section): New classs definition.
10903         (Output_section::relax_input_section): New method declaration.
10904         (Output_section::checkpoint_): New data member.
10905         (Output_segment): Update comments.
10906         (Output_segment::Output_segment): Un-privatize copy constructor.
10907         (Output_segment::operator=): Un-privatize.
10908         * script-sections.cc (Output_section_element::Input_section_list):
10909         Change element type to Output_section::Simple_input_section.
10910         (Output_section_element_dot_assignment::set_section_addresses):
10911         Register output section data for relaxation clean up.
10912         (Output_data_exression::Output_data_expression): Adjust call to base
10913         constructor to fix data size.
10914         (Output_section_element_data::set_section_addresses): Register
10915         Output_data_expression object for relaxation clean up.
10916         (struct Input_section_info): Replace Relobj pointer and section index
10917         pair with Output_section::Simple_input_section and Convert struct to a
10918         class.
10919         (Input_section_sorter::operator()): Adjust access to
10920         Input_section_info data member to use accessors.
10921         (Output_section_element_input::set_section_addresses): Use layout
10922         parameter.  Adjust code to use Output_section::Simple_input_section
10923         and Input_secction_info classes.  Register filler for relaxation
10924         clean up.
10925         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10926         and section index pair with Output_section::Simple_input_section
10927         class.  Adjust code accordingly.
10928         (Phdrs_element::release_segment): New method definition.
10929         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10930         segment list.
10931         (Script_sections::release_segments): New method definition.
10932         * gold/script-sections.h (Script_sections::release_segments): New
10933         method declaration.
10934         * gold/target.h (Target::may_relax, Target::relax,
10935         Target::do_may_relax, Target::do_relax): New method definitions.
10936
10937 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10938
10939         * arm.cc (has_signed_unsigned_overflow): New function.
10940         (Arm_relocate_functions::abs8): New function.
10941         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10942         (Target_arm::Scan::global): Likewise.
10943         (Target_arm::relocate::relocate): Likewise.
10944         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10945         Likewise.
10946
10947 2009-09-16  Cary Coutant  <ccoutant@google.com>
10948
10949         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10950         * testsuite/Makefile.in: Regenerate.
10951
10952 2009-09-11  Nick Clifton  <nickc@redhat.com>
10953
10954         * po/gold.pot: Updated by the Translation project.
10955
10956 2009-09-08  Cary Coutant  <ccoutant@google.com>
10957
10958         * output.cc (Output_file::open): Add execute permission to empty file.
10959         * testsuite/Makefile.am (permission_test): New test.
10960         * testsuite/Makefile.in: Regenerate.
10961
10962 2009-09-02  Ian Lance Taylor  <iant@google.com>
10963
10964         * output.cc (Output_file::resize): Call map_no_anonymous rather
10965         than map.
10966
10967 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10968
10969         * gold.cc: Include "incremental.h".
10970         (queue_initial_tasks): Call Incremental_checker methods.
10971         * incremental.cc: Include "output.h".
10972         (Incremental_checker::can_incrementally_link_output_file): New
10973         method.
10974         * incremental.h (Incremental_checker): New class.
10975
10976         * output.cc (Output_file::open_for_modification): New method.
10977         (Output_file::map_anonymous): Changed return type to bool.  Record
10978         map in base_ field.
10979         (Output_file::map_no_anonymous): New method, broken out of map.
10980         (Output_file::map): Use map_no_anonymous and map_anonymous.
10981         * output.h (class Output_file): Update declarations.
10982
10983 2009-08-24  Cary Coutant  <ccoutant@google.com>
10984
10985         * options.h (Command_line::Pre_options): New class.
10986         (Command_line::pre_options): New member.
10987         * options.cc (gold::options::ready_to_register): New variable.
10988         (One_option::register_option): Do nothing if not registering options.
10989         Assert if same short option registered twice.
10990         (General_options::General_options): Turn off option registration when
10991         done constructing.
10992         (Command_line::Pre_options::Pre_options): New constructor.
10993
10994 2009-08-24  Cary Coutant  <ccoutant@google.com>
10995
10996         * options.h (General_options::no_keep_memory): Remove incorrect
10997         short option.
10998
10999 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11000
11001         * Makefile.am (am__skiplex, am__skipyacc): New.
11002         * Makefile.in: Regenerate.
11003
11004 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11005
11006         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11007         (INCLUDES): ... this.
11008         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11009         (AM_CPPFLAGS): Renamed from ...
11010         (INCLUDE): ... this.
11011         * Makefile.in, testsuite/Makefile.in: Regenerate.
11012
11013         * Makefile.in: Regenerate.
11014         * aclocal.m4: Likewise.
11015         * config.in: Likewise.
11016         * configure: Likewise.
11017         * testsuite/Makefile.in: Likewise.
11018
11019         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11020         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11021         * Makefile.in: Regenerate.
11022         * testsuite/Makefile.in: Regenerate.
11023
11024 2009-08-19  Cary Coutant  <ccoutant@google.com>
11025
11026         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11027         symbols in shared libraries overridden by hidden or internal symbols
11028         in the main program.
11029
11030 2009-08-19  Chris Demetriou  <cgd@google.com>
11031
11032         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11033         checking source file names in error messages.
11034
11035 2009-08-18  Doug Kwan  <dougkwan@google.com>
11036
11037         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11038         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11039         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11040         an elfcpp::Ehdr as parameter.
11041         * object.cc (Object::set_target): Remove the version that looks up
11042         a target and sets it.
11043         (Sized_relobj::setup): Take a Target object instead of
11044         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11045         (make_elf_sized_object): Find target and ask target to
11046         make an ELF object.
11047         * object.h: (Object::set_target): Remove the version that looks up
11048         a target and sets it.
11049         (Sized_relobj::setup): Take a Target object instead of
11050         an elfcpp:Ehdr as parameter.
11051         * target.cc: Include dynobj.h.
11052         (Target::do_make_elf_object_implementation): New.
11053         (Target::do_make_elf_object): New.
11054         * target.h (Target::make_elf_object): New template declaration.
11055         (Target::do_make_elf_object): New method declarations.
11056         (Target::do_make_elf_object_implementation): New template declaration.
11057
11058 2009-08-14  Ian Lance Taylor  <iant@google.com>
11059
11060         * gold.h (FUNCTION_NAME): Define.
11061         (gold_unreachable): Use FUNCTION_NAME.
11062
11063 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11064
11065         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11066         symbol in the --keep-unique list is not found.
11067
11068 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11069
11070         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11071         been maked as --keep-unique.
11072         (Icf::unfold_section): New function.
11073         * icf.h (Icf::unfold_section): New function.
11074         * options.h (General_options::keep_unique): New option.
11075         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11076         * testsuite/Makefile.in: Regenerate.
11077         * testsuite/icf_keep_unique_test.sh: New file.
11078         * testsuite/icf_keep_unique_test.cc: New file.
11079
11080 2009-08-12  Cary Coutant  <ccoutant@google.com>
11081
11082         PR 10471
11083         * resolve.cc (Symbol_table::resolve): Check for references from
11084         dynamic objects to hidden and internal symbols.
11085         * testsuite/Makefile.am (hidden_test.sh): New test.
11086         * testsuite/Makefile.in: Regenerate.
11087         * testsuite/hidden_test.sh: New script.
11088         * testsuite/hidden_test_1.c: New test source.
11089         * testsuite/hidden_test_main.c: New test source.
11090
11091 2009-08-11  Doug Kwan  <dougkwan@google.com>
11092
11093         * arm.cc: Update comments.
11094         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11095         segment to locate the .ARM.exidx section if present.
11096
11097 2009-08-09  Doug Kwan  <dougkwan@google.com>
11098
11099         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11100         patch.
11101
11102 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11103         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11104         compiler warnings.
11105
11106 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11107
11108         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11109         valid tls_segment only for non-debug-section relocations.
11110         * testsuite/Makefile.am: Add gc_tls_test.
11111         * testsuite/Makefile.in: Regenerate.
11112         * testsuite/gc_tls_test.cc: New file.
11113         * testsuite/gc_tls_test.sh: New file.
11114
11115 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11116
11117         * icf.cc: New file.
11118         * icf.h: New file.
11119         * Makefile.am (CCFILES): Add icf.cc.
11120         (HFILES): Add icf.h
11121         * Makefile.in: Regenerate.
11122         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11123         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11124         section, symbol and addend information for the relocs.
11125         * gold.cc (queue_middle_tasks): Call identical code folding.
11126         * gold.h: Add defines for multimap.
11127         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11128         to the call of finalize_local_symbols.
11129         * main.cc (main): Create object of class Icf.
11130         * object.cc (Sized_relobj::do_layout): Allow this function to be
11131         called twice during icf.
11132         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11133         to sections marked as identical by icf.
11134         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11135         when available.
11136         (Sized_relobj::do_section_entsize): New function.
11137         * object.h (Object::section_entsize): New function.
11138         (Object::do_section_entsize): New pure virtual function.
11139         (Relobj::finalize_local_symbols): Add new parameter.
11140         (Relobj::do_section_entsize): New function.
11141         * options.h (General_options::icf): New option.
11142         (General_options::icf_iterations): New option.
11143         (General_options::print_icf_sections): New option.
11144         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11145         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11146         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11147         icf.
11148         * symtab.cc (Symbol_table::is_section_folded): New function.
11149         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11150         to sections marked as identical by icf.
11151         * symtab.h (Symbol_table::set_icf): New function.
11152         (Symbol_table::icf): New function.
11153         (Symbol_table::is_section_folded): New function.
11154         (Symbol_table::icf_): New data member.
11155         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11156         * testsuite/Makefile.am: Add commands to build icf_test.
11157         * testsuite/Makefile.in: Regenerate.
11158         * testsuite/icf_test.sh: New file.
11159         * testsuite/icf_test.cc: New file.
11160
11161 2009-07-24  Chris Demetriou  <cgd@google.com>
11162
11163         * layout.cc (is_compressible_debug_section): Fix incorrect
11164         comment about compressed section names.
11165
11166 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11167
11168         PR 10419
11169         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11170
11171 2009-07-16  Ian Lance Taylor  <iant@google.com>
11172
11173         PR 10400
11174         * layout.h: #include <map>.
11175         (class Kept_section): Change from struct to class.  Add accessors
11176         and setters.  Add section size to Comdat_group mapping.  Change
11177         Comdat_group to std::map.  Add is_comdat_ field.  Add
11178         linkonce_size field in union.
11179         (class Layout): Update declaration of find_or_add_kept_section.
11180         Don't declare find_kept_object.
11181         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11182         parameter.  Add object, shndx, is_comdat, and is_group_name
11183         parameters.  Change all callers.  Adjust for new Kept_section.
11184         (Layout::find_kept_object): Remove.
11185         * object.cc (Sized_relobj::include_section_group): Update use of
11186         Kept_section.  Rename secnum to shndx.  Only record
11187         Kept_comdat_section if sections are the same size.
11188         (Sized_relobj::include_linkonce_section): Update use of
11189         Kept_section.  Only record Kept_comdat_section if sections are the
11190         same size.  Set size of linkonce section.
11191         (Sized_relobj::map_to_kept_section): Update call to
11192         get_kept_comdat_section.
11193         * object.h (class Sized_relobj): Rename fields in
11194         Kept_comdat_section to drop trailing underscores; change object
11195         field to Relobj*.  Change Kept_comdat_section_table to store
11196         struct rather than pointer.
11197         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11198         Add kept_object and kept_shndx parameters.  Change all callers.
11199         (Sized_relobj::get_kept_comdat_section): Change return type to
11200         bool.  Add kept_object and kept_shndx parameters.  Change all
11201         callers.
11202         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11203         Layout::find_or_add_kept_section.
11204
11205 2009-07-09  Ian Lance Taylor  <iant@google.com>
11206
11207         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11208         Reserve space in the hash table.
11209
11210 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11211
11212         * fileread.cc (File_read::get_mtime): New method.
11213         * fileread.h (Timespec): New structure.
11214         (File_read::get_mtime): New method.
11215         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11216         Renamed from timestamp_nsec.
11217         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11218         Elf_Xword.
11219         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11220         timestamp_nsec.
11221         (Incremental_inputs::report_archive): Save mtime; style fix.
11222         (Incremental_inputs::report_obejct): Save mtime; style fix.
11223         (Incremental_inputs::report_script): Save mtime; style fix.
11224         (Incremental_inputs::finalize_inputs): Style fix.
11225         (Incremental_inputs::finalize): Style fix.
11226         (Incremental_inputs::create_input_section_data): Store inputs
11227         mtime.
11228         * incremental.h (Incremental_inputs::report_script): Add mtime
11229         argument.
11230         (Incremental_inputs::Input_info::Input_info): Intialize only one
11231         union member.
11232         (Incremental_inputs::Input_info::archive): Move to nameless
11233         union.
11234         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11235         (Incremental_inputs::Input_info::script): Move to nameless union.
11236         (Incremental_inputs::mtime): New field.
11237         * script.cc (read_input_script): Pass file mtime to
11238         Incremental_input.
11239         * script.h (Script_info::inputs): Style fix.
11240
11241 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11242
11243         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11244         instead of 32.
11245
11246 2009-06-24  Ian Lance Taylor  <iant@google.com>
11247
11248         PR 10156
11249         * layout.cc (Layout::choose_output_section): If we find an
11250         existing section, update the flags.
11251         (Layout::create_notes): New function, broken out of
11252         Layout::finalize.
11253         (Layout::finalize): Don't create note sections.
11254         (Layout::create_note): Don't crash if linker script discards
11255         section.
11256         (Layout::create_gold_note): Likewise.
11257         (Layout::create_build_id): Likewise.  Don't set
11258         after_input_sections on the section.
11259         (Layout::create_executable_stack_info): Remove target parameter.
11260         Change caller.
11261         * layout.h (class Layout): Declare create_notes.  Update
11262         declaration of create_executable_stack_info.
11263         * gold.cc (queue_middle_tasks): Call create_notes.
11264         * output.cc (Output_section::update_flags_for_input_section): Move
11265         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11266         invalid.
11267         * output.h (Output_data::mark_address_invalid): New function.
11268         (class Output_section): Only declare, not define,
11269         update_flags_for_input_section.  Remove set_flags.
11270
11271 2009-06-24  Ian Lance Taylor  <iant@google.com>
11272
11273         * script-sections.cc (Output_section_definition::
11274         set_section_addresses): Rename shadowing local load_address to
11275         laddr.
11276
11277 2009-06-24  Ian Lance Taylor  <iant@google.com>
11278
11279         PR 10244
11280         * reloc.cc (relocate_sections): Skip empty relocation sections.
11281
11282 2009-06-23  Ian Lance Taylor  <iant@google.com>
11283
11284         PR 10156
11285         * layout.cc (Layout::create_note): Use choose_output_section
11286         rather than make_output_section.
11287
11288 2009-06-23  Ian Lance Taylor  <iant@google.com>
11289
11290         PR 10237
11291         * options.cc (General_options::parse_V): Set printed_version_.
11292         (General_options::General_options): Initialize printed_version_.
11293         * options.h (class General_options): Add printed_version_ field.
11294         * gold.cc (queue_initial_tasks): If there are no input files,
11295         don't give a fatal error if we printed the version information.
11296         (queue_middle_tasks): If using -r with a shared object, give a
11297         fatal error rather than an ordinary error.
11298
11299 2009-06-23  Ian Lance Taylor  <iant@google.com>
11300
11301         PR 10219
11302         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11303         (Layout::make_output_section): Set have_stabstr_section_ if we see
11304         a .stab*str section.
11305         (Layout::finalize): Call link_stabs_sections.
11306         (Layout::link_stabs_sections): New file.
11307         * layout.h (class Layout): Add have_stabstr_section_ field.
11308         Declare link_stabs_sections.
11309
11310 2009-06-23  Doug Kwan  <dougkwan@google.com>
11311
11312         * Makefile.am (libgold_a_LIBADD): New.
11313         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11314         * Makefile.in: Regenerate.
11315         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11316         * configure: Regenerate.
11317         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11318         * fileread.cc: Include sys/state.h
11319         * gold.h: Declare memmem and strndup if found missing.
11320         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11321
11322 2009-06-23  Ian Lance Taylor  <iant@google.com>
11323
11324         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11325         * configure: Rebuild.
11326
11327 2009-06-23  Ian Lance Taylor  <iant@google.com>
11328
11329         PR 10147
11330         * object.cc (Object::section_contents): Don't try to get a view if
11331         the section has length zero.
11332         (Object::handle_gnu_warning_section): If the section is empty, use
11333         the name of the section as the warning.
11334
11335 2009-06-23  Ian Lance Taylor  <iant@google.com>
11336
11337         PR 10133
11338         * stringpool.h (class Stringpool_template): Add optimize_ field.
11339         (Stringpool_template::set_optimize): New function.
11340         * stringpool.cc (Stringpool_template::Stringpool_template):
11341         Initialize optimize_ field.
11342         (Stringpool_template::set_string_offsets): Test local optimize
11343         fild rather than parameter.
11344         * layout.cc (Layout::Layout): Call set_optimize on the section
11345         name stringpool.
11346
11347 2009-06-22  Ian Lance Taylor  <iant@google.com>
11348
11349         PR 10030
11350         * yyscript.y: Parse TARGET.
11351         * script.cc (script_set_target): New function.
11352         * script-c.h (script_set_target): Declare.
11353         * options.cc (General_options::string_to_object_format): Rename
11354         from string_to_object_format in anonymous namespace.  Change
11355         callers.
11356         * options.h (class General_options): Declare
11357         string_to_object_format.
11358
11359 2009-06-22  Ian Lance Taylor  <iant@google.com>
11360
11361         * script-sections.cc (Script_sections::create_segments): Don't put
11362         program headers in a PT_LOAD segment if -n or -N.
11363
11364 2009-06-22  Ian Lance Taylor  <iant@google.com>
11365
11366         PR 10141
11367         * options.h (class General_options): Add -z lazy and -z now.  Sort
11368         -z options into alphabetical order.
11369         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11370
11371 2009-06-21  Ian Lance Taylor  <iant@google.com>
11372
11373         * layout.cc (Layout::make_output_section): Call
11374         Target::new_output_section.
11375         (Layout::attach_allocated_section_to_segment): Put large section
11376         sections in a separate load segment with the large segment flag
11377         set.
11378         (Layout::segment_precedes): Sort large data segments after other
11379         load segments.
11380         (align_file_offset): New static function.
11381         (Layout::set_segment_offsets): Use align_file_offset.
11382         * output.h (class Output_section): Add is_small_section_ and
11383         is_large_section_ fields.
11384         (Output_section::is_small_section): New function.
11385         (Output_section::set_is_small_section):  New function.
11386         (Output_section::is_large_section): New function.
11387         (Output_section::set_is_large_section): New function.
11388         (Output_section::is_large_data_section): New function.
11389         (class Output_segment): Add is_large_data_segment_ field.
11390         (Output_segment::is_large_data_segment): New function.
11391         (Output_segment::set_is_large_data_segment): New function.
11392         * output.cc (Output_section::Output_section): Initialize new
11393         fields.
11394         (Output_segment::Output_segment): Likewise.
11395         (Output_segment::add_output_section): Add assertion that large
11396         data sections always go in large data segments.  Force small data
11397         sections to the end of the list of data sections.  Force small BSS
11398         sections to the start of the list of BSS sections.  For large BSS
11399         sections to the end of the list of BSS sections.
11400         * symtab.h (class Symbol): Declare is_common_shndx.
11401         (Symbol::is_defined): Check Symbol::is_common_shndx.
11402         (Symbol::is_common): Likewise.
11403         (class Symbol_table): Define enum Commons_section_type.  Update
11404         declarations.  Add small_commons_ and large_commons_ fields.
11405         * symtab.cc (Symbol::is_common_shndx): New function.
11406         (Symbol_table::Symbol_table): Initialize new fields.
11407         (Symbol_table::add_from_object): Put small and large common
11408         symbols in the right list.
11409         (Symbol_table::sized_finalized_symbol): Check
11410         Symbol::is_common_shndx.
11411         (Symbol_table::sized_write_globals): Likewise.
11412         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11413         common symbol lists.  Don't call do_allocate_commons_list if the
11414         list is empty.
11415         (Symbol_table::do_allocate_commons_list): Remove is_tls
11416         parameter.  Add comons_section_type parameter.  Change all
11417         callers.  Handle small and large common symbols.
11418         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11419         Symbol::is_common_shndx.
11420         * resolve.cc (symbol_to_bits): Likewise.
11421         * target.h (Target::small_common_shndx): New function.
11422         (Target::small_common_section_flags): New function.
11423         (Target::large_common_shndx): New function.
11424         (Target::large_common_section_flags): New function.
11425         (Target::new_output_section): New function.
11426         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11427         small_common_section_flags, and large_common_section_flags
11428         fields.
11429         (Target::do_new_output_section): New virtual function.
11430         * arm.cc (Target_arm::arm_info): Initialize new fields.
11431         * i386.cc (Target_i386::i386_info): Likewise.
11432         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11433         Likewise.
11434         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11435         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11436         (Target_x86_64::do_new_output_section): New function.
11437         * configure.ac: Define conditional MCMODEL_MEDIUM.
11438         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11439         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11440         (large_LDFLAGS): Define.
11441         * testsuite/large.c: New file.
11442         * testsuite/testfile.cc (Target_test::test_target_info):
11443         Initialize new fields.
11444         * configure, testsuite/Makefile.in: Rebuild.
11445
11446 2009-06-05  Doug Kwan  <dougkwan@google.com>
11447
11448         * Makefile.am (CCFILES): Add target.cc.
11449         * Makefile.in: Regenerate.
11450         * i386.cc (class Target_i386): Define new virtual method to
11451         override do_is_local_label_name in parent.
11452         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11453         local symbols if --discard-locals or -X is given.
11454         * options.h (class General_options): Declare new options
11455         '--discard-locals' and '-X' for discarding locals.
11456         * target.h (class Target): Define new methods is_local_label_name.
11457         Declare new virtual method do_is_local_label_name.
11458         * target.cc: New file.
11459         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11460         (check_SCRIPTS): Add discard_locals_test.sh.
11461         (check_DATA): Add discard_local_tests.syms.
11462         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11463         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11464         * testsuite/Makefile.in: Regenerate.
11465         * testsuite/discard_locals_test.c: New file.
11466         * testsuite/discard_locals_test.sh: Same.
11467
11468 2009-06-05  Doug Kwan  <dougkwan@google.com>
11469
11470         * object.cc (Sized_relobj::Sized_relobj): Initialize
11471         discarded_eh_frame_shndx_ to -1U.
11472         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11473         section.
11474         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11475         a discarded .eh_frame section.
11476         (Sized_relobj::do_finalize_local_symbols): Ditto.
11477         * object.h (class Sized_relobj): Declare new member
11478         discarded_eh_frame_shndx_.
11479         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11480         (local_labels_test.o, local_labels_test): New rules.
11481         * testsuite/Makefile.in: Regenerate.
11482
11483 2009-06-04  Doug Kwan  <dougkwan@google.com>
11484
11485         * layout.cc (Layout::section_name_mapping): Add mapping for
11486         special ARM sections.
11487
11488 2009-06-03  Doug Kwan  <dougkwan@google.com>
11489
11490         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11491         (utils::has_overflow): Same.
11492
11493 2009-06-03  Ian Lance Taylor  <iant@google.com>
11494
11495         * layout.cc (Layout::section_name_mapping): New array, replacing
11496         Layout::linkonce_mapping.
11497         (Layout::section_name_mapping_count): New variable, replacing
11498         Layout::linkonce_mapping_count.
11499         (Layout::linkonce_output_name): Remove.
11500         (Layout::output_section_name): Rewrite.
11501         * layout.h (class Layout): Rename Linkonce_mapping to
11502         Section_name_mapping, linkonce_mapping to section_name_mapping,
11503         linkonce_mapping_count to section_name_mapping_count.  Don't
11504         declare linkonce_output_name.
11505
11506 2009-06-03  Doug Kwan  <dougkwan@google.com>
11507
11508         * gold/arm.cc (namespace utils): New.
11509         (Target_arm::reloc_is_non_pic): Define new method.
11510         (class Arm_relocate_functions): New.
11511         (Target_arm::Relocate::relocate): Handle relocation types used by
11512         Android.
11513
11514 2009-06-03  Ian Lance Taylor  <iant@google.com>
11515
11516         * arm.cc (Target_arm::scan::global): Use || instead of |.
11517
11518 2009-06-02  Doug Kwan  <dougkwan@google.com>
11519
11520         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11521         issued_non_pic_error_.
11522         (class Target_arm::Scan): Declare new method check_non_pic.
11523         Define new method symbol_needs_plt_entry.
11524         Declare new data member issued_non_pic_error_.
11525         (class Target_arm::Relocate): Declare new method
11526         should_apply_static_reloc.
11527         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11528         (Target_arm::Scan::check_non_pic): Define new method.
11529         (Target_arm::Scan::local): Handle a small subset of reloc types used
11530         by Android.
11531         (Target_arm::Scan::local): Same.
11532         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11533
11534 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11535
11536         * incremental.cc (Incremental_inputs::report_command_line): Filter
11537         out --incremental-* options.
11538
11539 2009-05-29  Doug Kwan  <dougkwan@google.com>
11540
11541         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11542         template class.
11543         (class Target_arm): Update comment.
11544         (Target_arm::Target_arm): Initialize new data members GOT_,
11545         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11546         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11547         and Target_arm::rel_dyn_section.
11548         Declare new_enum Target_arm::Got_type.
11549         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11550         and DYNBSS_.
11551         Update commments for member do_dynsym_value.
11552         (Target_arm::got_size, Target_arm::plt_section,
11553         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11554         new methods inside class defintion.
11555         (Target_arm::got_section): Define new method.
11556         (Target_arm::rel_dyn_section): Same.
11557         (Output_data_plt_arm): New template class.
11558         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11559         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11560         (Output_data_plt_arm::add_entry): Same.
11561         (Output_data_plt_arm::first_plt_entry): Define new
11562         static data member for PLT instruction template.
11563         (Output_data_plt_arm::plt_entry): Same.
11564         (Output_data_plt_arm::do_write): Define new method.
11565         (Target_arm::make_plt_entry): Same.
11566         (Target_arm::do_finalize_sections): Same.
11567         (Target_arm::do_dynsym_value): Same.
11568
11569 2009-05-28  Doug Kwan  <dougkwan@google.com>
11570
11571         * Makefile.am (TARGETSOURCES): Add arm.cc.
11572         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11573         * Makefile.in: Regenerate.
11574         * arm.cc: New file.
11575         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11576
11577 2009-05-26  Doug Kwan  <dougkwan@google.com>
11578
11579         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11580         (General_options::check_excluded_libs): Strip off directories in
11581         archive name before matching like GNU ld does.
11582         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11583         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11584         (exclude_libs_test_LDFLAGS): Add linker option
11585         -Wl,--exclude-libs,libexclude_libs_test_3
11586         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11587         an explicit archive without using -l.
11588         (alt/libexclude_libs_test_3.a): New make rule.
11589         * testsuite/Makefile.in: Regenerate.
11590         * testsuite/exclude_libs_test.c : Declare lib3_default().
11591         (main): Call it.
11592         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11593         * exclude_libs_test_3.c: New file.
11594
11595 2009-05-26  Nick Clifton  <nickc@redhat.com>
11596
11597         * po/id.po: New Indonesian translation.
11598         * po/gold.pot: Updated template file.
11599
11600 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11601
11602         * testsuite/Makefile.am: Add -ffunction-sections to compile
11603         gc_comdat_test files.  Add -Wl,--gc-sections to build
11604         gc_comdat_test.
11605         * testsuite/Makefile.in: Regenerate.
11606         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11607
11608 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11609
11610         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11611         kept comdat section was garbage collected.
11612         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11613         * testsuite/Makefile.in: Regenerate.
11614         * testsuite/gc_comdat_test.sh: New file.
11615         * testsuite/gc_comdat_test_1.cc: New file.
11616         * testsuite/gc_comdat_test_2.cc: New file.
11617
11618 2009-05-19  Doug Kwan  <dougkwan@google.com>
11619
11620         * archive.cc (Archive::Archive): Move constructor from archive.h
11621         to here.  Initialize no_export_.
11622         (Archive::get_elf_object_for_member): Set no_export flag of object.
11623         * archive.h (Archive::Archive): Move constructor body to
11624         archive.cc.
11625         (Archive::no_export): New method.
11626         (Archive::no_export_): New field.
11627         * object.h (Object::Object): Initialize no_export_ to false.
11628         (Object::no_export, Object::set_no_export): New methods.
11629         (Object::no_export_): New field.
11630         * options.cc (General_options::parse_exclude_libs): New method.
11631         (General_options::check_excluded_libs) Same.
11632         * options.h (exclude_libs): New option.
11633         (General_options::check_excluded_libs): New method declaration.
11634         (General_options::excluded_libs_): New field.
11635         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11636         default or protected visibility if an object has no-export flag set.
11637         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11638         (check_SCRIPTS): Add exclude_libs_test.sh.
11639         (check_DATA): Add exclude_libs_test.syms.
11640         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11641         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11642         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11643         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11644         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11645         libexclude_libs_test_2.a): New rules.
11646         * testsuite/Makefile.in: Regenerate.
11647         * testsuite/exclude_libs_test.c: New file.
11648         * testsuite/exclude_libs_test.sh: Ditto.
11649         * testsuite/exclude_libs_test_1.c: Ditto.
11650         * testsuite/exclude_libs_test_2.c: Ditto.
11651
11652 2009-05-15  Ian Lance Taylor  <iant@google.com>
11653
11654         * configure.ac: Check for declarations for cases where libiberty.h
11655         checks HAVE_DECL_xxx.
11656         * configure, config.in: Rebuild.
11657
11658 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11659
11660         * gold.h (Incremental_argument_list): Remove (invalid) forward
11661         declaration.
11662         * incremental.cc (Incremental_inputs::report_achive): New method.
11663         (Incremental_inputs::report_object): New method.
11664         (Incremental_inputs::report_script): New method.
11665         (Incremental_inputs::finalize_inputs): New method.
11666         (Incremental_inputs::finalize): Call finalize_inputs().
11667         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11668         Create inputs entries.
11669         * incremental.h (Incremental_input_type): New enum.
11670         (Incremental_inputs::Incremental_input): Initialize new fields.
11671         (Incremental_inputs::report_inputs): New method.
11672         (Incremental_inputs::report_achive): New method.
11673         (Incremental_inputs::report_object): New method.
11674         (Incremental_inputs::report_script): New method.
11675         (Incremental_inputs::finalize_inputs): New method.
11676         (Incremental_inputs::Input_info): New struct.
11677         (Incremental_inputs::Input_info_map): New typedef.
11678         (Incremental_inputs::lock_): New field.
11679         (Incremental_inputs::Inputs_): New field.
11680         (Incremental_inputs::Inputs_map): New field.
11681         * main.cc (main): Call Incremental_input::report_inputs.
11682         * options.h (Input_argument_list): Typedef moved from
11683         Input_arguments.
11684         (Input_file_group::Files): Remove, use ::Input_argument_list.
11685         (Input_file_group::Input_argument_list): Remove, use
11686         ::Input_argument_list.
11687         * plugin.cc (Plugin_manager::add_input_file): Add error in
11688         incremental build.
11689         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11690         functions.
11691         * script.cc (read_input_script): Call
11692         Incremental_input::report_script.
11693         * script.h (Script_info): New class.
11694
11695 2009-04-27  Ian Lance Taylor  <iant@google.com>
11696
11697         * x86_64.cc (do_adjust_output_section): Set entsize to
11698         plt_entry_size.
11699
11700 2009-04-23  Elliott Hughes  <enh@google.com>
11701
11702         * output.cc (Output_file::close): After short writes, continue
11703         writing from the correct offset in the buffer being written.
11704
11705 2009-04-23  Chris Demetriou  <cgd@google.com>
11706
11707         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11708         * configure: Regenerate.
11709         * config.in: Regenerate.
11710         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11711         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11712
11713 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11714
11715         * incremental.cc (Incremental_inputs_header_data): Renamed from
11716         Incremental_input_header_data.
11717         (Incremental_inputs_header_data::data_size): New field.
11718         (Incremental_inputs_header_data::put_input_file_count): Renamed
11719         from input_file_count.
11720         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11721         from command_line_offset.
11722         (Incremental_inputs_header_data::put_reserved): Renamed from
11723         put_reserved.
11724         (Incremental_inputs_entry_data): Renamed from
11725         Incremental_input_entry_data.
11726         (Incremental_inputs_entry_data::data_size): New field.
11727         (Incremental_inputs::report_command_line): New method.
11728         (Incremental_inputs::finalize): New method.
11729         (Incremental_inputs::create_incremental_inputs_data): New method.
11730         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11731         * incremental.h: New file.
11732         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11733         (Layout::finalize): Create incremental inputs section in
11734         incremental builds.
11735         (Layout::create_incremental_info_sections): New method.
11736         * layout.h (Layout::incremental_inputs): New method.
11737         (Layout::create_incremental_info_sections): New method.
11738         (Layout::incremental_inputs_): New field.
11739         * main.cc (main): Notify Incremental_input of the command line.
11740
11741 2009-04-01  Ian Lance Taylor  <iant@google.com>
11742             Mikolaj Zalewski  <mikolajz@google.com>
11743
11744         * gold.h (reserve_unordered_map): Define, three versions, one for
11745         each version of Unordered_map.
11746         * layout.cc (Layout::Layout): Remove options parameter.  Add
11747         number_of_input_files parameter.  Don't initialize options_.
11748         Initialize number_of_input_files_ and resized_signatures_.  Move
11749         sections_are_attached_.
11750         (Layout::layout_group): Reserve space for group_signatures_.
11751         (Layout::find_or_add_kept_section): Change name parameter to be a
11752         reference.  Resize signatures_ map when it gets large enough.
11753         (Layout::layout_eh_frame): Use parameters->options() instead of
11754         this->options_.
11755         (Layout::make_output_section): Likewise.
11756         (Layout::attach_allocated_section_to_segment): Likewise.
11757         (Layout::finalize, Layout::create_executable_stack): Likewise.
11758         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11759         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11760         * layout.h (class Layout): Update declarations.  Remove options_
11761         field.  Add number_of_input_files_ and resized_signatures_
11762         fields.  Move sections_are_attached_ field.
11763         * main.cc (main): Pass number of input files to Layout
11764         constructor.  Don't pass options.
11765
11766 2009-03-30  Ian Lance Taylor  <iant@google.com>
11767
11768         * ffsll.c (ffsll): Correct implementation.
11769
11770 2009-03-27  Ian Lance Taylor  <iant@google.com>
11771
11772         * ffsll.c: New file.
11773         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11774         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11775         * ftruncate.c (ftruncate): Declare before definition.
11776         * mremap.c (mremap): Likewise.
11777         * pread.c (pread): Likewise.
11778         * configure, Makefile.in, config.in: Rebuild.
11779
11780         * mremap.c: New file.
11781         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11782         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11783         (mremap): Declare if HAVE_MREMAP is not defined.
11784         * configure, Makefile.in, config.in: Rebuild.
11785
11786 2009-03-27  Cary Coutant  <ccoutant@google.com>
11787
11788         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11789         position independent.
11790         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11791         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11792
11793 2009-03-24  Cary Coutant  <ccoutant@google.com>
11794
11795         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11796         an executable.
11797         (needs_dynamic_reloc): Likewise.
11798
11799 2009-03-24  Ian Lance Taylor  <iant@google.com>
11800
11801         * yyscript.y (file_cmd): Recognize EXTERN.
11802         (extern_name_list, extern_name_list_body): New nonterminals.
11803         * script.cc (script_add_extern): Define.
11804         * script-c.h (script_add_extern): Declare.
11805
11806 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11807
11808         * object.cc (is_elf_object): Define.
11809         * object.h (is_elf_object): Declare.
11810         * archive.cc (Archive::get_elf_object_for_member): Call
11811         is_elf_object.
11812         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11813
11814 2009-03-24  Elliott Hughes  <enh@google.com>
11815
11816         * output.cc (Output_file::map_anonymous): Define.
11817         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11818         try an anonymous one.  Report the size if the mmap fails.
11819         * output.h (class Output_file): Declare map_anonymous.
11820
11821 2009-03-24  Ian Lance Taylor  <iant@google.com>
11822
11823         * target-select.cc (instantiate_target): Don't acquire the lock if
11824         the instantiated_target_ field has already been set.
11825
11826 2009-03-23  Ian Lance Taylor  <iant@google.com>
11827
11828         * gold-threads.h (class Initialize_lock): Define.
11829         * gold-threads.cc (class Initialize_lock_once): Define.
11830         (initialize_lock_control): New static variable.
11831         (initialize_lock_pointer): New static variable.
11832         (initialize_lock_once): New static function.
11833         (Initialize_lock::Initialize_lock): Define.
11834         (Initialize_lock::initialize): Define.
11835         * target-select.h: Include "gold-threads.h".
11836         (class Target_selector): Add lock_ and initialize_lock_ fields.
11837         Don't define instantiate_target, just declare it.
11838         * target-select.cc (Target_selector::Target_selector): Initialize
11839         new fields.
11840         (Target_selector::instantiate_target): Define.
11841         * descriptors.h: Include "gold-threads.h".
11842         (class Descriptors): Add initialize_lock_ field.
11843         * descriptors.cc (Descriptors::Descriptors): Initialize new
11844         field.
11845         (Descriptors::open): Use initialize_lock_ field
11846         * errors.h (class Errors): Add initialize_lock_ field.
11847         * errors.cc (Errors::Errors): Initialize new field.
11848         (Errors::initialize_lock): Use initialize_lock_ field.
11849         * powerpc.cc (class Target_selector_powerpc): Remove
11850         instantiated_target_ field.  In do_recognize call
11851         instantiate_target rather than do_instantiate_target.  In
11852         do_instantiate_target just allocate a new target.
11853         * sparc.cc (class Target_selector_sparc): Likewise.
11854
11855         * freebsd.h: New file.
11856         * i386.cc: Include "freebsd.h".
11857         (Target_i386): Derive from Target_freebsd rather than
11858         Sized_target.
11859         (Target_selector_i386): Derive from Target_selector_freebsd rather
11860         than Target_selector.
11861         * x86_64.cc: Include "freebsd.h".
11862         (Target_x86_64): Derive from Target_freebsd rather than
11863         Sized_target.
11864         (Target_selector_x86_64): Derive from Target_selector_freebsd
11865         rather than Target_selector.
11866         * target.h (class Target): Add adjust_elf_header and
11867         do_adjust_elf_header.
11868         * output.cc (Output_file_header:: do_sized_write): Call target
11869         adjust_elf_header routine.
11870         * configure.tgt: Set targ_osabi.
11871         * configure.ac: Define GOLD_DEFAULT_OSABI.
11872         * parameters.cc (Parameters::default_target): Pass
11873         GOLD_DEFAULT_OSABI to select_target.
11874         * target-select.h (class Target_selector): Make instantiate_target
11875         protected rather than private.
11876         * Makefile.am (HFILES): Add freebsd.h.
11877         * configure, Makefile.in, config.in: Rebuild.
11878
11879         * merge.cc (do_add_input_section): Correct pend value.  Change
11880         message about last entry not being null terminated from error to
11881         warning.
11882
11883 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11884
11885         * incremental.cc: New file.
11886         * Makefile.am (CCFILES): Add incremental.cc.
11887         * Makefile.in: Rebuild.
11888
11889 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11890
11891         * layout.cc (Layout::output_section_name): Preserve names
11892         of '.note.' sections.
11893
11894 2009-03-19  Ian Lance Taylor  <iant@google.com>
11895
11896         * descriptors.cc (Descriptors::open): Check that the options are
11897         valid before using them.
11898
11899 2009-03-18  Ian Lance Taylor  <iant@google.com>
11900
11901         * script-sections.h: Include <list>.
11902         (class Script_sections): Change Sections_elements from std::vector
11903         to std::list.  Typedef public Elements_iterator.  Add
11904         orphan_section_placement_, data_segment_align_start_, and
11905         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11906         field.
11907         * script-sections.cc (class Orphan_section_placement): New class.
11908         (class Sections_element): Add virtual functions is_relro and
11909         orphan_section_init.  Remove virtual function place_orphan_here.
11910         (class Output_section_definition): Add is_relro and
11911         orphan_section_init.  Remove place_orphan_here.
11912         (class Orphan_output_section): Likewise.
11913         (Script_sections::Script_sections): Update for field changes.
11914         (Script_sections::data_segment_align): Set saw_data_segment_align_
11915         and data_segment_align_start_, not data_segment_align_index.
11916         (Script_sections::data_segment_relro_end): Check
11917         saw_data_segment_align_.  Use data_segment_align_start_ rather
11918         than data_segment_align_index_.
11919         (Script_sections::place_orphan): Rewrite to use
11920         Orphan_section_placement.
11921
11922 2009-03-17  Ian Lance Taylor  <iant@google.com>
11923
11924         * archive.cc (Archive::add_symbols): Check for a version attached
11925         to the symbol name in the archive map.
11926         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11927         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11928         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11929         (ver_test_11.a): New target.
11930         * testsuite/Makefile.in: Rebuild.
11931
11932         * configure.ac: Check for chsize and posix_fallocate.  Replace
11933         ftruncate.
11934         * ftruncate.c: New file, from gnulib.
11935         * output.cc (posix_fallocate): Define dummy version if not
11936         HAVE_POSIX_FALLOCATE.
11937         (Output_file::map): Call posix_fallocate rather than lseek and
11938         write.
11939         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11940         * configure, Makefile.in, config.in: Rebuild.
11941
11942 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11943
11944         * layout.h (Layout::create_note): Add section_name parameter.
11945         * layout.cc (Layout::create_note): Likewise.
11946         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11947
11948 2009-03-17  Ian Lance Taylor  <iant@google.com>
11949
11950         * descriptors.cc: Include "options.h".
11951         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11952         (Descriptors::open): Always use O_CLOEXEC when opening a new
11953         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11954         then set FD_CLOEXEC.
11955
11956         * sparc.cc (class Target_sparc): Add has_got_section.
11957         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11958         make sure we have a GOT section.
11959
11960         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11961         (Target_sparc::Scan::local): Likewise.
11962         (Target_sparc::Scan::global): Likewise.
11963         (Target_sparc::Relocate::relocate): Likewise.
11964         (Target_sparc::Relocate::relocate_tls): Likewise.
11965
11966         * symtab.cc (Symbol_table::define_default_version): New function,
11967         broken out of add_from_object.
11968         (Symbol_table::add_from_object): Call define_default_version.
11969         (Symbol_table::define_special_symbol): Add resolve_oldsym
11970         parameter.  Change all callers.  If the version for a symbol comes
11971         from a version script, resolve it with the symbol with the same
11972         name with no version.  Also add the symbol without a version if
11973         appropriate.
11974         (do_define_in_output_data): If resolving with oldsym, don't delete
11975         sym.
11976         (do_define_in_output_segment): Likewise.
11977         (do_define_as_constant): Likewise.
11978         * symtab.h (class Symbol_table): Update declarations.
11979
11980 2009-03-13  Ian Lance Taylor  <iant@google.com>
11981
11982         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11983         (Read_symbols::requeue): New function.
11984         (Read_symbols::do_read_symbols): If make_elf_object fails because
11985         the target type is not configured, and the file was searched for,
11986         issue a warning and retry with the next directory.
11987         (Add_symbols::run): If the file has an incompatible format, and
11988         it was searched for, requeue the Read_symbols task.  On error,
11989         release the object.
11990         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11991         dirindex parameter to constructor.  Change all callers.  Declare
11992         incompatible_warning and requeue.
11993         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11994         input_argument_ and input_group_ fields.  Add them to
11995         constructor.  Change all callers.
11996         (class Read_script): Add dirindex_ field.  Add it to constructor.
11997         Change all callers.
11998         * archive.cc (Archive::setup): Remove input_objects parameter.
11999         Change all callers.
12000         (Archive::get_file_and_offset): Likewise.
12001         (Archive::read_all_symbols): Likewise.
12002         (Archive::read_symbols): Likewise.
12003         (Archive::get_elf_object_for_member): Remove input_objects
12004         parameter.  Add punconfigured parameter.  Change all callers.
12005         (Archive::add_symbols): Change return type to bool.  Check return
12006         value of include_member.
12007         (Archive::include_all_members): Likewise.
12008         (Archive::include_member): Change return type to bool.  Return
12009         false if first included object has incompatible target.  Set
12010         included_member_ field.
12011         (Add_archive_symbols::run): If add_symbols returns false, requeue
12012         Read_symbols task.
12013         * archive.h (class Archive): Add included_member_ field.
12014         Initialize it in constructor.  Add input_file and searched_for
12015         methods.  Update declarations.
12016         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12017         input_argument_ fields.  Add them to constructor.  Change all
12018         callers.
12019         * script.cc: Include "target-select.h".
12020         (class Parser_closure): Add skip_on_incompatible_target_ and
12021         found_incompatible_target_ fields.  Add
12022         skip_on_incompatible_target parameter to constructor.  Change all
12023         callers.  Add methods skip_on_incompatible_target,
12024         clear_skip_on_incompatible_target, found_incompatible_target, and
12025         set_found_incompatible_target.
12026         (read_input_script): Add dirindex parameter.  Change all callers.
12027         If parser finds an incompatible target, requeue Read_symbols
12028         task.
12029         (script_set_symbol): Clear skip_on_incompatible_target in
12030         closure.
12031         (script_add_assertion, script_parse_option): Likewise.
12032         (script_start_sections, script_add_phdr): Likewise.
12033         (script_check_output_format): New function.
12034         * script.h (read_input_script): Update declaration.
12035         * script-c.h (script_check_output_format): Declare.
12036         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12037         (ignore_cmd): Remove OUTPUT_FORMAT.
12038         * fileread.cc (Input_file::Input_file): Add explicit this.
12039         (Input_file::will_search_for): New function.
12040         (Input_file::open): Add pindex parameter.  Change all callers.
12041         * fileread.h (class Input_file): Add input_file_argument method.
12042         Declare will_search_for.  Update declarations.
12043         * object.cc (make_elf_object): Add punconfigured parameter.
12044         Change all callers.
12045         * object.h (class Object): Make input_file public.  Add
12046         searched_for method.
12047         (make_elf_object): Update declaration.
12048         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12049         restart search.
12050         * dirsearch.h (class Dirsearch): Update declaration.
12051         * options.h (class General_options): Add --warn-search-mismatch.
12052         * parameters.cc (Parameters::is_compatible_target): New function.
12053         * parameters.h (class Parameters): Declare is_compatible_target.
12054         * workqueue.cc (Workqueue::add_blocker): New function.
12055         * workqueue.h (class Workqueue): Declare add_blocker.
12056
12057         * fileread.cc (Input_file::open): Remove options parameter.
12058         Change all callers.
12059         (Input_file::open_binary): Likewise.
12060         * script.cc (read_input_script): Likewise.
12061         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12062         options parameter from constructor.  Change all callers.
12063         (class Read_script): Likewise.
12064         * fileread.h (class Input_file): Update declarations.
12065         * script.h (read_input_script): Update declaration.
12066
12067 2009-03-10  Nick Clifton  <nickc@redhat.com>
12068
12069         * po/es.po: New Spanish translation.
12070
12071 2009-03-06  Cary Coutant  <ccoutant@google.com>
12072
12073         * options.cc (parse_short_option): Keep dash_z from registering itself.
12074
12075 2009-03-03  Ian Lance Taylor  <iant@google.com>
12076
12077         PR 9918
12078         * target-reloc.h (relocate_section): Pass output_section to
12079         relocate.
12080         * i386.cc (Target_i386::should_apply_static_reloc): Add
12081         output_section parameter.  Change all callers.
12082         (Target_i386::Relocate::relocate): Add output_section parameter.
12083         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12084         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12085         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12086         * testsuite/two_file_shared.sh: New script.
12087         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12088         (check_DATA): Add two_file_shared.dbg.
12089         (two_file_shared.dbg): New target.
12090         * testsuite/Makefile.in: Rebuild.
12091
12092 2009-03-01  Ian Lance Taylor  <iant@google.com>
12093
12094         * configure.ac: Check for byteswap.h.
12095         * configure: Rebuild.
12096         * config.in: Rebuild.
12097
12098 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12099
12100         * layout.cc (Layout::find_or_add_kept_section): New function.
12101         (Layout::add_comdat): Removed.
12102         * layout.h (struct Kept_section): Move out of class Layout.
12103         Remove trailing underscores from field names.  Add group_sections
12104         field.  Rename group_ field to is_group.  Change all uses.
12105         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12106         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12107         comdat_groups_ field.
12108         (Sized_relobj::include_section_group): Use
12109         find_or_add_kept_section and Kept_section::group_sections.
12110         (Sized_relobj::include_linkonce_section): Likewise.
12111         * object.cc (class Sized_relobj): Don't define Comdat_group or
12112         Comdat_group_table.  Remove find_comdat_group and
12113         add_comdat_group.  Remove comdat_groups_ field.
12114         * plugin.cc (include_comdat_group): Use
12115         Layout::find_or_add_kept_section.
12116
12117 2009-02-28  Ian Lance Taylor  <iant@google.com>
12118
12119         * README: --gc-sections and map files are now supported.  Document
12120         some build requirements.
12121
12122         PR 6992
12123         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12124         relocatable link set the value of the section symbol to zero.
12125         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12126         relocatable link don't include the section address in the local
12127         symbol value.
12128
12129 2009-02-27  Ian Lance Taylor  <iant@google.com>
12130
12131         PR 6811
12132         * options.h (class Search_directory): Add is_system_directory.
12133         (class General_options): Declare is_in_system_directory.
12134         * options.cc (get_relative_sysroot): Make static.
12135         (get_default_sysroot): Make static.
12136         (General_optoins::is_in_system_directory): New function.
12137         * fileread.cc (Input_file::is_in_system_directory): New function.
12138         * fileread.h (class Input_file): Declare is_in_system_directory.
12139         * object.h (class Object): Add is_in_system_directory.
12140         (class Input_objects): Remove system_library_directory_ field.
12141         * object.cc (Input_objects::add_object): Don't set
12142         system_library_directory_.
12143         (input_objects::found_in_system_library_directory): Remove.
12144         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12145         parameter.  Change all callers.
12146         (Symbol_table::sized_write_globals): Likewise.
12147         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12148         Call Object::is_in_system_directory.
12149         * symtab.h (class Symbol_table): Update declarations.
12150
12151         PR 5990
12152         * descriptors.h (Open_descriptor): Add is_on_stack field.
12153         * descriptors.cc (Descriptors::open): If the descriptor is on the
12154         top of the stack, remove it.  Initialize is_on_stack field.
12155         (Descriptors::release): Only add pod to stack if it is not on the
12156         stack already.
12157         (Descriptors::close_some_descriptor): Clear stack_next and
12158         is_on_stack fields.
12159
12160         PR 7091
12161         * output.cc (Output_section::find_starting_output_address): Rename
12162         from starting_output_address; add PADDR parameter; change return
12163         type.
12164         * output.h (class Output_section): Declare
12165         find_starting_output_address instead of starting_output_address.
12166         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12167         section symbol for which we can't find a merge section.
12168
12169         PR 9836
12170         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12171         hidden or internal, force the symbol to be local.
12172         * resolve.cc (Symbol::override_visibility): Define.
12173         (Symbol::override_base): Use override_visibility.
12174         (Symbol_table::resolve): Likewise.
12175         (Symbol::override_base_with_special): Likewise.
12176         (Symbol_table::override_with_special): If the visibility is hidden
12177         or internal, force the symbol to be local.
12178         * symtab.h (class Symbol): Add set_visibility and
12179         override_visibility.
12180         * testsuite/ver_test_1.sh: New file.
12181         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12182         (check_DATA): Add ver_test_1.syms.
12183         (ver_test_1.syms): New target.
12184         * testsuite/Makefile.in: Rebuild.
12185
12186 2009-02-25  Cary Coutant  <ccoutant@google.com>
12187
12188         * layout.cc (Layout::choose_output_section): Don't rename sections
12189         when using a linker script that has a SECTIONS clause.
12190         * Makefile.in: Regenerate.
12191
12192         * testsuite/Makefile.am (script_test_5.sh): New test case.
12193         * testsuite/Makefile.in: Regenerate.
12194         * testsuite/script_test_5.cc: New file.
12195         * testsuite/script_test_5.sh: New file.
12196         * testsuite/script_test_5.t: New file.
12197
12198 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12199
12200         * archive.cc (Archive::include_member): Update calls to add_symbols.
12201         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12202         the Layout argument.
12203         * dynobj.h (do_add_symbols): Add the Layout argument.
12204         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12205         Layout argument.
12206         * object.h (Object::add_symbols): Add the Layout argument.
12207         (Object::do_add_symbols): Add the Layout argument.
12208         (Sized_relobj::do_add_symbols): Add the Layout argument.
12209         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12210         Unify the two versions.
12211         (Add_plugin_symbols): Remove.
12212         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12213         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12214         (Add_plugin_symbols): Remove.
12215         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12216         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12217         (Add_symbols::run): Make it work with Pulginobj.
12218
12219 2009-02-06  Ian Lance Taylor  <iant@google.com>
12220
12221         * object.cc (Sized_relobj::do_layout): Make info message start
12222         with lower case letter.
12223
12224 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12225
12226         * binary.cc: Fix file comment.
12227
12228         * options.h (enum Incremental_disposition): Define.
12229         (class General_options): Add new options: --incremental,
12230         --incremental_changed, --incremental_unchanged,
12231         --incremental_unknown.  Add incremental_disposition_ and
12232         implicit_incremental_ fields.
12233         (General_options::incremental_disposition): New function.
12234         (class Position_dependent_options): Add incremental_disposition
12235         option.
12236         (Position_dependent_options::copy_from_options): Set incremental
12237         dispositions.
12238         * options.cc (General_options::parse_incremental_changed): New
12239         function.
12240         (General_options::parse_incremental_unchanged): New function.
12241         (General_options::parse_incremental_unknown): New function.
12242         (General_options::General_options): Initialize new fields
12243         incremental_disposition_ and implicit_incremental_.
12244         (General_options::finalize): Check for uasge of --incremental-*
12245         without --incremental.
12246
12247 2009-02-06  Chris Demetriou  <cgd@google.com>
12248
12249         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12250         pointer and to report location as the file name associated with
12251         the symbol.
12252         (gold_undefined_symbol_at_location): New function to replace the
12253         old gold_undefined_symbol functionality.
12254         * target-reloc.h (relocate_section): Update to use
12255         gold_undefined_symbol_at_location.
12256         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12257         Call gold_undefined_symbol function rather than gold_error.
12258         * errors.h (Errors::undefined_symbol): Take location as a
12259         string, rather than calculating it from a relocation.
12260         * errors.cc (Errors::fatal): Print "fatal error:" before the
12261         formatted message.
12262         (Errors::error, Errors::error_at_location): Print "error: "
12263         before the formatted message.
12264         (Errors::undefined_symbol): Take location as a string, rather
12265         than calculating it from a relocation.
12266         (gold_undefined_symbol_at_location): New function akin to
12267         old gold_undefined_symbol, calculates location from relocation.
12268         (gold_undefined_symbol): Change to take only a Symbol pointer
12269         and to report location as the file name associated with the symbol.
12270         * testsuite/debug_msg.sh: Update for changed error messages.
12271         * testsuite/undef_symbol.sh: Likewise.
12272
12273 2009-02-04  Duncan Sands  <baldrick@free.fr>
12274
12275         PR 9812
12276         * reduced_debug_output.h
12277         (Output_reduced_debug_abbrev_section::failed): Use format for
12278         gold_warning.
12279         (Output_reduced_debug_info_section::faild): Likewise.
12280
12281 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12282
12283         * script.cc (Lazy_demangler): New class.
12284         (Version_script_info::get_symbol_version_helper): Demangle a
12285         symbol only once.
12286
12287 2009-01-29  Cary Coutant  <ccoutant@google.com>
12288
12289         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12290         to __tls_get_addr.
12291         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12292
12293 2009-01-28  Ian Lance Taylor  <iant@google.com>
12294
12295         * version.cc (version_string): Bump to 1.9.
12296
12297         * gold.h: Include <cstring> and <stdint.h>.
12298         * version.cc: Include <cstdio>.
12299         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12300         warning.
12301         * reduced_debug_output.cc (insert_into_vector): Rename from
12302         Insert_into_vector; change all callers.  Use Swap_unaligned to
12303         avoid aliasing issue; remove union since it is unnecessary.
12304
12305 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12306
12307         * Makefile.am (CCFILES): Add gc.cc.
12308         (HFILES): Add gc.h.
12309         * Makefile.in: Regenerate.
12310         * gold.cc (Gc_runner): New class.
12311         (queue_initial_tasks): Call garbage collection related tasks
12312         when corresponding options are invoked.
12313         (queue_middle_gc_tasks): New function.
12314         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12315         processed early before laying out sections during garbage collection.
12316         * gold.h (queue_middle_gc_tasks): New function.
12317         (is_prefix_of): Move from "layout.cc".
12318         * i386.cc (Target_i386::gc_process_relocs): New function.
12319         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12320         * main.cc (main): Create object of class "Garbage_collection".
12321         * object.cc (Relobj::copy_symbols_data): New function.
12322         (Relobj::is_section_name_included): New function.
12323         (Sized_relobj::do_layout): Allow this function to be called twice
12324         during garbage collection and defer layout of section during the
12325         first call.
12326         * object.h (Relobj::get_symbols_data): New function.
12327         (Relobj::is_section_name_included): New function.
12328         (Relobj::copy_symbols_data): New function.
12329         (Relobj::set_symbols_data): New function.
12330         (Relobj::get_relocs_data): New function.
12331         (Relobj::set_relocs_data): New function.
12332         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12333         (Relobj::gc_process_relocs): New function.
12334         (Relobj::do_gc_process_relocs): New pure virtual function.
12335         (Relobj::sd_): New data member.
12336         (Sized_relobj::is_output_section_offset_invalid): New function.
12337         (Sized_relobj::do_gc_process_relocs): New function.
12338         * options.h (General_options::gc_sections): Modify to not be a no-op.
12339         (General_options::print_gc_sections): New option.
12340         * plugin.cc (Plugin_finish::run): Remove function call to
12341         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12342         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12343         * reloc.cc (Read_relocs::run): Add task to process relocs and
12344         determine unreferenced sections when doing garbage collection.
12345         (Gc_process_relocs): New class.
12346         (Sized_relobj::do_gc_process_relocs): New function.
12347         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12348         sections that are garbage collected.
12349         * reloc.h (Gc_process_relocs): New class.
12350         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12351         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12352         symbols whose corresponding sections are garbage collected.
12353         (Symbol_table::Symbol_table): Add new parameter for the garbage
12354         collection object.
12355         (Symbol_table::gc_mark_undef_symbols): New function.
12356         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12357         (Symbol_table::gc_mark_dyn_syms): New function.
12358         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12359         as garbage.
12360         (Symbol_table::add_from_object): Likewise.
12361         (Symbol_table::add_from_relobj): When building shared objects, do not
12362         treat externally visible symbols as garbage.
12363         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12364         table information for static and relocatable links.
12365         * symtab.h (Symbol_table::set_gc): New function.
12366         (Symbol_table::gc): New function.
12367         (Symbol_table::gc_mark_undef_symbols): New function.
12368         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12369         (Symbol_table::gc_mark_dyn_syms): New function.
12370         (Symbol_table::gc_): New data member.
12371         * target.h (Sized_target::gc_process_relocs): New pure virtual
12372         function.
12373         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12374         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12375
12376 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12377
12378         * options.h (General_options::gc_sections): Define as a no-op for now.
12379         (General_options::no_keep_memory): Ditto.
12380         (General_options::Bshareable): Define.
12381         * options.cc (General_options::finalize): Honor -Bshareable.
12382
12383 2009-01-20  Andreas Schwab  <schwab@suse.de>
12384
12385         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12386         read the value in the contents, since we don't use it.  Use the
12387         template endianness when writing.
12388         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12389
12390 2009-01-19  Andreas Schwab  <schwab@suse.de>
12391
12392         * configure.tgt (powerpc64-*): Fix targ_obj.
12393
12394 2009-01-15  Ian Lance Taylor  <iant@google.com>
12395
12396         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12397         local symbols when stripping all symbols.
12398
12399 2009-01-14  Cary Coutant  <ccoutant@google.com>
12400
12401         * output.cc (Output_reloc): Add explicit instantiations.
12402
12403 2009-01-14  Cary Coutant  <ccoutant@google.com>
12404
12405         * archive.cc (Archive::get_elf_object_for_member): Remove call
12406         to File_read::claim_for_plugin.
12407         * descriptors.cc (Descriptors::open): Remove reference to
12408         is_claimed.
12409         (Descriptors::claim_for_plugin): Remove.
12410         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12411         (Descriptors::is_claimed): Remove.
12412         (claim_descriptor_for_plugin): Remove.
12413         * fileread.cc (File_read::claim_for_plugin): Remove.
12414         * fileread.h (File_read::claim_for_plugin): Remove.
12415         (File_read::descriptor): Reopen descriptor if necessary.
12416         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12417         (Plugin_manager::all_symbols_read): Add task parameter. Change
12418         all callers.
12419         (Plugin_manager::get_input_file): New function.
12420         (Plugin_manager::release_input_file): New function.
12421         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12422         corresponding data member.
12423         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12424         and pass to base constructor. Change all callers.
12425         (get_input_file, release_input_file): New functions.
12426         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12427         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12428         (Plugin_manager::all_symbols_read): Add task parameter.
12429         (Plugin_manager::get_input_file): New function.
12430         (Plugin_manager::release_input_file): New function.
12431         (Plugin_manager::task_): New data member.
12432         (Pluginobj::Pluginobj): Add filesize parameter.
12433         (Pluginobj::filename): New function.
12434         (Pluginobj::descriptor): New function.
12435         (Pluginobj::filesize): New function.
12436         (Pluginobj::filesize_): New data member.
12437         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12438         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12439         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12440
12441         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12442         with archive libraries.
12443         * testsuite/Makefile.in: Regenerate.
12444         * testsuite/plugin_test.c (struct sym_info): New type.
12445         (get_input_file, release_input_file): New static variables.
12446         (onload): Capture new transfer vector entries.
12447         (claim_file_hook): Stop reading at end of file according to filesize.
12448         Factor out parsing of readelf output into separate function.
12449         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12450         APIs and get the source file name from the symbol table.  Convert
12451         source file name to corresponding object file name.  Print info
12452         message when adding new input files.
12453         (parse_readelf_line): New function.
12454         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12455         * testsuite/plugin_test_2.sh: Likewise.
12456         * testsuite/plugin_test_3.sh: Likewise.
12457         * testsuite/plugin_test_4.sh: New test case.
12458
12459 2009-01-07  Ian Lance Taylor  <iant@google.com>
12460
12461         * version.cc (version_string): Bump to 1.8.
12462
12463 2008-12-23  Cary Coutant  <ccoutant@google.com>
12464
12465         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12466         * plugin.cc (Plugin_manager::finish): Rename as
12467         layout_deferred_objects.  Move cleanup to separate function.
12468         (Plugin_manager::cleanup): New function.
12469         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12470         separately.
12471         * plugin.h (Plugin_manager::finish): Rename as
12472         layout_deferred_objects.
12473         (Plugin_manager::cleanup): New function.
12474         (Plugin_manager::cleanup_done): New field.
12475
12476 2008-12-23  Cary Coutant  <ccoutant@google.com>
12477
12478         * plugin.cc (is_visible_from_outside): New function.
12479         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12480         so we don't return "IR only" status for exported symbols or -r links.
12481
12482         * testsuite/Makefile.am (plugin_test_3): New test case.
12483         * testsuite/Makefile.in: Regenerate.
12484         * testsuite/plugin_test_3.sh: New file.
12485
12486 2008-12-22  Cary Coutant  <ccoutant@google.com>
12487
12488         * object.cc (Sized_relobj::layout_section): New function.
12489         (Sized_relobj::do_layout): Defer layout of input sections until after
12490         plugin has provided replacement files.
12491         (Sized_relobj::do_layout_deferred_sections): New function.
12492         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12493         (Relobj::layout_deferred_sections): New function.
12494         (Relobj::do_layout_deferred_sections): New function.
12495         (Sized_relobj::do_layout_deferred_sections): New function.
12496         (Sized_relobj::layout_section): New function.
12497         (Sized_relobj::Deferred_layout): New structure.
12498         (Sized_relobj::deferred_layout_): New field.
12499         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12500         Change all callers.  Layout deferred sections.
12501         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12502         references.
12503         (Plugin_hook::run): Move code from do_plugin_hook inline.
12504         (Plugin_hook::do_plugin_hook): Remove.
12505         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12506         (Plugin_manager::finish): Renamed, was cleanup.
12507         (Plugin_manager::should_defer_layout): New function.
12508         (Plugin_manager::add_deferred_layout_object): New function.
12509         (Plugin_manager::Deferred_layout_list): New type.
12510         (Plugin_manager::deferred_layout_objects_): New field.
12511         (Plugin_hook::do_plugin_hook): Remove.
12512
12513 2008-12-17  Ian Lance Taylor  <iant@google.com>
12514
12515         * options.h (class General_options): Add --no case for
12516         --export-dynamic.
12517
12518 2008-12-16  Cary Coutant  <ccoutant@google.com>
12519
12520         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12521         vector.
12522         (Plugin_manager::claim_file): Create plugin object even if
12523         plugin did not call the add_symbols callback.
12524         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12525         asking for more symbols than were added.
12526         * testsuite/Makefile.am (plugin_test_1): Add test case with
12527         no global symbols.
12528         (empty.syms): New target.
12529         * testsuite/Makefile.in: Regenerate.
12530         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12531         message. Don't call add_symbols if no globals.
12532         (all_symbols_read_hook): Don't provide replacement for empty
12533         claimed file.
12534
12535 2008-12-12  Ian Lance Taylor  <iant@google.com>
12536
12537         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12538         r_type == 0 for a local symbol with r_sym == 0.
12539         (scan_relocatable_relocs): Pass r_sym to
12540         local_non_section_strategy.
12541         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12542         r_sym parameter.
12543
12544         * configure.ac: Update test for TLS descriptors: they are
12545         supported as of glibc 2.9.
12546         * configure: Rebuild.
12547
12548 2008-12-11  Ian Lance Taylor  <iant@google.com>
12549
12550         PR 7091
12551         * target-reloc.h (Default_scan_relocatable_relocs): For each
12552         function, map r_type == 0 to RELOC_DISCARD.
12553
12554 2008-12-10  Cary Coutant  <ccoutant@google.com>
12555
12556         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12557         object to override a kept COMDAT group from a plugin object.
12558
12559 2008-12-09  Ian Lance Taylor  <iant@google.com>
12560
12561         PR 7088
12562         * yyscript.y (file_cmd): Handle INPUT.
12563
12564         * testsuite/initpri1.c: Change all declarations to be full
12565         prototypes by adding void, to avoid compiler warnings.
12566
12567 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12568
12569         * options.cc (General_options::parse_plugin_opt): New.
12570         (General_options::add_plugin): The argument now is just the filename.
12571         (General_options::add_plugin_option): New.
12572         * options.h (plugin_opt): New.
12573         (add_plugin): Change argument name.
12574         (add_plugin_option): New.
12575         * plugin.cc (Plugin::load): Don't parse the plugin option.
12576         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12577         (Plugin::add_option): New.
12578         (Plugin::args_): Change type.
12579         (Plugin::filename_): New.
12580         (Plugin_manager::add_plugin_option): New.
12581         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12582         * testsuite/Makefile.in: Regenerate.
12583
12584 2008-12-05  Cary Coutant  <ccoutant@google.com>
12585
12586         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12587         Handle --strip-lto-sections option.
12588         * options.h (strip_lto_sections): New option.
12589
12590 2008-12-01  Cary Coutant  <ccoutant@google.com>
12591
12592         * plugin.cc (ld_plugin_message): Change format parameter to const.
12593         Fix mismatch between new[] and delete.
12594
12595 2008-11-14  Cary Coutant  <ccoutant@google.com>
12596
12597         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12598         instead of -1U.
12599
12600 2008-11-05  Craig Silverstein  <csilvers@google.com>
12601
12602         * options.cc (General_options::parse_dynamic_list): New function.
12603         * options.h (General_options): New flags dynamic_list,
12604         dynamic_list_data, dynamic_list_cpp_new, and
12605         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12606         (General_options::in_dynamic_list): New function.
12607         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12608         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12609         (Lex::can_continue_name): Likewise.
12610         (yylex): Likewise.
12611         (read_script_file): New parameter script_options.
12612         (read_dynamic_list): New function.
12613         (Script_options::define_dynamic_list): New function.
12614         (dynamic_list_keyword_parsecodes): New variable.
12615         (dynamic_list_keywords): New variable.
12616         * script.h (Script_options::define_dynamic_list): New function
12617         prototype.
12618         (read_dynamic_list): New function prototype.
12619         * symtab.cc (strprefix): New macro.
12620         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12621         dynamic_list_data, dynamic_list_cpp_new, and
12622         dynamic_list_cpp_typeinfo.
12623         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12624         (dynamic_list_expr): New rule.
12625         (dynamic_list_nodes): Likewise.
12626         (dynamic_list_node): Likewise.
12627         * testsuite/Makefile.am (dynamic_list): New test.
12628         * testsuite/Makefile.in: Regenerated.
12629         * testsuite/dynamic_list.t: New file.
12630         * testsuite/dynamic_list.sh: New file.
12631
12632 2008-11-05  Craig Silverstein  <csilvers@google.com>
12633
12634         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12635         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12636         (t11_last): Likewise.
12637         * testsuite/ver_test_6.c (main): Likewise.
12638
12639 2008-10-07  Cary Coutant  <ccoutant@google.com>
12640
12641         * options.c (General_options::finalize): Add check for -static and
12642         -shared.
12643         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12644         is not empty.
12645
12646 2008-10-02  Cary Coutant  <ccoutant@google.com>
12647
12648         * plugin.cc (make_sized_plugin_object): Fix conditional
12649         compilation to work when not all targets are enabled.
12650
12651 2008-09-29  Cary Coutant  <ccoutant@google.com>
12652
12653         * archive.cc (Archive::get_file_and_offset): Use filename instead
12654         of name to get library path.
12655         (Archive::include_member): Unlock external member of a thin archive.
12656
12657         * testsuite/Makefile.am (TEST_AR): New variable.
12658         (thin_archive_test_1): New test.
12659         (thin_archive_test_2): New test.
12660         * testsuite/Makefile.in: Regenerate.
12661         * testsuite/thin_archive_main.cc: New file.
12662         * testsuite/thin_archive_test_1.cc: New file.
12663         * testsuite/thin_archive_test_2.cc: New file.
12664         * testsuite/thin_archive_test_3.cc: New file.
12665         * testsuite/thin_archive_test_4.cc: New file.
12666
12667 2008-09-29  Cary Coutant  <ccoutant@google.com>
12668
12669         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12670         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12671         instead of -1U.
12672         (Sized_relobj::do_finalize_local_symbols): Likewise.
12673         (Sized_relobj::map_to_kept_section): Likewise.
12674         * object.h (Sized_relobj::invalid_address): New constant.
12675         (Sized_relobj::do_output_section_offset): Check for invalid_address
12676         and return -1ULL.
12677         * output.cc (Output_reloc::local_section_offset): Use constant
12678         invalid_address instead of -1U.
12679         (Output_reloc::get_address): Likewise.
12680         (Output_section::output_address): Change -1U to -1ULL.
12681         * output.h (Output_reloc::invalid_address): New constant.
12682         * reloc.cc (Sized_relobj::write_sections): Use constant
12683         invalid_address instead of -1U.
12684         (Sized_relobj::relocate_sections): Likewise.
12685         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12686         values for merge sections.
12687         * target-reloc.h (relocate_for_relocatable): Use constant
12688         invalid_address instead of -1U.
12689
12690 2008-09-19  Cary Coutant  <ccoutant@google.com>
12691
12692         Add plugin functionality for link-time optimization (LTO).
12693         * configure.ac (plugins): Add --enable-plugins option.
12694         * configure: Regenerate.
12695         * config.in: Regenerate.
12696         * Makefile.am (LIBDL): New variable.
12697         (CCFILES): Add plugin.cc.
12698         (HFILES): Add plugin.h.
12699         (ldadd_var): Add LIBDL.
12700         * Makefile.in: Regenerate.
12701
12702         * archive.cc: Include "plugin.h".
12703         (Archive::setup): Don't preread archive symbols when using a plugin.
12704         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12705         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12706         files.
12707         (Archive::include_member): Add symbols from plugin objects.
12708         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12709         * descriptors.cc (Descriptors::open): Check for file descriptors
12710         abandoned by plugins.
12711         (Descriptors::claim_for_plugin): New function.
12712         * descriptors.h (Descriptors::claim_for_plugin): New function.
12713         (Open_descriptor::is_claimed): New field.
12714         (claim_descriptor_for_plugin): New function.
12715         * fileread.cc (File_read::claim_for_plugin): New function.
12716         * fileread.h (File_read::claim_for_plugin): New function.
12717         (File_read::descriptor): New function.
12718         * gold.cc: Include "plugin.h".
12719         (queue_initial_tasks): Add task to call plugin hooks for generating
12720         new object files.
12721         * main.cc: Include "plugin.h".
12722         (main): Load plugin libraries.
12723         * object.h (Pluginobj): Declare.
12724         (Object::pluginobj): New function.
12725         (Object::do_pluginobj): New function.
12726         (Object::set_target): New function.
12727         * options.cc: Include "plugin.h".
12728         (General_options::parse_plugin): New function.
12729         (General_options::General_options): Initialize plugins_ field.
12730         (General_options::add_plugin): New function.
12731         * options.h (Plugin_manager): Declare.
12732         (General_options): Add --plugin option.
12733         (General_options::has_plugins): New function.
12734         (General_options::plugins): New function.
12735         (General_options::add_plugin): New function.
12736         (General_options::plugins_): New field.
12737         * plugin.cc: New file.
12738         * plugin.h: New file.
12739         * readsyms.cc: Include "plugin.h".
12740         (Read_symbols::do_read_symbols): Check for archive before checking
12741         for ELF file.  Call plugin hooks to claim files.
12742         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12743         from a real object file; force override when processing replacement
12744         files.
12745         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12746         (Symbol::init_base_object): Likewise.
12747         (Symbol::init_base_output_data): Likewise.
12748         (Symbol::init_base_output_segment): Likewise.
12749         (Symbol::init_base_constant): Likewise.
12750         (Symbol::init_base_undefined): Likewise.
12751         (Symbol::output_section): Assert that object is not a plugin.
12752         (Symbol_table::add_from_pluginobj): New function.
12753         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12754         undefined.
12755         (Symbol_table::sized_write_globals): Likewise.
12756         (Symbol_table::add_from_pluginobj): Instantiate template.
12757         * symtab.h (Sized_pluginobj): Declare.
12758         (Symbol::in_real_elf): New function.
12759         (Symbol::set_in_real_elf): New function.
12760         (Symbol::in_real_elf_): New field.
12761         (Symbol_table::add_from_pluginobj): New function.
12762
12763         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12764         (LIBDL): New variable.
12765         (LDADD): Add LIBDL.
12766         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12767         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12768         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12769         (MOSTLYCLEANFILES): Likewise.
12770         * testsuite/Makefile.in: Regenerate.
12771         * testsuite/plugin_test.c: New file.
12772         * testsuite/plugin_test_1.sh: New file.
12773         * testsuite/plugin_test_2.sh: New file.
12774
12775 2008-09-16  Ian Lance Taylor  <iant@google.com>
12776
12777         * target-reloc.h (relocate_section): Check whether a symbol is
12778         defined by the ABI before reporting an undefined symbol error.
12779         * target.h (Target::is_defined_by_abi): Make parameter const.
12780         (Target::do_is_defined_by_abi): Likewise.
12781         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12782         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12783         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12784         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12785         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12786         * testsuite/Makefile.in: Rebuild.
12787
12788         * fileread.cc (make_view): Add casts to avoid warning.
12789
12790 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12791
12792         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12793         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12794
12795 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12796
12797         * options.h (General_options::output_is_executable): New.
12798         (General_options::output_is_pie): New.
12799         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12800         for shared libraries.
12801         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12802
12803 2008-09-11  Chris Demetriou  <cgd@google.com>
12804
12805         * options.h (origin): New -z option.
12806         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12807         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12808         in DT_FLAGS_1.
12809
12810 2008-09-05  Cary Coutant  <ccoutant@google.com>
12811
12812         * fileread.cc (File_read::make_view): Add check for attempt to map
12813         beyond end of file.
12814
12815 2008-09-05  Cary Coutant  <ccoutant@google.com>
12816
12817         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12818         explicit instantiations.
12819
12820 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12821
12822         PR gold/6858
12823         * options.cc (General_options::finalize): Allow undefined symbols
12824         in shlibs if linking -shared.
12825
12826         PR gold/6859
12827         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12828         symbols as not needing a dynsym entry.
12829
12830 2008-08-20  Craig Silverstein  <csilvers@google.com>
12831
12832         * fileread.cc (File_read::open): Do not lock the file unless it
12833         was successfully opened.
12834
12835 2008-08-14  Cary Coutant  <ccoutant@google.com>
12836
12837         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12838         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12839         * testsuite/tls_test.cc (struct int128): 128-bit struct
12840         for testing TLS relocs with non-zero addend.
12841         (v12): New TLS variable.
12842         (t12): New test.
12843         (t_last): Add check for v12.
12844         * testsuite/tls_test.h (t12): New function.
12845         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12846
12847 2008-08-13  Ian Lance Taylor  <iant@google.com>
12848
12849         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12850         set tls_segment_ or relro_segment_.
12851         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12852         when appropriate.
12853         * output.h (Output_section::clear_is_relro): New function.
12854         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12855         sections specially even when output_data_ is empty.
12856         (Output_segment::maximum_alignment): When first section is relro,
12857         only force alignment for PT_LOAD segments.
12858         * script.cc (script_data_segment_align): New function.
12859         (script_data_segment_relro_end): New function.
12860         * script-c.h (script_data_segment_align): Declare.
12861         (script_data_segment_relro_end): Declare.
12862         * script-sections.h (class Script_sections): Declare
12863         data_segment_align and data_segment_relro_end.  Add fields
12864         segment_align_index_ and saw_relro_end_.
12865         * script-sections.cc (class Sections_element): Add set_is_relro
12866         virtual function.  Add new bool* parameter to place_orphan_here.
12867         Add get_output_section virtual function.
12868         (class Output_section_definition): Add set_is_relro.  Add new
12869         bool* parameter to place_orphan_here.  Add get_output_section.
12870         Add is_relro_ field.
12871         (Output_section_definition::Output_section_definition): Initialize
12872         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12873         and is_relro_ fields.
12874         (Output_section_definition::place_orphan_here): Add is_relro
12875         parameter.
12876         (Output_section_definition::set_section_addresses): Set relro for
12877         output section.
12878         (Output_section_definition::alternate_constraint): Likewise.
12879         (class Orphan_output_section): Add new bool* parameter to
12880         place_orphan_here.  Add get_output_section.
12881         (Orphan_output_section::place_orphan_here): Add is_relro
12882         parameter.
12883         (Script_sections::Script_sections): Initialize
12884         data_segment_align_index_ and saw_relro_end_.
12885         (Script_sections::data_segment_align): New function.
12886         (Script_sections::data_segment_relro_end): New function.
12887         (Script_sections::place_orphan): Set or clear is_relro.
12888         (Script_sections::set_section_addresses): Force alignment of first
12889         TLS section.
12890         * yyscript.y (exp): Call script_data_segment_align and
12891         script_data_segment_relro_end.
12892         * testsuite/relro_script_test.t: New file.
12893         * testsuite/relro_test.cc (using_script): Declare.
12894         (t1, t2): Test using_script.
12895         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12896         (relro_script_test_SOURCES): Define.
12897         (relro_script_test_DEPENDENCIES): Define.
12898         (relro_script_test_LDFLAGS): Define.
12899         (relro_script_test_LDADD): Define.
12900         (relro_script_test.so): New target.
12901         * testsuite/Makefile.in: Rebuild.
12902
12903 2008-08-06  Cary Coutant <ccoutant@google.com>
12904
12905         * archive.cc (Archive::total_archives, Archive::total_members)
12906         (Archive::total_members_loaded): New variables.
12907         (Archive::setup): Add parameter.  Add option to preread
12908         archive symbols.
12909         (Archive::read_armap): Add counter.
12910         (Archive::get_file_and_offset): New function.
12911         (Archive::get_elf_object_for_member): New function.
12912         (Archive::read_all_symbols): New function.
12913         (Archive::read_symbols): New function.
12914         (Archive::add_symbols): Add counters.
12915         (Archive::include_all_members): Use armap to find members if it's
12916         already built.
12917         (Archive::include_member): Skip reading symbols if already read.
12918         Factored code into Archive::get_file_and_offset and
12919         Archive::get_elf_object_for_member.  Changed call to
12920         Mapfile::report_include_archive_member.
12921         (Archive::print_stats): New function.
12922         * archive.h: Declare Object and Read_symbols_data classes.
12923         (Archive::Archive): Add initializers for new members.
12924         (Archive::setup): Add parameter.
12925         (Archive::print_stats): New function.
12926         (Archive::total_archives, Archive::total_members)
12927         (Archive::total_members_loaded): New variables.
12928         (Archive::get_file_and_offset): New function.
12929         (Archive::get_elf_object_for_member): New function.
12930         (Archive::read_all_symbols): New function.
12931         (Archive::read_symbols): New function.
12932         (Archive::Archive_member): New class.
12933         (Archive::members_): New member.
12934         (Archive::num_members_): New member.
12935         * main.cc: Include archive.h.
12936         (main): Call Archive::print_stats.
12937         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12938         archive parameter; member_name is now the fully-decorated name.
12939         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12940         * options.h: (General_options): Add --preread-archive-symbols option.
12941         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12942         Archive::setup.
12943
12944 2008-08-04  Ian Lance Taylor  <iant@google.com>
12945
12946         * symtab.h (Symbol::use_plt_offset): New function.
12947         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12948         * powerpc.cc (Relocate::relocate): Likewise.
12949         * sparc.cc (Relocate::relocate): Likewise.
12950         * x86_64.cc (Relocate::relocate): Likewise.
12951         * testsuite/weak_plt.sh: New test.
12952         * testsuite/weak_plt_main.cc: New test.
12953         * testsuite/weak_plt_shared.cc: New test.
12954         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12955         (check_PROGRAMS): Add weak_plt.
12956         (check_DATA): Add weak_plt_shared.so.
12957         (weak_plt_main_pic.o, weak_plt): New targets.
12958         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12959         * testsuite/Makefile.in: Rebuild.
12960
12961         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12962         gcctestdir/ld.
12963         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12964         * testsuite/Makefile.in: Rebuild.
12965
12966 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12967
12968         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12969         * Makefile.in: Regenerate.
12970         * po/POTFILES.in: Regenerate.
12971
12972 2008-07-29  Ian Lance Taylor  <iant@google.com>
12973
12974         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12975         symbols before other symbols.
12976         * testsuite/script_test_2.cc (test_addr): Declare.
12977         (test_addr_alias): Declare.
12978         (main): Check that test_addr and test_addr_alias have the right
12979         values.
12980         * testsuite/script_test_2.t: Define test_addr_alias and
12981         test_addr.
12982
12983 2008-07-24  Ian Lance Taylor  <iant@google.com>
12984
12985         PR 5990
12986         * descriptors.cc: New file.
12987         * descriptors.h: New file.
12988         * gold-threads.h (class Hold_optional_lock): New class.
12989         * fileread.cc: Include "descriptors.h".
12990         (File_read::~File_read): Release descriptor rather than closing
12991         it.
12992         (File_read::open) [file]: Call open_descriptor rather than open.
12993         Set is_descriptor_opened_.
12994         (File_read::open) [memory]: Assert that descriptor is not open.
12995         (File_read::reopen_descriptor): New function.
12996         (File_read::release): Release descriptor.
12997         (File_read::do_read): Make non-const.  Reopen descriptor.
12998         (File_read::read): Make non-const.
12999         (File_read::make_view): Reopen descriptor.
13000         (File_read::do_readv): Likewise.
13001         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13002         Update declarations.
13003         * layout.cc: Include "descriptors.h".
13004         (Layout::create_build_id): Use open_descriptor rather than open.
13005         * output.cc: Include "descriptors.h".
13006         (Output_file::open): Use open_descriptor rather than open.
13007         * archive.cc (Archive::const_iterator): Change Archive to be
13008         non-const.
13009         (Archive::begin, Archive::end): Make non-const.
13010         (Archive::count_members): Likewise.
13011         * archive.h (class Archive): Update declarations.
13012         * object.h (Object::read): Make non-const.
13013         * Makefile.am (CCFILES): Add descriptors.cc.
13014         (HFILES): Add descriptors.h.
13015         * Makefile.in: Rebuild.
13016
13017         PR 6716
13018         * gold.h: Always include <clocale>.  Add Solaris workarounds
13019         following code in binutils/sysdep.h.
13020
13021         PR 6048
13022         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13023         this->eh_frame_hdr_ is NULL before using it.
13024
13025         * dynobj.cc (Versions::Versions): Update comment.
13026
13027         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13028         the base version name.
13029
13030         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13031         array size plus one.
13032         (Stringpool_template::set_string_offsets): Subtract one from key
13033         before using it as an array index.
13034         (Stringpool_template::get_offset_with_length): Likewise.
13035         (Stringpool_template::write_to_buffer): Likewise.
13036         * stringpool.h (Stringpool_template::get_offset_from_key):
13037         Likewise.
13038
13039 2008-07-23  Ian Lance Taylor  <iant@google.com>
13040
13041         PR 6658
13042         * object.h (Merged_symbol_value::value): Do our best to handle a
13043         negative addend.
13044
13045         PR 6647
13046         * script.cc (Version_script_info::get_versions): Don't add empty
13047         version tag to return value.
13048         (Version_script_info::get_symbol_version_helper): Change return
13049         type to bool.  Add pversion parameter.  Change all callers.
13050         (script_register_vers_node): Don't require a non-NULL tag.
13051         * script.h (class Version_script_info): Update declarations.
13052         (Version_script_info::get_symbol_version): Change return type to
13053         bool.  Add version parameter.  Change all callers.
13054         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13055         handling.  Handle an empty version from a version script.
13056         (Symbol_table::define_special_symbol): Likewise.
13057         * testsuite/ver_test_10.script: New file.
13058         * testsuite/ver_test_10.sh: New file.
13059         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13060         (check_DATA): Add ver_test_10.syms.
13061         (ver_test_10.syms, ver_test_10.so): New target.
13062         * testsuite/Makefile.in: Rebuild.
13063
13064 2008-07-23  Simon Baldwin  <simonb@google.com>
13065
13066         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13067         to zero for undefined symbols from dynamic libraries.
13068
13069 2008-07-23  Ian Lance Taylor  <iant@google.com>
13070
13071         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13072         Change all callers.
13073         * symtab.h (class Symbol_table): Update declaration.
13074         * testsuite/ver_test_9.cc: New file.
13075         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13076         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13077         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13078         (ver_test_9.so, ver_test_9.o): New targets.
13079         * testsuite/Makefile.in: Rebuild.
13080
13081 2008-07-22  Ian Lance Taylor  <iant@google.com>
13082
13083         * options.h (class General_options): Define --check-sections.
13084         * layout.cc (Layout::set_segment_offsets): Handle
13085         --check-sections.
13086
13087         * options.h (class General_options): Define -n/--nmagic and
13088         -N/--omagic.
13089         * options.cc (General_options::finalize): For -n/--nmagic or
13090         -N/--omagic, set -static.
13091         * layout.cc (Layout::attach_allocated_section_to_segment): If
13092         -N/--omagic, don't put read-only and read-write sections in
13093         different segments.
13094         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13095         finding a read-only segment.
13096         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13097         don't set the minimum segment alignment to the common page size,
13098         and don't set the file offset to the address modulo the page size.
13099         * script-sections.cc (Script_sections::create_segments): If
13100         -n/--omagic, don't put read-only and read-write sections in
13101         different segments.
13102
13103         * cref.cc: New file.
13104         * cref.h: New file.
13105         * options.h (class General_options): Add --print-symbol-counts.
13106         * main.cc (main): Issue defined symbol report if requested.
13107         * archive.cc (Archive::interpret_header): Make into a const member
13108         function.
13109         (Archive::add_symbols): Call Input_objects::archive_start and
13110         archive_stop.
13111         (Archive::const_iterator): Define new class.
13112         (Archive::begin, Archive::end): New functions.
13113         (Archive::include_all_members): Rewrite to use iterator.
13114         (Archive::count_members): New function.
13115         * archive.h (class Archive): Update declarations.
13116         (Archive::filename): New function.
13117         * object.cc: Include "cref.h".
13118         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13119         (Sized_relobj::do_get_global_symbol_counts): New function.
13120         (Input_objects::add_object): Add object to cross-referencer.
13121         (Input_objects::archive_start): New function.
13122         (Input_objects::archive_stop): New function.
13123         (Input_objects::print_symbol_counts): New function.
13124         * object.h: Declare Cref and Archive.
13125         (Object::get_global_symbol_counts): New function.
13126         (Object::do_get_global_symbol_counts): New pure virtual function.
13127         (class Sized_relobj): Add defined_count_ field.  Update
13128         declarations.
13129         (class Input_objects): Add cref_ field.  Update constructor.
13130         Update declarations.
13131         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13132         defined_count_.
13133         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13134         symbol counts.
13135         (Sized_dynobj::do_get_global_symbol_counts): New function.
13136         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13137         defined_count_.  Update declarations.  Define Symbols typedef.
13138         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13139         parameter.  Change all callers.
13140         (Symbol_table::add_from_dynobj): Add sympointers and defined
13141         parameters.  Change all callers.
13142         * symtab.h (class Symbol_table): Update declarations.
13143         * Makefile.am (CCFILES): Add cref.cc.
13144         (HFILES): Add cref.h.
13145         * Makefile.in: Rebuild.
13146
13147 2008-07-22  Simon Baldwin  <simonb@google.com>
13148
13149         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13150         to zero when writing undefined symbols.
13151
13152 2008-07-22  Ian Lance Taylor  <iant@google.com>
13153
13154         * output.cc (Output_section::add_input_section): Don't try to
13155         merge empty merge sections.
13156
13157 2008-07-21  Craig Silverstein  <csilvers@google.com>
13158
13159         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13160         Include symbol version in error message.
13161
13162 2008-07-20  Chris Demetriou  <cgd@google.com>
13163
13164         * configure.ac (gold_cv_c_random_seed): New configured variable.
13165         (RANDOM_SEED_CFLAGS): New substituted variable.
13166         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13167         * configure: Rebuild.
13168         * Makefile.in: Likewise.
13169         * testsuite/Makefile.in: Likewise.
13170
13171 2008-07-18  Ian Lance Taylor  <iant@google.com>
13172
13173         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13174         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13175         * testsuite/ver_test_main.cc (main): Call t4.
13176         (t4, t4_2a): Define.
13177         * testsuite/ver_test_2.cc (t4_2): Define.
13178         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13179         * testsuite/ver_test_4.cc (t4_2a): Define.
13180         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13181         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13182
13183 2008-07-17  Ian Lance Taylor  <iant@google.com>
13184
13185         * dynobj.cc (Versions::add_def): If we give an error about a
13186         missing version, go ahead and create the version anyhow.
13187
13188 2008-07-10  Ian Lance Taylor  <iant@google.com>
13189
13190         Handle output sections with more than 0x7fffffff bytes.
13191         * object.h (class Relobj): Change map_to_output_ to
13192         output_sections_, and just keep a section pointer.  Change all
13193         uses.  Move comdat group support to Sized_relobj.
13194         (Relobj::is_section_specially_mapped): Remove.
13195         (Relobj::output_section): Remove poff parameter.  Change all
13196         callers.
13197         (Relobj::output_section_offset): New function.
13198         (Relobj::set_section_offset): Rewrite.
13199         (Relobj::map_to_output): Remove.
13200         (Relobj::output_sections): New function.
13201         (Relobj::do_output_section_offset): New pure virtual function.
13202         (Relobj::do_set_section_offset): Likewise.
13203         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13204         group support from Relobj.  Update declarations.
13205         (Sized_relobj::get_output_section_offset): New function.
13206         (Sized_relobj::do_output_section_offset): New function.
13207         (Sized_relobj::do_set_section_offset): New function.
13208         * object.cc (Relobj::output_section_address): Remove.
13209         (Sized_relobj::Sized_relobj): Initialize new fields.
13210         (Sized_relobj::include_section_group): Cast find_kept_object to
13211         Sized_relobj.
13212         (Sized_relobj::include_linkonce_section): Likewise.
13213         (Sized_relobj::do_layout): Use separate arrays for output section
13214         and output offset.
13215         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13216         output_sections.
13217         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13218         output_sections and section_offsets.
13219         (Sized_relobj::write_local_symbols): Likewise.
13220         (map_to_kept_section): Compute output address directly.
13221         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13222         output_sections and section_offsets.
13223         (Sized_relobj::write_sections): Likewise.
13224         (Sized_relobj::relocate_sections): Likewise.
13225         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13226         * output.h (class Output_reloc): Update declarations.  Change
13227         u2_.relobj to Sized_relobj*.
13228         (class Output_data_reloc): Change add functions to use
13229         Sized_relobj*.
13230         * output.cc (Output_reloc::Output_reloc): Change relobj to
13231         Sized_relobj*.
13232         (Output_reloc::local_section_offset): Change return type to
13233         Elf_Addr.  Use get_output_section_offset.
13234         (Output_reloc::get_address): Likewise.
13235         (Output_section::is_input_address_mapped): Don't call
13236         is_section_specially_mapped.
13237         (Output_section::output_offset): Likewise.
13238         (Output_section::output_address): Likewise.
13239         (Output_section::starting_output_address): Likewise.
13240         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13241         parameter to Sized_relobj*.
13242         (Copy_relocs::need_copy_reloc): Likewise.
13243         (Copy_relocs::save): Likewise.
13244         * copy-relocs.h (class Copy_relocs): Update declarations.
13245         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13246         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13247         * target-reloc.h (relocate_for_relocatable): Change
13248         offset_in_output_section type to Elf_Addr.  Change code that uses
13249         it as well.
13250         * layout.cc (Layout::layout): Always set *off.
13251         * mapfile.cc (Mapfile::print_input_section): Use
13252         output_section_offset.
13253         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13254         Sized_relobj*.
13255         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13256         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13257         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13258
13259 2008-07-03  Ian Lance Taylor  <iant@google.com>
13260
13261         * layout.cc (Layout::include_section): Do not discard unrecognized
13262         SHT_STRTAB sections.
13263
13264 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13265
13266         * script.cc (Lex::can_continue_name): Make '?' allowable in
13267         version-script names.
13268         * testsuite/version_script.map: Change glob pattern to use '?'
13269
13270 2008-06-30  Manish Singh  <yosh@gimp.org>
13271
13272         PR 6585
13273         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13274         Correct typo.
13275
13276 2008-06-30  Ian Lance Taylor  <iant@google.com>
13277
13278         PR 6660
13279         PR 6682
13280         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13281         versions]: Don't try to read the value in the contents, since we
13282         don't use it.  Use the template endianness when writing.
13283
13284 2008-06-25  Cary Coutant  <ccoutant@google.com>
13285
13286         * fileread.cc (File_read::make_view): Assert on zero-length view.
13287         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13288         symbol table when there are no symbols to read.
13289
13290 2008-06-23  Craig Silverstein  <csilvers@google.com>
13291
13292         * version.cc (version_string): Bump to 1.7
13293
13294 2008-06-18  Craig Silverstein  <csilvers@google.com>
13295
13296         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13297         constant 0xFFFF to type Valtype.
13298         (Powerpc_relocate_functions::rel16_ha): Likewise.
13299
13300 2008-06-17  Ian Lance Taylor  <iant@google.com>
13301
13302         * output.h (Output_section::Input_section): Initialize p2align_ to
13303         zero for Output_section_data constructors.
13304         (Output_section::Input_section::addralign): If not an input
13305         section, return the alignment of the Output_section_data.
13306         * testsuite/copy_test.cc: New file.
13307         * testsuite/copy_test_1.cc: New file.
13308         * testsuite/copy_test_2.cc: New file.
13309         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13310         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13311         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13312         (copy_test_1_pic.o, copy_test_1.so): New targets.
13313         (copy_test_2_pic.o, copy_test_2.so): New targets.
13314         * testsuite/Makefile.in: Rebuild.
13315
13316         * script-sections.cc (Script_sections::place_orphan): Initialize
13317         local variable exact.
13318
13319 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13320
13321         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13322
13323 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13324             David S. Miller  <davem@davemloft.net>
13325
13326         * powerpc.cc: New file.
13327         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13328         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13329         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13330         * Makefile.in: Rebuild.
13331
13332 2008-06-09  Ian Lance Taylor  <iant@google.com>
13333
13334         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13335         <exception>.
13336         (throwing, orig_terminate): New static variables.
13337         (terminate_handler): New static function.
13338         (t2): Set terminate handler.
13339
13340 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13341
13342         PR 6584
13343         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13344         alignment.
13345
13346 2008-05-30  Cary Coutant  <ccoutant@google.com>
13347
13348         * archive.cc (Archive::include_all_members) Correct to step
13349         over symbol table and extended name table in thin archives.
13350
13351 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13352
13353         PR 6407
13354         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13355         calculation.
13356
13357 2008-05-28  Caleb Howe  <cshowe@google.com>
13358
13359         * reduced_debug_output.cc: New file.
13360         * reduced_debug_output.h: New file.
13361         * options.h (class General_options): Add --strip-debug-non-line.
13362         * options.cc (General_options::finalize): Add strip_debug_non_line
13363         to the strip heirarchy.
13364         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13365         fields.
13366         * layout.cc: Include "reduced_debug_output.h".
13367         (Layout::Layout): Initialize new fields.
13368         (line_only_debug_sections): New static array.
13369         (is_lines_only_debug_sections): New static inline function.
13370         (Layout::include_section): Handle --strip-debug-non-line.
13371         (Layout::make_output_section): If --strip-debug-non-line, build
13372         new output sections for .debug_abbrev and .debug_info.
13373         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13374         gold.  Warn about possible overflow.
13375         (read_signed_LEB_128): Likewise.
13376         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13377         (read_signed_LEB_128): Declare.
13378         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13379         (HFILES): Add reduced_debug_output.h.
13380         * Makefile.in: Rebuild.
13381
13382 2008-05-21  Ian Lance Taylor  <iant@google.com>
13383
13384         * mapfile.cc: New file.
13385         * mapfile.h: New file.
13386         * options.h (class General_options): Add -M/--print-map and -Map.
13387         * options.cc (General_options::finalize): Make -M equivalent to
13388         -Map -.
13389         * main.cc: Include <cstdio> and "mapfile.h".
13390         (main): Open mapfile if requested.
13391         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13392         constructor.  Change caller.
13393         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13394         (queue_middle_tasks): Likewise.
13395         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13396         declarations.
13397         * archive.cc: Include "mapfile.h".
13398         (Archive::add_symbols): Add mapfile parameter.  Change all
13399         callers.  Pass mapfile, symbol, and reason to include_member.
13400         (Archive::include_all_members): Add mapfile parameter.  Change all
13401         callers.
13402         (Archive::include_member): Add mapfile, sym, and why parameters.
13403         Change all callers.  Report inclusion to map file.
13404         * archive.h: Include "fileread.h".
13405         (class Archive): Update declarations.
13406         (Archive::file): New const method.
13407         (class Add_archive_symbols): Add mapfile_ field.  Update
13408         constructor.  Change all callers.
13409         * readsyms.h (class Read_symbols): Likewise.
13410         (class Finish_group): Likewise.
13411         (class Read_script): Likewise.
13412         * common.cc: Include "mapfile.h".
13413         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13414         all callers.
13415         (Symbol_table::do_allocate_commons): Likewise.
13416         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13417         symbol allocation to mapfile.
13418         * common.h (class Allocate_commons_task): Add mapfile_ field.
13419         Update constructor.  Change all callers.
13420         * symtab.h (class Symbol_table): Update declarations.
13421         * layout.cc: Include "mapfile.h".
13422         (Layout_task_runner::run): Print information to mapfile.
13423         (Layout::create_gold_note): Change Output_data_fixed_space to
13424         Output_data_zero_fill.
13425         (Layout::create_build_id): Likewise.
13426         (Layout::print_to_mapfile): New function.
13427         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13428         constructor.  Change caller.
13429         (class Layout): Declare print_to_mapfile.
13430         * output.cc (Output_section::Input_section::print_to_mapfile): New
13431         function.
13432         (Output_section::add_input_section): If producing a map, always
13433         add to input_sections_ list.
13434         (Output_section::do_print_to_mapfile): New function.
13435         (Output_segment::print_sections_to_mapfile): New function.
13436         (Output_segment::print_section_list_to_mapfile): New function.
13437         * output.h: Include "mapfile.h".
13438         (Output_data::print_to_mapfile): New function.
13439         (Output_data::do_print_to_mapfile): New virtual function.
13440         (Output_segment_headers::do_print_to_mapfile): New function.
13441         (Output_file_header::do_print_to_mapfile): New function.
13442         (Output_data_const::do_print_to_mapfile): New function.
13443         (class Output_data_const_buffer): Add map_name_ field.  Update
13444         constructor.  Change all callers.  Add do_print_to_mapfile
13445         function.
13446         (class Output_data_fixed_space): Likewise.
13447         (class Output_data_space): Likewise.
13448         (class Output_data_zero_fill): New class.
13449         (Output_data_strtab::do_print_to_mapfile): New function.
13450         (Output_data_reloc_base::do_print_to_mapfile): New function.
13451         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13452         (Output_data_group::do_print_to_mapfile): New function.
13453         (Output_data_got::do_print_to_mapfile): New function.
13454         (Output_data_dynamic::do_print_to_mapfile): New function.
13455         (Output_symtab_xindex::do_print_to_mapfile): New function.
13456         (class Output_section): Declare do_print_to_mapflie.  Declare
13457         print_to_mapfile in Input_section.
13458         (class Output_segment): Declare new functions.
13459         * object.h (Sized_relobj::symbol_count): New function.
13460         * script-sections.cc
13461         (Output_section_element_dot_assignment::set_section_addresses):
13462         Change Output_data_fixed_space to Output_data_zero_fill.
13463         (Output_data_expression::do_print_to_mapfile): New function.
13464         * script.cc (read_input_script): Add mapfile parameter.  Change
13465         all callers.
13466         * script.h (read_input_script): Update declaration.
13467         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13468         (Eh_frame::do_print_to_mapfile): New function.
13469         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13470         (Output_merge_string::do_print_to_mapfile): New function.
13471         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13472         function.
13473         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13474         function.
13475         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13476         function.
13477         * Makefile.am (CCFILES): Add mapfile.cc.
13478         (HFILES): Add mapfile.h.
13479         * Makefile.in: Rebuild.
13480
13481 2008-05-19  Ian Lance Taylor  <iant@google.com>
13482
13483         * options.h (class General_options): Add -z relro.
13484         * layout.cc (Layout::Layout): Initialize relro_segment_.
13485         (Layout::add_output_section_data): Return the output section.
13486         (Layout::make_output_section): Rcognize relro sections and mark
13487         them appropriately.
13488         (Layout::attach_allocated_section_to_segment): Put relro sections
13489         in a PT_GNU_RELRO segment.
13490         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13491         section as relro.
13492         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13493         PT_TLS segments.
13494         (Layout::linkonce_mapping): Map d.rel.ro.local to
13495         .data.rel.ro.local.
13496         (Layout::output_section_name): Us .data.rel.ro.local for any
13497         section which begins with that.
13498         * layout.h (class Layout): Update add_output_section_data
13499         declaration.  Add relro_segment_ field.
13500         * output.cc (Output_section::Output_section): Initialize is_relro_
13501         and is_relro_local_ fields.
13502         (Output_segment::add_output_section): Group relro sections.
13503         (Output_segment::is_first_section_relro): New function.
13504         (Output_segment::maximum_alignment): If there is a relro section,
13505         align the segment to the common page size.
13506         (Output_segment::set_section_addresses): Track whether we are
13507         looking at relro sections.  If the last section is a relro
13508         section, align to the common page size.
13509         (Output_segment::set_section_list_addresses): Add in_relro
13510         parameter.  Change all callers.  Align to the page size when
13511         moving from relro to non-relro section.
13512         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13513         segment.
13514         * output.h (class Output_section): Add is_relro_ and
13515         is_relro_local_ fields.
13516         (Output_section::is_relro): New function.
13517         (Output_section::set_is_relro): New function.
13518         (Output_section::is_relro_local): New function.
13519         (Output_section::set_is_relro_local): New function.
13520         (class Output_segment): Update declarations.
13521         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13522         * sparc.cc (Target_sparc::got_section): Likewise.
13523         * x86_64.cc (Target_x86_64::got_section): Likewise.
13524         * testsuite/relro_test_main.cc: New file.
13525         * testsuite/relro_test.cc: New file.
13526         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13527         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13528         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13529         (relro_test.so, relro_test_pic.o): New targets.
13530         * testsuite/Makefile.in: Rebuild.
13531
13532 2008-05-16  Ian Lance Taylor  <iant@google.com>
13533
13534         * output.cc (Output_segment::add_output_section): Remove front
13535         parameter.
13536         * output.h (class Output_segment): Remove
13537         add_initial_output_section and overloaded add_output_section.
13538         Update declaration of remaining add_output_section.
13539         * layout.cc (Layout::create_interp): Call add_output_section
13540         rather than add_initial_output_section.
13541         (Layout::finish_dynamic_section): Likewise.
13542
13543         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13544         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13545         know the dynamic type.
13546         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13547         field.  Initialize it in constructor.
13548         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13549         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13550         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13551         reloc.
13552
13553         * output.cc (Output_reloc::get_address): Change return type to
13554         Elf_Addr.
13555         * output.h (class Output_reloc): Update get_address declaration.
13556         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13557         for section addresses.
13558
13559 2008-05-09  Ian Lance Taylor  <iant@google.com>
13560
13561         PR 6493
13562         * gold.cc (gold_nomem): Use return value of write.
13563
13564 2008-05-08  Ian Lance Taylor  <iant@google.com>
13565
13566         * symtab.c (Symbol::init_base_output_data): Add version
13567         parameter.  Change all callers.
13568         (Symbol::init_base_output_segment): Likewise.
13569         (Symbol::init_base_constant): Likewise.
13570         (Symbol::init_base_undefined): Likewise.
13571         (Sized_symbol::init_output_data): Likewise.
13572         (Sized_symbol::init_output_segment): Likewise.
13573         (Sized_symbol::init_constant): Likewise.
13574         (Sized_symbol::init_undefined): Likewise.
13575         (Symbol_table::do_define_in_output_data): If the new symbol has a
13576         version, mark it as the default.
13577         (Symbol_table::do_define_in_output_segment): Likewise.
13578         (Symbol_table::do_define_as_constant): Likewise.
13579         * symtab.h (class Symbol): Update declarations.
13580         (class Sized_symbol): Likewise.
13581         * resolve.cc (Symbol::override_version): New function.
13582         (Symbol::override_base): Call override_version.
13583         (Symbol::override_base_with_special): Likewise.
13584         * testsuite/ver_script_8.script: New file.
13585         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13586         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13587         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13588         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13589
13590 2008-05-06  Ian Lance Taylor  <iant@google.com>
13591
13592         PR 6049
13593         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13594         functions.
13595         (class General_options): Remove existing --undefined, and add
13596         --no-undefined instead.  Add new --undefined as synonym for -u.
13597         * archive.cc (Archive::add_symbols): Check whether symbol was
13598         named with -u.
13599         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13600         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13601         all uses.  Add IS_UNDEFINED.  Update declarations to split
13602         different versions of init_base.  Declare init_base_undefined.
13603         (Symbol::is_defined): Handle IS_UNDEFINED.
13604         (Symbol::is_undefined): Likewise.
13605         (Symbol::is_weak_undefined): Call is_undefined.
13606         (Symbol::is_absolute): Handle IS_CONSTANT.
13607         (class Sized_symbol): Update declarations to split different
13608         versions of init.  Declare init_undefined.
13609         (class Symbol_table): Declare new functions.
13610         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13611         Change all callers.
13612         (Symbol::init_base_output_data): Likewise.
13613         (Symbol::init_base_output_segment): Likewise.
13614         (Symbol::init_base_constant): Likewise.
13615         (Symbol::init_base_undefined): New function.
13616         (Sized_symbol::init_object): Rename from init.  Change all
13617         callers.
13618         (Sized_symbol::init_output_data): Likewise.
13619         (Sized_symbol::init_output_segment): Likewise.
13620         (Sized_symbol::init_constant): Likewise.
13621         (Sized_symbol::init_undefined): New function.
13622         (Symbol_table::add_undefined_symbols_from_command_line): New
13623         function.
13624         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13625         function.
13626         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13627         (Symbol::output_section): Likewise.
13628         (Symbol::set_output_section): Likewise.
13629         (Symbol_table::sized_finalize_symbol): Likewise.
13630         (Symbol_table::sized_write_globals): Likewise.
13631         * resolve.cc (Symbol_table::should_override): Likewise.
13632         (Symbol::override_base_with_special): Likewise.
13633
13634         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13635         symbol, change it to have default visibility.
13636         * testsuite/protected_1.cc: New file.
13637         * testsuite/protected_2.cc: New file.
13638         * testsuite/protected_3.cc: New file.
13639         * testsuite/protected_main_1.cc: New file.
13640         * testsuite/protected_main_2.cc: New file.
13641         * testsuite/protected_main_3.cc: New file.
13642         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13643         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13644         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13645         (protected_1.so): New target.
13646         (protected_1_pic.o, protected_2_pic.o): New targets.
13647         (protected_3_pic.o): New target.
13648         (check_PROGRAMS): Add protected_2.
13649         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13650         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13651         * testsuite/Makefile.in: Rebuild.
13652
13653         * options.h (DEFINE_var): Add set_user_set_##varname__.
13654         (DEFINE_bool_alias): New macro.
13655         (class General_options): Define -Bstatic using DEFINE_bool_alias
13656         rather than DEFINE_special.  Add --undefined as an alias for -z
13657         defs.
13658         * options.cc (General_options::parse_Bstatic): Remove.
13659
13660         * options.h (class General_options): Add --fatal-warnings.
13661         * main.cc (main): Implement --fatal-warnings.
13662         * errors.h (Errors::warning_count): New function.
13663
13664         * options.h (class General_options): Add -Bsymbolic-functions.
13665         * symtab.h (Symbol::is_preemptible): Check for
13666         -Bsymbolic-functions.
13667
13668 2008-05-05  Ian Lance Taylor  <iant@google.com>
13669
13670         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13671         as noVARNAME rather than no-VARNAME.
13672         (class General_options): Add option -z combreloc.
13673         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13674         get_address.
13675         (Output_reloc::sort_before) [SHT_REL]: New function.
13676         (Output_reloc::sort_before) [SHT_RELA]: New function.
13677         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13678         Sort_relocs_comparison.
13679         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13680         parameter.  Change all callers.
13681         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13682         sort_relocs parameter.  Change all callers.
13683         * output.cc (Output_reloc::get_address): New function, broken out
13684         of write_rel.
13685         (Output_reloc::write_rel): Call it.
13686         (Output_reloc::compare): New function.
13687         (Output_data_reloc_base::do_write): Optionally sort relocs.
13688
13689         * configure.ac: If targ_extra_obj is set, link it in.
13690         * configure.tgt: Initialize all variables.
13691         (x86_64*): Set targ_extra_obj and targ_extra_size.
13692         * configure: Rebuild.
13693
13694         * object.cc (Sized_relobj::include_section_group): Adjust section
13695         indexes read from group data.  Build vector to pass to
13696         layout_group.
13697         * layout.cc (Layout::layout_group): Add flags and shndxes
13698         parameters.  Remove contents parameter.  Change caller.  Update
13699         explicit instantiations.
13700         * layout.h (class Layout): Update layout_group declaration.
13701         * output.cc (Output_data_group::Output_data_group): Add flags and
13702         input_shndxes parameters.  Remove contents parameter.  Change
13703         caller.
13704         (Output_data_group::do_write): Change input_sections_ to
13705         input_shndxes_.
13706         * output.h (class Output_data_group): Update constructor
13707         declaration.  Rename input_sections_ to input_shndxes_.
13708         * testsuite/many_sections_test.cc: Add template.
13709
13710 2008-04-30  Cary Coutant  <ccoutant@google.com>
13711
13712         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13713
13714         * layout.cc (Layout::include_section): Refactored check for debug
13715         info section.
13716         (Layout::add_comdat): Add new parameters.  Change type
13717         of signature parameter.  Add object and shndx to signatures table.
13718         (Layout::find_kept_object): New function.
13719         * layout.h: Include <cstring>.
13720         (Layout::is_debug_info_section): New function.
13721         (Layout::add_comdat): Add new parameters.
13722         (Layout::find_kept_object): New function.
13723         (Layout::Kept_section): New struct.
13724         (Layout::Signatures): Change type of map range.
13725         * object.cc (Relobj::output_section_address): New function.
13726         (Sized_relobj::include_section_group): Add new parameters.  Change
13727         calls to Layout::add_comdat.  Change to build table of kept comdat
13728         groups and table mapping discarded sections to kept sections.
13729         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13730         (Sized_relobj::do_layout): Change calls to include_section_group and
13731         include_linkonce_section.
13732         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13733         value to zero when section is discarded.
13734         (Sized_relobj::map_to_kept_section): New function.
13735         * object.h (Relobj::output_section_address): New function.
13736         (Relobj::Comdat_group): New type.
13737         (Relobj::find_comdat_group): New function.
13738         (Relobj::Comdat_group_table): New type.
13739         (Relobj::Kept_comdat_section): New type.
13740         (Relobj::Kept_comdat_section_table): New type.
13741         (Relobj::add_comdat_group): New function.
13742         (Relobj::set_kept_comdat_section): New function.
13743         (Relobj::get_kept_comdat_section): New function.
13744         (Relobj::comdat_groups_): New field.
13745         (Relobj::kept_comdat_sections_): New field.
13746         (Symbol_value::input_value): Update comment.
13747         (Sized_relobj::map_to_kept_section) New function.
13748         (Sized_relobj::include_linkonce_section): Add new parameter.
13749         * target-reloc.h (Comdat_behavior): New type.
13750         (get_comdat_behavior): New function.
13751         (relocate_section): Add code to map a discarded section to the
13752         corresponding kept section when applying a relocation.
13753
13754 2008-04-30  Craig Silverstein  <csilvers@google.com>
13755
13756         * dwarf_reader.cc (next_generation_count): New static var.
13757         (Addr2line_cache_entry): New struct.
13758         (addr2line_cache): New static var.
13759         (Dwarf_line_info::one_addr2line): Added caching.
13760         (Dwarf_line_info::clear_addr2line_cache): New function.
13761         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13762         cache-size parameter.
13763         (Dwarf_line_info::one_addr2line_cache): New function.
13764         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13765         new cache-size argument to one_addr2line(), and clear cache.
13766
13767 2008-04-28  Cary Coutant  <ccoutant@google.com>
13768
13769         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13770         R_386_PC8 relocations.
13771
13772 2008-04-23  Ian Lance Taylor  <iant@google.com>
13773
13774         * object.cc (Sized_relobj::include_section_group): Check for
13775         invalid section group.
13776
13777         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13778         header size.
13779
13780         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13781         than read for file header.
13782         * archive.cc (Archive::include_member): Likewise.
13783
13784 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13785
13786         * aclocal.m4: Regenerate.
13787         * configure: Regenerate.
13788
13789 2008-04-19  Ian Lance Taylor  <iant@google.com>
13790
13791         * version.cc (version_string): Bump to 1.6.
13792
13793         * testsuite/Makefile.am (many_sections_r_test): New target.
13794         (many_sections_r_test_SOURCES): Remove.
13795         (many_sections_r_test_DEPENDENCIES): Remove.
13796         (many_sections_r_test_LDFLAGS): Remove.
13797         (many_sections_r_test_LDADD): Remove.
13798
13799         * object.cc (Sized_relobj::do_add_symbols): Always pass
13800         local_symbol_count_ to add_from_relobj.
13801
13802         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13803         every thousand variables.
13804         * testsuite/Makefile.in: Rebuild.
13805
13806         * object.cc (Xindex::initialize_symtab_xindex): New function.
13807         (Xindex::read_symtab_xindex): New function.
13808         (Xindex::sym_xindex_to_shndx): New function.
13809         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13810         available.
13811         (Sized_relobj::do_initialize_xindex): New function.
13812         (Sized_relobj::do_read_symbols): Adjust section links.
13813         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13814         parameter.  Change all callers.
13815         (Sized_relobj::include_section_group): Adjust section links and
13816         symbol section indexes.
13817         (Sized_relobj::do_layout): Adjust section links.
13818         (Sized_relobj::do_count_local_symbols): Adjust section links and
13819         symbol section indexes.
13820         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13821         ordinary and special symbols.
13822         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13823         dynsym_xindex parameters.  Change all callers.  Adjust section
13824         links.  Use SHN_XINDEX when needed.
13825         (Sized_relobj::get_symbol_location_info): Adjust section links.
13826         Don't get fooled by special symbols.
13827         * object.h (class Xindex): Define.
13828         (class Object): Add xindex_ parameter.  Declare virtual functoin
13829         do_initialize_xindex.
13830         (Object::adjust_sym_shndx): New function.
13831         (Object::set_xindex): New protected function.
13832         (class Symbol_value): Add is_ordinary_shndx_ field.
13833         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13834         (Symbol_value::value): Assert ordinary section.
13835         (Symbol_value::initialize_input_to_output_map): Likewise.
13836         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13837         Change all callers.
13838         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13839         all callers.
13840         (class Sized_relobj): Update declarations.
13841         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13842         parameter.  Change all callers.
13843         (Sized_relobj::adjust_shndx): New function.
13844         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13845         field.
13846         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13847         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13848         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13849         (Sized_dynobj::read_dynsym_section): Adjust section links.
13850         (Sized_dynobj::read_dynamic): Likewise.
13851         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13852         section links.
13853         (Sized_dynobj::do_initialize_xindex): New function.
13854         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13855         do_initialize_xindex.
13856         (Sized_dynobj::adjust_shndx): New function.
13857         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13858         dynsym_xindex_ fields.
13859         (Layout::finalize): Add a call to set_section_indexes before
13860         creating the symtab sections.
13861         (Layout::set_section_indexes): Don't do anything if the section
13862         already has a section index.
13863         (Layout::create_symtab_sections): Add shnum parameter.  Change
13864         caller.  Create .symtab_shndx section if needed.
13865         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13866         caller.
13867         (Layout::allocated_output_section_count): New function.
13868         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13869         needed.
13870         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13871         fields.  Update declarations.
13872         (Layout::symtab_xindex): New function.
13873         (Layout::dynsym_xindex): New function.
13874         (class Write_symbols_task): Add layout_ field.
13875         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13876         Change caller.
13877         * output.cc (Output_section_headers::Output_section_headers): Add
13878         shstrtab_section parameter.  Change all callers.
13879         (Output_section_headers::do_sized_write): Store overflow values
13880         for section count and section string table section index in
13881         section header zero.
13882         (Output_file_header::do_sized_write): Check for overflow of
13883         section count and section string table section index.
13884         (Output_symtab_xindex::do_write): New function.
13885         (Output_symtab_xindex::endian_do_write): New function.
13886         * output.h (class Output_section_headers): Add shstrtab_section_.
13887         Update declarations.
13888         (class Output_symtab_xindex): Define.
13889         (Output_section::has_out_shndx): New function.
13890         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13891         field.
13892         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13893         Change all callers.
13894         (Sized_symbol::init): Likewise.
13895         (Symbol::output_section): Check for ordinary symbol.
13896         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13897         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13898         callers.
13899         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13900         Change all callers.  Simplify handling of symbols from sections
13901         not included in the link.
13902         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13903         distinction.
13904         (Weak_alias_sorter::operator()): Assert that symbols are
13905         ordinary.
13906         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13907         distinction.
13908         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13909         parameters.  Change all callers.
13910         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13911         symbol distinction.  Use SHN_XINDEX when needed.
13912         (Symbol_table::write_section_symbol): Add symtab_xindex
13913         parameter.  Change all callers.
13914         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13915         SHN_XINDEX when needed.
13916         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13917         declarations.
13918         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13919         (Symbol::is_defined): Check is_ordinary.
13920         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13921         (Symbol::is_absolute, Symbol::is_common): Likewise.
13922         (class Sized_symbol): Update declarations.
13923         (class Symbol_table): Update declarations.
13924         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13925         parameters.  Change all callers.
13926         (Sized_symbol::override): Likewise.
13927         (Symbol_table::override): Likewise.
13928         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13929         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13930         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13931         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13932         to be in an ordinary section.
13933         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13934         object and is_ordinary parameters.  Change all callers.
13935         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13936         Change all callers.  Don't add undefined or non-ordinary symbols
13937         to reloc_map_.
13938         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13939         Change all callers.
13940         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13941         declarations.
13942         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13943         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13944         (Sized_relobj::relocate_sections): Likewise.
13945         * target-reloc.h (scan_relocs): Adjust section symbol index.
13946         (scan_relocatable_relocs): Likewise.
13947         * i386.cc (Scan::local): Check for ordinary symbols.
13948         * sparc.cc (Scan::local): Likewise.
13949         * x86_64.cc (Scan::local): Likewise.
13950         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13951         to symbol_section_and_value.
13952         * testsuite/many_sections_test.cc: New file.
13953         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13954         (check_PROGRAMS): Add many_sections_test.
13955         (many_sections_test_SOURCES): Define.
13956         (many_sections_test_DEPENDENCIES): Define.
13957         (many_sections_test_LDFLAGS): Define.
13958         (BUILT_SOURCES): Add many_sections_define.h.
13959         (many_sections_define.h): New target.
13960         (BUILT_SOURCES): Add many_sections_check.h.
13961         (many_sections_check.h): New target.
13962         (check_PROGRAMS): Add many_sections_r_test.
13963         (many_sections_r_test_SOURCES): Define.
13964         (many_sections_r_test_DEPENDENCIES): Define.
13965         (many_sections_r_test_LDFLAGS): Define.
13966         (many_sections_r_test_LDADD): Define.
13967         (many_sections_r_test.o): New target.
13968         * testsuite/Makefile.in: Rebuild.
13969
13970 2008-04-17  Cary Coutant  <ccoutant@google.com>
13971
13972         * errors.cc (Errors::info): New function.
13973         (gold_info): New function.
13974         * errors.h (Errors::info): New function.
13975         * gold.h (gold_info): New function.
13976         * object.cc (Input_objects::add_object): Print trace output.
13977         * options.cc (options::parse_set): New function.
13978         (General_options::parse_wrap): Deleted.
13979         (General_options::General_options): Deleted initializer.
13980         * options.h (options::String_set): New typedef.
13981         (options::parse_set): New function.
13982         (DEFINE_set): New macro.
13983         (General_options::wrap): Changed to use DEFINE_set. Changed
13984         callers of any_wrap_symbols and is_wrap_symbol.
13985         (General_options::trace, General_options::trace_symbol):
13986         New options.
13987         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13988         (General_options::wrap_symbols_): Deleted.
13989         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13990
13991 2008-04-17  David S. Miller  <davem@davemloft.net>
13992
13993         * options.cc (General_options::parse_V): New function.
13994         * options.h: Add entries for -V and -Qy.
13995
13996 2008-04-17  Ian Lance Taylor  <iant@google.com>
13997
13998         * common.cc (Symbol_table::allocate_commons): Remove options
13999         parameter.  Change caller.
14000         (Symbol_table::do_allocate_commons): Remove options parameter.
14001         Change caller.  Just call do_allocate_commons_list twice.
14002         (Symbol_table::do_allocate_commons_list): New function, broken out
14003         of do_allocate_commons.
14004         * common.h (class Allocate_commons_task): Remove options_ field.
14005         Update constructor.
14006         * symtab.cc (Symbol_table::Symbol_table): Initialize
14007         tls_commons_.
14008         (Symbol_table::add_from_object): Put TLS common symbols on
14009         tls_commons_ list.
14010         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14011         which are IN_OUTPUT_DATA.
14012         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14013         allocate_commons and do_allocate_commons declarations.  Declare
14014         do_allocate_commons_list.
14015         * gold.cc (queue_middle_tasks): Update creation of
14016         Allocate_commons_task to not pass options.
14017         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14018         (TLS_TEST_C_FLAGS): New variable.
14019         (tls_test_c_pic.o): New target.
14020         (tls_test_shared.so): Link in tls_test_c_pic.o.
14021         (tls_test_c_pic_ie.o): New target.
14022         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14023         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14024         (tls_test_c.o): New target.
14025         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14026         (tls_pic_test_LDADD): Likewise.
14027         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14028         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14029         (tls_test_c_gnu2.o): New target.
14030         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14031         tls_test_c_gnu2.o.
14032         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14033         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14034         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14035         * testsuite/tls_test.cc: Include "config.h".
14036         (t_last): Call t11_last.
14037         * testsuite/tls_test.h (t11, t11_last): Declare.
14038         * testsuite/tls_test_c.c: New file.
14039         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14040         * configure.ac: Check for OpenMP support.
14041         * configure, config.in, Makefile.in: Rebuild.
14042         * testsuite/Makefile.in: Rebuild.
14043
14044 2008-04-16  Cary Coutant  <ccoutant@google.com>
14045
14046         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14047         (Target_i386::tls_base_symbol_defined_): New field.
14048         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14049         (Target_i386::Scan::global): Likewise.
14050         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14051         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14052         (Target_x86_64::tls_base_symbol_defined_): New field.
14053         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14054         (Target_x86_64::Scan::global): Likewise.
14055
14056 2008-04-16  Cary Coutant  <ccoutant@google.com>
14057
14058         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14059         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14060         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14061         building shared libraries.
14062         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14063         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14064         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14065         * testsuite/Makefile.in: Rebuild.
14066         * testsuite/weak_undef.h: New file.
14067         * testsuite/weak_undef_file1.cc: Add extra test cases.
14068         * testsuite/weak_undef_file2.cc: Likewise.
14069         * testsuite/weak_undef_test.cc: Likewise.
14070
14071 2008-04-16  David S. Miller  <davem@davemloft.net>
14072
14073         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14074         Add issued_non_pic_error_ field.  Declare check_non_pic.
14075         (Target_sparc::Scan::check_non_pic): New function.
14076         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14077         (Target_sparc::Scan::global): Likewise.
14078
14079         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14080         * configure: Rebuild.
14081
14082         * options.h (DEFINE_enable): New macro.
14083         (new_dtags): New enable option.
14084         (initfirst, interpose, loadfltr, nodefaultlib,
14085         nodelete, nodlopen, nodump): New -z options.
14086         * layout.cc (Layout:finish_dynamic_section): If new
14087         dtags enabled, emit DT_RUNPATH.  Also, emit a
14088         DT_FLAGS_1 containing any specified -z flags.
14089
14090 2008-04-16  Ian Lance Taylor  <iant@google.com>
14091
14092         * copy-relocs.cc: New file.
14093         * copy-relocs.h: New file.
14094         * reloc.cc: Remove Copy_relocs code.
14095         * reloc.h: Likewise.
14096         * reloc-types.h (struct Reloc_types) [both versions]: Add
14097         get_reloc_addend_noerror.
14098         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14099         variants of add_global which take an addend which must be zero.
14100         * i386.cc: Include "copy-relocs.h".
14101         (class Target_i386): Change type of copy_relocs_ to variable,
14102         update initializer.
14103         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14104         Change all callers.
14105         (Target_i386::do_finalize_sections): Change handling of
14106         copy_relocs_.
14107         * sparc.cc: Include "copy-relocs.h".
14108         (class Target_sparc): Change type of copy_relocs_ to variable,
14109         update initializer.
14110         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14111         Change all callers.
14112         (Target_sparc::do_finalize_sections): Change handling of
14113         copy_relocs_.
14114         * x86_64.cc: Include "copy-relocs.h".
14115         (class Target_x86_64): Change type of copy_relocs_ to variable,
14116         update initializer.
14117         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14118         class.  Change all callers.
14119         (Target_x86_64::do_finalize_sections): Change handling of
14120         copy_relocs_.
14121         * Makefile.am (CCFILES): Add copy-relocs.cc.
14122         (HFILES): Add copy-relocs.h.
14123
14124         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14125
14126         * testsuite/script_test_4.sh: Permit leading zeroes.
14127
14128 2008-04-15  Ian Lance Taylor  <iant@google.com>
14129
14130         * script-sections.cc (Script_sections::create_segments): Use
14131         header_size_adjustment even when there is enough room for the
14132         headers.
14133         * testsuite/script_test_4.sh: New file.
14134         * testsuite/script_test_4.t: New file.
14135         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14136         (check_DATA): Add script_test_4.stdout.
14137         (MOSTLYCLEANFILES): Likewise.
14138         (script_test_4): New target.
14139         (script_test_4.stdout): New target.
14140         * testsuite/Makefile.in: Rebuild.
14141
14142         * sparc.cc: Add definitions for Output_data_plt_sparc class
14143         constants.
14144
14145 2008-04-14  David S. Miller  <davem@davemloft.net>
14146
14147         * sparc.cc: New file.
14148         * Makefile.am (TARGETSOURCES): Add sparc.cc
14149         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14150         * configure.tgt: Document targ_extra_size and
14151         targ_extra_big_endian.  Add entries for sparc-* and
14152         sparc64-*.
14153         * configure.ac: Handle targ_extra_size and
14154         targ_extra_big_endian.
14155         * Makefile.in: Rebuild.
14156         * configure: Likewise.
14157         * po/POTFILES.in: Likewise.
14158         * po/gold.pot: Likewise.
14159
14160 2008-04-14  Ian Lance Taylor  <iant@google.com>
14161
14162         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14163         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14164         in the name/type/flags to section mapping.  Don't call
14165         allocate_output_section.
14166         (Layout::choose_output_section): Change parameter from adjust_name
14167         to is_input_section.  Don't permit input sections after sections
14168         are attached to segments.  Don't call allocate_output_section.
14169         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14170         not write_enable_output_section.
14171         (Layout::make_output_section): Don't push to
14172         unattached_section_list_ nor call attach_to_segment.  Call
14173         attach_section_to_segment if sections are attached.
14174         (Layout::attach_sections_to_segments): New function.
14175         (Layout::attach_section_to_segment): New function.
14176         (Layout::attach_allocated_section_to_segment): Rename from
14177         attach_to_segment.  Remove flags parameter.
14178         (Layout::allocate_output_section): Remove function.
14179         (Layout::write_enable_output_section): Remove function.
14180         * layout.h (class Layout): Update for above changes.  Add new
14181         field sections_are_attached_.
14182         * output.h (Output_section::update_flags_for_input_section): New
14183         function.
14184         * output.cc (Output_section::add_input_section): Call
14185         update_flags_for_input_section.
14186         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14187
14188 2008-04-11  Cary Coutant  <ccoutant@google.com>
14189
14190         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14191         thought unnecessary.
14192         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14193
14194 2008-04-11  Ian Lance Taylor  <iant@google.com>
14195
14196         * output.h (class Output_section_data): Remove inline definition
14197         of set_addralign.
14198         * output.cc (Output_section_data::set_addralign): New function.
14199
14200 2008-04-11  Cary Coutant  <ccoutant@google.com>
14201
14202         Add support for TLS descriptors for i386 and x86_64.
14203         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14204         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14205         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14206         GOT_TYPE_TLS_DESC.
14207         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14208         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14209         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14210         relocations.
14211         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14212         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14213         Fix problem with initial-exec relocations.
14214         (Target_i386::Relocate::relocate_tls): Likewise.
14215         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14216         relaxation.
14217         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14218         support for section-plus-offset dynamic table entries.
14219         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14220         (Output_data_dynamic::Dynamic_entry): Add support for
14221         section-plus-offset dynamic table entries.
14222         (Output_data_dynamic::Classification): Likewise.
14223         (Output_data_dynamic::classification_): Renamed offset_.
14224         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14225         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14226         (Target_x86_64::make_plt_section): New function.
14227         (Target_x86_64::reserve_tlsdesc_entries): New function.
14228         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14229         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14230         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14231         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14232         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14233         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14234         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14235         add extra PLT entry for TLS descriptors.
14236         (Output_data_plt_x86_64::got_): New field.
14237         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14238         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14239         fields.
14240         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14241         descriptors.
14242         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14243         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14244         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14245         R_386_TLS_DESC_CALL relocations.
14246         (Target_x86_64::Scan::global): Likewise.
14247         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14248         for TLS descriptors.
14249         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14250         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14251         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14252         GD-to-IE relaxation.
14253         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14254         and TLS_DESCRIPTORS.
14255         * Makefile.in: Rebuild.
14256         * configure: Rebuild.
14257         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14258         (tls_test_shared2.so): New target.
14259         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14260         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14261         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14262         (tls_shared_gd_to_ie_test_LDADD): New variable.
14263         (tls_shared_gnu2_gd_to_ie_test): New target.
14264         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14265         New targets.
14266         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14267         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14268         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14269         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14270         (tls_shared_gnu2_test): New target.
14271         (tls_test_gnu2_shared.so): New target.
14272         (tls_shared_gnu2_test_SOURCES): New variable.
14273         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14274         (tls_shared_gnu2_test_LDFLAGS): New variable.
14275         (tls_shared_gnu2_test_LDADD): New variable.
14276         * testsuite/Makefile.in: Rebuild.
14277         * testsuite/Makefile.
14278
14279 2008-04-11  Ian Lance Taylor  <iant@google.com>
14280
14281         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14282         justsyms.t.
14283         * testsuite/Makefile.in: Rebuild.
14284
14285         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14286         long.
14287         * testsuite/script_test_2.cc (main): Adjust test.
14288
14289 2008-04-11  David S. Miller  <davem@davemloft.net>
14290             Ian Lance Taylor  <iant@google.com>
14291
14292         * options.h (General_options): Add entries for '-Y' and
14293         '-relax'.
14294         * options.cc (General_options:finalize): If -Y was used, add those
14295         entries to the library path instead of the default "/lib" and
14296         "/usr/lib".
14297
14298 2008-04-11  David S. Miller  <davem@davemloft.net>
14299
14300         * testsuite/justsyms.t: Start at 0x100.
14301         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14302         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14303         long.
14304         * testsuite/script_test_2.cc: Adjust string and section length
14305         checks.
14306
14307 2008-04-09  Ian Lance Taylor  <iant@google.com>
14308
14309         PR gold/5996
14310         * script-sections.cc (Sections_element::allocate_to_segment): Add
14311         orphan parameter.
14312         (Output_section_definition::allocate_to_segment): Likewise.
14313         (Orphan_output_section::allocate_to_segment): Likewise.
14314         (Script_sections::attach_sections_using_phdrs_clause): Don't
14315         propagate non-PT_LOAD segments to orphan sections.
14316         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14317         readelf rather than objdump.
14318         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14319         .interp section and PT_INTERP segment are the same size.
14320         * testsuite/Makefile.in: Rebuild.
14321
14322         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14323         aliases for symbols defined in the same object.
14324         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14325         (weak_alias_test_SOURCES): New variable.
14326         (weak_alias_test_DEPENDENCIES): New variable.
14327         (weak_alias_test_LDFLAGS): New variable.
14328         (weak_alias_test_LDADD): New variable.
14329         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14330         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14331         (weak_alias_test_3.o): New target.
14332         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14333         * testsuite/weak_alias_test_main.cc: New file.
14334         * testsuite/weak_alias_test_1.cc: New file.
14335         * testsuite/weak_alias_test_2.cc: New file.
14336         * testsuite/weak_alias_test_3.cc: New file.
14337
14338 2008-04-08  Ian Lance Taylor  <iant@google.com>
14339
14340         * options.h (class General_options): Add --noinhibit-exec option.
14341         * main.cc (main): Check --noinhibit-exec.
14342
14343         * options.h (class General_options): Define --wrap as a special
14344         option.  Add wrap_symbols_ field.
14345         (General_options::any_wrap_symbols): New function.
14346         (General_options::is_wrap_symbol): New function.
14347         * options.cc (General_options::parse_wrap): New function.
14348         (General_options::General_options): Initialize wrap_symbols_.
14349         * symtab.cc (Symbol_table::wrap_symbol): New function.
14350         (Symbol_table::add_from_object): Handle --wrap.
14351         * symtab.h (class Symbol_table): Declare wrap_symbol.
14352         * target.h (Target::wrap_char): New function.
14353         (Target::Target_info): Add wrap_char field.
14354         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14355         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14356         * testsuite/testfile.cc (Target_test::test_target_info):
14357         Likewise.
14358
14359         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14360         there is one.
14361
14362         * layout.h (class Layout): Add added_eh_frame_data_ field.
14363         * layout.cc (Layout::Layout): Initialize new field.
14364         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14365         output section until we find a section we merged successfully.
14366         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14367         that the size be non-zero.
14368
14369         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14370         qualifier.
14371
14372 2008-04-08  Craig Silverstein  <csilvers@google.com>
14373
14374         * configure.ac: Export new conditional variable HAVE_ZLIB.
14375         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14376         on HAVE_ZLIB.
14377         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14378         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14379
14380 2008-04-07  Ian Lance Taylor  <iant@google.com>
14381
14382         * version.cc (version_string): Set to "1.5".
14383
14384         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14385         Add issued_non_pic_error_ field.  Declare check_non_pic.
14386         (Target_x86_64::Scan::check_non_pic): New function.
14387         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14388         (Target_x86_64::Scan::global): Likewise.
14389
14390         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14391         addend parameter.  Change caller.  Handle merge sections.
14392         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14393         Address to Addend.  Don't add in the result of
14394         local_section_offset, pass down the addend and use the returned
14395         value.
14396         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14397         Update declarations of local_section_offset and symbol_value.
14398         * testsuite/two_file_test_1.cc (t18): New function.
14399         * testsuite/two_file_test_2.cc (f18): New function.
14400         * testsuite/two_file_test_main.cc (main): Call t18.
14401         * testsuite/two_file_test.h (t18, f18): Declare.
14402
14403         * configure.ac: Don't test for objdump, c++filt, or readelf.
14404         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14405         conditionals.
14406         (TEST_READELF): New variable.
14407         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14408         (check_PROGRAMS): Add two_file_strip_test.
14409         (two_file_strip_test): New target.
14410         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14411         (two_file_same_shared_strip_test_SOURCES): New variable.
14412         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14413         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14414         (two_file_same_shared_strip_test_LDADD): New variable.
14415         (two_file_shared_strip.so): New target.
14416         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14417         (ver_test_5.syms, ver_test_7.syms): Likewise.
14418         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14419         (strip_test_3.stdout): Use TEST_OBJDUMP.
14420         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14421
14422 2008-04-04  Cary Coutant  <ccoutant@google.com>
14423
14424         * symtab.h (Symbol::is_weak_undefined): New function.
14425         (Symbol::is_strong_undefined): New function.
14426         (Symbol::is_absolute): New function.
14427         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14428         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14429         absolute symbols.
14430         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14431         (weak_undef_test): New target.
14432         * testsuite/Makefile.in: Rebuild.
14433         * testsuite/weak_undef_file1.cc: New file.
14434         * testsuite/weak_undef_file2.cc: New file.
14435         * testsuite/weak_undef_test.cc: New file.
14436
14437 2008-04-03  Craig Silverstein  <csilvers@google.com>
14438
14439         * compressed_output.h (class Output_compressed_section): Use
14440         unsigned buffer.
14441         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14442         add zlib header.
14443         (zlib_compressed_suffix): Removed.
14444         (Output_compressed_section::set_final_data_size): Use unsigned
14445         buffers.
14446         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14447         Fix linker invocation.
14448         (flagstest_o_specialfile_and_compress_debug_sections):
14449         Likewise.
14450         * testsuite/Makefile.in: Regenerated.
14451
14452 2008-04-02  David S. Miller  <davem@davemloft.net>
14453
14454         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14455         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14456
14457 2008-04-02  Craig Silverstein  <csilvers@google.com>
14458
14459         * TODO: New file.
14460
14461 2008-04-02  Ian Lance Taylor  <iant@google.com>
14462
14463         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14464         parameters.  Update for new key type to views_.  Change all
14465         callers.
14466         (File_read::read): Adjust for byteshift in returned view.
14467         (File_read::add_view): New function, broken out of
14468         find_and_make_view.
14469         (File_read::make_view): New function, broken out of
14470         find_and_make_view.
14471         (File_read::find_or_make_view): Add offset and aligned
14472         parameters.  Rewrite accordingly.  Change all callers.
14473         (File_read::get_view): Add offset and aligned parameters.  Adjust
14474         for byteshift in return value.
14475         (File_read::get_lasting_view): Likewise.
14476         * fileread.h (class File_read): Update declarations.
14477         (class File_read::View): Add byteshift_ field.  Add byteshift to
14478         constructor.  Add byteshift method.
14479         * archive.h (Archive::clear_uncached_views): New function.
14480         (Archive::get_view): Add aligned parameter.  Change all callers.
14481         * object.h (Object::get_view): Add aligned parameter.  Change all
14482         callers.
14483         (Object::get_lasting_view): Likewise.
14484
14485         * fileread.cc (File_read::release): Don't call clear_views if
14486         there are multiple objects.
14487         * fileread.h (File_read::clear_uncached_views): New function.
14488         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14489         on the archive.
14490
14491 2008-03-31  Cary Coutant  <ccoutant@google.com>
14492
14493         Add thin archive support.
14494         * archive.cc (Archive::armagt): New const.
14495         (Archive::setup): Remove task parameter and calls to unlock.
14496         (Archive::unlock_nested_archives): New function.
14497         (Archive::read_header): Add nested_off parameter. Change
14498         all callers.
14499         (Archive::interpret_header): Likewise.
14500         (Archive::include_all_members): Change to handle thin
14501         archives.
14502         (Archive::include_member): Likewise.
14503         * archive.h (Archive::Archive): Add new parameters and
14504         initializers.
14505         (Archive::armagt): New const.
14506         (Archive::setup): Remove task parameter.
14507         (Archive::unlock_nested_archives): New function.
14508         (Archive::read_header): Add nested_off parameter.
14509         (Archive::interpret_header): Likewise.
14510         (Archive::Nested_archive_table): New typedef.
14511         (Archive::is_thin_archive_): New field.
14512         (Archive::nested_archives_): New field.
14513         (Archive::options_): New field.
14514         (Archive::dirpath_): New field.
14515         (Archive::task_): New field.
14516         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14517         for thin archives.  Pass additional parameters to
14518         Archive::Archive.  Unlock the archive file after calling
14519         Archive::setup.
14520
14521 2008-03-29  Ian Lance Taylor  <iant@google.com>
14522
14523         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14524         version symbol to be local.
14525         * testsuite/ver_test_4.sh: New file.
14526         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14527         (check_DATA): Add ver_test_4.syms.
14528         (ver_test_4.syms): New target.
14529         * testsuite/Makefile.in: Rebuild.
14530
14531         * output.cc
14532         (Output_section::Input_section_sort_entry::has_priority): New
14533         function.
14534         (Output_section::Input_section_sort_entry::match_file_name): New
14535         function.
14536         (Output_section::Input_section_sort_entry::match_section_name):
14537         Remove.
14538         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14539         Remove.
14540         (Output_section::Input_section_sort_entry::match_section_file):
14541         Remove.
14542         (Output_section::Input_section_sort_compare::operator()): Rewrite
14543         using new Input_section_sort_entry functions.  Sort crtbegin and
14544         crtend first.  Sort sections with no priority before sections with
14545         a priority.
14546         * testsuite/initpri1.c (d3): Check j != 4.
14547         (cd5): New constructor/destructor function.
14548         (main): Check j != 2.
14549
14550         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14551         new symbol when resolving, don't call set_is_default.
14552         * testsuite/ver_test_7.cc: New file.
14553         * testsuite/ver_test_7.sh: New file.
14554         * testsuite/Makefile.am (ver_test_7.so): New target.
14555         (ver_test_7.o): New target.
14556         (check_SCRIPTS): Add ver_test_7.sh.
14557         (check_DATA): Add ver_test_7.syms.
14558         (ver_test_7.syms): New target.
14559
14560 2008-03-28  Ian Lance Taylor  <iant@google.com>
14561
14562         * layout.cc (Layout::layout): If we see an input section with a
14563         name that needs sorting, set the must_sort flag for the output
14564         section.
14565         (Layout::make_output_section): If the name of the output section
14566         indicates that it might require sorting, set the may_sort flag.
14567         * output.h (Output_section::may_sort_attached_input_sections): New
14568         function.
14569         (Output_section::set_may_sort_attached_input_sections): New
14570         function.
14571         (Output_section::must_sort_attached_input_sections): New
14572         function.
14573         (Output_section::set_must_sort_attached_input_sections): New
14574         function.
14575         (class Output_section): Declare Input_section_sort_entry.  Define
14576         Input_section_sort_compare.  Declare
14577         sort_attached_input_sections.  Add new fields:
14578         may_sort_attached_input_sections_,
14579         must_sort_attached_input_sections_,
14580         attached_input_sections_are_sorted_.
14581         * output.cc (Output_section::Output_section): Initialize new
14582         fields.
14583         (Output_section::add_input_section): Add an entry to
14584         input_sections_ if may_sort or must_sort are true.
14585         (Output_section::set_final_data_size): Call
14586         sort_attached_input_sections if necessary.
14587         (Output_section::Input_section_sort_entry): Define new class.
14588         (Output_section::Input_section_sort_compare::operator()): New
14589         function.
14590         (Output_section::sort_attached_input_sections): New function.
14591         * configure.ac: Check whether the compiler supports constructor
14592         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14593         * testsuite/initpri1.c: New file.
14594         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14595         CONSTRUCTOR_PRIORITY.
14596         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14597         (initpri1_LDFLAGS): New variable.
14598         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14599
14600 2008-03-27  Ian Lance Taylor  <iant@google.com>
14601
14602         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14603         * testsuite/common_test_1.c: New file.
14604         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14605         (common_test_1_SOURCES): New variable.
14606         (common_test_1_DEPENDENCIES): New variable.
14607         (common_test_1_LDFLAGS): New variable.
14608
14609         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14610         and commons_ correctly when NAME/VERSION does not override
14611         NAME/NULL.
14612         * testsuite/ver_test_6.c: New file.
14613         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14614         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14615         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14616
14617 2008-03-26  Ian Lance Taylor  <iant@google.com>
14618
14619         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14620         of an undefined symbol from a version script.
14621         * testsuite/Makefile.am (ver_test_5.so): New target.
14622         (ver_test_5.o): New target.
14623         (check_SCRIPTS): Add ver_test_5.sh.
14624         (check_DATA): Add ver_test_5.syms.
14625         (ver_test_5.syms): New target.
14626         * testsuite/ver_test_5.cc: New file.
14627         * testsuite/ver_test_5.script: New file.
14628         * testsuite/ver_test_5.sh: New file.
14629         * Makefile.in, testsuite/Makefile.in: Rebuild.
14630
14631         PR gold/5986
14632         Fix problems building gold with gcc 4.3.0.
14633         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14634         (gold_error_at_location, gold_warning_at_location): Use it.
14635         * configure.ac: Check whether we can compile and use a template
14636         function with a printf attribute.
14637         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14638         when jumping over bytes.
14639         * object.cc: Instantiate Object::read_section_data.
14640         * debug.h: Include <cstring>
14641         * dwarf_reader.cc: Include <algorithm>
14642         * main.cc: Include <cstring>.
14643         * options.cc: Include <cstring>.
14644         * output.cc: Include <cstring>.
14645         * script.cc: Include <cstring>.
14646         * script.h: Include <string>.
14647         * symtab.cc: Include <cstring> and <algorithm>.
14648         * target-select.cc: Include <cstring>.
14649         * version.cc: Include <string>.
14650         * testsuite/testmain.cc: Include <cstdlib>.
14651         * configure, config.in: Rebuild.
14652
14653 2008-03-25  Ian Lance Taylor  <iant@google.com>
14654
14655         * options.cc: Include "../bfd/bfdver.h".
14656         (options::help): Print bug reporting address.
14657
14658         * version.cc (print_version): Adjust output for current value of
14659         BFD_VERSION_STRING.
14660
14661         * NEWS: New file.
14662
14663         * options.cc (options::help): Print list of supported targets.
14664         * target-select.h: Include <vector>.
14665         (class Target_selector): Make machine_, size_, and is_big_endian_
14666         fields const.  Add bfd_name_ and instantiated_target_ fields.
14667         (Target_selector::Target_selector): Add bfd_name parameter.
14668         (Target_selector::recognize): Make non-virtual, call
14669         do_recognize.
14670         (Target_selector::recognize_by_name): Make non-virtual, call
14671         do_recognize_by_name.
14672         (Target_selector::supported_names): New function.
14673         (Target_selector::bfd_name): New function.
14674         (Target_selector::do_instantiate_target): New pure virtual
14675         function.
14676         (Target_selector::do_recognize): New virtual function.
14677         (Target_selector::do_recognize_by_name): New virtual function.
14678         (Target_selector::instantiate_target): New private function.
14679         (supported_target_names): Declare.
14680         * target-select.cc (Target_selector::Target_selector): Update for
14681         new parameter and fields.
14682         (select_target_by_name): Check that the name matches before
14683         calling recognize_by_name.
14684         (supported_target_names): New function.
14685         * i386.cc (class Target_selector_i386): Update Target_selector
14686         constructor call.  Remove recognize and recognize_by_name.  Add
14687         do_instantiate_target.
14688         * x86_64.cc (class Target_selector_x86_64): Likewise.
14689         * testsuite/testfile.cc (class Target_selector_test): Update for
14690         changes to Target_selector.
14691
14692         * README: Rewrite, with some notes on unsupported features.
14693
14694 2008-03-24  Cary Coutant  <ccoutant@google.com>
14695
14696         * i386.cc (Target_i386::Got_type): New enum declaration.
14697         (Target_i386::Scan::local): Updated callers of Output_data_got
14698         member functions.
14699         (Target_i386::Scan::global): Likewise.
14700         (Target_i386::Relocate::relocate): Likewise.
14701         (Target_i386::Relocate::relocate_tls): Likewise.
14702         * object.h (Got_offset_list): New class.
14703         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14704         (Sized_relobj::local_got_offset): Likewise.
14705         (Sized_relobj::set_local_got_offset): Likewise.
14706         (Sized_relobj::local_has_tls_got_offset): Removed.
14707         (Sized_relobj::local_tls_got_offset): Removed.
14708         (Sized_relobj::set_local_tls_got_offset): Removed.
14709         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14710         * output.cc (Output_data_got::add_global): Added got_type parameter.
14711         (Output_data_got::add_global_with_rel): Likewise.
14712         (Output_data_got::add_global_with_rela): Likewise.
14713         (Output_data_got::add_global_pair_with_rel): New function.
14714         (Output_data_got::add_global_pair_with_rela): New function.
14715         (Output_data_got::add_local): Added got_type parameter.
14716         (Output_data_got::add_local_with_rel): Likewise.
14717         (Output_data_got::add_local_with_rela): Likewise.
14718         (Output_data_got::add_local_pair_with_rel): New function.
14719         (Output_data_got::add_local_pair_with_rela): New function.
14720         (Output_data_got::add_global_tls): Removed.
14721         (Output_data_got::add_global_tls_with_rel): Removed.
14722         (Output_data_got::add_global_tls_with_rela): Removed.
14723         (Output_data_got::add_local_tls): Removed.
14724         (Output_data_got::add_local_tls_with_rel): Removed.
14725         (Output_data_got::add_local_tls_with_rela): Removed.
14726         * output.h (Output_data_got::add_global): Added got_type parameter.
14727         (Output_data_got::add_global_with_rel): Likewise.
14728         (Output_data_got::add_global_with_rela): Likewise.
14729         (Output_data_got::add_global_pair_with_rel): New function.
14730         (Output_data_got::add_global_pair_with_rela): New function.
14731         (Output_data_got::add_local): Added got_type parameter.
14732         (Output_data_got::add_local_with_rel): Likewise.
14733         (Output_data_got::add_local_with_rela): Likewise.
14734         (Output_data_got::add_local_pair_with_rel): New function.
14735         (Output_data_got::add_local_pair_with_rela): New function.
14736         (Output_data_got::add_global_tls): Removed.
14737         (Output_data_got::add_global_tls_with_rel): Removed.
14738         (Output_data_got::add_global_tls_with_rela): Removed.
14739         (Output_data_got::add_local_tls): Removed.
14740         (Output_data_got::add_local_tls_with_rel): Removed.
14741         (Output_data_got::add_local_tls_with_rela): Removed.
14742         * resolve.cc (Symbol::override_base_with_special): Removed
14743         reference to has_got_offset_ field.
14744         * symtab.cc (Symbol::init_fields): Replaced initialization
14745         of got_offset_ with got_offsets_.  Removed initialization
14746         of has_got_offset_
14747         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14748         (Symbol::got_offset): Likewise.
14749         (Symbol::set_got_offset): Likewise.
14750         (Symbol::has_tls_got_offset): Removed.
14751         (Symbol::tls_got_offset): Removed.
14752         (Symbol::set_tls_got_offset): Removed.
14753         (Symbol::got_offset_): Removed.
14754         (Symbol::tls_mod_got_offset_): Removed.
14755         (Symbol::tls_pair_got_offset_): Removed.
14756         (Symbol::got_offsets_): New field.
14757         (Symbol::has_got_offset): Removed.
14758         (Symbol::has_tls_mod_got_offset): Removed.
14759         (Symbol::has_tls_pair_got_offset): Removed.
14760         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14761         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14762         member functions.
14763         (Target_x86_64::Scan::global): Likewise.
14764         (Target_x86_64::Relocate::relocate): Likewise.
14765         (Target_x86_64::Relocate::relocate_tls): Likewise.
14766
14767 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14768
14769         * yyscript.y: Fix spelling error in comment.
14770
14771 2008-03-24  Ian Lance Taylor  <iant@google.com>
14772
14773         * options.h (class General_options): Define build_id option.
14774         * layout.h (class Layout): Declare write_build_id, create_note,
14775         create_build_id.  Add build_id_note_ member.
14776         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14777         "libiberty.h", "md5.h", "sha1.h".
14778         (Layout::Layout): Initialize eh_frame_data_,
14779         eh_frame_hdr_section_, and build_id_note_.
14780         (Layout::finalize): Call create_build_id.
14781         (Layout::create_note): New function, broken out of
14782         Layout::create_gold_note.
14783         (Layout::create_gold_note): Call create_note.
14784         (Layout::create_build_id): New function.
14785         (Layout::write_build_id): New function.
14786         (Close_task_runner::run): Call write_build_id.
14787
14788         * x86_64.cc: Correct license to GPLv3.
14789
14790 2008-03-23  Ian Lance Taylor  <iant@google.com>
14791
14792         * options.cc: Include "demangle.h".
14793         (parse_optional_string): New function.
14794         (parse_long_option): Handle takes_optional_argument.
14795         (parse_short_option): Update dash_z initializer.  Handle
14796         takes_optional_argument.
14797         (General_options::General_options): Initialize do_demangle_.
14798         (General_options::finalize): Set do_demangle_.  Handle demangling
14799         style.
14800         * options.h (parse_optional_string): Declare.
14801         (struct One_option): Add optional_arg field.  Update constructor.
14802         Update call constructor calls.  Add takes_optional_argument
14803         function.
14804         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14805         (DEFINE_optional_string): Define.
14806         (General_options::demangle): Change from DEFINE_bool to
14807         DEFINE_optional_string.
14808         (General_options::no_demangle): New function.
14809         (General_options::do_demangle): New function.
14810         (General_options::set_do_demangle): New function.
14811         (General_options::execstack_status_): Move definition to end of
14812         class definition.
14813         (General_options::static_): Likewise.
14814         (General_options::do_demangle_): New field.
14815         * object.cc (big_endian>::get_symbol_location_info): Call
14816         Options::do_demangle, not Options::demangle.
14817         * symtab.cc (demangle): Likewise.
14818
14819 2008-03-22  Ian Lance Taylor  <iant@google.com>
14820
14821         * gold.h: Include <cstddef> and <sys/types.h>
14822         * options.h: Include <cstring>.
14823
14824 2008-03-21  Ian Lance Taylor  <iant@google.com>
14825
14826         * Added source code to GNU binutils.
14827 \f
14828 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14829
14830 Copying and distribution of this file, with or without modification,
14831 are permitted in any medium without royalty provided the copyright
14832 notice and this notice are preserved.
14833
14834 Local Variables:
14835 mode: change-log
14836 left-margin: 8
14837 fill-column: 74
14838 version-control: never
14839 End: