gold/
[external/binutils.git] / gold / ChangeLog
1 2013-06-14  Cary Coutant  <ccoutant@google.com>
2
3         * resolve.cc (Symbol::override_base): Don't override st_type
4         from plugin placeholder symbols.
5         (Symbol_table::resolve): Likewise.
6         (Symbol_table::should_override): Don't complain about TLS mismatch
7         if the TO symbol is a plugin placeholder.
8         * testsuite/Makefile.am (plugin_test_tls): New test.
9         * testsuite/Makefile.in: Regenerate.
10         * testsuite/plugin_test_tls.sh: New test script.
11         * testsuite/two_file_test_2_tls.cc: New test source.
12         * testsuite/two_file_test_tls.cc: New test source.
13
14 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
15
16         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
17         the maximum segment alignment is larger than the page size.
18         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
19         correctly aligns the symbols with large alignemnt.
20         * testsuite/Makefile.in: Regenerate.
21         * testsuite/large_symbol_alignment.cc: New file.
22
23 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
24             Sriraman Tallam  <tmsriram@google.com>
25
26         * options.h (sort_section): New option.
27         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
28         Rename from Input_section_sort_section_name_special_ordering_compare.
29         (Input_section_sort_section_name_compare): New struct.
30         * output.cc (Output_section::Input_section_sort_section_name_compare::
31         operator()): New function.
32         (Output_section::sort_attached_input_sections): Use new sort function
33         for .text if --sort-section=name is specified.
34         * layout.cc (Layout::make_output_section):
35         Add sorting by name when --sort-section=name is specified.
36         * testsuite/Makefile.am (text_section_grouping): Test option
37         --sort-section=name.
38         * testsuite/Makefile.in: Regenerate.
39         * testsuite/section_sorting_name.cc: New file.
40         * testsuite/section_sorting_name.sh: New file.
41
42 2013-05-21  Cary Coutant  <ccoutant@google.com>
43
44         * symtab.h (Symbol::is_cxx_vtable): New function.
45         * target-reloc.h (relocate_section): Check for vtable symbol.
46         * testsuite/Makefile.am (missing_key_func.sh): New test case.
47         * testsuite/Makefile.in: Regenerate.
48         * testsuite/missing_key_func.cc: New test source.
49         * testsuite/missing_key_func.sh: New test script.
50
51 2013-05-21  Cary Coutant  <ccoutant@google.com>
52
53         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
54         type of enclosing symbol.
55         (Relocate_info::location): Check symbol type when describing symbol.
56         * object.h (Symbol_location_info): Remove unused line_number;
57         add enclosing_symbol_type.
58         * testsuite/debug_msg.sh: Adjust expected output.
59
60 2013-05-13  Cary Coutant  <ccoutant@google.com>
61
62         * configure.ac: Export DEFAULT_TARGET.
63         * configure: Regenerate.
64         * Makefile.in: Regenerate.
65         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
66         * testsuite/Makefile.in: Regenerate.
67         * testsuite/debug_msg.sh: Delete duplicate tests.
68         Don't check undef_int error message match for powerpc where the
69         source file and line number aren't available.
70
71 2013-05-10  Roland McGrath  <mcgrathr@google.com>
72
73         * options.h (General_options): Add --rosegment-gap option.
74         * options.cc (finalize): --rosegment-gap implies --rosegment.
75         * layout.cc (set_segment_offsets): Let user option override
76         target->rosegment_gap().
77
78 2013-05-10  Roland McGrath  <mcgrathr@google.com>
79
80         * options.h (General_options): Remove leading space from help
81         messages for -nostdlib and --rosegment.
82
83 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
84
85         PR ld/15365
86         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
87
88 2013-05-03  Alan Modra  <amodra@gmail.com>
89
90         * merge.cc (Output_merge_string::do_add_input_section): Correct
91         scan for number of strings.  Rename vars to avoid shadowing.
92         Include missing terminator in input_size_.
93
94 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
95
96         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
97         Restore empty string handling.
98
99 2013-05-01  Cary Coutant  <ccoutant@google.com>
100
101         * stringpool.cc (Stringpool_template::new_key_offset): Fix
102         uninitialized warning.
103
104 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
105
106         * output.cc (Output_section::add_merge_input_section): Allow
107         to merge sections if the alignment is more than character size.
108         * merge.h (Output_merge_string::Output_merge_string): Remove
109         assert.
110         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
111         only not-null strings. Check the alignment of strings.
112         * stringpool.h
113         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
114         alignment as the argument.
115         (Stringpool_template<Stringpool_char>::addralign_): New class member.
116         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
117         Align non-zero length strings according to the addralign_.
118         (Stringpool_template<Stringpool_char>::set_string_offsets):
119         Updating offsets according to the given alignment.
120         * testsuite/Makefile.am (text_section_grouping): Test if string
121         literals are getting merged.
122         * testsuite/Makefile.in: Regenerate.
123         * testsuite/merge_string_literals_1.c: New file.
124         * testsuite/merge_string_literals_2.c: Ditto.
125         * testsuite/merge_string_literals.sh: Ditto.
126
127 2013-04-26  Ian Lance Taylor  <iant@google.com>
128
129         * target-reloc.h (relocate_section): If the reloc offset is out of
130         range, pass VIEW as NULL to relocate.relocate.
131         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
132         * i386.cc (Target_i386::Relocate::relocate): Likewise.
133         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
134         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
135         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
136         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
137
138 2013-04-26  Geoff Pike  <gpike@chromium.org>
139
140         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
141         * layout.cc (Hash_task): New class.
142         (Layout::queue_build_id_tasks): New function.
143         (Layout::write_build_id): Handle single-thread portion of build ID
144         computation.  (In some cases, all of it is single-threaded.)  Replace
145         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
146         functionality in fewer lines of code.
147         * layout.h (Layout::queue_build_id_tasks): New function declaration.
148         * options.h (General_options): make "--build-id" default to tree
149         rather than sha1.  Add two new options related to --build-id=tree:
150         --build-id-chunk-size-for-treehash and
151         --build-id-min-file-size-for-treehash.
152         * Makefile.am: add testing of --build-id=tree and related new options
153         (these tests will be invoked by "make check").
154         * Makefile.in: Regenerate.
155
156 2013-04-25  Alan Modra  <amodra@gmail.com>
157
158         * configure.tgt: Add powerpcle and powerpc64le.
159
160 2013-04-22  Alan Modra  <amodra@gmail.com>
161
162         PR gold/15355
163         * layout.cc (Layout::segment_precedes): Allow more than one
164         segment with the same type and flags.
165
166 2013-04-15  Cary Coutant  <ccoutant@google.com>
167
168         * layout.cc (Layout::set_relocatable_section_offsets): Don't
169         allocate space in file for BSS sections.
170
171 2013-04-15  Cary Coutant  <ccoutant@google.com>
172
173         * script-sections.cc (Orphan_output_section): Reset address
174         to zero after each orphaned section for relocatable links.
175
176 2013-04-15  Cary Coutant  <ccoutant@google.com>
177
178         * symtab.cc (Symbol_table::sized_write_globals): Subtract
179         section starting address for relocatable link.
180         * testsuite/Makefile.am (script_test_11): New test.
181         * testsuite/Makefile.in: Regenerate.
182         * testsuite/script_test_11.c: New source file.
183         * testsuite/script_test_11.t: New linker script.
184
185 2013-04-13  Alan Modra  <amodra@gmail.com>
186
187         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
188         owner when sections are not adjacent and exceed group size.
189         (Target_powerpc::group_sections): Handle corner case.
190         (Target_powerpc::Branch_info::make_stub): Handle case where
191         stub table doesn't exist due to branches in non-exec sections.
192         (Target_powerpc::Relocate::relocate): Likewise.
193
194 2013-04-11  Alan Modra  <amodra@gmail.com>
195
196         PR gold/15354
197         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
198         .branch_lt to match bfd ld.  Adjust comments throughout file.
199
200 2013-04-04  Ian Lance Taylor  <iant@google.com>
201
202         GCC PR c++/56840
203         * object.cc (do_layout_deferred_sections): Handle .eh_frame
204         sections before checking whether they are included in the link.
205
206 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
207
208         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
209         object before calling the plugin claim_file handler.  Pass the elf
210         object of the archive to the plugin. Delete the elf object if the
211         plugin claims the file.
212
213 2013-03-21  Alan Modra  <amodra@gmail.com>
214
215         * layout.cc (Layout::set_segment_offsets): Accept writable .text
216         segment when omagic.
217
218 2013-03-21  Alan Modra  <amodra@gmail.com>
219
220         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
221         comparison warning.
222         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
223         uninitialized" warning.
224
225 2013-03-20  Alan Modra  <amodra@gmail.com>
226
227         * symtab.h (Symbol::clear_version): New function.
228         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
229         is_needed by weak references.  Clear version for symbols defined
230         in as-needed objects that are not needed.
231
232 2013-03-15  Alan Modra  <amodra@gmail.com>
233
234         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
235         static and public.  Add report_err param.  Return false for data refs.
236         (Target_powerpc::rela_dyn_section): New overloaded function.
237         (Target_powerpc::plt_, iplt_): Elucidate.
238         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
239         (Output_data_plt_powerpc::do_write): Don't write .iplt.
240         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
241         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
242         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
243         push_branch and make_plt_entry for ifunc syms when
244         reloc_needs_plt_for_ifunc.
245         (Target_powerpc::Relocate::relocate): Don't use plt entry value
246         for ifunc unless reloc_needs_plt_for_ifunc.
247
248 2013-03-15  Alan Modra  <amodra@gmail.com>
249
250         * gc.h (gc_process_relocs): Don't look through function descriptors.
251         * icf.cc (get_section_contents): Do so here instead.
252
253 2013-03-13  Alan Modra  <amodra@gmail.com>
254
255         * powerpc.cc (is_branch_reloc): Forward declare.
256         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
257         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
258         false for 64-bit, true for 32-bit non-branch relocs.
259         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
260         * testsuite/Makefile.am (icf_test): Use linker map file instead of
261         nm output.
262         (icf_safe_test): Generate linker map file as well as nm output.
263         (icf_safe_so_test): Likewise.
264         * testsuite/Makefile.in: Regenerate.
265         * testsuite/icf_test.sh: Parse linker map file to determine
266         section folding.
267         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
268         * testsuite/icf_safe_so_test.sh: Likewise.
269         (X86_32_or_ARM_specific_safe_fold): Merge into..
270         (arch_specific_safe_fold): ..this.
271         (X86_64_specific_safe_fold): Delete unused function.
272
273 2013-03-12  Alan Modra  <amodra@gmail.com>
274
275         * gc.h (gc_process_relocs): Look through function descriptors
276         to determine shndx, symvalue and addend used by ICF.  Tidy
277         variable duplication.
278
279 2013-03-11  Alan Modra  <amodra@gmail.com>
280
281         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
282         * layout.cc (Layout_task_runner::run): ..to here.
283         * symtab.h (struct Symbol_location): Extract from..
284         (class Symbol_table): ..here.
285         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
286         * target.h (class Target): Add function_location and
287         do_function_location functions.
288         (class Sized_target): Add do_function_location.
289         * object.h (class Sized_relobj_file): Move find_shdr..
290         (class Object): ..to here.
291         * object.cc: Likewise.  Update to suit.  Instantiate.
292         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
293         * powerpc.cc (class Powerpc_dynobj): New.
294         (Target_powerpc::do_function_location): New function.
295         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
296         (Powerpc_dynobj::do_read_symbols): New function.
297         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
298
299 2013-03-08  Ian Lance Taylor  <iant@google.com>
300
301         * options.cc (General_options::string_to_object_format): Accept
302         "default".
303
304 2013-03-08  Alan Modra  <amodra@gmail.com>
305
306         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
307         pointer to Post_fde.
308         (struct Post_fde): Move definition to here..
309         * ehframe.cc (struct Post_fde): ..from here.
310         (Cie::write): Don't alloc Post_fde.
311         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
312
313 2013-03-07  Alan Modra  <amodra@gmail.com>
314
315         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
316         relocation referencing .LC0.
317         * testsuite/discard_locals_test.sh: Remove FIXMEs.
318
319 2013-03-07  Alan Modra  <amodra@gmail.com>
320
321         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
322         always_inline.  Add assembly for powerpc to avoid GOT.
323
324 2013-03-07  Alan Modra  <amodra@gmail.com>
325
326         * testsuite/script_test_10.sh: Don't test .bss section
327         header number.
328
329 2013-03-06  Alan Modra  <amodra@gmail.com>
330
331         * powerpc.cc (class Powerpc_relobj): Move some member functions.
332         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
333         all callers.  Handle folded sections.
334         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
335         to Powerpc_relobj.
336         (Global_symbol_visitor_opd::operator()): Likewise.
337
338 2013-03-04  Alan Modra  <amodra@gmail.com>
339
340         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
341         * testsuite/Makefile.in: Regenerate.
342
343 2013-03-01  Cary Coutant  <ccoutant@google.com>
344
345         Add dwp support for v2 DWARF package file format.
346         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
347         tu_length parameter.  Adjust all callers.
348         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
349         * dwp.cc: Include dwarf.h.
350         (Section_bounds): New struct type.
351         (Unit_set): New struct type.
352         (Dwo_file::Dwo_file): Initialize new data member.
353         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
354         Combine and rename to...
355         (Dwo_file::read_unit_index): ...this.
356         (Dwo_file::sized_read_compunit_index)
357         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
358         (Dwo_file::sized_read_unit_index): ...this.
359         (Dwo_file::copy_section): Remove section_name, is_str_offsets
360         parameters; add section_id parameter.
361         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
362         (Dwo_file::add_unit_set): ...this.
363         (Dwo_file::shndx_map_): Remove.
364         (Dwo_file::sect_offsets_): New data member.
365         (Dwp_output_file::Dwp_output_file): Initialize new data members.
366         (Dwp_output_file::add_section): Rename to...
367         (Dwp_output_file::add_contribution): ...this.
368         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
369         (Dwp_output_file::add_tu_set): Likewise.
370         (Dwp_output_file::Contribution): New type.
371         (Dwp_output_file::Section::contributions): New data member.
372         (Dwp_output_file::Cu_or_tu_set): Remove.
373         (Dwp_output_file::Section::Section): New ctor.
374         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
375         (Dwp_output_file::Dwp_index::Section_table): New type.
376         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
377         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
378         parameter.
379         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
380         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
381         (Dwp_output_file::Dwp_index::section_table): New member function.
382         (Dwp_output_file::Dwp_index::section_table_end): New member function.
383         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
384         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
385         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
386         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
387         (Dwp_output_file::Dwp_index::section_table_): New data member.
388         (Dwp_output_file::Dwp_index::section_mask_): New data member.
389         (Dwp_output_file::add_output_section): New member function.
390         (Dwp_output_file::write_new_section): New member function.
391         (Dwp_output_file::write_contributions): New member function.
392         (Dwp_output_file::section_id_map_): New data member.
393         (class Dwo_id_info_reader): Remove.
394         (class Unit_reader): New class.
395         (get_dwarf_section_name): New function.
396         (Dwo_file::read_executable): Adjust initializations of class data.
397         (Dwo_file::read): Add support for v2 package file format.
398         (Dwo_file::read_unit_index): Likewise.
399         (Dwo_file::sized_read_unit_index): Likewise.
400         (Dwo_file::copy_section): Likewise.
401         (Dwo_file::add_unit_set): Likewise.
402         (Dwp_output_file::add_output_section): Likewise.
403         (Dwp_output_file::add_contribution): Likewise.
404         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
405         for empty slot.
406         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
407         file format.
408         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
409         slot.
410         (Dwp_output_file::initialize): Remove unused function.
411         (Dwp_output_file::finalize): Add support for v2 package file format.
412         (Dwp_output_file::write_index): Likewise.
413         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
414         function prototype.
415
416 2013-03-01  Cary Coutant  <ccoutant@google.com>
417
418         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
419         function into class definition in header file.
420         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
421         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
422         New function.
423         (Dwarf_info_reader::check_buffer): Move here from .cc file.
424
425 2013-02-28  Alan Modra  <amodra@gmail.com>
426
427         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
428         * target.cc (Target::do_plt_fde_location): New function.
429         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
430         accessor function, and constructor param.
431         (struct Post_fde, Post_fdes): Declare.
432         (Cie::write): Add post_fdes param.
433         * ehframe.cc (Fde::write): Use plt_fde_location.
434         (struct Post_fde): Define.
435         (Cie::write): Stash FDEs added post merge mapping.
436         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
437         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
438         (Eh_frame::do_sized_write): Arrange to write post map FDES after
439         other FDEs.
440         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
441         (Target_powerpc::has_glink): New function.
442         (Target_powerpc::do_relax): Add eh_frame info for stubs.
443         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
444         glink_eh_frame_fde_32, default_fde): New data.
445         (Stub_table::eh_frame_added_): New var.
446         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
447         Make const.
448         (Stub_table::add_eh_frame): New function.
449         (Output_data_glink::add_eh_frame): New function.
450         (Target_powerpc::make_glink_section): Call add_eh_frame.
451
452 2013-02-15  Ian Lance Taylor  <iant@google.com>
453
454         * options.h (DEFINE_uint64_alias): Define.
455         (class General_options): Add -Ttext-segment as an alias for
456         -Ttext.
457
458 2013-02-15  Alan Modra  <amodra@gmail.com>
459
460         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
461         (Stub_table::do_write): ..here, two places.
462         (Stub_table::plt_call_size): Use it here too.
463
464 2013-02-11  Ian Lance Taylor  <iant@google.com>
465
466         * descriptors.cc (Descriptors::close_all): New function.
467         * descriptors.h (class Descriptors): Declare close_all.
468         (close_all_descriptors): New inline function.
469         * plugin.cc: Include "descriptors.h".
470         (Plugin_manager::cleanup): Call close_all_descriptors.
471
472 2013-02-06  Alan Modra  <amodra@gmail.com>
473
474         * README: Update coding style link.
475
476 2013-01-28  Cary Coutant  <ccoutant@google.com>
477
478         * dwp.cc (File_list): New typedef.
479         (Dwo_name_info_reader): New class.
480         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
481         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
482         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
483         (Dwo_file::read_executable): New function.
484         (Dwo_file::read): Move common setup code to ...
485         (Dwo_file::make_object): ... here.
486         (dwp_options): Add --exec/-e.
487         (usage): Likewise.
488         (main): Likewise.
489
490 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
491
492         * layout.cc (Layout::layout): Check for option text_reorder.
493         (Layout::make_output_section): Ditto.
494         * options.h (text_reorder): New option.
495         * output.cc (Input_section_sort_compare): Remove special ordering
496         of section names.
497         (Output_section::
498          Input_section_sort_section_name_special_ordering_compare::
499          operator()): New function.
500         (Output_section::sort_attached_input_sections): Use new sort function
501         for .text.
502         * output.h (Input_section_sort_section_name_special_ordering_compare):
503         New struct.
504         * testsuite/Makefile.am (text_section_grouping): Test option
505         --no-text-reorder
506         * testsuite/Makefile.in: Regenerate.
507         * testsuite/text_section_grouping.sh: Check order of functions without
508         default text reordering.
509
510 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
511
512         * options.h (General_options): Change default to true for new_dtags.
513
514 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
515
516         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
517         when enable_new_dtags is false.  Only add DT_RUNPATH when
518         enable_new_dtags is true.
519
520 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
521
522         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
523         used in declaration and definition consistent.
524         (Target_powerpc::symval_for_branch): Ditto.
525
526 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
527
528         * testsuite/plugin_final_layout.cc: Fix comment.
529
530 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
531
532         * layout.cc (Layout::layout): Do not do default sorting for
533         text sections when section ordering is specified.
534         (make_output_section): Ditto.
535         * testsuite/plugin_final_layout.cc: Name the function sections
536         to catch reordering issues.
537
538 2013-01-15  Alan Modra  <amodra@gmail.com>
539
540         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
541         plt-thread-safe.
542
543 2013-01-15  Alan Modra  <amodra@gmail.com>
544
545         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
546         * testsuite/Makefile.in: Regenerate.
547
548 2013-01-14  Alan Modra  <amodra@gmail.com>
549
550         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
551         * testsuite/Makefile.in: Regenerate.
552
553 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
554
555         PR bfd/14430
556         Fix mingw gold build with plugins enabled
557         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
558         * configure.ac: Export DLOPEN_LIBS and add headers check.
559         * plugin.cc: Handle non-dlfcn case.
560         * Makefile.in: Regenerate.
561         * config.in: Regenerate.
562         * configure: Regenerate.
563         * testsuite/Makefile.in: Regenerate.
564
565 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
566
567         * output.h (sort_attached_input_sections): Change to be public.
568         * script-sections.cc
569         (Output_section_definition::set_section_addresses): Sort
570         attached input sections according to section order before linker
571         script assigns section addresses.
572         (Orphan_output_section::set_section_addresses): Sort
573         attached input sections according to section order before linker
574         script assigns section addresses.
575         * Makefile.am (final_layout.sh): Use a simple linker script to
576         check if section ordering still works.
577         * Makefile.in: Regenerate.
578
579 2013-01-09  Ben Cheng  <bccheng@google.com>
580
581         * arm.cc (Target_arm::attributes_accept_div): New function.
582         (Target_arm::attributes_forbid_div): New function.
583         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
584         attribute using the same new functions as what bfd/elf32_arm.c
585         does.
586
587 2013-01-07  Cary Coutant  <ccoutant@google.com>
588
589         PR gold/14993
590         * output.cc (Output_section::add_input_section): For incremental
591         updates, don't track input sections that are allocated from patch
592         space.
593
594 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
595             Ian Lance Taylor  <iant@google.com>
596
597         PR gold/14897
598         * configure.ac (--enable-ld): Removed.
599         (install_as_default): Set to yes only for --enable-gold=default
600         or --disable-ld.
601         * configure: Regenerated.
602
603 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
604
605         * options.h (General_options): Add -fuse-ld= for GCC linker
606         option compatibility.
607
608 2013-01-04  Cary Coutant  <ccoutant@google.com>
609
610         * configure.ac: Fix typo restoring CXXFLAGS.
611         * configure: Regenerate.
612
613 2013-01-04  Cary Coutant  <ccoutant@google.com>
614
615         * testsuite/Makefile.am (CXXLINK_S): New macro.
616         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
617         * testsuite/Makefile.in: Regenerate.
618
619 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
620
621         * version.cc (print_version): Update copyright year to 2013.
622
623 2012-12-20  Ian Lance Taylor  <iant@google.com>
624
625         * layout.cc (Layout::special_ordering_of_input_section): New
626         function.
627         (Layout::layout): If input section requires special ordering, must
628         sort input sections.
629         (Layout::make_output_section): May sort .text input sections.
630         (Layout::is_section_name_prefix_grouped): Remove.
631         * layout.h (class Layout): Declare
632         special_ordering_of_input_section.  Don't declare
633         is_section_name_prefix_grouped.
634         * output.cc (Output_section::add_input_section): Revert last
635         change.
636         (Output_section::Input_section_sort::match_file_name): Don't crash
637         if called on output section data.
638         (Output_section::Input_section_sort_compare): Sort based on
639         special ordering.
640         (Output_section::Input_section_sort_section_order_index_compare):
641         Revert last patch.
642         (Output_section::sort_attached_input_sections): Likewise.
643
644 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
645
646         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
647         * layout.h (Layout::is_section_name_prefix_grouped): New function.
648         * output.cc (Output_section::add_input_section): Check if section
649         name contains special prefix.  Keep input sections to sort such
650         sections.
651         (Output_section::Input_section_sort_section_order_index_compare
652          ::operator()): Group sections according to prefixes.
653         (Output_section::sort_attached_input_sections): Add condition to
654         Input_section_entry constructor call.
655         * testsuite/Makefile.am (text_section_grouping): New test.
656         * testsuite/Makefile.in: Regenerate.
657         * testsuite/text_section_grouping.cc: New file.
658         * testsuite/text_section_grouping.sh: New file.
659
660 2012-12-17  Nick Clifton  <nickc@redhat.com>
661
662         * Makefile.am: Add copyright notice.
663         * NEWS: Likewise.
664         * README: Likewise.
665         * configure.ac: Likewise.
666         * ftruncate.c: Likewise.
667         * Makefile.in: Regenerate.
668
669 2012-12-14  Cary Coutant  <ccoutant@google.com>
670
671         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
672         --no-as-needed flag.
673         (exception_separate_shared_12_test): Likewise.
674         (incremental_copy_test): Likewise.
675         * testsuite/Makefile.in: Regenerate.
676
677 2012-12-14  Cary Coutant  <ccoutant@google.com>
678
679         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
680         (Dwp_output_file::Dwp_index::enter_set): Add assert.
681
682 2012-12-12  Alan Modra  <amodra@gmail.com>
683
684         * powerpc.cc (class Track_tls): New.
685         (class Relocate, class Scan): Inherit Track_tls.
686         (Target_powerpc::Scan::local, global): Track tls optimization
687         and avoid creating plt entry for __tls_get_addr if all uses
688         are optimized away.
689         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
690
691 2012-12-12  Alan Modra  <amodra@gmail.com>
692
693         * options.h (General_options): Add --toc-sort/--no-toc-sort.
694         Replace no_toc_optimize with toc_optimize.
695         * output.h (Output_section::input_sections): Provide non-const variant.
696         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
697         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
698         accessors.
699         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
700         (class Sort_toc_sections): New.
701         (Target_powerpc::do_finalize_sections): Sort toc sections.
702         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
703
704 2012-12-10  Roland McGrath  <mcgrathr@google.com>
705
706         * testsuite/binary_unittest.cc (read_all): New function.
707         (Sized_binary_test): Use it instead of ::read.
708         * fileread.cc (do_read): Don't assume pread always reads the whole
709         amount in a single call.
710
711 2012-12-10  Alan Modra  <amodra@gmail.com>
712
713         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
714         Set EM_PPC64 or EM_PPC here.
715         (Target_selector_powerpc::do_recognize): Delete.
716
717 2012-12-10  Alan Modra  <amodra@gmail.com>
718
719         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
720         stub_table_.
721         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
722
723 2012-12-07  Roland McGrath  <mcgrathr@google.com>
724
725         * testsuite/binary_unittest.cc (Sized_binary_test):
726         Use open_descriptor rather than ::open.
727
728 2012-12-07  Alan Modra  <amodra@gmail.com>
729
730         * powerpc.cc (Stub_table::do_write): Delete redundant Address
731         typedef and invalid_address constant.
732         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
733         instantiate constants.
734
735 2012-12-06  Roland McGrath  <mcgrathr@google.com>
736
737         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
738         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
739         * aclocal.m4: Regenerate.
740         * configure: Regenerate.
741         * Makefile.in: Regenerate.
742         * testsuite/Makefile.in: Regenerate.
743
744 2012-12-07  Alan Modra  <amodra@gmail.com>
745
746         * options.h (General_options): Add no_toc_optimize.
747         * powerpc.cc (ok_lo_toc_insn): New function.
748         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
749
750 2012-12-06  Alan Modra  <amodra@gmail.com>
751
752         * options.h (General_options): Add plt_align, plt_static_chain,
753         plt_thread_safe.  Update stub_group_size help text.
754         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
755         for new plt_thread_safe_ var.
756         (use_plt_offset): Correct comments.
757         (Target_powerpc::do_relax): Look for thread creation symbols to
758         determine default plt_thread_safe value.  Clear plt call stubs
759         as well as branch stubs each iteration.
760         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
761         insn constants.
762         (l, hi, ha, write_insn): Move earlier.
763         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
764         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
765         plt stubs too.
766         (Stub_table::update_size): Adjust.
767         (Stub_table::prev_size, set_prev_size): Delete.
768         (Stub_table::stub_align): Let --plt-align affect result.
769         (Stub_table::plt_call_size): Calculate sizes for various stubs.
770         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
771         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
772         (Stub_table::do_write): Support more stub variants.
773
774 2012-12-04  Alan Modra  <amodra@gmail.com>
775
776         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
777         (Target_powerpc::do_define_standard_symbols): New function.
778
779 2012-12-03  Alan Modra  <amodra@gmail.com>
780
781         * output.h: Formatting, whitespace.
782
783 2012-12-03  Alan Modra  <amodra@gmail.com>
784
785         * layout.h (Layout::get_executable_sections): Declare.
786         * layout.cc (Layout::get_executable_sections): New function.
787         * arm.cc (Target_arm::group_sections): Use it.
788         (Arm_output_section::group_sections): Delete now redundant test.
789         * output.cc (Output_reloc::Output_reloc): Add is_relative.
790         param to handle relative relocs.
791         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
792         (Output_data_reloc::add_absolute): Adjust.
793         (Output_data_reloc::add_relative): New function.
794         (Output_data::reset_data_size): New function.
795         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
796         (Output_section::set_addralign): New function.
797         (Output_section::checkpoint_set_addralign): New function.
798         (Output_section::clear_section_offsets_need_adjustment): New function.
799         (Output_section::input_sections): Make public.
800         * powerpc.cc (class Output_data_brlt_powerpc): New.
801         (class Stub_table, class Stub_control): New.
802         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
803         stub_table_, set_stub_table, stub_table): New vectors and accessor
804         functions.
805         (Target_powerpc::do_may_relax, do_relax, push_branch,
806         new_stub_table, stub_tables, brlt_section, group_sections,
807         add_branch_lookup_table, find_branch_lookup_table,
808         write_branch_lookup_table, make_brlt_section): New functions.
809         (Target_powerpc::struct Sort_sections, class Branch_info): New.
810         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
811         branch_info_): New vars.
812         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
813         make call stubs here.
814         (Output_data_glink): Remove all call stub handling from this class.
815         (Target_powerpc::Scan::local, global): Save interesting branch
816         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
817         (Target_powerpc::do_finalize_sections): Only make reg save/restore
818         functions on final link.
819         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
820         Handle long branch destinations too.
821         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
822         do_plt_address_for_local): Adjust lookup of plt call stubs.
823
824 2012-11-30  Alan Modra  <amodra@gmail.com>
825
826         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
827         relocs against protected symbols when building 32-bit shared libs.
828
829 2012-11-30  Alan Modra  <amodra@gmail.com>
830
831         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
832         param.  Call got_section() to make .got.  Update all callers
833         and their callers and so on.
834
835 2012-11-30  Alan Modra  <amodra@gmail.com>
836
837         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
838         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
839         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
840         value if it already exists.
841
842 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
843
844         PR gold/14858
845         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
846
847 2012-11-14  Roland McGrath  <mcgrathr@google.com>
848
849         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
850         than bfc instruction for data sandboxing.
851
852 2012-11-08  Alan Modra  <amodra@gmail.com>
853
854         * po/POTFILES.in: Regenerate.
855
856 2012-11-05  Alan Modra  <amodra@gmail.com>
857
858         * configure.ac: Apply 2012-09-10 change to config.in here.
859         * configure: Regenerate.
860
861 2012-11-05  Alan Modra  <amodra@gmail.com>
862
863         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
864         (struct Opd_ent): Use "Address" rather than "Offset".
865         (Output_data_got_powerpc::got_base_offset): Return Valtype.
866         (Target_powerpc::got_section): Make public.
867         (Target_powerpc::scan_relocs): Move code setting symbols..
868         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
869         Create _SDA_BASE_ only when referenced.
870
871 2012-11-02  Roland McGrath  <mcgrathr@google.com>
872
873         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
874         from last change.
875
876 2012-11-01  Roland McGrath  <mcgrathr@google.com>
877
878         * target.h (Sized_target::relocate_relocs): Use Elf_Off
879         for offset_in_output_section parameter.
880         (Sized_target::relocate_special_relocatable): Likewise.
881         * arm.cc (Target_arm::relocate_relocs): Likewise.
882         (Target_arm::relocate_special_relocatable): Likewise.
883         * i386.cc (Target_i386::relocate_relocs): Likewise.
884         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
885         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
886         * target-reloc.h (relocate_relocs): Likewise.
887         * testsuite/testfile.cc (Target_test): Likewise.
888         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
889         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
890
891         * system.h: Move inclusion of <clocale> to after <libintl.h> in
892         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
893
894         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
895         parameter, which is unused in the [!F_SETFD] case.
896
897         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
898         SYMNDX to off_t before comparing it to this->data_size().
899         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
900         * incremental.cc (Output_section_incremental_inputs::do_write):
901         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
902
903         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
904
905 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
906
907         * gold.cc (Target_arm::do_adjust_elf_header): Add the
908         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
909         in EABI_VER5.
910
911 2012-10-29  Cary Coutant  <ccoutant@google.com>
912
913         * dwp.cc (usage): Add file and exit status parameters;
914         add --help and --version options.
915         (print_version): New function.
916         (main): Add --help and --version options.
917
918 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
919
920         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
921         final_layout_sequence.txt.
922         * testsuite/Makefile.in: Regenerated.
923
924 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
925
926         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
927         COMPILE generated by automake.
928         (LINK1): Likewise.
929         (CXXCOMPILE1): Likewise.
930         (CXXLINK1): Likewise.
931         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
932         (LINK): Likewise.
933         (CXXCOMPILE): Likewise.
934         (CXXLINK): Likewise.
935         * testsuite/Makefile.in: Regenerated.
936
937 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
938
939         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
940         on bad fwrite return.
941
942 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
943
944         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
945         on val.
946
947 2012-10-23  Cary Coutant  <ccoutant@google.com>
948
949         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
950         * testsuite/Makefile.in: Regenerate.
951         * testsuite/dwp_test.h: New source file.
952         * testsuite/dwp_test_1.cc: New source file.
953         * testsuite/dwp_test_1.s: New source file.
954         * testsuite/dwp_test_1.sh: New source file.
955         * testsuite/dwp_test_1b.cc: New source file.
956         * testsuite/dwp_test_1b.s: New source file.
957         * testsuite/dwp_test_2.cc: New source file.
958         * testsuite/dwp_test_2.s: New source file.
959         * testsuite/dwp_test_2.sh: New source file.
960         * testsuite/dwp_test_main.cc: New source file.
961         * testsuite/dwp_test_main.s: New source file.
962
963 2012-10-23  Cary Coutant  <ccoutant@google.com>
964
965         * dwp.h: New header file.
966         * dwp.cc: New source file.
967         * gold.h: Move shared declarations to system.h.
968         * system.h: New header file.
969         * Makefile.am: Add dwp.
970         * Makefile.in: Regenerate.
971
972 2012-10-23  Cary Coutant  <ccoutant@google.com>
973
974         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
975         Dwarf_info_reader::read_from_pointer.
976         (Dwarf_pubnames_table::read_header): Likewise.
977         (Dwarf_pubnames_table::next_name): Likewise.
978         (Dwarf_die::read_attributes): Likewise.
979         (Dwarf_die::skip_attributes): Likewise.
980         (Dwarf_info_reader::read_from_pointer): New function template.
981         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
982         (Dwarf_pubnames_table): Likewise.
983         (Dwarf_info_reader::read_from_pointer): New function template.
984         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
985         Dwarf_pubnames_table ctor.
986
987 2012-10-23  Cary Coutant  <ccoutant@google.com>
988
989         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
990         abbrev_shndx.
991         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
992         abbrev_shndx_.
993         (Dwarf_info_reader::set_abbrev_shndx): New method.
994         (Dwarf_info_reader::abbrev_shndx_): New data member.
995
996 2012-10-23  Cary Coutant  <ccoutant@google.com>
997
998         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
999         from object, not parameters.
1000         (Dwarf_info_reader::parse): Likewise.
1001         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1002         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1003         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1004         methods.
1005
1006 2012-10-23  Cary Coutant  <ccoutant@google.com>
1007
1008         * fileread.cc (Input_file::Input_file): New constructor.
1009         * fileread.h (class Input_file): Add new constructor.
1010
1011 2012-10-18  Alan Modra  <amodra@gmail.com>
1012
1013         PR gold/14727
1014         * object.cc (Relobj::is_section_name_included): Also match
1015         .sdata personality section.
1016
1017 2012-10-18  Alan Modra  <amodra@gmail.com>
1018
1019         * target-reloc.h (class Default_comdat_behavior): New, package up..
1020         (get_comdat_behaviour): ..this.
1021         (relocate_section): Add Relocate_comdat_behavior template arg,
1022         adjust code to suit.
1023         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1024         (Target_arm::scan_reloc_section): Likewise.
1025         * i386.cc (Target_i386::relocate_section): Likewise.
1026         * sparc.cc (Target_sparc::relocate_section): Likewise.
1027         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1028         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1029         * powerpc.cc (class Relocate_comdat_behavior): New.
1030         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1031         gold::relocate_section with new template arg.
1032
1033 2012-10-18  Alan Modra  <amodra@gmail.com>
1034
1035         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1036         dynamic relocs for GOT_TPREL got entries, without symbol if
1037         resolving locally.
1038         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1039         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1040         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1041
1042 2012-10-17  Alan Modra  <amodra@gmail.com>
1043
1044         PR gold/14726
1045         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1046
1047 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1048
1049         * layout.cc (Layout::include_section): Keep sections marked
1050         SHF_EXCLUDE when doing relocatable links.
1051
1052 2012-10-16  Alan Modra  <amodra@gmail.com>
1053
1054         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1055         (Target_powerpc::do_finalize_sections): Call it.
1056         (Output_data_save_res): New class and supporting functions.
1057         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1058         normal symbols defined in object files.
1059
1060 2012-10-12  Alan Modra  <amodra@gmail.com>
1061
1062         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1063         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1064         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1065         section if scan_opd_relocs not yet called.
1066         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1067
1068 2012-10-12  Alan Modra  <amodra@gmail.com>
1069
1070         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1071         add_local_ifunc_entry): Revert last change.
1072         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1073
1074 2012-10-05  Alan Modra  <amodra@gmail.com>
1075
1076         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1077         do_plt_address_for_global): New functions.
1078         (Output_data_got_powerpc::do_write): Don't segfault when linking
1079         statically.
1080         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1081         add_local_ifunc_entry): Return true on adding entry..
1082         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1083         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1084         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1085         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1086         set up symbols here.
1087         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1088         syms here.  Do so even when no .iplt.  Don't segfault when linking
1089         statically.
1090         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1091         new variants without reloc param.
1092         (Glink_sym_ent::Glink_sym_ent): Likewise.
1093         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1094         reloc when refs will resolve to plt call stub.
1095         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1096         R_PPC_PLTREL24 to resolve locally.
1097         (Target_powerpc::Scan::global): Correct ifunc handling.
1098         (Target_powerpc::Relocate::relocate): Correct local sym glink
1099         lookup.  Don't destroy "value" when we have a plt call stub,
1100         and when checking plt call validity.
1101         (Target_powerpc::do_dynsym_value): Simplify.
1102
1103 2012-10-05  Alan Modra  <amodra@gmail.com>
1104
1105         * i386.cc (Output_data_plt_i386::address_for_global,
1106         address_for_local): Add plt offset to returned value.  Adjust uses.
1107         * sparc.cc (Output_data_plt_sparc::address_for_global,
1108         address_for_local): Likewise.
1109         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1110         address_for_local): Likewise.
1111         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1112         address_for_local): Likewise.
1113         * target.h (Target::plt_address_for_global, plt_address_for_local):
1114         Update comment.
1115         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1116         (Output_data_got::Got_entry::write): Nor here.
1117         * output.h: Comment fix.
1118
1119 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1120
1121         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1122         global_offset_table_ value for larget got.
1123         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1124
1125 2012-09-29  Alan Modra  <amodra@gmail.com>
1126
1127         * powerpc.cc (Target_powerpc::iplt_): New output section.
1128         (Target_powerpc::iplt_section, make_iplt_section,
1129         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1130         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1131         Target_powerpc::plt_entry_count): Count iplt entries too.
1132         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1133         reloc section in constructor.  New params.
1134         (Target_powerpc::make_plt_section): Create reloc section here instead.
1135         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1136         functions.
1137         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1138         (Output_data_glink::add_entry, find_entry): New functions to
1139         deal with local syms.
1140         (Glink_sym_ent): Add support for local syms.
1141         (Output_data_glink::do_write): Handle ifunc plt entries.
1142         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1143         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1144         (Target_powerpc::Relocate::relocate): Likewise.
1145         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1146
1147 2012-09-25  Alan Modra  <amodra@gmail.com>
1148
1149         * object.h (Sized_relobj_file::adjust_local_symbol,
1150         do_adjust_local_symbol): New functions.
1151         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1152         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1153         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1154         and irregular opd entry spacing.
1155         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1156         (Global_symbol_visitor_opd): New functor.
1157         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1158         on deleted opd entries.
1159
1160 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1161
1162         * tilegx.cc: New file.
1163         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1164         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1165         * configure.tgt: Add entries for tilegx*.
1166         * configure.ac: Likewise.
1167         * Makefile.in: Rebuild.
1168         * configure: Likewise.
1169         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1170         tilegx.
1171
1172 2012-09-13  Alan Modra  <amodra@gmail.com>
1173
1174         * target-reloc.h (scan_relocs): Call scan.local for relocs
1175         against symbols in discarded sections.  Pass is_discarded
1176         param.
1177         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1178         Add is_discarded param.
1179         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1180         is_discarded to flag opd entry as discarded.  Don't emit dyn
1181         relocs on such entries.
1182         (Target_powerpc::Scan::global): Similarly detect and handle
1183         such opd entries.
1184         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1185         opd_ent_.  Update all uses.
1186         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1187         (Target_powerpc::relocate_section): Zero out discarded opd
1188         entry relocs.
1189
1190 2012-09-12  Ian Lance Taylor  <iant@google.com>
1191
1192         PR gold/14570
1193         * output.cc: Rename Output_data_got template parameter from size
1194         to got_size for all functions.  Compile all variants of
1195         Output_data_got.
1196         (Output_data_got::Got_entry::write): Correct use of size for
1197         symbol value.  Use local_is_tls rather than casting to
1198         Sized_relobj_file.
1199         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1200         (class Sized_relobj_file): Add do_local_is_tls.
1201         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1202
1203 2012-09-11  Alan Modra  <amodra@gmail.com>
1204
1205         PR gold/14566
1206         * layout.cc (Layout::set_segment_offsets): When using
1207         common-page-size alignment, ensure we are on a new max-page-size
1208         page.
1209         * output.cc (Output_segment::set_section_addresses): Use
1210         abi_pagesize, not common_pagesize for relro boundary.
1211         (Output_segment::set_offset): Likewise.
1212
1213 2012-09-11  Alan Modra  <amodra@gmail.com>
1214
1215         * output.h (Output_data_got::add_global_tls, add_local_tls,
1216         add_local_tls_pair): New functions.
1217         (Output_data_got::add_local_pair_with_rel): Remove second
1218         reloc param.  Expand comment.
1219         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1220         use_plt_or_tls_offset_, similarly for constructor param.
1221         (Output_data_got::Got_entry::write): Add got_index param.
1222         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1223         add_local_tls_pair): New functions.
1224         (Output_data_got::Got_entry::write): Handle tls symbols
1225         with use_plt_or_tls_offset_ set specially.
1226         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1227         (Output_data_got::do_write): Replace iterator with index, pass
1228         index to entry write function.
1229         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1230         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1231         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1232         call.
1233         * i386.cc (Target_i386::Scan::local): Likewise.
1234         * sparc.cc (Target_sparc::Scan::local): Likewise.
1235         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1236         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1237         do_tls_offset_for_global): New functions.
1238         (Target_powerpc::Scan::local): Correct TLS relocations and got
1239         entry values.
1240         (Target_powerpc::Scan::global): Don't emit unnecessary
1241         dynamic relocations on TLS GOT entries.
1242
1243 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1244
1245         * config.in: Disable sanity check for kfreebsd.
1246
1247 2012-09-10  Sterling Augustine  <saugustine@google.com>
1248
1249         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1250         (Gdb_index::pubtypes_read): New parameter.
1251         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1252         to calls.
1253         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1254         pubtypes_object_.
1255
1256 2012-09-09  Alan Modra  <amodra@gmail.com>
1257
1258         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1259         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1260         * gc.h (gc_process_relocs): Call target gc_add_reference.
1261         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1262         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1263         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1264         unnecessary cast.
1265         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1266         to cater for when we don't need code offset.  Update use.
1267         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1268         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1269         set_opd_valid): New functions.
1270         (Target_powerpc::do_gc_add_reference): New function.
1271         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1272         stashed refs.
1273         (Target_powerpc::do_gc_mark_symbol): New function.
1274
1275 2012-09-06  Cary Coutant  <ccoutant@google.com>
1276
1277         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1278         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1279         (Dwarf_die::skip_attributes): Likewise.
1280         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1281         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1282         (main): Call it.
1283         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1284
1285 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1286
1287         * testsuite/script_test_3.t: Add .got.plt output section
1288         statement.
1289         * testsuite/script_test_4.t: Likewise.
1290
1291 2012-09-05  Alan Modra  <amodra@gmail.com>
1292
1293         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1294         update all uses and lose "enum" when using type.
1295
1296 2012-09-05  Alan Modra  <amodra@gmail.com>
1297
1298         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1299         * configure: Regenerate.
1300         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1301         (plugin_final_layout.stdout): Likewise.
1302         (memory_test): Set page sizes to 0x1000.
1303         * testsuite/Makefile.in: Regenerate.
1304         * testsuite/discard_locals_test.sh: Add FIXME comment.
1305         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1306         * testsuite/pr14265.t: Add .got output section statement.
1307         * testsuite/script_test_2.t: Likewise.
1308         * testsuite/script_test_3.t: Likewise.
1309         * testsuite/script_test_4.t: Likewise.
1310         * testsuite/script_test_5.t: Likewise.
1311         * testsuite/script_test_6.t: Likewise.
1312         * testsuite/script_test_7.t: Likewise.
1313         * testsuite/script_test_9.t: Likewise.
1314
1315 2012-09-05  Alan Modra  <amodra@gmail.com>
1316
1317         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1318         (Powerpc_relocate_functions::Status): New typedef.
1319         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1320         (Target_powerpc::Scan::local): Handle REL64.
1321         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1322         for REL32 and REL64.
1323         (Target_powerpc::symval_for_branch): New function, extracted from..
1324         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1325         checks.  Report overflow errors.
1326
1327 2012-09-05  Alan Modra  <amodra@gmail.com>
1328
1329         * object.h (Sized_relobj_file::emit_relocs): Delete.
1330         (Sized_relobj_file::emit_relocs_reltype): Delete.
1331         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1332         relocate_relocs for --emit-relocs.
1333         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1334         * output.h: Update comment.
1335         (Output_segment::first_section): New function.
1336         (Output_segment::first_section_load_address): Use first_section.
1337         * output.cc (Output_segment::first_section): New function extracted..
1338         (Output_segment::first_section_load_address): ..from here.  Delete.
1339         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1340         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1341         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1342         adjust call to target.h function.
1343         * i386.cc (Target_i386): Likewise.
1344         * sparc.cc (Target_sparc): Likewise.
1345         * x86_64.cc (Target_x86_64): Likewise.
1346         * powerpc.cc (Target_powerpc): Likewise.
1347         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1348         first tls section has section symbol for optimised local dynamic
1349         output relocs.
1350         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1351         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1352         optimised tls code.
1353         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1354         Rename to relocate_relocs.  Update error message.
1355
1356 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1357
1358         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1359         --just-symbols.
1360
1361 2012-08-31  Alan Modra  <amodra@gmail.com>
1362
1363         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1364         (Powerpc_relobj::toc_base_offset): New stub function.
1365         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1366         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1367         (Target_powerpc::Relocate::enum skip_tls): New.
1368         (Target_powerpc::call_tls_get_addr_): New var.
1369         (Target_powerpc::is_branch_reloc): Move to file scope.
1370         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1371         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1372         New functions.
1373         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1374         (powerpc_info): Correct common_pagesize for ppc64.
1375         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1376         (Powerpc_relocate_functions): Add overflow check enums and functions.
1377         Add non-shift version of rela, rela_ua.  Delete all rel public
1378         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1379         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1380         addr16_ha3, addr14 functions.
1381         (Output_data_got_powerpc::add_constant_pair): New function.
1382         (Output_data_got_powerpc::got_base_offset): Likewise.
1383         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1384         (instruction constants): Sort, add some more.
1385         (Output_data_glink::do_write): Add and use Address typedef.  Use
1386         object->toc_base_offset() stub for 64-bit.
1387         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1388         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1389         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1390         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1391         Always treat .opd relocs as against locally defined symbol.
1392         Correct condition for RELATIVE relocs.
1393         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1394         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1395         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1396         calculations.  Handle TLS relocs, and more.  Add overflow
1397         checking and adjust for Powerpc_relocate_functions changes.
1398         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1399         Reinstate --emit-relocs code with FIXME.
1400
1401 2012-08-30  Alan Modra  <amodra@gmail.com>
1402
1403         * layout.cc (Layout::set_segment_offsets): Set p_align to
1404         abi_pagesize, not common_pagesize.
1405         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1406         to determine whether file header can go in segment.
1407
1408 2012-08-30  Alan Modra  <amodra@gmail.com>
1409
1410         * output.h (Output_reloc::Output_reloc <output section>): Add
1411         is_relative param.  Adjust calls.
1412         (Output_reloc::add_output_section_relative): New functions.
1413         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1414         is_relative.
1415         (Output_reloc::symbol_value): Handle SECTION_CODE.
1416
1417 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1418
1419         * gold.cc (queue_middle_tasks): Call layout again when unique
1420         segments for sections is desired.
1421         * layout.cc (Layout::Layout): Initialize new members.
1422         (Layout::get_output_section_flags): New function.
1423         (Layout::choose_output_section): Call get_output_section_flags.
1424         (Layout::layout): Make output section for mapping to a unique segment.
1425         (Layout::insert_section_segment_map): New function.
1426         (Layout::attach_allocated_section_to_segment): Make unique segment for
1427         output sections marked so.
1428         (Layout::segment_precedes): Check for unique segments when sorting.
1429         * layout.h (Layout::Unique_segment_info): New struct.
1430         (Layout::Section_segment_map): New typedef.
1431         (Layout::insert_section_segment_map): New function.
1432         (Layout::get_output_section_flags): New function.
1433         (Layout::is_unique_segment_for_sections_specified): New function.
1434         (Layout::set_unique_segment_for_sections_specified): New function.
1435         (Layout::unique_segment_for_sections_specified_): New member.
1436         (Layout::section_segment_map_): New member.
1437         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1438         Rename is_gc_pass_one to is_pass_one.
1439         Rename is_gc_pass_two to is_pass_two.
1440         Rename is_gc_or_icf to is_two_pass.
1441         Check for which pass based on whether symbols data is present.
1442         Make it two pass when unique segments for sections is desired.
1443         * output.cc (Output_section::Output_section): Initialize new
1444         members.
1445         * output.h (Output_section::is_unique_segment): New function.
1446         (Output_section::set_is_unique_segment): New function.
1447         (Output_section::is_unique_segment_): New member.
1448         (Output_section::extra_segment_flags): New function.
1449         (Output_section::set_extra_segment_flags): New function.
1450         (Output_section::extra_segment_flags_): New member.
1451         (Output_section::segment_alignment): New function.
1452         (Output_section::set_segment_alignment): New function.
1453         (Output_section::segment_alignment_): New member.
1454         (Output_segment::Output_segment): Initialize is_unique_segment_.
1455         (Output_segment::is_unique_segment): New function.
1456         (Output_segment::set_is_unique_segment): New function.
1457         (Output_segment::is_unique_segment_): New member.
1458         * plugin.cc (allow_unique_segment_for_sections): New function.
1459         (unique_segment_for_sections): New function.
1460         (Plugin::load): Add new functions to transfer vector.
1461         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1462         * Makefile.in: Regenerate.
1463         * testsuite/plugin_final_layout.sh: Check if unique segment
1464         functionality works.
1465         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1466         are available.
1467         (allow_unique_segment_for_sections): New global.
1468         (unique_segment_for_sections): New global.
1469         (claim_file_hook): Call allow_unique_segment_for_sections.
1470         (all_symbols_read_hook): Call unique_segment_for_sections.
1471
1472 2012-08-22  Cary Coutant  <ccoutant@google.com>
1473
1474         * layout.cc (Layout::include_section): Don't assert on GROUP
1475         sections with --emit-relocs.
1476
1477 2012-08-21  Cary Coutant  <ccoutant@google.com>
1478
1479         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1480         if --export-dynamic-symbol names an undef symbol.
1481
1482 2012-08-18  Alan Modra  <amodra@gmail.com>
1483
1484         * powerpc.cc: Formatting and white space.
1485         (Powerpc_relobj): Rename got2_section_ to special_.
1486         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1487         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1488         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1489         (Target_powerpc): Add Address typedef and invalid_address.  Use
1490         throughout.
1491         (Target_powerpc::is_branch_reloc): New function.
1492         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1493         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1494         for dst_mask, value and addend.
1495         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1496         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1497         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1498         uint16_t for 24-bit offset.  Use get_output_section_offset and
1499         check return.
1500         (Target_powerpc::Scan::local): Handle more relocs.
1501         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1502         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1503         Plug in toc restoring insn after plt calls.  Translate branches
1504         to function descriptor symbols to corresponding entry point.
1505         (Target_powerpc::relocate_for_relocatable): Check return from
1506         get_output_section_offset.
1507         * symtab.h: Comment typo.
1508
1509 2012-08-14  Ian Lance Taylor  <iant@google.com>
1510
1511         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1512         unsupported_relocal_local to call unsupported_reloc_global.
1513
1514 2012-08-14  Nick Clifton  <nickc@redhat.com>
1515
1516         PR ld/14265
1517         * script-sections.cc (Sections_element::output_section_name): Add
1518         keep return parameter.
1519         (Output_section_element::match_name): Add keep return parameter.
1520         Return the value of the keep_ member.
1521         * script-sections.h (class Output_section): Update
1522         output_section_name prototype.
1523         * layout.cc (Layout::keep_input_section): New public member
1524         function.
1525         (Layout::choose_output_section): Pass keep parameter to
1526         output_section_name.
1527         * layout.h (class Layout): Add keep_input_section.
1528         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1529         sections.
1530         * testsuite/Makefile.am: Add a test.
1531         * testsuite/Makefile.in: Regenerate.
1532         * testsuite/pr14265.c: Source file for the test.
1533         * testsuite/pr14265.t: Linker script for the test.
1534         * testsuite/pr14265.sh: Shell script for the test.
1535
1536 2012-08-14  Alan Modra  <amodra@gmail.com>
1537
1538         * target.h (Target::output_section_name): New function.
1539         (Target::do_output_section_name): New function.
1540         * layout.cc (Layout::choose_output_section): Call the above.
1541         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1542
1543 2012-08-14  Alan Modra  <amodra@gmail.com>
1544
1545         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1546         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1547         for replace_constant call.
1548         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1549         (Output_data_glink::do_print_to_mapfile): New function.
1550         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1551         (Target_powerpc::Relocate::relocate): Likewise.
1552
1553 2012-08-14  Alan Modra  <amodra@gmail.com>
1554
1555         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1556         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1557         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1558         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1559         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1560         here.
1561         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1562         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1563         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1564         here.
1565         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1566         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1567
1568 2012-08-12  Alan Modra  <amodra@gmail.com>
1569
1570         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1571         (glink insn constants): Use uint32_t.
1572         (Output_data_glink::add_entry): Use insert, not [] operator.
1573
1574 2012-08-11  Alan Modra  <amodra@gmail.com>
1575
1576         * object.h (Sized_relobj_file::find_shdr): New function.
1577         (Sized_relobj_file::find_special_sections): New function.
1578         * object.cc (Sized_relobj_file::find_shdr): New function.
1579         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1580         (Sized_relobj_file::find_special_sections): New function, split out..
1581         (Sized_relobj_file::do_read_symbols): ..from here.
1582         * output.h (Output_data_got::replace_constant): New function.
1583         (Output_data_got::num_entries): New function.
1584         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1585         (Output_data_got::got_offset): Protected rather than private.
1586         (Output_data_got::replace_got_entry): New function.
1587         * output.cc (Output_data_got::replace_got_entry): New function.
1588         * powerpc.cc (class Powerpc_relobj): New.
1589         (class Powerpc_relocate_functions): Delete all psymval variants or
1590         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1591         Implement _ha functions using corresponding _hi function.
1592         (Powerpc_relobj::find_special_sections): New function.
1593         (Target_powerpc::do_make_elf_object): New function.
1594         (class Output_data_got_powerpc): New.
1595         (class Output_data_glink): New.
1596         (class Powerpc_scan_relocatable_reloc): New.
1597         Many more changes througout file.
1598
1599 2012-08-09  Nick Clifton  <nickc@redhat.com>
1600
1601         * po/vi.po: Updated Vietnamese translation.
1602
1603 2012-08-07  Ian Lance Taylor  <iant@google.com>
1604
1605         * layout.cc (Layout::add_target_dynamic_tags): If
1606         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1607         plt_rel.
1608
1609 2012-07-30  Nick Clifton  <nickc@redhat.com>
1610
1611         * po/gold.pot: Updated template.
1612         * po/es.po: Updated Spanish translation.
1613
1614 2012-07-18  Cary Coutant  <ccoutant@google.com>
1615
1616         PR gold/14344
1617         * configure.ac: Add check for -gpubnames support.
1618         * configure: Regenerate.
1619         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1620         support; force -gno-pubnames.
1621         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1622         support.
1623         (gdb_index_test_4): New test.
1624         * testsuite/Makefile.in: Regenerate.
1625         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1626         * testsuite/gdb_index_test_2.sh: Likewise.
1627         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1628         * testsuite/gdb_index_test_4.sh: New script.
1629         * testsuite/gdb_index_test_comm.sh: New script with common code;
1630         don't look for space after colon.
1631
1632 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1633
1634         * gold.cc (queue_middle_tasks): Update function order only after
1635         deferred objects due to plugins are processed.
1636
1637 2012-07-11  Ian Lance Taylor  <iant@google.com>
1638
1639         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1640         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1641         (Target_arm::scan_reloc_for_stub): Likewise.
1642         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1643         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1644         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1645         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1646         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1647
1648 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1649             Ian Lance Taylor  <iant@google.com>
1650
1651         PR gold/14309
1652         * configure.ac: Test whether std::tr1::hash<off_t> works.
1653         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1654         needed.
1655         * output.h (class Output_fill): Add virtual destructor.
1656         * configure, config.in: Rebuild.
1657
1658 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1659
1660         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1661
1662 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1663
1664         * plugin.cc (Plugin::load): Handle position independent executables.
1665
1666 2012-06-06  Cary Coutant  <ccoutant@google.com>
1667
1668         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1669         add .debug_macro.
1670         (lines_only_debug_sections): Likewise.
1671         (gdb_fast_lookup_sections): New static array.
1672         (is_gdb_debug_section): Rename formal parameter.
1673         (is_lines_only_debug_section): Likewise.
1674         (is_gdb_fast_lookup_section): New function.
1675         (Layout::include_section): Check for ".zdebug_" prefix; pass
1676         section name suffix to is_gdb_debug_section, et al.; check for
1677         fast-lookup sections when building .gdb_index.
1678         * options.h (--strip-debug-gdb): Update GDB version number.
1679
1680 2012-06-06  Cary Coutant  <ccoutant@google.com>
1681
1682         * configure.ac: Add check for fallocate.
1683         * configure: Regenerate.
1684         * config.in: Regenerate.
1685
1686         * options.h (class General_options): Add --mmap-output-file and
1687         --posix-fallocate options.
1688         * output.cc: (posix_fallocate): Remove; replace with...
1689         (gold_fallocate): New function.
1690         (Output_file::map_no_anonymous): Call gold_fallocate.
1691         (Output_file::map): Check --mmap-output-file option.
1692
1693 2012-06-05  Jing Yu  <jingyu@google.com>
1694
1695         * gold.h (textdomain): Add do {} to empty while(0).
1696         (bindtextdomain): Likewise.
1697
1698 2012-06-04  Cary Coutant  <ccoutant@google.com>
1699
1700         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1701         has_dynsym_index.
1702
1703 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1704
1705         * symtab.cc (Symbol_table::define_special_symbol):
1706         Initialize *poldsym to prevent uninitialized variable errors.
1707
1708 2012-05-23  Cary Coutant  <ccoutant@google.com>
1709
1710         * layout.cc (Layout::section_name_mapping): Add rules to handle
1711         exact match on .data.rel.ro.local or .data.rel.ro.
1712         (Layout::output_section_name): Check for exact matches.
1713
1714 2012-05-23  Cary Coutant  <ccoutant@google.com>
1715
1716         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1717         more carefully.
1718
1719 2012-05-22  Cary Coutant  <ccoutant@google.com>
1720
1721         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1722         object before exporting symbol.
1723
1724 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1725
1726         * testsuite/tls_test.cc: Include "config.h" first.
1727         * testsuite/tls_test_c.c: Likewise.
1728
1729 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1730             Nick Clifton  <nickc@redhat.com>
1731
1732         PR 14072
1733         * configure.in: Add check that sysdep.h has been included before
1734         any system header files.
1735         * configure: Regenerate.
1736         * config.in: Regenerate.
1737
1738 2012-05-14  Cary Coutant  <ccoutant@google.com>
1739
1740         * layout.cc (Layout::make_output_section): Mark .tdata section
1741         as RELRO.
1742         * testsuite/relro_test.cc: Add a TLS variable.
1743
1744 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1745
1746         PR gold/14091
1747         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1748         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1749         R_X86_64_64.
1750
1751 2012-05-08  Cary Coutant  <ccoutant@google.com>
1752
1753         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1754         (lines_only_debug_sections): Likewise.
1755
1756 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1757
1758         * nacl.cc: New file.
1759         * nacl.h: New file.
1760         * Makefile.am (CCFILES, HFILES): Add them.
1761         * Makefile.in: Regenerate.
1762         * i386.cc (Output_data_plt_i386_nacl): New class.
1763         (Output_data_plt_i386_nacl_exec): New class.
1764         (Output_data_plt_i386_nacl_dyn): New class.
1765         (Target_i386_nacl): New class.
1766         (Target_selector_i386_nacl): New class.
1767         (target_selector_i386): Use it instead of Target_selector_i386.
1768         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1769         (Target_x86_64_nacl): New class.
1770         (Target_selector_x86_64_nacl): New class.
1771         (target_selector_x86_64, target_selector_x32): Use it instead of
1772         Target_selector_x86_64.
1773         * arm.cc (Output_data_plt_arm_nacl): New class.
1774         (Target_arm_nacl): New class.
1775         (Target_selector_arm_nacl): New class.
1776         (target_selector_arm, target_selector_armbe): Use it instead of
1777         Target_selector_arm.
1778
1779         * target-select.cc (select_target): Take new Input_file* and off_t
1780         arguments, pass them on to recognize method of selector.
1781         * object.cc (make_elf_sized_object): Update caller.
1782         * parameters.cc (parameters_force_valid_target): Likewise.
1783         * incremental.cc (make_sized_incremental_binary): Likewise.
1784         * target-select.h: Update decl.
1785         (Target_selector::recognize): Take new Input_file* argument,
1786         pass it on to do_recognize.
1787         (Target_selector::do_recognize): Take new Input_file* argument.
1788         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1789         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1790         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1791         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1792
1793         * target.h (Target::Target_info): New members isolate_execinstr
1794         and rosegment_gap.
1795         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1796         * arm.cc (Target_arm::arm_info): Update initializer.
1797         * i386.cc (Target_i386::i386_info): Likewise.
1798         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1799         * sparc.cc (Target_sparc::sparc_info): Likewise.
1800         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1801         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1802         * layout.cc (Layout::attach_allocated_section_to_segment):
1803         Take new const Target* argument.  If target->isolate_execinstr(), act
1804         like --rosegment.
1805         (Layout::find_first_load_seg): Take new const Target* argument;
1806         if target->isolate_execinstr(), reject PF_X segments.
1807         (Layout::relaxation_loop_body): Update caller.
1808         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1809         reset file offset to zero when we hit LOAD_SEG, and then do a second
1810         loop over the segments before LOAD_SEG to reassign offsets after
1811         addresses have been determined.  Handle target->rosegment_gap().
1812         (Layout::attach_section_to_segment): Take new const Target* argument;
1813         pass it to attach_allocated_section_to_segment.
1814         (Layout::make_output_section): Update caller.
1815         (Layout::attach_sections_to_segments): Take new const Target* argument;
1816         pass it to attach_section_to_segment.
1817         * gold.cc (queue_middle_tasks): Update caller.
1818         * layout.h (Layout): Update method decls with new arguments.
1819
1820         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1821         Target_info pointer to use.
1822         (Target_arm::do_make_data_plt): New virtual method.
1823         (Target_arm::make_data_plt): New method that calls it.
1824         (Target_arm::make_plt_entry): Use it.
1825         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1826         for the section alignment.
1827         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1828         method.
1829         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1830         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1831         method.
1832         (Output_data_plt_arm::get_plt_entry_size): Call it.
1833         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1834         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1835         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1836         method.
1837         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1838         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1839         method instead of sizeof(plt_entry).
1840         (Output_data_plt_arm::add_entry): Likewise.
1841         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1842         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1843         than static method.
1844         (Target_arm::plt_entry_size): Likewise.
1845         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1846         Move to ...
1847         (Output_data_plt_arm_standard): ... here, new class.
1848         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1849         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1850         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1851
1852         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1853         Take additional argument for the PLT entry size.
1854         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1855         Use get_plt_entry_size method rather than plt_entry_size variable.
1856         (Output_data_plt_x86_64::reserve_slot): Likewise.
1857         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1858         (Output_data_plt_x86_64::add_entry): Likewise.
1859         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1860         (Output_data_plt_x86_64::address_for_global): Likewise.
1861         (Output_data_plt_x86_64::address_for_local): Likewise.
1862         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1863         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1864         Make method non-static.
1865         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1866         method.
1867         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1868         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1869         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1870         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1871         virtual method.
1872         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1873         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1874         virtual method.
1875         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1876         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1877         virtual method.
1878         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1879         (Output_data_plt_x86_64::plt_entry_size)
1880         (Output_data_plt_x86_64::first_plt_entry)
1881         (Output_data_plt_x86_64::plt_entry)
1882         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1883         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1884         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1885         (Output_data_plt_x86_64_standard): ... here, new class.
1886         (Target_x86_64::Target_x86_64): Take optional argument for the
1887         Target_info pointer to use.
1888         (Target_x86_64::do_make_data_plt): New virtual method.
1889         (Target_x86_64::make_data_plt): New method to call it.
1890         (Target_x86_64::init_got_plt_for_update): Use that.
1891         Call this->plt_->add_eh_frame method here.
1892         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1893         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1894         rather than static method.
1895         (Target_x86_64::plt_entry_size): Likewise.
1896         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1897         rather than plt_entry_size variable.  Move guts of PLT filling to...
1898         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1899         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1900         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1901
1902         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1903         additional argument for the section alignment.
1904         Don't do add_eh_frame_for_plt here.
1905         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1906         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1907         variable.
1908         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1909         method.
1910         (Output_data_plt_i386::get_plt_entry_size): Call it.
1911         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1912         (Output_data_plt_i386::add_eh_frame): New method to call it.
1913         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1914         method.
1915         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1916         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1917         method.
1918         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1919         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1920         method instead of plt_entry_size.
1921         (Output_data_plt_i386::plt_entry_size)
1922         (Output_data_plt_i386::plt_eh_frame_fde_size)
1923         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1924         (Output_data_plt_i386_standard): ... here, new class.
1925         (Output_data_plt_i386_exec): New class.
1926         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1927         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1928         (Output_data_plt_i386::exec_plt_entry): Move to ...
1929         (Output_data_plt_i386_exec::plt_entry): ... here.
1930         (Output_data_plt_i386_dyn): New class.
1931         (Output_data_plt_i386::first_plt_entry): Move to ...
1932         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1933         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1934         (Output_data_plt_i386_dyn::plt_entry): ... here.
1935         (Target_i386::Target_i386): Take optional argument for the Target_info
1936         pointer to use.
1937         (Target_i386::do_make_data_plt): New virtual method.
1938         (Target_i386::make_data_plt): New method to call it.
1939         (Target_i386::make_plt_section): Use that.
1940         Call this->plt_->add_eh_frame method here.
1941         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1942         rather than plt_entry_size variable.
1943         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1944         (Output_data_plt_i386::address_for_local): Likewise.
1945         (Output_data_plt_i386::do_write): Likewise.
1946         Move guts of PLT filling to...
1947         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1948         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1949         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1950         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1951
1952 2012-05-01  Cary Coutant  <ccoutant@google.com>
1953
1954         * dwarf_reader.cc (Dwarf_die::read_attributes)
1955         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1956         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1957         * reduced_debug_output.cc
1958         (Output_reduced_debug_info_section::get_die_end): Remove
1959         DW_FORM_GNU_ref_index.  Add default case.
1960
1961 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1962
1963         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1964         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1965         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1966         DW_AT_high_pc as offset from DW_AT_low_pc.
1967
1968         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1969         * testsuite/Makefile.in: Regenerate.
1970         * testsuite/gdb_index_test_3.c: New test source file.
1971         * testsuite/gdb_index_test_3.sh: New test source file.
1972
1973 2012-04-25  Ian Lance Taylor  <iant@google.com>
1974
1975         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1976         pointer.
1977         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1978         as a class, not a struct.
1979         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1980         (Target_arm::apply_cortex_a8_workaround): Likewise.
1981         * gc.h: Declare Reloc_types as a struct, not a class.
1982         * object.h: Declare Symbols_data as a struct.
1983         * reloc.h: Declare Read_relocs_data as a struct.
1984         * target.h: Declare Relocate_info as a struct.
1985
1986 2012-04-24  David S. Miller  <davem@davemloft.net>
1987
1988         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1989         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1990         and R_SPARC_WPLT30.
1991
1992 2012-04-24  Cary Coutant  <ccoutant@google.com>
1993
1994         * incremental-dump.cc (find_input_containing_global): Replace
1995         magic number with symbolic constant.
1996         (dump_incremental_inputs): Update version number.
1997         * incremental.cc (Output_section_incremental_inputs): Update version
1998         number; import symbolic constants from Incremental_inputs_reader.
1999         (Incremental_inputs::create_data_sections): Align relocations
2000         section correctly for 64-bit targets.
2001         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2002         constants; add padding.
2003         (Output_section_incremental_inputs::write_header): Add assert for
2004         header_size.
2005         (Output_section_incremental_inputs::write_input_files): Add assert
2006         for input_entry_size.
2007         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2008         add assert for object_info_size, input_section_entry_size,
2009         global_sym_entry_size.
2010         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2011         for data structure sizes; use them.
2012         (Incremental_input_entry_reader): Import symbolic constants from
2013         Incremental_inputs_reader; use them.
2014
2015 2012-04-23  David S. Miller  <davem@davemloft.net>
2016
2017         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2018         and elf_flags_set_.
2019         (Target_sparc::Target_sparc): Initialize new fields.
2020         (Target_sparc::do_make_elf_object): New function.
2021         (Target_sparc::do_adjust_elf_header): New function.
2022
2023 2012-04-23  Cary Coutant  <ccoutant@google.com>
2024
2025         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2026         CU range table of gdb index.
2027
2028 2012-04-20  David S. Miller  <davem@davemloft.net>
2029
2030         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2031         instead of false.
2032
2033 2012-04-16  David S. Miller  <davem@davemloft.net>
2034
2035         * sparc.cc (Target_sparc::got_address): New function.
2036         (Sparc_relocate_functions::gdop_hix22): New function.
2037         (Sparc_relocate_functions::gdop_lox10): New function.
2038         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2039         relocs.
2040         (Target_sparc::Scan::local): Likewise if the global symbol is not
2041         preemptible and is not IFUNC.
2042         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2043         transformations for local and non-preemptible non-IFUNC global
2044         symbols.
2045
2046         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2047         writing out 64-bit part of ranges.
2048
2049         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2050         -fpic and -fpie respectively.
2051         * Makefile.in: Regenerate.
2052
2053         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2054         (Target_sparc::Target_sparc): Initialize new field.
2055         (Target_sparc::do_plt_section_for_global): New function.
2056         (Target_sparc::do_plt_section_for_local): New function.
2057         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2058         (Target_sparc::make_plt_section): New function, broken out of
2059         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2060         (Target_sparc::make_plt_entry): Call make_plt_section.
2061         (Target_sparc::make_local_ifunc_plt_entry): New function.
2062         (Target_sparc::rela_ifunc_section): New function.
2063         (Target_sparc::plt_section): Remove const.
2064         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2065         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2066         and ifunc_count_ fields.
2067         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2068         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2069         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2070         (Output_data_plt_sparc::rela_ifunc): New function.
2071         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2072         (Output_data_plt_sparc::has_ifunc_section): New function.
2073         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2074         (Output_data_plt_sparc::address_for_global): New function.
2075         (Output_data_plt_sparc::address_for_local): New function.
2076         (Output_data_plt_sparc::plt_index_to_offset): New function.
2077         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2078         and entry_count.
2079         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2080         entry_count.
2081         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2082         R_SPARC_JMP_IREL to switch.
2083         (Target_sparc::Scan::check_non_pic): Likewise.
2084         (Target_sparc::Scan::local): Handle IFUNC symbols.
2085         (Target_sparc::Scan::local): Likewise.
2086         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2087         and plt_address_for_local.
2088         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2089         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2090
2091         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2092         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2093         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2094         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2095         global relocs too.
2096         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2097         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2098         calls.
2099         * sparc.cc (Target_sparc::Scan::global): Likewise.
2100         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2101
2102 2012-04-16  Cary Coutant  <ccoutant@google.com>
2103
2104         * archive.cc (Library_base::should_include_member): Check for
2105         --export-dynamic-symbol.
2106         * options.h (class General_options): Add --export-dynamic-symbol.
2107         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2108         --export-dynamic-symbol.
2109         (Symbol_table::gc_mark_undef_symbols): Likewise.
2110         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2111
2112 2012-04-12  David S. Miller  <davem@davemloft.net>
2113
2114         * sparc.cc (Reloc::wdisp10): New relocation method.
2115         (Reloc::h34): Likewise.
2116         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2117         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2118         R_SPARC_WDISP10.
2119         (Target_sparc::Scan::local): Likewise.
2120         (Target_sparc::Scan::global): Likewise.
2121         (Target_sparc::Relocate::relocate): Likewise.
2122
2123 2012-04-09  Cary Coutant  <ccoutant@google.com>
2124
2125         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2126         low_pc == 0.
2127
2128 2012-04-06  Ian Lance Taylor  <iant@google.com>
2129
2130         * timer.cc: #include <unistd.h>.
2131
2132 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2133
2134         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2135         * config.in: Regenerate.
2136         * configure: Regenerate.
2137
2138 2012-04-05  Nick Clifton  <nickc@redhat.com>
2139
2140         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2141         (AM_LC_MESSAGES): Add.
2142         * aclocal.m4: Regenerate.
2143         * config.in: Regenerate.
2144         * configure: Regenerate.
2145
2146 2012-03-21  Cary Coutant  <ccoutant@google.com>
2147
2148         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2149         * Makefile.in: Regenerate.
2150         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2151         (Sized_elf_reloc_mapper::symbol_section): New function.
2152         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2153         (make_elf_reloc_mapper): New function.
2154         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2155         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2156         (Dwarf_abbrev_table::do_get_abbrev): New function.
2157         (Dwarf_ranges_table::read_ranges_table): New function.
2158         (Dwarf_ranges_table::read_range_list): New function.
2159         (Dwarf_pubnames_table::read_section): New function.
2160         (Dwarf_pubnames_table::read_header): New function.
2161         (Dwarf_pubnames_table::next_name): New function.
2162         (Dwarf_die::Dwarf_die): New function.
2163         (Dwarf_die::read_attributes): New function.
2164         (Dwarf_die::skip_attributes): New function.
2165         (Dwarf_die::set_name): New function.
2166         (Dwarf_die::set_linkage_name): New function.
2167         (Dwarf_die::attribute): New function.
2168         (Dwarf_die::string_attribute): New function.
2169         (Dwarf_die::int_attribute): New function.
2170         (Dwarf_die::uint_attribute): New function.
2171         (Dwarf_die::ref_attribute): New function.
2172         (Dwarf_die::child_offset): New function.
2173         (Dwarf_die::sibling_offset): New function.
2174         (Dwarf_info_reader::check_buffer): New function.
2175         (Dwarf_info_reader::parse): New function.
2176         (Dwarf_info_reader::do_parse): New function.
2177         (Dwarf_info_reader::do_read_string_table): New function.
2178         (Dwarf_info_reader::lookup_reloc): New function.
2179         (Dwarf_info_reader::get_string): New function.
2180         (Dwarf_info_reader::visit_compilation_unit): New function.
2181         (Dwarf_info_reader::visit_type_unit): New function.
2182         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2183         Sized_elf_reloc_mapper.
2184         (Sized_dwarf_line_info::symbol_section): Remove function.
2185         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2186         (Sized_dwarf_line_info::read_line_mappings): Remove object
2187         parameter, adjust callers.
2188         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2189         * dwarf_reader.h: Include <sys/types.h>.
2190         (class Track_relocs): Remove forward declaration.
2191         (class Elf_reloc_mapper): New class.
2192         (class Sized_elf_reloc_mapper): New class.
2193         (class Dwarf_abbrev_table): New class.
2194         (class Dwarf_range_list): New class.
2195         (class Dwarf_ranges_table): New class.
2196         (class Dwarf_pubnames_table): New class.
2197         (class Dwarf_die): New class.
2198         (class Dwarf_info_reader): New class.
2199         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2200         (Sized_dwarf_line_info::symbol_section): Remove member function.
2201         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2202         base class.
2203         * gdb-index.cc: New source file.
2204         * gdb-index.h: New source file.
2205         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2206         and .debug_types sections, call Layout::add_to_gdb_index.
2207         (Sized_relobj_incr::do_section_name): Implement.
2208         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2209         return type; Implement.
2210         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2211         return type.
2212         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2213         parameter list and return type.
2214         (Sized_incr_dynobj::do_section_contents): Likewise.
2215         * layout.cc: Include gdb-index.h.
2216         (Layout::Layout): Initialize gdb_index_data_.
2217         (Layout::init_fixed_output_section): Check for .gdb_index section.
2218         (Layout::add_to_gdb_index): New function. Instantiate.
2219         * layout.h: Add forward declaration for class Gdb_index.
2220         (Layout::add_to_gdb_index): New member function.
2221         (Layout::gdb_index_data_): New data member.
2222         * main.cc: Include gdb-index.h.
2223         (main): Print statistics for gdb index.
2224         * object.cc (Object::section_contents): Move code into
2225         do_section_contents.
2226         (need_decompressed_section): Check for sections needed when building
2227         gdb index.
2228         (build_compressed_section_map): Likewise.
2229         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2230         gdb index.
2231         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2232         sections; call Layout::add_to_gdb_index.
2233         (Sized_relobj_file::do_decompressed_section_contents): Call
2234         do_section_contents directly.
2235         * object.h (Object::do_section_contents): Adjust parameter list and
2236         return type.
2237         (Object::do_decompressed_section_contents): Call do_section_contents
2238         directly.
2239         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2240         return type.
2241         * options.h (class General_options): Add --gdb-index option.
2242         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2243         list and return type.
2244         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2245         * reloc.h (Track_relocs::checkpoint): New function.
2246         (Track_relocs::reset): New function.
2247
2248         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2249         New test cases.
2250         * testsuite/Makefile.in: Regenerate.
2251         * testsuite/gdb_index_test.cc: New test source file.
2252         * testsuite/gdb_index_test_1.sh: New test source file.
2253         * testsuite/gdb_index_test_2.sh: New test source file.
2254
2255 2012-03-19  Doug Kwan  <dougkwan@google.com>
2256
2257         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2258         (Target_arm::do_finalize_sections): Remove code which defines
2259         __exidx_start and __exidx_end.  Make symbol table parameter
2260         anonymous as it is not used.
2261         * gold.cc (queue_middle_tasks): Call target hook to define any
2262         target-specific symbols.
2263         * target.h (Target::define_standard_symbols): New method.
2264         (Target::do_define_standard_symbols): Same.
2265         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2266         * testsuite/Makefile.in: Regenerate.
2267         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2268         and __exidx_end.
2269         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2270         relocations are generated for __exidx_start and __exidx_end.
2271
2272 2012-03-16  Doug Kwan  <dougkwan@google.com>
2273
2274         * testsuite/Makefile.am: Disable test initpri3b.
2275         * testsuite/Makefile.in: Regenerate.
2276
2277 2012-03-15  Doug Kwan  <dougkwan@google.com>
2278
2279         * arm.cc (Target_arm::got_section): Make .got section read-only
2280         if -z now is given.
2281
2282 2012-03-15  Ian Lance Taylor  <iant@google.com>
2283
2284         PR gold/13850
2285         * layout.cc (Layout::make_output_section): Correctly mark
2286         SHT_INIT_ARRAY, et. al., as relro.
2287
2288 2012-03-14  Doug Kwan  <dougkwan@google.com>
2289
2290         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2291         dynamic relocations for protected symbols in shared objects.
2292
2293 2012-03-13  Ian Lance Taylor  <iant@google.com>
2294
2295         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2296         keep the larger alignment.
2297
2298 2012-03-12  Cary Coutant  <ccoutant@google.com>
2299
2300         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2301         handling of DW_LNE_define_file.
2302
2303 2012-03-12  Cary Coutant  <ccoutant@google.com>
2304
2305         * reduced_debug_output.cc
2306         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2307         codes to switch.
2308
2309 2012-02-29  Cary Coutant  <ccoutant@google.com>
2310
2311         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2312
2313 2012-02-29  Cary Coutant  <ccoutant@google.com>
2314
2315         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2316         Call Object::decompressed_section_contents.
2317         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2318         New dtor.
2319         (Sized_dwarf_line_info::buffer_start_): New data member.
2320         * merge.cc (Output_merge_data::do_add_input_section): Call
2321         Object::decompressed_section_contents.
2322         (Output_merge_string::do_add_input_section): Likewise.
2323         * object.cc (need_decompressed_section): New function.
2324         (build_compressed_section_map): Decompress sections needed later.
2325         (Sized_relobj_file::do_decompressed_section_contents): New function.
2326         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2327         * object.h (Object::decompressed_section_contents): New function.
2328         (Object::discard_decompressed_sections): New function.
2329         (Object::do_decompressed_section_contents): New function.
2330         (Object::do_discard_decompressed_sections): New function.
2331         (Compressed_section_info): New type.
2332         (Compressed_section_map): Include decompressed section contents.
2333         (Sized_relobj_file::do_decompressed_section_contents): New function.
2334         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2335
2336 2012-02-16  Cary Coutant  <ccoutant@google.com>
2337
2338         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2339         * testsuite/Makefile.in: Regenerate.
2340
2341 2012-02-14  Cary Coutant  <ccoutant@google.com>
2342
2343         * options.cc (General_options::finalize): Disallow -pie and -static.
2344
2345 2012-02-03  Doug Kwan  <dougkwan@google.com>
2346
2347         * arm.cc (Arm_relocate_functions::abs8,
2348         Arm_relocate_functions::abs16): Use
2349         Bits::has_signed_unsigned_overflow32.
2350         (Arm_relocate_functions::thm_abs8): Correct range of
2351         overflow check.
2352         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2353         in assertions.
2354
2355 2012-02-02  Doug Kwan  <dougkwan@google.com>
2356
2357         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2358         position independent outputs, not just shared objects.
2359
2360 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2361
2362         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2363         * configure: Regenerated.
2364
2365 2012-01-27  Ian Lance Taylor  <iant@google.com>
2366
2367         * reloc.h (Bits): New class with static functions, copied from
2368         namespace utils in arm.cc.
2369         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2370         instead.
2371
2372 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2373
2374         * incremental.cc (write_info_blocks): Correct relocation offset.
2375
2376 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2377
2378         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2379         (Relocate::tls_gd_to_le): Likewise.
2380
2381 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2382
2383         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2384
2385 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2386
2387         * configure.ac: Check if -mcmodel=medium works.
2388         * configure: Regenerated.
2389
2390 2012-01-24  Cary Coutant  <ccoutant@google.com>
2391
2392         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2393         definition and ...
2394         (read_unsigned_LEB_128_x): ... this new function.
2395         (read_signed_LEB_128): Replaced with inline definition and ...
2396         (read_signed_LEB_128_x): ... this new function.
2397         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2398         (read_unsigned_LEB_128): Add inline definition.
2399         (read_signed_LEB_128_x): New function.
2400         (read_signed_LEB_128): Add inline definition.
2401         * testsuite/Makefile.am (leb128_unittest): New unit test.
2402         * testsuite/Makefile.in: Regenerate.
2403         * testsuite/leb128_unittest.cc: New unit test.
2404
2405 2012-01-23  Ian Lance Taylor  <iant@google.com>
2406
2407         PR gold/13617
2408         * i386.cc (Target_i386::do_code_fill): When using a jmp
2409         instruction, pad with nop instructions.
2410         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2411
2412 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2413
2414         * x86_64.cc (gc_process_relocs): Add typename on types used in
2415         template.
2416         (scan_relocs): Likewise.
2417         (relocate_section): Likewise.
2418         (apply_relocation): Likewise.
2419
2420 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2421
2422         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2423         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2424         under x32.
2425
2426 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2427
2428         * x86_64.cc: Initial support for x32.
2429
2430 2012-01-03  Cary Coutant  <ccoutant@google.com>
2431
2432         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2433         Use abstract base class for GOT.
2434         * gold/output.h (class Output_data_got_base): New abstract base class.
2435         (class Output_data_got): Derive from new base class, adjust ctors.
2436         (Output_data_got::reserve_slot): Make virtual; rename to
2437         do_reserve_slot; Adjust callers.
2438         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2439         pointer to abstract base class.
2440         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2441
2442 2011-12-18  Ian Lance Taylor  <iant@google.com>
2443
2444         * object.h (Relobj::local_symbol_value): New function.
2445         (Relobj::local_plt_offset): New function.
2446         (Relobj::local_has_got_offset): New function.
2447         (Relobj::local_got_offset): New function.
2448         (Relobj::set_local_got_offset): New function.
2449         (Relobj::do_local_symbol_value): New pure virtual function.
2450         (Relobj::do_local_plt_offset): Likewise.
2451         (Relobj::do_local_has_got_offset): Likewise.
2452         (Relobj::do_local_got_offset): Likewise.
2453         (Relobj::do_set_local_got_offset): Likewise.
2454         (Sized_relobj::do_local_has_got_offset): Rename from
2455         local_has_got_offset.
2456         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2457         (Sized_relobj::do_set_local_got_offset): Rename from
2458         set_local_got_offset.
2459         (Sized_relobj_file::do_local_plt_offset): Rename from
2460         local_plt_offset.
2461         (Sized_relobj_file::do_local_symbol_value): New function.
2462         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2463         local_plt_offset.
2464         * output.cc (Output_data_got::Got_entry::write): Change object to
2465         Relobj.  Use local_symbol_value.
2466         (Output_data_got::add_global_with_rel): Change rel_dyn to
2467         Output_data_reloc_generic*.  Use add_global_generic.
2468         (Output_data_got::add_global_with_rela): Remove.  Change all
2469         callers to use add_global_with_rel.
2470         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2471         Output_data_reloc_generic*.  Use add_global_generic.
2472         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2473         callers to use add_global_pair_with_rel.
2474         (Output_data_got::add_local): Change object to Relobj*.
2475         (Output_data_got::add_local_plt): Likewise.
2476         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2477         change rel_dyn to Output_data_reloc_generic*.  Use
2478         add_local_generic.
2479         (Output_data_got::add_local_with_rela): Remove.  Change all
2480         callers to use all_local_with_rel.
2481         (Output_data_got::add_local_pair_with_rel): Change object to
2482         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2483         add_output_section_generic.
2484         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2485         callers to use add_local_pair_with_rel.
2486         (Output_data_got::reserve_local): Change object to Relobj*.
2487         * output.h: (class Output_data_reloc_generic): Add pure virtual
2488         declarations for add_global_generic, add_local_generic,
2489         add_output_section_generic.
2490         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2491         functions for Output_data_reloc_generic.  Update declarations for
2492         changes listed in output.cc.
2493         (class Output_data_got): Change template parameter to got_size.
2494         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2495         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2496         function.
2497         (Sized_relobj_incr::do_local_plt_offset): New function.
2498         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2499         add_global_generic.
2500
2501 2011-12-17  Cary Coutant  <ccoutant@google.com>
2502
2503         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2504         * resolve.cc (Symbol_table::resolve): Likewise.
2505         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2506         arrays.
2507         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2508
2509 2011-12-16  Ian Lance Taylor  <iant@google.com>
2510
2511         * output.h (Output_data_reloc_generic::add): Only call
2512         add_dynamic_reloc if this is a dynamic reloc section.
2513
2514 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2515
2516         PR gold/13505
2517         * target-reloc.h (apply_relocation): Replace <64, false> with
2518         <size, big_endian>.
2519
2520 2011-11-25  Nick Clifton  <nickc@redhat.com>
2521
2522         * po/it.po: New Italian translation.
2523
2524 2011-11-17  Sterling Augustine  <saugustine@google.com>
2525
2526         * script.cc (script_include_directive): Implement.
2527         (read_script_file): New local variables name and search_path. Update
2528         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2529         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2530         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2531
2532 2011-11-11  Sterling Augustine  <saugustine@google.com>
2533
2534         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2535         (file_or_sections_cmd): Likewise.
2536
2537 2011-11-11  Doug Kwan  <dougkwan@google.com>
2538
2539         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2540         if --just-symbols is given.
2541
2542 2011-11-10  Doug Kwan  <dougkwan@google.com>
2543
2544         PR gold/13362
2545         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2546         when processing data relocs.
2547         * reloc.h (Relocate_functions::rel_unaligned): New method.
2548         (Relocate_functions::pcrel_unaligned): Ditto.
2549         (Relocate_functions::rel32_unaligned): Ditto.
2550         (Relocate_functions::pcrel32_unaligned): Ditto.
2551
2552 2011-11-09  Doug Kwan  <dougkwan@google.com>
2553
2554         PR gold/13362
2555         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2556         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2557         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2558         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2559         (Relocate_functions::rel_unaligned): New.
2560         (Relocate_functions::rel32_unaligned): New.
2561         * target-reloc.h (relocate_for_relocatable): Add code to handle
2562         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2563         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2564         arm_unaligned_reloc_r): New targets.
2565         * testsuite/Makefile.in: Regenerate.
2566         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2567         linking.
2568
2569 2011-11-02  Ian Lance Taylor  <iant@google.com>
2570
2571         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2572         NATIVE_LINKER.
2573         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2574         * options.cc (General_options::finalize): Use library search path
2575         from configure script if specified.  If not native and no sysroot,
2576         only search TOOLLIBDIR.
2577         * options.h (Search_directory::Search_directory): Change name to
2578         const std::string&.
2579         (General_options::add_to_library_path_with_sysroot): Change arg to
2580         const std::string&.
2581         * configure, Makefile.in, config.in: Rebuild.
2582
2583 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2584
2585         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2586         we are working around the ARM1176 Erratum.
2587         * options.h (General_options::fix_arm1176): Add option.
2588         * testsuite/Makefile.am: Add testcases, and keep current ones
2589         working.
2590         * testsuite/Makefile.in: Regenerate.
2591         * testsuite/arm_fix_1176.s: New file.
2592         * testsuite/arm_fix_1176.sh: Likewise.
2593
2594 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2595
2596         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2597         may_use_blx_.
2598         (Target_arm::may_use_blx): Remove method.
2599         (Target_arm::set_may_use_blx): Likewise.
2600         (Target_arm::may_use_v4t_interworking): New method.
2601         (Target_arm::may_use_v5t_interworking): Likewise.
2602         (Target_arm::may_use_blx_): Remove member variable.
2603         (Arm_relocate_functions::arm_branch_common): Check for v5T
2604         interworking.
2605         (Arm_relocate_functions::thumb_branch_common): Likewise.
2606         (Reloc_stub::stub_type_for_reloc): Likewise.
2607         (Target_arm::do_finalize_sections): Correct interworking checks.
2608         * testsuite/Makefile.am: Add new tests.
2609         * testsuite/Makefile.in: Regenerate.
2610         * testsuite/arm_farcall_arm_arm.s: New test.
2611         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2612         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2613         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2614         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2615         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2616         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2617         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2618
2619 2011-10-31  Cary Coutant  <ccoutant@google.com>
2620
2621         PR gold/13023
2622         * expression.cc (Expression::eval_with_dot): Add
2623         is_section_dot_assignment parameter.
2624         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2625         absolute and assigning to dot within a section.
2626         * script-sections.cc
2627         (Output_section_element_assignment::set_section_addresses): Pass
2628         dot_section to set_if_absolute.
2629         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2630         as is_section_dot_assignment flag to eval_with_dot.
2631         (Output_section_element_dot_assignment::set_section_addresses):
2632         Likewise.
2633         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2634         parameter.  Also set value if relative to dot_section; set the
2635         symbol's output_section.
2636         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2637         parameter.  Adjust all callers.
2638         (Expression::eval_maybe_dot): Likewise.
2639         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2640         Adjust all callers.
2641         * testsuite/script_test_2.t: Test assignment of an absolute value
2642         to dot within an output section element.
2643
2644 2011-10-31  Cary Coutant  <ccoutant@google.com>
2645
2646         * options.h (class General_options): Add --[no-]gnu-unique options.
2647         * symtab.cc (Symbol_table::sized_write_globals): Convert
2648         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2649
2650 2011-10-31  Cary Coutant  <ccoutant@google.com>
2651
2652         PR gold/13359
2653         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2654         unnecessary assertion.
2655         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2656
2657 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2658
2659         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2660         gc_mark_symbol.
2661         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2662         gc_mark_symbol.
2663         Change to just keep the section associated with symbol.
2664         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2665         they are externally visible and --export-dynamic is turned on.
2666         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2667
2668 2011-10-19  Ian Lance Taylor  <iant@google.com>
2669
2670         PR gold/13163
2671         * script-sections.cc
2672         (Output_section_element_dot_assignment::needs_output_section): New
2673         function.
2674
2675 2011-10-19  Ian Lance Taylor  <iant@google.com>
2676
2677         PR gold/13204
2678         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2679         --section-start option was seen.
2680         * options.h (General_options::any_section_start): New function.
2681
2682 2011-10-18  David S. Miller  <davem@davemloft.net>
2683
2684         PR binutils/13301
2685         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2686         member to track relocation locations that have moved during TLS
2687         reloc optimizations.
2688         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2689         (Target_sparc::Relocate::relocate): Adjust view down by 4
2690         bytes if it matches reloc_adjust_addr_.
2691         (Target_sparc::Relocate::relocate_tls): Always move the
2692         __tls_get_addr call delay slot instruction forward 4 bytes when
2693         performing relaxation.
2694
2695 2011-10-18  Cary Coutant  <ccoutant@google.com>
2696
2697         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2698         (Output_file::map_no_anonymous): Check for non-zero
2699         return code from posix_fallocate.
2700
2701 2011-10-17  Cary Coutant  <ccoutant@google.com>
2702
2703         PR gold/13245
2704         * plugin.cc (is_visible_from_outside): Check for symbols
2705         referenced from dynamic objects.
2706         * resolve.cc (Symbol_table::resolve): Don't count references
2707         from dynamic objects as references from real ELF files.
2708         * testsuite/plugin_test_2.sh: Adjust expected result.
2709
2710 2011-10-17  Cary Coutant  <ccoutant@google.com>
2711
2712         * gold.cc: Include timer.h.
2713         (queue_middle_tasks): Stamp time.
2714         (queue_final_tasks): Likewise.
2715         * main.cc (main): Store timer in parameters.  Print timers
2716         for each pass.
2717         * parameters.cc (Parameters::Parameters): Initialize timer_.
2718         (Parameters::set_timer): New function.
2719         (set_parameters_timer): New function.
2720         * parameters.h (Parameters::set_timer): New function.
2721         (Parameters::timer): New function.
2722         (Parameters::timer_): New data member.
2723         (set_parameters_timer): New function.
2724         * timer.cc (Timer::stamp): New function.
2725         (Timer::get_pass_time): New function.
2726         * timer.h (Timer::stamp): New function.
2727         (Timer::get_pass_time): New function.
2728         (Timer::pass_times_): New data member.
2729
2730 2011-10-17  Cary Coutant  <ccoutant@google.com>
2731
2732         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2733         task for members of lib groups.
2734
2735 2011-10-17  Cary Coutant  <ccoutant@google.com>
2736
2737         PR gold/13288
2738         * fileread.cc (File_read::find_view): Add assert.
2739         (File_read::make_view): Move bounds check (replace with assert)...
2740         (File_read::find_or_make_view): ... to here.
2741
2742 2011-10-12  Cary Coutant  <ccoutant@google.com>
2743
2744         * output.cc (Output_file::open_base_file): Handle case where
2745         ::read returns less than requested size.
2746
2747 2011-10-10  Cary Coutant  <ccoutant@google.com>
2748
2749         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2750         Initialize defined_count_.
2751         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2752         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2753         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2754         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2755         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2756         * incremental.h (Sized_relobj_incr::defined_count_): New data
2757         member.
2758         (Sized_incr_dynobj::defined_count_): New data member.
2759         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2760         Return zeroes instead of internal error.
2761
2762 2011-10-10  Cary Coutant  <ccoutant@google.com>
2763
2764         PR gold/13249
2765         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2766         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2767         * output.h (class Output_reloc): Add use_plt_offset flag.
2768         (Output_reloc::type_): Adjust size of bit field.
2769         (Output_reloc::use_plt_offset_): New bit field.
2770         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2771         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2772         flag.  Adjust all callers.
2773         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2774         creating RELATIVE relocations.
2775
2776 2011-10-10  Nick Clifton  <nickc@redhat.com>
2777
2778         * po/es.po: Updated Spanish translation.
2779         * po/fi.po: Updated Finnish translation.
2780
2781 2011-10-03   Diego Novillo  <dnovillo@google.com>
2782
2783         * options.cc (parse_uint): Fix dereference of RETVAL.
2784
2785 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2786
2787         * layout.h (section_order_map_): New member.
2788         (get_section_order_map): New member function.
2789         * output.cc (Output_section::add_input_section): Check for patterns
2790         only when --section-ordering-file is specified.
2791         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2792         output_sections have been formed.
2793         * layout.cc (Layout_Layout): Initialize section_order_map_.
2794         * plugin.cc (update_section_order): Store order in order_map. Do not
2795         update the order.
2796         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2797         * testsuite/Makefile.in: Regenerate.
2798         * testsuite/plugin_section_order.c: New file.
2799         * testsuite/plugin_final_layout.cc: New file.
2800         * testsuite/plugin_final_layout.sh: New file.
2801
2802 2011-09-29  Cary Coutant  <ccoutant@google.com>
2803
2804         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2805         Check for NULL.
2806         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2807         symbols during incremental update.
2808         (Symbol_table::add_from_dynobj): Likewise.
2809
2810 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2811             Ian Lance Taylor  <iant@google.com>
2812
2813         * symtab.cc (Symbol_table::define_special_symbol): Always
2814         canonicalize version string.
2815
2816 2011-09-26  Cary Coutant  <ccoutant@google.com>
2817
2818         * gold.cc (queue_initial_tasks): Move option checks ...
2819         * options.cc (General_options::finalize): ... to here. Disable
2820         some options; make others fatal.
2821
2822 2011-09-26  Cary Coutant  <ccoutant@google.com>
2823
2824         gcc PR lto/47247
2825         * plugin.cc (get_symbols_v2): New function.
2826         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2827         (is_referenced_from_outside): New function.
2828         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2829         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2830         (get_symbols): Pass version parameter.
2831         (get_symbols_v2): New function.
2832         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2833         parameter.
2834         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2835         (onload): Add LDPT_GET_SYMBOLS_V2.
2836         (all_symbols_read_hook): Use get_symbols_v2; check for
2837         LDPR_PREVAILING_DEF_IRONLY_EXP.
2838         * testsuite/plugin_test_3.sh: Update expected results.
2839
2840 2011-09-23  Simon Baldwin  <simonb@google.com>
2841
2842         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2843         configuration options.
2844         * configure: Regenerate.
2845         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2846         * Makefile.in: Regenerate.
2847         * testsuite/Makefile.in: Regenerate.
2848
2849 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2850
2851         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2852
2853 2011-09-19  Cary Coutant  <ccoutant@google.com>
2854
2855         * incremental.cc (can_incremental_update): Fix typo in comment.
2856         * incremental.h (can_incremental_update): Likewise.
2857
2858 2011-09-18  Cary Coutant  <ccoutant@google.com>
2859
2860         * incremental.cc (can_incremental_update): New function.
2861         * incremental.h (can_incremental_update): New function.
2862         * layout.cc (Layout::init_fixed_output_section): Call it.
2863         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2864         * object.cc (Sized_relobj_file::do_layout): Call
2865         can_incremental_update.
2866
2867 2011-09-13  Cary Coutant  <ccoutant@google.com>
2868
2869         * configure.ac: Check for glibc support for gnu_indirect_function
2870         support with static linking, setting automake conditional
2871         IFUNC_STATIC.
2872         * Makefile.in: Regenerate.
2873         * configure: Regenerate.
2874
2875         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2876         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2877         for IFUNC_STATIC.
2878         * testsuite/Makefile.in: Regenerate.
2879
2880 2011-09-13  Cary Coutant  <ccoutant@google.com>
2881
2882         * incremental.cc (Sized_relobj_incr::do_layout): Call
2883         report_comdat_group for kept comdat sections.
2884         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2885         * testsuite/Makefile.in: Regenerate.
2886         * testsuite/incr_comdat_test_1.cc: New source file.
2887         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2888         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2889         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2890
2891 2011-09-13  Ian Lance Taylor  <iant@google.com>
2892
2893         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2894         variable external_symbols_offset.
2895
2896 2011-09-12  Ian Lance Taylor  <iant@google.com>
2897
2898         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2899         triggered if object has no symbols.
2900
2901 2011-09-09  David S. Miller  <davem@davemloft.net>
2902
2903         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2904         (Output_fill_debug_line::do_write): Likewise.
2905
2906 2011-08-29  Cary Coutant  <ccoutant@google.com>
2907
2908         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2909         casts to match formatting specs.
2910         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2911
2912 2011-08-26  Cary Coutant  <ccoutant@google.com>
2913
2914         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2915         remaining hole size when allocating.
2916         (Layout::make_output_section): Set fill methods for debug sections.
2917         * layout.h (Free_list::Free_list_node): Move from private to
2918         public.
2919         (Free_list::set_min_hole_size): New function.
2920         (Free_list::begin, Free_list::end): New functions.
2921         (Free_list::min_hole_): New data member.
2922         * output.cc: Include dwarf.h.
2923         (Output_fill_debug_info::do_minimum_hole_size): New function.
2924         (Output_fill_debug_info::do_write): New function.
2925         (Output_fill_debug_line::do_minimum_hole_size): New function.
2926         (Output_fill_debug_line::do_write): New function.
2927         (Output_section::Output_section): Initialize new data member.
2928         (Output_section::set_final_data_size): Ensure patch space is larger
2929         than minimum hole size.
2930         (Output_section::do_write): Fill holes in debug sections.
2931         * output.h (Output_fill): New class.
2932         (Output_fill_debug_info): New class.
2933         (Output_fill_debug_line): New class.
2934         (Output_section::set_free_space_fill): New function.
2935         (Output_section::free_space_fill_): New data member.
2936         * testsuite/Makefile.am (incremental_test_3): Add
2937         --incremental-patch option.
2938         (incremental_test_4): Likewise.
2939         (incremental_test_5): Likewise.
2940         (incremental_test_6): Likewise.
2941         (incremental_copy_test): Likewise.
2942         (incremental_common_test_1): Likewise.
2943         * testsuite/Makefile.in: Regenerate.
2944
2945 2011-08-26  Nick Clifton  <nickc@redhat.com>
2946
2947         * po/es.po: Updated Spanish translation.
2948
2949 2011-08-01  Cary Coutant  <ccoutant@google.com>
2950
2951         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2952         * gold/testsuite/Makefile.in: Regenerate.
2953         * gold/testsuite/justsyms_exec.c: New source file.
2954         * gold/testsuite/justsyms_lib.c: New source file.
2955
2956 2011-08-01  Cary Coutant  <ccoutant@google.com>
2957
2958         * layout.cc (Layout::set_segment_offsets): Don't realign text
2959         segment if -Ttext was specified.
2960         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2961         file type.
2962         * object.h (Sized_relobj_file::e_type): New function.
2963         (Sized_relobj_file::e_type_): New data member.
2964         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2965         base address for ET_EXEC files.
2966         * target.cc (Target::do_make_elf_object_implementation): Allow
2967         ET_EXEC files with --just-symbols option.
2968
2969 2011-07-28  Cary Coutant  <ccoutant@google.com>
2970
2971         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2972         Add thread_number parameter.
2973         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2974         * workqueue-threads.cc
2975         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2976         current thread if its thread number is greater than desired thread
2977         count.
2978         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2979         Add thread_number parameter.
2980         (Workqueue::should_cancel_thread): Likewise.
2981         (Workqueue::find_runnable_or_wait): Pass thread_number to
2982         should_cancel_thread.
2983         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2984         parameter.
2985
2986 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2987
2988         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2989         only after checking if it cannot be forced local.
2990         * symtab.h (is_externally_visible): Check if the symbol is not forced
2991         local.
2992
2993 2011-07-15  Ian Lance Taylor  <iant@google.com>
2994
2995         * options.h (class General_options): Add --print-output-format.
2996         Move -EL next to -EB, for  better --help output.
2997         * target-select.cc: Include <cstdio>, "options.h", and
2998         "parameters.h".
2999         (Target_selector::do_target_bfd_name): New function.
3000         (print_output_format): New function.
3001         * target-select.h (class Target_selector): Update declarations.
3002         (Target_selector::target_bfd_name): New function.
3003         (print_output_format): Declare.
3004         * main.cc: Include "target-select.h".
3005         (main): Handle --print-output-format.
3006         * gold.cc: Include "target-select.h".
3007         (queue_initial_tasks): Handle --print-output-format when there are
3008         no input files.
3009         * parameters.cc (parameters_force_valid_target): Give a better
3010         error message if -EB/-EL does not match target.
3011         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3012         function.
3013
3014 2011-07-15  Ian Lance Taylor  <iant@google.com>
3015
3016         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3017         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3018         (Output_data_plt_i386::do_write): Write address of .dynamic
3019         section to first entry in .got.plt section.
3020         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3021         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3022         Initialize layout_.
3023         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3024         section to first entry in .got.plt section.
3025         * layout.h (Layout::dynamic_section): New function.
3026
3027 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3028
3029         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3030         to claim_file call.
3031         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3032         input_section_position_, and input_section_glob_.
3033         (read_layout_from_file): Call function section_ordering_specified.
3034         * layout.h (is_section_ordering_specified): New function.
3035         (section_ordering_specified): New function.
3036         (section_ordering_specified_): New boolean member.
3037         * main.cc(main): Call load_plugins after layout object is defined.
3038         * output.cc (Output_section::add_input_section): Use
3039         function section_ordering_specified to check if section ordering is
3040         needed.
3041         * output.cc (Output_section::add_relaxed_input_section): Use
3042         function section_ordering_specified to check if section ordering is
3043         needed.
3044         (Output_section::update_section_layout): New function.
3045         (Output_section::sort_attached_input_sections): Check if input section
3046         must be reordered.
3047         * output.h (Output_section::update_section_layout): New function.
3048         * plugin.cc (get_section_count): New function.
3049         (get_section_type): New function.
3050         (get_section_name): New function.
3051         (get_section_contents): New function.
3052         (update_section_order): New function.
3053         (allow_section_ordering): New function.
3054         (Plugin::load): Add the new interfaces to the transfer vector.
3055         (Plugin_manager::load_plugins): New parameter.
3056         (Plugin_manager::all_symbols_read): New parameter.
3057         (Plugin_manager::claim_file): New parameter. Save the elf object for
3058         unclaimed objects.
3059         (Plugin_manager::get_elf_object): New function.
3060         (Plugin_manager::get_view): Change to directly use the bool to check
3061         if get_view is called from claim_file_hook.
3062         * plugin.h (input_objects): New function
3063         (Plugin__manager::load_plugins): New parameter.
3064         (Plugin_manager::claim_file): New parameter.
3065         (Plugin_manager::get_elf_object): New function.
3066         (Plugin_manager::in_claim_file_handler): New function.
3067         (Plugin_manager::in_claim_file_handler_): New member.
3068         (layout): New function.
3069         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3070         handler with an extra parameter. Make the elf object before calling
3071         claim_file handler.
3072         * testsuite/plugin_test.c (get_section_count): New function pointer.
3073         (get_section_type): New function pointer.
3074         (get_section_name): New function pointer.
3075         (get_section_contents): New function pointer.
3076         (update_section_order): New function pointer.
3077         (allow_section_ordering): New function pointer.
3078         (onload): Check if the new interfaces exist.
3079
3080 2011-07-13  Ian Lance Taylor  <iant@google.com>
3081
3082         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3083         relro section.
3084         * x86_64.cc (Target_x86_64::got_section): Likewise.
3085         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3086         (relro_now_test_SOURCES): New variable.
3087         (relro_now_test_DEPENDENCIES): New variable.
3088         (relro_now_test_LDFLAGS): New variable.
3089         (relro_now_test_LDADD): New variable.
3090         (relro_now_test.so): New target.
3091         * testsuite/Makefile.in: Rebuild.
3092
3093 2011-07-12  Ian Lance Taylor  <iant@google.com>
3094
3095         PR gold/12980
3096         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3097         GLOB_DAT relocation rather than a RELATIVE relocation for a
3098         protected symbol when creating a shared library.
3099         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3100         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3101         * testsuite/protected_main_1.cc (main): Test that protected
3102         function has same address.
3103
3104 2011-07-11  Ian Lance Taylor  <iant@google.com>
3105
3106         PR gold/12979
3107         * options.h (class General_options): Add -Bgroup.
3108         * options.cc (General_options::finalize): If -Bgroup is set,
3109         default to --unresolved-symbols=report-all.
3110         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3111         * target-reloc.h (issue_undefined_symbol_error): Handle
3112         --unresolved-symbols=report-all.
3113
3114 2011-07-08  Ian Lance Taylor  <iant@google.com>
3115
3116         PR gold/11985
3117         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3118         if linker script discards key sections.
3119         (Layout::create_dynamic_symtab): Likewise.
3120         (Layout::assign_local_dynsym_offsets): Likewise.
3121         (Layout::sized_create_version_sections): Likewise.
3122         (Layout::create_interp): Likewise.
3123         (Layout::finish_dynamic_section): Likewise.
3124         (Layout::set_dynamic_symbol_size): Likewise.
3125
3126 2011-07-08  Ian Lance Taylor  <iant@google.com>
3127
3128         PR gold/12386
3129         * options.h (class General_options): Add --unresolved-symbols.
3130         * target-reloc.h (issue_undefined_symbol_error): Check
3131         --unresolved-symbols.  Add comments.
3132
3133 2011-07-08  Ian Lance Taylor  <iant@google.com>
3134
3135         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3136         expression more complex.
3137
3138 2011-07-08  Ian Lance Taylor  <iant@google.com>
3139
3140         PR gold/11317
3141         * target-reloc.h (issue_undefined_symbol_error): New inline
3142         function, broken out of relocate_section.
3143         (relocate_section): Call issue_undefined_symbol_error.
3144         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3145         there is no TLS segment if we are about to issue an undefined
3146         symbol error.
3147         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3148
3149 2011-07-08  Ian Lance Taylor  <iant@google.com>
3150
3151         PR gold/12279
3152         * resolve.cc (Symbol_table::should_override): Add fromtype
3153         parameter.  Change all callers.  Give error when linking together
3154         TLS and non-TLS symbol.
3155         (Symbol_table::should_override_with_special): Add fromtype
3156         parameter.  Change all callers.
3157         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3158         there is no TLS segment if we have reported some errors.
3159         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3160
3161 2011-07-08  Ian Lance Taylor  <iant@google.com>
3162
3163         PR gold/12372
3164         * target.h (Target::plt_address_for_global): New function.
3165         (Target::plt_address_for_local): New function.
3166         (Target::plt_section_for_global): Remove.
3167         (Target::plt_section_for_local): Remove.
3168         (Target::do_plt_address_for_global): New virtual function.
3169         (Target::do_plt_address_for_local): New virtual function.
3170         (Target::do_plt_section_for_global): Remove.
3171         (Target::do_plt_section_for_local): Remove.
3172         (Target::register_global_plt_entry): Add Symbol_table and Layout
3173         parameters.
3174         * output.cc (Output_data_got::Got_entry::write): Use
3175         plt_address_for_global and plt_address_for_local.
3176         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3177         address of output section.
3178         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3179         got_irelative_, and irelative_count_ fields.  Update
3180         declarations.
3181         (Output_data_plt_i386::has_irelative_section): New function.
3182         (Output_data_plt_i386::entry_count): Add irelative_count_.
3183         (Output_data_plt_i386::set_final_data_size): Likewise.
3184         (class Target_i386): Add got_irelative_ and rel_irelative_
3185         fields.  Update declarations.
3186         (Target_i386::Target_i386): Initialize new fields.
3187         (Target_i386::do_plt_address_for_global): New function replacing
3188         do_plt_section_for_global.
3189         (Target_i386::do_plt_address_for_local): New function replacing
3190         do_plt_section_for_local.
3191         (Target_i386::got_section): Create got_irelative_.
3192         (Target_i386::rel_irelative_section): New function.
3193         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3194         fields.  Don't define __rel_iplt_{start,end}.
3195         (Output_data_plt_i386::add_entry): Add symtab and layout
3196         parameters.  Change all callers.  Use different PLT and GOT for
3197         IFUNC symbols.
3198         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3199         layout parameters.  Change all callers.  Use different PLT and
3200         GOT.
3201         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3202         (Output_data_plt_i386::rel_irelative): New function.
3203         (Output_data_plt_i386::address_for_global): New function.
3204         (Output_data_plt_i386::address_for_local): New function.
3205         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3206         IRELATIVE GOT when changing IFUNC GOT entries.
3207         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3208         reloc.
3209         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3210         if we didn't create an IRELATIVE GOT.
3211         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3212         plt_address_for_local.
3213         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3214         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3215         got_irelative_, and irelative_count_ fields.  Update
3216         declarations.
3217         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3218         Initialize new fields.  Remove symtab parameter.  Change all
3219         callers.
3220         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3221         irelative_count_.
3222         (Output_data_plt_x86_64::has_irelative_section): New function.
3223         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3224         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3225         fields.  Update declarations.
3226         (Target_x86_64::Target_x86_64): Initialize new fields.
3227         (Target_x86_64::do_plt_address_for_global): New function replacing
3228         do_plt_section_for_global.
3229         (Target_x86_64::do_plt_address_for_local): New function replacing
3230         do_plt_section_for_local.
3231         (Target_x86_64::got_section): Create got_irelative_.
3232         (Target_x86_64::rela_irelative_section): New function.
3233         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3234         all callers.  Don't create __rel_iplt_{start,end}.
3235         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3236         parameters.  Change all callers.  Use different PLT and GOT for
3237         IFUNC symbols.
3238         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3239         layout parameters.  Change all callers.  Use different PLT and
3240         GOT.
3241         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3242         parameters.  Change all callers.  Use different PLT and GOT for
3243         IFUNC symbols.
3244         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3245         (Output_data_plt_x86_64::rela_irelative): New function.
3246         (Output_data_plt_x86_64::address_for_global): New function.
3247         (Output_data_plt_x86_64::address_for_local): New function.
3248         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3249         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3250         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3251         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3252         parameters.
3253         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3254         reloc.
3255         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3256         symbols if we didn't create an IRELATIVE GOT.
3257         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3258         plt_address_for_local.
3259         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3260         * testsuite/ifuncvar1.c: New test file.
3261         * testsuite/ifuncvar2.c: New test file.
3262         * testsuite/ifuncvar3.c: New test file.
3263         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3264         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3265         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3266         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3267         * testsuite/Makefile.in: Rebuild.
3268
3269 2011-07-07  Cary Coutant  <ccoutant@google.com>
3270
3271         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3272         (two_file_test_1_ndebug.o): Likewise.
3273         (two_file_test_1b_ndebug.o): Likewise.
3274         (two_file_test_2_ndebug.o): Likewise.
3275         (two_file_test_main_ndebug.o): Likewise.
3276         (incremental_test_2): Link with no-debug versions.
3277
3278 2011-07-06  Cary Coutant  <ccoutant@google.com>
3279
3280         * gold/incremental.cc
3281         (Output_section_incremental_inputs::write_info_blocks): Check for
3282         hidden and internal symbols.
3283
3284 2011-07-06  Cary Coutant  <ccoutant@google.com>
3285
3286         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3287         Check disposition for startup file.
3288         (Incremental_inputs::report_command_line): Ignore
3289         --incremental-startup-unchanged option.
3290         * options.cc (General_options::parse_incremental_startup_unchanged):
3291         New function.
3292         (General_options::General_options): Initialize new data member.
3293         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3294         (General_options): Add --incremental-startup-unchanged option.
3295         (General_options::incremental_startup_disposition): New function.
3296         (General_options::incremental_startup_disposition_): New data member.
3297
3298 2011-07-06  Cary Coutant  <ccoutant@google.com>
3299
3300         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3301         input file index to Script_info ctor.
3302         (Sized_incremental_binary::do_file_has_changed): Find the
3303         command-line argument for files named in scripts.
3304         * incremental.h (Script_info::Script_info): New ctor
3305         with input file index.
3306         (Script_info::input_file_index): New function.
3307         (Script_info::input_file_index_): New data member.
3308         (Incremental_binary::get_library): Add const.
3309         (Incremental_binary::get_script_info): Add const.
3310         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3311         * testsuite/Makefile.am (incremental_test_5): New test case.
3312         (incremental_test_6): New test case.
3313         * testsuite/Makefile.in: Regenerate.
3314
3315 2011-07-06  Cary Coutant  <ccoutant@google.com>
3316
3317         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3318         debug output when command lines differ.
3319
3320 2011-07-06  Cary Coutant  <ccoutant@google.com>
3321
3322         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3323         --incremental-patch option.
3324         * layout.cc (Free_list::allocate): Extend allocation beyond original
3325         end if enabled.
3326         (Layout::make_output_section): Mark sections that should get
3327         patch space.
3328         * options.cc (parse_percent): New function.
3329         * options.h (parse_percent): New function.
3330         (DEFINE_percent): New macro.
3331         (General_options): Add --incremental-patch option.
3332         * output.cc (Output_section::Output_section): Initialize new data
3333         members.
3334         (Output_section::add_input_section): Print section name when out
3335         of patch space.
3336         (Output_section::add_output_section_data): Likewise.
3337         (Output_section::set_final_data_size): Add patch space when
3338         doing --incremental-full.
3339         (Output_section::do_reset_address_and_file_offset): Remove patch
3340         space.
3341         (Output_segment::set_section_list_addresses): Print debug output
3342         only if --incremental-update.
3343         * output.h (Output_section::set_is_patch_space_allowed): New function.
3344         (Output_section::is_patch_space_allowed_): New data member.
3345         (Output_section::patch_space_): New data member.
3346         * parameters.cc (Parameters::incremental_full): New function.
3347         * parameters.h (Parameters::incremental_full): New function
3348         * testsuite/Makefile.am (incremental_test_2): Add test for
3349         --incremental-patch option.
3350         * testsuite/Makefile.in: Regenerate.
3351         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3352         (t18): Remove function body.
3353
3354 2011-07-05  Doug Kwan  <dougkwan@google.com>
3355
3356         PR gold/12771
3357         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3358         Arm_Address type for relocation result.
3359         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3360         overflow check.
3361         (Arm_relocate_functions::abs32): Use unaligned access.
3362         (Arm_relocate_functions::rel32): Ditto.
3363         (Arm_relocate_functions::prel31): Ditto.
3364         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3365         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3366         static data relocations.
3367         * testsuite/Makefile.in: Regnerate.
3368         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3369
3370 2011-07-05  Ian Lance Taylor  <iant@google.com>
3371
3372         PR gold/12392
3373         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3374         symbols if necessary.
3375         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3376
3377 2011-07-05  Ian Lance Taylor  <iant@google.com>
3378
3379         PR gold/12952
3380         * resolve.cc (Symbol::override_base_with_special): Simply override
3381         version with special symbol version, ignoring previous version.
3382
3383 2011-07-05  Ian Lance Taylor  <iant@google.com>
3384
3385         * object.cc (Sized_relobj_file::include_section_group): Add
3386         information to comment about signature location.
3387
3388 2011-07-02  Ian Lance Taylor  <iant@google.com>
3389
3390         PR gold/12957
3391         * options.h (class General_options): Add -f and -F.
3392         * options.cc (General_options::finalize): Fatal error if -f/-F
3393         are used without -shared.
3394         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3395
3396 2011-07-02  Ian Lance Taylor  <iant@google.com>
3397
3398         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3399
3400 2011-07-01  Ian Lance Taylor  <iant@google.com>
3401
3402         PR gold/12525
3403         PR gold/12952
3404         * resolve.cc (Symbol::override_base_with_special): Don't override
3405         the version if the overriding symbol has a different name.
3406         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3407         all callers.  If we give an error about an undefined version,
3408         define the base version if necessary.
3409         * dynobj.h (class Versions): Update declaration.
3410         * testsuite/weak_alias_test_5.cc: New file.
3411         * testsuite/weak_alias_test.script: New file.
3412         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3413         and versioned_alias have the right value, and call t2.
3414         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3415         weak_alias_test_5.so.
3416         (weak_alias_test_LDADD): Likewise.
3417         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3418         * testsuite/Makefile.in: Rebuild.
3419
3420 2011-07-01  Ian Lance Taylor  <iant@google.com>
3421
3422         PR gold/12525
3423         * options.h (class General_options): Support -z notext.
3424         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3425         -Wl,-z,notext.
3426         (two_file_shared_nonpic.so): Likewise.
3427         (two_file_shared_mixed.so): Likewise.
3428         (two_file_shared_mixed_1.so): Likewise.
3429         (weak_undef_lib_nonpic.so): Likewise.
3430         (alt/weak_undef_lib_nonpic.so): Likewise.
3431         (tls_test_shared_nonpic.so): Likewise.
3432         * testsuite/Makefile.in: Rebuild.
3433
3434 2011-07-01  Ian Lance Taylor  <iant@google.com>
3435
3436         PR gold/12525
3437         * configure.ac: Test whether static linking works, setting
3438         the automake conditional HAVE_STATIC.
3439         * testsuite/Makefile.am: Disable tests using -static if
3440         HAVE_STATIC is not true.
3441         * configure, testsuite/Makefile.in: Rebuild.
3442
3443 2011-07-01  Ian Lance Taylor  <iant@google.com>
3444
3445         PR gold/12525
3446         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3447         Assert if we see DW_EH_PE_indirect.
3448         * target.h (Target::ehframe_datarel_base): New function.
3449         (Target::do_ehframe_datarel_base): New target function.
3450         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3451         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3452         function.
3453
3454 2011-07-01  Ian Lance Taylor  <iant@google.com>
3455
3456         PR gold/12571
3457         * options.h (class General_options): Add
3458         --ld-generated-unwind-info.
3459         * ehframe.cc (Fde::write): Add address parameter.  Change all
3460         callers.  If associated with PLT, fill in address and size.
3461         (Cie::set_output_offset): Only add merge mapping if there is an
3462         object.
3463         (Cie::write): Add address parameter.  Change all callers.
3464         (Eh_frame::add_ehframe_for_plt): New function.
3465         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3466         input_offset_ fields into union u_, with new plt field.
3467         (Fde::Fde): Adjust for new union field.
3468         (Fde::Fde) [Output_data version]: New constructor.
3469         (Fde::add_mapping): Only add merge mapping if there is an object.
3470         (class Cie): Update declarations.
3471         (class Eh_frame): Declare add_ehframe_for_plt.
3472         * layout.cc (Layout::layout_eh_frame): Break out code into
3473         make_eh_frame_section, and call it.
3474         (Layout::make_eh_frame_section): New function.
3475         (Layout::add_eh_frame_for_plt): New function.
3476         * layout.h (class Layout): Update declarations.
3477         * merge.cc (Merge_map::add_mapping): Add assertion.
3478         * i386.cc: Include "dwarf.h".
3479         (class Output_data_plt_i386): Make first_plt_entry,
3480         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3481         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3482         and plt_eh_frame_fde.
3483         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3484         boundary.  Call add_eh_frame_for_plt if appropriate.
3485         * x86_64.cc: Include "dwarf.h".
3486         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3487         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3488         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3489         and plt_eh_frame_fde.
3490         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3491         appropriate.
3492
3493 2011-06-29  Ian Lance Taylor  <iant@google.com>
3494
3495         PR gold/12629
3496         * object.cc (Sized_relobj_file::layout_section): Change shdr
3497         parameter to be const.
3498         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3499         out of do_layout.
3500         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3501         appropriate.  Call layout_eh_frame_section.
3502         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3503         sections.
3504         * object.h (class Sized_relobj_file): Update declarations.
3505
3506 2011-06-29  Ian Lance Taylor  <iant@google.com>
3507
3508         PR gold/12652
3509         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3510         modifier.
3511         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3512
3513 2011-06-29  Ian Lance Taylor  <iant@google.com>
3514
3515         PR gold/12675
3516         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3517         SHT_X86_64_UNWIND.
3518         * layout.cc (Layout::layout_eh_frame): Likewise.
3519
3520 2011-06-29  Ian Lance Taylor  <iant@google.com>
3521
3522         PR gold/12695
3523         * layout.cc (Layout::symtab_section_shndx): New function.
3524         * layout.h (class Layout): Declare symtab_section_shndx.
3525         * output.cc (Output_section::write_header): Call it.
3526
3527 2011-06-29  Ian Lance Taylor  <iant@google.com>
3528
3529         PR gold/12818
3530         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3531         symbols which are not used in a relocation.
3532
3533 2011-06-28  Ian Lance Taylor  <iant@google.com>
3534
3535         PR gold/12898
3536         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3537         script create indistinguishable segments.
3538         (Layout::set_segment_offsets): Use stable_sort when sorting
3539         segments.  Pass this to Compare_segments constructor.
3540         * layout.h (class Layout): Make segment_precedes non-static.
3541         (class Compare_segments): Change from struct to class.  Add
3542         layout_ field.  Add constructor.
3543         * script-sections.cc
3544         (Script_sections::attach_sections_using_phdrs_clause): Rename
3545         local orphan to is_orphan.  Don't report failure to put empty
3546         section in segment.  On attachment failure, report name of
3547         section, and attach to first PT_LOAD segment.
3548
3549 2011-06-28  Ian Lance Taylor  <iant@google.com>
3550
3551         PR gold/12934
3552         * target-select.cc (Target_selector::Target_selector): Add
3553         emulation parameter.  Change all callers.
3554         (select_target_by_bfd_name): Rename from select_target_by_name.
3555         Change all callers.
3556         (select_target_by_emulation): New function.
3557         (supported_emulation_names): New function.
3558         * target-select.h (class Target_selector): Add emulation_ field.
3559         Update declarations.
3560         (Target_selector::recognize_by_bfd_name): Rename from
3561         recognize_by_name.  Change all callers.
3562         (Target_selector::supported_bfd_names): Rename from
3563         supported_names.  Change all callers.
3564         (Target_selector::recognize_by_emulation): New function.
3565         (Target_selector::supported_emulations): New function.
3566         (Target_selector::emulation): New function.
3567         (Target_selector::do_recognize_by_bfd_name): Rename from
3568         do_recognize_by_name.  Change all callers.
3569         (Target_selector::do_supported_bfd_names): Rename from
3570         do_supported_names.  Change all callers.
3571         (Target_selector::do_recognize_by_emulation): New function.
3572         (Target_selector::do_supported_emulations): New function.
3573         (select_target_by_bfd_name): Change name in declaration.
3574         (select_target_by_emulation): Declare.
3575         (supported_emulation_names): Declare.
3576         * parameters.cc (parameters_force_valid_target): Try to find
3577         target based on emulation from -m option.
3578         * options.h (class General_options): Change doc string for -m.
3579         * options.cc (help): Print emulations.
3580         (General_options::parse_V): Likewise.
3581         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3582         Add emulation parameter.  Change all callers.
3583
3584 2011-06-28  Ian Lance Taylor  <iant@google.com>
3585
3586         * target.h (class Target): Add osabi_ field.
3587         (Target::osabi): New function.
3588         (Target::set_osabi): New function.
3589         (Target::Target): Initialize osabi_.
3590         (Target::do_adjust_elf_header): Make pure virtual.
3591         (Sized_target::do_adjust_elf_header): Declare.
3592         * target.cc (Sized_target::do_adjust_elf_header): New function.
3593         (class Sized_target): Instantiate all versions.
3594         * freebsd.h (class Target_freebsd): Remove.
3595         (Target_selector_freebsd::do_recognize): Call set_osabi on
3596         Target.
3597         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3598         (Target_selector_freebsd::set_osabi): Remove.
3599         * i386.cc (class Target_i386): Inherit from Sized_target rather
3600         than Target_freebsd.
3601         * x86_64.cc (class Target_x86_64): Likewise.
3602
3603 2011-06-28  Ian Lance Taylor  <iant@google.com>
3604
3605         * target.h (Target::can_check_for_function_pointers): Rewrite.
3606         Make non-virtual.
3607         (Target::can_icf_inline_merge_sections): Likewise.
3608         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3609         (Target::Target_info): Add can_icf_inline_merge_sections field.
3610         (Target::do_can_check_for_function_pointers): New virtual
3611         function.
3612         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3613         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3614         from can_check_for_function_pointers, move in file.
3615         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3616         section_may_have_icf_unsafe_poineters, move in file.
3617         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3618         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3619         Rename from can_check_for_function_pointers, move in file.
3620         (Target_i386::can_icf_inline_merge_sections): Remove.
3621         (Target_i386::i386_info): Initialize
3622         can_icf_inline_merge_sections.
3623         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3624         Initialize can_icf_inline_merge_sections.
3625         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3626         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3627         Rename from can_check_for_function_pointers, move in file.
3628         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3629         (Target_x86_64::x86_64_info): Initialize
3630         can_icf_inline_merge_sections.
3631         * testsuite/testfile.cc (Target_test::test_target_info):
3632         Likewise.
3633         * icf.cc (get_section_contents): Correct formatting.
3634
3635 2011-06-27  Ian Lance Taylor  <iant@google.com>
3636
3637         * symtab.cc (Symbol::versioned_name): New function.
3638         (Symbol_table::add_to_final_symtab): Use versioned_name when
3639         appropriate.
3640         (Symbol_table::sized_write_symbol): Likewise.
3641         * symtab.h (class Symbol): Declare versioned_name.
3642         * stringpool.h (class Stringpool_template): Add variant of add
3643         which takes a std::basic_string.
3644         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3645         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3646         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3647         (ver_test_12.o): New target.
3648         * testsuite/Makefile.in: Rebuild.
3649
3650 2011-06-27  Doug Kwan  <dougkwan@google.com>
3651
3652         * arm.cc (Arm_relocate_functions::thm_jump8,
3653         Arm_relocate_functions::thm_jump11): Use a wider signed
3654         type to compute offset.
3655         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3656         arm_thm_jump8.
3657         * testsuite/Makefile.in: Regenerate.
3658         * testsuite/arm_branch_in_range.sh: Check test results of
3659         arm_thm_jump11 and arm_thm_jump8.
3660         * testsuite/arm_thm_jump11.s: New test source file.
3661         * testsuite/arm_thm_jump11.t: New linker script.
3662         * testsuite/arm_thm_jump8.s: New test source file.
3663         * testsuite/arm_thm_jump8.t: New linker script.
3664
3665 2011-06-24  Ian Lance Taylor  <iant@google.com>
3666
3667         * layout.cc: Include "object.h".
3668         (ctors_sections_in_init_array): New static variable.
3669         (Layout::is_ctors_in_init_array): New function.
3670         (Layout::layout): Add entry to ctors_sections_in_init_array if
3671         appropriate.
3672         * layout.h (class Layout): Declare is_ctors_in_init_array.
3673         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3674         is_ctors_reverse_view is set.
3675         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3676         all callers.  Set is_ctors_reverse_view field of View_size.
3677         (Sized_relobj_file::reverse_words): New function.
3678         * object.h (Sized_relobj_file::View_size): Add
3679         is_ctors_reverse_view field.
3680         (class Sized_relobj_file): Update declarations.
3681         * testsuite/initpri3.c: New test.
3682         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3683         initpri3b.
3684         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3685         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3686         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3687         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3688         * testsuite/Makefile.in: Rebuild.
3689
3690 2011-06-24  Cary Coutant  <ccoutant@google.com>
3691
3692         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3693         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3694         (debug_msg_cdebug.err): New targets.
3695         * testsuite/Makefile.in: Regenerate.
3696         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3697         Fix checks for link with shared library.
3698
3699 2011-06-24  Doug Kwan  <dougkwan@google.com>
3700
3701         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3702         skip empty text sections.
3703         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3704
3705 2011-06-22  Ian Lance Taylor  <iant@google.com>
3706
3707         PR gold/12910
3708         * options.h (class General_options): Add --ctors-in-init-array.
3709         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3710         friends as SHT_PROGBITS for merging sections.
3711         (Layout::layout): Remove special handling of .init_array and
3712         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3713         and .dtors if ctors_in_init_array.
3714         (Layout::make_output_section): Force correct section types for
3715         .init_array and friends.  Don't sort if doing relocatable link,
3716         Don't sort .ctors and .dtors if ctors_in_init_array.
3717         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3718         (Layout::output_section_name): Add relobj parameter.  Change all
3719         callers.  Handle .ctors. and .dtors. in code rather than table.
3720         Handle .ctors and .dtors if ctors_in_init_array.
3721         (Layout::match_file_name): New function, moved from output.cc.
3722         * layout.h (class Layout): Update declarations.
3723         * output.cc: Include "layout.h".
3724         (Input_section_sort_entry::get_priority): New function.
3725         (Input_section_sort_entry::match_file_name): Just call
3726         Layout::match_file_name.
3727         (Output_section::Input_section_sort_init_fini_compare::operator()):
3728         Handle .ctors and .dtors.  Sort by explicit priority rather than
3729         by name.
3730         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3731         * testsuite/initpri2.c: New test.
3732         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3733         (check_PROGRAMS): Add initpri2.
3734         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3735         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3736         * configure, testsuite/Makefile.in: Rebuild.
3737
3738 2011-06-19  Ian Lance Taylor  <iant@google.com>
3739
3740         PR gold/12880
3741         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3742         .interp section to a PT_INTERP segment even if we have seen a
3743         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3744         clause in a linker script.
3745         (Layout::finalize): Don't create a .interp section if we've
3746         already create a PT_INTERP segment.
3747         (Layout::create_interp): Always call choose_output_section (revert
3748         patch of 2011-06-17).  Don't create PT_INTERP segment.
3749         * script-sections.cc
3750         (Script_sections::create_note_and_tls_segments): Add a .interp
3751         section to a PT_INTERP segment even if we have seen a
3752         --dynamic-linker option.
3753
3754 2011-06-18  Ian Lance Taylor  <iant@google.com>
3755
3756         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3757         merely because a non-PT_LOAD segment has a dynamic reloc.
3758
3759 2011-06-18  Ian Lance Taylor  <iant@google.com>
3760
3761         * layout.cc (Layout::finish_dynamic_section): Don't create
3762         DT_FLAGS entry if not needed.
3763
3764 2011-06-18  Ian Lance Taylor  <iant@google.com>
3765
3766         PR gold/12745
3767         * layout.cc (Layout::layout_eh_frame): Correct handling of
3768         writable .eh_frame section.
3769
3770 2011-06-17  Ian Lance Taylor  <iant@google.com>
3771
3772         PR gold/12893
3773         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3774         symbol is redefined with the exact same object and value.
3775
3776 2011-06-17  Ian Lance Taylor  <iant@google.com>
3777
3778         PR gold/12880
3779         * layout.h (class Layout): Add interp_segment_ field.
3780         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3781         (Layout::attach_allocated_section_to_segment): If making shared
3782         library, put .interp section in PT_INTERP segment.
3783         (Layout::finalize): Also call create_interp if -dynamic-linker
3784         option was used.
3785         (Layout::create_interp): Assert that there is no PT_INTERP
3786         segment.  If not using a SECTIONS clause, use make_output_section.
3787         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3788         * script-sections.cc
3789         (Script_sections::create_note_and_tls_segments): If making shared
3790         library, put .interp section in PT_INTERP segment.
3791
3792 2011-06-17  Ian Lance Taylor  <iant@google.com>
3793
3794         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3795         when making a shared library.
3796
3797 2011-06-17  Ian Lance Taylor  <iant@google.com>
3798
3799         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3800         parameter.  Change all callers.  Don't issue warning about PC32
3801         against locally defined symbol.
3802
3803 2011-06-16  Ian Lance Taylor  <iant@google.com>
3804
3805         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3806         occurs in same object.
3807
3808 2011-06-14  Alan Modra  <amodra@gmail.com>
3809
3810         * po/POTFILES.in: Regenerate.
3811
3812 2011-06-09  Ian Lance Taylor  <iant@google.com>
3813
3814         * script-sections.cc
3815         (Orphan_output_section::set_section_addresses): For a relocatable
3816         link set address to 0.
3817
3818 2011-06-09  Cary Coutant  <ccoutant@google.com>
3819
3820         PR gold/12804
3821         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3822         used with --compress-debug-sections.
3823         * gold/object.cc (Sized_relobj_file::do_layout): Report
3824         uncompressed size of compressed input sections.
3825
3826 2011-06-08  Cary Coutant  <ccoutant@google.com>
3827
3828         PR gold/12804
3829         * testsuite/two_file_test_2_v1.cc: Change initialization of
3830         v2 to keep it in .data.
3831
3832 2011-06-07  Cary Coutant  <ccoutant@google.com>
3833
3834         * common.cc (Symbol_table::do_allocate_commons_list): Call
3835         gold_fallback.
3836         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3837         (Errors::fallback): New function.
3838         (gold_fallback): New function.
3839         * errors.h (Errors::fallback): New function.
3840         * gold.cc (gold_exit): Change status parameter to enum; adjust
3841         all callers.
3842         (queue_initial_tasks): Call gold_fallback.
3843         * gold.h: Include cstdlib.
3844         (Exit_status): New enum type.
3845         (gold_exit): Change status parameter to enum.
3846         (gold_fallback): New function.
3847         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3848         (Layout::create_symtab_sections): Likewise.
3849         (Layout::create_shdrs): Likewise.
3850         * main.cc (main): Adjust call to gold_exit.
3851         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3852         (Output_data_got::add_got_entry_pair): Likewise.
3853         (Output_section::add_input_section): Likewise.
3854         (Output_section::add_output_section_data): Likewise.
3855         (Output_segment::set_section_list_addresses): Likewise.
3856         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3857
3858 2011-06-07  Cary Coutant  <ccoutant@google.com>
3859
3860         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3861         for incremental links.
3862         * output.cc (Output_segment::set_section_list_addresses): Remove
3863         FIXME and test for TLS or BSS.
3864
3865 2011-06-07  Cary Coutant  <ccoutant@google.com>
3866
3867         * testsuite/Makefile.am: Add incremental_copy_test,
3868         incremental_common_test_1.
3869         * testsuite/Makefile.in: Regenerate.
3870         * testsuite/common_test_1_v1.c: New source file.
3871         * testsuite/common_test_1_v2.c: New source file.
3872         * testsuite/copy_test_v1.cc: New source file.
3873
3874 2011-06-07  Cary Coutant  <ccoutant@google.com>
3875
3876         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3877         update, allocate common from bss section's free list.
3878         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3879         linker-defined symbols.
3880         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3881         Skip GOT and PLT entries that are no longer referenced.
3882         (Output_section_incremental_inputs::write_info_blocks): Mark
3883         linker-defined symbols.
3884         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3885         * output.cc (Output_section::allocate): New function.
3886         * output.h (Output_section::allocate): New function.
3887         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3888         linker-defined symbols.
3889         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3890         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3891         (Symbol::init_base_output_data): Likewise.
3892         (Symbol::init_base_output_segment): Likewise.
3893         (Symbol::init_base_constant): Likewise.
3894         (Sized_symbol::init_output_data): Likewise.
3895         (Sized_symbol::init_output_segment): Likewise.
3896         (Sized_symbol::init_constant): Likewise.
3897         (Symbol_table::do_define_in_output_data): Likewise.
3898         (Symbol_table::do_define_in_output_segment): Likewise.
3899         (Symbol_table::do_define_as_constant): Likewise.
3900         * symtab.h (Symbol::is_predefined): New function.
3901         (Symbol::init_base_output_data): Add is_predefined parameter.
3902         (Symbol::init_base_output_segment): Likewise.
3903         (Symbol::init_base_constant): Likewise.
3904         (Symbol::is_predefined_): New data member.
3905         (Sized_symbol::init_output_data): Add is_predefined parameter.
3906         (Sized_symbol::init_output_segment): Likewise.
3907         (Sized_symbol::init_constant): Likewise.
3908         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3909
3910 2011-06-07  Cary Coutant  <ccoutant@google.com>
3911
3912         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3913         instead of emit_copy_reloc.
3914         (Copy_relocs::emit_copy_reloc): Refactor.
3915         (Copy_relocs::make_copy_reloc): New function.
3916         (Copy_relocs::add_copy_reloc): Remove.
3917         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3918         section.
3919         (Copy_relocs::make_copy_reloc): New function.
3920         (Copy_relocs::add_copy_reloc): Remove.
3921         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3922         unchanged input files.
3923         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3924         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3925         Reserve BSS space for COPY relocations.
3926         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3927         (Output_section_incremental_inputs::write_info_blocks): Record
3928         whether a symbol is copied from a shared object.
3929         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3930         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3931         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3932         (Incremental_input_entry_reader::get_output_symbol_index): Add
3933         is_copy parameter.
3934         (Incremental_binary::emit_copy_relocs): New function.
3935         (Incremental_binary::do_emit_copy_relocs): New function.
3936         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3937         new data member.
3938         (Sized_incremental_binary::add_copy_reloc): New function.
3939         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3940         (Sized_incremental_binary::Copy_reloc): New struct.
3941         (Sized_incremental_binary::Copy_relocs): New typedef.
3942         (Sized_incremental_binary::copy_relocs_): New data member.
3943         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3944         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3945         * target.h (Sized_target::emit_copy_reloc): New function.
3946         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3947
3948 2011-06-02  Cary Coutant  <ccoutant@google.com>
3949
3950         PR gold/12163
3951         * gold/archive.cc (Archive::Archive): Initialize new data member.
3952         (Archive::include_all_members): Return if archive has already been
3953         included.
3954         * gold/archive.h (Archive::include_all_members_): New data member.
3955
3956 2011-06-02  Nick Clifton  <nickc@redhat.com>
3957
3958         * dynobj.h: Fix spelling mistake in comment.
3959         * output.cc: Likewise.
3960
3961 2011-05-31  Doug Kwan  <dougkwan@google.com>
3962             Asier Llano
3963
3964         PR gold/12826
3965         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3966         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3967         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3968         redundant arm_exidx_test.so.
3969         * testsuite/Makefile.in: Regenerate.
3970         (check_SCRIPTS): Add pr12826.sh
3971         (check_DATA): Add pr12826.stdout
3972         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3973         * testsuite/pr12826.sh: New file.
3974         * testsuite/pr12826_1.s: Ditto.
3975         * testsuite/pr12826_1.s: Ditto.
3976
3977 2011-05-30  Ian Lance Taylor  <iant@google.com>
3978
3979         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3980         sections.
3981
3982 2011-05-29  Ian Lance Taylor  <iant@google.com>
3983
3984         PR gold/12804
3985         * testsuite/Makefile.am: Use different file name for two_file_test
3986         temporary file for each incremental test.
3987         * testsuite/Makefile.in: Rebuild.
3988
3989 2011-05-29  Ian Lance Taylor  <iant@google.com>
3990
3991         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3992         binary input file is empty.
3993
3994 2011-05-27  Ian Lance Taylor  <iant@google.com>
3995
3996         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3997         (ver_test_9.so): Likewise.
3998         * testsuite/Makefile.in: Rebuild.
3999
4000 2011-05-26 Cary Coutant  <ccoutant@google.com>
4001
4002         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4003         * incremental.cc (Incremental_inputs::report_input_section): Fix
4004         comment, indentation.
4005         (Incremental_inputs::report_comdat_group): New function.
4006         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4007         of data for incremental input file entry.
4008         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4009         group count, COMDAT group signatures.
4010         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4011         an unchanged input file.
4012         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4013         Initialize new data member.
4014         (Incremental_object_entry::add_comdat_group): New function.
4015         (Incremental_object_entry::get_comdat_group_count): New function.
4016         (Incremental_object_entry::get_comdat_signature_key): New function.
4017         (Incremental_object_entry::groups_): New data member.
4018         (Incremental_inputs::report_comdat_group): New function.
4019         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4020         data for incremental input file entry.
4021         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4022         (Incremental_input_entry_reader::get_input_section): Adjust size of
4023         data for incremental input file entry.
4024         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4025         (Incremental_input_entry_reader::get_comdat_group_signature): New
4026         function.
4027         * object.cc (Sized_relobj::include_section_group): Report kept
4028         COMDAT groups for incremental links.
4029
4030 2011-05-24  David Meyer  <pdox@google.com>
4031
4032         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4033         with name parameter.  Add found_name parameter.
4034         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4035         * dirsearch.h (class Dirsearch): Update declaration.
4036
4037 2011-05-24  Ian Lance Taylor  <iant@google.com>
4038
4039         * archive.cc (Library_base::should_include_member): Pull in object
4040         from archive if it defines the entry symbol.
4041         * parameters.cc (Parameters::entry): New function.
4042         * parameters.h (class Parameters): Declare entry.
4043         * output.h (class Output_file_header): Remove entry_ field.
4044         * output.cc (Output_file_header::Output_file_header): Remove entry
4045         parameter.  Change all callers.
4046         (Output_file_header::entry): Use parameters->entry.
4047         * gold.cc (queue_middle_tasks): Likewise.
4048         * plugin.cc (Plugin_hook::run): Likewise.
4049
4050 2011-05-24 Cary Coutant  <ccoutant@google.com>
4051
4052         * gold.cc (queue_initial_tasks): Pass incremental base filename
4053         to Output_file::open_base_file; don't print error message.
4054         * incremental-dump.cc (main): Adjust call to
4055         Output_file::open_for_modification.
4056         * incremental-dump.cc (main): Likewise.
4057         * incremental.cc (Incremental_inputs::report_command_line):
4058         Ignore --incremental-base option when comparing command lines.
4059         Ignore parameter when given as separate argument.
4060         * options.h (class General_options): Add --incremental-base.
4061         * output.cc (Output_file::Output_file):
4062         (Output_file::open_base_file): Add base_name and writable parameters;
4063         read base file into new file; print error message here.
4064         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4065         callers.
4066         * output.h (Output_file::open_for_modification): Rename to...
4067         (Output_file::open_base_file): ...this; add base_name and
4068         writable parameters; adjust all callers.
4069         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4070         callers.
4071         * testsuite/Makefile.am (incremental_test_4): Test
4072         --incremental-base.
4073         * testsuite/Makefile.in: Regenerate.
4074
4075 2011-05-24 Cary Coutant  <ccoutant@google.com>
4076
4077         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4078         incremental_test_4.
4079         * testsuite/Makefile.in: Regenerate.
4080         * testsuite/two_file_test_1_v1.cc: New test source file.
4081         * testsuite/two_file_test_1b_v1.cc: New test source file.
4082         * testsuite/two_file_test_2_v1.cc: New test source file.
4083
4084 2011-05-24 Cary Coutant  <ccoutant@google.com>
4085
4086         * dynobj.h (Dynobj::do_dynobj): New function.
4087         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4088         flag and soname for shared objects.
4089         * incremental.cc (Incremental_inputs::report_object): Make
4090         either Incremental_object_entry or Incremental_dynobj_entry; add
4091         soname to string table.
4092         (Incremental_inputs::report_input_section): Add assertion.
4093         (Output_section_incremental_inputs::set_final_data_size): Adjust
4094         type of input file entry for shared libraries; adjust size of
4095         shared library info entry.
4096         (Output_section_incremental_inputs::write_input_files): Write
4097         as_needed flag for shared libraries.
4098         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4099         of input file entry for shared libraries; write soname.
4100         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4101         soname from incremental info.
4102         * incremental.h (enum Incremental_input_flags): Add
4103         INCREMENTAL_INPUT_AS_NEEDED.
4104         (Incremental_input_entry::Incremental_input_entry): Initialize new
4105         data member.
4106         (Incremental_input_entry::set_as_needed): New function.
4107         (Incremental_input_entry::as_needed): New function.
4108         (Incremental_input_entry::do_dynobj_entry): New function.
4109         (Incremental_input_entry::as_needed_): New data member.
4110         (Incremental_object_entry::Incremental_object_entry): Don't check
4111         for shared library.
4112         (Incremental_object_entry::do_type): Likewise.
4113         (class Incremental_dynobj_entry): New class.
4114         (Incremental_input_entry_reader::as_needed): New function.
4115         (Incremental_input_entry_reader::get_soname): New function.
4116         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4117         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4118         size of shared library info entry.
4119         * layout.cc (Layout::finish_dynamic_section): Don't test for
4120         incremental link when adding DT_NEEDED entries.
4121         * object.h (Object::Object): Initialize new data member.
4122         (Object::dynobj): New function.
4123         (Object::set_as_needed): New function.
4124         (Object::as_needed): New function.
4125         (Object::do_dynobj): New function.
4126         (Object::as_needed_): New data member.
4127
4128 2011-05-24 Cary Coutant  <ccoutant@google.com>
4129
4130         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4131         info; adjust display of GOT entries.
4132         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4133         vector of input objects; remove file_status_.
4134         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4135         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4136         got_plt reader; call target hooks to reserve GOT entries.
4137         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4138         of input file info header and GOT info entry.
4139         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4140         relocation info.
4141         (Got_plt_view_info::got_descriptor): Remove.
4142         (Got_plt_view_info::sym_index): New data member.
4143         (Got_plt_view_info::input_index): New data member.
4144         (Local_got_offset_visitor::visit): Write input file index.
4145         (Global_got_offset_visitor::visit): Write 0 for input file index.
4146         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4147         with sym_index and input_index.
4148         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4149         incremental info GOT entry; replace got_descriptor with input_index.
4150         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4151         map from input file index to object.
4152         (Sized_relobj_incr::do_layout): Replace direct data member reference
4153         with accessor function.
4154         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4155         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4156         Adjust size of input file info header.
4157         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4158         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4159         (Incremental_input_entry_reader::get_input_section): Adjust size of
4160         input file info header.
4161         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4162         of incremental info GOT entry.
4163         (Incremental_got_plt_reader::get_got_desc): Remove.
4164         (Incremental_got_plt_reader::get_got_symndx): New function.
4165         (Incremental_got_plt_reader::get_got_input_index): New function.
4166         (Sized_incremental_binary::Sized_incremental_binary): Remove
4167         file_status_; add input_objects_.
4168         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4169         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4170         (Sized_incremental_binary::file_is_unchanged): Remove.
4171         (Sized_incremental_binary::set_input_object): New function.
4172         (Sized_incremental_binary::input_object): New function.
4173         (Sized_incremental_binary::file_status_): Remove.
4174         (Sized_incremental_binary::input_objects_): New data member.
4175         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4176         references.
4177         (Sized_relobj_incr::invalid_address): Move to base class.
4178         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4179         class.
4180         (Sized_relobj_incr::do_output_section_offset): Likewise.
4181         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4182         (Sized_relobj_incr::section_offsets_): Likewise.
4183         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4184         function.
4185         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4186         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4187         with accessor function.
4188         (Sized_relobj_file::do_layout): Likewise.
4189         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4190         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4191         (Sized_relobj_file::compute_final_local_value): Replace refs to
4192         section_offsets_ with accessor function.
4193         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4194         * object.h (Relobj::Relobj): Initialize new data members.
4195         (Relobj::add_dyn_reloc): New function.
4196         (Relobj::first_dyn_reloc): New function.
4197         (Relobj::dyn_reloc_count): New function.
4198         (Relobj::first_dyn_reloc_): New data member.
4199         (Relobj::dyn_reloc_count_): New data member.
4200         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4201         references.
4202         (Sized_relobj::Address): New typedef.
4203         (Sized_relobj::invalid_address): Move here from child class.
4204         (Sized_relobj::Sized_relobj): Initialize new data members.
4205         (Sized_relobj::sized_relobj): New function.
4206         (Sized_relobj::is_output_section_offset_invalid): Move here from
4207         child class.
4208         (Sized_relobj::get_output_section_offset): Likewise.
4209         (Sized_relobj::local_has_got_offset): Likewise.
4210         (Sized_relobj::local_got_offset): Likewise.
4211         (Sized_relobj::set_local_got_offset): Likewise.
4212         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4213         (Sized_relobj::clear_got_offsets): New function.
4214         (Sized_relobj::section_offsets): Move here from child class.
4215         (Sized_relobj::do_output_section_offset): Likewise.
4216         (Sized_relobj::do_set_section_offset): Likewise.
4217         (Sized_relobj::Local_got_offsets): Likewise.
4218         (Sized_relobj::local_got_offsets_): Likewise.
4219         (Sized_relobj::section_offsets_): Likewise.
4220         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4221         references.
4222         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4223         class.
4224         (Sized_relobj_file::sized_relobj): New function
4225         (Sized_relobj_file::local_has_got_offset): Move to base class.
4226         (Sized_relobj_file::local_got_offset): Likewise.
4227         (Sized_relobj_file::set_local_got_offset): Likewise.
4228         (Sized_relobj_file::get_output_section_offset): Likewise.
4229         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4230         (Sized_relobj_file::do_output_section_offset): Likewise.
4231         (Sized_relobj_file::do_set_section_offset): Likewise.
4232         (Sized_relobj_file::Local_got_offsets): Likewise.
4233         (Sized_relobj_file::local_got_offsets_): Likewise.
4234         (Sized_relobj_file::section_offsets_): Likewise.
4235         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4236         (all constructors).
4237         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4238         (Output_reloc::get_symbol_index): Likewise.
4239         (Output_reloc::local_section_offset): Likewise.
4240         (Output_reloc::get_address): Likewise.
4241         (Output_reloc::symbol_value): Likewise.
4242         (Output_data_got::reserve_slot): Move to class definition.
4243         (Output_data_got::reserve_local): New function.
4244         (Output_data_got::reserve_slot_for_global): Remove.
4245         (Output_data_got::reserve_global): New function.
4246         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4247         (all constructors, two instantiations).
4248         (Output_reloc::get_relobj): New function (two instantiations).
4249         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4250         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4251         (Output_data_reloc::add_global): Adjust type of relobj.
4252         (Output_data_reloc::add_global_relative): Likewise.
4253         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4254         (Output_data_reloc::add_local): Likewise.
4255         (Output_data_reloc::add_local_relative): Likewise.
4256         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4257         (Output_data_reloc::add_local_section): Likewise.
4258         (Output_data_reloc::add_output_section): Likewise.
4259         (Output_data_reloc::add_absolute): Likewise.
4260         (Output_data_reloc::add_target_specific): Likewise.
4261         (Output_data_got::reserve_slot): Move definition here.
4262         (Output_data_got::reserve_local): New function.
4263         (Output_data_got::reserve_global): New function.
4264         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4265         section_offsets_ with accessor function.
4266         (Sized_relobj_file::write_sections): Likewise.
4267         (Sized_relobj_file::do_relocate_sections): Likewise.
4268         * target.h (Sized_target::reserve_local_got_entry): New function.
4269         (Sized_target::reserve_global_got_entry): New function.
4270         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4271         (Target_x86_64::reserve_global_got_entry): New function.
4272         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4273
4274 2011-05-23 Cary Coutant  <ccoutant@google.com>
4275
4276         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4277         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4278         bit when checking got_type.
4279         * incremental.cc (Sized_incremental_binary::setup_readers):
4280         Store symbol table and string table locations; initialize bit vector
4281         of file status flags.
4282         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4283         unchanged files.
4284         (Sized_incremental_binary::do_process_got_plt): New function.
4285         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4286         (Output_section_incremental_inputs::set_final_data_size): Record
4287         file index for each input file.
4288         (Output_section_incremental_inputs::write_got_plt): Store file index
4289         instead of input entry offset for each GOT entry.
4290         * incremental.h
4291         (Incremental_input_entry::Incremental_input_entry): Initialize new
4292         data member.
4293         (Incremental_input_entry::set_offset): Store file index.
4294         (Incremental_input_entry::get_file_index): New function.
4295         (Incremental_input_entry::file_index_): New data member.
4296         (Incremental_binary::process_got_plt): New function.
4297         (Incremental_binary::do_process_got_plt): New function.
4298         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4299         data members.
4300         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4301         (Sized_incremental_binary::set_file_is_unchanged): New function.
4302         (Sized_incremental_binary::file_is_unchanged): New function.
4303         (Sized_incremental_binary::do_process_got_plt): New function.
4304         (Sized_incremental_binary::file_status_): New data member.
4305         (Sized_incremental_binary::main_symtab_loc_): New data member.
4306         (Sized_incremental_binary::main_strtab_loc_): New data member.
4307         * output.cc (Output_data_got::Got_entry::write): Add case
4308         RESERVED_CODE.
4309         (Output_data_got::add_global): Call add_got_entry.
4310         (Output_data_got::add_global_plt): Likewise.
4311         (Output_data_got::add_global_with_rel): Likewise.
4312         (Output_data_got::add_global_with_rela): Likewise.
4313         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4314         (Output_data_got::add_global_pair_with_rela): Likewise.
4315         (Output_data_got::add_local): Call add_got_entry.
4316         (Output_data_got::add_local_plt): Likewise.
4317         (Output_data_got::add_local_with_rel): Likewise.
4318         (Output_data_got::add_local_with_rela): Likewise.
4319         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4320         (Output_data_got::add_local_pair_with_rela): Likewise.
4321         (Output_data_got::reserve_slot): New function.
4322         (Output_data_got::reserve_slot_for_global): New function.
4323         (Output_data_got::add_got_entry): New function.
4324         (Output_data_got::add_got_entry_pair): New function.
4325         (Output_section::add_output_section_data): Edit FIXME.
4326         * output.h
4327         (Output_section_data_build::Output_section_data_build): New
4328         constructor with size parameter.
4329         (Output_data_space::Output_data_space): Likewise.
4330         (Output_data_got::Output_data_got): Initialize new data member; new
4331         constructor with size parameter.
4332         (Output_data_got::add_constant): Call add_got_entry.
4333         (Output_data_got::reserve_slot): New function.
4334         (Output_data_got::reserve_slot_for_global): New function.
4335         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4336         (Output_data_got::add_got_entry): New function.
4337         (Output_data_got::add_got_entry_pair): New function.
4338         (Output_data_got::free_list_): New data member.
4339         * target.h (Sized_target::init_got_plt_for_update): New function.
4340         (Sized_target::register_global_plt_entry): New function.
4341         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4342         Initialize new data member; call init; add constructor with PLT count.
4343         (Output_data_plt_x86_64::init): New function.
4344         (Output_data_plt_x86_64::add_relocation): New function.
4345         (Output_data_plt_x86_64::reserve_slot): New function.
4346         (Output_data_plt_x86_64::free_list_): New data member.
4347         (Target_x86_64::init_got_plt_for_update): New function.
4348         (Target_x86_64::register_global_plt_entry): New function.
4349         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4350         incremental updates.
4351         (Output_data_plt_x86_64::add_relocation): New function.
4352         * testsuite/object_unittest.cc (Object_test): Set default options.
4353
4354 2011-05-16  Ian Lance Taylor  <iant@google.com>
4355
4356         * options.h (class General_options): Make -i a synonym for -r.
4357
4358 2011-05-16  Ian Lance Taylor  <iant@google.com>
4359
4360         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4361
4362 2011-05-10 Cary Coutant  <ccoutant@google.com>
4363
4364         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4365         strip_all (-s).
4366
4367 2011-05-06  Ian Lance Taylor  <iant@google.com>
4368
4369         * layout.cc (Layout::layout): If the output section flags change,
4370         update the ordering.
4371
4372 2011-04-25 Cary Coutant  <ccoutant@google.com>
4373
4374         * incremental-dump.cc (dump_incremental_inputs): Print local
4375         symbol info for each input file.
4376         * incremental.cc
4377         (Output_section_incremental_inputs::set_final_data_size): Add local
4378         symbol info to input file entries in incremental info.
4379         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4380         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4381         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4382         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4383         implementation.
4384         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4385         (Sized_incr_relobj::do_relocate): Write the local symbols.
4386         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4387         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4388         Adjust size of input file header.
4389         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4390         (Incremental_inputs_reader::get_local_symbol_count): New function.
4391         (Incremental_inputs_reader::get_input_section): Adjust size of input
4392         file header.
4393         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4394         (Sized_incr_relobj::This): New typedef.
4395         (Sized_incr_relobj::sym_size): New const data member.
4396         (Sized_incr_relobj::Local_symbol): New struct.
4397         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4398         (Sized_incr_relobj::do_local_symbol_offset): New function.
4399         (Sized_incr_relobj::local_symbol_count_): New data member.
4400         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4401         (Sized_incr_relobj::local_symbol_index_): New data member.
4402         (Sized_incr_relobj::local_symbol_offset_): New data member.
4403         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4404         (Sized_incr_relobj::local_symbols_): New data member.
4405         * object.h (Relobj::output_local_symbol_count): New function.
4406         (Relobj::local_symbol_offset): New function.
4407         (Relobj::do_output_local_symbol_count): New function.
4408         (Relobj::do_local_symbol_offset): New function.
4409         (Sized_relobj::do_output_local_symbol_count): New function.
4410         (Sized_relobj::do_local_symbol_offset): New function.
4411
4412 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4413
4414         * descriptors.cc (set_close_on_exec): New function.
4415         (Descriptors::open): Use set_close_on_exec.
4416         * output.cc (S_ISLNK): Define if not defined.
4417
4418 2011-04-22 Cary Coutant  <ccoutant@google.com>
4419
4420         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4421         global symbol map.
4422         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4423         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4424         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4425         relocations.
4426         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4427         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4428         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4429         * incremental.h
4430         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4431         function.
4432         (Incremental_binary::apply_incremental_relocs): New function.
4433         (Incremental_binary::do_apply_incremental_relocs): New function.
4434         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4435         data member.
4436         (Sized_incremental_binary::add_global_symbol): New function.
4437         (Sized_incremental_binary::global_symbol): New function.
4438         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4439         (Sized_incremental_binary::symbol_map_): New data member.
4440         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4441         * target.h (Sized_target::apply_relocation): New function.
4442         * target-reloc.h (apply_relocation): New function.
4443         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4444
4445 2011-04-22  Doug Kwan  <dougkwan@google.com>
4446
4447         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4448         flag of a SHT_ARM_EXIDX section.
4449         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4450         * testsuite/Makefile.in: Regenerate.
4451         * testsuite/arm_exidx_test.s: New file.
4452         * testsuite/arm_exidx_test.sh: Same.
4453
4454 2011-04-20 Cary Coutant  <ccoutant@google.com>
4455
4456         PR gold/12689
4457         * archive.h (Incremental_archive_entry::Archive_member):
4458         Initialize arg_serial_ (second constructor).
4459
4460 2011-04-17  Ian Lance Taylor  <iant@google.com>
4461
4462         * object.cc (Relocate_info::location): Simplify location string.
4463         * errors.cc (Errors::error_at_location): Don't print program
4464         name.
4465         (Errors::warning_at_location): Likewise.
4466         (Errors::undefined_symbol): Likewise.
4467         * testsuite/debug_msg.sh: Update accordingly.
4468
4469 2011-04-14 Cary Coutant  <ccoutant@google.com>
4470
4471         * gold/layout.cc (Layout::symtab_section_offset): New function.
4472         * gold/layout.h (Layout::symtab_section_offset): New function.
4473         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4474
4475 2011-04-12  Ian Lance Taylor  <iant@google.com>
4476
4477         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4478         with MREMAP_MAYMOVE.
4479         * output.h (class Output_file): Add map_is_allocated_ field.
4480         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4481         not available, provide stubs.  If mremap is not available, #define
4482         it to gold_mremap.
4483         (MREMAP_MAYMOVE): Define if not defined.
4484         (Output_file::Output_file): Initialize map_is_allocated_.
4485         (Output_file::resize): Check map_is_allocated_.
4486         (Output_file::map_anonymous): If mmap fails, use malloc.
4487         (Output_file::unmap): Don't do anything for an anonymous map.
4488         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4489         is not available, provide stubs.
4490         (File_read::View::~View): Use free rather than delete[].
4491         (File_read::make_view): Use malloc rather than new[].  If mmap
4492         fails, use malloc.
4493         (File_read::find_or_make_view): Use malloc rather than new[].
4494         * gold.h: Remove HAVE_REMAP code.
4495         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4496         exists.  Rename mremap to gold_mremap.  If mmap is not available
4497         don't do anything.
4498         * configure, config.in: Rebuild.
4499
4500 2011-04-11  Ian Lance Taylor  <iant@google.com>
4501
4502         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4503         initialize local variable v.
4504
4505 2011-04-11  Cary Coutant  <ccoutant@google.com>
4506
4507         * archive.cc (Archive::include_member): Adjust call to
4508         report_object.
4509         (Add_archive_symbols::run): Track argument serial numbers.
4510         (Lib_group::include_member): Likewise.
4511         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4512         * archive.h (Incremental_archive_entry::Archive_member):
4513         Initialize arg_serial_.
4514         (Archive_member::arg_serial_): New data member.
4515         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4516         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4517         incremental link.
4518         (Sized_dynobj::do_for_all_local_got_entries): New function.
4519         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4520         function.
4521         * fileread.cc (get_mtime): New function.
4522         * fileread.h (get_mtime): New function.
4523         * gold.cc (queue_initial_tasks): Check for incremental update.
4524         (process_incremental_input): New function.
4525         (queue_middle_tasks): Don't force valid target for incremental
4526         update.
4527         * incremental-dump.cc (find_input_containing_global): Adjust
4528         size of symbol info entry.
4529         (dump_incremental_inputs): Dump argument serial number and
4530         in_system_directory flag; bias shndx by 1; print symbol names
4531         when dumping per-file symbol lists; use new symbol info readers.
4532         * incremental.cc
4533         (Output_section_incremental_inputs:update_data_size): New function.
4534         (Sized_incremental_binary::setup_readers): Setup input readers
4535         for each input file; build maps for files added from libraries
4536         and scripts.
4537         (Sized_incremental_binary::check_input_args): New function.
4538         (Sized_incremental_binary::do_check_inputs): Build map of argument
4539         serial numbers to input arguments.
4540         (Sized_incremental_binary::do_file_has_changed): Rename
4541         do_file_is_unchanged to this; compare file modification times.
4542         (Sized_incremental_binary::do_init_layout): New function.
4543         (Sized_incremental_binary::do_reserve_layout): New function.
4544         (Sized_incremental_binary::do_get_input_reader): Remove.
4545         (Sized_incremental_binary::get_symtab_view): New function.
4546         (Incremental_checker::can_incrementally_link_output_file): Remove.
4547         (Incremental_inputs::report_command_line): Exclude --debug options.
4548         (Incremental_inputs::report_archive_begin): Add parameter; track
4549         argument serial numbers; don't put input file entry for archive
4550         before archive members.
4551         (Incremental_inputs::report_archive_end): Put input file entry
4552         for archive after archive members.
4553         (Incremental_inputs::report_object): Add parameter; track argument
4554         serial numbers and in_system_directory flag.
4555         (Incremental_inputs::report_script): Add parameter; track argument
4556         serial numbers.
4557         (Output_section_incremental_inputs::set_final_data_size): Adjust
4558         size of symbol info entry; check for forwarding symbols.
4559         (Output_section_incremental_inputs::write_input_files): Write
4560         in_system_directory flag and argument serial number.
4561         (Output_section_incremental_inputs::write_info_blocks): Map section
4562         indices between incremental info and original input file; store
4563         input section index for each symbol.
4564         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4565         change operator() to visit().
4566         (class Global_got_offset_visitor): Likewise.
4567         (class Global_symbol_visitor_got_plt):
4568         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4569         classes.
4570         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4571         (Sized_incr_relobj::do_read_symbols): New function.
4572         (Sized_incr_relobj::do_layout): New function.
4573         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4574         (Sized_incr_relobj::do_add_symbols): New function.
4575         (Sized_incr_relobj::do_should_include_member): New function.
4576         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4577         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4578         (Sized_incr_relobj::do_section_size): New function.
4579         (Sized_incr_relobj::do_section_name): New function.
4580         (Sized_incr_relobj::do_section_contents): New function.
4581         (Sized_incr_relobj::do_section_flags): New function.
4582         (Sized_incr_relobj::do_section_entsize): New function.
4583         (Sized_incr_relobj::do_section_address): New function.
4584         (Sized_incr_relobj::do_section_type): New function.
4585         (Sized_incr_relobj::do_section_link): New function.
4586         (Sized_incr_relobj::do_section_info): New function.
4587         (Sized_incr_relobj::do_section_addralign): New function.
4588         (Sized_incr_relobj::do_initialize_xindex): New function.
4589         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4590         (Sized_incr_relobj::do_read_relocs): New function.
4591         (Sized_incr_relobj::do_gc_process_relocs): New function.
4592         (Sized_incr_relobj::do_scan_relocs): New function.
4593         (Sized_incr_relobj::do_count_local_symbols): New function.
4594         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4595         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4596         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4597         (Sized_incr_relobj::do_relocate): New function.
4598         (Sized_incr_relobj::do_set_section_offset): New function.
4599         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4600         (Sized_incr_dynobj::do_read_symbols): New function.
4601         (Sized_incr_dynobj::do_layout): New function.
4602         (Sized_incr_dynobj::do_add_symbols): New function.
4603         (Sized_incr_dynobj::do_should_include_member): New function.
4604         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4605         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4606         (Sized_incr_dynobj::do_section_size): New function.
4607         (Sized_incr_dynobj::do_section_name): New function.
4608         (Sized_incr_dynobj::do_section_contents): New function.
4609         (Sized_incr_dynobj::do_section_flags): New function.
4610         (Sized_incr_dynobj::do_section_entsize): New function.
4611         (Sized_incr_dynobj::do_section_address): New function.
4612         (Sized_incr_dynobj::do_section_type): New function.
4613         (Sized_incr_dynobj::do_section_link): New function.
4614         (Sized_incr_dynobj::do_section_info): New function.
4615         (Sized_incr_dynobj::do_section_addralign): New function.
4616         (Sized_incr_dynobj::do_initialize_xindex): New function.
4617         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4618         (make_sized_incremental_object): New function.
4619         (Incremental_library::copy_unused_symbols): New function.
4620         (Incremental_library::do_for_all_unused_symbols): New function.
4621         * incremental.h (enum Incremental_input_flags): New type.
4622         (class Incremental_checker): Remove.
4623         (Incremental_input_entry::Incremental_input_entry): Add argument
4624         serial number.
4625         (Incremental_input_entry::arg_serial): New function.
4626         (Incremental_input_entry::set_is_in_system_directory): New function.
4627         (Incremental_input_entry::is_in_system_directory): New function.
4628         (Incremental_input_entry::arg_serial_): New data member.
4629         (Incremental_input_entry::is_in_system_directory_): New data member.
4630         (class Script_info): Move here from script.h.
4631         (Script_info::Script_info): Add filename parameter.
4632         (Script_info::filename): New function.
4633         (Script_info::filename_): New data member.
4634         (Incremental_script_entry::Incremental_script_entry): Add argument
4635         serial number.
4636         (Incremental_object_entry::Incremental_object_entry): Likewise.
4637         (Incremental_object_entry::add_input_section): Build list of input
4638         sections with map to original shndx.
4639         (Incremental_object_entry::get_input_section_index): New function.
4640         (Incremental_object_entry::shndx_): New data member.
4641         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4642         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4643         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4644         serial number.
4645         (Incremental_inputs::report_archive_begin): Likewise.
4646         (Incremental_inputs::report_object): Likewise.
4647         (Incremental_inputs::report_script): Likewise.
4648         (class Incremental_global_symbol_reader): New class.
4649         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4650         and store flags and input file type.
4651         (Incremental_input_entry_reader::arg_serial): New function.
4652         (Incremental_input_entry_reader::type): Extract type from flags.
4653         (Incremental_input_entry_reader::is_in_system_directory): New function.
4654         (Incremental_input_entry_reader::get_input_section_count): Call
4655         accessor function for type.
4656         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4657         function for type; adjust size of global symbol entry.
4658         (Incremental_input_entry_reader::get_global_symbol_count): Call
4659         accessor function for type.
4660         (Incremental_input_entry_reader::get_object_count): Likewise.
4661         (Incremental_input_entry_reader::get_object_offset): Likewise.
4662         (Incremental_input_entry_reader::get_member_count): Likewise.
4663         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4664         (Incremental_input_entry_reader::get_member_offset): Likewise.
4665         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4666         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4667         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4668         (Incremental_input_entry_reader::get_global_symbol_reader): New
4669         function.
4670         (Incremental_input_entry_reader::get_output_symbol_index): New
4671         function.
4672         (Incremental_input_entry_reader::type_): Remove.
4673         (Incremental_input_entry_reader::flags_): New data member.
4674         (Incremental_inputs_reader::input_file_offset): New function.
4675         (Incremental_inputs_reader::input_file_index): New function.
4676         (Incremental_inputs_reader::input_file): Call input_file_offset.
4677         (Incremental_inputs_reader::input_file_at_offset): New function.
4678         (Incremental_relocs_reader::get_r_type): Reformat.
4679         (Incremental_relocs_reader::get_r_shndx): Reformat.
4680         (Incremental_relocs_reader::get_r_offset): Reformat.
4681         (Incremental_relocs_reader::data): New function.
4682         (Incremental_binary::Incremental_binary): Initialize new data members.
4683         (Incremental_binary::check_inputs): Add cmdline parameter.
4684         (Incremental_binary::file_is_unchanged): Remove.
4685         (Input_reader::arg_serial): New function.
4686         (Input_reader::get_unused_symbol_count): New function.
4687         (Input_reader::get_unused_symbol): New function.
4688         (Input_reader::do_arg_serial): New function.
4689         (Input_reader::do_get_unused_symbol_count): New function.
4690         (Input_reader::do_get_unused_symbol): New function.
4691         (Incremental_binary::input_file_count): New function.
4692         (Incremental_binary::get_input_reader): Change signature to use
4693         index instead of filename.
4694         (Incremental_binary::file_has_changed): New function.
4695         (Incremental_binary::get_input_argument): New function.
4696         (Incremental_binary::get_library): New function.
4697         (Incremental_binary::get_script_info): New function.
4698         (Incremental_binary::init_layout): New function.
4699         (Incremental_binary::reserve_layout): New function.
4700         (Incremental_binary::output_file): New function.
4701         (Incremental_binary::do_check_inputs): New function.
4702         (Incremental_binary::do_file_is_unchanged): Remove.
4703         (Incremental_binary::do_file_has_changed): New function.
4704         (Incremental_binary::do_init_layout): New function.
4705         (Incremental_binary::do_reserve_layout): New function.
4706         (Incremental_binary::do_input_file_count): New function.
4707         (Incremental_binary::do_get_input_reader): Change signature.
4708         (Incremental_binary::input_args_map_): New data member.
4709         (Incremental_binary::library_map_): New data member.
4710         (Incremental_binary::script_map_): New data member.
4711         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4712         new data members.
4713         (Sized_incremental_binary::output_section): New function.
4714         (Sized_incremental_binary::inputs_reader): Add const.
4715         (Sized_incremental_binary::symtab_reader): Add const.
4716         (Sized_incremental_binary::relocs_reader): Add const.
4717         (Sized_incremental_binary::got_plt_reader): Add const.
4718         (Sized_incremental_binary::get_symtab_view): New function.
4719         (Sized_incremental_binary::Inputs_reader): New typedef.
4720         (Sized_incremental_binary::Input_entry_reader): New typedef.
4721         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4722         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4723         (Sized_incremental_binary::do_file_has_changed): New function.
4724         (Sized_incremental_binary::do_init_layout): New function.
4725         (Sized_incremental_binary::do_reserve_layout): New function.
4726         (Sized_input_reader::Inputs_reader): Remove.
4727         (Sized_input_reader::Input_entry_reader): Remove.
4728         (Sized_input_reader::do_arg_serial): New function.
4729         (Sized_input_reader::do_get_unused_symbol_count): New function.
4730         (Sized_input_reader::do_get_unused_symbol): New function.
4731         (Sized_incremental_binary::do_input_file_count): New function.
4732         (Sized_incremental_binary::do_get_input_reader): Change signature;
4733         use index instead of filename.
4734         (Sized_incremental_binary::section_map_): New data member.
4735         (Sized_incremental_binary::input_entry_readers_): New data member.
4736         (class Sized_incr_relobj): New class.
4737         (class Sized_incr_dynobj): New class.
4738         (make_sized_incremental_object): New function.
4739         (class Incremental_library): New class.
4740         * layout.cc (Free_list::num_lists): New static data member.
4741         (Free_list::num_nodes): New static data member.
4742         (Free_list::num_removes): New static data member.
4743         (Free_list::num_remove_visits): New static data member.
4744         (Free_list::num_allocates): New static data member.
4745         (Free_list::num_allocate_visits): New static data member.
4746         (Free_list::init): New function.
4747         (Free_list::remove): New function.
4748         (Free_list::allocate): New function.
4749         (Free_list::dump): New function.
4750         (Free_list::print_stats): New function.
4751         (Layout_task_runner::run): Resize output file for incremental updates.
4752         (Layout::Layout): Initialize new data members.
4753         (Layout::set_incremental_base): New function.
4754         (Layout::init_fixed_output_section): New function.
4755         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4756         incremental updates.
4757         (Layout::create_gold_note): Do not create gold note section for
4758         incremental updates.
4759         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4760         for incremental updates.
4761         (Layout::set_section_offsets): For incremental updates, allocate space
4762         from free list.
4763         (Layout::create_symtab_sections): Layout with offsets relative to
4764         start of section; for incremental updates, allocate space from free
4765         list.
4766         (Layout::create_shdrs): For incremental updates, allocate space from
4767         free list.
4768         (Layout::finish_dynamic_section): For incremental updates, do not
4769         check --as-needed (fixed in subsequent patch).
4770         * layout.h (class Free_list): New class.
4771         (Layout::set_incremental_base): New function.
4772         (Layout::incremental_base): New function.
4773         (Layout::init_fixed_output_section): New function.
4774         (Layout::allocate): New function.
4775         (Layout::incremental_base_): New data member.
4776         (Layout::free_list_): New data member.
4777         * main.cc (main): Print Free_list statistics.
4778         * object.cc (Relobj::finalize_incremental_relocs): Add
4779         clear_counts parameter; clear counts only when clear_counts is set.
4780         (Sized_relobj::Sized_relobj): Initialize new base class.
4781         (Sized_relobj::do_layout): Don't report special sections.
4782         (Sized_relobj::do_for_all_local_got_entries): New function.
4783         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4784         symtab_off to all symbol table offsets.
4785         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4786         * object.h (class Got_offset_list): Move to top of file.
4787         (Object::Object): Allow case where input_file == NULL.
4788         (Object::~Object): Likewise.
4789         (Object::input_file): Assert that input_file != NULL.
4790         (Object::lock): Allow case where input_file == NULL.
4791         (Object::unlock): Likewise.
4792         (Object::is_locked): Likewise.
4793         (Object::token): Likewise.
4794         (Object::release): Likewise.
4795         (Object::is_incremental): New function.
4796         (Object::get_mtime): New function.
4797         (Object::for_all_local_got_entries): New function.
4798         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4799         (Object::set_is_in_system_directory): New function.
4800         (Object::is_in_system_directory): New function.
4801         (Object::do_is_incremental): New function.
4802         (Object::do_get_mtime): New function.
4803         (Object::do_for_all_local_got_entries): New function.
4804         (Object::is_in_system_directory_): New data member.
4805         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4806         (class Sized_relobj_base): New class.
4807         (class Sized_relobj): Derive from Sized_relobj_base.
4808         (class Sized_relobj::Symbols): Redeclare from base class.
4809         (class Sized_relobj::local_got_offset_list): Remove.
4810         (class Sized_relobj::Output_sections): Redeclare from base class.
4811         (class Sized_relobj::do_for_all_local_got_entries): New function.
4812         (class Sized_relobj::write_local_symbols): Add offset parameter.
4813         (class Sized_relobj::local_symbol_offset_): Update comment.
4814         (class Sized_relobj::local_dynsym_offset_): Update comment.
4815         * options.cc (Input_arguments::add_file): Remove const.
4816         * options.h (Input_file_argument::Input_file_argument):
4817         Initialize arg_serial_ (all constructors).
4818         (Input_file_argument::set_arg_serial): New function.
4819         (Input_file_argument::arg_serial): New function.
4820         (Input_file_argument::arg_serial_): New data member.
4821         (Input_arguments::Input_arguments): Initialize file_count_.
4822         (Input_arguments::add_file): Remove const.
4823         (Input_arguments::number_of_input_files): New function.
4824         (Input_arguments::file_count_): New data member.
4825         (Command_line::number_of_input_files): Call
4826         Input_arguments::number_of_input_files.
4827         * output.cc (Output_segment_headers::Output_segment_headers):
4828         Set current size.
4829         (Output_section::Input_section::current_data_size): New function.
4830         (Output_section::Output_section): Initialize new data members.
4831         (Output_section::add_input_section): Don't do merge sections for
4832         an incremental link; allocate space from free list for an
4833         incremental update.
4834         (Output_section::add_output_section_data): Allocate space from
4835         free list for an incremental update.
4836         (Output_section::update_data_size): New function.
4837         (Output_section::set_fixed_layout): New function.
4838         (Output_section::reserve): New function.
4839         (Output_segment::set_section_addresses): Remove const.
4840         (Output_segment::set_section_list_addresses): Remove const; allocate
4841         space from free list for an incremental update.
4842         (Output_segment::set_offset): Adjust size of RELRO segment for an
4843         incremental update.
4844         * output.h (Output_data::current_data_size): Move here from
4845         child classes.
4846         (Output_data::pre_finalize_data_size): New function.
4847         (Output_data::update_data_size): New function.
4848         (Output_section_headers::update_data_size): new function.
4849         (Output_section_data_build::current_data_size): Move to Output_data.
4850         (Output_data_strtab::update_data_size): New function.
4851         (Output_section::current_data_size): Move to Output_data.
4852         (Output_section::set_fixed_layout): New function.
4853         (Output_section::has_fixed_layout): New function.
4854         (Output_section::reserve): New function.
4855         (Output_section::update_data_size): New function.
4856         (Output_section::has_fixed_layout_): New data member.
4857         (Output_section::free_list_): New data member.
4858         (Output_segment::set_section_addresses): Remove const.
4859         (Output_segment::set_section_list_addresses): Remove const.
4860         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4861         New function.
4862         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4863         New function.
4864         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4865         parameter when calling Add_symbols constructor; store argument
4866         serial number for members of a lib group.
4867         (Add_symbols::locks): Allow case where token == NULL.
4868         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4869         (Read_member::~Read_member): New function.
4870         (Read_member::is_runnable): New function.
4871         (Read_member::locks): New function.
4872         (Read_member::run): New function.
4873         (Check_script::~Check_script): New function.
4874         (Check_script::is_runnable): New function.
4875         (Check_script::locks): New function.
4876         (Check_script::run): New function.
4877         (Check_library::~Check_library): New function.
4878         (Check_library::is_runnable): New function.
4879         (Check_library::locks): New function.
4880         (Check_library::run): New function.
4881         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4882         (Add_symbols::library_): New data member.
4883         (class Read_member): New class.
4884         (class Check_script): New class.
4885         (class Check_library): New class.
4886         * reloc.cc (Read_relocs::is_runnable): Allow case where
4887         token == NULL.
4888         (Read_relocs::locks): Likewise.
4889         (Scan_relocs::locks): Likewise.
4890         (Relocate_task::locks): Likewise.
4891         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4892         to clear counters.
4893         (Sized_relobj::incremental_relocs_scan): Fix comment.
4894         (Sized_relobj::do_relocate): Pass output file offset to
4895         write_local_symbols.
4896         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4897         from class declaration.
4898         * script.cc (read_input_script): Allocate Script_info; pass
4899         argument serial number to report_script.
4900         * script.h (class Script_info): Move to incremental.h.
4901         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4902         * symtab.h (Symbol_table::add_from_incrobj): New function.
4903         (Symbol_table::set_file_offset): New function.
4904
4905 2011-04-05  Cary Coutant  <ccoutant@google.com>
4906
4907         * incremental-dump.cc (dump_incremental_inputs): Change signature
4908         to take a Sized_incremental_binary; change caller.  Use readers
4909         in Sized_incremental_binary.
4910         * incremental.cc
4911         (Sized_incremental_binary::find_incremental_inputs_sections):
4912         Rename do_find_incremental_inputs_sections to this.
4913         (Sized_incremental_binary::setup_readers): New function.
4914         (Sized_incremental_binary::do_check_inputs): Check
4915         has_incremental_info_ flag; move setup code to setup_readers;
4916         use input readers.
4917         (Sized_incremental_binary::do_file_is_unchanged): New function.
4918         (Sized_incremental_binary::do_get_input_reader): New function.
4919         * incremental.h (class Incremental_binary): Move to end of file.
4920         (Incremental_binary::file_is_unchanged): New function.
4921         (Incremental_binary::do_file_is_unchanged): New function.
4922         (Incremental_binary::Input_reader): New class.
4923         (Incremental_binary::get_input_reader): New function.
4924         (class Sized_incremental_binary): Move to end of file.
4925         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4926         input section reader classes.
4927         (Sized_incremental_binary::has_incremental_info): New function.
4928         (Sized_incremental_binary::inputs_reader): New function.
4929         (Sized_incremental_binary::symtab_reader): New function.
4930         (Sized_incremental_binary::relocs_reader): New function.
4931         (Sized_incremental_binary::got_plt_reader): New function.
4932         (Sized_incremental_binary::do_file_is_unchanged): New function.
4933         (Sized_incremental_binary::Sized_input_reader): New class.
4934         (Sized_incremental_binary::get_input_reader): New function.
4935         (Sized_incremental_binary::find_incremental_inputs_sections):
4936         Rename do_find_incremental_inputs_sections to this.
4937         (Sized_incremental_binary::setup_readers): New function.
4938         (Sized_incremental_binary::has_incremental_info_): New data member.
4939         (Sized_incremental_binary::inputs_reader_): New data member.
4940         (Sized_incremental_binary::symtab_reader_): New data member.
4941         (Sized_incremental_binary::relocs_reader_): New data member.
4942         (Sized_incremental_binary::got_plt_reader_): New data member.
4943         (Sized_incremental_binary::current_input_file_): New data member.
4944
4945 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4946
4947         PR gold/12640
4948         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4949         violation.
4950
4951 2011-03-30  Cary Coutant  <ccoutant@google.com>
4952
4953         * archive.cc (Archive::include_member): Adjust call to report_object.
4954         (Add_archive_symbols::run): Add script_info to call to
4955         report_archive_begin.
4956         (Lib_group::include_member): Adjust call to report_object.
4957         (Add_lib_group_symbols::run): Adjust call to report_object.
4958         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4959         blocks.  Add object count for script input files.
4960         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4961         script_info parameter; change all callers.
4962         (Incremental_inputs::report_object): Add script_info parameter;
4963         change all callers.
4964         (Incremental_inputs::report_script): Store backpointer to
4965         incremental info entry.
4966         (Output_section_incremental_inputs::set_final_data_size): Record
4967         additional information for scripts.
4968         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4969         * incremental.h (Incremental_script_entry::add_object): New function.
4970         (Incremental_script_entry::get_object_count): New function.
4971         (Incremental_script_entry::get_object): New function.
4972         (Incremental_script_entry::objects_): New data member; adjust
4973         constructor.
4974         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4975         (Incremental_inputs::report_object): Add script_info parameter.
4976         (Incremental_inputs_reader::get_object_count): New function.
4977         (Incremental_inputs_reader::get_object_offset): New function.
4978         * options.cc (Input_arguments::add_file): Return reference to
4979         new input argument.
4980         * options.h (Input_argument::set_script_info): New function.
4981         (Input_argument::script_info): New function.
4982         (Input_argument::script_info_): New data member; adjust all
4983         constructors.
4984         (Input_file_group::add_file): Return reference to new input argument.
4985         (Input_file_lib::add_file): Likewise.
4986         (Input_arguments::add_file): Likewise.
4987         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4988         * script.cc (Parser_closure::Parser_closure): Add script_info
4989         parameter; adjust all callers.
4990         (Parser_closure::script_info): New function.
4991         (Parser_closure::script_info_): New data member.
4992         (read_input_script): Report scripts earlier to incremental info.
4993         (script_add_file): Set script_info in Input_argument.
4994         (script_add_library): Likewise.
4995         * script.h (Script_options::Script_info): Rewrite class.
4996
4997 2011-03-29  Cary Coutant  <ccoutant@google.com>
4998
4999         * archive.cc (Library_base::should_include_member): Move
5000         method here from class Archive.
5001         (Archive::Archive): Initialize base class.
5002         (Archive::should_include_member): Move to base class.
5003         (Archive::do_for_all_unused_symbols): New function.
5004         (Add_archive_symbols::run): Remove redundant access to
5005         incremental_inputs.
5006         (Lib_group::Lib_group): Initialize base class.
5007         (Lib_group::do_filename): New function.
5008         (Lib_group::include_member): Pass pointer to Lib_group to
5009         report_object.
5010         (Lib_group::do_for_all_unused_symbols): New function.
5011         (Add_lib_group_symbols::run): Report archive information for
5012         incremental links.
5013         * archive.h (class Library_base): New base class.
5014         (class Archive): Derive from Library_base.
5015         (Archive::filename): Move to base class.
5016         (Archive::set_incremental_info): Likewise.
5017         (Archive::incremental_info): Likewise.
5018         (Archive::Should_include): Likewise.
5019         (Archive::should_include_member): Likewise.
5020         (Archive::Armap_entry): Remove.
5021         (Archive::Unused_symbol_iterator): Remove.
5022         (Archive::unused_symbols_begin): Remove.
5023         (Archive::unused_symbols_end): Remove.
5024         (Archive::do_filename): New function.
5025         (Archive::do_get_mtime): New function.
5026         (Archive::do_for_all_unused_symbols): New function.
5027         (Archive::task_): Move to base class.
5028         (Archive::incremental_info_): Likewise.
5029         (class Lib_group): Derive from Library_base.
5030         (Lib_group::do_filename): New function.
5031         (Lib_group::do_get_mtime): New function.
5032         (Lib_group::do_for_all_unused_symbols): New function.
5033         (Lib_group::task_): Move to base class.
5034         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5035         function.
5036         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5037         function.
5038         * incremental.cc (Incremental_inputs::report_archive_begin):
5039         Use Library_base; call library's get_mtime; add incremental inputs
5040         entry before members.
5041         (class Unused_symbol_visitor): New class.
5042         (Incremental_inputs::report_archive_end): Use Library_base; use
5043         visitor class to record unused symbols; don't add incremental inputs
5044         entry after members.
5045         (Incremental_inputs::report_object): Use Library_base.
5046         * incremental.h
5047         (Incremental_archive_entry::Incremental_archive_entry): Remove
5048         unused Archive parameter.
5049         (Incremental_inputs::report_archive_begin): Use Library_base.
5050         (Incremental_inputs::report_archive_end): Likewise.
5051         (Incremental_inputs::report_object): Likewise.
5052         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5053         function.
5054         * object.h (Object::for_all_global_symbols): New function.
5055         (Object::do_for_all_global_symbols): New function.
5056         (Sized_relobj::do_for_all_global_symbols): New function.
5057         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5058         function.
5059         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5060         function.
5061
5062 2011-03-27  Ian Lance Taylor  <iant@google.com>
5063
5064         * archive.cc (Archive::interpret_header): Return -1 if something
5065         goes wrong.  Change callers accordingly.
5066
5067 2011-03-25  Cary Coutant  <ccoutant@google.com>
5068
5069         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5070         * testsuite/Makefile.in: Regenerate.
5071
5072 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5073
5074         * plugin.cc (get_view): New.
5075         (Plugin::load): Pass get_view to the plugin.
5076         (Plugin_manager::get_view): New.
5077
5078 2011-03-21  Ian Lance Taylor  <iant@google.com>
5079
5080         * testsuite/final_layout.sh: Rewrite to not use dc.
5081         * testsuite/relro_test.sh: Fail if dc is not present.
5082
5083 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5084
5085         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5086         Change == to -eq.
5087         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5088         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5089         Change == to -eq.
5090         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5091         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5092
5093 2011-03-14  Ian Lance Taylor  <iant@google.com>
5094
5095         * script-sections.cc (Sort_output_sections::script_compare):
5096         Rename from is_before, change return type.
5097         (Sort_output_sections::operator()): Adjust accordingly.
5098
5099 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5100
5101         PR gold/12572
5102         * testsuite/odr_violation2.cc: Add comment to make all error line
5103         numbers double digits.
5104         * testsuite/debug_msg.sh: Adjust expected errors.
5105
5106 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5107
5108         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5109         but mark earlier ones as non-canonical
5110         (offset_to_iterator): Update search target and example
5111         (do_addr2line): Return extra lines in a vector*
5112         (format_file_lineno): Extract from do_addr2line
5113         (one_addr2line): Add vector* out-param
5114         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5115         when a lineno entry appeared last for its instruction
5116         (Dwarf_line_info): Add vector* out-param
5117         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5118         * symtab.cc (Odr_violation_compare): Include the lineno in the
5119         comparison again.
5120         (linenos_from_loc): New. Combine the canonical line for an
5121         address with its other lines.
5122         (True_if_intersect): New. Helper functor to make
5123         std::set_intersection a query.
5124         (detect_odr_violations): Compare sets of lines instead of just
5125         one line for each function. This became less deterministic, but
5126         has fewer false positives.
5127         * symtab.h: Declarations.
5128         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5129         mix an optimized and non-optimized object in the same binary
5130         (odr_violation2.so): Same.
5131         * testsuite/Makefile.in: Regenerate from Makefile.am.
5132         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5133         * testsuite/debug_msg.sh: Update line numbers and add
5134         assertions.
5135         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5136         non-optimized context.
5137         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5138         isn't inlined, and use OdrDerived in an optimized context.
5139         * testsuite/odr_header1.h: Defines OdrDerived, where
5140         optimization will change the
5141         first-instruction-in-the-destructor's file and line number.
5142         * testsuite/odr_header2.h: Defines OdrBase.
5143
5144 2011-03-09  Ian Lance Taylor  <iant@google.com>
5145
5146         * fileread.cc (File_read::clear_views): Don't delete the whole
5147         file view.
5148
5149 2011-03-08  Ian Lance Taylor  <iant@google.com>
5150
5151         PR gold/12525
5152         * fileread.cc: #include <climits>.
5153         (GOLD_IOV_MAX): Define.
5154         (File_read::read_multiple): Limit number of entries by iov_max.
5155         * fileread.h (class File_read): Always set max_readv_entries to
5156         128.
5157
5158 2011-03-07  Ian Lance Taylor  <iant@google.com>
5159
5160         PR gold/12525
5161         * options.h (class General_options): Add -dy and -dn.
5162
5163 2011-03-02  Cary Coutant  <ccoutant@google.com>
5164
5165         * testsuite/script_test_9.t: Add TLS segment.
5166
5167 2011-03-02  Simon Baldwin  <simonb@google.com>
5168
5169         * configure.ac: Add check for gnu_indirect_function support in
5170         the toolchain building binutils.
5171         * configure: Rebuild.
5172
5173 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5174
5175         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5176         plugin only symbols.
5177         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5178         in plugin files as not needed in the symbol table.
5179
5180 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5181
5182         * output.cc (Output_section::add_input_section): Delay fill
5183         generation for section ordering.
5184
5185 2011-02-09  Ian Lance Taylor  <iant@google.com>
5186
5187         PR gold/12316
5188         * object.h (class Sized_relobj): Remove clear_local_symbols.
5189         * reloc.cc (Sized_relobj::do_relocate): Don't call
5190         clear_local_symbols.
5191
5192 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5193
5194         * plugin.cc (is_visible_from_outside): Return true for symbols
5195         in the -u option.
5196
5197 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5198
5199         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5200         filename.
5201
5202 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5203
5204         * icf.h (is_section_foldable_candidate): Change type of parameter
5205         to std::string.
5206         * icf.cc (Icf::find_identical_sections): Change type of local variable
5207         section_name to be std::string.
5208         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5209
5210 2011-01-25  Ian Lance Taylor  <iant@google.com>
5211
5212         * script.cc (script_add_extern): Rewrite to use
5213         add_symbol_reference.
5214
5215 2011-01-25  Doug Kwan  <dougkwan@google.com>
5216
5217         * icf.cc (get_section_contents): Always lock section's object.
5218
5219 2011-01-24  Ian Lance Taylor  <iant@google.com>
5220
5221         * options.h (class General_options): Accept
5222         --no-detect-odr-violations.
5223
5224 2011-01-24  Ian Lance Taylor  <iant@google.com>
5225
5226         * version.cc (version_string): Bump to 1.11.
5227
5228 2011-01-24  Ian Lance Taylor  <iant@google.com>
5229
5230         * plugin.cc (class Plugin_rescan): Define new class.
5231         (Plugin_manager::claim_file): Set any_claimed_.
5232         (Plugin_manager::save_archive): New function.
5233         (Plugin_manager::save_input_group): New function.
5234         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5235         necessary.
5236         (Plugin_manager::new_undefined_symbol): New function.
5237         (Plugin_manager::rescan): New function.
5238         (Plugin_manager::rescannable_defines): New function.
5239         (Plugin_manager::add_input_file): Set any_added_.
5240         * plugin.h (class Plugin_manager): define new fields rescannable_,
5241         undefined_symbols_, any_claimed_, and any_added_.  Declare
5242         Plugin_rescan as friend.  Declare new functions.
5243         (Plugin_manager::Rescannable): Define type.
5244         (Plugin_manager::Rescannable_list): Define type.
5245         (Plugin_manager::Undefined_symbol_list): Define type.
5246         (Plugin_manager::Plugin_manager): Initialize new fields.
5247         * archive.cc (Archive::defines_symbol): New function.
5248         (Add_archive_symbols::run): Pass archive to plugins if any.
5249         * archive.h (class Archive): Declare defines_symbol.
5250         * readsyms.cc (Input_group::~Input_group): New function.
5251         (Finish_group::run): Pass input_group to plugins if any.
5252         * readsyms.h (class Input_group): Declare destructor.
5253         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5254         any.
5255
5256 2011-01-10  Ian Lance Taylor  <iant@google.com>
5257
5258         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5259         section as relro.
5260         (Layout::set_segment_offsets): Reset increase_relro before calling
5261         set_section_addresses a second time.
5262
5263 2011-01-04  Cary Coutant  <ccoutant@google.com>
5264
5265         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5266         sections before NOBITS sections.
5267
5268 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5269
5270         * version.cc (print_version): Update copyright to 2011.
5271
5272 2010-12-23  Cary Coutant  <ccoutant@google.com>
5273
5274         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5275         of OS to this->add.  Add OD parameter to second form of the function.
5276
5277 2010-12-20  Ian Lance Taylor  <iant@google.com>
5278
5279         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5280         second of two consecutive entries with same offset.
5281
5282 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5283
5284         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5285         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5286         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5287         to avoid unneeded links against $(LDADD).
5288         * testsuite/Makefile.in: Regenerate.
5289
5290 2010-12-15  Ian Lance Taylor  <iant@google.com>
5291
5292         PR gold/12324
5293         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5294         for R_X86_64_32 and R_X86_64_PC32.
5295         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5296         ver_matching_def_pic.o.
5297         (ver_matching_def_pic.o): New target.
5298
5299 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5300
5301         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5302         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5303         Move definition before File_read::View member definitions.
5304         (File_read::View::~View): Initialize and hold lock before
5305         updating current_mapped_bytes.
5306
5307 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5308
5309         * dwarf_reader.cc: Remove outdated comment.
5310         * gold-threads.cc: Fix typo in error message.
5311         * archive.cc: Fix typos in comments.
5312         * archive.h: Likewise.
5313         * arm-reloc-property.cc: Likewise.
5314         * arm-reloc-property.h: Likewise.
5315         * arm-reloc.def: Likewise.
5316         * arm.cc: Likewise.
5317         * attributes.h: Likewise.
5318         * cref.cc: Likewise.
5319         * ehframe.cc: Likewise.
5320         * fileread.h: Likewise.
5321         * gold.h: Likewise.
5322         * i386.cc: Likewise.
5323         * icf.cc: Likewise.
5324         * incremental.h: Likewise.
5325         * int_encoding.cc: Likewise.
5326         * layout.h: Likewise.
5327         * main.cc: Likewise.
5328         * merge.h: Likewise.
5329         * object.cc: Likewise.
5330         * object.h: Likewise.
5331         * options.cc: Likewise.
5332         * readsyms.cc: Likewise.
5333         * reduced_debug_output.cc: Likewise.
5334         * reloc.cc: Likewise.
5335         * script-sections.cc: Likewise.
5336         * sparc.cc: Likewise.
5337         * symtab.h: Likewise.
5338         * target-reloc.h: Likewise.
5339         * target.cc: Likewise.
5340         * target.h: Likewise.
5341         * timer.cc: Likewise.
5342         * timer.h: Likewise.
5343         * x86_64.cc: Likewise.
5344
5345 2010-12-09  Cary Coutant  <ccoutant@google.com>
5346
5347         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5348         stack.
5349         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5350         parameter; change all callers.
5351         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5352         * options.h (warn_execstack): New option.
5353
5354 2010-12-07  Doug Kwan  <dougkwan@google.com>
5355
5356         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5357         like function call relocations.
5358
5359 2010-12-07  Ian Lance Taylor  <iant@google.com>
5360
5361         * archive.cc (Archive::get_elf_object_for_member): Permit
5362         punconfigured to be NULL.
5363         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5364         (Archive::include_member): Pass NULL to get_elf_object_for_member
5365         if we searched for the archive and this is the first included
5366         object.
5367
5368 2010-12-01  Ian Lance Taylor  <iant@google.com>
5369
5370         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5371         track_relocs_type_ field.
5372         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5373         Set track_relocs_type_.
5374         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5375         contents when using RELA relocs.
5376         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5377         reloc_map_.
5378         * reloc.cc (Track_relocs::next_addend): New function.
5379         * reloc.h (class Track_relocs): Declare next_addend.
5380
5381 2010-12-01  Ian Lance Taylor  <iant@google.com>
5382
5383         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5384         virtual destructor.
5385
5386 2010-12-01  Ian Lance Taylor  <iant@google.com>
5387
5388         * README: Update compilers known to work and fail.
5389
5390 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5391
5392         * configure.in: For --enable-gold, handle value `default' instead of
5393         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5394         not the default.
5395         * configure: Regenerate.
5396
5397 2010-11-18  Doug Kwan  <dougkwan@google.com>
5398
5399         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5400         and right_alignment to be zero.  Store result alignment only if it is
5401         greater than existing alignment.
5402
5403 2010-11-16  Cary Coutant  <ccoutant@google.com>
5404
5405         PR gold/12220
5406         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5407         Check for ".zdebug_line".
5408
5409 2010-11-16  Doug Kwan  <dougkwan@google.com>
5410             Cary Coutant  <ccoutant@google.com>
5411
5412         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5413         by reference; adjust all callers.
5414         * output.cc (Output_segment::set_section_addresses): Adjust references
5415         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5416         list is empty.
5417         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5418         end at page boundary.
5419
5420 2010-11-16  Cary Coutant  <ccoutant@google.com>
5421
5422         PR gold/12220
5423         * layout.cc (Layout::choose_output_section): Transform names of
5424         compressed sections even when using a script with a SECTIONS clause.
5425         (Layout::output_section_name): Remove code to transform
5426         compressed debug section names.
5427         * output.cc (Output_section::add_input_section): Use uncompressed
5428         section size when tracking input sections.
5429
5430 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5431
5432         * symtab.h (Symbol::NON_PIC_REF): Remove.
5433         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5434         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5435         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5436         (Symbol::use_plt_offset): Take a flags argument and pass it
5437         directly to needs_dynamic_reloc.  Restrict check for undefined
5438         weak symbols to function calls.
5439         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5440         (Target_arm::Scan::global): Use it.
5441         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5442         (Target_arm::Relocate::relocate): Likewise.
5443         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5444         parameter with an r_type parameter.  Use get_reference_flags
5445         to get the flags.
5446         (Target_arm::Relocate::relocate): Update accordingly.
5447         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5448         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5449         (Target_i386::Scan::global): Likewise.
5450         (Target_i386::Relocate::relocate): Likewise.
5451         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5452         parameter with an r_type parameter.  Use get_reference_flags
5453         to get the flags.
5454         (Target_i386::Relocate::relocate): Update accordingly.
5455         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5456         (Target_powerpc::Scan::global): Use it.
5457         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5458         (Target_powerpc::Relocate::relocate): Likewise.
5459         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5460         (Target_sparc::Scan::global): Use it.
5461         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5462         (Target_sparc::Relocate::relocate): Likewise.
5463         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5464         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5465         (Target_x86_64::Scan::global): Likewise.
5466         (Target_x86_64::Relocate::relocate): Likewise.
5467
5468 2010-11-08  Doug Kwan  <dougkwan@google.com>
5469             Cary Coutant  <ccoutant@google.com>
5470
5471         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5472         (Arm_exidx_merge_section::section_contents_): New data member.
5473         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5474         (Arm_input_section::~Arm_input_section): De-allocate memory.
5475         (Arm_input_section::original_contents_): New data member.
5476         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5477         in parameters instead of calling Object::section_contents without
5478         locking.
5479         (Arm_output_section::group_section): New parameter TASK.  Pass it
5480         to callees that need locking objects.
5481         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5482         to lock EXIDX input sections.  Fix a formatting issue.  Call
5483         Arm_exidx_merged_section::build_contents to create merged section
5484         contents.
5485         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5486         to lock object of stub table owner.
5487         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5488         TEXT_SIZE to initialize data member TEXT_SIZE_.
5489         (Arm_exidx_input_section::addralign): Fix typo in comment.
5490         (Arm_exidx_input_section::text_size): New method.
5491         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5492         that require locking objects.  Lock objects before scanning for stubs
5493         and updating local symbols.
5494         (Arm_input_section<big_endian>::init): Copy contents of original
5495         input section.
5496         (Arm_input_section<big_endian>::do_write): Use saved contents of
5497         original input section instead of calling Object::section_contents
5498         without locking.
5499         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5500         size without calling Object::section_size().
5501         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5502         for size.  Allocate a buffer for merged EXIDX entries.
5503         (Arm_exidx_merged_section::build_contents): New method.
5504         (Arm_exidx_merged_section::do_write): Move merge section contents
5505         building code to Arm_exidx_merged_section::build_contetns.  Write
5506         out contetns in buffer instead of building it on the fly.
5507         (Arm_relobj::make_exidx_input_section): Also pass text section size
5508         to Arm_exidx_input_section constructor.
5509         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5510         (Arm_dynobj::do_read_symbols): Fix memory leak.
5511         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5512         * target.h: (class Task): Add forward declaration.
5513         (Target::relax): Add new parameter TASK and pass it to
5514         Target::do_relax().
5515         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5516
5517 2010-11-05  Cary Coutant  <ccoutant@google.com>
5518
5519         PR gold/10708
5520         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5521         object when reading from the file.
5522         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5523         second layout pass.
5524         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5525         when reading section contents.
5526         (get_section_contents): Likewise.
5527         (icf::find_identical_sections): Likewise.
5528         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5529         object when reading from the file.
5530         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5531         the object when doing deferred section layout.
5532
5533 2010-11-03  Nick Clifton  <nickc@redhat.com>
5534
5535         PR gold/12001
5536         * script.h (class Symbol_assignment: name): New member.  Returns
5537         the name of the symbol.
5538         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5539         Returns true if the given symbol name is on the list of
5540         assignments wating to be processed.
5541         * archive.cc (should_incldue_member): If the symbol is undefined,
5542         check to see if it is on the list of symbols pending assignment.
5543
5544 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5545
5546         * script-sections.cc (Script_sections::find_memory_region): Check
5547         for a NULL output section pointer.
5548
5549 2010-10-29  Doug Kwan  <dougkwan@google.com>
5550
5551         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5552         Output_section::add_relaxed_input_section.
5553         * output.cc (Output_section::add_relaxed_input_section): Add new
5554         arguments LAYOUT and NAME.  Set section order index.
5555         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5556         Copy section order index.
5557         * output.h (Output_section::add_relaxed_input_section): Add new
5558         arguments LAYOUT and NAME.
5559
5560 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5561
5562         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5563         NATIVE_OR_CROSS_LINKER.
5564         * testsuite/Makefile.in: Regenerate.
5565
5566 2010-10-20  Doug Kwan  <dougkwan@google.com>
5567
5568         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5569         without SHF_LINK_ORDER flags.
5570         * layout.cc (Layout::choose_output_section): Do not filter
5571         SHF_LINK_ORDER flag in a relocatable link.
5572
5573 2010-10-17  Cary Coutant  <ccoutant@google.com>
5574
5575         * output.h (Output_segment::set_section_addresses): Change function
5576         signature.  Update all callers.
5577         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5578         sections.
5579         (Output_segment::set_section_addresses): Align after last TLS
5580         section.  Add padding before last relro section instead of after.
5581
5582 2010-10-17  Doug Kwan  <dougkwan@google.com>
5583
5584         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5585         GOT output section to be writable.
5586
5587 2010-10-14  Cary Coutant  <ccoutant@google.com>
5588
5589         * debug.h (DEBUG_INCREMENTAL): New flag.
5590         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5591         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5592         mode.
5593         * incremental.cc (report_command_line): Ignore all forms of
5594         --incremental.
5595         * layout.cc (Layout::Layout): Check parameters for incremental link
5596         mode.
5597         * options.cc (General_options::parse_incremental): New function.
5598         (General_options::parse_no_incremental): New function.
5599         (General_options::parse_incremental_full): New function.
5600         (General_options::parse_incremental_update): New function.
5601         (General_options::incremental_mode_): New data member.
5602         (General_options::finalize): Check incremental_mode_.
5603         * options.h (General_options): Update help text for --incremental.
5604         Add --no-incremental, --incremental-full, --incremental-update.
5605         (General_options::Incremental_mode): New enum type.
5606         (General_options::incremental_mode): New function.
5607         (General_options::incremental_mode_): New data member.
5608         * parameters.cc (Parameters::incremental_mode_): New data member.
5609         (Parameters::set_options): Set incremental_mode_.
5610         (Parameters::set_incremental_full): New function.
5611         (Parameters::incremental): New function.
5612         (Parameters::incremental_update): New function.
5613         (set_parameters_incremental_full): New function.
5614         * parameters.h (Parameters::set_incremental_full): New function.
5615         (Parameters::incremental): New function.
5616         (Parameters::incremental_update): New function.
5617         (Parameters::incremental_mode_): New data member.
5618         (set_parameters_incremental_full): New function.
5619         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5620         incremental link mode.
5621         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5622         (Sized_relobj::do_relocate_sections): Likewise.
5623         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5624         option.
5625         * testsuite/Makefile.in: Regenerate.
5626         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5627
5628 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5629
5630         * script-sections.h (class Script_sections): Make
5631         Sections_elements typedef public.
5632         * script-sections.cc (class Sort_output_sections): Add elements_
5633         field.  Add constructor which sets it; change all callers.
5634         (Sort_output_sections::is_before): New function.
5635         (Sort_output_sections::operator()): Call is_before.
5636         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5637         conditional.
5638         * testsuite/script_test_10.sh: New test. Test script section
5639         order.
5640         * testsuite/script_test_10.t: Likewise.
5641         * testsuite/script_test_10.s: Likewise.
5642         * testsuite/Makefile.am: Wrap the cross linker tests and the
5643         common tests into NATIVE_OR_CROSS_LINKER.
5644         (check_SCRIPTS): Add script_test_10.sh.
5645         (check_DATA): Add script_test_10.stdout.
5646         (script_test_10.o, script_test_10): New targets.
5647         (script_test_10.stdout): New target.
5648         * configure, testsuite/Makefile.in: Regenerate.
5649
5650 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5651
5652         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5653         error for the deprecated relocations.
5654         (Target_arm::Scan::global): Likewise.
5655         (Target_arm::Relocate::relocate): Likewise.
5656
5657 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5658
5659         * fileread.cc (Input_file::find_file): Initialize *found_name
5660         and *namep when using the fallback search for case 4.
5661
5662 2010-10-11  Cary Coutant  <ccoutant@google.com>
5663
5664         * options.h (class General_options): Redefine -z lazy as an alias for
5665         the negation of -z now.
5666
5667 2010-10-11  Ian Lance Taylor  <iant@google.com>
5668
5669         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5670         binding.
5671
5672 2010-10-06  Nick Clifton  <nickc@redhat.com>
5673
5674         * script-sections.cc(class Memory_region): Remove
5675         current_lma_offset_ field.  Rename current_vma_offset_ to
5676         current_offset_.  Add last_section_ field.
5677         (Memory_region::get_current_vma_address): Rename to
5678         get_current_address.
5679         (Memory_region::get_current_lma_address): Delete.
5680         (Memory_region::increment_vma_offset): Rename to
5681         increment_offset.
5682         (Memory_region::increment_lma_offset): Delete.
5683         (Memory_region::attributes_compatible): New method.  Returns
5684         true if the provided section is compatible with the region.
5685         (Memory_region::get_last_section): New method.  Returns the last
5686         section to use the region.
5687         (Memory_region::set_last_section): New method.  Stores the last
5688         section to use the region.
5689         (Script_sections::block_in_region): New method.  Returns true if
5690         a block of memory is contained within a region.
5691         (Script_sections::find_memory_region): New method.  Locates a
5692         memory region to be used to set a VMA or LMA address.
5693         (Output_section_definition::set_section_addresses): Add code to
5694         check for addresses set by memory regions.
5695         (Output_segment::set_section_addresses): Remove memory region
5696         walking code.
5697         (Script_sections::create_segment): Add a warning if a header
5698         segment is created outside of any region.
5699         * script-sections.h (class Script_sections): Add prototypes for
5700         find_memory_region and block_in_region methods.
5701         * testsuite/memory_test.s: Use .long instead of .word.
5702         * testsuite/memory_test.t: Add some more output sections.
5703         * testsuite/memory_test.sh: Update expected output.
5704
5705 2010-10-02  Doug Kwan  <dougkwan@google.com>
5706
5707         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5708         defintion to symtab.h
5709         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5710         declaration to defintion.
5711
5712 2010-10-01  Nick Clifton  <nickc@redhat.com>
5713
5714         * expression.cc (eval): Replace dummy argument with NULL.
5715         (eval_maybe_dot): Check for a NULL result section pointer.
5716         (Symbol_expression::value): Likewise.
5717         (Dot_expression::value): Likewise.
5718         (BINARY_EXPRESSION): Likewise.
5719         (Max_expression::value): Likewise.
5720         (Min_expression::value): Likewise.
5721         (Absolute_expression::value): Likewise.
5722         (Addr_expression::value_from_output_section): Likewise.
5723         (Loaddddr_expression::value_from_output_section): Likewise.
5724         (Segment_start_expression::value): Likewise.
5725         * script-sections.cc
5726         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5727         argument with NULL.
5728         (Sections_elememt_dot_assignment::set_section_addresses):
5729         Likewise.
5730         (Output_data_expression::do_write_to_buffer): Likewise.
5731         (Output_section_definition::finalize_symbols): Likewise.
5732         (Output_section_definition::set_section_addresses): Likewise.
5733
5734 2010-09-30  Doug Kwan  <dougkwan@google.com>
5735
5736         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5737
5738 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5739
5740         * target.h (Target::can_icf_inline_merge_sections): New virtual
5741         function.
5742         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5743         virtual function.
5744         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5745         virtual function.
5746         * icf.cc (get_section_contents): Inline merge sections only when
5747         target allows it.
5748
5749 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5750
5751         * configure: Regenerate.
5752
5753 2010-09-17  Ian Lance Taylor  <iant@google.com>
5754
5755         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5756         * testsuite/Makefile.am (memory_test.o): New target.
5757         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5758         memory_test.t.
5759         * testsuite/Makefile.in: Rebuild.
5760
5761 2010-09-17  Doug Kwan  <dougkwan@google.com>
5762
5763         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5764         defintion if relocation uses GOT entries of the symbol.
5765         * testsuite/icf_safe_test.sh: Fix test.
5766         * testsuite/icf_safe_so_test.sh: Fix test.
5767
5768 2010-09-16  Cary Coutant  <ccoutant@google.com>
5769
5770         * script_sections.cc (class Memory_region): Remove "NULL" from
5771         vector initializations.
5772
5773 2010-09-15  Cary Coutant  <ccoutant@google.com>
5774
5775         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5776         Resolve forwarding symbols.
5777
5778 2010-09-15  Doug Kwan  <dougkwan@google.com>
5779
5780         * gold/testsuite/script_test_3.t: Add ARM special sections.
5781         * gold/testsuite/script_test_4.t: Same.
5782         * gold/testsuite/script_test_5.t: Same.
5783         * gold/testsuite/script_test_6.t: Same.
5784         * gold/testsuite/script_test_7.t: Same.
5785         * gold/testsuite/script_test_7.t: Same.
5786         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5787
5788 2010-09-14  Cary Coutant  <ccoutant@google.com>
5789
5790         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5791         (Target_x86_64::Relocate::relocate_tls): Replace check for
5792         saw_tls_block_reloc_ with test for executable section.
5793
5794 2010-09-12  Cary Coutant  <ccoutant@google.com>
5795
5796         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5797         position-independent executables to shared libraries need dynamic
5798         relocations.
5799         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5800         position-independent executables.
5801         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5802         * testsuite/Makefile.in: Regenerate.
5803
5804 2010-09-10  Nick Clifton  <nickc@redhat.com>
5805
5806         PR gold/11997
5807         * testsuite/memory_test.t: Discard any sections that are not
5808         needed.
5809
5810 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5811
5812         PR gold/11996
5813         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5814         "This::" to work around a bug in gcc 4.2.
5815
5816         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5817
5818 2010-09-09  Rafael Espindola  <espindola@google.com>
5819
5820         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5821         sections with different PF_X flags in the same segment.
5822         (Layout::find_first_load_seg): Search all segments to find the first
5823         one.
5824         * options.h (rosegment): New.
5825
5826 2010-09-08  Rafael Espindola  <espindola@google.com>
5827
5828         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5829
5830 2010-09-08  Doug Kwan  <dougkwan@google.com>
5831
5832         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5833         (Arm_relobj::do_relocate_sections): Add new parameter for output
5834         file to match the parent.
5835         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5836         of local symbols instead of input values.  Update code to track
5837         changes in gold::relocate_section.
5838         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5839         (Sized_relobj::compute_final_local_value_internal): New methods.
5840         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5841         body into private version of Sized_relobj::compute_final_local_value.
5842         Call the inline method.
5843         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5844         merged symbol value if there is one.
5845         (Symbol_value::has_output_value): New method defintiion.
5846         (Sized_relobj::Compute_final_local_value_status): New enum type.
5847         (Sized_relobj::compute_final_local_value): New methods.
5848         (Sized_relobj::compute_final_local_value_internal): New methods.
5849         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5850         and arm_cortex_a8.sh.
5851         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5852         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5853         New tests.
5854         * Makefile.in: Regenerate.
5855         * testsuite/arm_bl_out_of_range.s: Update test.
5856         * testsuite/thumb_bl_out_of_range.s: Ditto.
5857         * testsuite/thumb_blx_out_of_range.s: Ditto.
5858         * testsuite/arm_branch_out_of_range.sh: New file.
5859         * testsuite/arm_cortex_a8.sh: Ditto.
5860         * testsuite/arm_cortex_a8_b.s: Ditto.
5861         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5862         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5863         * testsuite/arm_cortex_a8_bl.s: Ditto.
5864         * testsuite/arm_cortex_a8_blx.s: Ditto.
5865         * testsuite/arm_cortex_a8_local.s: Ditto.
5866         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5867         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5868
5869 2010-09-08  Rafael Espindola  <espindola@google.com>
5870
5871         * Makefile.am (memory_test.stdout): Run readelf with -W.
5872         * Makefile.in: Regenerate.
5873         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5874         64 bit output.
5875
5876 2010-09-08  Rafael Espindola  <espindola@google.com>
5877
5878         * script-sections.cc (Script_sections::add_memory_region): Convert
5879         field precision to int.
5880         * script.cc (script_set_section_region, script_set_section_region):
5881         Convert field precision to int.
5882
5883 2010-09-08  Rafael Espindola  <espindola@google.com>
5884
5885         * arm.cc (do_finalize_sections): Create the __exidx_start and
5886         __exdix_end symbols even when the section is missing.
5887
5888 2010-09-08  Nick Clifton  <nickc@redhat.com>
5889
5890         * README: Remove claim that MEMORY is not supported.
5891         * expression.cc (script_exp_function_origin)
5892         (script_exp_function_length): Move from here to ...
5893         * script.cc: ... here.
5894         (script_set_section_region, script_add_memory)
5895         (script_parse_memory_attr, script_include_directive): New
5896         functions.
5897         * script-sections.cc
5898         (class Memory_region): New class.
5899         (class Output_section_definition): Add set_memory_region,
5900         set_section_vma, set_section_lma and get_section_name methods.
5901         (class Script_Sections): Add add_memory_region,
5902         find_memory_region, find_memory_region_origin,
5903         find_memory_region_length and set_memory_region methods.
5904         Have set_section_addresses method walk the list of set memory
5905         regions.
5906         Extend the print methos to display memory regions.
5907         * script-sections.h: Add prototypes for new methods.
5908         Add enum for MEMORY region attributes.
5909         * yyscript.y: Add support for parsing MEMORY regions.
5910         * script-c.h: Add prototypes for new functions.
5911         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5912         * testsuite/Makefile.in: Regenerate.
5913         * testsuite/memory_test.sh: New script.
5914         * testsuite/memory_test.s: New assembler source file.
5915         * testsuite/memory_test.t: New linker script.
5916
5917 2010-08-27  Doug Kwan  <dougkwan@google.com>
5918
5919         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5920         reference override an existing dynamic weak reference.
5921         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5922         * testsuite/Makefile.in: Regenerate.
5923         * testsuite/dyn_weak_ref.sh: New file.
5924         * testsuite/dyn_weak_ref_1.c: Ditto.
5925         * testsuite/dyn_weak_ref_2.c: Ditto.
5926
5927 2010-08-27  Ian Lance Taylor  <iant@google.com>
5928
5929         * incremental.h (class Incremental_input_entry): Add virtual
5930         destructor.
5931
5932 2010-08-27  Ian Lance Taylor  <iant@google.com>
5933
5934         * testsuite/start_lib_test_3.c: Mark t3 as used.
5935
5936 2010-08-27  Nick Clifton  <nickc@redhat.com>
5937
5938         * options.cc (version_script): Fix small typo in previous
5939         whitespace tidyup.
5940
5941 2010-08-25  Nick Clifton  <nickc@redhat.com>
5942
5943         * archive.cc: Formatting fixes: Remove whitespace between
5944         typename and following asterisk.  Remove whitespace between
5945         function name and opening parenthesis.
5946         * archive.h: Likewise.
5947         * arm.cc: Likewise.
5948         * attributes.cc: Likewise.
5949         * attributes.h: Likewise.
5950         * common.cc: Likewise.
5951         * copy-relocs.cc: Likewise.
5952         * dirsearch.h: Likewise.
5953         * dynobj.cc: Likewise.
5954         * ehframe.cc: Likewise.
5955         * ehframe.h: Likewise.
5956         * expression.cc: Likewise.
5957         * fileread.cc: Likewise.
5958         * fileread.h: Likewise.
5959         * gc.h: Likewise.
5960         * gold-threads.cc: Likewise.
5961         * gold.cc: Likewise.
5962         * i386.cc: Likewise.
5963         * icf.h: Likewise.
5964         * incremental-dump.cc: Likewise.
5965         * incremental.cc: Likewise.
5966         * layout.cc: Likewise.
5967         * layout.h: Likewise.
5968         * main.cc: Likewise.
5969         * merge.cc: Likewise.
5970         * merge.h: Likewise.
5971         * object.cc: Likewise.
5972         * object.h: Likewise.
5973         * options.cc: Likewise.
5974         * options.h: Likewise.
5975         * output.cc: Likewise.
5976         * output.h: Likewise.
5977         * plugin.cc: Likewise.
5978         * plugin.h: Likewise.
5979         * powerpc.cc: Likewise.
5980         * reloc.cc: Likewise.
5981         * script-c.h: Likewise.
5982         * script-sections.cc: Likewise.
5983         * script.cc: Likewise.
5984         * stringpool.cc: Likewise.
5985         * symtab.cc: Likewise.
5986         * symtab.h: Likewise.
5987         * target.cc: Likewise.
5988         * timer.cc: Likewise.
5989         * timer.h: Likewise.
5990         * version.cc: Likewise.
5991         * x86_64.cc: Likewise.
5992
5993 2010-08-24  Nick Clifton  <nickc@redhat.com>
5994
5995         PR 11899
5996         * layout.cc (segment_precedes): Sort segments by their physical
5997         addresses, if they have been set.
5998
5999 2010-08-23  Cary Coutant  <ccoutant@google.com>
6000
6001         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6002         symbols data.
6003         (Lib_group::include_member): Unlock object after deleting its
6004         symbols data.
6005         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6006         the bug fixed here.
6007
6008 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6009             Cary Coutant  <ccoutant@google.com>
6010
6011         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6012         constructor, and set_blocker.
6013         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6014         readsyms_blocker_.
6015         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6016         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6017         * testsuite/Makefile.am (start_lib_test): New test case.
6018         * testsuite/Makefile.in: Regenerate.
6019         * testsuite/start_lib_test_main.c: New file.
6020         * testsuite/start_lib_test_1.c: New file.
6021         * testsuite/start_lib_test_2.c: New file.
6022         * testsuite/start_lib_test_3.c: New file.
6023
6024 2010-08-19  Ian Lance Taylor  <iant@google.com>
6025
6026         * Makefile.in: Rebuild with automake 1.11.1.
6027         * aclocal.m4: Likewise.
6028         * testsuite/Makefile.in: Likewise.
6029
6030 2010-08-19  Ian Lance Taylor  <iant@google.com>
6031
6032         PR 10893
6033         * i386.cc (class Output_data_plt_i386): Update declarations.
6034         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6035         local_ifuncs_ fields.
6036         (Target_i386::do_plt_section_for_global): New function.
6037         (Target_i386::do_plt_section_for_local): New function.
6038         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6039         parameter; change all callers.  Initialize global_ifuncs_ and
6040         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6041         __rel_iplt_end.
6042         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6043         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6044         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6045         symbols.
6046         (Target_i386::make_plt_section): New function, broken out of
6047         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6048         (Target_i386::make_plt_entry): Call make_plt_section.
6049         (Target_i386::make_local_ifunc_plt_entry): New function.
6050         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6051         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6052         R_386_IRELATIVE to switch.
6053         (Target_i386::Scan::global): Likewise.
6054         (Target_i386::Relocate::relocate): Likewise.
6055         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6056         switch.
6057         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6058         (Target_x86_64::do_plt_section_for_global): New function.
6059         (Target_x86_64::do_plt_section_for_local): New function.
6060         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6061         parameter; change all callers.  If doing a static link define
6062         __rela_iplt_start and __rela_iplt_end.
6063         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6064         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6065         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6066         to point to .plt.
6067         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6068         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6069         switch.
6070         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6071         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6072         R_X86_64_IRELATIVE to switch.
6073         (Target_x86_64::Scan::global): Likewise.
6074         (Target_x86_64::Relocate::relocate): Likewise.
6075         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6076         switch.
6077         * target.h (class Target): Add plt_section_for_global and
6078         plt_section_for_local functions.  Add do_plt_section_for_global
6079         and do_plt_section_for_local virtual functions.
6080         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6081         clarifying comments.
6082         (Symbol::use_plt_offset): Handle IFUNC symbol.
6083         * object.cc (Sized_relobj::Sized_relobj): Initialize
6084         local_plt_offsets_.
6085         (Sized_relobj::local_has_plt_offset): New function.
6086         (Sized_relobj::local_plt_offset): New function.
6087         (Sized_relobj::set_local_plt_offset): New function.
6088         (Sized_relobj::do_count): Handle IFUNC symbol.
6089         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6090         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6091         is_ifunc_symbol functions.
6092         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6093         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6094         local_plt_offsets_ field.
6095         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6096         * output.h (class Output_section_data): Add non-const
6097         output_section function.
6098         (class Output_data_got): Update declarations.
6099         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6100         Add use_plt_offset parameter to global and local constructors.
6101         Change all callers.  Change local_sym_index_ field to 31 bits.
6102         Change GSYM_CODE and CONSTANT_CODE accordingly.
6103         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6104         doing a static link don't set sh_link field.
6105         (Output_data_got::Got_entry::write): Use PLT offset if
6106         appropriate.
6107         (Output_data_got::add_global_plt): New function.
6108         (Output_data_got::add_local_plt): New function.
6109         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6110         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6111         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6112         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6113         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6114         IFUNC conditional.
6115         * testsuite/ifunc-sel.h: New file.
6116         * testsuite/ifuncmain1.c: New file.
6117         * testsuite/ifuncmain1vis.c: New file.
6118         * testsuite/ifuncmod1.c: New file.
6119         * testsuite/ifuncdep2.c: New file.
6120         * testsuite/ifuncmain2.c: New file.
6121         * testsuite/ifuncmain3.c: New file.
6122         * testsuite/ifuncmod3.c: New file.
6123         * testsuite/ifuncmain4.c: New file.
6124         * testsuite/ifuncmain5.c: New file.
6125         * testsuite/ifuncmod5.c: New file.
6126         * testsuite/ifuncmain6pie.c: New file.
6127         * testsuite/ifuncmod6.c: New file.
6128         * testsuite/ifuncmain7.c: New file.
6129         * configure, testsuite/Makefile.in: Rebuild.
6130
6131 2010-08-18  Ian Lance Taylor  <iant@google.com>
6132
6133         * incremental.cc
6134         (Output_section_incremental_inputs::write_input_files): Add cast
6135         to avoid signed/unsigned comparison warning.
6136         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6137
6138 2010-08-12  Cary Coutant  <ccoutant@google.com>
6139
6140         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6141
6142 2010-08-13  Ian Lance Taylor  <iant@google.com>
6143
6144         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6145
6146 2010-08-12  Cary Coutant  <ccoutant@google.com>
6147             Doug Kwan  <dougkwan@google.com>
6148
6149         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6150         defintion overrides non-weak undef, remember that the original undef
6151         is not weak.
6152         * symtab.cc (Symbol_table::sized_write_global): For undef without
6153         an original weak binding, set binding to global in output.
6154         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6155         * testsuite/Makefile.in: Regenerate.
6156         * testsuite/strong_ref_weak_def.sh: New file.
6157         * testsuite/strong_ref_weak_def_1.c: Ditto.
6158         * testsuite/strong_ref_weak_def_2.c: Ditto.
6159
6160 2010-08-12  Cary Coutant  <ccoutant@google.com>
6161
6162         * testsuite/incremental_test.sh: Rewrite.
6163         * testsuite/incremental_test_1.c: Rewrite.
6164         * testsuite/incremental_test_2.c: Rewrite.
6165
6166 2010-08-12  Cary Coutant  <ccoutant@google.com>
6167
6168         * arm.cc (Target_arm::got_size): Add const.
6169         (Target_arm::got_entry_count): New function.
6170         (Target_arm::plt_entry_count): New function.
6171         (Target_arm::first_plt_entry_offset): New function.
6172         (Target_arm::plt_entry_size): New function.
6173         (Output_data_plt_arm::entry_count): New function.
6174         (Output_data_plt_arm::first_plt_entry_offset): New function.
6175         (Output_data_plt_arm::get_plt_entry_size): New function.
6176         * i386.cc (Target_i386::got_size): Add const.
6177         (Target_i386::got_entry_count): New function.
6178         (Target_i386::plt_entry_count): New function.
6179         (Target_i386::first_plt_entry_offset): New function.
6180         (Target_i386::plt_entry_size): New function.
6181         (Output_data_plt_i386::entry_count): New function.
6182         (Output_data_plt_i386::first_plt_entry_offset): New function.
6183         (Output_data_plt_i386::get_plt_entry_size): New function.
6184         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6185         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6186         * incremental.cc: Include target.h.
6187         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6188         parameter.  Adjust all callers.  Find incremental_got_plt section.
6189         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6190         section.
6191         (Output_section_incremental_inputs::set_final_data_size): Calculate
6192         size of incremental_got_plt section.
6193         (Output_section_incremental_inputs::do_write): Write the
6194         incremental_got_plt section.
6195         (Got_plt_view_info): New struct.
6196         (Local_got_offset_visitor): New class.
6197         (Global_got_offset_visitor): New class.
6198         (Global_symbol_visitor_got_plt): New class.
6199         (Output_section_incremental_inputs::write_got_plt): New function.
6200         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6201         Add parameter.  Adjust all callers.
6202         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6203         (Incremental_inputs::got_plt_section): New function.
6204         (Incremental_inputs::got_plt_section_): New data member.
6205         (Incremental_got_plt_reader): New class.
6206         * layout.cc (Layout::create_incremental_info_sections): Add the
6207         incremental_got_plt section.
6208         * object.h (Got_offset_list::get_list): New function.
6209         (Got offset_list::for_all_got_offsets): New function.
6210         (Sized_relobj::local_got_offset_list): New function.
6211         * powerpc.cc (Target_powerpc::got_size): Add const.
6212         (Target_powerpc::got_entry_count): New function.
6213         (Target_powerpc::plt_entry_count): New function.
6214         (Target_powerpc::first_plt_entry_offset): New function.
6215         (Target_powerpc::plt_entry_size): New function.
6216         (Output_data_plt_powerpc::entry_count): New function.
6217         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6218         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6219         * sparc.cc (Target_sparc::got_size): Add const.
6220         (Target_sparc::got_entry_count): New function.
6221         (Target_sparc::plt_entry_count): New function.
6222         (Target_sparc::first_plt_entry_offset): New function.
6223         (Target_sparc::plt_entry_size): New function.
6224         (Output_data_plt_sparc::entry_count): New function.
6225         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6226         (Output_data_plt_sparc::get_plt_entry_size): New function.
6227         * symtab.h (Symbol::got_offset_list): New function.
6228         (Symbol_table::for_all_symbols): New function.
6229         * target.h (Sized_target::got_entry_count): New function.
6230         (Sized_target::plt_entry_count): New function.
6231         (Sized_target::plt_entry_size): New function.
6232         * x86_64.cc (Target_x86_64::got_size): Add const.
6233         (Target_x86_64::got_entry_count): New function.
6234         (Target_x86_64::plt_entry_count): New function.
6235         (Target_x86_64::first_plt_entry_offset): New function.
6236         (Target_x86_64::plt_entry_size): New function.
6237         (Output_data_plt_x86_64::entry_count): New function.
6238         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6239         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6240
6241 2010-08-12  Cary Coutant  <ccoutant@google.com>
6242
6243         * archive.cc: Include incremental.h.
6244         (Archive::Archive): Initialize incremental_info_.
6245         (Archive::include_member): Record archive members in incremental info.
6246         (Add_archive_symbols::run): Record begin and end of an archive in
6247         incremental info.
6248         (Lib_group::include_member): Record objects in incremental info.
6249         * archive.h (Incremental_archive_entry): Forward declaration.
6250         (Archive::set_incremental_info): New member function.
6251         (Archive::incremental_info): New member function.
6252         (Archive::Unused_symbol_iterator): New class.
6253         (Archive::unused_symbols_begin): New member function.
6254         (Archive::unused_symbols_end): New member function.
6255         (Archive::incremental_info_): New data member.
6256         * incremental-dump.cc (find_input_containing_global): New function.
6257         (dump_incremental_inputs): Dump new incremental info sections.
6258         * incremental.cc: Include symtab.h.
6259         (Output_section_incremental_inputs): New class.
6260         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6261         new incremental info sections.
6262         (Sized_incremental_binary::do_check_inputs): Likewise.
6263         (Incremental_inputs::report_archive): Remove.
6264         (Incremental_inputs::report_archive_begin): New function.
6265         (Incremental_inputs::report_archive_end): New function.
6266         (Incremental_inputs::report_object): New function.
6267         (Incremental_inputs::finalize_inputs): Remove.
6268         (Incremental_inputs::report_input_section): New function.
6269         (Incremental_inputs::report_script): Rewrite.
6270         (Incremental_inputs::finalize): Do nothing but finalize string table.
6271         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6272         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6273         (Incremental_inputs::create_data_sections): New function.
6274         (Incremental_inputs::relocs_entsize): New function.
6275         (Output_section_incremental_inputs::set_final_data_size): New function.
6276         (Output_section_incremental_inputs::do_write): New function.
6277         (Output_section_incremental_inputs::write_header): New function.
6278         (Output_section_incremental_inputs::write_input_files): New function.
6279         (Output_section_incremental_inputs::write_info_blocks): New function.
6280         (Output_section_incremental_inputs::write_symtab): New function.
6281         * incremental.h (Incremental_script_entry): Forward declaration.
6282         (Incremental_object_entry): Forward declaration.
6283         (Incremental_archive_entry): Forward declaration.
6284         (Incremental_inputs): Forward declaration.
6285         (Incremental_inputs_header_data): Remove.
6286         (Incremental_inputs_header): Remove.
6287         (Incremental_inputs_header_write): Remove.
6288         (Incremental_inputs_entry_data): Remove.
6289         (Incremental_inputs_entry): Remove.
6290         (Incremental_inputs_entry_write): Remove.
6291         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6292         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6293         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6294         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6295         Likewise.
6296         (Incremental_input_entry): New class.
6297         (Incremental_script_entry): New class.
6298         (Incremental_object_entry): New class.
6299         (Incremental_archive_entry): New class.
6300         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6301         (Incremental_inputs::report_inputs): Remove.
6302         (Incremental_inputs::report_archive): Remove.
6303         (Incremental_inputs::report_archive_begin): New function.
6304         (Incremental_inputs::report_archive_end): New function.
6305         (Incremental_inputs::report_object): Change prototype.
6306         (Incremental_inputs::report_input_section): New function.
6307         (Incremental_inputs::report_script): Change prototype.
6308         (Incremental_inputs::get_reloc_count): New function.
6309         (Incremental_inputs::set_reloc_count): New function.
6310         (Incremental_inputs::create_data_sections): New function.
6311         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6312         (Incremental_inputs::inputs_section): New function.
6313         (Incremental_inputs::symtab_section): New function.
6314         (Incremental_inputs::relocs_section): New function.
6315         (Incremental_inputs::get_stringpool): Add const.
6316         (Incremental_inputs::command_line): Add const.
6317         (Incremental_inputs::inputs): Remove.
6318         (Incremental_inputs::command_line_key): New function.
6319         (Incremental_inputs::input_file_count): New function.
6320         (Incremental_inputs::input_files): New function.
6321         (Incremental_inputs::relocs_entsize): New function.
6322         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6323         (Incremental_inputs::finalize_inputs): Remove.
6324         (Incremental_inputs::Input_info): Remove.
6325         (Incremental_inputs::lock_): Remove.
6326         (Incremental_inputs::inputs_): Change type.
6327         (Incremental_inputs::inputs_map_): Remove.
6328         (Incremental_inputs::current_object_entry_): New data member.
6329         (Incremental_inputs::inputs_section_): New data member.
6330         (Incremental_inputs::symtab_section_): New data member.
6331         (Incremental_inputs::relocs_section_): New data member.
6332         (Incremental_inputs::reloc_count_): New data member.
6333         (Incremental_inputs_reader): New class.
6334         (Incremental_symtab_reader): New class.
6335         (Incremental_relocs_reader): New class.
6336         * layout.cc (Layout::finalize): Move finalization of incremental info
6337         and creation of incremental info sections to follow finalization of
6338         symbol table.  Set offsets for postprocessing sections.
6339         (Layout::create_incremental_info_sections): Call
6340         Incremental_inputs::create_data_sections.  Add incremental symtab
6341         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6342         sections to layout after input sections.
6343         * layout.h (struct Timespec): Forward declaration.
6344         (Layout::incremental_inputs): Add const.
6345         (Layout::create_incremental_info_sections): Add parameter.
6346         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6347         * object.cc: Include incremental.h.
6348         (Relobj::finalize_incremental_relocs): New function.
6349         (Sized_relobj::do_layout): Record input sections in incremental info.
6350         * object.h (Object::output_section): New function.
6351         (Object::output_section_offset): Moved from Relobj.
6352         (Object::get_incremental_reloc_base): New function.
6353         (Object::get_incremental_reloc_count): New function.
6354         (Object::do_output_section): New function.
6355         (Object::do_output_section_offset): Moved from Relobj.
6356         (Object::do_get_incremental_reloc_base): New function.
6357         (Object::do_get_incremental_reloc_count): New function.
6358         (Object::Object): Initialize new data members.
6359         (Relobj::output_section): Renamed do_output_section and moved to
6360         protected.
6361         (Relobj::output_section_offset): Moved to Object.
6362         (Relobj::do_get_incremental_reloc_base): New function.
6363         (Relobj::do_get_incremental_reloc_count): New function.
6364         (Relobj::allocate_incremental_reloc_counts): New function.
6365         (Relobj::count_incremental_reloc): New function.
6366         (Relobj::finalize_incremental_relocs): New function.
6367         (Relobj::next_incremental_reloc_index): New function.
6368         (Relobj::reloc_counts_): New data member.
6369         (Relobj::reloc_bases_): New data member.
6370         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6371         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6372         (Sized_relobj::incremental_relocs_scan): New function.
6373         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6374         (Sized_relobj::incremental_relocs_write): New function.
6375         (Sized_relobj::incremental_relocs_write_reltype): New function.
6376         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6377         incremental link.
6378         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6379         archives and object files elsewhere.
6380         (Add_symbols::run): Report object files here.
6381         (Finish_group::run): Report end of archive at end of group.
6382         * reloc.cc: Include layout.h, incremental.h.
6383         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6384         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6385         (Sized_relobj::incremental_relocs_scan): New function.
6386         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6387         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6388         (Sized_relobj::incremental_relocs_write): New function.
6389         (Sized_relobj::incremental_relocs_write_reltype): New function.
6390         * script.cc (read_input_script): Rewrite test for incremental link.
6391         Change call to Incremental_inputs::report_script.
6392         * symtab.h (Symbol_table::first_global_index): New function.
6393         (Symbol_table::output_count): New function.
6394
6395 2010-08-12  Doug Kwan  <dougkwan@google.com>
6396
6397         * arm.cc (Target_arm::merge_object_attributes): Check command line
6398         options --no-wchar-size-warning and --no-enum-size-warning.
6399         * options.h (General_options): Add ld-compatible options
6400         --no-enum-size-warning and --no-wchar-size-warning.
6401
6402 2010-08-04  Ian Lance Taylor  <iant@google.com>
6403
6404         * x86_64.cc (Target_x86_64::Scan::local): Use
6405         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6406         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6407         (Target_x86_64::Scan::global): Likewise.
6408         (Target_x86_64::Relocate::relocate): Likewise.
6409         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6410         Likewise.
6411
6412 2010-08-03  Cary Coutant  <ccoutant@google.com>
6413
6414         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6415         to reserve space in merged_strings vector. Keep total input size
6416         for stats.
6417         (Output_merge_string::do_print_merge_stats): Print total input size.
6418         * merge.h (Output_merge_string): Add input_size_ field.
6419         * stringpool.cc (Stringpool_template::string_length): Move
6420         implementations out of Stringpool_template class and place in
6421         stringpool.h.
6422         * stringpool.h (string_length): Move out of Stringpool_template.
6423
6424 2010-08-03  Ian Lance Taylor  <iant@google.com>
6425
6426         PR 11712
6427         * layout.cc (relaxation_loop_body): If address of load segment is
6428         set, adjust address to include headers if possible.
6429
6430 2010-08-03  Ian Lance Taylor  <iant@google.com>
6431
6432         * version.cc (version_string): Bump to 1.10.
6433
6434 2010-08-03  Ian Lance Taylor  <iant@google.com>
6435
6436         PR 11805
6437         * layout.h (enum Output_section_order): Define.
6438         (class Layout): Update declarations.
6439         * layout.cc (Layout::get_output_section): Add order parameter.
6440         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6441         is_first_non_relro parameters.  Change all callers.
6442         (Layout::choose_output_section): Likewise.
6443         (Layout::add_output_section_data): Likewise.
6444         (Layout::make_output_section): Likewise.  Set order.
6445         (Layout::default_section_order): New function.
6446         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6447         * output.cc (Output_section::Output_section): Initialize order_.
6448         Don't initialize deleted fields.
6449         (Output_segment::Output_segment): Don't initialize deleted
6450         fields.
6451         (Output_segment::add_output_section_to_load): New function
6452         replacing add_output_section.  Change all callers to call this or
6453         add_output_section_to_nonload.
6454         (Output_segment::add_output_section_to_nonload): New function.
6455         (Output_segment::remove_output_section): Rewrite.
6456         (Output_segment::add_initial_output_data): Likewise.
6457         (Output_segment::has_any_data_sections): Likewise.
6458         (Output_segment::is_first_section_relro): Likewise.
6459         (Output_segment::maximum_alignment): Likewise.
6460         (Output_segment::has_dynamic_reloc): New function replacing
6461         dynamic_reloc_count.  Change all callers.
6462         (Output_segment::has_dynamic_reloc_list): New function replacing
6463         dynamic_reloc_count_list.  Change all callers.
6464         (Output_segment::set_section_addresses): Rewrite.
6465         (Output_segment::set_offset): Rewrite.
6466         (Output_segment::find_first_and_last_list): Remove.
6467         (Output_segment::set_tls_offsets): Rewrite.
6468         (Output_segment::first_section_load_address): Likewise.
6469         (Output_segment::output_section_count): Likewise.
6470         (Output_segment::section_with_lowest_load_address): Likewise.
6471         (Output_segment::write_section_headers): Likewise.
6472         (Output_segment::print_sections_to_map): Likewise.
6473         * output.h (class Output_data): Remove dynamic_reloc_count_
6474         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6475         (Output_data::add_dynamic_reloc): Rewrite.
6476         (Output_data::has_dynamic_reloc): New function.
6477         (Output_data::dynamic_reloc_count): Remove.
6478         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6479         is_last_relro_, is_first_non_relro_, is_interp_,
6480         is_dynamic_linker_section_ fields.  Add order and set_order
6481         functions.  Remove is_relro_local, set_is_relro_local,
6482         is_last_relro, set_is_last_relro, is_first_non_relro,
6483         set_is_first_non_relro functions, is_interp, set_is_interp,
6484         is_dynamic_linker_section, and set_is_dynamic_linker_section
6485         functions.
6486         (class Output_segment): Change Output_data_list from std::list to
6487         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6488         output_bss_ fields.  Update declarations.
6489
6490 2010-08-02  Ian Lance Taylor  <iant@google.com>
6491
6492         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6493         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6494         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6495
6496 2010-08-02  Ian Lance Taylor  <iant@google.com>
6497
6498         PR 11855
6499         * script.cc (Script_options::Script_options): Initialize
6500         symbol_definitions_ and symbol_references_.
6501         (Script_options::add_symbol_assignment): Update
6502         symbol_definitions_ and symbol_references_.
6503         (Script_options::add_symbol_reference): New function.
6504         (script_symbol): New function.
6505         * script.h (class Script_options): Add symbol_definitions_ and
6506         symbol_references_ fields.
6507         (Script_options::referenced_const_iterator): New type.
6508         (Script_options::referenced_begin): New function.
6509         (Script_options::referenced_end): New function.
6510         (Script_options::is_referenced): New function.
6511         (Script_options::any_unreferenced): New function.
6512         * script-c.h (script_symbol): Declare.
6513         * yyscript.y (exp): Call script_symbol.
6514         * symtab.cc: Include "script.h".
6515         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6516         Change all callers.  Check symbols referenced by scripts.
6517         (Symbol_table::add_undefined_symbols_from_command_line): Add
6518         layout parameter.  Change all callers.
6519         (Symbol_table::do_add_undefined_symbols_from_command_line):
6520         Likewise.  Break out loop body.  Check symbols referenced by
6521         scripts.
6522         (Symbol_table::add_undefined_symbol_from_command_line): New
6523         function broken out of
6524         do_add_undefined_symbols_from_command_line.
6525         * symtab.h (class Symbol_table): Update declarations.
6526         * archive.cc: Include "layout.h".
6527         (Archive::should_include_member): Add layout parameter.  Change
6528         all callers.  Check for symbol mentioned in expression.
6529         * archive.h (class Archive): Update declaration.
6530         * object.cc (Sized_relobj::do_should_include_member): Add layout
6531         parameter.
6532         * object.h (Object::should_include_member): Add layout parameter.
6533         Change all callers.
6534         (Object::do_should_include_member): Add layout parameter.
6535         (class Sized_relobj): Update declaration.
6536         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6537         parameter.
6538         * dynobj.h (class Sized_dynobj): Update declaration.
6539         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6540         layout parameter.
6541         * plugin.h (class Sized_pluginobj): Update declaration.
6542
6543 2010-08-02  Ian Lance Taylor  <iant@google.com>
6544
6545         PR 11866
6546         * output.cc (Output_segment::set_offset): Search for the first and
6547         last sections rather than assuming that the list is in order.
6548         (Output_segment::find_first_and_last_list): New function.
6549         * output.h (class Output_segment): Update declarations.
6550         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6551         (relro_strip_test_SOURCES): New variable.
6552         (relro_strip_test_DEPENDENCIES): New variable.
6553         (relro_strip_test_LDFLAGS): New variable.
6554         (relro_strip_test_LDADD): New variable.
6555         (relro_strip_test.so): New target.
6556
6557 2010-08-02  Ian Lance Taylor  <iant@google.com>
6558
6559         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6560         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6561         (Target_i386::got_tlsdesc_section): New function.
6562         (Target_i386::got_section): Create space for GOT entries for
6563         TLSDESC relocations.
6564         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6565         R_386_TLS_GOTDESC.
6566         (Target_i386::Scan::global): Likewise.
6567         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6568         using TLSDESC GOT.
6569         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6570         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6571         (Target_x86_64::got_tlsdesc_section): New function.
6572         (Target_x86_64::got_section): Create space for GOT entries for
6573         TLSDESC relocations.
6574         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6575         R_386_TLS_GOTDESC.
6576         (Target_x86_64::Scan::global): Likewise.
6577         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6578         using TLSDESC GOT.
6579
6580 2010-08-02  Ian Lance Taylor  <iant@google.com>
6581
6582         * testsuite/final_layout.sh: Use dc to convert from hex to
6583         decimal.
6584
6585 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6586
6587         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6588         paramter to the call to gold::gc_process_relocs.
6589         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6590         paramter to the call to gold::gc_process_relocs.
6591         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6592         parameter to the call to gold::gc_process_relocs.
6593         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6594         template parameter to the call to gold::gc_process_relocs.
6595         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6596         paramter to the call to gold::gc_process_relocs.
6597         * gc.h (get_embedded_addend_size): New function.
6598         (gc_process_relocs): Save the size of the reloc for use by ICF.
6599         * icf.cc (get_section_contents): Get the addend from the text section
6600         for SHT_REL relocation sections.
6601         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6602         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6603         * int_encoding.h (read_from_pointer): New overloaded function.
6604         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6605         * testsuite/icf_sht_rel_addend_test.sh: New file.
6606         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6607         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6608
6609 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6610
6611         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6612         * Makefile.in: Regenerate.
6613         * testsuite/Makefile.in: Regenerate.
6614
6615 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6616
6617         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6618         * gold/testsuite/debug_msg.cc: Likewise.
6619         * gold/testsuite/odr_violation1.cc
6620         * gold/testsuite/odr_violation2.cc
6621
6622 2010-07-21  Cary Coutant  <ccoutant@google.com>
6623
6624         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6625         string, and length fields.
6626         (Output_merge_string::Merged_strings_list): New type.
6627         (Output_merge_string::Merged_strings_lists): New typedef.
6628         (Output_merge_string): Replace merged_strings_ with
6629         merged_strings_lists_.
6630         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6631         Merged_strings_list per input object and section.  Don't store pointer
6632         to the string.  Don't store length with each merged string entry.
6633         (Output_merge_string::finalize_merged_data): Loop over list of merged
6634         strings lists.  Recompute length of each merged string.
6635
6636 2010-07-15  Cary Coutant  <ccoutant@google.com>
6637
6638         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6639         here.
6640
6641 2010-07-14  Ian Lance Taylor  <iant@google.com>
6642
6643         * descriptors.cc (Descriptors::open): Report correct name in error
6644         message.
6645
6646 2010-07-13  Doug Kwan  <dougkwan@google.com>
6647
6648         * arm.cc (Arm_input_section::Arm_input_section): For a
6649         SHT_ARM_EXIDX section, always keeps the input sections.
6650         (Arm_input_section::set_exidx_section_link): New method.
6651         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6652         has_errors_ to false.
6653         (Arm_exidx_input_section::has_errors,
6654         Arm_exidx_input_section::set_has_errors): New methods.
6655         (Arm_exidx_input_section::has_errors_): New data member.
6656         (Arm_relobj::get_exidx_shndx_list): New method.
6657         (Arm_output_section::append_text_sections_to_list): Do not skip
6658         section without SHF_EXECINSTR.
6659         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6660         errors.
6661         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6662         section header.  Make error messages more verbose.  Check for
6663         a non-executable section linked to an EXIDX section.
6664         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6665         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6666         check that there is no deferred EXIDX section if we exit early.
6667         Instead of not making an EXIDX section in case of an error, make one
6668         and set the has_errors flag of it.
6669         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6670         in a relocatable link.
6671         (Target_arm::do_relax): Look for the EXIDX output section instead of
6672         assuming that it is called .ARM.exidx.
6673         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6674         section list.  Do not check for SHF_EXECINSTR section flags but
6675         skip any input section with errors.
6676         * output.cc (Output_section::Output_section): Initialize
6677         always_keeps_input_sections_ to false.
6678         (Output_section::add_input_section): Check for
6679         always_keeps_input_sections_.
6680         *  output.h (Output_section::always_keeps_input_sections,
6681         Output_section::set_always_keeps_input_sections): New methods.
6682         (Output_section::always_keeps_input_sections): New data member.
6683
6684 2010-07-13  Rafael Espindola  <espindola@google.com>
6685
6686         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6687         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6688
6689 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6690             Ian Lance Taylor  <iant@google.com>
6691
6692         * output.h (Output_section_lookup_maps::add_merge_section):
6693         Correct check of whether value was inserted.
6694         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6695         (Output_section_lookup_maps::add_relaxed_input_section):
6696         Likewise.
6697         * arm.cc (Target_arm::got_section): Remove used local os.
6698         * i386.cc (Target_i386::got_section): Likewise.
6699         * x86_64.cc (Target_x86_64::got_section): Likewise.
6700         * sparc.cc (Target_sparc::got_section): Likewise.
6701         (Target_sparc::relocate): Remove unused local have_got_offset.
6702         * powerpc.cc (Target_powerpc::relocate): Likewise.
6703
6704 2010-07-13  Ian Lance Taylor  <iant@google.com>
6705
6706         * compressed_output.cc (zlib_decompress): Fix signature in
6707         !HAVE_ZLIB_H case.
6708
6709         * archive.cc (Archive::include_member): Unlock an external member
6710         of a thin archive.  Don't bother to delete an object we know is
6711         NULL.
6712
6713 2010-07-12  Cary Coutant  <ccoutant@google.com>
6714
6715         * compressed_output.cc (zlib_decompress): New function.
6716         (get_uncompressed_size): New function.
6717         (decompress_input_section): New function.
6718         * compressed_output.h (get_uncompressed_size): New function.
6719         (decompress_input_section): New function.
6720         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6721         Handle compressed debug sections.
6722         * layout.cc (is_compressed_debug_section): New function.
6723         (Layout::output_section_name): Map compressed section names to
6724         canonical names.
6725         * layout.h (is_compressed_debug_section): New function.
6726         (is_debug_info_section): Recognize compressed debug sections.
6727         * merge.cc: Include compressed_output.h.
6728         (Output_merge_data::do_add_input_section): Handle compressed
6729         debug sections.
6730         (Output_merge_string::do_add_input_section): Handle compressed
6731         debug sections.
6732         * object.cc: Include compressed_output.h.
6733         (Sized_relobj::Sized_relobj): Initialize new data members.
6734         (build_compressed_section_map): New function.
6735         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6736         * object.h (Object::section_is_compressed): New method.
6737         (Object::do_section_is_compressed): New method.
6738         (Sized_relobj::Compressed_section_map): New type.
6739         (Sized_relobj::do_section_is_compressed): New method.
6740         (Sized_relobj::compressed_sections_): New data member.
6741         * output.cc (Output_section::add_input_section): Handle compressed
6742         debug sections.
6743         * reloc.cc: Include compressed_output.h.
6744         (Sized_relobj::write_sections): Handle compressed debug sections.
6745
6746 2010-07-08  Cary Coutant  <ccoutant@google.com>
6747
6748         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6749         weak when resolving to a dynamic def.
6750         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6751         for weak undef/dynamic def cases. Adjust callers.
6752         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6753         undef_binding_weak_.
6754         (Symbol_table::sized_write_globals): Adjust symbol binding.
6755         (Symbol_table::sized_write_symbol): Add binding parameter.
6756         * symtab.h (Symbol::set_undef_binding): New method.
6757         (Symbol::is_undef_binding_weak): New method.
6758         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6759         (Symbol_table::should_override): Add new parameter.
6760         (Symbol_table::sized_write_symbol): Add new parameter.
6761
6762         * testsuite/weak_undef_file1.cc: Add new test case.
6763         * testsuite/weak_undef_file2.cc: Fix header comment.
6764         * testsuite/weak_undef_test.cc: Add new test case.
6765
6766 2010-06-29  Doug Kwan  <dougkwan@google.com>
6767
6768         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6769         Initialize USE_SYMBOL_.
6770         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6771         definition.
6772         (Arm_reloc_property::uses_symbol_): New data member declaration.
6773         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6774         uses symbol value and symbol is undefined but not weakly undefined.
6775
6776 2010-06-28  Rafael Espindola  <espindola@google.com>
6777
6778         * plugin.cc (Plugin::load): Use dlerror.
6779
6780 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6781
6782         * symtab.cc (detect_odr_violations): When reporting an ODR
6783         violation, report an object where the symbol is defined.
6784
6785 2010-06-25  Doug Kwan  <dougkwan@google.com>
6786
6787         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6788         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6789         definition.
6790         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6791         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6792         target hook to detect function points.
6793         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6794         * icf.h (Icf::check_section_for_function_pointers): Change type of
6795         parameter SECTION_NAME to const reference to std::string.  Use
6796         target hook to determine if section may have unsafe pointers.
6797         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6798         method definition.
6799
6800 2010-06-21  Rafael Espindola  <espindola@google.com>
6801
6802         * fileread.cc (Input_file::find_fie): New
6803         (Input_file::open): Use Input_file::find_fie.
6804         * fileread.h (Input_file::find_fie): New
6805         * plugin.cc (set_extra_library_path): New.
6806         (Plugin::load): Add set_extra_library_path to the transfer vector.
6807         (Plugin_manager::set_extra_library_path): New.
6808         (Plugin_manager::add_input_file): Use the extra search path if set.
6809         (set_extra_library_path(): New.
6810         * plugin.h (Plugin_manager): Add set_extra_library_path and
6811         extra_search_path_.
6812
6813 2010-06-19  Cary Coutant  <ccoutant@google.com>
6814
6815         * layout.cc (gdb_sections): Add .debug_types.
6816         (lines_only_debug_sections): Likewise.
6817
6818 2010-06-18  Rafael Espindola  <espindola@google.com>
6819
6820         * plugin.cc (add_input_file,add_input_library)
6821         (Plugin_manager::add_input_file): Make filename arguments const.
6822         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6823         const.
6824
6825 2010-06-16  Doug Kwan  <dougkwan@google.com>
6826
6827         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6828         .ARM.attributes section if we have not merged any input
6829         attributes sections.
6830
6831 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6832
6833         * arm.cc: Allow combining objects with no EABI version
6834         information.
6835
6836 2010-06-15  Rafael Espindola  <espindola@google.com>
6837
6838         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6839
6840 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6841
6842         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6843         (struct iovec): Correct !HAVE_READV definition.
6844
6845 2010-06-10  Cary Coutant  <ccoutant@google.com>
6846
6847         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6848         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6849         reloc sections.
6850         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6851
6852         PR 11683
6853         * symtab.h (Symbol::is_placeholder): New member function.
6854         * target-reloc.h (relocate_section): Check for placeholder symbols.
6855
6856         * testsuite/Makefile.am (plugin_test_8): New test.
6857         (plugin_test_9): New test.
6858         * testsuite/Makefile.in: Regenerate.
6859
6860 2010-06-09  Nick Clifton  <nickc@redhat.com>
6861
6862         * yyscript.y (input_list_element): Allow strings prefixed with
6863         the '-' character.  Treat these as libraries.
6864         * script.cc (script_add_library): New function.  Adds a library
6865         specified by "-l<name>" found in an input script.
6866         * script-c.h: Add prototype for script_add_library.
6867
6868 2010-06-07  Doug Kwan  <dougkwan@google.com>
6869
6870         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6871         Restrict stub-group size to be within long conditional branch
6872         range when working around cortex-A8 erratum.
6873
6874 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6875
6876         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6877         #ifdef typo.
6878
6879 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6880
6881         PR gold/11658
6882         * output.cc
6883         (Output_section::Input_section_sort_entry::compare_section_ordering):
6884         Change to return non-zero correctly.
6885         (Output_section::Input_section_sort_section_order_index_compare
6886         ::operator()): Change to fix ambiguity in comparisons.
6887
6888 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6889
6890         * gold.h (is_wildcard_string): New function.
6891         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6892         (Layout::layout_eh_frame): Ditto.
6893         (Layout::find_section_order_index): New method.
6894         (Layout::read_layout_from_file): New method.
6895         * layout.h (Layout::find_section_order_index): New method.
6896         (Layout::read_layout_from_file): New method.
6897         (Layout::input_section_position_): New private member.
6898         (Layout::input_section_glob_): New private member.
6899         * main.cc (main): Call read_layout_from_file here.
6900         * options.h (--section-ordering-file): New option.
6901         * output.cc (Output_section::input_section_order_specified_): New
6902         member.
6903         (Output_section::Output_section): Initialize new member.
6904         (Output_section::add_input_section): Add new parameter.
6905         Keep input sections when --section-ordering-file is used.
6906         (Output_section::set_final_data_size): Sort input sections when
6907         section ordering file is specified.
6908         (Output_section::Input_section_sort_entry): Add new parameter.
6909         Check sorting type.
6910         (Output_section::Input_section_sort_entry::compare_section_ordering):
6911         New method.
6912         (Output_section::Input_section_sort_compare::operator()): Change to
6913         consider section_order_index.
6914         (Output_section::Input_section_sort_init_fini_compare::operator()):
6915         Change to consider section_order_index.
6916         (Output_section::Input_section_sort_section_order_index_compare
6917         ::operator()): New method.
6918         (Output_section::sort_attached_input_sections): Change to sort
6919         according to section order when specified.
6920         (Output_section::add_input_section<32, true>): Add new parameter.
6921         (Output_section::add_input_section<64, true>): Add new parameter.
6922         (Output_section::add_input_section<32, false>): Add new parameter.
6923         (Output_section::add_input_section<64, false>): Add new parameter.
6924         * output.h (Output_section::add_input_section): Add new parameter.
6925         (Output_section::input_section_order_specified): New
6926         method.
6927         (Output_section::set_input_section_order_specified): New method.
6928         (Input_section::Input_section): Initialize section_order_index_.
6929         (Input_section::section_order_index): New method.
6930         (Input_section::set_section_order_index): New method.
6931         (Input_section::section_order_index_): New member.
6932         (Input_section::Input_section_sort_section_order_index_compare): New
6933         struct.
6934         (Output_section::input_section_order_specified_): New member.
6935         * script-sections.cc (is_wildcard_string): Delete and move modified
6936         method to gold.h.
6937         (Output_section_element_input::Output_section_element_input): Modify
6938         call to is_wildcard_string.
6939         (Output_section_element_input::Input_section_pattern
6940         ::Input_section_pattern): Ditto.
6941         (Output_section_element_input::Output_section_element_input): Ditto.
6942         * testsuite/Makefile.am (final_layout): New test case.
6943         * testsuite/Makefile.in: Regenerate.
6944         * testsuite/final_layout.cc: New file.
6945         * testsuite/final_layout.sh: New file.
6946
6947 2010-06-01  Rafael Espindola  <espindola@google.com>
6948
6949         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6950
6951 2010-06-01  Rafael Espindola  <espindola@google.com>
6952
6953         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6954         visibility of symbols.
6955
6956 2010-05-27  Doug Kwan  <dougkwan@google.com>
6957
6958         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6959         from start of output section instead of address for a local symbol
6960         in a merged or relaxed section when doing a relocatable link.
6961
6962 2010-05-26  Rafael Espindola  <espindola@google.com>
6963
6964         PR 11604
6965         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6966         adding sections the garbage collector removed.
6967         * gold/testsuite/Makefile.am: Add test.
6968         * gold/testsuite/Makefile.in: Regenerate.
6969         * gold/testsuite/plugin_test_7.sh: New.
6970         * gold/testsuite/plugin_test_7_1.c: New.
6971         * gold/testsuite/plugin_test_7_2.c: New.
6972
6973 2010-05-26  Rafael Espindola  <espindola@google.com>
6974
6975         * script-sections.cc (Output_section_definition::set_section_addresses):
6976         Check for --section-start.
6977
6978 2010-05-26  Doug Kwan  <dougkwan@google.com>
6979
6980         * arm.cc (Arm_scan_relocatable_relocs): New class.
6981         (Target_arm::relocate_special_relocatable): New method.
6982         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6983         (Arm_relocate_functions::thumb_branch_common): Same.
6984         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6985         instead of Default_scan_relocatable_relocs.
6986         * target-reloc.h (relocate_for_relocatable): Let target handle
6987         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6988         * target.h (Sized_target::relocate_special_relocatable): New method.
6989
6990 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6991
6992         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6993
6994 2010-05-23  Doug Kwan  <dougkwan@google.com>
6995
6996         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6997         instead of a cast.
6998         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6999         with a direct branch, not a conditional branch, to a stub.
7000         * merge.cc (Output_merge_base::record_input_section): New method
7001         defintion.
7002         (Output_merge_data::do_add_input_section): Record input section if
7003         keeps-input-sections flag is set.
7004         (Output_merge_string::do_add_input_section): Ditto.
7005         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7006         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7007         INPUT_SECTIONS_.
7008         (Output_merge_base::keeps_input_sections,
7009         Output_merge_base::set_keeps_input_sections,
7010         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7011         method definitions.
7012         (Output_merge_base::Input_sections): New type declaration.
7013         (Output_merge_base::input_sections_begin,
7014         Output_merge_base::input_sections_end,
7015         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7016         (Output_merge_base::bool keeps_input_sections_,
7017         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7018         Output_merge_base::input_sections_): New data members.
7019         (Output_merge_data::do_set_keeps_input_sections): New method
7020         defintion.
7021         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7022         * output.cc (Output_section::Input_section::relobj): Move method
7023         defintion from class declaration to here and handle merge sections.
7024         (Output_section::Input_section::shndx): Ditto.
7025         (Output_section::Output_section): Remove initializations of removed
7026         data members and initialize new data member LOOKUP_MAPS_.
7027         (Output_section::add_input_section): Set keeps-input-sections flag
7028         for a newly created merge output section as appropriate.  Adjust code
7029         to use Output_section_lookup_maps class.
7030         (Output_section::add_relaxed_input_section): Adjst code for lookup
7031         maps code refactoring.
7032         (Output_section::add_merge_input_section): Add a new parameter
7033         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7034         class.  If adding input section to a newly created merge output
7035         section fails, remove the new merge section.
7036         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7037         Adjust code for use of the Output_section_lookup_maps class.
7038         (Output_section::find_merge_section): Ditto.
7039         (Output_section::build_lookup_maps): New method defintion.
7040         (Output_section::find_relaxed_input_section): Adjust code to use
7041         Output_section_lookup_maps class.
7042         (Output_section::get_input_sections): Export merge sections.  Adjust
7043         code to use Output_section_lookup_maps class.
7044         (Output_section:::add_script_input_section): Adjust code to use
7045         Output_section_lookup_maps class.  Update lookup maps for merge
7046         sections also.
7047         (Output_section::discard_states): Use Output_section_lookup_maps.
7048         (Output_section::restore_states): Same.
7049         * output.h (Merge_section_properties): Move class defintion out of
7050         Output_section.
7051         (Output_section_lookup_maps): New class.
7052         (Output_section::Input_section::is_merge_section): New method
7053         defintion.
7054         (Output_section::Input_section::relobj): Move defintion out of class
7055         defintion.  Declare method only.
7056         (Output_section::Input_section::shndx): Ditto.
7057         (Output_section::Input_section::output_merge_base): New method defintion.
7058         (Output_section::Input_section::u2_.pomb): New union field.
7059         (Output_section::Merge_section_by_properties_map,
7060         Output_section::Output_section_data_by_input_section_map,
7061         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7062         Remove types.
7063         (Output_section::add_merge_input_section): Add new parameter
7064         KEEPS_INPUT_SECTIONS.
7065         (Output_section::build_lookup_maps): New method declaration.
7066         (Output_section::merge_section_map_,
7067         Output_section::merge_section_by_properties_map_,
7068         Output_section::relaxed_input_section_map_,
7069         Output_section::is_relaxed_input_section_map_valid_): Remove data
7070         members.
7071         (Output_section::lookup_maps_): New data member.
7072
7073 2010-05-21  Doug Kwan  <dougkwan@google.com>
7074
7075         PR gold/11619
7076         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7077         avoid a compilation error.
7078
7079 2010-05-19  Rafael Espindola  <espindola@google.com>
7080
7081         * script-sections.cc (Output_section_definition::allocate_to_segment):
7082         Update the phdrs_list even when the output section is NULL.
7083         * testsuite/Makefile.am: Add test.
7084         * testsuite/Makefile.in: Regenerate.
7085         * testsuite/script_test_9.cc: New.
7086         * testsuite/script_test_9.sh: New.
7087         * testsuite/script_test_9.t: New.
7088
7089 2010-05-19  Doug Kwan  <dougkwan@google.com>
7090
7091         * arm.cc (Arm_input_section::original_size): New method.
7092         (Arm_input_section::do_addralign): Add a cast.
7093         (Arm_input_section::do_output_offset): Remove static cast.
7094         (Arm_input_section::original_addralign,
7095          Arm_input_section::original_size_): Change type to uint32_t.
7096         (Arm_input_section::init): Add safe casts for section alignment
7097         and size.
7098         (Arm_input_section::set_final_data_size): Do not set address and
7099         offset of stub table.
7100         (Arm_output_section::fix_exidx_coverage): Change use of of
7101         Output_section::Simple_input_section to that of
7102         Output_section::Input_section.
7103         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7104         except for the first pass.
7105         * output.cc (Output_section::get_input_sections): Change type of
7106         input_sections to std::list<Input_section>.
7107         (Output_section::add_script_input_section): Rename from
7108         Output_section::add_simple_input_section.  Change type of SIS
7109         parameter from Simple_input_section to Input_section.
7110         * output.h (Output_section::Simple_input_section): Remove class.
7111         (Output_section::Input_section): Change class visibility to public.
7112         (Output_section::Input_section::addralign): Use stored alignments
7113         for special input sections if set.
7114         (Output_section::Input_section::set_addralign): New method.
7115         (Output_section::get_input_sections): Change parameter type from
7116         list of Simple_input_section to list of Input_section.
7117         (Output_section::add_script_input_section): Rename from
7118         Output_section::add_simple_input_section. Change first parameter's
7119         type from Simple_input_section to Input_section and remove the
7120         second and third parameters.
7121         * script-sections.cc (Input_section::Input_section_list): Change
7122         type to list of Output_section::Input_section/
7123         (Input_section_info::Input_section_info): Change parameter type of
7124         INPUT_SECTION to Output_section::Input_section.
7125         (Input_section_info::input_section): Change return type.
7126         (Input_section_info::input_section_): Change type to
7127         Output_section::Input_section.
7128         (Output_section_element_input::set_section_addresses): Adjust code
7129         to use Output_section::Input_section instead of
7130         Output_section::Simple_input_section.  Adjust code for renaming
7131         of Output_section::add_simple_input_section.
7132         (Orphan_output_section::set_section_addresses): Ditto.
7133
7134 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7135
7136         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7137         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7138
7139 2010-05-18  Rafael Espindola  <espindola@google.com>
7140
7141         * options.cc (General_options::finalize): Handle -nostdlib.
7142         * options.h (nostdlib): New option.
7143         * script.cc (script_add_search_dir): Handle -nostdlib.
7144
7145 2010-05-12  Doug Kwan  <dougkwan@google.com>
7146
7147         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7148         attributes section only if there no attributes section after merging.
7149         (Target_arm::merge_object_attributes): Move value of
7150         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7151         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7152         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7153         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7154         and arm_attr_merge_7.stdout.
7155         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7156         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7157         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7158         arm_attr_merge_7b.o): New rules.
7159         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7160         arm_attr_merge_7
7161         * testsuite/Makefile.in: Regenerate.
7162         * testsuite/arm_attr_merge.sh: New file.
7163         * testsuite/arm_attr_merge_[67][ab].s: Same.
7164
7165 2010-05-05  Nick Clifton  <nickc@redhat.com>
7166
7167         * po/es.po: Updated Spanish translation.
7168
7169 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7170
7171         * Makefile.am (install-exec-local): Properly install gold as
7172         default cross linker.
7173         * Makefile.in: Regenerated.
7174
7175 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7176             Nick Clifton  <nickc@redhat.com>
7177
7178         * configure.ac (install_as_default): Define and set to false
7179         unless --enable-gold or --enable-gold=both/gold has been
7180         specified.
7181         * configure: Regenerate.
7182
7183         * Makefile.am (install-exec-local): Install the executable as
7184         'ld.gold'.  If install_as_default is true then also install it as
7185         'ld'.
7186         * Makefile.in: Regenerated.
7187
7188 2010-04-24  Ian Lance Taylor  <iant@google.com>
7189
7190         * layout.cc (Layout::layout_reloc): In relocatable link don't
7191         combine reloc sections for grouped sections.
7192
7193 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7194
7195         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7196         sections that are not ordinary to icf.
7197         * icf.cc (get_section_contents): Handle relocation pointing to section
7198         with no object or shndx information.
7199         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7200         * testsuite/Makefile.in: Regenerate.
7201         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7202         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7203
7204 2010-04-22  Ian Lance Taylor  <iant@google.com>
7205
7206         * expression.cc (Expression::Expression_eval_info): Add
7207         result_alignment_pointer field.
7208         (Expression::eval_with_dot): Add result_alignment_pointer
7209         parameter.  Change all callers.
7210         (Expression::eval_maybe_dot): Likewise.
7211         (class Binary_expression): Add alignment_pointer parameter to
7212         left_value and right_value.  Change all callers.
7213         (BINARY_EXPRESSION): Set result alignment.
7214         (class Trinary_expression): Add alignment_pointer parameter to
7215         arg2_value and arg3_value.  Change all callers.
7216         (Trinary_cond::value): Set result alignment.
7217         (Max_expression::value, Min_expression::value): Likewise.
7218         (Align_expression::value): Likewise.
7219         * script-sections.cc (class Sections_element): Add dot_alignment
7220         parameter to set_section_addresses virtual function.  Update
7221         instantiations.
7222         (class Output_section_element): Likewise.
7223         (Script_sections::create_segments): Add dot_alignment parameter.
7224         Change all callers.
7225         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7226         (Script_sections::set_phdrs_clause_addresses): Likewise.
7227         * script-sections.h: Update declarations.
7228         * script.h: Update declarations.
7229         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7230         min_p_align.
7231         * testsuite/script_test_3.t: Set large alignment.
7232         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7233         segment has expected alignment.
7234
7235 2010-04-22  Nick Clifton  <nickc@redhat.com>
7236
7237         * po/gold.pot: Updated by the Translation project.
7238         * po/vi.po: Updated Vietnamese translation.
7239
7240 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7241
7242         * testsuite/Makefile.am (check_PROGRAMS): Add
7243         icf_virtual_function_folding_test.
7244         * testsuite/Makefile.in: Regenerated.
7245
7246 2010-04-15  Andrew Haley  <aph@redhat.com>
7247
7248         * options.h (merge_exidx_entries): New option.
7249         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7250         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7251         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7252         (Target_arm::merge_exidx_entries): New function.
7253         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7254         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7255         to Arm_exidx_fixup constructor.
7256         Add new arg, merge_exidx_entries.
7257         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7258         Arm_output_section::fix_exidx_coverage.
7259
7260 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7261
7262         * icf.cc (get_section_contents): Check for preemptible functions.
7263         Ignore addend when appropriate.
7264         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7265         section folded.
7266         (add_from_relobj): Check for section folded.
7267         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7268         * symtab.h (should_add_dynsym_entry): Add new parameter.
7269         * target-reloc.h (scan_relocs): Check for section folded.
7270         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7271         Check reloc types for function pointers in shared objects.
7272         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7273         case.
7274         (icf_preemptible_functions_test): New test case.
7275         (icf_string_merge_test): New test case.
7276         * testsuite.Makefile.in: Regenerate.
7277         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7278         bar_glob.  Refactor code.
7279         * testsuite/icf_preemptible_functions_test.cc: New file.
7280         * testsuite/icf_preemptible_functions_test.sh: New file.
7281         * testsuite/icf_string_merge_test.cc: New file.
7282         * testsuite/icf_string_merge_test.sh: New file.
7283         * testsuite/icf_virtual_function_folding_test.cc: New file.
7284         * testsuite/icf_virtual_function_folding_test.sh: New file.
7285
7286 2010-04-14  Doug Kwan  <dougkwan@google.com>
7287
7288         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7289         for local symbol recounting if we remove a section due to ICF.
7290         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7291         there are no regular objects in input.
7292
7293 2010-04-13  Doug Kwan  <dougkwan@google.com>
7294
7295         * arm.cc (Arm_input_section::set_final_data_size): Compute
7296         accurate final data size instead of using current data size.
7297
7298 2010-04-09  Doug Kwan  <dougkwan@google.com>
7299
7300         * layout.cc (Layout::choose_output_section): Handle script section
7301         types.
7302         (Layout::make_output_section_for_script): Add section type parameter.
7303         Handle script section types.
7304         * layout.h (Layout::make_output_section_for_script): Add section
7305         type parameter.
7306         * output.cc (Output_section::Output_section): Initialize data member
7307         is_noload_.
7308         (Output_section::do_reset_address_and_file_offset): Do not set address
7309         to 0 if section is a NOLOAD section.
7310         * output.h (Output_section::is_noload): New method.
7311         (Output_section::set_is_noload): Ditto.
7312         (Output_section::is_noload_): New data member.
7313         * script-c.h (Script_section_type): New enum type.
7314         (struct Parser_output_section_header): Add new file section_type.
7315         * script-sections.cc (Sections_element::output_section_name): Add
7316         parameter for returning script section type.
7317         (Output_section_definition::output_section_name): Ditto.
7318         (Output_section_definition::section_type)P; New method.
7319         (Output_section_definiton::script_section_type_name): Ditto.
7320         (Output_section_definition::script_section_type_): New data member.
7321         (Output_section_definition::Output_section_definition): Initialize
7322         data member Output_section_definition::script_section_type_.
7323         (Output_section_definition::create_sections): Pass script section type
7324         to Layout::make_output_section_for_script.
7325         (Output_section_definition::output_section_name): Return script
7326         section type to caller.
7327         (Output_section_definition::set_section_address): Do not advance
7328         dot value and load address if section type is NOLOAD.  Set address
7329         of NOLOAD sections regardless of section flags.
7330         (Output_section_definition::print): Print section type if it is
7331         not SCRIPT_SECTION_TYPE_NONE.
7332         (Output_section_definition::section_type): New method.
7333         (Output_section_definition::script_section_type_name): Ditto.
7334         (Script_sections::output_section_name): Add new parameter
7335         PSECTION_TYPE for returning script section type.  Pass it to
7336         section elements.  Handle discard sections.
7337         (Sort_output_sections::operator()): Handle NOLOAD sections.
7338         * script-sections.h (Script_sections::Section_type): New enum type.
7339         (Script_sections::output_section_name): Add a new parameter for
7340         returning script section type.
7341         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7342         INFO and NOLOAD.
7343         * yyscript.y (union): Add new field SECTION_TYPE.
7344         (COPY, DSECT, INFO, NOLOAD): New tokens.
7345         (opt_address_and_section_type): Change type to output_section_header.
7346         (section_type): New non-terminal
7347         (section_header): Handle section type.
7348         (opt_address_and_section_type): Return section type value.
7349
7350 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7351
7352         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7353         * testsuite/plugin_common_test_2.c (foo): Likewise.
7354
7355 2010-04-08  Doug Kwan  <dougkwan@google.com>
7356
7357         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7358         Output_merge_data.
7359         * output.cc (Output_section::add_merge_input_section): Simplify
7360         code and return status of Output_merge_base::add_input_section.
7361         Update merge section map only if Output_merge_base::add_input_section
7362         returns true.
7363
7364 2010-04-07  Doug Kwan  <dougkwan@google.com>
7365
7366         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7367         if section is marked as containing instructions but has no mapping
7368         symbols.
7369         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7370         correct section index.
7371         (Arm_relobj::find_linked_text_section): Ditto.
7372
7373 2010-04-07  Cary Coutant  <ccoutant@google.com>
7374
7375         * archive.cc (include_member): Destroy Read_symbols_data object before
7376         releasing file.
7377         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7378         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7379         (Read_symbols_data::~Read_symbols_data) New destructor.
7380         (Section_relocs::Section_relocs) New constructor.
7381         (Section_relocs::~Section_relocs) New destructor.
7382         (Read_relocs_data::Read_relocs_data) New constructor.
7383         (Read_relocs_data::~Read_relocs_data) New destructor.
7384         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7385         pointers to NULL after deleting.
7386
7387 2010-04-07  Doug Kwan  <dougkwan@google.com>
7388
7389         * arm.cc: Replace "endianity" with "endianness" in comments.
7390         (Arm_exidx_cantunwind): Ditto.
7391         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7392         (Arm_relobj::merge_flags_and_attributes): New method.
7393         (Arm_relobj::merge_flags_and_attributes_): New data member.
7394         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7395         (Arm_relobj::scan_sections_for_stubs): Ditto.
7396         (Arm_relobj::do_read_symbols): Check to see if we really want to
7397         merge processor-specific flags and attributes.  Exit early if
7398         an object is empty except for section names and the undefined symbol.
7399         (Target_arm::do_finalize_sections): Move check for ELF format to
7400         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7401         attributes from a regular object only when we have determined that
7402         it is aapropriate.  Do not create an .ARM.attributes section in
7403         output if there is no regular input object.
7404         (Target_arm::merge_processor_specific_flags): Check
7405         --warn-mismatch before printing any error.
7406         (Target_arm::merge_object_attributes): Ditto.
7407         * gold.cc (queue_middle_tasks): Handle the case in which there is
7408         no regular object in input.
7409         * options.cc (General_options::parse_EB): New method.
7410         (General_options::parse_EL): Same.
7411         (General_options::General_options): Initialize endianness_.
7412         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7413         New options.
7414         (General_options::Endianness): New enum.
7415         (General_options::endianness): New method.
7416         (General_options::endianness_): New data member.
7417         * parameters.cc (Parameters::set_options): Check target endianness.
7418         (Parameters::set_target_once): Ditto.
7419         (Parameters::check_target_endianness): New method.
7420         (parameters_force_valid_target): If either -EL or -EB is specified,
7421         use it to define endianness of default target.
7422         * parameters.h (Parameters::check_target_endianness): New method
7423         declaration.
7424         * target.h (class Target): Change "endianity" to "endianness"
7425         in comments.
7426
7427 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7428
7429         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7430         * configure: Regenerate.
7431         * Makefile.in: Regenerate.
7432         * testsuite/Makefile.in: Regenerate.
7433
7434 2010-04-06  Cary Coutant  <ccoutant@google.com>
7435
7436         gcc PR lto/42757
7437         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7438         prevailing definitions of common symbols.
7439         * testsuite/plugin_test_6.sh: New test case.
7440         * testsuite/plugin_common_test_1.c: New test case.
7441         * testsuite/plugin_common_test_2.c: New test case.
7442         * testsuite/Makefile.am (plugin_test_6): New test case.
7443         * testsuite/Makefile.in: Regenerate.
7444
7445 2010-04-06  Nick Clifton  <nickc@redhat.com>
7446
7447         * po/vi.po: New Vietnamese translation.
7448
7449 2010-03-30  Doug Kwan  <dougkwan@google.com>
7450
7451         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7452
7453 2010-03-25  Doug Kwan  <dougkwan@google.com>
7454
7455         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7456         to avoid a conversion warning on a 32-bit host.
7457
7458 2010-03-24  Ian Lance Taylor  <iant@google.com>
7459
7460         * testsuite/script_test_3.t: Add a TLS segment.
7461         * testsuite/Makefile.am (check_PROGRAMS): Add
7462         tls_phdrs_script_test.
7463         (tls_phdrs_script_test_SOURCES): Define.
7464         (tls_phdrs_script_test_DEPENDENCIES): Define.
7465         (tls_phdrs_script_test_LDFLAGS): Define.
7466         (tls_phdrs_script_test_LDADD): Define.
7467         * testsuite/Makefile.in: Rebuild.
7468
7469 2010-03-23  Cary Coutant  <ccoutant@google.com>
7470
7471         * fileread.cc (find_or_make_view): Fix comment.
7472
7473 2010-03-23  Ian Lance Taylor  <iant@google.com>
7474
7475         * script-sections.cc (class Orphan_section_placement): Define
7476         PLACE_TLS and PLACE_TLS_BSS.
7477         (Orphan_section_placement::Orphan_section_placement): Initialize
7478         new places.
7479         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7480         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7481         (tls_script_test_SOURCES): Define.
7482         (tls_script_test_DEPENDENCIES): Define.
7483         (tls_script_test_LDFLAGS): Define.
7484         (tls_script_test_LDADD): Define.
7485         * testsuite/Makefile.in: Rebuild.
7486
7487 2010-03-22  Doug Kwan  <dougkwan@google.com>
7488
7489         * arm.cc (Arm_relocate_functions::abs8,
7490         Arm_relocate_functions::abs16): Use correct check for overflow
7491         specified in the ARM ELF specs.
7492         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7493         target of a BLX instruction specially.
7494         (Reloc_stub::stub_type_for_reloc): Ditto.
7495         (Relocate::relocate): Use symbolic names instead of numeric relocation
7496         codes to report error.
7497         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7498         workaround.
7499         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7500         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7501         thumb2_blx_out_of_range.stdout
7502         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7503         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7504         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7505         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7506         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7507         thumb2_blx_in_range, thumb2_blx_in_range.o,
7508         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7509         thumb2_blx_out_of_range.o): New rules.
7510         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7511         thumb2_blx_in_range and thumb2_blx_out_of_range.
7512         * testsuite/Makefile.in: Regenerate.
7513         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7514         * testsuite/thumb_blx_in_range.s: New file.
7515         * testsuite/thumb_blx_out_of_range.s: New file.
7516
7517 2010-03-22  Rafael Espindola  <espindola@google.com>
7518
7519         * archive.cc (Should_include): Move to archive.h.
7520         (should_include_member): Make it a member of Archive.
7521         (Lib_group): New.
7522         (Add_lib_group_symbols): New.
7523         * archive.h: Include options.h.
7524         (Archive_member): Moved from Archive.
7525         (Should_include): Moved from archive.cc.
7526         (Lib_group): New.
7527         (Add_lib_group_symbols): New.
7528         * dynobj.cc (do_should_include_member): New.
7529         * dynobj.h (do_should_include_member): New.
7530         * gold.cc (queue_initial_tasks): Update call to queue.
7531         * main.cc (main): Print lib group stats.
7532         * object.cc (do_should_include_member): New.
7533         * object.h: Include archive.h.
7534         (Object::should_include_member): New.
7535         (Object::do_should_include_member): New.
7536         (Sized_relobj::do_should_include_member): New.
7537         * options.cc (General_options::parse_start_lib): New.
7538         (General_options::parse_end_lib): New.
7539         (Input_arguments::add_file): Handle lib groups.
7540         (Input_arguments::start_group): Check we are not in a lib.
7541         (Input_arguments::start_lib): New.
7542         (Input_arguments::end_lib): New.
7543         * options.h (General_options): Add start_lib and end_lib.
7544         (Input_argument::lib_): New.
7545         (Input_argument::lib): New.
7546         (Input_argument::is_lib): New.
7547         (Input_file_lib): New.
7548         (Input_arguments::in_lib_): New.
7549         (Input_arguments::in_lib): New.
7550         (Input_arguments::start_lib): New.
7551         (Input_arguments::end_lib_): New.
7552         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7553         in unused members as preempted.
7554         (Sized_pluginobj::do_should_include_member): New.
7555         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7556         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7557         return the blocker.
7558         (Read_symbols::do_whole_lib_group): New.
7559         (Read_symbols::do_lib_group): New.
7560         (Read_symbols::do_read_symbols): Handle lib groups.
7561         (Read_symbols::get_name): Handle lib groups.
7562         * readsyms.h (Read_symbols): Add an archive member pointer.
7563         (Read_symbols::do_whole_lib_group): New.
7564         (Read_symbols::do_lib_group): New.
7565         (Read_symbols::member_): New.
7566         * script.cc (read_input_script): Update call to queue_soon.
7567
7568 2010-03-19  Doug Kwan  <dougkwan@google.com>
7569
7570         * arm.cc (Stub_table::Stub_table): Initialize new data members
7571         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7572         (Stub_table::add_reloc_stub): Assign stub offset and update
7573         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7574         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7575         New data members.
7576         (Stub_table::update_data_size_and_addralign): Use
7577         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7578         instead of going over all reloc stubs.
7579         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7580         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7581         Stringpool_template::offset_ to size of Stringpool_char.
7582         (Stringpool_template::new_key_offset): Remove code to initialize
7583         Stringpool_template::offset_.
7584         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7585         Stringpool_template::offset_ to zero.
7586
7587 2010-03-15  Doug Kwan  <dougkwan@google.com>
7588
7589         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7590         offset_.
7591         (Stringpool_template::new_key_offset): New method.
7592         (Stringpool_template::add_string): Assign offsets when adding new
7593         strings.
7594         (Stringpool_template::set_string_offsets): Do not set string offsets
7595         when not optimizing.
7596         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7597         member size_.
7598         (Chunked_vector::clear): Clear size_.
7599         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7600         (Chunked_vector::size): Return size_.
7601         (Chunked_vector::push_back): Use size_ to find insert position.
7602         (Chunked_vector::size_): New data member.
7603         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7604         (Stringpool_template::new_key_offset): New method declaration.
7605         (Stringpool_template::offset_): New data member.
7606
7607 2010-03-15   Rafael Espindola  <espindola@google.com>
7608
7609         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7610         Add_symbols' constructor.
7611         * readsyms.h (Add_symbols): Remove the input_group member.
7612
7613 2010-03-10  Ian Lance Taylor  <iant@google.com>
7614
7615         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7616         target to ask whether a reference to a symbol requires a stack
7617         split.
7618         * target.h (Target::is_call_to_non_split): New function.
7619         (Target::do_is_call_to_non_split): Declare virtual function.
7620         * target.cc: Include "symtab.h".
7621         (Target::do_is_call_to_non_split): New function.
7622         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7623
7624 2010-03-10  Cary Coutant  <ccoutant@google.com>
7625
7626         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7627         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7628         (File_read::open[2]): Add whole_file_view_ to list of views.
7629         (File_read::make_view): Remove test of whole_file_view_.
7630         (File_read::find_or_make_view): Create whole_file_view_ if
7631         necessary.
7632         (File_read::clear_views): Replace bool parameter with enum;
7633         adjust all callers.  Don't delete views with permanent data;
7634         do delete cached views and views from archives if
7635         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7636         if clearing the corresponding view.
7637         * fileread.h (File_read::Clear_views_mode): New enum.
7638         (File_read::View::is_permanent_view): New method.
7639         (File_read::clear_views): Replace bool parameter
7640         with enum; adjust all callers.
7641         * options.h (General_options): Change keep_files_mapped option;
7642         add map_whole_files.
7643         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7644         releasing the file.
7645         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7646         the file.
7647
7648 2010-03-10  David S. Miller  <davem@davemloft.net>
7649
7650         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7651
7652 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7653
7654         * icf.cc (get_section_contents): Add '@' marker after processing the
7655         merge reloc.
7656
7657 2010-03-08  Doug Kwan  <dougkwan@google.com>
7658
7659         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7660         due to a conversion warning.
7661         (Arm_relobj::update_output_local_symbol_count): Check for local
7662         symbol with unset output index.
7663
7664 2010-03-05  Ian Lance Taylor  <iant@google.com>
7665
7666         * options.h (class General_options): Add --spare-dynamic-tags.
7667         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7668         --spare-dynamic-tags.
7669
7670 2010-03-05  Ian Lance Taylor  <iant@google.com>
7671
7672         * incremental.cc: Include "libiberty.h".
7673
7674 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7675
7676         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7677         function, is_info_ member.
7678         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7679         (Versions::Versions): Update caller.
7680         (Versions::define_base_version): Likewise.
7681         (Versions::add_def): Likewise.
7682
7683 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7684
7685         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7686         (Scan::possible_function_pointer_reloc): New function.
7687         (Scan::local_reloc_may_be_function_pointer): Change to call
7688         possible_function_pointer_reloc.
7689         (Scan::global_reloc_may_be_function_pointer): Ditto.
7690         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7691         relocations in ".data.rel.ro._ZTV" section.
7692         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7693         * testsuite/icf_safe_so_test.cc: Ditto.
7694         * testsuite/icf_safe_test.cc: Ditto.
7695         * testsuite/icf_safe_test.sh: Ditto.
7696
7697 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7698             Ian Lance Taylor  <iant@google.com>
7699
7700         * target-reloc.h (relocate_section): Check the symbol table index
7701         for -1U before setting the local symbol index.
7702         (scan_relocatable_relocs): If copying the relocation, record that
7703         the local symbol is required.
7704         * object.h (Symbol_value::is_output_symtab_index_set): New
7705         function.
7706         (Symbol_value::may_be_discarded_from_output_symtab): New
7707         function.
7708         (Symbol_value::has_output_symtab_entry): New function.
7709         (Symbol_value::needs_output_symtab_entry): Remove.
7710         (Symbol_value::output_symtab_index): Make sure the symbol index is
7711         set.
7712         (Symbol_value::set_output_symtab_index): Make sure the symbol
7713         index is not set.  Make sure the new index is valid.
7714         (Symbol_value::set_must_have_output_symtab_entry): New function.
7715         (Symbol_value::has_output_dynsym_entry): New function.
7716         (Symbol_value::set_output_dynsym_index): Make sure the new index
7717         is valid.
7718         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7719         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7720         local symbol if permitted.
7721         (Sized_relobj::do_finalize_local_symbols): Call
7722         is_output_symtab_index_set rather than needs_output_symtab_entry.
7723         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7724         rather than needs_output_symtab_entry.  Call
7725         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7726         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7727         is_output_symtab_index_set rather than needs_output_symtab_entry.
7728         * testsuite/discard_locals_relocatable_test.c: New file.
7729         * testsuite/discard_locals_test.sh: Test -r.
7730         * testsuite/Makefile.am (check_DATA): Add
7731         discard_locals_relocatable_test1.syms,
7732         discard_local_relocatable_test2.syms.
7733         (MOSTLYCLEANFILES): Likewise.  Also add
7734         discard_locals_relocatable_test1.lout and
7735         discard_locals_relocatable_test2.out.
7736         (discard_locals_relocatable_test1.syms): New target.
7737         (discard_locals_relocatable_test.o): New target.
7738         (discard_locals_relocatable_test1.out): New target.
7739         (discard_locals_relocatable_test2.syms): New target.
7740         (discard_locals_relocatable_test2.out): New target.
7741         (various): Add missing ../ld-new dependencies.
7742         * testsuite/Makefile.in: Rebuild.
7743
7744 2010-03-03  Nick Clifton  <nickc@redhat.com>
7745
7746         * po/fi.po: New Finnish translation.
7747
7748 2010-03-01  Doug Kwan  <dougkwan@google.com>
7749
7750         * layout.cc (Layout::Layout): Force section types of .init_array*,
7751         .preinit_array* and .fini_array* sections.
7752         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7753         Fix check of return value of std::string::find.().
7754         (Output_section::Input_section_sort_compare::operator()): Remove
7755         comment about .init_array.
7756         (Output_section::Input_section_sort_init_fini_compare::operator()):
7757         New method.
7758         (Output_section::sort_attached_input_sections): Handle .init_array
7759         and .fini_array specially.
7760         * output.h (Output_section::Inut_section_sort_compare): Update
7761         comment.
7762         (Output_section::Input_section_sort_init_fini_compare): New struct.
7763
7764 2010-02-26  Doug Kwan  <dougkwan@google.com>
7765
7766         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7767         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7768         * testsuite/debug_msg.sh: Avoid matching source line number for
7769         use of global variable undef_int.
7770
7771 2010-02-26  Doug Kwan  <dougkwan@google.com>
7772
7773         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7774         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7775         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7776         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7777         * options.cc (General_options::General_options): Initialize member
7778         fix_v4bx_.
7779         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7780         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7781         and rm_no_fix_v4bx.stdout
7782         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7783         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7784         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7785         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7786         and arm_no_fix_v4bx.
7787         * Makefile.in: Regenerate.
7788         * testsuite/arm_fix_v4bx.s: New file.
7789         * testsuite/arm_fix_v4bx.sh: Ditto.
7790
7791 2010-02-24  Doug Kwan  <dougkwan@google.com>
7792
7793         * arm.cc (Target_arm::got_section): Make the .got section the first
7794         non RELRO section in the data segment.
7795         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7796         suffixes of section names.
7797
7798 2010-02-24  Doug Kwan  <dougkwan@google.com>
7799
7800         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7801         flags and attributes merging if an input file is a binary file.
7802         * fileread.cc (Input_file::open): Record format of original file.
7803         * fileread.h (Input_file::Format): New enum type.
7804         (Input_file::Input_file): Initialize data member format_.
7805         (Input_file::format): New method definition.
7806         (Input_file::format_):: New data member.
7807
7808 2010-02-24  Doug Kwan  <dougkwan@google.com>
7809
7810         * arm.cc (Arm_output_data_got): New class.
7811         (ARM_TCB_SIZE): New constant
7812         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7813         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7814         If user uses a script with a SECTIONS clause, issue only a warning
7815         for a misplaced EXIDX input section.  Otherwise, issue an error.
7816         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7817         garbage collection.
7818         (Target_arm::got_mode_index_entry): Handle static linking.
7819         (Target_arm::Scan::local): Ditto.
7820         (Target_arm::Scan::global): Ditto.
7821         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7822         all incorrectly implemented relocations.
7823         (Target_arm::fix_exidx_coverage): Pass layout to
7824         Arm_output_section::fix_exidx_coverage.
7825         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7826         from ".ARM.exidx." and ".ARM.extab.".
7827
7828 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7829
7830         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7831         section if it does not already exist.
7832         * attributes.cc (Attributes_section_data::Attributes_section_data):
7833         Don't crash if size is zero.
7834
7835 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7836             Ian Lance Taylor  <iant@google.com>
7837
7838         * gold.cc (queue_middle_tasks): If no input files were opened,
7839         exit.
7840         * workqueue.h (Task_function::Task_function): Assert that there is
7841         a blocker.
7842
7843 2010-02-22  Doug Kwan  <dougkwan@google.com>
7844
7845         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7846         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7847         types to avoid warnings due to different uint64_t implementations
7848         on different hosts.
7849
7850 2010-02-21  Doug Kwan  <dougkwan@google.com>
7851
7852         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7853         handling of the maximum backward branch offset.
7854         (Arm_relocate_functions::thumb_branch_common): Ditto.
7855         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7856         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7857         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7858         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7859         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7860         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7861         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7862         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7863         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7864         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7865         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7866         thumb2_bl_out_of_range.o): New rules.
7867         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7868         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7869         thumb2_bl_out_of_range
7870         * testsuite/Makefile.in: Regenerate.
7871         * testsuite/arm_bl_in_range.s: New file.
7872         * testsuite/arm_bl_out_of_range.s: Ditto.
7873         * testsuite/arm_branch_in_range.sh: Ditto.
7874         * testsuite/arm_branch_range.t: Ditto.
7875         * testsuite/thumb2_branch_range.t: Ditto.
7876         * testsuite/thumb_bl_in_range.s: Ditto.
7877         * testsuite/thumb_bl_out_of_range.s: Ditto.
7878         * testsuite/thumb_branch_range.t: Ditto.
7879
7880 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7881
7882         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7883         Add reloc offset information.
7884         * icf.cc (get_section_contents): Change iterators to point to the new
7885         vectors. Add reloc offset information to the contents.
7886         * icf.h (Icf::Sections_reachable_info): New typedef.
7887         (Icf::Sections_reachable_list): New typedef.
7888         (Icf::Offset_info): New typedef.
7889         (Icf::Reloc_info): New struct typedef.
7890         (Icf::Reloc_info_list): New typedef.
7891         (Icf::symbol_reloc_list): Delete method.
7892         (Icf::addend_reloc_list): Delete method.
7893         (Icf::section_reloc_list): Delete method.
7894         (Icf::reloc_info_list): New method.
7895         (Icf::reloc_info_list_): New member.
7896
7897 2010-02-19  Doug Kwan  <dougkwan@google.com>
7898
7899         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7900         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7901         * arm.cc (Arm_relocation_functions): New forward declaration.
7902         (Target_arm::Target_arm): Initialize new data members
7903         got_mod_index_offset_ and tls_base_symbol_defined_.
7904         (Target_arm::Relocate::relocate_tls): New method.
7905         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7906          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7907         New methods.
7908         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7909         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7910         (Target_arm::got_mod_index_offset_,
7911         Target_arm::tls_base_symbol_defined_): New data members.
7912         (Target_arm::Scan::local, Target::Scan::global,
7913         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7914         relocations.
7915
7916 2010-02-18  Doug Kwan  <dougkwan@google.com>
7917
7918         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7919         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7920         text section as a parameter becuase some broken tools may not set
7921         the link in section header.
7922         (Target_arm::has_got_section): New method.
7923         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7924         without any mapping symbol as data only.  Remove warning.
7925         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7926         link in its section header, try to discover the link by inspecting the
7927         REL31 relocation at the beginning of the section.
7928         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7929         in error message.
7930         (Target_arm::Scan::global): Treat any reference to the symbol
7931         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7932
7933 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7934
7935         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7936         (Scan::global_reloc_may_be_function_pointer): New function.
7937         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7938         (Scan::global_reloc_may_be_function_pointer): New function.
7939         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7940         (Scan::global_reloc_may_be_function_pointer): New function.
7941         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7942         (Scan::global_reloc_may_be_function_pointer): New function.
7943         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7944         (Scan::global_reloc_may_be_function_pointer): New function.
7945         (Scan::possible_function_pointer_reloc): New function.
7946         (Target_x86_64::can_check_for_function_pointers): New function.
7947         * gc.h (gc_process_relocs): Scan relocation types to determine if
7948         function pointers were taken for targets that support it.
7949         * icf.cc (Icf::find_identical_sections): Include functions for
7950         folding in safe ICF whose pointer is not taken.
7951         * icf.h (Secn_fptr_taken_set): New typedef.
7952         (fptr_section_id_): New member.
7953         (section_has_function_pointers): New function.
7954         (set_section_has_function_pointers): New function.
7955         (check_section_for_function_pointers): New function.
7956         * options.h: Fix comment for safe ICF option.
7957         * target.h (can_check_for_function_pointers): New function.
7958         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7959         Modify icf_safe_test for X86-64.
7960         * testsuite/Makefile.in: Regenerate.
7961         * testsuite/icf_safe_so_test.cc: New file.
7962         * testsuite/icf_safe_so_test.sh: New file.
7963         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7964         (main): Change to take pointer to function kept_func_3.
7965         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7966         folding is done correctly for X86-64.
7967
7968 2010-02-12  David S. Miller  <davem@davemloft.net>
7969
7970         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7971         is_symbolless parameter.
7972         (Output_reloc<SHT_REL>::is_symbolless): New.
7973         (Output_reloc<SHT_REL>::is_symbolless_): New.
7974         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7975         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7976         (Output_reloc<SHT_RELA>::is_symbolless): New.
7977         (Output_data_reloc::add_global): Handle is_symbolless.
7978         (Output_data_reloc::add_global_relative): Likewise.
7979         (Output_data_reloc::add_local): Likewise.
7980         (Output_data_reloc::add_local_relative): Likewise.
7981         (Output_data_reloc::add_symbolless_global_addend): New.
7982         (Output_data_reloc::add_symbolless_local_addend): New.
7983         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7984         is_symbolless.
7985         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7986         instead of ->is_relative_
7987         (Output_reloc::write): Likewise.
7988         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7989         (Output_reloc::write_rel): Simplify.
7990
7991         * sparc.cc (Target_sparc::Scan::local): Use
7992         ->add_symbolless_local_addend as needed.
7993         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7994         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7995         based upon relocation offset.
7996
7997 2010-02-11  Doug Kwan  <dougkwan@google.com>
7998
7999         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8000         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8001         beginning of function.
8002         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8003         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8004         parameter is_32bit in calls to should_apply_static_reloc.
8005         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8006         (check_DATA): Add arm_abs_global.stdout.
8007         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8008         arm_abs_global.stdout): New rules.
8009         (MOSTLLYCLEANFILES): Add arm_abs_global
8010         * Makefile.in: Regenerate.
8011         * testsuite/arm_abs_global.s: New file.
8012         * testsuite/arm_abs_global.sh: Ditto.
8013         * testsuite/arm_abs_lib.s: Ditto.
8014
8015 2010-02-11  Ian Lance Taylor  <iant@google.com>
8016
8017         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8018         Read_relocs task.
8019         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8020         Allocate_commons_task first.
8021         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8022         task, rather than symtab_lock_.
8023         (Gc_process_relocs::~Gc_process_relocs): New function.
8024         (Gc_process_relocs::is_runnable): Check this_blocker_.
8025         (Gc_process_relocs::locks): Use next_blocker_ rather than
8026         blocker_.
8027         (Scan_relocs::~Scan_relocs): New function.
8028         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8029         symtab_lock_.
8030         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8031         next_blocker_.
8032         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8033         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8034         constructor accordingly.
8035         (class Gc_process_relocs): Likewise.
8036         (class Scan_relocs): Likewise.
8037         * common.h (class Allocate_commons_task): Remove symtab_lock_
8038         field, and corresponding constructor parameter.
8039         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8040         symtab_lock_.
8041         (Allocate_commons_task::locks): Likewise.
8042
8043 2010-02-11  Ian Lance Taylor  <iant@google.com>
8044
8045         * gold-threads.h (class Once): Define.
8046         (class Initialize_lock): Rewrite as child of Once.
8047         * gold-threads.cc (class Once_initialize): Define.
8048         (once_pointer_control): New static variable.
8049         (once_pointer, once_arg): New static variables.
8050         (c_run_once): New static function.
8051         (Once::Once, Once::run_once, Once::internal_run): New functions.
8052         (class Initialize_lock_once): Remove.
8053         (initialize_lock_control): Remove.
8054         (initialize_lock_pointer): Remove.
8055         (initialize_lock_once): Remove.
8056         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8057         (Initialize_lock::initialize): Rewrite.
8058         (Initialize_lock::do_run_once): New function.
8059         * archive.cc (Archive::interpret_header): Only clear name if it is
8060         not already empty.
8061         * fileread.cc: Include "gold-threads.h"
8062         (file_counts_lock): New static variable.
8063         (file_counts_initialize_lock): Likewise.
8064         (File_read::release): Only increment counts when using --stats.
8065         Use a lock around the increment.
8066         * parameters.cc (class Set_parameters_target_once): Define.
8067         (set_parameters_target_once): New static variable.
8068         (Parameters::Parameters): Move here from parameters.h.
8069         (Parameters::set_target): Rewrite.
8070         (Parameters::set_target_once): New function.
8071         (Parameters::clear_target): Move here and rewrite.
8072         * parameters.h (class Parameters): Update declarations.  Add
8073         set_parameters_target_once_ field.
8074         (Parameters::Parameters): Move to parameters.cc.
8075         (Parameters::clear_target): Likewise.
8076         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8077         task.
8078         (Start_group::~Start_group): New function.
8079         (Start_group::is_runnable): New function.
8080         (Start_group::locks, Start_group::run): New functions.
8081         (Finish_group::run): Change saw_undefined to size_t.
8082         * readsyms.h (class Start_group): Define.
8083         (class Finish_group): Change saw_undefined_ field to size_t.
8084         (Finish_group::Finish_group): Remove saw_undefined and
8085         this_blocker parameters.  Change all callers.
8086         (Finish_group::set_saw_undefined): New function.
8087         (Finish_group::set_blocker): New function.
8088         * symtab.h (class Symbol_table): Change saw_undefined to return
8089         size_t.  Change saw_undefined_ field to size_t.
8090         * target-select.cc (Set_target_once::do_run_once): New function.
8091         (Target_selector::Target_selector): Initialize set_target_once_
8092         field.  Don't initialize lock_ and initialize_lock_ fields.
8093         (Target_selector::instantiate_target): Rewrite.
8094         (Target_selector::set_target): New function.
8095         * target-select.h (class Set_target_once): Define.
8096         (class Target_selector): Update declarations.  Make
8097         Set_target_once a friend.  Remove lock_ and initialize_lock_
8098         fields.  Add set_target_once_ field.
8099
8100 2010-02-10  Ian Lance Taylor  <iant@google.com>
8101
8102         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8103         queueing any tasks.
8104         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8105         (queue_middle_tasks): Add all blockers before queueing any tasks.
8106         (queue_final_tasks): Likewise.
8107         * token.h (Task_token::add_blockers): New function.
8108         * object.h (Input_objects::number_of_relobjs): New function.
8109
8110 2010-02-10  Ian Lance Taylor  <iant@google.com>
8111
8112         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8113         shared, not if not position independent.
8114         * x86_64.cc (Relocate::relocate_tls): Likewise.
8115         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8116         (tls_pie_pic_test): New target.
8117         * testsuite/Makefile.in: Rebuild.
8118
8119         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8120         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8121         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8122         * testsuite/Makefile.in: Rebuild.
8123
8124 2010-02-09  David S. Miller  <davem@davemloft.net>
8125
8126         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8127         R_SPARC_RELATIVE using ->add_local_relative().
8128         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8129
8130         * output.h (Output_data_dynamic::add_section_size): New method
8131         that takes two Output_data objects.
8132         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8133         entry param.  Handle it in initializers.
8134         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8135         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8136         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8137         arg.
8138         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8139         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8140         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8141         for dynrel_includes_plt.
8142         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8143         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8144         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8145         before .rela.plt
8146         (Target_sparc::do_finalize_sections): Update to pass true for
8147         dynrel_includes_plt.
8148         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8149         output before .rela.plt
8150         (Target_powerpc::do_finalize_sections): Update to pass true for
8151         dynrel_includes_plt when 32-bit.
8152
8153 2010-02-08  Doug Kwan  <dougkwan@google.com>
8154
8155         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8156         method.
8157         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8158         Arm_relobj::scan_section_for_cortex_a8_stubs,
8159         Arm_relobj::do_relocation_section): Instead of calling
8160         Output_section::output_address, use faster
8161         Arm_relobj::simple_input_section_output_address.
8162
8163 2010-02-08  David S. Miller  <davem@davemloft.net>
8164
8165         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8166         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8167         relocation helper function.
8168
8169         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8170         just like R_SPARC_GOT{10,13,22}.
8171         (Target_sparc::Scan::local): Likewise.
8172         (Target_sparc::Relocate:relocate): Likewise.
8173
8174 2010-02-06  Ian Lance Taylor  <iant@google.com>
8175
8176         * configure.ac: Rewrite targetobjs duplicate removal code to use
8177         only shell constructs.
8178         * configure: Rebuild.
8179
8180 2010-02-05  Doug Kwan  <dougkwan@google.com>
8181
8182         PR 11247
8183         * arm.cc (Arm_relobj::section_is_scannable): New method.
8184         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8185         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8186
8187 2010-02-04  Doug Kwan  <dougkwan@google.com>
8188
8189         PR 11247
8190         * arm-reloc-property.cc (cstdio): Include.
8191         * configure.ac (targetobjs): Remove duplicates.
8192         * configure: Regenerate.
8193         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8194         big and little endian version for a given address size.
8195
8196 2010-02-03  Doug Kwan  <dougkwan@google.com>
8197
8198         * arm-reloc-property.cc
8199         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8200         definition.
8201         * arm-reloc-property.h
8202         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8203         New method definition.
8204         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8205         declaration.
8206         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8207         overflow to N.
8208         (GOT_PREL): Change implemented to Y.
8209         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8210         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8211         (Arm_relocate_functions::movw_abs_nc): Remove method.
8212         (Arm_relocate_functions::movt_abs): Ditto.
8213         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8214         (Arm_relocate_functions::thm_movt_abs): Ditto.
8215         (Arm_relocate_functions::movw_rel_nc): Ditto.
8216         (Arm_relocate_functions::movw_rel): Ditto.
8217         (Arm_relocate_functions::movt_rel): Ditto.
8218         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8219         (Arm_relocate_functions:thm_movw_rel): Ditto.
8220         (Arm_relocate_functions:thm_movt_rel): Ditto.
8221         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8222         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8223         New method definitions.
8224         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8225         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8226         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8227         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8228         (Target_arm::Relocate::relocate): Check for non-static or
8229         unimplemented relocation code and exit early.  Change calls to
8230         Target_arm::reloc_uses_thumb_bit and
8231         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8232         instead.  Refactor code to handle similar relocations to increase
8233         code sharing.  Remove check for unsupported relocation code in switch
8234         statement.
8235         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8236         relocation property table to find out size.  Change error message to
8237         print out the name of a relocation code instead of the numeric value.
8238         (Target_arm::scan_reloc_for_stub): Use relocation property table
8239         instead of calling Target_arm::reloc_uses_thumb_bit().
8240
8241 2010-02-02  Doug Kwan  <dougkwan@google.com>
8242
8243         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8244         types of relaxed input section.
8245
8246 2010-02-02  Doug Kwan  <dougkwan@google.com>
8247
8248         * Makefile.am (HFILES): Add arm-reloc-property.h.
8249         (DEFFILES): New.
8250         (TARGETSOURCES): Add arm-reloc-property.cc
8251         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8252         (libgold_a_SOURCES): $(DEFFILES)
8253         * Makefile.in: Regenerate.
8254         * arm-reloc-property.cc: New file.
8255         * arm-reloc-property.h: New file.
8256         * arm-reloc.def: New file.
8257         * arm.cc: Update comments.
8258         (arm-reloc-property.h): New included header.
8259         (arm_reloc_property_table): New global variable.
8260         (Target_arm::do_select_as_default_target): New method definition.
8261         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8262         arm-reloc-property to targ_extra_obj.
8263         * parameters.cc (set_parameters_target): Call
8264         Target::select_as_default_target().
8265         * target.h (Target::select_as_default_target): New method definition.
8266         (Target::do_select_as_default_target): Same.
8267
8268 2010-02-01  Doug Kwan  <dougkwan@google.com>
8269
8270         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8271         first_output_text_section_.
8272         (Arm_exidx_fixup::first_output_text_section): New method definition.
8273         (Arm_exidx_fixup::first_output_text_section_): New data member.
8274         (Arm_exidx_fixup::process_exidx_section): Record the first text
8275         output section seen.
8276         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8277         and entsize in output section header.
8278
8279 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8280
8281         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8282         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8283         (Arm_relocate_functions::thm_alu11): New Method.
8284         (Arm_relocate_functions::thm_pc8): New Method.
8285         (Arm_relocate_functions::thm_pc12): New Method.
8286         (Target_arm::Scan::local): Handle the relocations.
8287         (Target_arm::Scan::global): Likewise.
8288         (Target_arm::Relocate::relocate): Likewise.
8289         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8290
8291 2010-01-29  Doug Kwan  <dougkwan@google.com>
8292
8293         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8294         of relocation types as ld.
8295
8296 2010-01-29  Doug Kwan  <dougkwan@google.com>
8297
8298         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8299         to public.
8300         (Arm_relocate_functions::thumb_branch_common): Ditto.
8301         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8302         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8303         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8304         Arm_relocate_functions::jump24): Remove.
8305         (Target_arm::Relocate::relocate): Adjust code to call
8306         Arm_relocation_functions::arm_branch_common and
8307         Arm_relocation_functions::thumb_branch_common instead of their removed
8308         wrappers.  Merge switch-cases together to reduce source code size.
8309
8310 2010-01-29  Doug Kwan  <dougkwan@google.com>
8311
8312         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8313         output_local_symbol_count_needs_update_.
8314         (Arm_relobj::output_local_symbol_count_needs_update,
8315          Arm_relobj::set_output_local_symbol_count_needs_update,
8316          Arm_relobj::update_output_local_symbol_count): New methods.
8317         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8318         member.
8319         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8320         of pointed function as in a R_ARM_PREL31 relocation.
8321         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8322         for output local symbol count updating.
8323         (Target_arm::do_relax): Update output local symbol counts in objects
8324         if necessary.
8325         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8326
8327 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8328
8329         * arm.cc: Added support for the ARM relocations:
8330         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8331         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8332         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8333         movw_prel_nc).
8334         (Arm_relocate_functions::movw_rel): New method.
8335         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8336         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8337         thm_movw_prel_nc).
8338         (Arm_relocate_functions::thm_movw_rel): New method.
8339         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8340         thm_movt_prel).
8341         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8342         relocations.
8343         (Target_arm::Scan::global): Likewise.
8344         (Target_arm::Relocate::relocate): Likewise.
8345         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8346         Likewise.
8347
8348 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8349
8350         * arm.cc: Added support for ARM group relocations.
8351         (Target_arm::reloc_needs_sym_origin): New method.
8352         (Arm_relocate_functions::calc_grp_kn): New method.
8353         (Arm_relocate_functions::calc_grp_residual): New method.
8354         (Arm_relocate_functions::calc_grp_gn): New method.
8355         (Arm_relocate_functions::arm_grp_alu): New Method.
8356         (Arm_relocate_functions::arm_grp_ldr): New Method.
8357         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8358         (Arm_relocate_functions::arm_grp_ldc): New Method.
8359         (Target_arm::Scan::local): Handle the ARM group relocations.
8360         (Target_arm::Scan::global): Likewise.
8361         (Target_arm::Relocate::relocate): Likewise.
8362         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8363         Likewise.
8364
8365 2010-01-26  Doug Kwan  <dougkwan@google.com>
8366
8367         * arm.cc (set): Include.
8368         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8369         pointer type.
8370         (Arm_output_section::Text_section_list): New type.
8371         (Arm_output_section::append_text_sections_to_list): New method.
8372         (Arm_output_section::fix_exidx_coverage): Ditto.
8373         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8374         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8375         Relobj::set_section_offset() instead of
8376         Sized_relobj::invalidate_section_offset().
8377         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8378         parameter for section headers. Ignore relocation sections for
8379         unallocated sections and EXIDX sections.
8380         (Target_arm::fix_exidx_coverage): New method.
8381         (Target_arm::output_section_address_less_than): New type.
8382         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8383         linked text section instead of the EXIDX section.
8384         (Arm_output_section::create_stub_group): Add an assertion to check
8385         that this is not an EXIDX output section.
8386         (Arm_output_section::append_text_sections_to_list): New method.
8387         (Arm_output_section::fix_exidx_coverage): Ditto.
8388         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8389         Arm_relobj::section_needs_reloc_stub_scanning.
8390         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8391         first pass.
8392         (Target_arm::fix_exidx_coverage): New method.
8393         * object.h (Relobj::set_output_section): New method.
8394         (Sized_relobj::invalidate_section_offset): Remove method.
8395         (Sized_relobj::do_invalidate_section_offset): Remove method.
8396         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8397
8398 2010-01-25  Doug Kwan  <dougkwan@google.com>
8399
8400         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8401         Fix warning due to signed and unsigned comparison on a 32-bit host.
8402
8403 2010-01-22  Doug Kwan  <dougkwan@google.com>
8404
8405         * arm.cc (Target_arm::do_relax): Record an output section for section
8406         offset adjustment it contains any stub table that has changed.
8407         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8408         offsets in an output section if necessary.
8409         * output.cc (Output_section::Output_section): Initialize
8410         section_offsets_need_adjustments_.
8411         (Output_section::add_input_section_for_script): Renamed to
8412         Output_section::add_simple_input_section.
8413         (Output_section::save_states): Add a comment.
8414         (Output_section::discard_states): New method defintion.
8415         (Output_section::adjust_section_offsets): Same.
8416         * output.h (Output_section::add_input_section_for_script): Renamed to
8417         Output_section::add_simple_input_section.
8418         (Output_section::discard_states): New method declaration.
8419         (Output_section::adjust_section_offsets): Same.
8420         (Output_section::section_offsets_need_adjustment,
8421         Output_section::set_section_offsets_need_adjustment): New method
8422         definitions.
8423         (Output_section::section_offsets_need_adjustment_): New data member.
8424         * script-sections.cc
8425         (Output_section_element_input::set_section_address): Adjust code for
8426         renaming of Output_section::add_input_section_for_script.
8427         (Orphan_output_section::set_section_address): Same.
8428
8429 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8430
8431         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8432         Fix_v4bx enum values .
8433         * gold/options.h (General_options): New option definitions.
8434         (General_options::fix_v4bx): New method.
8435         (General_options::Fix_v4bx): New enum.
8436         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8437         (General_options::parse_fix_v4bx_interworking): New method.
8438
8439 2010-01-22  Doug Kwan  <dougkwan@google.com>
8440
8441         * arm.cc (Arm_exidx_fixup): New class.
8442
8443 2010-01-21  Doug Kwan  <dougkwan@google.com>
8444
8445         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8446         classes.
8447         (Arm_exidx_section_offset_map): New type.
8448
8449 2010-01-21  Doug Kwan  <dougkwan@google.com>
8450
8451         * arm.cc (Arm_exidx_input_section): New class.
8452         (Arm_relobj::exidx_input_section_by_link,
8453         Arm_relobj::exidx_input_section_by_shndx,
8454         Arm_relobj::make_exidx_input_section): New methods.
8455         (read_arm_attributes_section): Remove.
8456         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8457         information about them.
8458         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8459         to here.
8460
8461 2010-01-20  Doug Kwan  <dougkwan@google.com>
8462
8463         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8464         Input_section_specifier to Section_id.
8465         (Target_arm::new_arm_input_section: Adjust code for change of key
8466         type.
8467         (Target_arm::find_arm_input_section): Ditto.
8468         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8469         (Section_id): Remove.
8470         (Garbage_collection::Section_id_hash): Remove.
8471         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8472         (Section_id): Remove.
8473         (Icf::Section_id_hash): Remove.
8474         * object.h (Section_id, Const_section_id, Section_id_hash,
8475         Const_section_id_hash): New type definitions.
8476         * output.cc (Output_section::add_relaxed_input_section): Change to
8477         use Const_section_id instead of Input_section_specifier as key type.
8478         (Output_section::add_merge_input_section): Ditto.
8479         (Output_section::build_relaxation_map): Change to use Section_id
8480         instead of Input_section_specifier as key type.
8481         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8482         Ditto.
8483         (Output_section::convert_input_sections_to_relaxed_sections): Change
8484         to use Const_section_id instead of Input_section_specifier as key type.
8485         (Output_section::find_merge_section): Ditto.
8486         (Output_section::find_relaxed_input_section): Ditto.
8487         * output.h (Input_section_specifier): Remove class.
8488         (Output_section::Output_section_data_by_input_section_map): Change
8489         key type to Const_section_id.
8490         (Output_section::Output_relaxed_input_section_by_input_section_map):
8491         Ditto.
8492         (Output_section::Relaxation_map): Change key type to Section_id.
8493
8494 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8495
8496         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8497         (class Arm_v4bx_stub): New class.
8498         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8499         (Stub_factory::make_arm_v4bx_stub): New method.
8500         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8501         (Stub_table::empty): Handle v4bx stubs.
8502         (Stub_table::add_arm_v4bx_stub): New method.
8503         (Stub_table::find_arm_v4bx_stub): New method.
8504         (Arm_relocate_functions::v4bx): New method.
8505         (Target_arm::fix_v4bx): New method.
8506         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8507         (Stub_table::relocate_stubs): Likewise.
8508         (Stub_table::do_write): Likewise.
8509         (Stub_table::update_data_size_and_addralign): Likewise.
8510         (Stub_table::finalize_stubs):  Likewise.
8511         (Target_arm::Scan::local): Likewise.
8512         (Target_arm::Scan::global): Likewise.
8513         (Target_arm::do_finalize_sections): Likewise.
8514         (Target_arm::Relocate::relocate): Likewise.
8515         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8516         Likewise.
8517         (Target_arm::scan_reloc_for_stub): Likewise.
8518         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8519
8520 2010-01-19  Ian Lance Taylor  <iant@google.com>
8521
8522         * output.cc (Output_section_headers::do_sized_write): Write large
8523         segment count to sh_info field.
8524         (Output_file_header::do_sized_write): For large segment count,
8525         write PN_XNUM to e_phnum field.
8526
8527 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8528
8529         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8530         (Arm_relocate_functions::thm_jump8): New function.
8531         (Arm_relocate_functions::thm_jump11): New function.
8532         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8533         R_ARM_THM_JUMP11.
8534         (Target_arm::Scan::global): Likewise.
8535         (Target_arm::Relocate::relocate): Likewise.
8536         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8537         Likewise.
8538
8539 2010-01-14  Doug Kwan  <dougkwan@google.com>
8540
8541         * arm.cc (map, utility): Include headers.
8542         (Target_arm::apply_cortex_a8_workaround): New method.
8543         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8544         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8545         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8546         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8547         the --[no-]fix-cortex-a8 command line options.
8548         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8549         (Target_arm::relocate_stub): Use addend in instruction template.
8550         * options.h (DEFINE_bool): Set the user-set flag.
8551         (General_options): Add --[no-]-fix-cortex options.
8552         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8553         : Update fast look-up map after conversion.
8554
8555 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8556
8557         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8558         in the first pass of do_layout.
8559
8560 2010-01-13  Doug Kwan  <dougkwan@google.com>
8561
8562         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8563         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8564         apparent compiler problem of not folding static constant integral
8565         data members of elfcpp::Elf_sizes<32>.
8566
8567 2010-01-13  Doug Kwan  <dougkwan@google.com>
8568
8569         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8570         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8571         Arm_relobj::scan_section_for_cortex_a8_erratum,
8572         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8573         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8574         sections to scan for relocation stubs into a new method
8575         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8576         relocation and Cortex-A8 stub scanning.
8577         (Target_arm::do_relax): Force stubs to be after stubbed sections
8578         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8579         the beginning of a new relaxation pass.  Update a comment.
8580         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8581
8582 2010-01-12  Ian Lance Taylor  <iant@google.com>
8583
8584         * target-reloc.h (visibility_error): New inline function.
8585         (relocate_section): Call visibility_error.
8586         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8587         (MOSTLYCLEANFILES): Likewise.
8588         (protected_4_pic.o, protected_3.err): New targets.
8589         * testsuite/protected_4.cc: New file.
8590
8591 2010-01-12  Doug Kwan  <dougkwan@google.com>
8592
8593         * arm.cc (Cortex_a8_reloc): New class.
8594         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8595         and cortex_a8_relocs_info_.
8596         (Target_arm::fix_cortex_a8): New method definition.
8597         (Target_arm::Cortex_a8_relocs_info): New type.
8598         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8599         New data member declarations.
8600         (Target_arm::scan_reloc_for_stub): Record information about
8601         relocations for THUMB branches that might be exempted from the
8602         Cortex-A8 workaround.
8603         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8604         at the beginning of a relaxation pass.
8605
8606 2010-01-12  Doug Kwan  <dougkwan@google.com>
8607
8608         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8609         (Arm_relobj::Mapping_symbol_position,
8610          Arm_reloj::Mapping_symbol_position_less,
8611          Arm_relobj::Mapping_symbols_info): New types.
8612         (Target_arm::is_mapping_symbol_name): New method definition.
8613         (Arm_relobj::do_count_local_symbols): Save information about mapping
8614         symbols.
8615
8616 2010-01-11  Doug Kwan  <dougkwan@google.com>
8617
8618         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8619         Arm_relocate_functions::thumb32_branch_upper,
8620         Arm_relocate_functions::thumb32_branch_lower,
8621         Arm_relocate_functions::thumb32_cond_branch_offset,
8622         Arm_relocate_functions::thumb32_cond_branch_upper,
8623         Arm_relocate_functions::thumb32_cond_branch_lower,
8624         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8625         branch offset encoding.
8626         (Arm_relocate_functions::thumb_branch_common): Use new branch
8627         offset encoding methods to avoid code duplication.
8628         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8629         (Stub_addend_reader::operator()): Use new branch encoding method
8630         to avoid code duplication.
8631
8632 2010-01-11  Doug Kwan  <dougkwan@google.com>
8633
8634         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8635         (Target_arm::do_finalize_sections): Define special EXIDX section
8636         symbols only if referenced.
8637         * gc.h (Garbage_collection::add_reference): New method.
8638         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8639         code duplication.
8640
8641 2010-01-11  Ian Lance Taylor  <iant@google.com>
8642
8643         * script.cc (Version_script_info::build_expression_list_lookup):
8644         Change complaing about duplicate wildcard match from error to
8645         warning.
8646
8647         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8648         of 2009-12-30.
8649         (Version_script_info::Version_script_info): Initialize globs_,
8650         default_version_, default_is_global_, and exact_.  Don't
8651         initialize globals_ or locals_.
8652         (Version_script_info::build_lookup_tables): Build local symbols
8653         first.
8654         (Version_script_info::unquote): New function.
8655         (Version_script_info::add_exact_match): New function.
8656         (Version_script_info::build_expression_list_lookup): Remove lookup
8657         parameter.  Add is_global parameter.  Change all callers.  Handle
8658         wildcard pattern specially.  Unquote pattern.  Call
8659         add_exact_match.
8660         (Version_script_info::get_name_to_match): New function.
8661         (Version_script_info::get_symbol_version): New function.
8662         (Version_script_info::get_symbol_version_helper): Remove.
8663         (Version_script_info::check_unmatched_names): Call unquote.
8664         * script.h (class Version_script_info): Change get_symbol_version
8665         to be non-inline and add is_global parameter; change all callers.
8666         Rewrite symbol_is_local.  Update declarations.  Define struct
8667         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8668         Remove globals_ and locals_ members.  Add exact_, globs_,
8669         default_version_, is_global_.
8670         (Version_script_info::Glob): Remove pattern, add expression and
8671         is_global.  Update constructor.  Change all callers.
8672         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8673         default version.
8674         (Versions::symbol_section_contents): If a symbol is undefined, or
8675         defined in a dynamic object, set the version index to
8676         VER_NDX_LOCAL.
8677         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8678         symbol_is_local.
8679         (Symbol_table::add_from_pluginobj): Likewise.
8680         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8681
8682 2010-01-11  Doug Kwan  <dougkwan@google.com>
8683
8684         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8685         (incremental_dump_LDADD): Add linking option for libintl.
8686         * Makefile.in: Regenerate.
8687
8688 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8689
8690         PR gold/11144
8691         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8692         instead of -Ds.
8693         * testsuite/Makefile.in: Regenerated.
8694
8695 2010-01-10  Doug Kwan  <dougkwan@google.com>
8696
8697         * options.h (DEFINE_var): Use parentheses around argument varname__
8698         in macro body to avoid any unintended subsequent substitutions.
8699
8700 2010-01-10  Ian Lance Taylor  <iant@google.com>
8701
8702         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8703         candidates before doing symbol resolution.
8704
8705         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8706         ODR candidates if only one is weak.
8707
8708 2010-01-08  Ian Lance Taylor  <iant@google.com>
8709
8710         * script.cc (Version_script_info::build_expression_list_lookup):
8711         Don't warn about ambiguous version, just record the ambiguity.
8712         (Version_script_info::get_symbol_version_helper): Give error if
8713         version is ambiguous.
8714
8715 2010-01-08  Doug Kwan  <dougkwan@google.com>
8716
8717         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8718         prev_data_size_ and prev_addralign_.  Remove initializer for
8719         deleted data member has_been_changed_.
8720         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8721         to determine if the table is empty.
8722         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8723         Remove.
8724         (Stub_table::add_reloc_stub): Define method in class definition
8725         instead of just declaring it there.
8726         (Stub_table::add_cortex_a8_stub): New method definition.
8727         (Stub_table::update_data_size_and_addralign): Ditto.
8728         (Stub_table::finalize_stubs): Ditto.
8729         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8730         (Stub_table::do_addralign_): Return address alignment in the
8731         (Stub_table::do_reset_address_and_file_offset): Define method in
8732         class definition instead of declaring it there.  Set current data
8733         size to be the data size of the previous pass.
8734         (Stub_table::set_final_data_size): Use current data size as the
8735         final data size.
8736         (Stub_table::relocate_stub): Change parameter type of stub from
8737         Reloc_stub pointer to Stub pointer.
8738         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8739         (Stub_table::Cortex_a8_stub_list): New typedef.
8740         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8741          Stub_table::prev_addralign_): New data member.
8742         (Arm_relobj::Arm_relobj): Initialize data member
8743         section_has_cortex_a8_workaround_.
8744         (Arm_relobj::section_has_cortex_a8_workaround,
8745          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8746          definitions.
8747         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8748         declarations.
8749         (Target_arm::relocate_stub): Change parameter type of stub from
8750         Reloc_stub pointer to Stub pointer.
8751         (Insn_template::size, Insn_template::alignment): Handle
8752         THUMB16_SPECIAL_TYPE.
8753         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8754          Stub_table::update_data_size_and_addralign,
8755          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8756         definitions.
8757         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8758         (Stub_table::do_write): Ditto.
8759         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8760
8761 2010-01-08  Ian Lance Taylor  <iant@google.com>
8762
8763         PR 11108
8764         * symtab.h (class Symbol): Remove fields is_target_special_ and
8765         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8766         (Symbol::is_defined_in_discarded_section): New function.
8767         (Symbol::set_is_defined_in_discarded_section): New function.
8768         (Symbol::has_plt_offset): Rewrite.
8769         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8770         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8771         Don't initialize is_target_special_ or has_plt_offset_.
8772         Initialize is_defined_in_discarded_section_.
8773         (Symbol_table::add_from_relobj): If appropriate, set
8774         is_defined_in_discarded_section.
8775         * resolve.cc (Symbol::override_base_with_special): Don't test
8776         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8777         * target-reloc.h (relocate_section): Do special handling for
8778         symbols defined in discarded sections for global symbols as well
8779         as local symbols.
8780
8781 2010-01-08  Ian Lance Taylor  <iant@google.com>
8782
8783         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8784         the SHT_SYMTAB case.
8785
8786 2010-01-08  Ian Lance Taylor  <iant@google.com>
8787
8788         * object.cc (Sized_relobj::do_layout): Don't get confused if
8789         layout_eh_frame returns NULL.
8790
8791 2010-01-08  Ian Lance Taylor  <iant@google.com>
8792
8793         PR 11084
8794         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8795         dynamic symbol table, use the normal symbol table.
8796         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8797         symbol table.
8798
8799 2010-01-08  Ian Lance Taylor  <iant@google.com>
8800
8801         PR 11072
8802         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8803         sections.
8804
8805 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8806
8807         * version.cc (print_version): Change to "Copyright 2010".
8808
8809 2010-01-08  Ian Lance Taylor  <iant@google.com>
8810
8811         PR 10287
8812         PR 11063
8813         * i386.cc (class Target_i386): Change return type of plt_section
8814         to be non-const.
8815         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8816         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8817         tls_desc_rel_ field.
8818         (Output_data_plt_i386::rel_tls_desc): New function.
8819         (Target_i386::rel_tls_desc_section): New function.
8820         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8821         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8822         R_386_TLS_DESC reloc in rel_tls_desc_section.
8823         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8824         Define struct Tlsdesc_info.
8825         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8826         (Target_x86_64::do_reloc_symbol_index): New function.
8827         (Target_x86_64::add_tlsdesc_info): New function.
8828         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8829         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8830         tlsdesc_rel_ field.
8831         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8832         all callers.
8833         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8834         (Target_x86_64::rela_tlsdesc_section): New function.
8835         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8836         handling.
8837         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8838         (Target_x86_64::do_reloc_addend): New function.
8839         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8840         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8841         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8842         (Output_reloc::type): New function.
8843         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8844         (Output_reloc::is_target_specific): New function.
8845         (Output_reloc::target_arg): New function.
8846         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8847         absolute relocs and target specific relocs.
8848         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8849         add_target_specific.
8850         (class Output_data_reloc) [SHT_RELA]: Likewise.
8851         * output.cc (Output_reloc::Output_reloc): Add four new versions
8852         for absolute relocs and target specific relocs.
8853         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8854         (Output_reloc::get_symbol_index): Likewise.
8855         (Output_reloc::local_section_offset): Check that local_sym_index_
8856         is not TARGET_CODE or 0.
8857         (Output_reloc::symbol_value): Likewise.
8858         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8859         reloc.
8860         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8861         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8862         functions.
8863         * layout.cc (add_target_dynamic_tags): Use output section for
8864         DT_PLTRELSZ and DT_JMPREL.
8865
8866 2010-01-07  Ian Lance Taylor  <iant@google.com>
8867
8868         PR 11061
8869         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8870         function.
8871         (class Output_data_reloc_generic): Define.
8872         (class Output_data_reloc_base): Change base class to
8873         Output_data_reloc_generic.  Change add() method to call
8874         bump_relative_reloc_count for a relative reloc.  Remove
8875         sort_relocs_ field.
8876         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8877         to sort_relocs().
8878         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8879         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8880         appropriate.
8881         * layout.h (class Layout): Update declaration.
8882
8883 2010-01-07  Ian Lance Taylor  <iant@google.com>
8884
8885         * output.h (class Output_data): Add const version of
8886         output_section and do_output_section.
8887         (class Output_section_data): Add const version of
8888         do_output_section.
8889         (class Output_section): Likewise.
8890         * layout.cc (Layout::add_target_dynamic_tags): New function.
8891         * layout.h (class Layout): Update declarations.
8892         * arm.cc (Target_arm::do_finalize_sections): Use
8893         add_target_dynamic_tags.
8894         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8895         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8896         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8897         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8898
8899 2010-01-07  Ian Lance Taylor  <iant@google.com>
8900
8901         PR 11042
8902         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8903         object as needed.
8904
8905 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8906             Ian Lance Taylor  <iant@google.com>
8907
8908         PR 11019
8909         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8910         Xindex::read_symtab_xindex.
8911
8912 2010-01-07  Doug Kwan  <dougkwan@google.com>
8913
8914         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8915         (Insn_template::thumb16_bcond_insn): New method declaration.
8916         (Insn_template): Fix spelling.
8917         (Stub::thumb16_special): New method declaration.
8918         (Stub::do_write): Define virtual method which was previously pure
8919         virtual.
8920         (Stub::do_thumb16_special): New method declaration.
8921         (Stub::do_fixed_endian_write): New template member.
8922         (Reloc_stub::do_write): Remove.
8923         (Reloc_stub::do_fixed_endian_write): Remove.
8924         (Cortex_a8_stub): New class definition.
8925         (Stub_factory::make_cortex_a8_stub): New method definition.
8926         (Stub_factory::Stub_factory): Add missing static storage class
8927         qualifier for elf32_arm_stub_a8_veneer_blx.
8928
8929 2010-01-07  Ian Lance Taylor  <iant@google.com>
8930
8931         PR 10980
8932         * options.h (class General_options): Add --warn-unresolved-symbols
8933         and --error-unresolved-symbols.
8934         * errors.cc (Errors::undefined_symbol): Implement
8935         --warn-unresolved-symbols.
8936
8937         * options.h (class General_options): Add -z text and -z textoff.
8938         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8939
8940 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8941
8942         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8943         (Garbage_collection::cident_sections): New function.
8944         (Garbage_collection::add_cident_section): New function.
8945         (Garbage_collection::cident_sections_): New member.
8946         (gc_process_relocs): Add references to sections whose names are C
8947         identifiers.
8948         * gold.h (cident_section_start_prefix): New constant.
8949         (cident_section_stop_prefix): New constant.
8950         (is_cident): New function.
8951         * layout.cc (Layout::define_section_symbols): Replace string constants
8952         with the newly defined constants.
8953         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8954         C identifiers.
8955         * testsuite/Makefile.am: Add gc_orphan_section_test.
8956         * testsuite/Makefile.in: Regenerate.
8957         * testsuite/gc_orphan_section_test.cc: New file.
8958         * testsuite/gc_orphan_section_test.sh: New file.
8959
8960 2010-01-06  Ian Lance Taylor  <iant@google.com>
8961
8962         PR 10980
8963         * options.h (class General_options): Add --warn-shared-textrel.
8964         * layout.cc (Layout::finish_dynamic_section): Implement
8965         --warn-shared-textrel.
8966
8967         PR 10980
8968         * options.h (class General_options): Add --warn-multiple-gp.
8969
8970 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8971
8972         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8973         $(THREADSLIB) and $(LIBDL).
8974         * Makefile.in: Rebuild.
8975
8976 2010-01-06  Ian Lance Taylor  <iant@google.com>
8977
8978         PR 10980
8979         * options.cc (General_options::parse_section_start): New function.
8980         (General_options::section_start): New function.
8981         (General_options::General_options): Initialize all members.
8982         * options.h: Include <map>
8983         (class General_options): Add --section-start.  Add section_starts_
8984         member.
8985         * layout.cc (Layout::attach_allocated_section_to_segment): If
8986         --section-start was used, set the address of the segment.  Remove
8987         local sort_sections.
8988         (Layout::relaxation_loop_body): If the address of the load segment
8989         has been set by --section-start, don't use it.
8990         * output.h (Output_segment::update_flags_for_output_section): New
8991         function.
8992         * output.cc (Output_segment::add_output_section): Call
8993         update_flags_for_output_section.
8994
8995 2010-01-05  Ian Lance Taylor  <iant@google.com>
8996
8997         PR 10980
8998         * options.h (class General_options): Add --undefined-version.
8999         * script.cc (struct Version_expression): Add was_matched_by_symbol
9000         field.
9001         (Version_script_info::matched_symbol): New function.
9002         (Version_script_info::get_symbol_version_helper): Call
9003         matched_symbol.
9004         (Version_script_info::check_unmatched_names): New function.
9005         * script.h (class Version_script_info): Update declarations.
9006         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9007
9008         * options.h (class General_options): Use DEFINE_bool_alias for
9009         allow_multiple_definition.
9010         * resolve.cc (Symbol_table::should_override): Don't test
9011         allow_multiple_definition.
9012
9013         PR 10980
9014         * options.h (class General_options): Add --cref.
9015         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9016         until after printing cref table.
9017         * cref.cc: Include "symtab.h".
9018         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9019         (Cref_table_compare::operator()): New function.
9020         (Cref_inputs::gather_cref): New function.
9021         (filecol): New static const.
9022         (Cref_inputs::print_cref): New function.
9023         (Cref::print_cref): New function.
9024         * cref.h: Include <cstdio>.
9025         (class Cref): Update declarations.
9026         * mapfile.h (Mapfile::file): New function.
9027         * object.h (class Object): Define Symbols.  Declare virtual
9028         do_get_global_symbols.
9029         (Object::get_global_symbols): New function.
9030         * object.cc (Input_objects::add_object): Pass object to cref_ if
9031         --cref.
9032         (Input_objects::archive_start): Likewise.
9033         (Input_objects::archive_stop): Likewise.
9034         (Input_objects::print_cref): New function.
9035         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9036         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9037         --cref.
9038         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9039         function.
9040         * plugin.h (class Sized_pluginobj): Update declarations.
9041
9042 2010-01-05  Ian Lance Taylor  <iant@google.com>
9043
9044         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9045         to is_default_version.  Rename insdef to insdefault.
9046         (Symbol_table::add_from_relobj): Rename def to is_default_version
9047         and local to is_forced_local.
9048         (Symbol_table::add_from_pluginobj): Likewise.
9049         (Symbol_table::add_from_dynobj): Likewise.
9050         (Symbol_table::define_special_symbol): Rename insdef to
9051         insdefault.
9052
9053 2010-01-04  Ian Lance Taylor  <iant@google.com>
9054
9055         PR 10980
9056         * options.h (class General_options): Add
9057         --allow-multiple-definition and -z muldefs.
9058         * resolve.cc (Symbol_table::should_override): Don't warn about a
9059         multiple symbol definition if --allow-multiple-definition or -z
9060         muldefs.
9061
9062         PR 10980
9063         * options.h (class General_options): Add --add-needed and
9064         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9065         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9066         error if --copy-dt-needed-entries aka --add-needed is used and
9067         would cause a change in behaviour.
9068
9069         PR 10980
9070         * options.h (class General_options): Add -G as a short version of
9071         --shared.  Add no-op options -assert, -g, and -i.
9072
9073 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9074
9075         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9076         check for .text or .gnu.linkonce.t sections.
9077         * icf.cc (Icf::find_identical_sections): Ditto.
9078         Change the detection for mangled function name within the section
9079         name.
9080         * icf.h (is_section_foldable_candidate): New function.
9081
9082 2009-12-30  Ian Lance Taylor  <iant@google.com>
9083
9084         PR 10980
9085         * options.h (class General_options): Permit two dashes with
9086         --retain-symbols-file.
9087
9088 2009-12-30  Ian Lance Taylor  <iant@google.com>
9089
9090         PR 10979
9091         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9092         don't put the file header and segment headers in the text
9093         segment.
9094
9095         PR 10979
9096         * common.cc (Sort_commons::operator()): Stabilize sort when both
9097         entries are NULL.
9098         (Symbol_table::do_allocate_commons_list): When allocating common
9099         symbols, skip a symbol which is no longer common.
9100         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9101         an object before checking its type.
9102         * testsuite/common_test_2.c: New file.
9103         * testsuite/common_test_3.c: New file.
9104         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9105         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9106         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9107         (common_test_2_pic.o, common_test_2.so): New targets.
9108         (common_test_3_pic.o, common_test_3.so): New targets.
9109         * testsuite/Makefile.in: Rebuild.
9110
9111         PR 10979
9112         * script.cc (read_input_script): If we see a new SECTIONS clause,
9113         and we have added an input section, give an error.
9114         * layout.h (class Layout): Add have_added_input_section function.
9115         Add have_added_input_section_ field.
9116         * layout.cc (Layout::Layout): Initialize
9117         have_added_input_section_.
9118         (Layout::layout): Set have_added_input_section_.
9119         (Layout::layout_eh_frame): Likewise.
9120
9121 2009-12-30  Ian Lance Taylor  <iant@google.com>
9122
9123         PR 10931
9124         * options.h (class General_options): Add --sort-common option.
9125         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9126         * common.cc (Sort_common): Add sort_order parameter to
9127         constructor.  Add sort_order_ field.
9128         (Sort_commons::operator): Check sort_order_.
9129         (Symbol_table::allocate_commons): Determine the sort order.
9130         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9131         Change all callers.
9132         (Symbol_table::do_allocate_commons_list): Likewise.
9133
9134 2009-12-30  Ian Lance Taylor  <iant@google.com>
9135
9136         PR 10916
9137         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9138         symbols from this object, don't change the visibility of an
9139         undefined symbol.
9140         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9141
9142 2009-12-30  Ian Lance Taylor  <iant@google.com>
9143
9144         PR 10861
9145         * script.h (class Version_script_info): Define Language enum.
9146         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9147         new fields globals_, locals_, and is_finalized_.
9148         * script.cc: Various formatting fixes.
9149         (class Parser_closure): Change language_stack_ from a vector of
9150         std::string to one of Version_script_info::Language.  Adjust all
9151         uses accordingly.
9152         (class Lazy_demangler): Remove.
9153         (struct Version_expression): Change language from std::string to
9154         Version_script_info::Language.
9155         (Version_script_info::Version_script_info): New function.
9156         (Version_script_info::~Version_script_info): Don't call clear.
9157         (Version_script_info::finalize): New function.
9158         (Version_script_info::build_lookup_tables): New function.
9159         (Version_script_info::build_expression_list_lookup): New
9160         function.
9161         (Version_script_info::get_symbol_version_helper): Rewrite to use
9162         lookup tables.
9163         (Version_script_info::print_expression_list): Adjust to use
9164         Version_script_info::Language.
9165         (script_push_lex_into_version_mode): Check that the version script
9166         has not been finalized.
9167         (version_script_push_lang): Change language string to
9168         Version_script_info::Language.
9169         * options.cc (Command_line::version_script): New function.
9170         * options.h (class General_options): Add finalize_dynamic_list
9171         function.  Change version_script from declaration to definition.
9172         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9173         * testsuite/version_script.map: Remove duplicate def of foo.
9174         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9175         version_script.map.
9176         * testsuite/Makefile.in: Rebuild.
9177
9178 2009-12-30  Ian Lance Taylor  <iant@google.com>
9179
9180         PR 10843
9181         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9182         if the input symbol index is 0, make the output symbol index 0.
9183
9184 2009-12-30  Ian Lance Taylor  <iant@google.com>
9185
9186         PR 10670
9187         * options.h (class General_options): Add -x/--discard-all.
9188         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9189         --discard-all.  If the local symbol needs a dynamic entry, check
9190         that before handling --discard-locals.
9191
9192 2009-12-30  Ian Lance Taylor  <iant@google.com>
9193
9194         PR 10450
9195         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9196         flags to PF_R.
9197         (Output_segment::add_output_section): Don't change the flags if
9198         the type is PT_TLS.
9199
9200         PR 10450
9201         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9202         GNU hash table if they need a dynamic value.  Otherwise, don't add
9203         them if they are defined in a dynamic object or are forced local.
9204
9205 2009-12-29  Ian Lance Taylor  <iant@google.com>
9206
9207         PR 10450
9208         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9209         .gnu.hash table for a 32-bit target.
9210
9211         PR 10450
9212         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9213         regular and a dynamic object only needs a dynamic symbol table
9214         entry if it is externally visible.
9215
9216         PR 10450
9217         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9218         constructor.  Add global_offset_table_ field.
9219         (Target_i386::got_section): Set global_offset_table_.
9220         (Target_i386::do_finalize_sections): Set global_offset_table_
9221         size.
9222         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9223         in constructor.  Add global_offset_table_ field.
9224         (Target_x86_64::got_section): Set global_offset_table_.
9225         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9226         size.
9227
9228         * layout.cc (Layout::Layout): Initialize increase_relro_.
9229         (Layout::get_output_section): Add is_relro, is_last_relro, and
9230         is_first_non_relro parameters.  Change all callers.
9231         (Layout::choose_output_section): Likewise.
9232         (Layout::add_output_section_data): Likewise.
9233         (Layout::make_output_section): Likewise.
9234         (Layout::set_segment_offsets): Clear increase_relro when using a
9235         linker script.
9236         * layout.h (class Layout): Add increase_relro method.  Add
9237         increase_relro_ field.  Update declarations.
9238         * output.cc (Output_section::Output_section): Initialize
9239         is_last_relro_ and is_first_non_relro_.
9240         (Output_segment::add_output_section): Group relro sections is
9241         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9242         (Output_segment::maximum_alignment): Remove relro handling.
9243         (Output_segment::set_section_addresses): Add increase_relro
9244         parameter.  Change all callers.  Add initial alignment to align
9245         relro sections on separate page.  Remove old relro handling.
9246         (Output_segment::set_section_list_addresses): Remove in_relro
9247         parameter.  Change all callers.
9248         (Output_segment::set_offset): Add increase parameter.  Change all
9249         callers.  Remove old relro handling.
9250         * output.h (class Output_section): Add new methods: is_last_relro,
9251         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9252         Add is_last_relro_ and is_first_non_relro_ fields.
9253         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9254         Create separate .got.plt section.  Call increase_relro.
9255         * x86_64.cc (Target_x86_64::got_section): Likewise.
9256         * testsuite/relro_script_test.t: Add .got.plt.
9257
9258         PR 10450
9259         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9260         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9261         (Layout::finalize): Call set_dynamic_symbol_size.
9262         (Layout::set_dynamic_symbol_size): New function.
9263         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9264         set_dynamic_symbol_size.
9265
9266         PR 10450
9267         * output.h (class Output_section): Add is_entsize_zero_ field.
9268         * output.cc (Output_section::Output_section): Initialize
9269         is_entsize_zero_.
9270         (Output_section::set_entsize): If two different entsizes are
9271         requested, force it to zero.
9272         (Output_section::add_input_section): Set flags for .debug_str
9273         before updating section flags.  Set entsize.
9274         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9275         and SHF_STRING if all input sections have those flags.
9276
9277 2009-12-29   Rafael Espindola  <espindola@google.com>
9278
9279         * main.cc (main): Fix the sys time reporting.
9280         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9281         reporting.
9282
9283 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9284
9285         * options.cc (General_options::parse_version): Allow -v to exit
9286         without an error if there is nothing to link.
9287
9288 2009-12-29  Ian Lance Taylor  <iant@google.com>
9289
9290         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9291         using a version of gcc before 4.1.
9292         * configure: Rebuild.
9293
9294 2009-12-28  Chris Demetriou  <cgd@google.com>
9295
9296         * attributes.cc (Output_attributes_section_data::do_write): Use
9297         std::vector::front rather than std::vector::data.
9298
9299 2009-12-28  Ian Lance Taylor  <iant@google.com>
9300
9301         * symtab.h (class Symbol_table): Add enum Defined.
9302         * resolve.cc (Symbol_table::should_override): Add defined
9303         parameter.  Change all callers.  Test whether object is NULL
9304         before calling a method on it.
9305         (Symbol_table::report_resolve_problem): Add defined parameter.
9306         Change all callers.
9307         (Symbol_table::should_override_with_special): Likewise.
9308         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9309         parameter.  Change all callers.
9310         (Symbol_table::do_define_in_output_data): Likewise.
9311         (Symbol_table::define_in_output_segment): Likewise.
9312         (Symbol_table::do_define_in_output_segment): Likewise.
9313         (Symbol_table::define_as_constant): Likewise.
9314         (Symbol_table::do_define_as_constant): Likewise.
9315         * script.h (class Symbol_assignment): Add is_defsym parameter to
9316         constructor; change all callers.
9317         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9318         parameter.  Change all callers.  Add is_defsym_ field.
9319         (class Parser_closure): Add parsing_defsym parameter to
9320         constructor; change all callers.  Add parsing_defsym accessor
9321         function.  Add parsing_defsym_ field.
9322
9323 2009-12-28  Ian Lance Taylor  <iant@google.com>
9324
9325         * gold.cc (queue_middle_tasks): Fix formatting.
9326         * object.cc (Relobj::is_section_name_included): Likewise.
9327
9328 2009-12-23  Ian Lance Taylor  <iant@google.com>
9329
9330         * i386.cc (Target_i386::do_calls_non_split): Recognize
9331         -fsplit-stack prologue for a function with a static chain.
9332         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9333         -fsplit-stack prologue when using %r11.
9334
9335 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9336
9337         * options.cc (General_options::parse_version): Make -v continue and do
9338         the link like GNU ld does.
9339
9340 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9341
9342         * Makefile.am (CCFILES): Add timer.cc.
9343         (HFILES): Add timer.h.
9344         * configure.ac: Check for sysconf and times.
9345         * main.cc: include timer.h.
9346         (main): Use Timer instead of get_run_time.
9347         * timer.cc: New.
9348         * timer.h: New.
9349         * workqueue.cc: include timer.h.
9350         (Workqueue::find_and_run_task):
9351         Report user, sys and wall time.
9352         * Makefile.in: Regenerate.
9353         * config.in: Regenerate.
9354         * configure: Regenerate.
9355
9356 2009-12-16  Doug Kwan  <dougkwan@google.com>
9357
9358         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9359         sections.
9360         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9361         relaxed input sections.
9362         * output.cc (Output_section::find_relaxed_input_section): Change
9363         return type to Output_relaxed_input_section pointer.  Adjust code
9364         for new type of relaxed_input_section_map_.
9365         * output.h (Output_section::find_relaxed_input_section): Change
9366         return type to Output_relaxed_input_section pointer.
9367         (Output_section::Output_relaxed_input_section_by_input_section_map):
9368         New type.
9369         (Output_section::relaxed_input_section_map_): Change type to
9370         Output_section::Output_relaxed_input_section_by_input_section_map.
9371         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9372         input section.
9373
9374 2009-12-15  Ian Lance Taylor  <iant@google.com>
9375
9376         * layout.cc (Layout::create_shstrtab): Only write out after input
9377         sections if we are compressing debug sections.
9378
9379 2009-12-15  Ian Lance Taylor  <iant@google.com>
9380
9381         * archive.cc (Archive::add_symbols): Only look up a symbol without
9382         a version if there is, in fact, a version.
9383
9384 2009-12-14  Ian Lance Taylor  <iant@google.com>
9385
9386         Revert -Wshadow changes, all changes from:
9387         2009-12-11  Doug Kwan  <dougkwan@google.com>
9388         2009-12-11  Nick Clifton  <nickc@redhat.com>
9389         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9390
9391 2009-12-11  Doug Kwan  <dougkwan@google.com>
9392
9393         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9394         due to -Wshadow.
9395         * attributes.cc (Object_attribute::size): Ditto.
9396         (Attributes_section_data::size): Ditto.
9397         (Attributes_section_data::Attributes_section_data): Ditto.
9398         (Output_attributes_section_data::do_write): Ditto.
9399         * attributes.h (Object_attribute::set_type): Ditto.
9400         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9401
9402 2009-12-11  Nick Clifton  <nickc@redhat.com>
9403
9404         * archive.cc: Fix shadowed variable warnings.
9405         * arm.cc: Likewise.
9406         * compressed_output.cc: Likewise.
9407         * compressed_output.h: Likewise.
9408         * configure: Likewise.
9409         * dwarf_reader.cc: Likewise.
9410         * dynobj.cc: Likewise.
9411         * dynobj.h: Likewise.
9412         * ehframe.cc: Likewise.
9413         * ehframe.h: Likewise.
9414         * errors.cc: Likewise.
9415         * expression.cc: Likewise.
9416         * fileread.cc: Likewise.
9417         * fileread.h: Likewise.
9418         * freebsd.h: Likewise.
9419         * i386.cc: Likewise.
9420         * icf.cc: Likewise.
9421         * incremental.h: Likewise.
9422         * layout.cc: Likewise.
9423         * layout.h: Likewise.
9424         * mapfile.cc: Likewise.
9425         * merge.cc: Likewise.
9426         * merge.h: Likewise.
9427         * object.cc: Likewise.
9428         * object.h: Likewise.
9429         * options.h: Likewise.
9430         * output.cc: Likewise.
9431         * output.h: Likewise.
9432         * parameters.cc: Likewise.
9433         * plugin.cc: Likewise.
9434         * powerpc.cc: Likewise.
9435         * reduced_debug_output.cc: Likewise.
9436         * reduced_debug_output.h: Likewise.
9437         * reloc.cc: Likewise.
9438         * reloc.h: Likewise.
9439         * resolve.cc: Likewise.
9440         * script-sections.cc: Likewise.
9441         * script.cc: Likewise.
9442         * script.h: Likewise.
9443         * sparc.cc: Likewise.
9444         * symtab.cc: Likewise.
9445         * symtab.h: Likewise.
9446         * target-select.cc: Likewise.
9447         * target-select.h: Likewise.
9448         * token.h: Likewise.
9449         * workqueue.cc: Likewise.
9450         * workqueue.h: Likewise.
9451         * x86_64.cc: Likewise.
9452
9453 2009-12-10  Doug Kwan  <dougkwan@google.com>
9454
9455         * arm.cc (attributes.h): New include.
9456         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9457         (Arm_relobj::~Arm_relobj): Delete object pointed by
9458         attributes_section_data_.
9459         (Arm_relobj::attributes_section_data): New method definition.
9460         (Arm_relobj::attributes_section_data_): New data member declaration.
9461         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9462         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9463         attributes_section_data_.
9464         (Arm_dynobj::attributes_section_data): New method definition.
9465         (Arm_dynobj::attributes_section_data_): New data member declaration.
9466         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9467         initialization value of may_use_blx_ to false.
9468         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9469         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9470         object attributes to compute results instead of hard-coding.
9471         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9472         Target_arm::get_secondary_compatible_arch,
9473         Target_arm::set_secondary_compatible_arch
9474         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9475         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9476         New method declarations.
9477         (Target_arm::get_aeabi_object_attribute): New method definition.
9478         (Target_arm::attributes_section_data_): New data member declaration.
9479         (read_arm_attributes_section): New template definition.
9480         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9481         (Arm_dynobj::do_read_symbols): Ditto.
9482         (Target_arm::do_finalize_sections): Merge attributes sections from
9483         input.  Check for BLX use after attributes section merging.
9484         Fix __exidx_start and __exidx_end visibility.  Create an
9485         .ARM.attributes section if necessary.
9486         (Target_arm::get_secondary_compatible_arch,
9487         Target_arm::set_secondary_compatible_arch,
9488         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9489         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9490         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9491         New method definitions.
9492
9493 2009-12-09  Ian Lance Taylor  <iant@google.com>
9494
9495         * plugin.cc (Plugin::load): Don't cast from void* to a function
9496         pointer.
9497
9498 2009-12-09  Ian Lance Taylor  <iant@google.com>
9499
9500         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9501         information fields.
9502
9503 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9504
9505         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9506         Replace two_file_shared_1.so with two_file_shared_2.so.
9507         * testsuite/Makefile.in: Regenerated.
9508
9509 2009-12-08  Doug Kwan  <dougkwan@google.com>
9510
9511         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9512         (HFILES): Add attributes.h and int_encoding.h.
9513         * Makefile.in: Regenerate.
9514         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9515         function definitions to int_encoding.cc
9516         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9517         prototypes to int_encoding.h
9518         * reduced_debug_output.cc (int_encoding.h): New include.
9519         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9520         function definitions to int_encoding.cc
9521         (insert_into_vector, read_from_pointer): Move template definitions to
9522         int_encoding.h
9523         * attributes.cc: New file.
9524         * attributes.h: New file.
9525         * int_encoding.cc: New file.
9526         * int_encoding.h: New file.
9527
9528 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9529
9530         PR gold/11055
9531         * incremental-dump.cc (dump_incremental_inputs): New.
9532         (main): Use dump_incremental_inputs.
9533
9534 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9535
9536         PR gold/10893
9537         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9538         checking elfcpp::STT_FUNC.
9539         (Target_i386::Relocate::relocate): Likewise.
9540         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9541
9542         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9543         symbols from shared libraries into normal FUNC symbols.
9544
9545         * symtab.h (Symbol): Add is_func and use it.
9546
9547 2009-12-05  Doug Kwan  <dougkwan@google.com>
9548
9549         * arm.cc (Target_arm::arm_info): Initialize new fields
9550         attributes_section and attributes_vendor.
9551         * i386.cc (Target_i386::i386_info): Same.
9552         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9553         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9554         fields attributes_section and attributes_vendor.
9555         * sparc.cc (Target_sparc::sparc_info): Same.
9556         * target.h (Target::attributes_section, Target::attributes_vendor,
9557         Target::is_attributes_section, Target::attribute_arg_type,
9558         Target::attributes_order): New method definitions.
9559         (Target::Target_info::attributes_section,
9560         Target::Target_info::attributes_vendor): New fields.
9561         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9562         virtual method definitions.
9563         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9564         attributes_section and attributes_vendor.
9565         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9566
9567 2009-12-05  Doug Kwan  <dougkwan@google.com>
9568
9569         * arm.cc: Update comments about interworking and stub generation.
9570         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9571         considered as non-PIC.
9572         (Arm_relocate_functions::base_abs): Fix formatting.
9573         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9574         of function to use GOT entry address instead of offset.
9575         (Target_arm::Scan::global): Issue an error if a symbol would need a
9576         PLT does not get one because it is untyped.  Remove code to create
9577         dynamic symbols for relative branches.
9578         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9579         takes unsigned integer instead of boolean.
9580
9581 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9582
9583         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9584         (two_file_test_LDADD): Likewise.
9585         (common_test_1_LDADD): Likewise.
9586         (exception_test_LDADD) Likewise.
9587         (weak_test_LDADD): Likewise.
9588         (many_sections_test_LDADD): Likewise.
9589         (initpri1_LDADD): Likewise.
9590         (script_test_1_LDADD): Likewise.
9591         (script_test_2_LDADD): Likewise.
9592         (justsyms_LDADD): Likewise.
9593         (binary_test_LDADD): Likewise.
9594         (large_LDADD): Likewise.
9595         * testsuite/Makefile.in: Regenerated.
9596
9597 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9598
9599         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9600         (Symbol_table::override_with_special): Likewise.
9601         (Symbol_table::add_from_object): Likewise.
9602
9603 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9604
9605         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9606         Don't set the data_offset twice.
9607
9608 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9609
9610         * testsuite/Makefile.in: Regenerate.
9611
9612 2009-12-03  Doug Kwan  <dougkwan@google.com>
9613
9614         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9615         (Target_arm::do_finalize_sections): Add parameter for symbol table
9616         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9617         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9618         parameter for symbol table pointer.
9619         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9620         an additional parameter for a pointer to symbol table.
9621         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9622         parameter for a symbol table pointer.
9623         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9624         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9625         Ditto.
9626         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9627         parameter for a symbol table pointer.
9628
9629 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9630
9631         * incremental.cc (Incremental_inputs_header)
9632         (Incremental_inputs_header_write, Incremental_inputs_entry)
9633         (Incremental_inputs_entry_write): Move ...
9634         * incremental.h (Incremental_inputs_header)
9635         (Incremental_inputs_header_write, Incremental_inputs_entry)
9636         (Incremental_inputs_entry_write): here.
9637
9638 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9639
9640         * incremental.cc (make_sized_incremental_binary): Set the target.
9641         Error if it is incompatible.
9642         * output.h (Output_file): Add filename method.
9643
9644 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9645
9646         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9647         from the get_* methods.
9648
9649 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9650
9651         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9652         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9653         Write 0 for the data_offset of scripts.
9654
9655 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9656
9657         * testsuite/Makefile.am: Add the incremental_test.sh test.
9658         * testsuite/incremental_test.sh: New.
9659         * testsuite/incremental_test_1.c: New.
9660         * testsuite/incremental_test_2.c: New.
9661
9662 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9663
9664         * incremental-dump.cc (main): Fix typos.
9665
9666 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9667
9668         PR gold/11025
9669         * incremental-dump.cc (main): Use llu to print 64 bit values.
9670
9671 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9672             H.J. Lu  <hongjiu.lu@intel.com>
9673
9674         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9675         $(LIBDL).
9676         (incremental_dump_LDADD): Likewise.
9677         * Makefile.in: Regenerated.
9678
9679 2009-11-25  Doug Kwan  <dougkwan@google.com>
9680
9681         Revert:
9682
9683         2009-11-25  Doug Kwan  <dougkwan@google.com>
9684
9685                 * arm.cc (Target_arm::Target_arm): Move method definition
9686                 outside of class definition.  Add code to handle
9687                 --target1-rel, --target1-abs and --target2= options.
9688                 (Target_arm::get_reloc_reloc_type): Change method to be
9689                 non-static and const.
9690                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9691                 New data member declaration.
9692                 (Target_arm::Scan::local, Target_arm::Scan::global,
9693                 Target_arm::Relocate::relocate,
9694                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9695                 Adjust call to Target_arm::get_real_reloc_type.
9696                 (Target_arm::get_real_reloc_type): Use command line options
9697                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9698                 * options.h (--target1-rel, --target1-abs, --target2): New
9699                 ARM-only options.
9700
9701 2009-11-25  Doug Kwan  <dougkwan@google.com>
9702
9703         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9704         class definition.  Add code to handle --target1-rel, --target1-abs
9705         and --target2= options.
9706         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9707         and const.
9708         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9709         member declaration.
9710         (Target_arm::Scan::local, Target_arm::Scan::global,
9711         Target_arm::Relocate::relocate,
9712         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9713         call to Target_arm::get_real_reloc_type.
9714         (Target_arm::get_real_reloc_type): Use command line options to
9715         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9716         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9717         options.
9718
9719 2009-11-25  Doug Kwan  <dougkwan@google.com>
9720
9721         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9722         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9723         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9724         formatting.
9725         (Arm_relocate_functions::thm_call): Replace body with a call to
9726         Arm_relocate_functions::thumb_branch_common.
9727         (Arm_relocate_functions::thm_jump24,
9728         Arm_relocate_functions::thm_xpc22): New method definitions.
9729         (Arm_relocate_functions::thumb_branch_common): New method definition.
9730         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9731         operator.
9732         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9733         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9734
9735 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9736
9737         * Makefile.am: Build incremental-dump
9738         * Makefile.in: Regenerate.
9739         * incremental-dump.cc: New.
9740         * incremental.cc (Incremental_inputs_header_data,
9741         Incremental_inputs_entry_data): Move to incremental.h
9742         * incremental.h: (Incremental_inputs_header_data,
9743         Incremental_inputs_entry_data): Move from incremental.cc
9744
9745 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9746
9747         * incremental.cc (Incremental_inputs_header,
9748         Incremental_inputs_header_write, Incremental_inputs_entry,
9749         Incremental_inputs_entry_write): Add a typedef with the data type.
9750
9751 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9752
9753         * incremental.cc (Incremental_inputs_header,
9754         Incremental_inputs_header_write, Incremental_inputs_entry,
9755         Incremental_inputs_entry_write): Update comment about which
9756         type has the filed descriptions.
9757
9758 2009-11-15  Doug Kwan  <dougkwan@google.com>
9759
9760         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9761         (Arm_relocate_functions::arm_branch_common): Change method defintion
9762         in class definition to a method declaration and update list of formal
9763         parameters.
9764         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9765         Arm_relocation_functions::jump24): Adjust call to
9766         Arm_relocate_functions::arm_branch_common.  Update list of formal
9767         parameters.
9768         (Arm_relocate_functions::xpc25): New method definition.
9769         (Arm_relocate_functions::arm_branch_common): Move method defintion
9770         out from class definition.  Use stubs for mode-switching and extending
9771         branch ranges.
9772         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9773         specially.  Change code to enable use of stubs in ARM branches.
9774
9775 2009-11-10  Doug Kwan  <dougkwan@google.com>
9776
9777         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9778         in method declaration.
9779         (Target_arm::relocate_stub): New method declaration.
9780         (Target_arm::default_target): Change to return a pointer instead of
9781         a const reference.
9782         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9783         Target_arm::default_target.
9784         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9785         method definition.
9786         (Target_arm::relocate_section): Adjust view.
9787         (Target_arm::relocate_stub): New method definition.
9788
9789 2009-11-10  Doug Kwan  <dougkwan@google.com>
9790
9791         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9792         a format warning.
9793         * incremental.cc (open_incremental_binary): Initialized local
9794         variables to avoid warnings.
9795         * object.cc (make_elf_object): Ditto.
9796         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9797         a format warning.
9798
9799 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9800
9801         PR gold/10930
9802         * testsuite/plugin_test.c: Include "config.h".
9803
9804 2009-11-09  Doug Kwan  <dougkwan@google.com>
9805
9806         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9807         (arm_symbol_value): Remove.
9808         (Arm_relocate_functions::arm_branch_common,
9809         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9810         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9811         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9812         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9813         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9814         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9815         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9816         Arm_relocate_functions::thm_mobw_abs_nc,
9817         Arm_relocate_functions::thm_mov_abs,
9818         Arm_relocate_functions::movw_prel_nc,
9819         Arm_relocate_functions::thm_movt_abs,
9820         Arm_relocate_functions::movt_prel,
9821         Arm_relocate_functions::thm_movw_prel_nc,
9822         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9823         (Target_arm::Relocate::relocate): Only decompose address into two
9824         parts if relocation type uses the thumb-bit and pass the actual
9825         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9826         calls to methods in Arm_relocate_functions for this change.
9827
9828 2009-11-08  Ian Lance Taylor  <iant@google.com>
9829
9830         PR 10925
9831         * reloc.cc: Instantiate
9832         Sized_relobj::initialize_input_to_output_maps and
9833         Sized_relobj:free_input_to_output_maps.
9834
9835 2009-11-06  Ian Lance Taylor  <iant@google.com>
9836
9837         PR 10876
9838         * defstd.cc (in_segment): Set only_if_ref true for "end".
9839
9840 2009-11-06  Doug Kwan  <dougkwan@google.com>
9841
9842         * arm.cc (class Reloc_stub): Correct a comment.
9843         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9844         (Target_arm::scan_section_for_stubs): New method declaration.
9845         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9846         Change methods from private to protected.
9847         (Target_arm::do_may_relax): New method definition.
9848         (Target_arm::do_relax, Target_arm::group_sections,
9849         Target_arm::scan_reloc_for_stub,
9850         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9851         (Target_arm::arm_input_section_map_): New data member declaration.
9852         (Target_arm::scan_reloc_for_stub,
9853         Target_arm::scan_reloc_section_for_stubs,
9854         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9855         Target_arm::do_relax): New method definitions.
9856
9857 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9858
9859         * configure.ac: Check for (struct stat)::st_mtim
9860         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9861         * config.in: Regenerate.
9862         * configure: Regenerate.
9863
9864 2009-11-05  Ian Lance Taylor  <iant@google.com>
9865
9866         PR 10910
9867         * output.cc (Output_segment::add_output_section): Add missing
9868         return statement.
9869
9870 2009-11-04  Ian Lance Taylor  <iant@google.com>
9871
9872         PR 10880
9873         * object.h (class Object): Add is_needed and set_is_needed
9874         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9875         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9876         defined in a dynamic object and referenced by a regular object,
9877         set is_needed for the dynamic object.
9878         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9879         if the file is marked with as_needed and it is not needed.
9880
9881 2009-11-04  Ian Lance Taylor  <iant@google.com>
9882
9883         PR 10887
9884         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9885         tags if data is discarded by linker script.
9886         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9887         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9888         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9889         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9890
9891 2009-11-04  Ian Lance Taylor  <iant@google.com>
9892
9893         * layout.cc (Layout::get_output_section): Add is_interp and
9894         is_dynamic_linker_section parameters.  Change all callers.
9895         (Layout::choose_output_section): Likewise.
9896         (Layout::make_output_section): Likewise.
9897         (Layout::add_output_section_data): Add is_dynamic_linker_section
9898         parameter.  Change all callers.
9899         * layout.h (class Layout): Update declarations.
9900         * output.h (class Output_section): Add is_interp, set_is_interp,
9901         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9902         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9903         generate_code_fills_at_write_ to a bitfield.
9904         * output.cc (Output_section::Output_sections): Initialize new
9905         fields.
9906         (Output_segment::add_output_section): Add do_sort parameter.
9907         Change all callers.
9908
9909 2009-11-03  Ian Lance Taylor  <iant@google.com>
9910
9911         PR 10860
9912         * options.h (class General_options): Add --warn-common.
9913         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9914         merging two common symbols.
9915         (Symbol_table::should_override): Handle --warn-common when merging
9916         a common symbol with a defined symbol.  Use report_resolve_problem
9917         for multiple definitions.
9918         (Symbol_table::report_resolve_problem): New function.
9919         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9920
9921 2009-11-03  Doug Kwan  <dougkwan@google.com>
9922
9923         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9924         stub_factory_.
9925         (Target_arm::stub_factory): New method definition.
9926         (Target_arm::new_arm_input_section,
9927         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9928         Target_arm::reloc_uses_thumb_bit): New method declarations.
9929         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9930         New type definitions.
9931         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9932         member declarations.
9933         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9934         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9935         New method definitions.
9936
9937 2009-11-03  Ian Lance Taylor  <iant@google.com>
9938
9939         * options.h (class General_options): Add --warn_constructors.
9940
9941 2009-11-03  Ian Lance Taylor  <iant@google.com>
9942
9943         PR 10893
9944         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9945         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9946
9947 2009-11-03  Ian Lance Taylor  <iant@google.com>
9948
9949         PR 10895
9950         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9951         --msgid-bugs-address.
9952         (install-pdf): New target.
9953         (install-data_yes): Look up one directory to find mkinstalldirs.
9954
9955 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9956
9957         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9958         tree.
9959
9960 2009-10-30  Doug Kwan  <dougkwan@google.com>
9961
9962         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9963
9964 2009-10-30  Doug Kwan  <dougkwan@google.com>
9965
9966         * arm.cc (Stub_addend_reader): New struct template definition
9967         and partial specializations.
9968         (Stub_addend_reader::operator()): New method definition for a
9969         partially specialized template.
9970
9971 2009-10-30  Doug Kwan  <dougkwan@google.com>
9972
9973         * arm.cc (Arm_relobj::processor_specific_flags): New method
9974         definition.
9975         (Arm_relobj::do_read_symbols): New method declaration.
9976         (Arm_relobj::processor_specific_flags_): New data member declaration.
9977         (Arm_dynobj): New class definition.
9978         (Target_arm::do_finalize_sections): Add input_objects parameter.
9979         (Target_arm::do_adjust_elf_header): New method declaration.
9980         (Target_arm::are_eabi_versions_compatible,
9981         (Target_arm::merge_processor_specific_flags): New method declaration.
9982         (Target_arm::do_make_elf_object): New overloaded method definitions
9983         and declaration.
9984         (Arm_relobj::do_read_symbols): New method definition.
9985         (Arm_dynobj::do_read_symbols): Ditto.
9986         (Target_arm::do_finalize_sections): Add input_objects parameters.
9987         Merge processor-specific flags from all input objects.
9988         (Target_arm::are_eabi_versions_compatible,
9989         Target_arm::merge_processor_specific_flags,
9990         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9991         New method definitions.
9992         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9993         Input_objects pointer type parameter.
9994         * layout.cc (Layout::finalize): Pass input objects to target's.
9995         finalize_sections function.
9996         * output.cc (Output_file_header::do_sized_write): Set ELF file
9997         header's processor-specific flags.
9998         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9999         Input_objects pointer type parameter.
10000         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10001         * target.h (Input_objects): New forward class declaration.
10002         (Target::processor_specific_flags,
10003         Target::are_processor_specific_flags_sect): New method definitions.
10004         (Target::finalize_sections): Add input_objects parameter.
10005         (Target::Target): Initialize processor_specific_flags_ and
10006         are_processor_specific_flags_set_.
10007         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10008         parameter.
10009         (Target::set_processor_specific_flags): New method definition.
10010         (Target::processor_specific_flags_,
10011         Target::are_processor_specific_flags_set_): New data member
10012         declarations.
10013         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10014         Input_objects pointer type parameter.
10015
10016 2009-10-30  Doug Kwan  <dougkwan@google.com>
10017
10018         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10019
10020 2009-10-28  Ian Lance Taylor  <iant@google.com>
10021
10022         * object.h (class Relobj): Drop options parameter from
10023         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10024         do_scan_relocs, do_relocate.  Change all callers.
10025         (class Sized_relobj): Drop options parameters from
10026         do_gc_process_relocs, do_scan_relocs, do_relocate,
10027         do_relocate_sections, relocate_sections, emit_relocs_scan,
10028         emit_relocs_scan_reltype.  Change all callers.
10029         (struct Relocate_info): Remove options field and all references to
10030         it.
10031         * reloc.h (class Read_relocs): Remove options constructor
10032         parameter and options_ field.  Change all callers.
10033         (class Gc_process_relocs, class Scan_relocs): Likewise.
10034         (class Relocate_task): Likewise.
10035         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10036         all callers.
10037         (scan_relocatable_relocs): Likewise.
10038         * target.h (class Sized_target): Remove options parameter from
10039         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10040         all callers.
10041         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10042         callers.
10043         * arm.cc: Update functions to remove options parameters.
10044         * i386.cc: Likewise.
10045         * powerpc.cc: Likewise.
10046         * sparc.cc: Likewise.
10047         * x86_64.cc: Likewise.
10048         * testsuite/testfile.cc: Likewise.
10049
10050 2009-10-28  Doug Kwan  <dougkwan@google.com>
10051
10052         * arm.cc (Arm_relobj): New class definition.
10053         (Arm_relobj::scan_sections_for_stubs,
10054         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10055         New method definitions.
10056
10057 2009-10-28  Cary Coutant  <ccoutant@google.com>
10058
10059         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10060         (Plugin::cleanup_done_): New member.
10061         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10062         (Plugin_manager::cleanup_done_): Remove.
10063         (Plugin_manager::add_input_file): Edit error message.
10064         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10065         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10066
10067 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10068
10069         * fileread.cc: (File_read::View::~View): Use the new
10070         data_ownership_ filed.
10071         (File_read::~File_read): Dispose the new whole_file_view_.
10072         (File_read::open): Mmap the whole file if needed.
10073         (File_read::open): Use whole_file_view_ instead of contents_.
10074         (File_read::find_view): Use whole_file_view_ if applicable.
10075         (File_read::do_read): Use whole_file_view_ instead of contents_.
10076         (File_read::make_view): Use whole_file_view_ instead of contents_,
10077         update File_read::View::View call.
10078         (File_read::find_or_make_view): Update File_read::View::View
10079         call.
10080         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10081         remove contents_
10082         (File_read::View::Data_ownership): New enum.
10083         (File_read::View::View): Replace bool mapped_ with Data_ownership
10084         argument.
10085         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10086         (File_read::View::data_ownership_): New field.
10087         (File_read::contents_): Remove (replaced by whole_file_view_).
10088         (File_read::whole_file_view_): New field.
10089         * options.h (class General_options): Add --keep-files-mapped.
10090
10091 2009-10-27  Cary Coutant  <ccoutant@google.com>
10092
10093         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10094         * testsuite/Makefile.am (plugin_test_5): New test case.
10095         * testsuite/Makefile.in: Regenerate.
10096
10097 2009-10-25  Doug Kwan  <dougkwan@google.com>
10098
10099         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10100         from private to protected to allow access by child class.
10101         (Sized_relobj::do_relocate_sections): New method declaration.
10102         (Sized_relobj::relocate_sections): Virtualize.
10103         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10104         Sized_relobj::relocate_sections.  Instantiate template explicitly
10105         for different target sizes and endianity.
10106
10107 2009-10-24  Doug Kwan  <dougkwan@google.com>
10108
10109         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10110         (Arm_input_section::as_arm_input_section): New method.
10111         (Arm_output_section): New class definition.
10112         (Arm_output_section::create_stub_group,
10113         Arm_output_section::group_sections): New method definitions.
10114
10115 2009-10-22  Doug Kwan  <dougkwan@google.com>
10116
10117         * arm.cc (Arm_input_section): New class definition.
10118         (Arm_input_section::init, Arm_input_section:do_write,
10119         Arm_input_section::set_final_data_size,
10120         Arm_input_section::do_reset_address_and_file_offset): New method
10121         definitions.
10122
10123 2009-10-21  Doug Kwan  <dougkwan@google.com>
10124
10125         * arm.cc (Stub_table, Arm_input_section): New forward class
10126         declarations.
10127         (Stub_table): New class defintion.
10128         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10129         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10130         New method definition.
10131
10132 2009-10-21  Doug Kwan  <dougkwan@google.com>
10133
10134         * arm.cc: Update copyright comments.
10135         (Target_arm): New forward class template declaration.
10136         (Arm_address): New type.
10137         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10138         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10139         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10140         constants.
10141         (Insn_template): Same.
10142         (DEF_STUBS): New macro.
10143         (Stub_type): New enum type.
10144         (Stub_template): New class definition.
10145         (Stub): Same.
10146         (Reloc_stub): Same.
10147         (Stub_factory): Same.
10148         (Target_arm::Target_arm): Initialize may_use_blx_ and
10149         should_force_pic_veneer_.
10150         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10151         Target_arm::should_force_pic_veneer,
10152         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10153         Target_arm::using_thumb_only, Target_arm:;default_target): New
10154         method defintions.
10155         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10156         New data member declarations.
10157         (Insn_template::size, Insn_template::alignment): New method defintions.
10158         (Stub_template::Stub_template): New method definition.
10159         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10160         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10161         (Stub_factory::Stub_factory): New method definition.
10162         * gold.h (string_hash): New template.
10163         * output.h (Input_section_specifier::hash_value): Use
10164         gold::string_hash.
10165         (Input_section_specifier::string_hash): Remove.
10166         * stringpool.cc (Stringpool_template::string_hash): Use
10167         gold::string_hash.
10168
10169 2009-10-20  Doug Kwan  <dougkwan@google.com>
10170
10171         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10172         symbols of relaxed input sections.
10173         * output.h (Output_section::find_relaxed_input_section): Make
10174         method public.
10175
10176 2009-10-16  Doug Kwan  <dougkwan@google.com>
10177
10178         * dynobj.cc (Versions::Versions): Initialize version_script_.
10179         Only insert base version symbol definition for a shared object
10180         if version script defines any version versions.
10181         (Versions::define_base_version): New method definition.
10182         (Versions::add_def): Check that base version is not needed.
10183         (Versions::add_need): Define base version lazily.
10184         * dynobj.h (Versions::define_base_version): New method declaration.
10185         (Versions::needs_base_version_): New data member declaration.
10186         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10187         (check_DATA): Add no_version_test.stdout.
10188         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10189         New make rules.
10190         * testsuite/Makefile.in: Regenerate.
10191         * testsuite/no_version_test.c: New file.
10192         * testsuite/no_version_test.sh: Ditto.
10193
10194 2009-10-16  Doug Kwan  <dougkwan@google.com>
10195
10196         * expression.cc (class Segment_start_expression): New class definition.
10197         (Segment_start_expression::value): New method definition.
10198         (script_exp_function_segment_start): Return a new
10199         Segment_start_expression.
10200         * gold/script-c.h (script_saw_segment_start_expression): New function
10201         prototype.
10202         * script-sections.cc (Script_sections::Script_sections): Initialize
10203         SAW_SEGMENT_START_EXPRESSION_ to false.
10204         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10205         and -Tbbs options to specify section addresses if given in
10206         command line and no SEGMENT_START expression is seen in a script.
10207         * script-sections.h (Script_sections::saw_segment_start_expression,
10208         Script_sections::set_saw_segment_start_expression): New method
10209         definition.
10210         (Script_sections::saw_segment_start_expression_): New data member
10211         declaration.
10212         * script.cc (script_saw_segment_start_expression): New function.
10213         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10214         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10215         script_test_7.sh and script_test_8.sh.
10216         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10217         script_test_8.stdout.
10218         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10219         (script_test_6, script_test_6.stdout, script_test_7,
10220         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10221         * Makefile.in: Regenerate.
10222         * testsuite/script_test_6.sh: New file.
10223         * testsuite/script_test_6.t: Same.
10224         * testsuite/script_test_7.sh: Same.
10225         * testsuite/script_test_7.t: Same.
10226         * testsuite/script_test_8.sh: Same.
10227
10228 2009-10-16  Doug Kwan  <dougkwan@google.com>
10229
10230         * output.cc (Output_segment::set_section_list_address): Cast
10231         expressions to unsigned long long type to avoid format warnings.
10232
10233 2009-10-15  Ian Lance Taylor  <iant@google.com>
10234
10235         * script.cc (Script_options::add_symbol_assignment): Always add a
10236         dot assignment to script_sections_.
10237         * script-sections.cc (Script_sections::add_dot_assignment):
10238         Initialize if necessary.
10239
10240         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10241         program headers with no load segment if there is a linker script.
10242
10243         * layout.cc (Layout::set_segment_offsets): Align the file offset
10244         to the segment aligment for -N or -n with no load segment.
10245         * output.cc (Output_segment::add_output_section): Don't crash if
10246         the first section is a TLS section.
10247         (Output_segment::set_section_list_addresses): Print an error
10248         message if the address moves backward in a linker script.
10249         * script-sections.cc
10250         (Output_section_element_input::set_section_addresses): Don't
10251         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10252         (Orphan_output_section::set_section_addresses): Likewise.
10253
10254 2009-10-15  Doug Kwan  <dougkwan@google.com>
10255
10256         * layout.cc (Layout::finish_dynamic_section): Generate tags
10257         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10258         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10259         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10260
10261 2009-10-14  Ian Lance Taylor  <iant@google.com>
10262
10263         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10264         fields.
10265         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10266         data_shdr fields of relinfo.
10267         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10268         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10269         R_386_TLS_LDO_32, adjust based on section flags.
10270         (Target_i386::Relocate::fix_up_ldo): Remove.
10271
10272 2009-10-13  Ian Lance Taylor  <iant@google.com>
10273
10274         Add support for -pie.
10275         * options.h (class General_options): Add -pie and
10276         --pic-executable.
10277         (General_options::output_is_position_independent): Test -pie.
10278         (General_options::output_is_executable): Return true if not shared
10279         and not relocatable.
10280         (General_options::output_is_pie): Remove.
10281         * options.cc (General_options::finalize): Reject incompatible uses
10282         of -pie.
10283         * gold.cc (queue_middle_tasks): A -pie link is not static.
10284         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10285         * symtab.cc (Symbol::final_value_is_known): Return false if
10286         output_is_position_independent.
10287         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10288         output_is_position_independent.
10289         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10290         output_is_position_independent.
10291         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10292         output_is_position_independent.
10293         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10294         two_file_pie_test.
10295         (basic_pie_test.o, basic_pie_test): New targets.
10296         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10297         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10298         (two_file_pie_test): New target.
10299         * testsuite/Makefile.in: Rebuild.
10300         * README: Remove note saying that -pie is not supported.
10301
10302 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10303
10304         * options.h (class General_options): Add -init and -fini.
10305         * layout.cc (Layout::finish_dynamic_section): Emit
10306         given init and fini functions.
10307
10308 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10309
10310         * gc.h (gc_process_relocs): Check if icf is enabled using new
10311         function.
10312         * gold.cc (queue_initial_tasks): Likewise.
10313         (queue_middle_tasks): Likewise.
10314         * object.cc (do_layout): Likewise.
10315         * symtab.cc (is_section_folded): Likewise.
10316         * main.cc (main): Likewise.
10317         * reloc.cc (Read_relocs::run): Likewise.
10318         (Sized_relobj::do_scan_relocs): Likewise.
10319         * icf.cc (is_function_ctor_or_dtor): New function.
10320         (Icf::find_identical_sections): Check if function is ctor or dtor when
10321         safe icf is chosen.
10322         * options.h (General_options::icf): Change option to be an enum.
10323         (Icf_status): New enum.
10324         (icf_enabled): New method.
10325         (icf_safe_folding): New method.
10326         (set_icf_status): New method.
10327         (icf_status_): New variable.
10328         * (options.cc) (General_options::finalize): Set icf_status_.
10329         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10330         icf_test and icf_keep_unique_test to use the --icf enum flag.
10331         * testsuite/icf_safe_test.sh: New file.
10332         * testsuite/icf_safe_test.cc: New file.
10333
10334 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10335
10336         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10337         includes to gc.h and icf.h.
10338         * arm.cc: Include gc.h.
10339         * gold.cc: Likewise.
10340         * i386.cc: Likewise.
10341         * powerpc.cc: Likewise.
10342         * sparc.cc: Likewise.
10343         * x86_64.cc: Likewise.
10344         * gc.h: Include icf.h.
10345
10346 2009-10-11  Ian Lance Taylor  <iant@google.com>
10347
10348         * plugin.cc: Include "gold.h" before other header files.
10349
10350 2009-10-10  Chris Demetriou  <cgd@google.com>
10351
10352         * options.h (Input_file_argument::Input_file_type): New enum.
10353         (Input_file_argument::is_lib_): Replace with...
10354         (Input_file_argument::type_): New member.
10355         (Input_file_argument::Input_file_argument): Take Input_file_type
10356         'type' rather than boolean 'is_lib' as second argument.
10357         (Input_file_argument::is_lib): Use type_.
10358         (Input_file_argument::is_searched_file): New function.
10359         (Input_file_argument::may_need_search): Handle is_searched_file.
10360         * options.cc (General_options::parse_library): Support -l:filename.
10361         (General_options::parse_just_symbols): Update for Input_file_argument
10362         changes.
10363         (Command_line::process): Likewise.
10364         * archive.cc (Archive::get_file_and_offset): Likewise.
10365         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10366         * script.cc (read_script_file, script_add_file): Likewise.
10367         * fileread.cc (Input_file::Input_file): Likewise.
10368         (Input_file::will_search_for): Handle is_searched_file.
10369         (Input_file::open): Likewise.
10370         * readsyms.cc (Read_symbols::get_name): Likewise.
10371         * testsuite/Makefile.am (searched_file_test): New test.
10372         * testsuite/Makefile.in: Regenerate.
10373         * testsuite/searched_file_test.cc: New file.
10374         * testsuite/searched_file_test_lib.cc: New file.
10375
10376 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10377             Ian Lance Taylor  <iant@google.com>
10378
10379         * descriptor.cc: Include <cstdio> and "binary-io.h".
10380         (Descriptors::open): Open the files in binary mode always.
10381         * script.cc (Lex::get_token): Treat \r as whitespace.
10382
10383 2009-10-09  Ian Lance Taylor  <iant@google.com>
10384
10385         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10386
10387 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10388             Ian Lance Taylor  <iant@google.com>
10389
10390         * configure.ac: Check for readv function also.
10391         * fileread.cc (readv): Define if not HAVE_READV.
10392         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10393         does not exist.
10394         * config.in: Regenerate.
10395         * configure: Regenerate.
10396
10397 2009-10-09  Doug Kwan  <dougkwan@google.com>
10398
10399         * layout.cc (Layout::make_output_section): Call target hook to make
10400         ordinary output section.
10401         (Layout::finalize): Adjust parameter list of call the
10402         Target::may_relax().
10403         * layout.h (class Layout::section_list): New method.
10404         * merge.h (Output_merge_base::entsize): Change visibility to public.
10405         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10406         New methods.
10407         (Output_merge_string::do_is_string): New method.
10408         * object.cc (Sized_relobj::do_setup): renamed from
10409         Sized_relobj::set_up.
10410         * object.h (Sized_relobj::adjust_shndx,
10411         Sized_relobj::initializ_input_to_output_maps,
10412         Sized_relobj::free_input_to_output_maps): Change visibilities to
10413         protected.
10414         (Sized_relobj::setup): Virtualize.
10415         (Sized_relobj::do_setup): New method declaration.
10416         (Sized_relobj::invalidate_section_offset,
10417         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10418         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10419         * options.cc (parse_int): New function.
10420         * options.h (parse_int): New declaration.
10421         (DEFINE_int): New macro.
10422         (stub_group_size): New option.
10423         * output.cc (Output_section::Output_section): Initialize memebers
10424         merge_section_map_, merge_section_by_properties_map_,
10425         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10426         (Output_section::add_input_section): Handled deferred code-fill
10427         generation and remove an old comment.
10428         (Output_section::add_relaxed_input_section): New method definition.
10429         (Output_section::add_merge_input_section): Use merge section by
10430         properties map to speed to search.  Update merge section maps
10431         as appropriate.
10432         (Output_section::build_relaxation_map): New method definition.
10433         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10434         Same.
10435         (Output_section::relax_input_section): Renamed to
10436         Output_section::convert_input_sections_to_relaxed_sections and change
10437         interface to take a vector of pointers to relaxed sections.
10438         (Output_section::find_merge_section,
10439         Output_section::find_relaxed_input_section): New method definitions.
10440         (Output_section::is_input_address_mapped,
10441         Output_section::output_offset, Output_section::output_address):
10442         Use output section data maps to speed up searching.
10443         (Output_section::find_starting_output_address): Add comments.
10444         (Output_section::do_write,
10445         Output_section::write_to_postprocessing_buffer): Do code-fill
10446         generation as appropriate.
10447         (Output_section::get_input_sections): Invalidate relaxed input section
10448         map.
10449         (Output_section::restore_states): Adjust type of checkpoint .
10450         Invalidate relaxed input section map.
10451         * output.h (Output_merge_base): New class declaration.
10452         (Input_section_specifier): New class defintion.
10453         (class Output_relaxed_input_section) Change base class to
10454         Output_section_data_build.
10455         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10456         base class initializer.
10457         (Output_section::add_relaxed_input_section): New method declaration.
10458         (Output_section::Input_section): Change visibility to protected.
10459         (Output_section::Input_section::relobj,
10460         Output_section::Input_section::shndx): Handle relaxed input sections.
10461         Output_section::input_sections) Change visibility to protected.  Also
10462         define overload to return a non-const pointer.
10463         (Output_section::Merge_section_properties): New class defintion.
10464         (Output_section::Merge_section_by_properties_map,
10465         Output_section::Output_section_data_by_input_section_map,
10466         Output_section::Relaxation_map): New types.
10467         (Output_section::relax_input_section): Rename method to
10468         Output_section::convert_input_sections_to_relaxed_sections and change
10469         interface to take a vector of relaxed section pointers.
10470         (Output_section::find_merge_section,
10471         Output_section::find_relaxed_input_section,
10472         Output_section::build_relaxation_map,
10473         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10474         New method declarations.
10475         (Output_section::merge_section_map_
10476         Output_section::merge_section_by_properties_map_,
10477         Output_section::relaxed_input_section_map_,
10478         Output_section::is_relaxed_input_section_map_valid_,
10479         Output_section::generate_code_fills_at_write_): New data members.
10480         * script-sections.cc
10481         (Output_section_element_input::set_section_addresses): Call
10482         current_data_size and addralign methods of relaxed input sections.
10483         (Orphan_output_section::set_section_addresses): Call current_data_size
10484         and addralign methods of relaxed input sections.
10485         * symtab.cc (Symbol_table::compute_final_value): Extract template
10486         from the body of Symbol_table::sized_finalize_symbol.
10487         (Symbol_table::sized_finalized_symbol): Call
10488         Symbol_table::compute_final_value.
10489         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10490         (Symbol_table::compute_final_value): New templated method declaration.
10491         * target.cc (Target::do_make_output_section): New method defintion.
10492         * target.h (Target::make_output_section): New method declaration.
10493         (Target::relax): Add more parameters for input objects, symbol table
10494         and layout.  Adjust call to do_relax.
10495         (Target::do_make_output_section): New method declaration.
10496         (Target::do_relax): Add parameters for input objects, symbol table
10497         and layout.
10498
10499 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10500
10501         * pread.c: Include stdio.h.
10502
10503 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10504
10505         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10506         defined.
10507
10508 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10509
10510         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10511         Change read_shndx type to unsigned int.
10512         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10513         int.
10514         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10515         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10516         Change read_shndx type to unsigned int.
10517         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10518         int.
10519         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10520         * layout.cc (Layout::create_symtab_sections): Cast the result of
10521         local_symcount * symsize to off_t in the gold_assert.
10522
10523 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10524
10525         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10526         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10527         R_ARM_BASE_ABS.
10528         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10529         (Arm_relocate_functions::thm_abs5): New function.
10530         (Arm_relocate_functions::abs12): New function.
10531         (Arm_relocate_functions::abs16): New function.
10532         (Arm_relocate_functions::base_abs): New function.
10533         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10534         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10535         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10536         R_ARM_BASE_ABS.
10537         (Scan::global): Likewise.
10538         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10539         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10540         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10541         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10542         R_ARM_BASE_ABS.
10543
10544 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10545
10546         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10547         (Arm_relocate_functions::movt_prel): New function.
10548         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10549         (Arm_relocate_functions::thm_movt_prel): New function.
10550         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10551         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10552         (Scan::global, Relocate::relocate): Likewise.
10553         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10554
10555 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10556
10557         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10558         Incremental_checker.
10559         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10560         unsigned int.
10561         (class Incremental_inputs_header): New class.
10562         (Incremental_inputs_header_writer): Edit comment.
10563         (Incremental_inputs_entry): New class.
10564         (Incremental_inputs_entry_writer): Edit comment.
10565         (Sized_incremental_binary::do_find_incremental_inputs_section):
10566         Add *strtab_shndx parameter, fill it.
10567         (Sized_incremental_binary::do_check_inputs): New method.
10568         (Incremental_checker::can_incrementally_link_output_file): Use
10569         Sized_incremental_binary::check_inputs.
10570         (Incremental_inputs::report_command_line): Save command line in
10571         command_line_.
10572         * incremental.h:
10573         (Incremental_binary::find_incremental_inputs_section): New
10574         method.
10575         (Incremental_binary::do_find_incremental_inputs_section): Add
10576         strtab_shndx parameter.
10577         (Incremental_binary::do_check_inputs): New pure virtual method.
10578         (Sized_incremental_binary::do_check_inputs): Declare.
10579         (Incremental_checker::Incremental_checker): Add incremental_inputs
10580         parameter, use it to initialize incremental_inputs_.
10581         (Incremental_checker::incremental_inputs_): New field.
10582         (Incremental_checker::command_line): New method.
10583         (Incremental_checker::inputs): New method.
10584         (Incremental_checker::command_line_): New field.
10585
10586 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10587
10588         * incremental.cc: Include <cstdarg> and "target-select.h".
10589         (vexplain_no_incremental): New function.
10590         (explain_no_incremental): New function.
10591         (Incremental_binary::error): New method.
10592         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10593         method.
10594         (make_sized_incremental_binary): New function.
10595         (open_incremental_binary): New function.
10596         (can_incrementally_link_file): Add checks if output is ELF and has
10597         inputs section.
10598         * incremental.h: Include "elfcpp_file.h" and "output.h".
10599         (Incremental_binary): New class.
10600         (Sized_incremental_binary): New class.
10601         (open_incremental_binary): Declare.
10602         * object.cc (is_elf_object): Use
10603         elfcpp::Elf_recognizer::is_elf_file.
10604         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10605         * output.h (Output_file::filesize): New method.
10606
10607 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10608
10609         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10610         New function.
10611         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10612         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10613         function.
10614         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10615         function.
10616         (Arm_relocate_functions::movw_abs_nc): New function.
10617         (Arm_relocate_functions::movt_abs): New function.
10618         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10619         (Arm_relocate_functions::thm_movt_abs): New function.
10620         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10621         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10622         (Scan::global): Likewise.
10623         (Relocate::relocate): Likewise.
10624         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10625
10626 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10627
10628         * arm.cc (Arm_relocate_functions::got_prel) New function.
10629         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10630         (Relocate::relocate): Likewise.
10631         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10632
10633 2009-10-06  Ian Lance Taylor  <iant@google.com>
10634
10635         * options.h (class General_options): Define
10636         split_stack_adjust_size parameter.
10637         * object.h (class Object): Add uses_split_stack_ and
10638         has_no_split_stack_ fields.  Add uses_split_stack and
10639         has_no_split_stack accessor functions.  Declare
10640         handle_split_stack_section.
10641         (class Reloc_symbol_changes): Define.
10642         (class Sized_relobj): Define Function_offsets.  Declare
10643         split_stack_adjust, split_stack_adjust_reltype, and
10644         find_functions.
10645         * object.cc (Object::handle_split_stack_section): New function.
10646         (Sized_relobj::do_layout): Call handle_split_stack_section.
10647         * dynobj.cc (Sized_dynobj::do_layout): Call
10648         handle_split_stack_section.
10649         * reloc.cc (Sized_relobj::relocate_sections): Call
10650         split_stack_adjust for executable sections in split_stack
10651         objects.  Pass reloc_map to relocate_section.
10652         (Sized_relobj::split_stack_adjust): New function.
10653         (Sized_relobj::split_stack_adjust_reltype): New function.
10654         (Sized_relobj::find_functions): New function.
10655         * target-reloc.h: Include "object.h".
10656         (relocate_section): Add reloc_symbol_changes parameter.  Change
10657         all callers.
10658         * target.h (class Target): Add calls_non_split method.  Declare
10659         do_calls_non_split virtual method.  Declare match_view and
10660         set_view_to_nop.
10661         * target.cc: Include "elfcpp.h".
10662         (Target::do_calls_non_split): New function.
10663         (Target::match_view): New function.
10664         (Target::set_view_to_nop): New function.
10665         * gold.cc (queue_middle_tasks): Give an error if mixing
10666         split-stack and non-split-stack objects with -r.
10667         * i386.cc (Target_i386::relocate_section): Add
10668         reloc_symbol_changes parameter.
10669         (Target_i386::do_calls_non_split): New function.
10670         * x86_64.cc (Target_x86_64::relocate_section): Add
10671         reloc_symbol_changes parameter.
10672         (Target_x86_64::do_calls_non_split): New function.
10673         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10674         parameter.
10675         * powerpc.cc (Target_powerpc::relocate_section): Add
10676         reloc_symbol_changes parameter.
10677         * sparc.cc (Target_sparc::relocate_section): Add
10678         reloc_symbol_changes parameter.
10679         * configure.ac: Call AM_CONDITIONAL for the default target.
10680         * configure: Rebuild.
10681         * testsuite/Makefile.am (TEST_AS): New variable.
10682         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10683         (check_DATA): Add split_i386 and split_x86_64 files.
10684         (SPLIT_DEFSYMS): Define.
10685         (split_i386_[1234n].o): New targets.
10686         (split_i386_[124]): New targets.
10687         (split_i386_[1234r].stdout): New targets.
10688         (split_x86_64_[1234n].o): New targets.
10689         (split_x86_64_[124]): New targets.
10690         (split_x86_64_[1234r].stdout): New targets.
10691         (MOSTLYCLEANFILES): Add new executables.
10692         * testsuite/split_i386.sh: New file.
10693         * testsuite/split_x86_64.sh: New file.
10694         * testsuite/split_i386_1.s: New file.
10695         * testsuite/split_i386_2.s: New file.
10696         * testsuite/split_i386_3.s: New file.
10697         * testsuite/split_i386_4.s: New file.
10698         * testsuite/split_i386_n.s: New file.
10699         * testsuite/split_x86_64_1.s: New file.
10700         * testsuite/split_x86_64_2.s: New file.
10701         * testsuite/split_x86_64_3.s: New file.
10702         * testsuite/split_x86_64_4.s: New file.
10703         * testsuite/split_x86_64_n.s: New file.
10704         * testsuite/testfile.cc (Target_test): Update relocation_section
10705         function.
10706         * testsuite/Makefile.in: Rebuild.
10707
10708 2009-10-06  Ian Lance Taylor  <iant@google.com>
10709
10710         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10711         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10712         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10713         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10714         the address on ldo_addrs_.
10715         (Target_i386::Relocate::fix_up_ldo): New function.
10716
10717 2009-10-06   Rafael Espindola  <espindola@google.com>
10718
10719         * plugin.cc (add_input_library): New.
10720         (Plugin::load): Add add_input_library to tv.
10721         (Plugin_manager::add_input_file): Add the is_lib argument.
10722         (add_input_file): Update call to Plugin_manager::add_input_file.
10723         (add_input_library): New.
10724         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10725
10726 2009-09-30  Doug Kwan  <dougkwan@google.com>
10727
10728         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10729         symbol and call Symbol::may_need_copy_reloc to determine if
10730         a copy reloc is needed.
10731         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10732         nocopyreloc is given in command line.
10733         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10734         given in command line.
10735         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10736         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10737         of the removed Target_i386::may_need_copy_reloc.
10738         * options.h (copyreloc): New option with default value false.
10739         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10740         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10741         instead of the removed Target_powerpc::may_need_copy_reloc.
10742         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10743         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10744         instead of the removed Target_sparc::may_need_copy_reloc.
10745         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10746         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10747         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10748         instead of the removed Target_x86_64::may_need_copy_reloc.
10749
10750 2009-09-30  Ian Lance Taylor  <iant@google.com>
10751
10752         * object.h (class Object): Remove target_ field, and target,
10753         sized_target, and set_target methods.
10754         (Object::sized_target): Remove.
10755         (class Sized_relobj): Update declarations.  Remove sized_target.
10756         * object.cc (Sized_relobj::setup): Remove target parameter.
10757         Change all callers.
10758         (Input_objects::add_object): Don't do anything with the target.
10759         (make_elf_sized_object): Add punconfigured parameter.  Change all
10760         callers.  Set or test parameter target.
10761         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10762         Change all callers.
10763         * parameters.cc (Parameters::set_target): Change parameter type to
10764         be non-const.
10765         (Parameters::default_target): Remove.
10766         (set_parameters_target): Change parameter type to be non-const.
10767         (parameters_force_valid_target): New function.
10768         (parameters_clear_target): New function.
10769         * parameters.h (class Parameters): Update declarations.  Remove
10770         default_target method.  Add sized_target and clear_target
10771         methods.  Change target_ to be non-const.
10772         (set_parameters_target): Update declaration.
10773         (parameters_force_valid_target): Declare.
10774         (parameters_clear_target): Declare.
10775         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10776         as NULL if we aren't searching.
10777         (Add_symbols::run): Don't check for compatible target.
10778         * fileread.cc (Input_file::open_binary): Call
10779         parameters_force_valid_target.
10780         * gold.cc (queue_middle_tasks): Likewise.
10781         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10782         set_target on object.
10783         * dynobj.h (class Sized_dynobj): Update declarations.
10784         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10785         make_elf_object returns NULL.
10786         (Archive::include_member): Don't check whether object target is
10787         compatible.
10788         * output.cc (Output_section::add_input_section): Get target from
10789         parameters.
10790         (Output_section::relax_input_section): Likewise.
10791         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10792         parameters.
10793         (Sized_relobj::do_scan_relocs): Likewise.
10794         (Sized_relobj::relocate_sections): Likewise.
10795         * resolve.cc (Symbol_table::resolve): Likewise.
10796         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10797         parameter.  Change all callers.
10798         (Symbol_table::add_from_object): Get target from parameters.
10799         (Symbol_table::add_from_relobj): Don't check object target.
10800         (Symbol_table::add_from_dynobj): Likewise.
10801         (Symbol_table::define_special_symbol): Get target from
10802         parameters.
10803         * symtab.h (class Symbol_table): Update declaration.
10804         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10805         parameter.  Change all callers.  Clear parameter target.
10806         (Binary_test): Test target here.
10807         * testsuite/object_unittest.cc (gold_testsuite): Remove
10808         target_test_pointer parameter.  Change all callers.
10809         (Object_test): Test target here.
10810
10811 2009-09-26  Ian Lance Taylor  <iant@google.com>
10812
10813         * testsuite/initpri1.c: Don't try to use constructor priorities if
10814         compiling with gcc before 4.3.
10815
10816 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10817
10818         * testsuite/retain_symbols_file_test.sh (check_present): Change
10819         output file name to retain_symbols_file_test.stdout.
10820         (check_absent): Likewise.
10821
10822 2009-09-18  Craig Silverstein  <csilvers@google.com>
10823
10824         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10825         * options.cc: Include <cerrno> and <fstream>.
10826         (General_options::finalize): Parse -retain-symbols-file tag.
10827         * options.h: New flag.
10828         (General_options): New method should_retain_symbol, new
10829         variable symbols_to_retain.
10830         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10831         should_retain_symbol map.
10832         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10833         * testsuite/Makefile.in: Regenerate.
10834         * testsuite/retain_symbols_file_test.sh: New file.
10835
10836 2009-09-18  Nick Clifton  <nickc@redhat.com>
10837
10838         * po/es.po: Updated Spanish translation.
10839
10840 2009-09-17  Doug Kwan  <dougkwan@google.com>
10841
10842         * debug.h (DEBUG_RELAXATION): New constant.
10843         (DEBUG_ALL): Add DEBUG_RELAXATION.
10844         (debug_string_to_enum): Add relaxation debug option.
10845         * layout.cc
10846         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10847         Layout::Relaxation_debug_check::read_sections,
10848         Layout::Relaxation_debug_check::read_sections): New method definitions.
10849         (Layout::Layout): Initialize data members
10850         record_output_section_data_from_scrips_,
10851         script_output_section_data_list_ and relaxation_debug_check_.
10852         (Layout::save_segments, Layout::restore_segments,
10853         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10854         Layout::relaxation_loop_body): New method definitions.
10855         (Layout::finalize): Support relaxation.  Move section layout code to
10856         Layout::relaxation_loop_body.
10857         (Layout::set_asection_address_from_script): Move code for orphan
10858         section placement out.
10859         (Layout::place_orphan_sections_in_script): New method definition.
10860         * layout.h (Output_segment_headers, Output_file_header):
10861         New forward class declarations.
10862         (Layout::~Layout): Define.
10863         (Layout::new_output_section_data_from_script): New method definition.
10864         (Layout::place_orphan_sections_in_script): New method declaration.
10865         (Layout::Segment_states): New type declaration.
10866         (Layout::save_segments, Layout::restore_segments,
10867         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10868         Layout::relaxation_loop_body): New method declarations.
10869         (Layout::Output_section_data_list): New type declaration.
10870         (Layout::Relaxation_debug_check): New class definition.
10871         (Layout::record_output_section_data_from_script_,
10872         Layout::script_output_section_data_list_, Layout::segment_states_,
10873         Layout::relaxation_debug_check_): New data members.
10874         * output.cc: (Output_section_headers::do_size): New method definition.
10875         (Output_section_headers::Output_section_headers): Move size
10876         computation to Output_section_headers::do_size.
10877         (Output_segment_headers::do_size): New method definition.
10878         (Output_file_header::Output_file_header): Move size computation to
10879         Output_file_header::do_size and call it.
10880         (Output_file_header::do_size): New method definition.
10881         (Output_data_group::Output_data_group): Adjust call to
10882         Output_section_data.
10883         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10884         (Output_symtab_xindex::do_write): Add array bound check.
10885         (Output_section::Input_section::print_to_mapfile): Handle
10886         RELAXED_INPUT_SECTION_CODE.
10887         (Output_section::Output_section): Initialize data member checkpoint_.
10888         (Output_section::~Output_section): Delete checkpoint object pointed
10889         by checkpoint_.
10890         (Output_section::add_input_section): Always add an Input_section if
10891         relaxing.
10892         (Output_section::add_merge_input_section): Add assert.
10893         (Output_section::relax_input_section): New method definition.
10894         (Output_section::set_final_data_size): Set load address to zero for
10895         an unallocated section.
10896         (Output_section::do_address_and_file_offset_have_reset_values):
10897         New method definition.
10898         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10899         Handle relaxed input section.
10900         (Output_section::sort_attached_input_sections): Checkpoint input
10901         section list lazily.
10902         (Output_section::get_input_sections): Change type of input_sections to
10903         list of Simple_input_section pointers.  Checkpoint input section list
10904         lazily.  Also handle relaxed input sections.
10905         (Output_section::add_input_section_for_script): Take a reference to
10906         a Simple_input_section object instead of Relobj pointer and section
10907         index as parameter.  Handle relaxed input sections.
10908         (Output_section::save_states, Output_section::restore_states): New
10909         method definitions.
10910         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10911         (Output_data::is_data_size_fixed): New method definition.
10912         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10913         if it is fixed.
10914         (Output_data::address_and_file_offset_have_reset_values): New method
10915         definition.
10916         (Output_data::do_address_and_file_offset_have_reset_values): New method
10917         definition.
10918         (Output_data::set_data_size): Check that data size is not fixed.
10919         (Output_data::fix_data_size): New method definition.
10920         (Output_data::is_data_size_fixed_): New data member.
10921         (Output_section_headers::set_final_data_size): New method definition.
10922         (Output_section_headers::do_size): New method declaration.
10923         (Output_segment_headers::set_final_data_size): New method definition.
10924         (Output_segment_headers::do_size): New method declaration.
10925         (Output_file_header::set_final_data_size)::New method definition.
10926         (Output_file_header::do_size)::New method declaration.
10927         (Output_section_data::Output_section_data): Add new parameter
10928         is_data_size_fixed and use it to fix data size.
10929         (Output_data_const::Output_data_const): Adjust call to base class
10930         constructor and fix data size.
10931         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10932         base class constructor and fix data size.
10933         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10934         base class constructor and fix data size.
10935         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10936         class constructor and fix data size.
10937         (Output_data_group::set_final_data_size): New method definition.
10938         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10939         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10940         class constructor and fix data size.
10941         (Output_relaxed_input_section): New class definition.
10942         (Output_section::Simple_input_section): New class definition.
10943         (Output_section::get_input_sections): Adjust parameter list.
10944         (Output_section::add_input_section_for_script): Same.
10945         (Output_section::save_states, Output_section::restore_states,
10946         Output_section::do_address_and_file_offset_have_reset_values,
10947         (Output_section::Input_section::Input_section): Handle
10948         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10949         Output_relaxed_input_section.
10950         (Output_section::Input_section::is_input_section,
10951         Output_section::Input_section::set_output_section): Handle relaxed
10952         input section.
10953         (Output_section::Input_section::is_relaxed_input_section,
10954         Output_section::Input_section::output_section_data,
10955         Output_section::Input_section::relaxed_input_section): New method
10956         definitions.
10957         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10958         value.
10959         (Output_section::Input_section::u1_): Update comments.
10960         (Output_section::Input_section::u2_): Add new union member poris.
10961         (Output_section::Checkpoint_output_section): New classs definition.
10962         (Output_section::relax_input_section): New method declaration.
10963         (Output_section::checkpoint_): New data member.
10964         (Output_segment): Update comments.
10965         (Output_segment::Output_segment): Un-privatize copy constructor.
10966         (Output_segment::operator=): Un-privatize.
10967         * script-sections.cc (Output_section_element::Input_section_list):
10968         Change element type to Output_section::Simple_input_section.
10969         (Output_section_element_dot_assignment::set_section_addresses):
10970         Register output section data for relaxation clean up.
10971         (Output_data_exression::Output_data_expression): Adjust call to base
10972         constructor to fix data size.
10973         (Output_section_element_data::set_section_addresses): Register
10974         Output_data_expression object for relaxation clean up.
10975         (struct Input_section_info): Replace Relobj pointer and section index
10976         pair with Output_section::Simple_input_section and Convert struct to a
10977         class.
10978         (Input_section_sorter::operator()): Adjust access to
10979         Input_section_info data member to use accessors.
10980         (Output_section_element_input::set_section_addresses): Use layout
10981         parameter.  Adjust code to use Output_section::Simple_input_section
10982         and Input_secction_info classes.  Register filler for relaxation
10983         clean up.
10984         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10985         and section index pair with Output_section::Simple_input_section
10986         class.  Adjust code accordingly.
10987         (Phdrs_element::release_segment): New method definition.
10988         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10989         segment list.
10990         (Script_sections::release_segments): New method definition.
10991         * gold/script-sections.h (Script_sections::release_segments): New
10992         method declaration.
10993         * gold/target.h (Target::may_relax, Target::relax,
10994         Target::do_may_relax, Target::do_relax): New method definitions.
10995
10996 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10997
10998         * arm.cc (has_signed_unsigned_overflow): New function.
10999         (Arm_relocate_functions::abs8): New function.
11000         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11001         (Target_arm::Scan::global): Likewise.
11002         (Target_arm::relocate::relocate): Likewise.
11003         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11004         Likewise.
11005
11006 2009-09-16  Cary Coutant  <ccoutant@google.com>
11007
11008         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11009         * testsuite/Makefile.in: Regenerate.
11010
11011 2009-09-11  Nick Clifton  <nickc@redhat.com>
11012
11013         * po/gold.pot: Updated by the Translation project.
11014
11015 2009-09-08  Cary Coutant  <ccoutant@google.com>
11016
11017         * output.cc (Output_file::open): Add execute permission to empty file.
11018         * testsuite/Makefile.am (permission_test): New test.
11019         * testsuite/Makefile.in: Regenerate.
11020
11021 2009-09-02  Ian Lance Taylor  <iant@google.com>
11022
11023         * output.cc (Output_file::resize): Call map_no_anonymous rather
11024         than map.
11025
11026 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11027
11028         * gold.cc: Include "incremental.h".
11029         (queue_initial_tasks): Call Incremental_checker methods.
11030         * incremental.cc: Include "output.h".
11031         (Incremental_checker::can_incrementally_link_output_file): New
11032         method.
11033         * incremental.h (Incremental_checker): New class.
11034
11035         * output.cc (Output_file::open_for_modification): New method.
11036         (Output_file::map_anonymous): Changed return type to bool.  Record
11037         map in base_ field.
11038         (Output_file::map_no_anonymous): New method, broken out of map.
11039         (Output_file::map): Use map_no_anonymous and map_anonymous.
11040         * output.h (class Output_file): Update declarations.
11041
11042 2009-08-24  Cary Coutant  <ccoutant@google.com>
11043
11044         * options.h (Command_line::Pre_options): New class.
11045         (Command_line::pre_options): New member.
11046         * options.cc (gold::options::ready_to_register): New variable.
11047         (One_option::register_option): Do nothing if not registering options.
11048         Assert if same short option registered twice.
11049         (General_options::General_options): Turn off option registration when
11050         done constructing.
11051         (Command_line::Pre_options::Pre_options): New constructor.
11052
11053 2009-08-24  Cary Coutant  <ccoutant@google.com>
11054
11055         * options.h (General_options::no_keep_memory): Remove incorrect
11056         short option.
11057
11058 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11059
11060         * Makefile.am (am__skiplex, am__skipyacc): New.
11061         * Makefile.in: Regenerate.
11062
11063 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11064
11065         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11066         (INCLUDES): ... this.
11067         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11068         (AM_CPPFLAGS): Renamed from ...
11069         (INCLUDE): ... this.
11070         * Makefile.in, testsuite/Makefile.in: Regenerate.
11071
11072         * Makefile.in: Regenerate.
11073         * aclocal.m4: Likewise.
11074         * config.in: Likewise.
11075         * configure: Likewise.
11076         * testsuite/Makefile.in: Likewise.
11077
11078         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11079         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11080         * Makefile.in: Regenerate.
11081         * testsuite/Makefile.in: Regenerate.
11082
11083 2009-08-19  Cary Coutant  <ccoutant@google.com>
11084
11085         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11086         symbols in shared libraries overridden by hidden or internal symbols
11087         in the main program.
11088
11089 2009-08-19  Chris Demetriou  <cgd@google.com>
11090
11091         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11092         checking source file names in error messages.
11093
11094 2009-08-18  Doug Kwan  <dougkwan@google.com>
11095
11096         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11097         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11098         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11099         an elfcpp::Ehdr as parameter.
11100         * object.cc (Object::set_target): Remove the version that looks up
11101         a target and sets it.
11102         (Sized_relobj::setup): Take a Target object instead of
11103         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11104         (make_elf_sized_object): Find target and ask target to
11105         make an ELF object.
11106         * object.h: (Object::set_target): Remove the version that looks up
11107         a target and sets it.
11108         (Sized_relobj::setup): Take a Target object instead of
11109         an elfcpp:Ehdr as parameter.
11110         * target.cc: Include dynobj.h.
11111         (Target::do_make_elf_object_implementation): New.
11112         (Target::do_make_elf_object): New.
11113         * target.h (Target::make_elf_object): New template declaration.
11114         (Target::do_make_elf_object): New method declarations.
11115         (Target::do_make_elf_object_implementation): New template declaration.
11116
11117 2009-08-14  Ian Lance Taylor  <iant@google.com>
11118
11119         * gold.h (FUNCTION_NAME): Define.
11120         (gold_unreachable): Use FUNCTION_NAME.
11121
11122 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11123
11124         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11125         symbol in the --keep-unique list is not found.
11126
11127 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11128
11129         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11130         been maked as --keep-unique.
11131         (Icf::unfold_section): New function.
11132         * icf.h (Icf::unfold_section): New function.
11133         * options.h (General_options::keep_unique): New option.
11134         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11135         * testsuite/Makefile.in: Regenerate.
11136         * testsuite/icf_keep_unique_test.sh: New file.
11137         * testsuite/icf_keep_unique_test.cc: New file.
11138
11139 2009-08-12  Cary Coutant  <ccoutant@google.com>
11140
11141         PR 10471
11142         * resolve.cc (Symbol_table::resolve): Check for references from
11143         dynamic objects to hidden and internal symbols.
11144         * testsuite/Makefile.am (hidden_test.sh): New test.
11145         * testsuite/Makefile.in: Regenerate.
11146         * testsuite/hidden_test.sh: New script.
11147         * testsuite/hidden_test_1.c: New test source.
11148         * testsuite/hidden_test_main.c: New test source.
11149
11150 2009-08-11  Doug Kwan  <dougkwan@google.com>
11151
11152         * arm.cc: Update comments.
11153         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11154         segment to locate the .ARM.exidx section if present.
11155
11156 2009-08-09  Doug Kwan  <dougkwan@google.com>
11157
11158         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11159         patch.
11160
11161 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11162         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11163         compiler warnings.
11164
11165 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11166
11167         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11168         valid tls_segment only for non-debug-section relocations.
11169         * testsuite/Makefile.am: Add gc_tls_test.
11170         * testsuite/Makefile.in: Regenerate.
11171         * testsuite/gc_tls_test.cc: New file.
11172         * testsuite/gc_tls_test.sh: New file.
11173
11174 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11175
11176         * icf.cc: New file.
11177         * icf.h: New file.
11178         * Makefile.am (CCFILES): Add icf.cc.
11179         (HFILES): Add icf.h
11180         * Makefile.in: Regenerate.
11181         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11182         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11183         section, symbol and addend information for the relocs.
11184         * gold.cc (queue_middle_tasks): Call identical code folding.
11185         * gold.h: Add defines for multimap.
11186         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11187         to the call of finalize_local_symbols.
11188         * main.cc (main): Create object of class Icf.
11189         * object.cc (Sized_relobj::do_layout): Allow this function to be
11190         called twice during icf.
11191         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11192         to sections marked as identical by icf.
11193         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11194         when available.
11195         (Sized_relobj::do_section_entsize): New function.
11196         * object.h (Object::section_entsize): New function.
11197         (Object::do_section_entsize): New pure virtual function.
11198         (Relobj::finalize_local_symbols): Add new parameter.
11199         (Relobj::do_section_entsize): New function.
11200         * options.h (General_options::icf): New option.
11201         (General_options::icf_iterations): New option.
11202         (General_options::print_icf_sections): New option.
11203         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11204         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11205         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11206         icf.
11207         * symtab.cc (Symbol_table::is_section_folded): New function.
11208         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11209         to sections marked as identical by icf.
11210         * symtab.h (Symbol_table::set_icf): New function.
11211         (Symbol_table::icf): New function.
11212         (Symbol_table::is_section_folded): New function.
11213         (Symbol_table::icf_): New data member.
11214         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11215         * testsuite/Makefile.am: Add commands to build icf_test.
11216         * testsuite/Makefile.in: Regenerate.
11217         * testsuite/icf_test.sh: New file.
11218         * testsuite/icf_test.cc: New file.
11219
11220 2009-07-24  Chris Demetriou  <cgd@google.com>
11221
11222         * layout.cc (is_compressible_debug_section): Fix incorrect
11223         comment about compressed section names.
11224
11225 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11226
11227         PR 10419
11228         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11229
11230 2009-07-16  Ian Lance Taylor  <iant@google.com>
11231
11232         PR 10400
11233         * layout.h: #include <map>.
11234         (class Kept_section): Change from struct to class.  Add accessors
11235         and setters.  Add section size to Comdat_group mapping.  Change
11236         Comdat_group to std::map.  Add is_comdat_ field.  Add
11237         linkonce_size field in union.
11238         (class Layout): Update declaration of find_or_add_kept_section.
11239         Don't declare find_kept_object.
11240         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11241         parameter.  Add object, shndx, is_comdat, and is_group_name
11242         parameters.  Change all callers.  Adjust for new Kept_section.
11243         (Layout::find_kept_object): Remove.
11244         * object.cc (Sized_relobj::include_section_group): Update use of
11245         Kept_section.  Rename secnum to shndx.  Only record
11246         Kept_comdat_section if sections are the same size.
11247         (Sized_relobj::include_linkonce_section): Update use of
11248         Kept_section.  Only record Kept_comdat_section if sections are the
11249         same size.  Set size of linkonce section.
11250         (Sized_relobj::map_to_kept_section): Update call to
11251         get_kept_comdat_section.
11252         * object.h (class Sized_relobj): Rename fields in
11253         Kept_comdat_section to drop trailing underscores; change object
11254         field to Relobj*.  Change Kept_comdat_section_table to store
11255         struct rather than pointer.
11256         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11257         Add kept_object and kept_shndx parameters.  Change all callers.
11258         (Sized_relobj::get_kept_comdat_section): Change return type to
11259         bool.  Add kept_object and kept_shndx parameters.  Change all
11260         callers.
11261         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11262         Layout::find_or_add_kept_section.
11263
11264 2009-07-09  Ian Lance Taylor  <iant@google.com>
11265
11266         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11267         Reserve space in the hash table.
11268
11269 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11270
11271         * fileread.cc (File_read::get_mtime): New method.
11272         * fileread.h (Timespec): New structure.
11273         (File_read::get_mtime): New method.
11274         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11275         Renamed from timestamp_nsec.
11276         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11277         Elf_Xword.
11278         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11279         timestamp_nsec.
11280         (Incremental_inputs::report_archive): Save mtime; style fix.
11281         (Incremental_inputs::report_obejct): Save mtime; style fix.
11282         (Incremental_inputs::report_script): Save mtime; style fix.
11283         (Incremental_inputs::finalize_inputs): Style fix.
11284         (Incremental_inputs::finalize): Style fix.
11285         (Incremental_inputs::create_input_section_data): Store inputs
11286         mtime.
11287         * incremental.h (Incremental_inputs::report_script): Add mtime
11288         argument.
11289         (Incremental_inputs::Input_info::Input_info): Intialize only one
11290         union member.
11291         (Incremental_inputs::Input_info::archive): Move to nameless
11292         union.
11293         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11294         (Incremental_inputs::Input_info::script): Move to nameless union.
11295         (Incremental_inputs::mtime): New field.
11296         * script.cc (read_input_script): Pass file mtime to
11297         Incremental_input.
11298         * script.h (Script_info::inputs): Style fix.
11299
11300 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11301
11302         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11303         instead of 32.
11304
11305 2009-06-24  Ian Lance Taylor  <iant@google.com>
11306
11307         PR 10156
11308         * layout.cc (Layout::choose_output_section): If we find an
11309         existing section, update the flags.
11310         (Layout::create_notes): New function, broken out of
11311         Layout::finalize.
11312         (Layout::finalize): Don't create note sections.
11313         (Layout::create_note): Don't crash if linker script discards
11314         section.
11315         (Layout::create_gold_note): Likewise.
11316         (Layout::create_build_id): Likewise.  Don't set
11317         after_input_sections on the section.
11318         (Layout::create_executable_stack_info): Remove target parameter.
11319         Change caller.
11320         * layout.h (class Layout): Declare create_notes.  Update
11321         declaration of create_executable_stack_info.
11322         * gold.cc (queue_middle_tasks): Call create_notes.
11323         * output.cc (Output_section::update_flags_for_input_section): Move
11324         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11325         invalid.
11326         * output.h (Output_data::mark_address_invalid): New function.
11327         (class Output_section): Only declare, not define,
11328         update_flags_for_input_section.  Remove set_flags.
11329
11330 2009-06-24  Ian Lance Taylor  <iant@google.com>
11331
11332         * script-sections.cc (Output_section_definition::
11333         set_section_addresses): Rename shadowing local load_address to
11334         laddr.
11335
11336 2009-06-24  Ian Lance Taylor  <iant@google.com>
11337
11338         PR 10244
11339         * reloc.cc (relocate_sections): Skip empty relocation sections.
11340
11341 2009-06-23  Ian Lance Taylor  <iant@google.com>
11342
11343         PR 10156
11344         * layout.cc (Layout::create_note): Use choose_output_section
11345         rather than make_output_section.
11346
11347 2009-06-23  Ian Lance Taylor  <iant@google.com>
11348
11349         PR 10237
11350         * options.cc (General_options::parse_V): Set printed_version_.
11351         (General_options::General_options): Initialize printed_version_.
11352         * options.h (class General_options): Add printed_version_ field.
11353         * gold.cc (queue_initial_tasks): If there are no input files,
11354         don't give a fatal error if we printed the version information.
11355         (queue_middle_tasks): If using -r with a shared object, give a
11356         fatal error rather than an ordinary error.
11357
11358 2009-06-23  Ian Lance Taylor  <iant@google.com>
11359
11360         PR 10219
11361         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11362         (Layout::make_output_section): Set have_stabstr_section_ if we see
11363         a .stab*str section.
11364         (Layout::finalize): Call link_stabs_sections.
11365         (Layout::link_stabs_sections): New file.
11366         * layout.h (class Layout): Add have_stabstr_section_ field.
11367         Declare link_stabs_sections.
11368
11369 2009-06-23  Doug Kwan  <dougkwan@google.com>
11370
11371         * Makefile.am (libgold_a_LIBADD): New.
11372         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11373         * Makefile.in: Regenerate.
11374         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11375         * configure: Regenerate.
11376         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11377         * fileread.cc: Include sys/state.h
11378         * gold.h: Declare memmem and strndup if found missing.
11379         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11380
11381 2009-06-23  Ian Lance Taylor  <iant@google.com>
11382
11383         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11384         * configure: Rebuild.
11385
11386 2009-06-23  Ian Lance Taylor  <iant@google.com>
11387
11388         PR 10147
11389         * object.cc (Object::section_contents): Don't try to get a view if
11390         the section has length zero.
11391         (Object::handle_gnu_warning_section): If the section is empty, use
11392         the name of the section as the warning.
11393
11394 2009-06-23  Ian Lance Taylor  <iant@google.com>
11395
11396         PR 10133
11397         * stringpool.h (class Stringpool_template): Add optimize_ field.
11398         (Stringpool_template::set_optimize): New function.
11399         * stringpool.cc (Stringpool_template::Stringpool_template):
11400         Initialize optimize_ field.
11401         (Stringpool_template::set_string_offsets): Test local optimize
11402         fild rather than parameter.
11403         * layout.cc (Layout::Layout): Call set_optimize on the section
11404         name stringpool.
11405
11406 2009-06-22  Ian Lance Taylor  <iant@google.com>
11407
11408         PR 10030
11409         * yyscript.y: Parse TARGET.
11410         * script.cc (script_set_target): New function.
11411         * script-c.h (script_set_target): Declare.
11412         * options.cc (General_options::string_to_object_format): Rename
11413         from string_to_object_format in anonymous namespace.  Change
11414         callers.
11415         * options.h (class General_options): Declare
11416         string_to_object_format.
11417
11418 2009-06-22  Ian Lance Taylor  <iant@google.com>
11419
11420         * script-sections.cc (Script_sections::create_segments): Don't put
11421         program headers in a PT_LOAD segment if -n or -N.
11422
11423 2009-06-22  Ian Lance Taylor  <iant@google.com>
11424
11425         PR 10141
11426         * options.h (class General_options): Add -z lazy and -z now.  Sort
11427         -z options into alphabetical order.
11428         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11429
11430 2009-06-21  Ian Lance Taylor  <iant@google.com>
11431
11432         * layout.cc (Layout::make_output_section): Call
11433         Target::new_output_section.
11434         (Layout::attach_allocated_section_to_segment): Put large section
11435         sections in a separate load segment with the large segment flag
11436         set.
11437         (Layout::segment_precedes): Sort large data segments after other
11438         load segments.
11439         (align_file_offset): New static function.
11440         (Layout::set_segment_offsets): Use align_file_offset.
11441         * output.h (class Output_section): Add is_small_section_ and
11442         is_large_section_ fields.
11443         (Output_section::is_small_section): New function.
11444         (Output_section::set_is_small_section):  New function.
11445         (Output_section::is_large_section): New function.
11446         (Output_section::set_is_large_section): New function.
11447         (Output_section::is_large_data_section): New function.
11448         (class Output_segment): Add is_large_data_segment_ field.
11449         (Output_segment::is_large_data_segment): New function.
11450         (Output_segment::set_is_large_data_segment): New function.
11451         * output.cc (Output_section::Output_section): Initialize new
11452         fields.
11453         (Output_segment::Output_segment): Likewise.
11454         (Output_segment::add_output_section): Add assertion that large
11455         data sections always go in large data segments.  Force small data
11456         sections to the end of the list of data sections.  Force small BSS
11457         sections to the start of the list of BSS sections.  For large BSS
11458         sections to the end of the list of BSS sections.
11459         * symtab.h (class Symbol): Declare is_common_shndx.
11460         (Symbol::is_defined): Check Symbol::is_common_shndx.
11461         (Symbol::is_common): Likewise.
11462         (class Symbol_table): Define enum Commons_section_type.  Update
11463         declarations.  Add small_commons_ and large_commons_ fields.
11464         * symtab.cc (Symbol::is_common_shndx): New function.
11465         (Symbol_table::Symbol_table): Initialize new fields.
11466         (Symbol_table::add_from_object): Put small and large common
11467         symbols in the right list.
11468         (Symbol_table::sized_finalized_symbol): Check
11469         Symbol::is_common_shndx.
11470         (Symbol_table::sized_write_globals): Likewise.
11471         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11472         common symbol lists.  Don't call do_allocate_commons_list if the
11473         list is empty.
11474         (Symbol_table::do_allocate_commons_list): Remove is_tls
11475         parameter.  Add comons_section_type parameter.  Change all
11476         callers.  Handle small and large common symbols.
11477         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11478         Symbol::is_common_shndx.
11479         * resolve.cc (symbol_to_bits): Likewise.
11480         * target.h (Target::small_common_shndx): New function.
11481         (Target::small_common_section_flags): New function.
11482         (Target::large_common_shndx): New function.
11483         (Target::large_common_section_flags): New function.
11484         (Target::new_output_section): New function.
11485         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11486         small_common_section_flags, and large_common_section_flags
11487         fields.
11488         (Target::do_new_output_section): New virtual function.
11489         * arm.cc (Target_arm::arm_info): Initialize new fields.
11490         * i386.cc (Target_i386::i386_info): Likewise.
11491         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11492         Likewise.
11493         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11494         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11495         (Target_x86_64::do_new_output_section): New function.
11496         * configure.ac: Define conditional MCMODEL_MEDIUM.
11497         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11498         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11499         (large_LDFLAGS): Define.
11500         * testsuite/large.c: New file.
11501         * testsuite/testfile.cc (Target_test::test_target_info):
11502         Initialize new fields.
11503         * configure, testsuite/Makefile.in: Rebuild.
11504
11505 2009-06-05  Doug Kwan  <dougkwan@google.com>
11506
11507         * Makefile.am (CCFILES): Add target.cc.
11508         * Makefile.in: Regenerate.
11509         * i386.cc (class Target_i386): Define new virtual method to
11510         override do_is_local_label_name in parent.
11511         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11512         local symbols if --discard-locals or -X is given.
11513         * options.h (class General_options): Declare new options
11514         '--discard-locals' and '-X' for discarding locals.
11515         * target.h (class Target): Define new methods is_local_label_name.
11516         Declare new virtual method do_is_local_label_name.
11517         * target.cc: New file.
11518         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11519         (check_SCRIPTS): Add discard_locals_test.sh.
11520         (check_DATA): Add discard_local_tests.syms.
11521         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11522         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11523         * testsuite/Makefile.in: Regenerate.
11524         * testsuite/discard_locals_test.c: New file.
11525         * testsuite/discard_locals_test.sh: Same.
11526
11527 2009-06-05  Doug Kwan  <dougkwan@google.com>
11528
11529         * object.cc (Sized_relobj::Sized_relobj): Initialize
11530         discarded_eh_frame_shndx_ to -1U.
11531         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11532         section.
11533         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11534         a discarded .eh_frame section.
11535         (Sized_relobj::do_finalize_local_symbols): Ditto.
11536         * object.h (class Sized_relobj): Declare new member
11537         discarded_eh_frame_shndx_.
11538         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11539         (local_labels_test.o, local_labels_test): New rules.
11540         * testsuite/Makefile.in: Regenerate.
11541
11542 2009-06-04  Doug Kwan  <dougkwan@google.com>
11543
11544         * layout.cc (Layout::section_name_mapping): Add mapping for
11545         special ARM sections.
11546
11547 2009-06-03  Doug Kwan  <dougkwan@google.com>
11548
11549         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11550         (utils::has_overflow): Same.
11551
11552 2009-06-03  Ian Lance Taylor  <iant@google.com>
11553
11554         * layout.cc (Layout::section_name_mapping): New array, replacing
11555         Layout::linkonce_mapping.
11556         (Layout::section_name_mapping_count): New variable, replacing
11557         Layout::linkonce_mapping_count.
11558         (Layout::linkonce_output_name): Remove.
11559         (Layout::output_section_name): Rewrite.
11560         * layout.h (class Layout): Rename Linkonce_mapping to
11561         Section_name_mapping, linkonce_mapping to section_name_mapping,
11562         linkonce_mapping_count to section_name_mapping_count.  Don't
11563         declare linkonce_output_name.
11564
11565 2009-06-03  Doug Kwan  <dougkwan@google.com>
11566
11567         * gold/arm.cc (namespace utils): New.
11568         (Target_arm::reloc_is_non_pic): Define new method.
11569         (class Arm_relocate_functions): New.
11570         (Target_arm::Relocate::relocate): Handle relocation types used by
11571         Android.
11572
11573 2009-06-03  Ian Lance Taylor  <iant@google.com>
11574
11575         * arm.cc (Target_arm::scan::global): Use || instead of |.
11576
11577 2009-06-02  Doug Kwan  <dougkwan@google.com>
11578
11579         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11580         issued_non_pic_error_.
11581         (class Target_arm::Scan): Declare new method check_non_pic.
11582         Define new method symbol_needs_plt_entry.
11583         Declare new data member issued_non_pic_error_.
11584         (class Target_arm::Relocate): Declare new method
11585         should_apply_static_reloc.
11586         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11587         (Target_arm::Scan::check_non_pic): Define new method.
11588         (Target_arm::Scan::local): Handle a small subset of reloc types used
11589         by Android.
11590         (Target_arm::Scan::local): Same.
11591         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11592
11593 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11594
11595         * incremental.cc (Incremental_inputs::report_command_line): Filter
11596         out --incremental-* options.
11597
11598 2009-05-29  Doug Kwan  <dougkwan@google.com>
11599
11600         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11601         template class.
11602         (class Target_arm): Update comment.
11603         (Target_arm::Target_arm): Initialize new data members GOT_,
11604         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11605         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11606         and Target_arm::rel_dyn_section.
11607         Declare new_enum Target_arm::Got_type.
11608         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11609         and DYNBSS_.
11610         Update commments for member do_dynsym_value.
11611         (Target_arm::got_size, Target_arm::plt_section,
11612         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11613         new methods inside class defintion.
11614         (Target_arm::got_section): Define new method.
11615         (Target_arm::rel_dyn_section): Same.
11616         (Output_data_plt_arm): New template class.
11617         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11618         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11619         (Output_data_plt_arm::add_entry): Same.
11620         (Output_data_plt_arm::first_plt_entry): Define new
11621         static data member for PLT instruction template.
11622         (Output_data_plt_arm::plt_entry): Same.
11623         (Output_data_plt_arm::do_write): Define new method.
11624         (Target_arm::make_plt_entry): Same.
11625         (Target_arm::do_finalize_sections): Same.
11626         (Target_arm::do_dynsym_value): Same.
11627
11628 2009-05-28  Doug Kwan  <dougkwan@google.com>
11629
11630         * Makefile.am (TARGETSOURCES): Add arm.cc.
11631         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11632         * Makefile.in: Regenerate.
11633         * arm.cc: New file.
11634         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11635
11636 2009-05-26  Doug Kwan  <dougkwan@google.com>
11637
11638         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11639         (General_options::check_excluded_libs): Strip off directories in
11640         archive name before matching like GNU ld does.
11641         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11642         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11643         (exclude_libs_test_LDFLAGS): Add linker option
11644         -Wl,--exclude-libs,libexclude_libs_test_3
11645         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11646         an explicit archive without using -l.
11647         (alt/libexclude_libs_test_3.a): New make rule.
11648         * testsuite/Makefile.in: Regenerate.
11649         * testsuite/exclude_libs_test.c : Declare lib3_default().
11650         (main): Call it.
11651         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11652         * exclude_libs_test_3.c: New file.
11653
11654 2009-05-26  Nick Clifton  <nickc@redhat.com>
11655
11656         * po/id.po: New Indonesian translation.
11657         * po/gold.pot: Updated template file.
11658
11659 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11660
11661         * testsuite/Makefile.am: Add -ffunction-sections to compile
11662         gc_comdat_test files.  Add -Wl,--gc-sections to build
11663         gc_comdat_test.
11664         * testsuite/Makefile.in: Regenerate.
11665         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11666
11667 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11668
11669         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11670         kept comdat section was garbage collected.
11671         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11672         * testsuite/Makefile.in: Regenerate.
11673         * testsuite/gc_comdat_test.sh: New file.
11674         * testsuite/gc_comdat_test_1.cc: New file.
11675         * testsuite/gc_comdat_test_2.cc: New file.
11676
11677 2009-05-19  Doug Kwan  <dougkwan@google.com>
11678
11679         * archive.cc (Archive::Archive): Move constructor from archive.h
11680         to here.  Initialize no_export_.
11681         (Archive::get_elf_object_for_member): Set no_export flag of object.
11682         * archive.h (Archive::Archive): Move constructor body to
11683         archive.cc.
11684         (Archive::no_export): New method.
11685         (Archive::no_export_): New field.
11686         * object.h (Object::Object): Initialize no_export_ to false.
11687         (Object::no_export, Object::set_no_export): New methods.
11688         (Object::no_export_): New field.
11689         * options.cc (General_options::parse_exclude_libs): New method.
11690         (General_options::check_excluded_libs) Same.
11691         * options.h (exclude_libs): New option.
11692         (General_options::check_excluded_libs): New method declaration.
11693         (General_options::excluded_libs_): New field.
11694         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11695         default or protected visibility if an object has no-export flag set.
11696         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11697         (check_SCRIPTS): Add exclude_libs_test.sh.
11698         (check_DATA): Add exclude_libs_test.syms.
11699         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11700         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11701         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11702         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11703         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11704         libexclude_libs_test_2.a): New rules.
11705         * testsuite/Makefile.in: Regenerate.
11706         * testsuite/exclude_libs_test.c: New file.
11707         * testsuite/exclude_libs_test.sh: Ditto.
11708         * testsuite/exclude_libs_test_1.c: Ditto.
11709         * testsuite/exclude_libs_test_2.c: Ditto.
11710
11711 2009-05-15  Ian Lance Taylor  <iant@google.com>
11712
11713         * configure.ac: Check for declarations for cases where libiberty.h
11714         checks HAVE_DECL_xxx.
11715         * configure, config.in: Rebuild.
11716
11717 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11718
11719         * gold.h (Incremental_argument_list): Remove (invalid) forward
11720         declaration.
11721         * incremental.cc (Incremental_inputs::report_achive): New method.
11722         (Incremental_inputs::report_object): New method.
11723         (Incremental_inputs::report_script): New method.
11724         (Incremental_inputs::finalize_inputs): New method.
11725         (Incremental_inputs::finalize): Call finalize_inputs().
11726         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11727         Create inputs entries.
11728         * incremental.h (Incremental_input_type): New enum.
11729         (Incremental_inputs::Incremental_input): Initialize new fields.
11730         (Incremental_inputs::report_inputs): New method.
11731         (Incremental_inputs::report_achive): New method.
11732         (Incremental_inputs::report_object): New method.
11733         (Incremental_inputs::report_script): New method.
11734         (Incremental_inputs::finalize_inputs): New method.
11735         (Incremental_inputs::Input_info): New struct.
11736         (Incremental_inputs::Input_info_map): New typedef.
11737         (Incremental_inputs::lock_): New field.
11738         (Incremental_inputs::Inputs_): New field.
11739         (Incremental_inputs::Inputs_map): New field.
11740         * main.cc (main): Call Incremental_input::report_inputs.
11741         * options.h (Input_argument_list): Typedef moved from
11742         Input_arguments.
11743         (Input_file_group::Files): Remove, use ::Input_argument_list.
11744         (Input_file_group::Input_argument_list): Remove, use
11745         ::Input_argument_list.
11746         * plugin.cc (Plugin_manager::add_input_file): Add error in
11747         incremental build.
11748         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11749         functions.
11750         * script.cc (read_input_script): Call
11751         Incremental_input::report_script.
11752         * script.h (Script_info): New class.
11753
11754 2009-04-27  Ian Lance Taylor  <iant@google.com>
11755
11756         * x86_64.cc (do_adjust_output_section): Set entsize to
11757         plt_entry_size.
11758
11759 2009-04-23  Elliott Hughes  <enh@google.com>
11760
11761         * output.cc (Output_file::close): After short writes, continue
11762         writing from the correct offset in the buffer being written.
11763
11764 2009-04-23  Chris Demetriou  <cgd@google.com>
11765
11766         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11767         * configure: Regenerate.
11768         * config.in: Regenerate.
11769         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11770         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11771
11772 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11773
11774         * incremental.cc (Incremental_inputs_header_data): Renamed from
11775         Incremental_input_header_data.
11776         (Incremental_inputs_header_data::data_size): New field.
11777         (Incremental_inputs_header_data::put_input_file_count): Renamed
11778         from input_file_count.
11779         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11780         from command_line_offset.
11781         (Incremental_inputs_header_data::put_reserved): Renamed from
11782         put_reserved.
11783         (Incremental_inputs_entry_data): Renamed from
11784         Incremental_input_entry_data.
11785         (Incremental_inputs_entry_data::data_size): New field.
11786         (Incremental_inputs::report_command_line): New method.
11787         (Incremental_inputs::finalize): New method.
11788         (Incremental_inputs::create_incremental_inputs_data): New method.
11789         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11790         * incremental.h: New file.
11791         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11792         (Layout::finalize): Create incremental inputs section in
11793         incremental builds.
11794         (Layout::create_incremental_info_sections): New method.
11795         * layout.h (Layout::incremental_inputs): New method.
11796         (Layout::create_incremental_info_sections): New method.
11797         (Layout::incremental_inputs_): New field.
11798         * main.cc (main): Notify Incremental_input of the command line.
11799
11800 2009-04-01  Ian Lance Taylor  <iant@google.com>
11801             Mikolaj Zalewski  <mikolajz@google.com>
11802
11803         * gold.h (reserve_unordered_map): Define, three versions, one for
11804         each version of Unordered_map.
11805         * layout.cc (Layout::Layout): Remove options parameter.  Add
11806         number_of_input_files parameter.  Don't initialize options_.
11807         Initialize number_of_input_files_ and resized_signatures_.  Move
11808         sections_are_attached_.
11809         (Layout::layout_group): Reserve space for group_signatures_.
11810         (Layout::find_or_add_kept_section): Change name parameter to be a
11811         reference.  Resize signatures_ map when it gets large enough.
11812         (Layout::layout_eh_frame): Use parameters->options() instead of
11813         this->options_.
11814         (Layout::make_output_section): Likewise.
11815         (Layout::attach_allocated_section_to_segment): Likewise.
11816         (Layout::finalize, Layout::create_executable_stack): Likewise.
11817         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11818         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11819         * layout.h (class Layout): Update declarations.  Remove options_
11820         field.  Add number_of_input_files_ and resized_signatures_
11821         fields.  Move sections_are_attached_ field.
11822         * main.cc (main): Pass number of input files to Layout
11823         constructor.  Don't pass options.
11824
11825 2009-03-30  Ian Lance Taylor  <iant@google.com>
11826
11827         * ffsll.c (ffsll): Correct implementation.
11828
11829 2009-03-27  Ian Lance Taylor  <iant@google.com>
11830
11831         * ffsll.c: New file.
11832         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11833         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11834         * ftruncate.c (ftruncate): Declare before definition.
11835         * mremap.c (mremap): Likewise.
11836         * pread.c (pread): Likewise.
11837         * configure, Makefile.in, config.in: Rebuild.
11838
11839         * mremap.c: New file.
11840         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11841         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11842         (mremap): Declare if HAVE_MREMAP is not defined.
11843         * configure, Makefile.in, config.in: Rebuild.
11844
11845 2009-03-27  Cary Coutant  <ccoutant@google.com>
11846
11847         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11848         position independent.
11849         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11850         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11851
11852 2009-03-24  Cary Coutant  <ccoutant@google.com>
11853
11854         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11855         an executable.
11856         (needs_dynamic_reloc): Likewise.
11857
11858 2009-03-24  Ian Lance Taylor  <iant@google.com>
11859
11860         * yyscript.y (file_cmd): Recognize EXTERN.
11861         (extern_name_list, extern_name_list_body): New nonterminals.
11862         * script.cc (script_add_extern): Define.
11863         * script-c.h (script_add_extern): Declare.
11864
11865 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11866
11867         * object.cc (is_elf_object): Define.
11868         * object.h (is_elf_object): Declare.
11869         * archive.cc (Archive::get_elf_object_for_member): Call
11870         is_elf_object.
11871         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11872
11873 2009-03-24  Elliott Hughes  <enh@google.com>
11874
11875         * output.cc (Output_file::map_anonymous): Define.
11876         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11877         try an anonymous one.  Report the size if the mmap fails.
11878         * output.h (class Output_file): Declare map_anonymous.
11879
11880 2009-03-24  Ian Lance Taylor  <iant@google.com>
11881
11882         * target-select.cc (instantiate_target): Don't acquire the lock if
11883         the instantiated_target_ field has already been set.
11884
11885 2009-03-23  Ian Lance Taylor  <iant@google.com>
11886
11887         * gold-threads.h (class Initialize_lock): Define.
11888         * gold-threads.cc (class Initialize_lock_once): Define.
11889         (initialize_lock_control): New static variable.
11890         (initialize_lock_pointer): New static variable.
11891         (initialize_lock_once): New static function.
11892         (Initialize_lock::Initialize_lock): Define.
11893         (Initialize_lock::initialize): Define.
11894         * target-select.h: Include "gold-threads.h".
11895         (class Target_selector): Add lock_ and initialize_lock_ fields.
11896         Don't define instantiate_target, just declare it.
11897         * target-select.cc (Target_selector::Target_selector): Initialize
11898         new fields.
11899         (Target_selector::instantiate_target): Define.
11900         * descriptors.h: Include "gold-threads.h".
11901         (class Descriptors): Add initialize_lock_ field.
11902         * descriptors.cc (Descriptors::Descriptors): Initialize new
11903         field.
11904         (Descriptors::open): Use initialize_lock_ field
11905         * errors.h (class Errors): Add initialize_lock_ field.
11906         * errors.cc (Errors::Errors): Initialize new field.
11907         (Errors::initialize_lock): Use initialize_lock_ field.
11908         * powerpc.cc (class Target_selector_powerpc): Remove
11909         instantiated_target_ field.  In do_recognize call
11910         instantiate_target rather than do_instantiate_target.  In
11911         do_instantiate_target just allocate a new target.
11912         * sparc.cc (class Target_selector_sparc): Likewise.
11913
11914         * freebsd.h: New file.
11915         * i386.cc: Include "freebsd.h".
11916         (Target_i386): Derive from Target_freebsd rather than
11917         Sized_target.
11918         (Target_selector_i386): Derive from Target_selector_freebsd rather
11919         than Target_selector.
11920         * x86_64.cc: Include "freebsd.h".
11921         (Target_x86_64): Derive from Target_freebsd rather than
11922         Sized_target.
11923         (Target_selector_x86_64): Derive from Target_selector_freebsd
11924         rather than Target_selector.
11925         * target.h (class Target): Add adjust_elf_header and
11926         do_adjust_elf_header.
11927         * output.cc (Output_file_header:: do_sized_write): Call target
11928         adjust_elf_header routine.
11929         * configure.tgt: Set targ_osabi.
11930         * configure.ac: Define GOLD_DEFAULT_OSABI.
11931         * parameters.cc (Parameters::default_target): Pass
11932         GOLD_DEFAULT_OSABI to select_target.
11933         * target-select.h (class Target_selector): Make instantiate_target
11934         protected rather than private.
11935         * Makefile.am (HFILES): Add freebsd.h.
11936         * configure, Makefile.in, config.in: Rebuild.
11937
11938         * merge.cc (do_add_input_section): Correct pend value.  Change
11939         message about last entry not being null terminated from error to
11940         warning.
11941
11942 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11943
11944         * incremental.cc: New file.
11945         * Makefile.am (CCFILES): Add incremental.cc.
11946         * Makefile.in: Rebuild.
11947
11948 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11949
11950         * layout.cc (Layout::output_section_name): Preserve names
11951         of '.note.' sections.
11952
11953 2009-03-19  Ian Lance Taylor  <iant@google.com>
11954
11955         * descriptors.cc (Descriptors::open): Check that the options are
11956         valid before using them.
11957
11958 2009-03-18  Ian Lance Taylor  <iant@google.com>
11959
11960         * script-sections.h: Include <list>.
11961         (class Script_sections): Change Sections_elements from std::vector
11962         to std::list.  Typedef public Elements_iterator.  Add
11963         orphan_section_placement_, data_segment_align_start_, and
11964         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11965         field.
11966         * script-sections.cc (class Orphan_section_placement): New class.
11967         (class Sections_element): Add virtual functions is_relro and
11968         orphan_section_init.  Remove virtual function place_orphan_here.
11969         (class Output_section_definition): Add is_relro and
11970         orphan_section_init.  Remove place_orphan_here.
11971         (class Orphan_output_section): Likewise.
11972         (Script_sections::Script_sections): Update for field changes.
11973         (Script_sections::data_segment_align): Set saw_data_segment_align_
11974         and data_segment_align_start_, not data_segment_align_index.
11975         (Script_sections::data_segment_relro_end): Check
11976         saw_data_segment_align_.  Use data_segment_align_start_ rather
11977         than data_segment_align_index_.
11978         (Script_sections::place_orphan): Rewrite to use
11979         Orphan_section_placement.
11980
11981 2009-03-17  Ian Lance Taylor  <iant@google.com>
11982
11983         * archive.cc (Archive::add_symbols): Check for a version attached
11984         to the symbol name in the archive map.
11985         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11986         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11987         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11988         (ver_test_11.a): New target.
11989         * testsuite/Makefile.in: Rebuild.
11990
11991         * configure.ac: Check for chsize and posix_fallocate.  Replace
11992         ftruncate.
11993         * ftruncate.c: New file, from gnulib.
11994         * output.cc (posix_fallocate): Define dummy version if not
11995         HAVE_POSIX_FALLOCATE.
11996         (Output_file::map): Call posix_fallocate rather than lseek and
11997         write.
11998         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11999         * configure, Makefile.in, config.in: Rebuild.
12000
12001 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12002
12003         * layout.h (Layout::create_note): Add section_name parameter.
12004         * layout.cc (Layout::create_note): Likewise.
12005         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12006
12007 2009-03-17  Ian Lance Taylor  <iant@google.com>
12008
12009         * descriptors.cc: Include "options.h".
12010         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12011         (Descriptors::open): Always use O_CLOEXEC when opening a new
12012         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12013         then set FD_CLOEXEC.
12014
12015         * sparc.cc (class Target_sparc): Add has_got_section.
12016         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12017         make sure we have a GOT section.
12018
12019         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12020         (Target_sparc::Scan::local): Likewise.
12021         (Target_sparc::Scan::global): Likewise.
12022         (Target_sparc::Relocate::relocate): Likewise.
12023         (Target_sparc::Relocate::relocate_tls): Likewise.
12024
12025         * symtab.cc (Symbol_table::define_default_version): New function,
12026         broken out of add_from_object.
12027         (Symbol_table::add_from_object): Call define_default_version.
12028         (Symbol_table::define_special_symbol): Add resolve_oldsym
12029         parameter.  Change all callers.  If the version for a symbol comes
12030         from a version script, resolve it with the symbol with the same
12031         name with no version.  Also add the symbol without a version if
12032         appropriate.
12033         (do_define_in_output_data): If resolving with oldsym, don't delete
12034         sym.
12035         (do_define_in_output_segment): Likewise.
12036         (do_define_as_constant): Likewise.
12037         * symtab.h (class Symbol_table): Update declarations.
12038
12039 2009-03-13  Ian Lance Taylor  <iant@google.com>
12040
12041         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12042         (Read_symbols::requeue): New function.
12043         (Read_symbols::do_read_symbols): If make_elf_object fails because
12044         the target type is not configured, and the file was searched for,
12045         issue a warning and retry with the next directory.
12046         (Add_symbols::run): If the file has an incompatible format, and
12047         it was searched for, requeue the Read_symbols task.  On error,
12048         release the object.
12049         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12050         dirindex parameter to constructor.  Change all callers.  Declare
12051         incompatible_warning and requeue.
12052         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12053         input_argument_ and input_group_ fields.  Add them to
12054         constructor.  Change all callers.
12055         (class Read_script): Add dirindex_ field.  Add it to constructor.
12056         Change all callers.
12057         * archive.cc (Archive::setup): Remove input_objects parameter.
12058         Change all callers.
12059         (Archive::get_file_and_offset): Likewise.
12060         (Archive::read_all_symbols): Likewise.
12061         (Archive::read_symbols): Likewise.
12062         (Archive::get_elf_object_for_member): Remove input_objects
12063         parameter.  Add punconfigured parameter.  Change all callers.
12064         (Archive::add_symbols): Change return type to bool.  Check return
12065         value of include_member.
12066         (Archive::include_all_members): Likewise.
12067         (Archive::include_member): Change return type to bool.  Return
12068         false if first included object has incompatible target.  Set
12069         included_member_ field.
12070         (Add_archive_symbols::run): If add_symbols returns false, requeue
12071         Read_symbols task.
12072         * archive.h (class Archive): Add included_member_ field.
12073         Initialize it in constructor.  Add input_file and searched_for
12074         methods.  Update declarations.
12075         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12076         input_argument_ fields.  Add them to constructor.  Change all
12077         callers.
12078         * script.cc: Include "target-select.h".
12079         (class Parser_closure): Add skip_on_incompatible_target_ and
12080         found_incompatible_target_ fields.  Add
12081         skip_on_incompatible_target parameter to constructor.  Change all
12082         callers.  Add methods skip_on_incompatible_target,
12083         clear_skip_on_incompatible_target, found_incompatible_target, and
12084         set_found_incompatible_target.
12085         (read_input_script): Add dirindex parameter.  Change all callers.
12086         If parser finds an incompatible target, requeue Read_symbols
12087         task.
12088         (script_set_symbol): Clear skip_on_incompatible_target in
12089         closure.
12090         (script_add_assertion, script_parse_option): Likewise.
12091         (script_start_sections, script_add_phdr): Likewise.
12092         (script_check_output_format): New function.
12093         * script.h (read_input_script): Update declaration.
12094         * script-c.h (script_check_output_format): Declare.
12095         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12096         (ignore_cmd): Remove OUTPUT_FORMAT.
12097         * fileread.cc (Input_file::Input_file): Add explicit this.
12098         (Input_file::will_search_for): New function.
12099         (Input_file::open): Add pindex parameter.  Change all callers.
12100         * fileread.h (class Input_file): Add input_file_argument method.
12101         Declare will_search_for.  Update declarations.
12102         * object.cc (make_elf_object): Add punconfigured parameter.
12103         Change all callers.
12104         * object.h (class Object): Make input_file public.  Add
12105         searched_for method.
12106         (make_elf_object): Update declaration.
12107         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12108         restart search.
12109         * dirsearch.h (class Dirsearch): Update declaration.
12110         * options.h (class General_options): Add --warn-search-mismatch.
12111         * parameters.cc (Parameters::is_compatible_target): New function.
12112         * parameters.h (class Parameters): Declare is_compatible_target.
12113         * workqueue.cc (Workqueue::add_blocker): New function.
12114         * workqueue.h (class Workqueue): Declare add_blocker.
12115
12116         * fileread.cc (Input_file::open): Remove options parameter.
12117         Change all callers.
12118         (Input_file::open_binary): Likewise.
12119         * script.cc (read_input_script): Likewise.
12120         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12121         options parameter from constructor.  Change all callers.
12122         (class Read_script): Likewise.
12123         * fileread.h (class Input_file): Update declarations.
12124         * script.h (read_input_script): Update declaration.
12125
12126 2009-03-10  Nick Clifton  <nickc@redhat.com>
12127
12128         * po/es.po: New Spanish translation.
12129
12130 2009-03-06  Cary Coutant  <ccoutant@google.com>
12131
12132         * options.cc (parse_short_option): Keep dash_z from registering itself.
12133
12134 2009-03-03  Ian Lance Taylor  <iant@google.com>
12135
12136         PR 9918
12137         * target-reloc.h (relocate_section): Pass output_section to
12138         relocate.
12139         * i386.cc (Target_i386::should_apply_static_reloc): Add
12140         output_section parameter.  Change all callers.
12141         (Target_i386::Relocate::relocate): Add output_section parameter.
12142         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12143         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12144         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12145         * testsuite/two_file_shared.sh: New script.
12146         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12147         (check_DATA): Add two_file_shared.dbg.
12148         (two_file_shared.dbg): New target.
12149         * testsuite/Makefile.in: Rebuild.
12150
12151 2009-03-01  Ian Lance Taylor  <iant@google.com>
12152
12153         * configure.ac: Check for byteswap.h.
12154         * configure: Rebuild.
12155         * config.in: Rebuild.
12156
12157 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12158
12159         * layout.cc (Layout::find_or_add_kept_section): New function.
12160         (Layout::add_comdat): Removed.
12161         * layout.h (struct Kept_section): Move out of class Layout.
12162         Remove trailing underscores from field names.  Add group_sections
12163         field.  Rename group_ field to is_group.  Change all uses.
12164         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12165         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12166         comdat_groups_ field.
12167         (Sized_relobj::include_section_group): Use
12168         find_or_add_kept_section and Kept_section::group_sections.
12169         (Sized_relobj::include_linkonce_section): Likewise.
12170         * object.cc (class Sized_relobj): Don't define Comdat_group or
12171         Comdat_group_table.  Remove find_comdat_group and
12172         add_comdat_group.  Remove comdat_groups_ field.
12173         * plugin.cc (include_comdat_group): Use
12174         Layout::find_or_add_kept_section.
12175
12176 2009-02-28  Ian Lance Taylor  <iant@google.com>
12177
12178         * README: --gc-sections and map files are now supported.  Document
12179         some build requirements.
12180
12181         PR 6992
12182         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12183         relocatable link set the value of the section symbol to zero.
12184         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12185         relocatable link don't include the section address in the local
12186         symbol value.
12187
12188 2009-02-27  Ian Lance Taylor  <iant@google.com>
12189
12190         PR 6811
12191         * options.h (class Search_directory): Add is_system_directory.
12192         (class General_options): Declare is_in_system_directory.
12193         * options.cc (get_relative_sysroot): Make static.
12194         (get_default_sysroot): Make static.
12195         (General_optoins::is_in_system_directory): New function.
12196         * fileread.cc (Input_file::is_in_system_directory): New function.
12197         * fileread.h (class Input_file): Declare is_in_system_directory.
12198         * object.h (class Object): Add is_in_system_directory.
12199         (class Input_objects): Remove system_library_directory_ field.
12200         * object.cc (Input_objects::add_object): Don't set
12201         system_library_directory_.
12202         (input_objects::found_in_system_library_directory): Remove.
12203         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12204         parameter.  Change all callers.
12205         (Symbol_table::sized_write_globals): Likewise.
12206         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12207         Call Object::is_in_system_directory.
12208         * symtab.h (class Symbol_table): Update declarations.
12209
12210         PR 5990
12211         * descriptors.h (Open_descriptor): Add is_on_stack field.
12212         * descriptors.cc (Descriptors::open): If the descriptor is on the
12213         top of the stack, remove it.  Initialize is_on_stack field.
12214         (Descriptors::release): Only add pod to stack if it is not on the
12215         stack already.
12216         (Descriptors::close_some_descriptor): Clear stack_next and
12217         is_on_stack fields.
12218
12219         PR 7091
12220         * output.cc (Output_section::find_starting_output_address): Rename
12221         from starting_output_address; add PADDR parameter; change return
12222         type.
12223         * output.h (class Output_section): Declare
12224         find_starting_output_address instead of starting_output_address.
12225         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12226         section symbol for which we can't find a merge section.
12227
12228         PR 9836
12229         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12230         hidden or internal, force the symbol to be local.
12231         * resolve.cc (Symbol::override_visibility): Define.
12232         (Symbol::override_base): Use override_visibility.
12233         (Symbol_table::resolve): Likewise.
12234         (Symbol::override_base_with_special): Likewise.
12235         (Symbol_table::override_with_special): If the visibility is hidden
12236         or internal, force the symbol to be local.
12237         * symtab.h (class Symbol): Add set_visibility and
12238         override_visibility.
12239         * testsuite/ver_test_1.sh: New file.
12240         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12241         (check_DATA): Add ver_test_1.syms.
12242         (ver_test_1.syms): New target.
12243         * testsuite/Makefile.in: Rebuild.
12244
12245 2009-02-25  Cary Coutant  <ccoutant@google.com>
12246
12247         * layout.cc (Layout::choose_output_section): Don't rename sections
12248         when using a linker script that has a SECTIONS clause.
12249         * Makefile.in: Regenerate.
12250
12251         * testsuite/Makefile.am (script_test_5.sh): New test case.
12252         * testsuite/Makefile.in: Regenerate.
12253         * testsuite/script_test_5.cc: New file.
12254         * testsuite/script_test_5.sh: New file.
12255         * testsuite/script_test_5.t: New file.
12256
12257 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12258
12259         * archive.cc (Archive::include_member): Update calls to add_symbols.
12260         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12261         the Layout argument.
12262         * dynobj.h (do_add_symbols): Add the Layout argument.
12263         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12264         Layout argument.
12265         * object.h (Object::add_symbols): Add the Layout argument.
12266         (Object::do_add_symbols): Add the Layout argument.
12267         (Sized_relobj::do_add_symbols): Add the Layout argument.
12268         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12269         Unify the two versions.
12270         (Add_plugin_symbols): Remove.
12271         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12272         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12273         (Add_plugin_symbols): Remove.
12274         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12275         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12276         (Add_symbols::run): Make it work with Pulginobj.
12277
12278 2009-02-06  Ian Lance Taylor  <iant@google.com>
12279
12280         * object.cc (Sized_relobj::do_layout): Make info message start
12281         with lower case letter.
12282
12283 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12284
12285         * binary.cc: Fix file comment.
12286
12287         * options.h (enum Incremental_disposition): Define.
12288         (class General_options): Add new options: --incremental,
12289         --incremental_changed, --incremental_unchanged,
12290         --incremental_unknown.  Add incremental_disposition_ and
12291         implicit_incremental_ fields.
12292         (General_options::incremental_disposition): New function.
12293         (class Position_dependent_options): Add incremental_disposition
12294         option.
12295         (Position_dependent_options::copy_from_options): Set incremental
12296         dispositions.
12297         * options.cc (General_options::parse_incremental_changed): New
12298         function.
12299         (General_options::parse_incremental_unchanged): New function.
12300         (General_options::parse_incremental_unknown): New function.
12301         (General_options::General_options): Initialize new fields
12302         incremental_disposition_ and implicit_incremental_.
12303         (General_options::finalize): Check for uasge of --incremental-*
12304         without --incremental.
12305
12306 2009-02-06  Chris Demetriou  <cgd@google.com>
12307
12308         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12309         pointer and to report location as the file name associated with
12310         the symbol.
12311         (gold_undefined_symbol_at_location): New function to replace the
12312         old gold_undefined_symbol functionality.
12313         * target-reloc.h (relocate_section): Update to use
12314         gold_undefined_symbol_at_location.
12315         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12316         Call gold_undefined_symbol function rather than gold_error.
12317         * errors.h (Errors::undefined_symbol): Take location as a
12318         string, rather than calculating it from a relocation.
12319         * errors.cc (Errors::fatal): Print "fatal error:" before the
12320         formatted message.
12321         (Errors::error, Errors::error_at_location): Print "error: "
12322         before the formatted message.
12323         (Errors::undefined_symbol): Take location as a string, rather
12324         than calculating it from a relocation.
12325         (gold_undefined_symbol_at_location): New function akin to
12326         old gold_undefined_symbol, calculates location from relocation.
12327         (gold_undefined_symbol): Change to take only a Symbol pointer
12328         and to report location as the file name associated with the symbol.
12329         * testsuite/debug_msg.sh: Update for changed error messages.
12330         * testsuite/undef_symbol.sh: Likewise.
12331
12332 2009-02-04  Duncan Sands  <baldrick@free.fr>
12333
12334         PR 9812
12335         * reduced_debug_output.h
12336         (Output_reduced_debug_abbrev_section::failed): Use format for
12337         gold_warning.
12338         (Output_reduced_debug_info_section::faild): Likewise.
12339
12340 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12341
12342         * script.cc (Lazy_demangler): New class.
12343         (Version_script_info::get_symbol_version_helper): Demangle a
12344         symbol only once.
12345
12346 2009-01-29  Cary Coutant  <ccoutant@google.com>
12347
12348         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12349         to __tls_get_addr.
12350         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12351
12352 2009-01-28  Ian Lance Taylor  <iant@google.com>
12353
12354         * version.cc (version_string): Bump to 1.9.
12355
12356         * gold.h: Include <cstring> and <stdint.h>.
12357         * version.cc: Include <cstdio>.
12358         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12359         warning.
12360         * reduced_debug_output.cc (insert_into_vector): Rename from
12361         Insert_into_vector; change all callers.  Use Swap_unaligned to
12362         avoid aliasing issue; remove union since it is unnecessary.
12363
12364 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12365
12366         * Makefile.am (CCFILES): Add gc.cc.
12367         (HFILES): Add gc.h.
12368         * Makefile.in: Regenerate.
12369         * gold.cc (Gc_runner): New class.
12370         (queue_initial_tasks): Call garbage collection related tasks
12371         when corresponding options are invoked.
12372         (queue_middle_gc_tasks): New function.
12373         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12374         processed early before laying out sections during garbage collection.
12375         * gold.h (queue_middle_gc_tasks): New function.
12376         (is_prefix_of): Move from "layout.cc".
12377         * i386.cc (Target_i386::gc_process_relocs): New function.
12378         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12379         * main.cc (main): Create object of class "Garbage_collection".
12380         * object.cc (Relobj::copy_symbols_data): New function.
12381         (Relobj::is_section_name_included): New function.
12382         (Sized_relobj::do_layout): Allow this function to be called twice
12383         during garbage collection and defer layout of section during the
12384         first call.
12385         * object.h (Relobj::get_symbols_data): New function.
12386         (Relobj::is_section_name_included): New function.
12387         (Relobj::copy_symbols_data): New function.
12388         (Relobj::set_symbols_data): New function.
12389         (Relobj::get_relocs_data): New function.
12390         (Relobj::set_relocs_data): New function.
12391         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12392         (Relobj::gc_process_relocs): New function.
12393         (Relobj::do_gc_process_relocs): New pure virtual function.
12394         (Relobj::sd_): New data member.
12395         (Sized_relobj::is_output_section_offset_invalid): New function.
12396         (Sized_relobj::do_gc_process_relocs): New function.
12397         * options.h (General_options::gc_sections): Modify to not be a no-op.
12398         (General_options::print_gc_sections): New option.
12399         * plugin.cc (Plugin_finish::run): Remove function call to
12400         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12401         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12402         * reloc.cc (Read_relocs::run): Add task to process relocs and
12403         determine unreferenced sections when doing garbage collection.
12404         (Gc_process_relocs): New class.
12405         (Sized_relobj::do_gc_process_relocs): New function.
12406         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12407         sections that are garbage collected.
12408         * reloc.h (Gc_process_relocs): New class.
12409         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12410         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12411         symbols whose corresponding sections are garbage collected.
12412         (Symbol_table::Symbol_table): Add new parameter for the garbage
12413         collection object.
12414         (Symbol_table::gc_mark_undef_symbols): New function.
12415         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12416         (Symbol_table::gc_mark_dyn_syms): New function.
12417         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12418         as garbage.
12419         (Symbol_table::add_from_object): Likewise.
12420         (Symbol_table::add_from_relobj): When building shared objects, do not
12421         treat externally visible symbols as garbage.
12422         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12423         table information for static and relocatable links.
12424         * symtab.h (Symbol_table::set_gc): New function.
12425         (Symbol_table::gc): New function.
12426         (Symbol_table::gc_mark_undef_symbols): New function.
12427         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12428         (Symbol_table::gc_mark_dyn_syms): New function.
12429         (Symbol_table::gc_): New data member.
12430         * target.h (Sized_target::gc_process_relocs): New pure virtual
12431         function.
12432         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12433         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12434
12435 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12436
12437         * options.h (General_options::gc_sections): Define as a no-op for now.
12438         (General_options::no_keep_memory): Ditto.
12439         (General_options::Bshareable): Define.
12440         * options.cc (General_options::finalize): Honor -Bshareable.
12441
12442 2009-01-20  Andreas Schwab  <schwab@suse.de>
12443
12444         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12445         read the value in the contents, since we don't use it.  Use the
12446         template endianness when writing.
12447         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12448
12449 2009-01-19  Andreas Schwab  <schwab@suse.de>
12450
12451         * configure.tgt (powerpc64-*): Fix targ_obj.
12452
12453 2009-01-15  Ian Lance Taylor  <iant@google.com>
12454
12455         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12456         local symbols when stripping all symbols.
12457
12458 2009-01-14  Cary Coutant  <ccoutant@google.com>
12459
12460         * output.cc (Output_reloc): Add explicit instantiations.
12461
12462 2009-01-14  Cary Coutant  <ccoutant@google.com>
12463
12464         * archive.cc (Archive::get_elf_object_for_member): Remove call
12465         to File_read::claim_for_plugin.
12466         * descriptors.cc (Descriptors::open): Remove reference to
12467         is_claimed.
12468         (Descriptors::claim_for_plugin): Remove.
12469         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12470         (Descriptors::is_claimed): Remove.
12471         (claim_descriptor_for_plugin): Remove.
12472         * fileread.cc (File_read::claim_for_plugin): Remove.
12473         * fileread.h (File_read::claim_for_plugin): Remove.
12474         (File_read::descriptor): Reopen descriptor if necessary.
12475         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12476         (Plugin_manager::all_symbols_read): Add task parameter. Change
12477         all callers.
12478         (Plugin_manager::get_input_file): New function.
12479         (Plugin_manager::release_input_file): New function.
12480         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12481         corresponding data member.
12482         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12483         and pass to base constructor. Change all callers.
12484         (get_input_file, release_input_file): New functions.
12485         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12486         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12487         (Plugin_manager::all_symbols_read): Add task parameter.
12488         (Plugin_manager::get_input_file): New function.
12489         (Plugin_manager::release_input_file): New function.
12490         (Plugin_manager::task_): New data member.
12491         (Pluginobj::Pluginobj): Add filesize parameter.
12492         (Pluginobj::filename): New function.
12493         (Pluginobj::descriptor): New function.
12494         (Pluginobj::filesize): New function.
12495         (Pluginobj::filesize_): New data member.
12496         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12497         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12498         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12499
12500         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12501         with archive libraries.
12502         * testsuite/Makefile.in: Regenerate.
12503         * testsuite/plugin_test.c (struct sym_info): New type.
12504         (get_input_file, release_input_file): New static variables.
12505         (onload): Capture new transfer vector entries.
12506         (claim_file_hook): Stop reading at end of file according to filesize.
12507         Factor out parsing of readelf output into separate function.
12508         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12509         APIs and get the source file name from the symbol table.  Convert
12510         source file name to corresponding object file name.  Print info
12511         message when adding new input files.
12512         (parse_readelf_line): New function.
12513         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12514         * testsuite/plugin_test_2.sh: Likewise.
12515         * testsuite/plugin_test_3.sh: Likewise.
12516         * testsuite/plugin_test_4.sh: New test case.
12517
12518 2009-01-07  Ian Lance Taylor  <iant@google.com>
12519
12520         * version.cc (version_string): Bump to 1.8.
12521
12522 2008-12-23  Cary Coutant  <ccoutant@google.com>
12523
12524         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12525         * plugin.cc (Plugin_manager::finish): Rename as
12526         layout_deferred_objects.  Move cleanup to separate function.
12527         (Plugin_manager::cleanup): New function.
12528         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12529         separately.
12530         * plugin.h (Plugin_manager::finish): Rename as
12531         layout_deferred_objects.
12532         (Plugin_manager::cleanup): New function.
12533         (Plugin_manager::cleanup_done): New field.
12534
12535 2008-12-23  Cary Coutant  <ccoutant@google.com>
12536
12537         * plugin.cc (is_visible_from_outside): New function.
12538         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12539         so we don't return "IR only" status for exported symbols or -r links.
12540
12541         * testsuite/Makefile.am (plugin_test_3): New test case.
12542         * testsuite/Makefile.in: Regenerate.
12543         * testsuite/plugin_test_3.sh: New file.
12544
12545 2008-12-22  Cary Coutant  <ccoutant@google.com>
12546
12547         * object.cc (Sized_relobj::layout_section): New function.
12548         (Sized_relobj::do_layout): Defer layout of input sections until after
12549         plugin has provided replacement files.
12550         (Sized_relobj::do_layout_deferred_sections): New function.
12551         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12552         (Relobj::layout_deferred_sections): New function.
12553         (Relobj::do_layout_deferred_sections): New function.
12554         (Sized_relobj::do_layout_deferred_sections): New function.
12555         (Sized_relobj::layout_section): New function.
12556         (Sized_relobj::Deferred_layout): New structure.
12557         (Sized_relobj::deferred_layout_): New field.
12558         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12559         Change all callers.  Layout deferred sections.
12560         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12561         references.
12562         (Plugin_hook::run): Move code from do_plugin_hook inline.
12563         (Plugin_hook::do_plugin_hook): Remove.
12564         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12565         (Plugin_manager::finish): Renamed, was cleanup.
12566         (Plugin_manager::should_defer_layout): New function.
12567         (Plugin_manager::add_deferred_layout_object): New function.
12568         (Plugin_manager::Deferred_layout_list): New type.
12569         (Plugin_manager::deferred_layout_objects_): New field.
12570         (Plugin_hook::do_plugin_hook): Remove.
12571
12572 2008-12-17  Ian Lance Taylor  <iant@google.com>
12573
12574         * options.h (class General_options): Add --no case for
12575         --export-dynamic.
12576
12577 2008-12-16  Cary Coutant  <ccoutant@google.com>
12578
12579         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12580         vector.
12581         (Plugin_manager::claim_file): Create plugin object even if
12582         plugin did not call the add_symbols callback.
12583         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12584         asking for more symbols than were added.
12585         * testsuite/Makefile.am (plugin_test_1): Add test case with
12586         no global symbols.
12587         (empty.syms): New target.
12588         * testsuite/Makefile.in: Regenerate.
12589         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12590         message. Don't call add_symbols if no globals.
12591         (all_symbols_read_hook): Don't provide replacement for empty
12592         claimed file.
12593
12594 2008-12-12  Ian Lance Taylor  <iant@google.com>
12595
12596         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12597         r_type == 0 for a local symbol with r_sym == 0.
12598         (scan_relocatable_relocs): Pass r_sym to
12599         local_non_section_strategy.
12600         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12601         r_sym parameter.
12602
12603         * configure.ac: Update test for TLS descriptors: they are
12604         supported as of glibc 2.9.
12605         * configure: Rebuild.
12606
12607 2008-12-11  Ian Lance Taylor  <iant@google.com>
12608
12609         PR 7091
12610         * target-reloc.h (Default_scan_relocatable_relocs): For each
12611         function, map r_type == 0 to RELOC_DISCARD.
12612
12613 2008-12-10  Cary Coutant  <ccoutant@google.com>
12614
12615         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12616         object to override a kept COMDAT group from a plugin object.
12617
12618 2008-12-09  Ian Lance Taylor  <iant@google.com>
12619
12620         PR 7088
12621         * yyscript.y (file_cmd): Handle INPUT.
12622
12623         * testsuite/initpri1.c: Change all declarations to be full
12624         prototypes by adding void, to avoid compiler warnings.
12625
12626 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12627
12628         * options.cc (General_options::parse_plugin_opt): New.
12629         (General_options::add_plugin): The argument now is just the filename.
12630         (General_options::add_plugin_option): New.
12631         * options.h (plugin_opt): New.
12632         (add_plugin): Change argument name.
12633         (add_plugin_option): New.
12634         * plugin.cc (Plugin::load): Don't parse the plugin option.
12635         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12636         (Plugin::add_option): New.
12637         (Plugin::args_): Change type.
12638         (Plugin::filename_): New.
12639         (Plugin_manager::add_plugin_option): New.
12640         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12641         * testsuite/Makefile.in: Regenerate.
12642
12643 2008-12-05  Cary Coutant  <ccoutant@google.com>
12644
12645         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12646         Handle --strip-lto-sections option.
12647         * options.h (strip_lto_sections): New option.
12648
12649 2008-12-01  Cary Coutant  <ccoutant@google.com>
12650
12651         * plugin.cc (ld_plugin_message): Change format parameter to const.
12652         Fix mismatch between new[] and delete.
12653
12654 2008-11-14  Cary Coutant  <ccoutant@google.com>
12655
12656         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12657         instead of -1U.
12658
12659 2008-11-05  Craig Silverstein  <csilvers@google.com>
12660
12661         * options.cc (General_options::parse_dynamic_list): New function.
12662         * options.h (General_options): New flags dynamic_list,
12663         dynamic_list_data, dynamic_list_cpp_new, and
12664         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12665         (General_options::in_dynamic_list): New function.
12666         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12667         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12668         (Lex::can_continue_name): Likewise.
12669         (yylex): Likewise.
12670         (read_script_file): New parameter script_options.
12671         (read_dynamic_list): New function.
12672         (Script_options::define_dynamic_list): New function.
12673         (dynamic_list_keyword_parsecodes): New variable.
12674         (dynamic_list_keywords): New variable.
12675         * script.h (Script_options::define_dynamic_list): New function
12676         prototype.
12677         (read_dynamic_list): New function prototype.
12678         * symtab.cc (strprefix): New macro.
12679         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12680         dynamic_list_data, dynamic_list_cpp_new, and
12681         dynamic_list_cpp_typeinfo.
12682         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12683         (dynamic_list_expr): New rule.
12684         (dynamic_list_nodes): Likewise.
12685         (dynamic_list_node): Likewise.
12686         * testsuite/Makefile.am (dynamic_list): New test.
12687         * testsuite/Makefile.in: Regenerated.
12688         * testsuite/dynamic_list.t: New file.
12689         * testsuite/dynamic_list.sh: New file.
12690
12691 2008-11-05  Craig Silverstein  <csilvers@google.com>
12692
12693         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12694         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12695         (t11_last): Likewise.
12696         * testsuite/ver_test_6.c (main): Likewise.
12697
12698 2008-10-07  Cary Coutant  <ccoutant@google.com>
12699
12700         * options.c (General_options::finalize): Add check for -static and
12701         -shared.
12702         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12703         is not empty.
12704
12705 2008-10-02  Cary Coutant  <ccoutant@google.com>
12706
12707         * plugin.cc (make_sized_plugin_object): Fix conditional
12708         compilation to work when not all targets are enabled.
12709
12710 2008-09-29  Cary Coutant  <ccoutant@google.com>
12711
12712         * archive.cc (Archive::get_file_and_offset): Use filename instead
12713         of name to get library path.
12714         (Archive::include_member): Unlock external member of a thin archive.
12715
12716         * testsuite/Makefile.am (TEST_AR): New variable.
12717         (thin_archive_test_1): New test.
12718         (thin_archive_test_2): New test.
12719         * testsuite/Makefile.in: Regenerate.
12720         * testsuite/thin_archive_main.cc: New file.
12721         * testsuite/thin_archive_test_1.cc: New file.
12722         * testsuite/thin_archive_test_2.cc: New file.
12723         * testsuite/thin_archive_test_3.cc: New file.
12724         * testsuite/thin_archive_test_4.cc: New file.
12725
12726 2008-09-29  Cary Coutant  <ccoutant@google.com>
12727
12728         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12729         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12730         instead of -1U.
12731         (Sized_relobj::do_finalize_local_symbols): Likewise.
12732         (Sized_relobj::map_to_kept_section): Likewise.
12733         * object.h (Sized_relobj::invalid_address): New constant.
12734         (Sized_relobj::do_output_section_offset): Check for invalid_address
12735         and return -1ULL.
12736         * output.cc (Output_reloc::local_section_offset): Use constant
12737         invalid_address instead of -1U.
12738         (Output_reloc::get_address): Likewise.
12739         (Output_section::output_address): Change -1U to -1ULL.
12740         * output.h (Output_reloc::invalid_address): New constant.
12741         * reloc.cc (Sized_relobj::write_sections): Use constant
12742         invalid_address instead of -1U.
12743         (Sized_relobj::relocate_sections): Likewise.
12744         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12745         values for merge sections.
12746         * target-reloc.h (relocate_for_relocatable): Use constant
12747         invalid_address instead of -1U.
12748
12749 2008-09-19  Cary Coutant  <ccoutant@google.com>
12750
12751         Add plugin functionality for link-time optimization (LTO).
12752         * configure.ac (plugins): Add --enable-plugins option.
12753         * configure: Regenerate.
12754         * config.in: Regenerate.
12755         * Makefile.am (LIBDL): New variable.
12756         (CCFILES): Add plugin.cc.
12757         (HFILES): Add plugin.h.
12758         (ldadd_var): Add LIBDL.
12759         * Makefile.in: Regenerate.
12760
12761         * archive.cc: Include "plugin.h".
12762         (Archive::setup): Don't preread archive symbols when using a plugin.
12763         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12764         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12765         files.
12766         (Archive::include_member): Add symbols from plugin objects.
12767         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12768         * descriptors.cc (Descriptors::open): Check for file descriptors
12769         abandoned by plugins.
12770         (Descriptors::claim_for_plugin): New function.
12771         * descriptors.h (Descriptors::claim_for_plugin): New function.
12772         (Open_descriptor::is_claimed): New field.
12773         (claim_descriptor_for_plugin): New function.
12774         * fileread.cc (File_read::claim_for_plugin): New function.
12775         * fileread.h (File_read::claim_for_plugin): New function.
12776         (File_read::descriptor): New function.
12777         * gold.cc: Include "plugin.h".
12778         (queue_initial_tasks): Add task to call plugin hooks for generating
12779         new object files.
12780         * main.cc: Include "plugin.h".
12781         (main): Load plugin libraries.
12782         * object.h (Pluginobj): Declare.
12783         (Object::pluginobj): New function.
12784         (Object::do_pluginobj): New function.
12785         (Object::set_target): New function.
12786         * options.cc: Include "plugin.h".
12787         (General_options::parse_plugin): New function.
12788         (General_options::General_options): Initialize plugins_ field.
12789         (General_options::add_plugin): New function.
12790         * options.h (Plugin_manager): Declare.
12791         (General_options): Add --plugin option.
12792         (General_options::has_plugins): New function.
12793         (General_options::plugins): New function.
12794         (General_options::add_plugin): New function.
12795         (General_options::plugins_): New field.
12796         * plugin.cc: New file.
12797         * plugin.h: New file.
12798         * readsyms.cc: Include "plugin.h".
12799         (Read_symbols::do_read_symbols): Check for archive before checking
12800         for ELF file.  Call plugin hooks to claim files.
12801         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12802         from a real object file; force override when processing replacement
12803         files.
12804         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12805         (Symbol::init_base_object): Likewise.
12806         (Symbol::init_base_output_data): Likewise.
12807         (Symbol::init_base_output_segment): Likewise.
12808         (Symbol::init_base_constant): Likewise.
12809         (Symbol::init_base_undefined): Likewise.
12810         (Symbol::output_section): Assert that object is not a plugin.
12811         (Symbol_table::add_from_pluginobj): New function.
12812         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12813         undefined.
12814         (Symbol_table::sized_write_globals): Likewise.
12815         (Symbol_table::add_from_pluginobj): Instantiate template.
12816         * symtab.h (Sized_pluginobj): Declare.
12817         (Symbol::in_real_elf): New function.
12818         (Symbol::set_in_real_elf): New function.
12819         (Symbol::in_real_elf_): New field.
12820         (Symbol_table::add_from_pluginobj): New function.
12821
12822         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12823         (LIBDL): New variable.
12824         (LDADD): Add LIBDL.
12825         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12826         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12827         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12828         (MOSTLYCLEANFILES): Likewise.
12829         * testsuite/Makefile.in: Regenerate.
12830         * testsuite/plugin_test.c: New file.
12831         * testsuite/plugin_test_1.sh: New file.
12832         * testsuite/plugin_test_2.sh: New file.
12833
12834 2008-09-16  Ian Lance Taylor  <iant@google.com>
12835
12836         * target-reloc.h (relocate_section): Check whether a symbol is
12837         defined by the ABI before reporting an undefined symbol error.
12838         * target.h (Target::is_defined_by_abi): Make parameter const.
12839         (Target::do_is_defined_by_abi): Likewise.
12840         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12841         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12842         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12843         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12844         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12845         * testsuite/Makefile.in: Rebuild.
12846
12847         * fileread.cc (make_view): Add casts to avoid warning.
12848
12849 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12850
12851         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12852         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12853
12854 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12855
12856         * options.h (General_options::output_is_executable): New.
12857         (General_options::output_is_pie): New.
12858         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12859         for shared libraries.
12860         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12861
12862 2008-09-11  Chris Demetriou  <cgd@google.com>
12863
12864         * options.h (origin): New -z option.
12865         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12866         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12867         in DT_FLAGS_1.
12868
12869 2008-09-05  Cary Coutant  <ccoutant@google.com>
12870
12871         * fileread.cc (File_read::make_view): Add check for attempt to map
12872         beyond end of file.
12873
12874 2008-09-05  Cary Coutant  <ccoutant@google.com>
12875
12876         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12877         explicit instantiations.
12878
12879 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12880
12881         PR gold/6858
12882         * options.cc (General_options::finalize): Allow undefined symbols
12883         in shlibs if linking -shared.
12884
12885         PR gold/6859
12886         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12887         symbols as not needing a dynsym entry.
12888
12889 2008-08-20  Craig Silverstein  <csilvers@google.com>
12890
12891         * fileread.cc (File_read::open): Do not lock the file unless it
12892         was successfully opened.
12893
12894 2008-08-14  Cary Coutant  <ccoutant@google.com>
12895
12896         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12897         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12898         * testsuite/tls_test.cc (struct int128): 128-bit struct
12899         for testing TLS relocs with non-zero addend.
12900         (v12): New TLS variable.
12901         (t12): New test.
12902         (t_last): Add check for v12.
12903         * testsuite/tls_test.h (t12): New function.
12904         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12905
12906 2008-08-13  Ian Lance Taylor  <iant@google.com>
12907
12908         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12909         set tls_segment_ or relro_segment_.
12910         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12911         when appropriate.
12912         * output.h (Output_section::clear_is_relro): New function.
12913         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12914         sections specially even when output_data_ is empty.
12915         (Output_segment::maximum_alignment): When first section is relro,
12916         only force alignment for PT_LOAD segments.
12917         * script.cc (script_data_segment_align): New function.
12918         (script_data_segment_relro_end): New function.
12919         * script-c.h (script_data_segment_align): Declare.
12920         (script_data_segment_relro_end): Declare.
12921         * script-sections.h (class Script_sections): Declare
12922         data_segment_align and data_segment_relro_end.  Add fields
12923         segment_align_index_ and saw_relro_end_.
12924         * script-sections.cc (class Sections_element): Add set_is_relro
12925         virtual function.  Add new bool* parameter to place_orphan_here.
12926         Add get_output_section virtual function.
12927         (class Output_section_definition): Add set_is_relro.  Add new
12928         bool* parameter to place_orphan_here.  Add get_output_section.
12929         Add is_relro_ field.
12930         (Output_section_definition::Output_section_definition): Initialize
12931         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12932         and is_relro_ fields.
12933         (Output_section_definition::place_orphan_here): Add is_relro
12934         parameter.
12935         (Output_section_definition::set_section_addresses): Set relro for
12936         output section.
12937         (Output_section_definition::alternate_constraint): Likewise.
12938         (class Orphan_output_section): Add new bool* parameter to
12939         place_orphan_here.  Add get_output_section.
12940         (Orphan_output_section::place_orphan_here): Add is_relro
12941         parameter.
12942         (Script_sections::Script_sections): Initialize
12943         data_segment_align_index_ and saw_relro_end_.
12944         (Script_sections::data_segment_align): New function.
12945         (Script_sections::data_segment_relro_end): New function.
12946         (Script_sections::place_orphan): Set or clear is_relro.
12947         (Script_sections::set_section_addresses): Force alignment of first
12948         TLS section.
12949         * yyscript.y (exp): Call script_data_segment_align and
12950         script_data_segment_relro_end.
12951         * testsuite/relro_script_test.t: New file.
12952         * testsuite/relro_test.cc (using_script): Declare.
12953         (t1, t2): Test using_script.
12954         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12955         (relro_script_test_SOURCES): Define.
12956         (relro_script_test_DEPENDENCIES): Define.
12957         (relro_script_test_LDFLAGS): Define.
12958         (relro_script_test_LDADD): Define.
12959         (relro_script_test.so): New target.
12960         * testsuite/Makefile.in: Rebuild.
12961
12962 2008-08-06  Cary Coutant <ccoutant@google.com>
12963
12964         * archive.cc (Archive::total_archives, Archive::total_members)
12965         (Archive::total_members_loaded): New variables.
12966         (Archive::setup): Add parameter.  Add option to preread
12967         archive symbols.
12968         (Archive::read_armap): Add counter.
12969         (Archive::get_file_and_offset): New function.
12970         (Archive::get_elf_object_for_member): New function.
12971         (Archive::read_all_symbols): New function.
12972         (Archive::read_symbols): New function.
12973         (Archive::add_symbols): Add counters.
12974         (Archive::include_all_members): Use armap to find members if it's
12975         already built.
12976         (Archive::include_member): Skip reading symbols if already read.
12977         Factored code into Archive::get_file_and_offset and
12978         Archive::get_elf_object_for_member.  Changed call to
12979         Mapfile::report_include_archive_member.
12980         (Archive::print_stats): New function.
12981         * archive.h: Declare Object and Read_symbols_data classes.
12982         (Archive::Archive): Add initializers for new members.
12983         (Archive::setup): Add parameter.
12984         (Archive::print_stats): New function.
12985         (Archive::total_archives, Archive::total_members)
12986         (Archive::total_members_loaded): New variables.
12987         (Archive::get_file_and_offset): New function.
12988         (Archive::get_elf_object_for_member): New function.
12989         (Archive::read_all_symbols): New function.
12990         (Archive::read_symbols): New function.
12991         (Archive::Archive_member): New class.
12992         (Archive::members_): New member.
12993         (Archive::num_members_): New member.
12994         * main.cc: Include archive.h.
12995         (main): Call Archive::print_stats.
12996         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12997         archive parameter; member_name is now the fully-decorated name.
12998         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12999         * options.h: (General_options): Add --preread-archive-symbols option.
13000         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13001         Archive::setup.
13002
13003 2008-08-04  Ian Lance Taylor  <iant@google.com>
13004
13005         * symtab.h (Symbol::use_plt_offset): New function.
13006         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13007         * powerpc.cc (Relocate::relocate): Likewise.
13008         * sparc.cc (Relocate::relocate): Likewise.
13009         * x86_64.cc (Relocate::relocate): Likewise.
13010         * testsuite/weak_plt.sh: New test.
13011         * testsuite/weak_plt_main.cc: New test.
13012         * testsuite/weak_plt_shared.cc: New test.
13013         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13014         (check_PROGRAMS): Add weak_plt.
13015         (check_DATA): Add weak_plt_shared.so.
13016         (weak_plt_main_pic.o, weak_plt): New targets.
13017         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13018         * testsuite/Makefile.in: Rebuild.
13019
13020         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13021         gcctestdir/ld.
13022         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13023         * testsuite/Makefile.in: Rebuild.
13024
13025 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13026
13027         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13028         * Makefile.in: Regenerate.
13029         * po/POTFILES.in: Regenerate.
13030
13031 2008-07-29  Ian Lance Taylor  <iant@google.com>
13032
13033         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13034         symbols before other symbols.
13035         * testsuite/script_test_2.cc (test_addr): Declare.
13036         (test_addr_alias): Declare.
13037         (main): Check that test_addr and test_addr_alias have the right
13038         values.
13039         * testsuite/script_test_2.t: Define test_addr_alias and
13040         test_addr.
13041
13042 2008-07-24  Ian Lance Taylor  <iant@google.com>
13043
13044         PR 5990
13045         * descriptors.cc: New file.
13046         * descriptors.h: New file.
13047         * gold-threads.h (class Hold_optional_lock): New class.
13048         * fileread.cc: Include "descriptors.h".
13049         (File_read::~File_read): Release descriptor rather than closing
13050         it.
13051         (File_read::open) [file]: Call open_descriptor rather than open.
13052         Set is_descriptor_opened_.
13053         (File_read::open) [memory]: Assert that descriptor is not open.
13054         (File_read::reopen_descriptor): New function.
13055         (File_read::release): Release descriptor.
13056         (File_read::do_read): Make non-const.  Reopen descriptor.
13057         (File_read::read): Make non-const.
13058         (File_read::make_view): Reopen descriptor.
13059         (File_read::do_readv): Likewise.
13060         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13061         Update declarations.
13062         * layout.cc: Include "descriptors.h".
13063         (Layout::create_build_id): Use open_descriptor rather than open.
13064         * output.cc: Include "descriptors.h".
13065         (Output_file::open): Use open_descriptor rather than open.
13066         * archive.cc (Archive::const_iterator): Change Archive to be
13067         non-const.
13068         (Archive::begin, Archive::end): Make non-const.
13069         (Archive::count_members): Likewise.
13070         * archive.h (class Archive): Update declarations.
13071         * object.h (Object::read): Make non-const.
13072         * Makefile.am (CCFILES): Add descriptors.cc.
13073         (HFILES): Add descriptors.h.
13074         * Makefile.in: Rebuild.
13075
13076         PR 6716
13077         * gold.h: Always include <clocale>.  Add Solaris workarounds
13078         following code in binutils/sysdep.h.
13079
13080         PR 6048
13081         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13082         this->eh_frame_hdr_ is NULL before using it.
13083
13084         * dynobj.cc (Versions::Versions): Update comment.
13085
13086         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13087         the base version name.
13088
13089         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13090         array size plus one.
13091         (Stringpool_template::set_string_offsets): Subtract one from key
13092         before using it as an array index.
13093         (Stringpool_template::get_offset_with_length): Likewise.
13094         (Stringpool_template::write_to_buffer): Likewise.
13095         * stringpool.h (Stringpool_template::get_offset_from_key):
13096         Likewise.
13097
13098 2008-07-23  Ian Lance Taylor  <iant@google.com>
13099
13100         PR 6658
13101         * object.h (Merged_symbol_value::value): Do our best to handle a
13102         negative addend.
13103
13104         PR 6647
13105         * script.cc (Version_script_info::get_versions): Don't add empty
13106         version tag to return value.
13107         (Version_script_info::get_symbol_version_helper): Change return
13108         type to bool.  Add pversion parameter.  Change all callers.
13109         (script_register_vers_node): Don't require a non-NULL tag.
13110         * script.h (class Version_script_info): Update declarations.
13111         (Version_script_info::get_symbol_version): Change return type to
13112         bool.  Add version parameter.  Change all callers.
13113         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13114         handling.  Handle an empty version from a version script.
13115         (Symbol_table::define_special_symbol): Likewise.
13116         * testsuite/ver_test_10.script: New file.
13117         * testsuite/ver_test_10.sh: New file.
13118         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13119         (check_DATA): Add ver_test_10.syms.
13120         (ver_test_10.syms, ver_test_10.so): New target.
13121         * testsuite/Makefile.in: Rebuild.
13122
13123 2008-07-23  Simon Baldwin  <simonb@google.com>
13124
13125         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13126         to zero for undefined symbols from dynamic libraries.
13127
13128 2008-07-23  Ian Lance Taylor  <iant@google.com>
13129
13130         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13131         Change all callers.
13132         * symtab.h (class Symbol_table): Update declaration.
13133         * testsuite/ver_test_9.cc: New file.
13134         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13135         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13136         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13137         (ver_test_9.so, ver_test_9.o): New targets.
13138         * testsuite/Makefile.in: Rebuild.
13139
13140 2008-07-22  Ian Lance Taylor  <iant@google.com>
13141
13142         * options.h (class General_options): Define --check-sections.
13143         * layout.cc (Layout::set_segment_offsets): Handle
13144         --check-sections.
13145
13146         * options.h (class General_options): Define -n/--nmagic and
13147         -N/--omagic.
13148         * options.cc (General_options::finalize): For -n/--nmagic or
13149         -N/--omagic, set -static.
13150         * layout.cc (Layout::attach_allocated_section_to_segment): If
13151         -N/--omagic, don't put read-only and read-write sections in
13152         different segments.
13153         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13154         finding a read-only segment.
13155         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13156         don't set the minimum segment alignment to the common page size,
13157         and don't set the file offset to the address modulo the page size.
13158         * script-sections.cc (Script_sections::create_segments): If
13159         -n/--omagic, don't put read-only and read-write sections in
13160         different segments.
13161
13162         * cref.cc: New file.
13163         * cref.h: New file.
13164         * options.h (class General_options): Add --print-symbol-counts.
13165         * main.cc (main): Issue defined symbol report if requested.
13166         * archive.cc (Archive::interpret_header): Make into a const member
13167         function.
13168         (Archive::add_symbols): Call Input_objects::archive_start and
13169         archive_stop.
13170         (Archive::const_iterator): Define new class.
13171         (Archive::begin, Archive::end): New functions.
13172         (Archive::include_all_members): Rewrite to use iterator.
13173         (Archive::count_members): New function.
13174         * archive.h (class Archive): Update declarations.
13175         (Archive::filename): New function.
13176         * object.cc: Include "cref.h".
13177         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13178         (Sized_relobj::do_get_global_symbol_counts): New function.
13179         (Input_objects::add_object): Add object to cross-referencer.
13180         (Input_objects::archive_start): New function.
13181         (Input_objects::archive_stop): New function.
13182         (Input_objects::print_symbol_counts): New function.
13183         * object.h: Declare Cref and Archive.
13184         (Object::get_global_symbol_counts): New function.
13185         (Object::do_get_global_symbol_counts): New pure virtual function.
13186         (class Sized_relobj): Add defined_count_ field.  Update
13187         declarations.
13188         (class Input_objects): Add cref_ field.  Update constructor.
13189         Update declarations.
13190         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13191         defined_count_.
13192         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13193         symbol counts.
13194         (Sized_dynobj::do_get_global_symbol_counts): New function.
13195         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13196         defined_count_.  Update declarations.  Define Symbols typedef.
13197         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13198         parameter.  Change all callers.
13199         (Symbol_table::add_from_dynobj): Add sympointers and defined
13200         parameters.  Change all callers.
13201         * symtab.h (class Symbol_table): Update declarations.
13202         * Makefile.am (CCFILES): Add cref.cc.
13203         (HFILES): Add cref.h.
13204         * Makefile.in: Rebuild.
13205
13206 2008-07-22  Simon Baldwin  <simonb@google.com>
13207
13208         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13209         to zero when writing undefined symbols.
13210
13211 2008-07-22  Ian Lance Taylor  <iant@google.com>
13212
13213         * output.cc (Output_section::add_input_section): Don't try to
13214         merge empty merge sections.
13215
13216 2008-07-21  Craig Silverstein  <csilvers@google.com>
13217
13218         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13219         Include symbol version in error message.
13220
13221 2008-07-20  Chris Demetriou  <cgd@google.com>
13222
13223         * configure.ac (gold_cv_c_random_seed): New configured variable.
13224         (RANDOM_SEED_CFLAGS): New substituted variable.
13225         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13226         * configure: Rebuild.
13227         * Makefile.in: Likewise.
13228         * testsuite/Makefile.in: Likewise.
13229
13230 2008-07-18  Ian Lance Taylor  <iant@google.com>
13231
13232         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13233         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13234         * testsuite/ver_test_main.cc (main): Call t4.
13235         (t4, t4_2a): Define.
13236         * testsuite/ver_test_2.cc (t4_2): Define.
13237         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13238         * testsuite/ver_test_4.cc (t4_2a): Define.
13239         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13240         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13241
13242 2008-07-17  Ian Lance Taylor  <iant@google.com>
13243
13244         * dynobj.cc (Versions::add_def): If we give an error about a
13245         missing version, go ahead and create the version anyhow.
13246
13247 2008-07-10  Ian Lance Taylor  <iant@google.com>
13248
13249         Handle output sections with more than 0x7fffffff bytes.
13250         * object.h (class Relobj): Change map_to_output_ to
13251         output_sections_, and just keep a section pointer.  Change all
13252         uses.  Move comdat group support to Sized_relobj.
13253         (Relobj::is_section_specially_mapped): Remove.
13254         (Relobj::output_section): Remove poff parameter.  Change all
13255         callers.
13256         (Relobj::output_section_offset): New function.
13257         (Relobj::set_section_offset): Rewrite.
13258         (Relobj::map_to_output): Remove.
13259         (Relobj::output_sections): New function.
13260         (Relobj::do_output_section_offset): New pure virtual function.
13261         (Relobj::do_set_section_offset): Likewise.
13262         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13263         group support from Relobj.  Update declarations.
13264         (Sized_relobj::get_output_section_offset): New function.
13265         (Sized_relobj::do_output_section_offset): New function.
13266         (Sized_relobj::do_set_section_offset): New function.
13267         * object.cc (Relobj::output_section_address): Remove.
13268         (Sized_relobj::Sized_relobj): Initialize new fields.
13269         (Sized_relobj::include_section_group): Cast find_kept_object to
13270         Sized_relobj.
13271         (Sized_relobj::include_linkonce_section): Likewise.
13272         (Sized_relobj::do_layout): Use separate arrays for output section
13273         and output offset.
13274         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13275         output_sections.
13276         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13277         output_sections and section_offsets.
13278         (Sized_relobj::write_local_symbols): Likewise.
13279         (map_to_kept_section): Compute output address directly.
13280         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13281         output_sections and section_offsets.
13282         (Sized_relobj::write_sections): Likewise.
13283         (Sized_relobj::relocate_sections): Likewise.
13284         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13285         * output.h (class Output_reloc): Update declarations.  Change
13286         u2_.relobj to Sized_relobj*.
13287         (class Output_data_reloc): Change add functions to use
13288         Sized_relobj*.
13289         * output.cc (Output_reloc::Output_reloc): Change relobj to
13290         Sized_relobj*.
13291         (Output_reloc::local_section_offset): Change return type to
13292         Elf_Addr.  Use get_output_section_offset.
13293         (Output_reloc::get_address): Likewise.
13294         (Output_section::is_input_address_mapped): Don't call
13295         is_section_specially_mapped.
13296         (Output_section::output_offset): Likewise.
13297         (Output_section::output_address): Likewise.
13298         (Output_section::starting_output_address): Likewise.
13299         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13300         parameter to Sized_relobj*.
13301         (Copy_relocs::need_copy_reloc): Likewise.
13302         (Copy_relocs::save): Likewise.
13303         * copy-relocs.h (class Copy_relocs): Update declarations.
13304         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13305         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13306         * target-reloc.h (relocate_for_relocatable): Change
13307         offset_in_output_section type to Elf_Addr.  Change code that uses
13308         it as well.
13309         * layout.cc (Layout::layout): Always set *off.
13310         * mapfile.cc (Mapfile::print_input_section): Use
13311         output_section_offset.
13312         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13313         Sized_relobj*.
13314         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13315         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13316         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13317
13318 2008-07-03  Ian Lance Taylor  <iant@google.com>
13319
13320         * layout.cc (Layout::include_section): Do not discard unrecognized
13321         SHT_STRTAB sections.
13322
13323 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13324
13325         * script.cc (Lex::can_continue_name): Make '?' allowable in
13326         version-script names.
13327         * testsuite/version_script.map: Change glob pattern to use '?'
13328
13329 2008-06-30  Manish Singh  <yosh@gimp.org>
13330
13331         PR 6585
13332         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13333         Correct typo.
13334
13335 2008-06-30  Ian Lance Taylor  <iant@google.com>
13336
13337         PR 6660
13338         PR 6682
13339         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13340         versions]: Don't try to read the value in the contents, since we
13341         don't use it.  Use the template endianness when writing.
13342
13343 2008-06-25  Cary Coutant  <ccoutant@google.com>
13344
13345         * fileread.cc (File_read::make_view): Assert on zero-length view.
13346         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13347         symbol table when there are no symbols to read.
13348
13349 2008-06-23  Craig Silverstein  <csilvers@google.com>
13350
13351         * version.cc (version_string): Bump to 1.7
13352
13353 2008-06-18  Craig Silverstein  <csilvers@google.com>
13354
13355         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13356         constant 0xFFFF to type Valtype.
13357         (Powerpc_relocate_functions::rel16_ha): Likewise.
13358
13359 2008-06-17  Ian Lance Taylor  <iant@google.com>
13360
13361         * output.h (Output_section::Input_section): Initialize p2align_ to
13362         zero for Output_section_data constructors.
13363         (Output_section::Input_section::addralign): If not an input
13364         section, return the alignment of the Output_section_data.
13365         * testsuite/copy_test.cc: New file.
13366         * testsuite/copy_test_1.cc: New file.
13367         * testsuite/copy_test_2.cc: New file.
13368         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13369         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13370         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13371         (copy_test_1_pic.o, copy_test_1.so): New targets.
13372         (copy_test_2_pic.o, copy_test_2.so): New targets.
13373         * testsuite/Makefile.in: Rebuild.
13374
13375         * script-sections.cc (Script_sections::place_orphan): Initialize
13376         local variable exact.
13377
13378 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13379
13380         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13381
13382 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13383             David S. Miller  <davem@davemloft.net>
13384
13385         * powerpc.cc: New file.
13386         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13387         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13388         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13389         * Makefile.in: Rebuild.
13390
13391 2008-06-09  Ian Lance Taylor  <iant@google.com>
13392
13393         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13394         <exception>.
13395         (throwing, orig_terminate): New static variables.
13396         (terminate_handler): New static function.
13397         (t2): Set terminate handler.
13398
13399 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13400
13401         PR 6584
13402         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13403         alignment.
13404
13405 2008-05-30  Cary Coutant  <ccoutant@google.com>
13406
13407         * archive.cc (Archive::include_all_members) Correct to step
13408         over symbol table and extended name table in thin archives.
13409
13410 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13411
13412         PR 6407
13413         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13414         calculation.
13415
13416 2008-05-28  Caleb Howe  <cshowe@google.com>
13417
13418         * reduced_debug_output.cc: New file.
13419         * reduced_debug_output.h: New file.
13420         * options.h (class General_options): Add --strip-debug-non-line.
13421         * options.cc (General_options::finalize): Add strip_debug_non_line
13422         to the strip heirarchy.
13423         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13424         fields.
13425         * layout.cc: Include "reduced_debug_output.h".
13426         (Layout::Layout): Initialize new fields.
13427         (line_only_debug_sections): New static array.
13428         (is_lines_only_debug_sections): New static inline function.
13429         (Layout::include_section): Handle --strip-debug-non-line.
13430         (Layout::make_output_section): If --strip-debug-non-line, build
13431         new output sections for .debug_abbrev and .debug_info.
13432         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13433         gold.  Warn about possible overflow.
13434         (read_signed_LEB_128): Likewise.
13435         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13436         (read_signed_LEB_128): Declare.
13437         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13438         (HFILES): Add reduced_debug_output.h.
13439         * Makefile.in: Rebuild.
13440
13441 2008-05-21  Ian Lance Taylor  <iant@google.com>
13442
13443         * mapfile.cc: New file.
13444         * mapfile.h: New file.
13445         * options.h (class General_options): Add -M/--print-map and -Map.
13446         * options.cc (General_options::finalize): Make -M equivalent to
13447         -Map -.
13448         * main.cc: Include <cstdio> and "mapfile.h".
13449         (main): Open mapfile if requested.
13450         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13451         constructor.  Change caller.
13452         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13453         (queue_middle_tasks): Likewise.
13454         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13455         declarations.
13456         * archive.cc: Include "mapfile.h".
13457         (Archive::add_symbols): Add mapfile parameter.  Change all
13458         callers.  Pass mapfile, symbol, and reason to include_member.
13459         (Archive::include_all_members): Add mapfile parameter.  Change all
13460         callers.
13461         (Archive::include_member): Add mapfile, sym, and why parameters.
13462         Change all callers.  Report inclusion to map file.
13463         * archive.h: Include "fileread.h".
13464         (class Archive): Update declarations.
13465         (Archive::file): New const method.
13466         (class Add_archive_symbols): Add mapfile_ field.  Update
13467         constructor.  Change all callers.
13468         * readsyms.h (class Read_symbols): Likewise.
13469         (class Finish_group): Likewise.
13470         (class Read_script): Likewise.
13471         * common.cc: Include "mapfile.h".
13472         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13473         all callers.
13474         (Symbol_table::do_allocate_commons): Likewise.
13475         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13476         symbol allocation to mapfile.
13477         * common.h (class Allocate_commons_task): Add mapfile_ field.
13478         Update constructor.  Change all callers.
13479         * symtab.h (class Symbol_table): Update declarations.
13480         * layout.cc: Include "mapfile.h".
13481         (Layout_task_runner::run): Print information to mapfile.
13482         (Layout::create_gold_note): Change Output_data_fixed_space to
13483         Output_data_zero_fill.
13484         (Layout::create_build_id): Likewise.
13485         (Layout::print_to_mapfile): New function.
13486         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13487         constructor.  Change caller.
13488         (class Layout): Declare print_to_mapfile.
13489         * output.cc (Output_section::Input_section::print_to_mapfile): New
13490         function.
13491         (Output_section::add_input_section): If producing a map, always
13492         add to input_sections_ list.
13493         (Output_section::do_print_to_mapfile): New function.
13494         (Output_segment::print_sections_to_mapfile): New function.
13495         (Output_segment::print_section_list_to_mapfile): New function.
13496         * output.h: Include "mapfile.h".
13497         (Output_data::print_to_mapfile): New function.
13498         (Output_data::do_print_to_mapfile): New virtual function.
13499         (Output_segment_headers::do_print_to_mapfile): New function.
13500         (Output_file_header::do_print_to_mapfile): New function.
13501         (Output_data_const::do_print_to_mapfile): New function.
13502         (class Output_data_const_buffer): Add map_name_ field.  Update
13503         constructor.  Change all callers.  Add do_print_to_mapfile
13504         function.
13505         (class Output_data_fixed_space): Likewise.
13506         (class Output_data_space): Likewise.
13507         (class Output_data_zero_fill): New class.
13508         (Output_data_strtab::do_print_to_mapfile): New function.
13509         (Output_data_reloc_base::do_print_to_mapfile): New function.
13510         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13511         (Output_data_group::do_print_to_mapfile): New function.
13512         (Output_data_got::do_print_to_mapfile): New function.
13513         (Output_data_dynamic::do_print_to_mapfile): New function.
13514         (Output_symtab_xindex::do_print_to_mapfile): New function.
13515         (class Output_section): Declare do_print_to_mapflie.  Declare
13516         print_to_mapfile in Input_section.
13517         (class Output_segment): Declare new functions.
13518         * object.h (Sized_relobj::symbol_count): New function.
13519         * script-sections.cc
13520         (Output_section_element_dot_assignment::set_section_addresses):
13521         Change Output_data_fixed_space to Output_data_zero_fill.
13522         (Output_data_expression::do_print_to_mapfile): New function.
13523         * script.cc (read_input_script): Add mapfile parameter.  Change
13524         all callers.
13525         * script.h (read_input_script): Update declaration.
13526         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13527         (Eh_frame::do_print_to_mapfile): New function.
13528         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13529         (Output_merge_string::do_print_to_mapfile): New function.
13530         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13531         function.
13532         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13533         function.
13534         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13535         function.
13536         * Makefile.am (CCFILES): Add mapfile.cc.
13537         (HFILES): Add mapfile.h.
13538         * Makefile.in: Rebuild.
13539
13540 2008-05-19  Ian Lance Taylor  <iant@google.com>
13541
13542         * options.h (class General_options): Add -z relro.
13543         * layout.cc (Layout::Layout): Initialize relro_segment_.
13544         (Layout::add_output_section_data): Return the output section.
13545         (Layout::make_output_section): Rcognize relro sections and mark
13546         them appropriately.
13547         (Layout::attach_allocated_section_to_segment): Put relro sections
13548         in a PT_GNU_RELRO segment.
13549         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13550         section as relro.
13551         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13552         PT_TLS segments.
13553         (Layout::linkonce_mapping): Map d.rel.ro.local to
13554         .data.rel.ro.local.
13555         (Layout::output_section_name): Us .data.rel.ro.local for any
13556         section which begins with that.
13557         * layout.h (class Layout): Update add_output_section_data
13558         declaration.  Add relro_segment_ field.
13559         * output.cc (Output_section::Output_section): Initialize is_relro_
13560         and is_relro_local_ fields.
13561         (Output_segment::add_output_section): Group relro sections.
13562         (Output_segment::is_first_section_relro): New function.
13563         (Output_segment::maximum_alignment): If there is a relro section,
13564         align the segment to the common page size.
13565         (Output_segment::set_section_addresses): Track whether we are
13566         looking at relro sections.  If the last section is a relro
13567         section, align to the common page size.
13568         (Output_segment::set_section_list_addresses): Add in_relro
13569         parameter.  Change all callers.  Align to the page size when
13570         moving from relro to non-relro section.
13571         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13572         segment.
13573         * output.h (class Output_section): Add is_relro_ and
13574         is_relro_local_ fields.
13575         (Output_section::is_relro): New function.
13576         (Output_section::set_is_relro): New function.
13577         (Output_section::is_relro_local): New function.
13578         (Output_section::set_is_relro_local): New function.
13579         (class Output_segment): Update declarations.
13580         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13581         * sparc.cc (Target_sparc::got_section): Likewise.
13582         * x86_64.cc (Target_x86_64::got_section): Likewise.
13583         * testsuite/relro_test_main.cc: New file.
13584         * testsuite/relro_test.cc: New file.
13585         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13586         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13587         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13588         (relro_test.so, relro_test_pic.o): New targets.
13589         * testsuite/Makefile.in: Rebuild.
13590
13591 2008-05-16  Ian Lance Taylor  <iant@google.com>
13592
13593         * output.cc (Output_segment::add_output_section): Remove front
13594         parameter.
13595         * output.h (class Output_segment): Remove
13596         add_initial_output_section and overloaded add_output_section.
13597         Update declaration of remaining add_output_section.
13598         * layout.cc (Layout::create_interp): Call add_output_section
13599         rather than add_initial_output_section.
13600         (Layout::finish_dynamic_section): Likewise.
13601
13602         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13603         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13604         know the dynamic type.
13605         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13606         field.  Initialize it in constructor.
13607         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13608         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13609         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13610         reloc.
13611
13612         * output.cc (Output_reloc::get_address): Change return type to
13613         Elf_Addr.
13614         * output.h (class Output_reloc): Update get_address declaration.
13615         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13616         for section addresses.
13617
13618 2008-05-09  Ian Lance Taylor  <iant@google.com>
13619
13620         PR 6493
13621         * gold.cc (gold_nomem): Use return value of write.
13622
13623 2008-05-08  Ian Lance Taylor  <iant@google.com>
13624
13625         * symtab.c (Symbol::init_base_output_data): Add version
13626         parameter.  Change all callers.
13627         (Symbol::init_base_output_segment): Likewise.
13628         (Symbol::init_base_constant): Likewise.
13629         (Symbol::init_base_undefined): Likewise.
13630         (Sized_symbol::init_output_data): Likewise.
13631         (Sized_symbol::init_output_segment): Likewise.
13632         (Sized_symbol::init_constant): Likewise.
13633         (Sized_symbol::init_undefined): Likewise.
13634         (Symbol_table::do_define_in_output_data): If the new symbol has a
13635         version, mark it as the default.
13636         (Symbol_table::do_define_in_output_segment): Likewise.
13637         (Symbol_table::do_define_as_constant): Likewise.
13638         * symtab.h (class Symbol): Update declarations.
13639         (class Sized_symbol): Likewise.
13640         * resolve.cc (Symbol::override_version): New function.
13641         (Symbol::override_base): Call override_version.
13642         (Symbol::override_base_with_special): Likewise.
13643         * testsuite/ver_script_8.script: New file.
13644         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13645         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13646         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13647         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13648
13649 2008-05-06  Ian Lance Taylor  <iant@google.com>
13650
13651         PR 6049
13652         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13653         functions.
13654         (class General_options): Remove existing --undefined, and add
13655         --no-undefined instead.  Add new --undefined as synonym for -u.
13656         * archive.cc (Archive::add_symbols): Check whether symbol was
13657         named with -u.
13658         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13659         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13660         all uses.  Add IS_UNDEFINED.  Update declarations to split
13661         different versions of init_base.  Declare init_base_undefined.
13662         (Symbol::is_defined): Handle IS_UNDEFINED.
13663         (Symbol::is_undefined): Likewise.
13664         (Symbol::is_weak_undefined): Call is_undefined.
13665         (Symbol::is_absolute): Handle IS_CONSTANT.
13666         (class Sized_symbol): Update declarations to split different
13667         versions of init.  Declare init_undefined.
13668         (class Symbol_table): Declare new functions.
13669         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13670         Change all callers.
13671         (Symbol::init_base_output_data): Likewise.
13672         (Symbol::init_base_output_segment): Likewise.
13673         (Symbol::init_base_constant): Likewise.
13674         (Symbol::init_base_undefined): New function.
13675         (Sized_symbol::init_object): Rename from init.  Change all
13676         callers.
13677         (Sized_symbol::init_output_data): Likewise.
13678         (Sized_symbol::init_output_segment): Likewise.
13679         (Sized_symbol::init_constant): Likewise.
13680         (Sized_symbol::init_undefined): New function.
13681         (Symbol_table::add_undefined_symbols_from_command_line): New
13682         function.
13683         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13684         function.
13685         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13686         (Symbol::output_section): Likewise.
13687         (Symbol::set_output_section): Likewise.
13688         (Symbol_table::sized_finalize_symbol): Likewise.
13689         (Symbol_table::sized_write_globals): Likewise.
13690         * resolve.cc (Symbol_table::should_override): Likewise.
13691         (Symbol::override_base_with_special): Likewise.
13692
13693         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13694         symbol, change it to have default visibility.
13695         * testsuite/protected_1.cc: New file.
13696         * testsuite/protected_2.cc: New file.
13697         * testsuite/protected_3.cc: New file.
13698         * testsuite/protected_main_1.cc: New file.
13699         * testsuite/protected_main_2.cc: New file.
13700         * testsuite/protected_main_3.cc: New file.
13701         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13702         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13703         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13704         (protected_1.so): New target.
13705         (protected_1_pic.o, protected_2_pic.o): New targets.
13706         (protected_3_pic.o): New target.
13707         (check_PROGRAMS): Add protected_2.
13708         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13709         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13710         * testsuite/Makefile.in: Rebuild.
13711
13712         * options.h (DEFINE_var): Add set_user_set_##varname__.
13713         (DEFINE_bool_alias): New macro.
13714         (class General_options): Define -Bstatic using DEFINE_bool_alias
13715         rather than DEFINE_special.  Add --undefined as an alias for -z
13716         defs.
13717         * options.cc (General_options::parse_Bstatic): Remove.
13718
13719         * options.h (class General_options): Add --fatal-warnings.
13720         * main.cc (main): Implement --fatal-warnings.
13721         * errors.h (Errors::warning_count): New function.
13722
13723         * options.h (class General_options): Add -Bsymbolic-functions.
13724         * symtab.h (Symbol::is_preemptible): Check for
13725         -Bsymbolic-functions.
13726
13727 2008-05-05  Ian Lance Taylor  <iant@google.com>
13728
13729         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13730         as noVARNAME rather than no-VARNAME.
13731         (class General_options): Add option -z combreloc.
13732         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13733         get_address.
13734         (Output_reloc::sort_before) [SHT_REL]: New function.
13735         (Output_reloc::sort_before) [SHT_RELA]: New function.
13736         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13737         Sort_relocs_comparison.
13738         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13739         parameter.  Change all callers.
13740         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13741         sort_relocs parameter.  Change all callers.
13742         * output.cc (Output_reloc::get_address): New function, broken out
13743         of write_rel.
13744         (Output_reloc::write_rel): Call it.
13745         (Output_reloc::compare): New function.
13746         (Output_data_reloc_base::do_write): Optionally sort relocs.
13747
13748         * configure.ac: If targ_extra_obj is set, link it in.
13749         * configure.tgt: Initialize all variables.
13750         (x86_64*): Set targ_extra_obj and targ_extra_size.
13751         * configure: Rebuild.
13752
13753         * object.cc (Sized_relobj::include_section_group): Adjust section
13754         indexes read from group data.  Build vector to pass to
13755         layout_group.
13756         * layout.cc (Layout::layout_group): Add flags and shndxes
13757         parameters.  Remove contents parameter.  Change caller.  Update
13758         explicit instantiations.
13759         * layout.h (class Layout): Update layout_group declaration.
13760         * output.cc (Output_data_group::Output_data_group): Add flags and
13761         input_shndxes parameters.  Remove contents parameter.  Change
13762         caller.
13763         (Output_data_group::do_write): Change input_sections_ to
13764         input_shndxes_.
13765         * output.h (class Output_data_group): Update constructor
13766         declaration.  Rename input_sections_ to input_shndxes_.
13767         * testsuite/many_sections_test.cc: Add template.
13768
13769 2008-04-30  Cary Coutant  <ccoutant@google.com>
13770
13771         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13772
13773         * layout.cc (Layout::include_section): Refactored check for debug
13774         info section.
13775         (Layout::add_comdat): Add new parameters.  Change type
13776         of signature parameter.  Add object and shndx to signatures table.
13777         (Layout::find_kept_object): New function.
13778         * layout.h: Include <cstring>.
13779         (Layout::is_debug_info_section): New function.
13780         (Layout::add_comdat): Add new parameters.
13781         (Layout::find_kept_object): New function.
13782         (Layout::Kept_section): New struct.
13783         (Layout::Signatures): Change type of map range.
13784         * object.cc (Relobj::output_section_address): New function.
13785         (Sized_relobj::include_section_group): Add new parameters.  Change
13786         calls to Layout::add_comdat.  Change to build table of kept comdat
13787         groups and table mapping discarded sections to kept sections.
13788         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13789         (Sized_relobj::do_layout): Change calls to include_section_group and
13790         include_linkonce_section.
13791         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13792         value to zero when section is discarded.
13793         (Sized_relobj::map_to_kept_section): New function.
13794         * object.h (Relobj::output_section_address): New function.
13795         (Relobj::Comdat_group): New type.
13796         (Relobj::find_comdat_group): New function.
13797         (Relobj::Comdat_group_table): New type.
13798         (Relobj::Kept_comdat_section): New type.
13799         (Relobj::Kept_comdat_section_table): New type.
13800         (Relobj::add_comdat_group): New function.
13801         (Relobj::set_kept_comdat_section): New function.
13802         (Relobj::get_kept_comdat_section): New function.
13803         (Relobj::comdat_groups_): New field.
13804         (Relobj::kept_comdat_sections_): New field.
13805         (Symbol_value::input_value): Update comment.
13806         (Sized_relobj::map_to_kept_section) New function.
13807         (Sized_relobj::include_linkonce_section): Add new parameter.
13808         * target-reloc.h (Comdat_behavior): New type.
13809         (get_comdat_behavior): New function.
13810         (relocate_section): Add code to map a discarded section to the
13811         corresponding kept section when applying a relocation.
13812
13813 2008-04-30  Craig Silverstein  <csilvers@google.com>
13814
13815         * dwarf_reader.cc (next_generation_count): New static var.
13816         (Addr2line_cache_entry): New struct.
13817         (addr2line_cache): New static var.
13818         (Dwarf_line_info::one_addr2line): Added caching.
13819         (Dwarf_line_info::clear_addr2line_cache): New function.
13820         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13821         cache-size parameter.
13822         (Dwarf_line_info::one_addr2line_cache): New function.
13823         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13824         new cache-size argument to one_addr2line(), and clear cache.
13825
13826 2008-04-28  Cary Coutant  <ccoutant@google.com>
13827
13828         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13829         R_386_PC8 relocations.
13830
13831 2008-04-23  Ian Lance Taylor  <iant@google.com>
13832
13833         * object.cc (Sized_relobj::include_section_group): Check for
13834         invalid section group.
13835
13836         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13837         header size.
13838
13839         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13840         than read for file header.
13841         * archive.cc (Archive::include_member): Likewise.
13842
13843 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13844
13845         * aclocal.m4: Regenerate.
13846         * configure: Regenerate.
13847
13848 2008-04-19  Ian Lance Taylor  <iant@google.com>
13849
13850         * version.cc (version_string): Bump to 1.6.
13851
13852         * testsuite/Makefile.am (many_sections_r_test): New target.
13853         (many_sections_r_test_SOURCES): Remove.
13854         (many_sections_r_test_DEPENDENCIES): Remove.
13855         (many_sections_r_test_LDFLAGS): Remove.
13856         (many_sections_r_test_LDADD): Remove.
13857
13858         * object.cc (Sized_relobj::do_add_symbols): Always pass
13859         local_symbol_count_ to add_from_relobj.
13860
13861         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13862         every thousand variables.
13863         * testsuite/Makefile.in: Rebuild.
13864
13865         * object.cc (Xindex::initialize_symtab_xindex): New function.
13866         (Xindex::read_symtab_xindex): New function.
13867         (Xindex::sym_xindex_to_shndx): New function.
13868         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13869         available.
13870         (Sized_relobj::do_initialize_xindex): New function.
13871         (Sized_relobj::do_read_symbols): Adjust section links.
13872         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13873         parameter.  Change all callers.
13874         (Sized_relobj::include_section_group): Adjust section links and
13875         symbol section indexes.
13876         (Sized_relobj::do_layout): Adjust section links.
13877         (Sized_relobj::do_count_local_symbols): Adjust section links and
13878         symbol section indexes.
13879         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13880         ordinary and special symbols.
13881         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13882         dynsym_xindex parameters.  Change all callers.  Adjust section
13883         links.  Use SHN_XINDEX when needed.
13884         (Sized_relobj::get_symbol_location_info): Adjust section links.
13885         Don't get fooled by special symbols.
13886         * object.h (class Xindex): Define.
13887         (class Object): Add xindex_ parameter.  Declare virtual functoin
13888         do_initialize_xindex.
13889         (Object::adjust_sym_shndx): New function.
13890         (Object::set_xindex): New protected function.
13891         (class Symbol_value): Add is_ordinary_shndx_ field.
13892         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13893         (Symbol_value::value): Assert ordinary section.
13894         (Symbol_value::initialize_input_to_output_map): Likewise.
13895         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13896         Change all callers.
13897         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13898         all callers.
13899         (class Sized_relobj): Update declarations.
13900         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13901         parameter.  Change all callers.
13902         (Sized_relobj::adjust_shndx): New function.
13903         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13904         field.
13905         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13906         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13907         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13908         (Sized_dynobj::read_dynsym_section): Adjust section links.
13909         (Sized_dynobj::read_dynamic): Likewise.
13910         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13911         section links.
13912         (Sized_dynobj::do_initialize_xindex): New function.
13913         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13914         do_initialize_xindex.
13915         (Sized_dynobj::adjust_shndx): New function.
13916         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13917         dynsym_xindex_ fields.
13918         (Layout::finalize): Add a call to set_section_indexes before
13919         creating the symtab sections.
13920         (Layout::set_section_indexes): Don't do anything if the section
13921         already has a section index.
13922         (Layout::create_symtab_sections): Add shnum parameter.  Change
13923         caller.  Create .symtab_shndx section if needed.
13924         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13925         caller.
13926         (Layout::allocated_output_section_count): New function.
13927         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13928         needed.
13929         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13930         fields.  Update declarations.
13931         (Layout::symtab_xindex): New function.
13932         (Layout::dynsym_xindex): New function.
13933         (class Write_symbols_task): Add layout_ field.
13934         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13935         Change caller.
13936         * output.cc (Output_section_headers::Output_section_headers): Add
13937         shstrtab_section parameter.  Change all callers.
13938         (Output_section_headers::do_sized_write): Store overflow values
13939         for section count and section string table section index in
13940         section header zero.
13941         (Output_file_header::do_sized_write): Check for overflow of
13942         section count and section string table section index.
13943         (Output_symtab_xindex::do_write): New function.
13944         (Output_symtab_xindex::endian_do_write): New function.
13945         * output.h (class Output_section_headers): Add shstrtab_section_.
13946         Update declarations.
13947         (class Output_symtab_xindex): Define.
13948         (Output_section::has_out_shndx): New function.
13949         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13950         field.
13951         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13952         Change all callers.
13953         (Sized_symbol::init): Likewise.
13954         (Symbol::output_section): Check for ordinary symbol.
13955         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13956         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13957         callers.
13958         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13959         Change all callers.  Simplify handling of symbols from sections
13960         not included in the link.
13961         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13962         distinction.
13963         (Weak_alias_sorter::operator()): Assert that symbols are
13964         ordinary.
13965         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13966         distinction.
13967         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13968         parameters.  Change all callers.
13969         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13970         symbol distinction.  Use SHN_XINDEX when needed.
13971         (Symbol_table::write_section_symbol): Add symtab_xindex
13972         parameter.  Change all callers.
13973         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13974         SHN_XINDEX when needed.
13975         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13976         declarations.
13977         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13978         (Symbol::is_defined): Check is_ordinary.
13979         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13980         (Symbol::is_absolute, Symbol::is_common): Likewise.
13981         (class Sized_symbol): Update declarations.
13982         (class Symbol_table): Update declarations.
13983         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13984         parameters.  Change all callers.
13985         (Sized_symbol::override): Likewise.
13986         (Symbol_table::override): Likewise.
13987         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13988         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13989         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13990         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13991         to be in an ordinary section.
13992         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13993         object and is_ordinary parameters.  Change all callers.
13994         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13995         Change all callers.  Don't add undefined or non-ordinary symbols
13996         to reloc_map_.
13997         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13998         Change all callers.
13999         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14000         declarations.
14001         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14002         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14003         (Sized_relobj::relocate_sections): Likewise.
14004         * target-reloc.h (scan_relocs): Adjust section symbol index.
14005         (scan_relocatable_relocs): Likewise.
14006         * i386.cc (Scan::local): Check for ordinary symbols.
14007         * sparc.cc (Scan::local): Likewise.
14008         * x86_64.cc (Scan::local): Likewise.
14009         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14010         to symbol_section_and_value.
14011         * testsuite/many_sections_test.cc: New file.
14012         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14013         (check_PROGRAMS): Add many_sections_test.
14014         (many_sections_test_SOURCES): Define.
14015         (many_sections_test_DEPENDENCIES): Define.
14016         (many_sections_test_LDFLAGS): Define.
14017         (BUILT_SOURCES): Add many_sections_define.h.
14018         (many_sections_define.h): New target.
14019         (BUILT_SOURCES): Add many_sections_check.h.
14020         (many_sections_check.h): New target.
14021         (check_PROGRAMS): Add many_sections_r_test.
14022         (many_sections_r_test_SOURCES): Define.
14023         (many_sections_r_test_DEPENDENCIES): Define.
14024         (many_sections_r_test_LDFLAGS): Define.
14025         (many_sections_r_test_LDADD): Define.
14026         (many_sections_r_test.o): New target.
14027         * testsuite/Makefile.in: Rebuild.
14028
14029 2008-04-17  Cary Coutant  <ccoutant@google.com>
14030
14031         * errors.cc (Errors::info): New function.
14032         (gold_info): New function.
14033         * errors.h (Errors::info): New function.
14034         * gold.h (gold_info): New function.
14035         * object.cc (Input_objects::add_object): Print trace output.
14036         * options.cc (options::parse_set): New function.
14037         (General_options::parse_wrap): Deleted.
14038         (General_options::General_options): Deleted initializer.
14039         * options.h (options::String_set): New typedef.
14040         (options::parse_set): New function.
14041         (DEFINE_set): New macro.
14042         (General_options::wrap): Changed to use DEFINE_set. Changed
14043         callers of any_wrap_symbols and is_wrap_symbol.
14044         (General_options::trace, General_options::trace_symbol):
14045         New options.
14046         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14047         (General_options::wrap_symbols_): Deleted.
14048         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14049
14050 2008-04-17  David S. Miller  <davem@davemloft.net>
14051
14052         * options.cc (General_options::parse_V): New function.
14053         * options.h: Add entries for -V and -Qy.
14054
14055 2008-04-17  Ian Lance Taylor  <iant@google.com>
14056
14057         * common.cc (Symbol_table::allocate_commons): Remove options
14058         parameter.  Change caller.
14059         (Symbol_table::do_allocate_commons): Remove options parameter.
14060         Change caller.  Just call do_allocate_commons_list twice.
14061         (Symbol_table::do_allocate_commons_list): New function, broken out
14062         of do_allocate_commons.
14063         * common.h (class Allocate_commons_task): Remove options_ field.
14064         Update constructor.
14065         * symtab.cc (Symbol_table::Symbol_table): Initialize
14066         tls_commons_.
14067         (Symbol_table::add_from_object): Put TLS common symbols on
14068         tls_commons_ list.
14069         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14070         which are IN_OUTPUT_DATA.
14071         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14072         allocate_commons and do_allocate_commons declarations.  Declare
14073         do_allocate_commons_list.
14074         * gold.cc (queue_middle_tasks): Update creation of
14075         Allocate_commons_task to not pass options.
14076         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14077         (TLS_TEST_C_FLAGS): New variable.
14078         (tls_test_c_pic.o): New target.
14079         (tls_test_shared.so): Link in tls_test_c_pic.o.
14080         (tls_test_c_pic_ie.o): New target.
14081         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14082         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14083         (tls_test_c.o): New target.
14084         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14085         (tls_pic_test_LDADD): Likewise.
14086         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14087         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14088         (tls_test_c_gnu2.o): New target.
14089         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14090         tls_test_c_gnu2.o.
14091         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14092         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14093         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14094         * testsuite/tls_test.cc: Include "config.h".
14095         (t_last): Call t11_last.
14096         * testsuite/tls_test.h (t11, t11_last): Declare.
14097         * testsuite/tls_test_c.c: New file.
14098         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14099         * configure.ac: Check for OpenMP support.
14100         * configure, config.in, Makefile.in: Rebuild.
14101         * testsuite/Makefile.in: Rebuild.
14102
14103 2008-04-16  Cary Coutant  <ccoutant@google.com>
14104
14105         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14106         (Target_i386::tls_base_symbol_defined_): New field.
14107         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14108         (Target_i386::Scan::global): Likewise.
14109         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14110         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14111         (Target_x86_64::tls_base_symbol_defined_): New field.
14112         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14113         (Target_x86_64::Scan::global): Likewise.
14114
14115 2008-04-16  Cary Coutant  <ccoutant@google.com>
14116
14117         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14118         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14119         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14120         building shared libraries.
14121         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14122         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14123         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14124         * testsuite/Makefile.in: Rebuild.
14125         * testsuite/weak_undef.h: New file.
14126         * testsuite/weak_undef_file1.cc: Add extra test cases.
14127         * testsuite/weak_undef_file2.cc: Likewise.
14128         * testsuite/weak_undef_test.cc: Likewise.
14129
14130 2008-04-16  David S. Miller  <davem@davemloft.net>
14131
14132         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14133         Add issued_non_pic_error_ field.  Declare check_non_pic.
14134         (Target_sparc::Scan::check_non_pic): New function.
14135         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14136         (Target_sparc::Scan::global): Likewise.
14137
14138         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14139         * configure: Rebuild.
14140
14141         * options.h (DEFINE_enable): New macro.
14142         (new_dtags): New enable option.
14143         (initfirst, interpose, loadfltr, nodefaultlib,
14144         nodelete, nodlopen, nodump): New -z options.
14145         * layout.cc (Layout:finish_dynamic_section): If new
14146         dtags enabled, emit DT_RUNPATH.  Also, emit a
14147         DT_FLAGS_1 containing any specified -z flags.
14148
14149 2008-04-16  Ian Lance Taylor  <iant@google.com>
14150
14151         * copy-relocs.cc: New file.
14152         * copy-relocs.h: New file.
14153         * reloc.cc: Remove Copy_relocs code.
14154         * reloc.h: Likewise.
14155         * reloc-types.h (struct Reloc_types) [both versions]: Add
14156         get_reloc_addend_noerror.
14157         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14158         variants of add_global which take an addend which must be zero.
14159         * i386.cc: Include "copy-relocs.h".
14160         (class Target_i386): Change type of copy_relocs_ to variable,
14161         update initializer.
14162         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14163         Change all callers.
14164         (Target_i386::do_finalize_sections): Change handling of
14165         copy_relocs_.
14166         * sparc.cc: Include "copy-relocs.h".
14167         (class Target_sparc): Change type of copy_relocs_ to variable,
14168         update initializer.
14169         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14170         Change all callers.
14171         (Target_sparc::do_finalize_sections): Change handling of
14172         copy_relocs_.
14173         * x86_64.cc: Include "copy-relocs.h".
14174         (class Target_x86_64): Change type of copy_relocs_ to variable,
14175         update initializer.
14176         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14177         class.  Change all callers.
14178         (Target_x86_64::do_finalize_sections): Change handling of
14179         copy_relocs_.
14180         * Makefile.am (CCFILES): Add copy-relocs.cc.
14181         (HFILES): Add copy-relocs.h.
14182
14183         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14184
14185         * testsuite/script_test_4.sh: Permit leading zeroes.
14186
14187 2008-04-15  Ian Lance Taylor  <iant@google.com>
14188
14189         * script-sections.cc (Script_sections::create_segments): Use
14190         header_size_adjustment even when there is enough room for the
14191         headers.
14192         * testsuite/script_test_4.sh: New file.
14193         * testsuite/script_test_4.t: New file.
14194         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14195         (check_DATA): Add script_test_4.stdout.
14196         (MOSTLYCLEANFILES): Likewise.
14197         (script_test_4): New target.
14198         (script_test_4.stdout): New target.
14199         * testsuite/Makefile.in: Rebuild.
14200
14201         * sparc.cc: Add definitions for Output_data_plt_sparc class
14202         constants.
14203
14204 2008-04-14  David S. Miller  <davem@davemloft.net>
14205
14206         * sparc.cc: New file.
14207         * Makefile.am (TARGETSOURCES): Add sparc.cc
14208         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14209         * configure.tgt: Document targ_extra_size and
14210         targ_extra_big_endian.  Add entries for sparc-* and
14211         sparc64-*.
14212         * configure.ac: Handle targ_extra_size and
14213         targ_extra_big_endian.
14214         * Makefile.in: Rebuild.
14215         * configure: Likewise.
14216         * po/POTFILES.in: Likewise.
14217         * po/gold.pot: Likewise.
14218
14219 2008-04-14  Ian Lance Taylor  <iant@google.com>
14220
14221         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14222         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14223         in the name/type/flags to section mapping.  Don't call
14224         allocate_output_section.
14225         (Layout::choose_output_section): Change parameter from adjust_name
14226         to is_input_section.  Don't permit input sections after sections
14227         are attached to segments.  Don't call allocate_output_section.
14228         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14229         not write_enable_output_section.
14230         (Layout::make_output_section): Don't push to
14231         unattached_section_list_ nor call attach_to_segment.  Call
14232         attach_section_to_segment if sections are attached.
14233         (Layout::attach_sections_to_segments): New function.
14234         (Layout::attach_section_to_segment): New function.
14235         (Layout::attach_allocated_section_to_segment): Rename from
14236         attach_to_segment.  Remove flags parameter.
14237         (Layout::allocate_output_section): Remove function.
14238         (Layout::write_enable_output_section): Remove function.
14239         * layout.h (class Layout): Update for above changes.  Add new
14240         field sections_are_attached_.
14241         * output.h (Output_section::update_flags_for_input_section): New
14242         function.
14243         * output.cc (Output_section::add_input_section): Call
14244         update_flags_for_input_section.
14245         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14246
14247 2008-04-11  Cary Coutant  <ccoutant@google.com>
14248
14249         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14250         thought unnecessary.
14251         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14252
14253 2008-04-11  Ian Lance Taylor  <iant@google.com>
14254
14255         * output.h (class Output_section_data): Remove inline definition
14256         of set_addralign.
14257         * output.cc (Output_section_data::set_addralign): New function.
14258
14259 2008-04-11  Cary Coutant  <ccoutant@google.com>
14260
14261         Add support for TLS descriptors for i386 and x86_64.
14262         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14263         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14264         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14265         GOT_TYPE_TLS_DESC.
14266         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14267         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14268         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14269         relocations.
14270         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14271         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14272         Fix problem with initial-exec relocations.
14273         (Target_i386::Relocate::relocate_tls): Likewise.
14274         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14275         relaxation.
14276         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14277         support for section-plus-offset dynamic table entries.
14278         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14279         (Output_data_dynamic::Dynamic_entry): Add support for
14280         section-plus-offset dynamic table entries.
14281         (Output_data_dynamic::Classification): Likewise.
14282         (Output_data_dynamic::classification_): Renamed offset_.
14283         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14284         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14285         (Target_x86_64::make_plt_section): New function.
14286         (Target_x86_64::reserve_tlsdesc_entries): New function.
14287         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14288         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14289         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14290         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14291         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14292         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14293         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14294         add extra PLT entry for TLS descriptors.
14295         (Output_data_plt_x86_64::got_): New field.
14296         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14297         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14298         fields.
14299         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14300         descriptors.
14301         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14302         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14303         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14304         R_386_TLS_DESC_CALL relocations.
14305         (Target_x86_64::Scan::global): Likewise.
14306         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14307         for TLS descriptors.
14308         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14309         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14310         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14311         GD-to-IE relaxation.
14312         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14313         and TLS_DESCRIPTORS.
14314         * Makefile.in: Rebuild.
14315         * configure: Rebuild.
14316         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14317         (tls_test_shared2.so): New target.
14318         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14319         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14320         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14321         (tls_shared_gd_to_ie_test_LDADD): New variable.
14322         (tls_shared_gnu2_gd_to_ie_test): New target.
14323         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14324         New targets.
14325         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14326         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14327         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14328         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14329         (tls_shared_gnu2_test): New target.
14330         (tls_test_gnu2_shared.so): New target.
14331         (tls_shared_gnu2_test_SOURCES): New variable.
14332         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14333         (tls_shared_gnu2_test_LDFLAGS): New variable.
14334         (tls_shared_gnu2_test_LDADD): New variable.
14335         * testsuite/Makefile.in: Rebuild.
14336         * testsuite/Makefile.
14337
14338 2008-04-11  Ian Lance Taylor  <iant@google.com>
14339
14340         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14341         justsyms.t.
14342         * testsuite/Makefile.in: Rebuild.
14343
14344         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14345         long.
14346         * testsuite/script_test_2.cc (main): Adjust test.
14347
14348 2008-04-11  David S. Miller  <davem@davemloft.net>
14349             Ian Lance Taylor  <iant@google.com>
14350
14351         * options.h (General_options): Add entries for '-Y' and
14352         '-relax'.
14353         * options.cc (General_options:finalize): If -Y was used, add those
14354         entries to the library path instead of the default "/lib" and
14355         "/usr/lib".
14356
14357 2008-04-11  David S. Miller  <davem@davemloft.net>
14358
14359         * testsuite/justsyms.t: Start at 0x100.
14360         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14361         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14362         long.
14363         * testsuite/script_test_2.cc: Adjust string and section length
14364         checks.
14365
14366 2008-04-09  Ian Lance Taylor  <iant@google.com>
14367
14368         PR gold/5996
14369         * script-sections.cc (Sections_element::allocate_to_segment): Add
14370         orphan parameter.
14371         (Output_section_definition::allocate_to_segment): Likewise.
14372         (Orphan_output_section::allocate_to_segment): Likewise.
14373         (Script_sections::attach_sections_using_phdrs_clause): Don't
14374         propagate non-PT_LOAD segments to orphan sections.
14375         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14376         readelf rather than objdump.
14377         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14378         .interp section and PT_INTERP segment are the same size.
14379         * testsuite/Makefile.in: Rebuild.
14380
14381         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14382         aliases for symbols defined in the same object.
14383         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14384         (weak_alias_test_SOURCES): New variable.
14385         (weak_alias_test_DEPENDENCIES): New variable.
14386         (weak_alias_test_LDFLAGS): New variable.
14387         (weak_alias_test_LDADD): New variable.
14388         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14389         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14390         (weak_alias_test_3.o): New target.
14391         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14392         * testsuite/weak_alias_test_main.cc: New file.
14393         * testsuite/weak_alias_test_1.cc: New file.
14394         * testsuite/weak_alias_test_2.cc: New file.
14395         * testsuite/weak_alias_test_3.cc: New file.
14396
14397 2008-04-08  Ian Lance Taylor  <iant@google.com>
14398
14399         * options.h (class General_options): Add --noinhibit-exec option.
14400         * main.cc (main): Check --noinhibit-exec.
14401
14402         * options.h (class General_options): Define --wrap as a special
14403         option.  Add wrap_symbols_ field.
14404         (General_options::any_wrap_symbols): New function.
14405         (General_options::is_wrap_symbol): New function.
14406         * options.cc (General_options::parse_wrap): New function.
14407         (General_options::General_options): Initialize wrap_symbols_.
14408         * symtab.cc (Symbol_table::wrap_symbol): New function.
14409         (Symbol_table::add_from_object): Handle --wrap.
14410         * symtab.h (class Symbol_table): Declare wrap_symbol.
14411         * target.h (Target::wrap_char): New function.
14412         (Target::Target_info): Add wrap_char field.
14413         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14414         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14415         * testsuite/testfile.cc (Target_test::test_target_info):
14416         Likewise.
14417
14418         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14419         there is one.
14420
14421         * layout.h (class Layout): Add added_eh_frame_data_ field.
14422         * layout.cc (Layout::Layout): Initialize new field.
14423         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14424         output section until we find a section we merged successfully.
14425         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14426         that the size be non-zero.
14427
14428         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14429         qualifier.
14430
14431 2008-04-08  Craig Silverstein  <csilvers@google.com>
14432
14433         * configure.ac: Export new conditional variable HAVE_ZLIB.
14434         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14435         on HAVE_ZLIB.
14436         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14437         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14438
14439 2008-04-07  Ian Lance Taylor  <iant@google.com>
14440
14441         * version.cc (version_string): Set to "1.5".
14442
14443         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14444         Add issued_non_pic_error_ field.  Declare check_non_pic.
14445         (Target_x86_64::Scan::check_non_pic): New function.
14446         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14447         (Target_x86_64::Scan::global): Likewise.
14448
14449         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14450         addend parameter.  Change caller.  Handle merge sections.
14451         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14452         Address to Addend.  Don't add in the result of
14453         local_section_offset, pass down the addend and use the returned
14454         value.
14455         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14456         Update declarations of local_section_offset and symbol_value.
14457         * testsuite/two_file_test_1.cc (t18): New function.
14458         * testsuite/two_file_test_2.cc (f18): New function.
14459         * testsuite/two_file_test_main.cc (main): Call t18.
14460         * testsuite/two_file_test.h (t18, f18): Declare.
14461
14462         * configure.ac: Don't test for objdump, c++filt, or readelf.
14463         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14464         conditionals.
14465         (TEST_READELF): New variable.
14466         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14467         (check_PROGRAMS): Add two_file_strip_test.
14468         (two_file_strip_test): New target.
14469         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14470         (two_file_same_shared_strip_test_SOURCES): New variable.
14471         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14472         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14473         (two_file_same_shared_strip_test_LDADD): New variable.
14474         (two_file_shared_strip.so): New target.
14475         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14476         (ver_test_5.syms, ver_test_7.syms): Likewise.
14477         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14478         (strip_test_3.stdout): Use TEST_OBJDUMP.
14479         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14480
14481 2008-04-04  Cary Coutant  <ccoutant@google.com>
14482
14483         * symtab.h (Symbol::is_weak_undefined): New function.
14484         (Symbol::is_strong_undefined): New function.
14485         (Symbol::is_absolute): New function.
14486         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14487         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14488         absolute symbols.
14489         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14490         (weak_undef_test): New target.
14491         * testsuite/Makefile.in: Rebuild.
14492         * testsuite/weak_undef_file1.cc: New file.
14493         * testsuite/weak_undef_file2.cc: New file.
14494         * testsuite/weak_undef_test.cc: New file.
14495
14496 2008-04-03  Craig Silverstein  <csilvers@google.com>
14497
14498         * compressed_output.h (class Output_compressed_section): Use
14499         unsigned buffer.
14500         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14501         add zlib header.
14502         (zlib_compressed_suffix): Removed.
14503         (Output_compressed_section::set_final_data_size): Use unsigned
14504         buffers.
14505         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14506         Fix linker invocation.
14507         (flagstest_o_specialfile_and_compress_debug_sections):
14508         Likewise.
14509         * testsuite/Makefile.in: Regenerated.
14510
14511 2008-04-02  David S. Miller  <davem@davemloft.net>
14512
14513         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14514         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14515
14516 2008-04-02  Craig Silverstein  <csilvers@google.com>
14517
14518         * TODO: New file.
14519
14520 2008-04-02  Ian Lance Taylor  <iant@google.com>
14521
14522         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14523         parameters.  Update for new key type to views_.  Change all
14524         callers.
14525         (File_read::read): Adjust for byteshift in returned view.
14526         (File_read::add_view): New function, broken out of
14527         find_and_make_view.
14528         (File_read::make_view): New function, broken out of
14529         find_and_make_view.
14530         (File_read::find_or_make_view): Add offset and aligned
14531         parameters.  Rewrite accordingly.  Change all callers.
14532         (File_read::get_view): Add offset and aligned parameters.  Adjust
14533         for byteshift in return value.
14534         (File_read::get_lasting_view): Likewise.
14535         * fileread.h (class File_read): Update declarations.
14536         (class File_read::View): Add byteshift_ field.  Add byteshift to
14537         constructor.  Add byteshift method.
14538         * archive.h (Archive::clear_uncached_views): New function.
14539         (Archive::get_view): Add aligned parameter.  Change all callers.
14540         * object.h (Object::get_view): Add aligned parameter.  Change all
14541         callers.
14542         (Object::get_lasting_view): Likewise.
14543
14544         * fileread.cc (File_read::release): Don't call clear_views if
14545         there are multiple objects.
14546         * fileread.h (File_read::clear_uncached_views): New function.
14547         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14548         on the archive.
14549
14550 2008-03-31  Cary Coutant  <ccoutant@google.com>
14551
14552         Add thin archive support.
14553         * archive.cc (Archive::armagt): New const.
14554         (Archive::setup): Remove task parameter and calls to unlock.
14555         (Archive::unlock_nested_archives): New function.
14556         (Archive::read_header): Add nested_off parameter. Change
14557         all callers.
14558         (Archive::interpret_header): Likewise.
14559         (Archive::include_all_members): Change to handle thin
14560         archives.
14561         (Archive::include_member): Likewise.
14562         * archive.h (Archive::Archive): Add new parameters and
14563         initializers.
14564         (Archive::armagt): New const.
14565         (Archive::setup): Remove task parameter.
14566         (Archive::unlock_nested_archives): New function.
14567         (Archive::read_header): Add nested_off parameter.
14568         (Archive::interpret_header): Likewise.
14569         (Archive::Nested_archive_table): New typedef.
14570         (Archive::is_thin_archive_): New field.
14571         (Archive::nested_archives_): New field.
14572         (Archive::options_): New field.
14573         (Archive::dirpath_): New field.
14574         (Archive::task_): New field.
14575         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14576         for thin archives.  Pass additional parameters to
14577         Archive::Archive.  Unlock the archive file after calling
14578         Archive::setup.
14579
14580 2008-03-29  Ian Lance Taylor  <iant@google.com>
14581
14582         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14583         version symbol to be local.
14584         * testsuite/ver_test_4.sh: New file.
14585         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14586         (check_DATA): Add ver_test_4.syms.
14587         (ver_test_4.syms): New target.
14588         * testsuite/Makefile.in: Rebuild.
14589
14590         * output.cc
14591         (Output_section::Input_section_sort_entry::has_priority): New
14592         function.
14593         (Output_section::Input_section_sort_entry::match_file_name): New
14594         function.
14595         (Output_section::Input_section_sort_entry::match_section_name):
14596         Remove.
14597         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14598         Remove.
14599         (Output_section::Input_section_sort_entry::match_section_file):
14600         Remove.
14601         (Output_section::Input_section_sort_compare::operator()): Rewrite
14602         using new Input_section_sort_entry functions.  Sort crtbegin and
14603         crtend first.  Sort sections with no priority before sections with
14604         a priority.
14605         * testsuite/initpri1.c (d3): Check j != 4.
14606         (cd5): New constructor/destructor function.
14607         (main): Check j != 2.
14608
14609         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14610         new symbol when resolving, don't call set_is_default.
14611         * testsuite/ver_test_7.cc: New file.
14612         * testsuite/ver_test_7.sh: New file.
14613         * testsuite/Makefile.am (ver_test_7.so): New target.
14614         (ver_test_7.o): New target.
14615         (check_SCRIPTS): Add ver_test_7.sh.
14616         (check_DATA): Add ver_test_7.syms.
14617         (ver_test_7.syms): New target.
14618
14619 2008-03-28  Ian Lance Taylor  <iant@google.com>
14620
14621         * layout.cc (Layout::layout): If we see an input section with a
14622         name that needs sorting, set the must_sort flag for the output
14623         section.
14624         (Layout::make_output_section): If the name of the output section
14625         indicates that it might require sorting, set the may_sort flag.
14626         * output.h (Output_section::may_sort_attached_input_sections): New
14627         function.
14628         (Output_section::set_may_sort_attached_input_sections): New
14629         function.
14630         (Output_section::must_sort_attached_input_sections): New
14631         function.
14632         (Output_section::set_must_sort_attached_input_sections): New
14633         function.
14634         (class Output_section): Declare Input_section_sort_entry.  Define
14635         Input_section_sort_compare.  Declare
14636         sort_attached_input_sections.  Add new fields:
14637         may_sort_attached_input_sections_,
14638         must_sort_attached_input_sections_,
14639         attached_input_sections_are_sorted_.
14640         * output.cc (Output_section::Output_section): Initialize new
14641         fields.
14642         (Output_section::add_input_section): Add an entry to
14643         input_sections_ if may_sort or must_sort are true.
14644         (Output_section::set_final_data_size): Call
14645         sort_attached_input_sections if necessary.
14646         (Output_section::Input_section_sort_entry): Define new class.
14647         (Output_section::Input_section_sort_compare::operator()): New
14648         function.
14649         (Output_section::sort_attached_input_sections): New function.
14650         * configure.ac: Check whether the compiler supports constructor
14651         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14652         * testsuite/initpri1.c: New file.
14653         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14654         CONSTRUCTOR_PRIORITY.
14655         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14656         (initpri1_LDFLAGS): New variable.
14657         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14658
14659 2008-03-27  Ian Lance Taylor  <iant@google.com>
14660
14661         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14662         * testsuite/common_test_1.c: New file.
14663         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14664         (common_test_1_SOURCES): New variable.
14665         (common_test_1_DEPENDENCIES): New variable.
14666         (common_test_1_LDFLAGS): New variable.
14667
14668         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14669         and commons_ correctly when NAME/VERSION does not override
14670         NAME/NULL.
14671         * testsuite/ver_test_6.c: New file.
14672         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14673         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14674         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14675
14676 2008-03-26  Ian Lance Taylor  <iant@google.com>
14677
14678         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14679         of an undefined symbol from a version script.
14680         * testsuite/Makefile.am (ver_test_5.so): New target.
14681         (ver_test_5.o): New target.
14682         (check_SCRIPTS): Add ver_test_5.sh.
14683         (check_DATA): Add ver_test_5.syms.
14684         (ver_test_5.syms): New target.
14685         * testsuite/ver_test_5.cc: New file.
14686         * testsuite/ver_test_5.script: New file.
14687         * testsuite/ver_test_5.sh: New file.
14688         * Makefile.in, testsuite/Makefile.in: Rebuild.
14689
14690         PR gold/5986
14691         Fix problems building gold with gcc 4.3.0.
14692         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14693         (gold_error_at_location, gold_warning_at_location): Use it.
14694         * configure.ac: Check whether we can compile and use a template
14695         function with a printf attribute.
14696         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14697         when jumping over bytes.
14698         * object.cc: Instantiate Object::read_section_data.
14699         * debug.h: Include <cstring>
14700         * dwarf_reader.cc: Include <algorithm>
14701         * main.cc: Include <cstring>.
14702         * options.cc: Include <cstring>.
14703         * output.cc: Include <cstring>.
14704         * script.cc: Include <cstring>.
14705         * script.h: Include <string>.
14706         * symtab.cc: Include <cstring> and <algorithm>.
14707         * target-select.cc: Include <cstring>.
14708         * version.cc: Include <string>.
14709         * testsuite/testmain.cc: Include <cstdlib>.
14710         * configure, config.in: Rebuild.
14711
14712 2008-03-25  Ian Lance Taylor  <iant@google.com>
14713
14714         * options.cc: Include "../bfd/bfdver.h".
14715         (options::help): Print bug reporting address.
14716
14717         * version.cc (print_version): Adjust output for current value of
14718         BFD_VERSION_STRING.
14719
14720         * NEWS: New file.
14721
14722         * options.cc (options::help): Print list of supported targets.
14723         * target-select.h: Include <vector>.
14724         (class Target_selector): Make machine_, size_, and is_big_endian_
14725         fields const.  Add bfd_name_ and instantiated_target_ fields.
14726         (Target_selector::Target_selector): Add bfd_name parameter.
14727         (Target_selector::recognize): Make non-virtual, call
14728         do_recognize.
14729         (Target_selector::recognize_by_name): Make non-virtual, call
14730         do_recognize_by_name.
14731         (Target_selector::supported_names): New function.
14732         (Target_selector::bfd_name): New function.
14733         (Target_selector::do_instantiate_target): New pure virtual
14734         function.
14735         (Target_selector::do_recognize): New virtual function.
14736         (Target_selector::do_recognize_by_name): New virtual function.
14737         (Target_selector::instantiate_target): New private function.
14738         (supported_target_names): Declare.
14739         * target-select.cc (Target_selector::Target_selector): Update for
14740         new parameter and fields.
14741         (select_target_by_name): Check that the name matches before
14742         calling recognize_by_name.
14743         (supported_target_names): New function.
14744         * i386.cc (class Target_selector_i386): Update Target_selector
14745         constructor call.  Remove recognize and recognize_by_name.  Add
14746         do_instantiate_target.
14747         * x86_64.cc (class Target_selector_x86_64): Likewise.
14748         * testsuite/testfile.cc (class Target_selector_test): Update for
14749         changes to Target_selector.
14750
14751         * README: Rewrite, with some notes on unsupported features.
14752
14753 2008-03-24  Cary Coutant  <ccoutant@google.com>
14754
14755         * i386.cc (Target_i386::Got_type): New enum declaration.
14756         (Target_i386::Scan::local): Updated callers of Output_data_got
14757         member functions.
14758         (Target_i386::Scan::global): Likewise.
14759         (Target_i386::Relocate::relocate): Likewise.
14760         (Target_i386::Relocate::relocate_tls): Likewise.
14761         * object.h (Got_offset_list): New class.
14762         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14763         (Sized_relobj::local_got_offset): Likewise.
14764         (Sized_relobj::set_local_got_offset): Likewise.
14765         (Sized_relobj::local_has_tls_got_offset): Removed.
14766         (Sized_relobj::local_tls_got_offset): Removed.
14767         (Sized_relobj::set_local_tls_got_offset): Removed.
14768         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14769         * output.cc (Output_data_got::add_global): Added got_type parameter.
14770         (Output_data_got::add_global_with_rel): Likewise.
14771         (Output_data_got::add_global_with_rela): Likewise.
14772         (Output_data_got::add_global_pair_with_rel): New function.
14773         (Output_data_got::add_global_pair_with_rela): New function.
14774         (Output_data_got::add_local): Added got_type parameter.
14775         (Output_data_got::add_local_with_rel): Likewise.
14776         (Output_data_got::add_local_with_rela): Likewise.
14777         (Output_data_got::add_local_pair_with_rel): New function.
14778         (Output_data_got::add_local_pair_with_rela): New function.
14779         (Output_data_got::add_global_tls): Removed.
14780         (Output_data_got::add_global_tls_with_rel): Removed.
14781         (Output_data_got::add_global_tls_with_rela): Removed.
14782         (Output_data_got::add_local_tls): Removed.
14783         (Output_data_got::add_local_tls_with_rel): Removed.
14784         (Output_data_got::add_local_tls_with_rela): Removed.
14785         * output.h (Output_data_got::add_global): Added got_type parameter.
14786         (Output_data_got::add_global_with_rel): Likewise.
14787         (Output_data_got::add_global_with_rela): Likewise.
14788         (Output_data_got::add_global_pair_with_rel): New function.
14789         (Output_data_got::add_global_pair_with_rela): New function.
14790         (Output_data_got::add_local): Added got_type parameter.
14791         (Output_data_got::add_local_with_rel): Likewise.
14792         (Output_data_got::add_local_with_rela): Likewise.
14793         (Output_data_got::add_local_pair_with_rel): New function.
14794         (Output_data_got::add_local_pair_with_rela): New function.
14795         (Output_data_got::add_global_tls): Removed.
14796         (Output_data_got::add_global_tls_with_rel): Removed.
14797         (Output_data_got::add_global_tls_with_rela): Removed.
14798         (Output_data_got::add_local_tls): Removed.
14799         (Output_data_got::add_local_tls_with_rel): Removed.
14800         (Output_data_got::add_local_tls_with_rela): Removed.
14801         * resolve.cc (Symbol::override_base_with_special): Removed
14802         reference to has_got_offset_ field.
14803         * symtab.cc (Symbol::init_fields): Replaced initialization
14804         of got_offset_ with got_offsets_.  Removed initialization
14805         of has_got_offset_
14806         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14807         (Symbol::got_offset): Likewise.
14808         (Symbol::set_got_offset): Likewise.
14809         (Symbol::has_tls_got_offset): Removed.
14810         (Symbol::tls_got_offset): Removed.
14811         (Symbol::set_tls_got_offset): Removed.
14812         (Symbol::got_offset_): Removed.
14813         (Symbol::tls_mod_got_offset_): Removed.
14814         (Symbol::tls_pair_got_offset_): Removed.
14815         (Symbol::got_offsets_): New field.
14816         (Symbol::has_got_offset): Removed.
14817         (Symbol::has_tls_mod_got_offset): Removed.
14818         (Symbol::has_tls_pair_got_offset): Removed.
14819         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14820         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14821         member functions.
14822         (Target_x86_64::Scan::global): Likewise.
14823         (Target_x86_64::Relocate::relocate): Likewise.
14824         (Target_x86_64::Relocate::relocate_tls): Likewise.
14825
14826 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14827
14828         * yyscript.y: Fix spelling error in comment.
14829
14830 2008-03-24  Ian Lance Taylor  <iant@google.com>
14831
14832         * options.h (class General_options): Define build_id option.
14833         * layout.h (class Layout): Declare write_build_id, create_note,
14834         create_build_id.  Add build_id_note_ member.
14835         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14836         "libiberty.h", "md5.h", "sha1.h".
14837         (Layout::Layout): Initialize eh_frame_data_,
14838         eh_frame_hdr_section_, and build_id_note_.
14839         (Layout::finalize): Call create_build_id.
14840         (Layout::create_note): New function, broken out of
14841         Layout::create_gold_note.
14842         (Layout::create_gold_note): Call create_note.
14843         (Layout::create_build_id): New function.
14844         (Layout::write_build_id): New function.
14845         (Close_task_runner::run): Call write_build_id.
14846
14847         * x86_64.cc: Correct license to GPLv3.
14848
14849 2008-03-23  Ian Lance Taylor  <iant@google.com>
14850
14851         * options.cc: Include "demangle.h".
14852         (parse_optional_string): New function.
14853         (parse_long_option): Handle takes_optional_argument.
14854         (parse_short_option): Update dash_z initializer.  Handle
14855         takes_optional_argument.
14856         (General_options::General_options): Initialize do_demangle_.
14857         (General_options::finalize): Set do_demangle_.  Handle demangling
14858         style.
14859         * options.h (parse_optional_string): Declare.
14860         (struct One_option): Add optional_arg field.  Update constructor.
14861         Update call constructor calls.  Add takes_optional_argument
14862         function.
14863         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14864         (DEFINE_optional_string): Define.
14865         (General_options::demangle): Change from DEFINE_bool to
14866         DEFINE_optional_string.
14867         (General_options::no_demangle): New function.
14868         (General_options::do_demangle): New function.
14869         (General_options::set_do_demangle): New function.
14870         (General_options::execstack_status_): Move definition to end of
14871         class definition.
14872         (General_options::static_): Likewise.
14873         (General_options::do_demangle_): New field.
14874         * object.cc (big_endian>::get_symbol_location_info): Call
14875         Options::do_demangle, not Options::demangle.
14876         * symtab.cc (demangle): Likewise.
14877
14878 2008-03-22  Ian Lance Taylor  <iant@google.com>
14879
14880         * gold.h: Include <cstddef> and <sys/types.h>
14881         * options.h: Include <cstring>.
14882
14883 2008-03-21  Ian Lance Taylor  <iant@google.com>
14884
14885         * Added source code to GNU binutils.
14886 \f
14887 Copyright (C) 2008-2013 Free Software Foundation, Inc.
14888
14889 Copying and distribution of this file, with or without modification,
14890 are permitted in any medium without royalty provided the copyright
14891 notice and this notice are preserved.
14892
14893 Local Variables:
14894 mode: change-log
14895 left-margin: 8
14896 fill-column: 74
14897 version-control: never
14898 End: