2013-03-29 Sriraman Tallam <tmsriram@google.com>
[platform/upstream/binutils.git] / gold / ChangeLog
1 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2
3         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
4         object before calling the plugin claim_file handler.  Pass the elf
5         object of the archive to the plugin. Delete the elf object if the
6         plugin claims the file.
7
8 2013-03-21  Alan Modra  <amodra@gmail.com>
9
10         * layout.cc (Layout::set_segment_offsets): Accept writable .text
11         segment when omagic.
12
13 2013-03-21  Alan Modra  <amodra@gmail.com>
14
15         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
16         comparison warning.
17         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
18         uninitialized" warning.
19
20 2013-03-20  Alan Modra  <amodra@gmail.com>
21
22         * symtab.h (Symbol::clear_version): New function.
23         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
24         is_needed by weak references.  Clear version for symbols defined
25         in as-needed objects that are not needed.
26
27 2013-03-15  Alan Modra  <amodra@gmail.com>
28
29         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
30         static and public.  Add report_err param.  Return false for data refs.
31         (Target_powerpc::rela_dyn_section): New overloaded function.
32         (Target_powerpc::plt_, iplt_): Elucidate.
33         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
34         (Output_data_plt_powerpc::do_write): Don't write .iplt.
35         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
36         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
37         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
38         push_branch and make_plt_entry for ifunc syms when
39         reloc_needs_plt_for_ifunc.
40         (Target_powerpc::Relocate::relocate): Don't use plt entry value
41         for ifunc unless reloc_needs_plt_for_ifunc.
42
43 2013-03-15  Alan Modra  <amodra@gmail.com>
44
45         * gc.h (gc_process_relocs): Don't look through function descriptors.
46         * icf.cc (get_section_contents): Do so here instead.
47
48 2013-03-13  Alan Modra  <amodra@gmail.com>
49
50         * powerpc.cc (is_branch_reloc): Forward declare.
51         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
52         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
53         false for 64-bit, true for 32-bit non-branch relocs.
54         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
55         * testsuite/Makefile.am (icf_test): Use linker map file instead of
56         nm output.
57         (icf_safe_test): Generate linker map file as well as nm output.
58         (icf_safe_so_test): Likewise.
59         * testsuite/Makefile.in: Regenerate.
60         * testsuite/icf_test.sh: Parse linker map file to determine
61         section folding.
62         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
63         * testsuite/icf_safe_so_test.sh: Likewise.
64         (X86_32_or_ARM_specific_safe_fold): Merge into..
65         (arch_specific_safe_fold): ..this.
66         (X86_64_specific_safe_fold): Delete unused function.
67
68 2013-03-12  Alan Modra  <amodra@gmail.com>
69
70         * gc.h (gc_process_relocs): Look through function descriptors
71         to determine shndx, symvalue and addend used by ICF.  Tidy
72         variable duplication.
73
74 2013-03-11  Alan Modra  <amodra@gmail.com>
75
76         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
77         * layout.cc (Layout_task_runner::run): ..to here.
78         * symtab.h (struct Symbol_location): Extract from..
79         (class Symbol_table): ..here.
80         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
81         * target.h (class Target): Add function_location and
82         do_function_location functions.
83         (class Sized_target): Add do_function_location.
84         * object.h (class Sized_relobj_file): Move find_shdr..
85         (class Object): ..to here.
86         * object.cc: Likewise.  Update to suit.  Instantiate.
87         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
88         * powerpc.cc (class Powerpc_dynobj): New.
89         (Target_powerpc::do_function_location): New function.
90         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
91         (Powerpc_dynobj::do_read_symbols): New function.
92         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
93
94 2013-03-08  Ian Lance Taylor  <iant@google.com>
95
96         * options.cc (General_options::string_to_object_format): Accept
97         "default".
98
99 2013-03-08  Alan Modra  <amodra@gmail.com>
100
101         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
102         pointer to Post_fde.
103         (struct Post_fde): Move definition to here..
104         * ehframe.cc (struct Post_fde): ..from here.
105         (Cie::write): Don't alloc Post_fde.
106         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
107
108 2013-03-07  Alan Modra  <amodra@gmail.com>
109
110         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
111         relocation referencing .LC0.
112         * testsuite/discard_locals_test.sh: Remove FIXMEs.
113
114 2013-03-07  Alan Modra  <amodra@gmail.com>
115
116         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
117         always_inline.  Add assembly for powerpc to avoid GOT.
118
119 2013-03-07  Alan Modra  <amodra@gmail.com>
120
121         * testsuite/script_test_10.sh: Don't test .bss section
122         header number.
123
124 2013-03-06  Alan Modra  <amodra@gmail.com>
125
126         * powerpc.cc (class Powerpc_relobj): Move some member functions.
127         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
128         all callers.  Handle folded sections.
129         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
130         to Powerpc_relobj.
131         (Global_symbol_visitor_opd::operator()): Likewise.
132
133 2013-03-04  Alan Modra  <amodra@gmail.com>
134
135         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
136         * testsuite/Makefile.in: Regenerate.
137
138 2013-03-01  Cary Coutant  <ccoutant@google.com>
139
140         Add dwp support for v2 DWARF package file format.
141         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
142         tu_length parameter.  Adjust all callers.
143         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
144         * dwp.cc: Include dwarf.h.
145         (Section_bounds): New struct type.
146         (Unit_set): New struct type.
147         (Dwo_file::Dwo_file): Initialize new data member.
148         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
149         Combine and rename to...
150         (Dwo_file::read_unit_index): ...this.
151         (Dwo_file::sized_read_compunit_index)
152         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
153         (Dwo_file::sized_read_unit_index): ...this.
154         (Dwo_file::copy_section): Remove section_name, is_str_offsets
155         parameters; add section_id parameter.
156         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
157         (Dwo_file::add_unit_set): ...this.
158         (Dwo_file::shndx_map_): Remove.
159         (Dwo_file::sect_offsets_): New data member.
160         (Dwp_output_file::Dwp_output_file): Initialize new data members.
161         (Dwp_output_file::add_section): Rename to...
162         (Dwp_output_file::add_contribution): ...this.
163         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
164         (Dwp_output_file::add_tu_set): Likewise.
165         (Dwp_output_file::Contribution): New type.
166         (Dwp_output_file::Section::contributions): New data member.
167         (Dwp_output_file::Cu_or_tu_set): Remove.
168         (Dwp_output_file::Section::Section): New ctor.
169         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
170         (Dwp_output_file::Dwp_index::Section_table): New type.
171         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
172         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
173         parameter.
174         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
175         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
176         (Dwp_output_file::Dwp_index::section_table): New member function.
177         (Dwp_output_file::Dwp_index::section_table_end): New member function.
178         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
179         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
180         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
181         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
182         (Dwp_output_file::Dwp_index::section_table_): New data member.
183         (Dwp_output_file::Dwp_index::section_mask_): New data member.
184         (Dwp_output_file::add_output_section): New member function.
185         (Dwp_output_file::write_new_section): New member function.
186         (Dwp_output_file::write_contributions): New member function.
187         (Dwp_output_file::section_id_map_): New data member.
188         (class Dwo_id_info_reader): Remove.
189         (class Unit_reader): New class.
190         (get_dwarf_section_name): New function.
191         (Dwo_file::read_executable): Adjust initializations of class data.
192         (Dwo_file::read): Add support for v2 package file format.
193         (Dwo_file::read_unit_index): Likewise.
194         (Dwo_file::sized_read_unit_index): Likewise.
195         (Dwo_file::copy_section): Likewise.
196         (Dwo_file::add_unit_set): Likewise.
197         (Dwp_output_file::add_output_section): Likewise.
198         (Dwp_output_file::add_contribution): Likewise.
199         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
200         for empty slot.
201         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
202         file format.
203         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
204         slot.
205         (Dwp_output_file::initialize): Remove unused function.
206         (Dwp_output_file::finalize): Add support for v2 package file format.
207         (Dwp_output_file::write_index): Likewise.
208         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
209         function prototype.
210
211 2013-03-01  Cary Coutant  <ccoutant@google.com>
212
213         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
214         function into class definition in header file.
215         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
216         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
217         New function.
218         (Dwarf_info_reader::check_buffer): Move here from .cc file.
219
220 2013-02-28  Alan Modra  <amodra@gmail.com>
221
222         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
223         * target.cc (Target::do_plt_fde_location): New function.
224         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
225         accessor function, and constructor param.
226         (struct Post_fde, Post_fdes): Declare.
227         (Cie::write): Add post_fdes param.
228         * ehframe.cc (Fde::write): Use plt_fde_location.
229         (struct Post_fde): Define.
230         (Cie::write): Stash FDEs added post merge mapping.
231         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
232         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
233         (Eh_frame::do_sized_write): Arrange to write post map FDES after
234         other FDEs.
235         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
236         (Target_powerpc::has_glink): New function.
237         (Target_powerpc::do_relax): Add eh_frame info for stubs.
238         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
239         glink_eh_frame_fde_32, default_fde): New data.
240         (Stub_table::eh_frame_added_): New var.
241         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
242         Make const.
243         (Stub_table::add_eh_frame): New function.
244         (Output_data_glink::add_eh_frame): New function.
245         (Target_powerpc::make_glink_section): Call add_eh_frame.
246
247 2013-02-15  Ian Lance Taylor  <iant@google.com>
248
249         * options.h (DEFINE_uint64_alias): Define.
250         (class General_options): Add -Ttext-segment as an alias for
251         -Ttext.
252
253 2013-02-15  Alan Modra  <amodra@gmail.com>
254
255         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
256         (Stub_table::do_write): ..here, two places.
257         (Stub_table::plt_call_size): Use it here too.
258
259 2013-02-11  Ian Lance Taylor  <iant@google.com>
260
261         * descriptors.cc (Descriptors::close_all): New function.
262         * descriptors.h (class Descriptors): Declare close_all.
263         (close_all_descriptors): New inline function.
264         * plugin.cc: Include "descriptors.h".
265         (Plugin_manager::cleanup): Call close_all_descriptors.
266
267 2013-02-06  Alan Modra  <amodra@gmail.com>
268
269         * README: Update coding style link.
270
271 2013-01-28  Cary Coutant  <ccoutant@google.com>
272
273         * dwp.cc (File_list): New typedef.
274         (Dwo_name_info_reader): New class.
275         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
276         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
277         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
278         (Dwo_file::read_executable): New function.
279         (Dwo_file::read): Move common setup code to ...
280         (Dwo_file::make_object): ... here.
281         (dwp_options): Add --exec/-e.
282         (usage): Likewise.
283         (main): Likewise.
284
285 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
286
287         * layout.cc (Layout::layout): Check for option text_reorder.
288         (Layout::make_output_section): Ditto.
289         * options.h (text_reorder): New option.
290         * output.cc (Input_section_sort_compare): Remove special ordering
291         of section names.
292         (Output_section::
293          Input_section_sort_section_name_special_ordering_compare::
294          operator()): New function.
295         (Output_section::sort_attached_input_sections): Use new sort function
296         for .text.
297         * output.h (Input_section_sort_section_name_special_ordering_compare):
298         New struct.
299         * testsuite/Makefile.am (text_section_grouping): Test option
300         --no-text-reorder
301         * testsuite/Makefile.in: Regenerate.
302         * testsuite/text_section_grouping.sh: Check order of functions without
303         default text reordering.
304
305 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
306
307         * options.h (General_options): Change default to true for new_dtags.
308
309 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
310
311         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
312         when enable_new_dtags is false.  Only add DT_RUNPATH when
313         enable_new_dtags is true.
314
315 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
316
317         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
318         used in declaration and definition consistent.
319         (Target_powerpc::symval_for_branch): Ditto.
320
321 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
322
323         * testsuite/plugin_final_layout.cc: Fix comment.
324
325 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
326
327         * layout.cc (Layout::layout): Do not do default sorting for
328         text sections when section ordering is specified.
329         (make_output_section): Ditto.
330         * testsuite/plugin_final_layout.cc: Name the function sections
331         to catch reordering issues.
332
333 2013-01-15  Alan Modra  <amodra@gmail.com>
334
335         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
336         plt-thread-safe.
337
338 2013-01-15  Alan Modra  <amodra@gmail.com>
339
340         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
341         * testsuite/Makefile.in: Regenerate.
342
343 2013-01-14  Alan Modra  <amodra@gmail.com>
344
345         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
346         * testsuite/Makefile.in: Regenerate.
347
348 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
349
350         PR bfd/14430
351         Fix mingw gold build with plugins enabled
352         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
353         * configure.ac: Export DLOPEN_LIBS and add headers check.
354         * plugin.cc: Handle non-dlfcn case.
355         * Makefile.in: Regenerate.
356         * config.in: Regenerate.
357         * configure: Regenerate.
358         * testsuite/Makefile.in: Regenerate.
359
360 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
361
362         * output.h (sort_attached_input_sections): Change to be public.
363         * script-sections.cc
364         (Output_section_definition::set_section_addresses): Sort
365         attached input sections according to section order before linker
366         script assigns section addresses.
367         (Orphan_output_section::set_section_addresses): Sort
368         attached input sections according to section order before linker
369         script assigns section addresses.
370         * Makefile.am (final_layout.sh): Use a simple linker script to
371         check if section ordering still works.
372         * Makefile.in: Regenerate.
373
374 2013-01-09  Ben Cheng  <bccheng@google.com>
375
376         * arm.cc (Target_arm::attributes_accept_div): New function.
377         (Target_arm::attributes_forbid_div): New function.
378         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
379         attribute using the same new functions as what bfd/elf32_arm.c
380         does.
381
382 2013-01-07  Cary Coutant  <ccoutant@google.com>
383
384         PR gold/14993
385         * output.cc (Output_section::add_input_section): For incremental
386         updates, don't track input sections that are allocated from patch
387         space.
388
389 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
390             Ian Lance Taylor  <iant@google.com>
391
392         PR gold/14897
393         * configure.ac (--enable-ld): Removed.
394         (install_as_default): Set to yes only for --enable-gold=default
395         or --disable-ld.
396         * configure: Regenerated.
397
398 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
399
400         * options.h (General_options): Add -fuse-ld= for GCC linker
401         option compatibility.
402
403 2013-01-04  Cary Coutant  <ccoutant@google.com>
404
405         * configure.ac: Fix typo restoring CXXFLAGS.
406         * configure: Regenerate.
407
408 2013-01-04  Cary Coutant  <ccoutant@google.com>
409
410         * testsuite/Makefile.am (CXXLINK_S): New macro.
411         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
412         * testsuite/Makefile.in: Regenerate.
413
414 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
415
416         * version.cc (print_version): Update copyright year to 2013.
417
418 2012-12-20  Ian Lance Taylor  <iant@google.com>
419
420         * layout.cc (Layout::special_ordering_of_input_section): New
421         function.
422         (Layout::layout): If input section requires special ordering, must
423         sort input sections.
424         (Layout::make_output_section): May sort .text input sections.
425         (Layout::is_section_name_prefix_grouped): Remove.
426         * layout.h (class Layout): Declare
427         special_ordering_of_input_section.  Don't declare
428         is_section_name_prefix_grouped.
429         * output.cc (Output_section::add_input_section): Revert last
430         change.
431         (Output_section::Input_section_sort::match_file_name): Don't crash
432         if called on output section data.
433         (Output_section::Input_section_sort_compare): Sort based on
434         special ordering.
435         (Output_section::Input_section_sort_section_order_index_compare):
436         Revert last patch.
437         (Output_section::sort_attached_input_sections): Likewise.
438
439 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
440
441         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
442         * layout.h (Layout::is_section_name_prefix_grouped): New function.
443         * output.cc (Output_section::add_input_section): Check if section
444         name contains special prefix.  Keep input sections to sort such
445         sections.
446         (Output_section::Input_section_sort_section_order_index_compare
447          ::operator()): Group sections according to prefixes.
448         (Output_section::sort_attached_input_sections): Add condition to
449         Input_section_entry constructor call.
450         * testsuite/Makefile.am (text_section_grouping): New test.
451         * testsuite/Makefile.in: Regenerate.
452         * testsuite/text_section_grouping.cc: New file.
453         * testsuite/text_section_grouping.sh: New file.
454
455 2012-12-17  Nick Clifton  <nickc@redhat.com>
456
457         * Makefile.am: Add copyright notice.
458         * NEWS: Likewise.
459         * README: Likewise.
460         * configure.ac: Likewise.
461         * ftruncate.c: Likewise.
462         * Makefile.in: Regenerate.
463
464 2012-12-14  Cary Coutant  <ccoutant@google.com>
465
466         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
467         --no-as-needed flag.
468         (exception_separate_shared_12_test): Likewise.
469         (incremental_copy_test): Likewise.
470         * testsuite/Makefile.in: Regenerate.
471
472 2012-12-14  Cary Coutant  <ccoutant@google.com>
473
474         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
475         (Dwp_output_file::Dwp_index::enter_set): Add assert.
476
477 2012-12-12  Alan Modra  <amodra@gmail.com>
478
479         * powerpc.cc (class Track_tls): New.
480         (class Relocate, class Scan): Inherit Track_tls.
481         (Target_powerpc::Scan::local, global): Track tls optimization
482         and avoid creating plt entry for __tls_get_addr if all uses
483         are optimized away.
484         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
485
486 2012-12-12  Alan Modra  <amodra@gmail.com>
487
488         * options.h (General_options): Add --toc-sort/--no-toc-sort.
489         Replace no_toc_optimize with toc_optimize.
490         * output.h (Output_section::input_sections): Provide non-const variant.
491         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
492         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
493         accessors.
494         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
495         (class Sort_toc_sections): New.
496         (Target_powerpc::do_finalize_sections): Sort toc sections.
497         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
498
499 2012-12-10  Roland McGrath  <mcgrathr@google.com>
500
501         * testsuite/binary_unittest.cc (read_all): New function.
502         (Sized_binary_test): Use it instead of ::read.
503         * fileread.cc (do_read): Don't assume pread always reads the whole
504         amount in a single call.
505
506 2012-12-10  Alan Modra  <amodra@gmail.com>
507
508         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
509         Set EM_PPC64 or EM_PPC here.
510         (Target_selector_powerpc::do_recognize): Delete.
511
512 2012-12-10  Alan Modra  <amodra@gmail.com>
513
514         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
515         stub_table_.
516         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
517
518 2012-12-07  Roland McGrath  <mcgrathr@google.com>
519
520         * testsuite/binary_unittest.cc (Sized_binary_test):
521         Use open_descriptor rather than ::open.
522
523 2012-12-07  Alan Modra  <amodra@gmail.com>
524
525         * powerpc.cc (Stub_table::do_write): Delete redundant Address
526         typedef and invalid_address constant.
527         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
528         instantiate constants.
529
530 2012-12-06  Roland McGrath  <mcgrathr@google.com>
531
532         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
533         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
534         * aclocal.m4: Regenerate.
535         * configure: Regenerate.
536         * Makefile.in: Regenerate.
537         * testsuite/Makefile.in: Regenerate.
538
539 2012-12-07  Alan Modra  <amodra@gmail.com>
540
541         * options.h (General_options): Add no_toc_optimize.
542         * powerpc.cc (ok_lo_toc_insn): New function.
543         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
544
545 2012-12-06  Alan Modra  <amodra@gmail.com>
546
547         * options.h (General_options): Add plt_align, plt_static_chain,
548         plt_thread_safe.  Update stub_group_size help text.
549         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
550         for new plt_thread_safe_ var.
551         (use_plt_offset): Correct comments.
552         (Target_powerpc::do_relax): Look for thread creation symbols to
553         determine default plt_thread_safe value.  Clear plt call stubs
554         as well as branch stubs each iteration.
555         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
556         insn constants.
557         (l, hi, ha, write_insn): Move earlier.
558         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
559         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
560         plt stubs too.
561         (Stub_table::update_size): Adjust.
562         (Stub_table::prev_size, set_prev_size): Delete.
563         (Stub_table::stub_align): Let --plt-align affect result.
564         (Stub_table::plt_call_size): Calculate sizes for various stubs.
565         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
566         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
567         (Stub_table::do_write): Support more stub variants.
568
569 2012-12-04  Alan Modra  <amodra@gmail.com>
570
571         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
572         (Target_powerpc::do_define_standard_symbols): New function.
573
574 2012-12-03  Alan Modra  <amodra@gmail.com>
575
576         * output.h: Formatting, whitespace.
577
578 2012-12-03  Alan Modra  <amodra@gmail.com>
579
580         * layout.h (Layout::get_executable_sections): Declare.
581         * layout.cc (Layout::get_executable_sections): New function.
582         * arm.cc (Target_arm::group_sections): Use it.
583         (Arm_output_section::group_sections): Delete now redundant test.
584         * output.cc (Output_reloc::Output_reloc): Add is_relative.
585         param to handle relative relocs.
586         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
587         (Output_data_reloc::add_absolute): Adjust.
588         (Output_data_reloc::add_relative): New function.
589         (Output_data::reset_data_size): New function.
590         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
591         (Output_section::set_addralign): New function.
592         (Output_section::checkpoint_set_addralign): New function.
593         (Output_section::clear_section_offsets_need_adjustment): New function.
594         (Output_section::input_sections): Make public.
595         * powerpc.cc (class Output_data_brlt_powerpc): New.
596         (class Stub_table, class Stub_control): New.
597         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
598         stub_table_, set_stub_table, stub_table): New vectors and accessor
599         functions.
600         (Target_powerpc::do_may_relax, do_relax, push_branch,
601         new_stub_table, stub_tables, brlt_section, group_sections,
602         add_branch_lookup_table, find_branch_lookup_table,
603         write_branch_lookup_table, make_brlt_section): New functions.
604         (Target_powerpc::struct Sort_sections, class Branch_info): New.
605         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
606         branch_info_): New vars.
607         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
608         make call stubs here.
609         (Output_data_glink): Remove all call stub handling from this class.
610         (Target_powerpc::Scan::local, global): Save interesting branch
611         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
612         (Target_powerpc::do_finalize_sections): Only make reg save/restore
613         functions on final link.
614         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
615         Handle long branch destinations too.
616         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
617         do_plt_address_for_local): Adjust lookup of plt call stubs.
618
619 2012-11-30  Alan Modra  <amodra@gmail.com>
620
621         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
622         relocs against protected symbols when building 32-bit shared libs.
623
624 2012-11-30  Alan Modra  <amodra@gmail.com>
625
626         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
627         param.  Call got_section() to make .got.  Update all callers
628         and their callers and so on.
629
630 2012-11-30  Alan Modra  <amodra@gmail.com>
631
632         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
633         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
634         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
635         value if it already exists.
636
637 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
638
639         PR gold/14858
640         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
641
642 2012-11-14  Roland McGrath  <mcgrathr@google.com>
643
644         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
645         than bfc instruction for data sandboxing.
646
647 2012-11-08  Alan Modra  <amodra@gmail.com>
648
649         * po/POTFILES.in: Regenerate.
650
651 2012-11-05  Alan Modra  <amodra@gmail.com>
652
653         * configure.ac: Apply 2012-09-10 change to config.in here.
654         * configure: Regenerate.
655
656 2012-11-05  Alan Modra  <amodra@gmail.com>
657
658         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
659         (struct Opd_ent): Use "Address" rather than "Offset".
660         (Output_data_got_powerpc::got_base_offset): Return Valtype.
661         (Target_powerpc::got_section): Make public.
662         (Target_powerpc::scan_relocs): Move code setting symbols..
663         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
664         Create _SDA_BASE_ only when referenced.
665
666 2012-11-02  Roland McGrath  <mcgrathr@google.com>
667
668         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
669         from last change.
670
671 2012-11-01  Roland McGrath  <mcgrathr@google.com>
672
673         * target.h (Sized_target::relocate_relocs): Use Elf_Off
674         for offset_in_output_section parameter.
675         (Sized_target::relocate_special_relocatable): Likewise.
676         * arm.cc (Target_arm::relocate_relocs): Likewise.
677         (Target_arm::relocate_special_relocatable): Likewise.
678         * i386.cc (Target_i386::relocate_relocs): Likewise.
679         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
680         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
681         * target-reloc.h (relocate_relocs): Likewise.
682         * testsuite/testfile.cc (Target_test): Likewise.
683         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
684         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
685
686         * system.h: Move inclusion of <clocale> to after <libintl.h> in
687         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
688
689         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
690         parameter, which is unused in the [!F_SETFD] case.
691
692         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
693         SYMNDX to off_t before comparing it to this->data_size().
694         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
695         * incremental.cc (Output_section_incremental_inputs::do_write):
696         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
697
698         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
699
700 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
701
702         * gold.cc (Target_arm::do_adjust_elf_header): Add the
703         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
704         in EABI_VER5.
705
706 2012-10-29  Cary Coutant  <ccoutant@google.com>
707
708         * dwp.cc (usage): Add file and exit status parameters;
709         add --help and --version options.
710         (print_version): New function.
711         (main): Add --help and --version options.
712
713 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
714
715         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
716         final_layout_sequence.txt.
717         * testsuite/Makefile.in: Regenerated.
718
719 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
720
721         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
722         COMPILE generated by automake.
723         (LINK1): Likewise.
724         (CXXCOMPILE1): Likewise.
725         (CXXLINK1): Likewise.
726         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
727         (LINK): Likewise.
728         (CXXCOMPILE): Likewise.
729         (CXXLINK): Likewise.
730         * testsuite/Makefile.in: Regenerated.
731
732 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
733
734         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
735         on bad fwrite return.
736
737 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
738
739         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
740         on val.
741
742 2012-10-23  Cary Coutant  <ccoutant@google.com>
743
744         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
745         * testsuite/Makefile.in: Regenerate.
746         * testsuite/dwp_test.h: New source file.
747         * testsuite/dwp_test_1.cc: New source file.
748         * testsuite/dwp_test_1.s: New source file.
749         * testsuite/dwp_test_1.sh: New source file.
750         * testsuite/dwp_test_1b.cc: New source file.
751         * testsuite/dwp_test_1b.s: New source file.
752         * testsuite/dwp_test_2.cc: New source file.
753         * testsuite/dwp_test_2.s: New source file.
754         * testsuite/dwp_test_2.sh: New source file.
755         * testsuite/dwp_test_main.cc: New source file.
756         * testsuite/dwp_test_main.s: New source file.
757
758 2012-10-23  Cary Coutant  <ccoutant@google.com>
759
760         * dwp.h: New header file.
761         * dwp.cc: New source file.
762         * gold.h: Move shared declarations to system.h.
763         * system.h: New header file.
764         * Makefile.am: Add dwp.
765         * Makefile.in: Regenerate.
766
767 2012-10-23  Cary Coutant  <ccoutant@google.com>
768
769         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
770         Dwarf_info_reader::read_from_pointer.
771         (Dwarf_pubnames_table::read_header): Likewise.
772         (Dwarf_pubnames_table::next_name): Likewise.
773         (Dwarf_die::read_attributes): Likewise.
774         (Dwarf_die::skip_attributes): Likewise.
775         (Dwarf_info_reader::read_from_pointer): New function template.
776         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
777         (Dwarf_pubnames_table): Likewise.
778         (Dwarf_info_reader::read_from_pointer): New function template.
779         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
780         Dwarf_pubnames_table ctor.
781
782 2012-10-23  Cary Coutant  <ccoutant@google.com>
783
784         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
785         abbrev_shndx.
786         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
787         abbrev_shndx_.
788         (Dwarf_info_reader::set_abbrev_shndx): New method.
789         (Dwarf_info_reader::abbrev_shndx_): New data member.
790
791 2012-10-23  Cary Coutant  <ccoutant@google.com>
792
793         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
794         from object, not parameters.
795         (Dwarf_info_reader::parse): Likewise.
796         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
797         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
798         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
799         methods.
800
801 2012-10-23  Cary Coutant  <ccoutant@google.com>
802
803         * fileread.cc (Input_file::Input_file): New constructor.
804         * fileread.h (class Input_file): Add new constructor.
805
806 2012-10-18  Alan Modra  <amodra@gmail.com>
807
808         PR gold/14727
809         * object.cc (Relobj::is_section_name_included): Also match
810         .sdata personality section.
811
812 2012-10-18  Alan Modra  <amodra@gmail.com>
813
814         * target-reloc.h (class Default_comdat_behavior): New, package up..
815         (get_comdat_behaviour): ..this.
816         (relocate_section): Add Relocate_comdat_behavior template arg,
817         adjust code to suit.
818         * arm.cc (Target_arm::relocate_section): Adjust to suit.
819         (Target_arm::scan_reloc_section): Likewise.
820         * i386.cc (Target_i386::relocate_section): Likewise.
821         * sparc.cc (Target_sparc::relocate_section): Likewise.
822         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
823         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
824         * powerpc.cc (class Relocate_comdat_behavior): New.
825         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
826         gold::relocate_section with new template arg.
827
828 2012-10-18  Alan Modra  <amodra@gmail.com>
829
830         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
831         dynamic relocs for GOT_TPREL got entries, without symbol if
832         resolving locally.
833         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
834         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
835         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
836
837 2012-10-17  Alan Modra  <amodra@gmail.com>
838
839         PR gold/14726
840         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
841
842 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
843
844         * layout.cc (Layout::include_section): Keep sections marked
845         SHF_EXCLUDE when doing relocatable links.
846
847 2012-10-16  Alan Modra  <amodra@gmail.com>
848
849         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
850         (Target_powerpc::do_finalize_sections): Call it.
851         (Output_data_save_res): New class and supporting functions.
852         (Target_powerpc::symval_for_branch): Only look up .opd entry for
853         normal symbols defined in object files.
854
855 2012-10-12  Alan Modra  <amodra@gmail.com>
856
857         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
858         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
859         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
860         section if scan_opd_relocs not yet called.
861         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
862
863 2012-10-12  Alan Modra  <amodra@gmail.com>
864
865         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
866         add_local_ifunc_entry): Revert last change.
867         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
868
869 2012-10-05  Alan Modra  <amodra@gmail.com>
870
871         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
872         do_plt_address_for_global): New functions.
873         (Output_data_got_powerpc::do_write): Don't segfault when linking
874         statically.
875         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
876         add_local_ifunc_entry): Return true on adding entry..
877         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
878         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
879         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
880         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
881         set up symbols here.
882         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
883         syms here.  Do so even when no .iplt.  Don't segfault when linking
884         statically.
885         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
886         new variants without reloc param.
887         (Glink_sym_ent::Glink_sym_ent): Likewise.
888         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
889         reloc when refs will resolve to plt call stub.
890         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
891         R_PPC_PLTREL24 to resolve locally.
892         (Target_powerpc::Scan::global): Correct ifunc handling.
893         (Target_powerpc::Relocate::relocate): Correct local sym glink
894         lookup.  Don't destroy "value" when we have a plt call stub,
895         and when checking plt call validity.
896         (Target_powerpc::do_dynsym_value): Simplify.
897
898 2012-10-05  Alan Modra  <amodra@gmail.com>
899
900         * i386.cc (Output_data_plt_i386::address_for_global,
901         address_for_local): Add plt offset to returned value.  Adjust uses.
902         * sparc.cc (Output_data_plt_sparc::address_for_global,
903         address_for_local): Likewise.
904         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
905         address_for_local): Likewise.
906         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
907         address_for_local): Likewise.
908         * target.h (Target::plt_address_for_global, plt_address_for_local):
909         Update comment.
910         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
911         (Output_data_got::Got_entry::write): Nor here.
912         * output.h: Comment fix.
913
914 2012-10-02  Jiong Wang  <jiwang@tilera.com>
915
916         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
917         global_offset_table_ value for larget got.
918         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
919
920 2012-09-29  Alan Modra  <amodra@gmail.com>
921
922         * powerpc.cc (Target_powerpc::iplt_): New output section.
923         (Target_powerpc::iplt_section, make_iplt_section,
924         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
925         (Target_powerpc::make_plt_entry): Handle ifunc syms.
926         Target_powerpc::plt_entry_count): Count iplt entries too.
927         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
928         reloc section in constructor.  New params.
929         (Target_powerpc::make_plt_section): Create reloc section here instead.
930         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
931         functions.
932         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
933         (Output_data_glink::add_entry, find_entry): New functions to
934         deal with local syms.
935         (Glink_sym_ent): Add support for local syms.
936         (Output_data_glink::do_write): Handle ifunc plt entries.
937         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
938         (Target_powerpc::Scan::local, global): Handle ifunc syms.
939         (Target_powerpc::Relocate::relocate): Likewise.
940         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
941
942 2012-09-25  Alan Modra  <amodra@gmail.com>
943
944         * object.h (Sized_relobj_file::adjust_local_symbol,
945         do_adjust_local_symbol): New functions.
946         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
947         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
948         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
949         and irregular opd entry spacing.
950         (Powerpc_relobj::do_read_relocs): Add opd size checks.
951         (Global_symbol_visitor_opd): New functor.
952         (Target_powerpc::do_finalize_sections): Omit global symbols defined
953         on deleted opd entries.
954
955 2012-09-15  Jiong Wang  <jiwang@tilera.com>
956
957         * tilegx.cc: New file.
958         * Makefile.am (TARGETSOURCES): Add tilegx.cc
959         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
960         * configure.tgt: Add entries for tilegx*.
961         * configure.ac: Likewise.
962         * Makefile.in: Rebuild.
963         * configure: Likewise.
964         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
965         tilegx.
966
967 2012-09-13  Alan Modra  <amodra@gmail.com>
968
969         * target-reloc.h (scan_relocs): Call scan.local for relocs
970         against symbols in discarded sections.  Pass is_discarded
971         param.
972         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
973         Add is_discarded param.
974         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
975         is_discarded to flag opd entry as discarded.  Don't emit dyn
976         relocs on such entries.
977         (Target_powerpc::Scan::global): Similarly detect and handle
978         such opd entries.
979         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
980         opd_ent_.  Update all uses.
981         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
982         (Target_powerpc::relocate_section): Zero out discarded opd
983         entry relocs.
984
985 2012-09-12  Ian Lance Taylor  <iant@google.com>
986
987         PR gold/14570
988         * output.cc: Rename Output_data_got template parameter from size
989         to got_size for all functions.  Compile all variants of
990         Output_data_got.
991         (Output_data_got::Got_entry::write): Correct use of size for
992         symbol value.  Use local_is_tls rather than casting to
993         Sized_relobj_file.
994         * object.h (class Object): Add local_is_tls and do_local_is_tls.
995         (class Sized_relobj_file): Add do_local_is_tls.
996         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
997
998 2012-09-11  Alan Modra  <amodra@gmail.com>
999
1000         PR gold/14566
1001         * layout.cc (Layout::set_segment_offsets): When using
1002         common-page-size alignment, ensure we are on a new max-page-size
1003         page.
1004         * output.cc (Output_segment::set_section_addresses): Use
1005         abi_pagesize, not common_pagesize for relro boundary.
1006         (Output_segment::set_offset): Likewise.
1007
1008 2012-09-11  Alan Modra  <amodra@gmail.com>
1009
1010         * output.h (Output_data_got::add_global_tls, add_local_tls,
1011         add_local_tls_pair): New functions.
1012         (Output_data_got::add_local_pair_with_rel): Remove second
1013         reloc param.  Expand comment.
1014         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1015         use_plt_or_tls_offset_, similarly for constructor param.
1016         (Output_data_got::Got_entry::write): Add got_index param.
1017         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1018         add_local_tls_pair): New functions.
1019         (Output_data_got::Got_entry::write): Handle tls symbols
1020         with use_plt_or_tls_offset_ set specially.
1021         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1022         (Output_data_got::do_write): Replace iterator with index, pass
1023         index to entry write function.
1024         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1025         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1026         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1027         call.
1028         * i386.cc (Target_i386::Scan::local): Likewise.
1029         * sparc.cc (Target_sparc::Scan::local): Likewise.
1030         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1031         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1032         do_tls_offset_for_global): New functions.
1033         (Target_powerpc::Scan::local): Correct TLS relocations and got
1034         entry values.
1035         (Target_powerpc::Scan::global): Don't emit unnecessary
1036         dynamic relocations on TLS GOT entries.
1037
1038 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1039
1040         * config.in: Disable sanity check for kfreebsd.
1041
1042 2012-09-10  Sterling Augustine  <saugustine@google.com>
1043
1044         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1045         (Gdb_index::pubtypes_read): New parameter.
1046         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1047         to calls.
1048         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1049         pubtypes_object_.
1050
1051 2012-09-09  Alan Modra  <amodra@gmail.com>
1052
1053         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1054         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1055         * gc.h (gc_process_relocs): Call target gc_add_reference.
1056         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1057         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1058         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1059         unnecessary cast.
1060         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1061         to cater for when we don't need code offset.  Update use.
1062         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1063         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1064         set_opd_valid): New functions.
1065         (Target_powerpc::do_gc_add_reference): New function.
1066         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1067         stashed refs.
1068         (Target_powerpc::do_gc_mark_symbol): New function.
1069
1070 2012-09-06  Cary Coutant  <ccoutant@google.com>
1071
1072         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1073         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1074         (Dwarf_die::skip_attributes): Likewise.
1075         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1076         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1077         (main): Call it.
1078         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1079
1080 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1081
1082         * testsuite/script_test_3.t: Add .got.plt output section
1083         statement.
1084         * testsuite/script_test_4.t: Likewise.
1085
1086 2012-09-05  Alan Modra  <amodra@gmail.com>
1087
1088         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1089         update all uses and lose "enum" when using type.
1090
1091 2012-09-05  Alan Modra  <amodra@gmail.com>
1092
1093         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1094         * configure: Regenerate.
1095         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1096         (plugin_final_layout.stdout): Likewise.
1097         (memory_test): Set page sizes to 0x1000.
1098         * testsuite/Makefile.in: Regenerate.
1099         * testsuite/discard_locals_test.sh: Add FIXME comment.
1100         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1101         * testsuite/pr14265.t: Add .got output section statement.
1102         * testsuite/script_test_2.t: Likewise.
1103         * testsuite/script_test_3.t: Likewise.
1104         * testsuite/script_test_4.t: Likewise.
1105         * testsuite/script_test_5.t: Likewise.
1106         * testsuite/script_test_6.t: Likewise.
1107         * testsuite/script_test_7.t: Likewise.
1108         * testsuite/script_test_9.t: Likewise.
1109
1110 2012-09-05  Alan Modra  <amodra@gmail.com>
1111
1112         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1113         (Powerpc_relocate_functions::Status): New typedef.
1114         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1115         (Target_powerpc::Scan::local): Handle REL64.
1116         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1117         for REL32 and REL64.
1118         (Target_powerpc::symval_for_branch): New function, extracted from..
1119         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1120         checks.  Report overflow errors.
1121
1122 2012-09-05  Alan Modra  <amodra@gmail.com>
1123
1124         * object.h (Sized_relobj_file::emit_relocs): Delete.
1125         (Sized_relobj_file::emit_relocs_reltype): Delete.
1126         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1127         relocate_relocs for --emit-relocs.
1128         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1129         * output.h: Update comment.
1130         (Output_segment::first_section): New function.
1131         (Output_segment::first_section_load_address): Use first_section.
1132         * output.cc (Output_segment::first_section): New function extracted..
1133         (Output_segment::first_section_load_address): ..from here.  Delete.
1134         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1135         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1136         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1137         adjust call to target.h function.
1138         * i386.cc (Target_i386): Likewise.
1139         * sparc.cc (Target_sparc): Likewise.
1140         * x86_64.cc (Target_x86_64): Likewise.
1141         * powerpc.cc (Target_powerpc): Likewise.
1142         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1143         first tls section has section symbol for optimised local dynamic
1144         output relocs.
1145         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1146         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1147         optimised tls code.
1148         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1149         Rename to relocate_relocs.  Update error message.
1150
1151 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1152
1153         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1154         --just-symbols.
1155
1156 2012-08-31  Alan Modra  <amodra@gmail.com>
1157
1158         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1159         (Powerpc_relobj::toc_base_offset): New stub function.
1160         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1161         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1162         (Target_powerpc::Relocate::enum skip_tls): New.
1163         (Target_powerpc::call_tls_get_addr_): New var.
1164         (Target_powerpc::is_branch_reloc): Move to file scope.
1165         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1166         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1167         New functions.
1168         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1169         (powerpc_info): Correct common_pagesize for ppc64.
1170         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1171         (Powerpc_relocate_functions): Add overflow check enums and functions.
1172         Add non-shift version of rela, rela_ua.  Delete all rel public
1173         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1174         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1175         addr16_ha3, addr14 functions.
1176         (Output_data_got_powerpc::add_constant_pair): New function.
1177         (Output_data_got_powerpc::got_base_offset): Likewise.
1178         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1179         (instruction constants): Sort, add some more.
1180         (Output_data_glink::do_write): Add and use Address typedef.  Use
1181         object->toc_base_offset() stub for 64-bit.
1182         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1183         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1184         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1185         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1186         Always treat .opd relocs as against locally defined symbol.
1187         Correct condition for RELATIVE relocs.
1188         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1189         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1190         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1191         calculations.  Handle TLS relocs, and more.  Add overflow
1192         checking and adjust for Powerpc_relocate_functions changes.
1193         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1194         Reinstate --emit-relocs code with FIXME.
1195
1196 2012-08-30  Alan Modra  <amodra@gmail.com>
1197
1198         * layout.cc (Layout::set_segment_offsets): Set p_align to
1199         abi_pagesize, not common_pagesize.
1200         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1201         to determine whether file header can go in segment.
1202
1203 2012-08-30  Alan Modra  <amodra@gmail.com>
1204
1205         * output.h (Output_reloc::Output_reloc <output section>): Add
1206         is_relative param.  Adjust calls.
1207         (Output_reloc::add_output_section_relative): New functions.
1208         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1209         is_relative.
1210         (Output_reloc::symbol_value): Handle SECTION_CODE.
1211
1212 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1213
1214         * gold.cc (queue_middle_tasks): Call layout again when unique
1215         segments for sections is desired.
1216         * layout.cc (Layout::Layout): Initialize new members.
1217         (Layout::get_output_section_flags): New function.
1218         (Layout::choose_output_section): Call get_output_section_flags.
1219         (Layout::layout): Make output section for mapping to a unique segment.
1220         (Layout::insert_section_segment_map): New function.
1221         (Layout::attach_allocated_section_to_segment): Make unique segment for
1222         output sections marked so.
1223         (Layout::segment_precedes): Check for unique segments when sorting.
1224         * layout.h (Layout::Unique_segment_info): New struct.
1225         (Layout::Section_segment_map): New typedef.
1226         (Layout::insert_section_segment_map): New function.
1227         (Layout::get_output_section_flags): New function.
1228         (Layout::is_unique_segment_for_sections_specified): New function.
1229         (Layout::set_unique_segment_for_sections_specified): New function.
1230         (Layout::unique_segment_for_sections_specified_): New member.
1231         (Layout::section_segment_map_): New member.
1232         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1233         Rename is_gc_pass_one to is_pass_one.
1234         Rename is_gc_pass_two to is_pass_two.
1235         Rename is_gc_or_icf to is_two_pass.
1236         Check for which pass based on whether symbols data is present.
1237         Make it two pass when unique segments for sections is desired.
1238         * output.cc (Output_section::Output_section): Initialize new
1239         members.
1240         * output.h (Output_section::is_unique_segment): New function.
1241         (Output_section::set_is_unique_segment): New function.
1242         (Output_section::is_unique_segment_): New member.
1243         (Output_section::extra_segment_flags): New function.
1244         (Output_section::set_extra_segment_flags): New function.
1245         (Output_section::extra_segment_flags_): New member.
1246         (Output_section::segment_alignment): New function.
1247         (Output_section::set_segment_alignment): New function.
1248         (Output_section::segment_alignment_): New member.
1249         (Output_segment::Output_segment): Initialize is_unique_segment_.
1250         (Output_segment::is_unique_segment): New function.
1251         (Output_segment::set_is_unique_segment): New function.
1252         (Output_segment::is_unique_segment_): New member.
1253         * plugin.cc (allow_unique_segment_for_sections): New function.
1254         (unique_segment_for_sections): New function.
1255         (Plugin::load): Add new functions to transfer vector.
1256         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1257         * Makefile.in: Regenerate.
1258         * testsuite/plugin_final_layout.sh: Check if unique segment
1259         functionality works.
1260         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1261         are available.
1262         (allow_unique_segment_for_sections): New global.
1263         (unique_segment_for_sections): New global.
1264         (claim_file_hook): Call allow_unique_segment_for_sections.
1265         (all_symbols_read_hook): Call unique_segment_for_sections.
1266
1267 2012-08-22  Cary Coutant  <ccoutant@google.com>
1268
1269         * layout.cc (Layout::include_section): Don't assert on GROUP
1270         sections with --emit-relocs.
1271
1272 2012-08-21  Cary Coutant  <ccoutant@google.com>
1273
1274         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1275         if --export-dynamic-symbol names an undef symbol.
1276
1277 2012-08-18  Alan Modra  <amodra@gmail.com>
1278
1279         * powerpc.cc: Formatting and white space.
1280         (Powerpc_relobj): Rename got2_section_ to special_.
1281         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1282         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1283         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1284         (Target_powerpc): Add Address typedef and invalid_address.  Use
1285         throughout.
1286         (Target_powerpc::is_branch_reloc): New function.
1287         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1288         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1289         for dst_mask, value and addend.
1290         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1291         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1292         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1293         uint16_t for 24-bit offset.  Use get_output_section_offset and
1294         check return.
1295         (Target_powerpc::Scan::local): Handle more relocs.
1296         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1297         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1298         Plug in toc restoring insn after plt calls.  Translate branches
1299         to function descriptor symbols to corresponding entry point.
1300         (Target_powerpc::relocate_for_relocatable): Check return from
1301         get_output_section_offset.
1302         * symtab.h: Comment typo.
1303
1304 2012-08-14  Ian Lance Taylor  <iant@google.com>
1305
1306         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1307         unsupported_relocal_local to call unsupported_reloc_global.
1308
1309 2012-08-14  Nick Clifton  <nickc@redhat.com>
1310
1311         PR ld/14265
1312         * script-sections.cc (Sections_element::output_section_name): Add
1313         keep return parameter.
1314         (Output_section_element::match_name): Add keep return parameter.
1315         Return the value of the keep_ member.
1316         * script-sections.h (class Output_section): Update
1317         output_section_name prototype.
1318         * layout.cc (Layout::keep_input_section): New public member
1319         function.
1320         (Layout::choose_output_section): Pass keep parameter to
1321         output_section_name.
1322         * layout.h (class Layout): Add keep_input_section.
1323         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1324         sections.
1325         * testsuite/Makefile.am: Add a test.
1326         * testsuite/Makefile.in: Regenerate.
1327         * testsuite/pr14265.c: Source file for the test.
1328         * testsuite/pr14265.t: Linker script for the test.
1329         * testsuite/pr14265.sh: Shell script for the test.
1330
1331 2012-08-14  Alan Modra  <amodra@gmail.com>
1332
1333         * target.h (Target::output_section_name): New function.
1334         (Target::do_output_section_name): New function.
1335         * layout.cc (Layout::choose_output_section): Call the above.
1336         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1337
1338 2012-08-14  Alan Modra  <amodra@gmail.com>
1339
1340         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1341         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1342         for replace_constant call.
1343         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1344         (Output_data_glink::do_print_to_mapfile): New function.
1345         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1346         (Target_powerpc::Relocate::relocate): Likewise.
1347
1348 2012-08-14  Alan Modra  <amodra@gmail.com>
1349
1350         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1351         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1352         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1353         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1354         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1355         here.
1356         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1357         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1358         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1359         here.
1360         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1361         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1362
1363 2012-08-12  Alan Modra  <amodra@gmail.com>
1364
1365         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1366         (glink insn constants): Use uint32_t.
1367         (Output_data_glink::add_entry): Use insert, not [] operator.
1368
1369 2012-08-11  Alan Modra  <amodra@gmail.com>
1370
1371         * object.h (Sized_relobj_file::find_shdr): New function.
1372         (Sized_relobj_file::find_special_sections): New function.
1373         * object.cc (Sized_relobj_file::find_shdr): New function.
1374         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1375         (Sized_relobj_file::find_special_sections): New function, split out..
1376         (Sized_relobj_file::do_read_symbols): ..from here.
1377         * output.h (Output_data_got::replace_constant): New function.
1378         (Output_data_got::num_entries): New function.
1379         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1380         (Output_data_got::got_offset): Protected rather than private.
1381         (Output_data_got::replace_got_entry): New function.
1382         * output.cc (Output_data_got::replace_got_entry): New function.
1383         * powerpc.cc (class Powerpc_relobj): New.
1384         (class Powerpc_relocate_functions): Delete all psymval variants or
1385         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1386         Implement _ha functions using corresponding _hi function.
1387         (Powerpc_relobj::find_special_sections): New function.
1388         (Target_powerpc::do_make_elf_object): New function.
1389         (class Output_data_got_powerpc): New.
1390         (class Output_data_glink): New.
1391         (class Powerpc_scan_relocatable_reloc): New.
1392         Many more changes througout file.
1393
1394 2012-08-09  Nick Clifton  <nickc@redhat.com>
1395
1396         * po/vi.po: Updated Vietnamese translation.
1397
1398 2012-08-07  Ian Lance Taylor  <iant@google.com>
1399
1400         * layout.cc (Layout::add_target_dynamic_tags): If
1401         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1402         plt_rel.
1403
1404 2012-07-30  Nick Clifton  <nickc@redhat.com>
1405
1406         * po/gold.pot: Updated template.
1407         * po/es.po: Updated Spanish translation.
1408
1409 2012-07-18  Cary Coutant  <ccoutant@google.com>
1410
1411         PR gold/14344
1412         * configure.ac: Add check for -gpubnames support.
1413         * configure: Regenerate.
1414         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1415         support; force -gno-pubnames.
1416         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1417         support.
1418         (gdb_index_test_4): New test.
1419         * testsuite/Makefile.in: Regenerate.
1420         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1421         * testsuite/gdb_index_test_2.sh: Likewise.
1422         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1423         * testsuite/gdb_index_test_4.sh: New script.
1424         * testsuite/gdb_index_test_comm.sh: New script with common code;
1425         don't look for space after colon.
1426
1427 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1428
1429         * gold.cc (queue_middle_tasks): Update function order only after
1430         deferred objects due to plugins are processed.
1431
1432 2012-07-11  Ian Lance Taylor  <iant@google.com>
1433
1434         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1435         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1436         (Target_arm::scan_reloc_for_stub): Likewise.
1437         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1438         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1439         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1440         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1441         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1442
1443 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1444             Ian Lance Taylor  <iant@google.com>
1445
1446         PR gold/14309
1447         * configure.ac: Test whether std::tr1::hash<off_t> works.
1448         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1449         needed.
1450         * output.h (class Output_fill): Add virtual destructor.
1451         * configure, config.in: Rebuild.
1452
1453 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1454
1455         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1456
1457 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1458
1459         * plugin.cc (Plugin::load): Handle position independent executables.
1460
1461 2012-06-06  Cary Coutant  <ccoutant@google.com>
1462
1463         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1464         add .debug_macro.
1465         (lines_only_debug_sections): Likewise.
1466         (gdb_fast_lookup_sections): New static array.
1467         (is_gdb_debug_section): Rename formal parameter.
1468         (is_lines_only_debug_section): Likewise.
1469         (is_gdb_fast_lookup_section): New function.
1470         (Layout::include_section): Check for ".zdebug_" prefix; pass
1471         section name suffix to is_gdb_debug_section, et al.; check for
1472         fast-lookup sections when building .gdb_index.
1473         * options.h (--strip-debug-gdb): Update GDB version number.
1474
1475 2012-06-06  Cary Coutant  <ccoutant@google.com>
1476
1477         * configure.ac: Add check for fallocate.
1478         * configure: Regenerate.
1479         * config.in: Regenerate.
1480
1481         * options.h (class General_options): Add --mmap-output-file and
1482         --posix-fallocate options.
1483         * output.cc: (posix_fallocate): Remove; replace with...
1484         (gold_fallocate): New function.
1485         (Output_file::map_no_anonymous): Call gold_fallocate.
1486         (Output_file::map): Check --mmap-output-file option.
1487
1488 2012-06-05  Jing Yu  <jingyu@google.com>
1489
1490         * gold.h (textdomain): Add do {} to empty while(0).
1491         (bindtextdomain): Likewise.
1492
1493 2012-06-04  Cary Coutant  <ccoutant@google.com>
1494
1495         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1496         has_dynsym_index.
1497
1498 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1499
1500         * symtab.cc (Symbol_table::define_special_symbol):
1501         Initialize *poldsym to prevent uninitialized variable errors.
1502
1503 2012-05-23  Cary Coutant  <ccoutant@google.com>
1504
1505         * layout.cc (Layout::section_name_mapping): Add rules to handle
1506         exact match on .data.rel.ro.local or .data.rel.ro.
1507         (Layout::output_section_name): Check for exact matches.
1508
1509 2012-05-23  Cary Coutant  <ccoutant@google.com>
1510
1511         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1512         more carefully.
1513
1514 2012-05-22  Cary Coutant  <ccoutant@google.com>
1515
1516         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1517         object before exporting symbol.
1518
1519 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1520
1521         * testsuite/tls_test.cc: Include "config.h" first.
1522         * testsuite/tls_test_c.c: Likewise.
1523
1524 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1525             Nick Clifton  <nickc@redhat.com>
1526
1527         PR 14072
1528         * configure.in: Add check that sysdep.h has been included before
1529         any system header files.
1530         * configure: Regenerate.
1531         * config.in: Regenerate.
1532
1533 2012-05-14  Cary Coutant  <ccoutant@google.com>
1534
1535         * layout.cc (Layout::make_output_section): Mark .tdata section
1536         as RELRO.
1537         * testsuite/relro_test.cc: Add a TLS variable.
1538
1539 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1540
1541         PR gold/14091
1542         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1543         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1544         R_X86_64_64.
1545
1546 2012-05-08  Cary Coutant  <ccoutant@google.com>
1547
1548         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1549         (lines_only_debug_sections): Likewise.
1550
1551 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1552
1553         * nacl.cc: New file.
1554         * nacl.h: New file.
1555         * Makefile.am (CCFILES, HFILES): Add them.
1556         * Makefile.in: Regenerate.
1557         * i386.cc (Output_data_plt_i386_nacl): New class.
1558         (Output_data_plt_i386_nacl_exec): New class.
1559         (Output_data_plt_i386_nacl_dyn): New class.
1560         (Target_i386_nacl): New class.
1561         (Target_selector_i386_nacl): New class.
1562         (target_selector_i386): Use it instead of Target_selector_i386.
1563         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1564         (Target_x86_64_nacl): New class.
1565         (Target_selector_x86_64_nacl): New class.
1566         (target_selector_x86_64, target_selector_x32): Use it instead of
1567         Target_selector_x86_64.
1568         * arm.cc (Output_data_plt_arm_nacl): New class.
1569         (Target_arm_nacl): New class.
1570         (Target_selector_arm_nacl): New class.
1571         (target_selector_arm, target_selector_armbe): Use it instead of
1572         Target_selector_arm.
1573
1574         * target-select.cc (select_target): Take new Input_file* and off_t
1575         arguments, pass them on to recognize method of selector.
1576         * object.cc (make_elf_sized_object): Update caller.
1577         * parameters.cc (parameters_force_valid_target): Likewise.
1578         * incremental.cc (make_sized_incremental_binary): Likewise.
1579         * target-select.h: Update decl.
1580         (Target_selector::recognize): Take new Input_file* argument,
1581         pass it on to do_recognize.
1582         (Target_selector::do_recognize): Take new Input_file* argument.
1583         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1584         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1585         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1586         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1587
1588         * target.h (Target::Target_info): New members isolate_execinstr
1589         and rosegment_gap.
1590         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1591         * arm.cc (Target_arm::arm_info): Update initializer.
1592         * i386.cc (Target_i386::i386_info): Likewise.
1593         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1594         * sparc.cc (Target_sparc::sparc_info): Likewise.
1595         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1596         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1597         * layout.cc (Layout::attach_allocated_section_to_segment):
1598         Take new const Target* argument.  If target->isolate_execinstr(), act
1599         like --rosegment.
1600         (Layout::find_first_load_seg): Take new const Target* argument;
1601         if target->isolate_execinstr(), reject PF_X segments.
1602         (Layout::relaxation_loop_body): Update caller.
1603         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1604         reset file offset to zero when we hit LOAD_SEG, and then do a second
1605         loop over the segments before LOAD_SEG to reassign offsets after
1606         addresses have been determined.  Handle target->rosegment_gap().
1607         (Layout::attach_section_to_segment): Take new const Target* argument;
1608         pass it to attach_allocated_section_to_segment.
1609         (Layout::make_output_section): Update caller.
1610         (Layout::attach_sections_to_segments): Take new const Target* argument;
1611         pass it to attach_section_to_segment.
1612         * gold.cc (queue_middle_tasks): Update caller.
1613         * layout.h (Layout): Update method decls with new arguments.
1614
1615         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1616         Target_info pointer to use.
1617         (Target_arm::do_make_data_plt): New virtual method.
1618         (Target_arm::make_data_plt): New method that calls it.
1619         (Target_arm::make_plt_entry): Use it.
1620         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1621         for the section alignment.
1622         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1623         method.
1624         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1625         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1626         method.
1627         (Output_data_plt_arm::get_plt_entry_size): Call it.
1628         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1629         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1630         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1631         method.
1632         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1633         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1634         method instead of sizeof(plt_entry).
1635         (Output_data_plt_arm::add_entry): Likewise.
1636         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1637         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1638         than static method.
1639         (Target_arm::plt_entry_size): Likewise.
1640         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1641         Move to ...
1642         (Output_data_plt_arm_standard): ... here, new class.
1643         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1644         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1645         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1646
1647         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1648         Take additional argument for the PLT entry size.
1649         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1650         Use get_plt_entry_size method rather than plt_entry_size variable.
1651         (Output_data_plt_x86_64::reserve_slot): Likewise.
1652         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1653         (Output_data_plt_x86_64::add_entry): Likewise.
1654         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1655         (Output_data_plt_x86_64::address_for_global): Likewise.
1656         (Output_data_plt_x86_64::address_for_local): Likewise.
1657         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1658         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1659         Make method non-static.
1660         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1661         method.
1662         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1663         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1664         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1665         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1666         virtual method.
1667         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1668         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1669         virtual method.
1670         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1671         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1672         virtual method.
1673         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1674         (Output_data_plt_x86_64::plt_entry_size)
1675         (Output_data_plt_x86_64::first_plt_entry)
1676         (Output_data_plt_x86_64::plt_entry)
1677         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1678         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1679         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1680         (Output_data_plt_x86_64_standard): ... here, new class.
1681         (Target_x86_64::Target_x86_64): Take optional argument for the
1682         Target_info pointer to use.
1683         (Target_x86_64::do_make_data_plt): New virtual method.
1684         (Target_x86_64::make_data_plt): New method to call it.
1685         (Target_x86_64::init_got_plt_for_update): Use that.
1686         Call this->plt_->add_eh_frame method here.
1687         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1688         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1689         rather than static method.
1690         (Target_x86_64::plt_entry_size): Likewise.
1691         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1692         rather than plt_entry_size variable.  Move guts of PLT filling to...
1693         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1694         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1695         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1696
1697         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1698         additional argument for the section alignment.
1699         Don't do add_eh_frame_for_plt here.
1700         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1701         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1702         variable.
1703         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1704         method.
1705         (Output_data_plt_i386::get_plt_entry_size): Call it.
1706         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1707         (Output_data_plt_i386::add_eh_frame): New method to call it.
1708         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1709         method.
1710         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1711         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1712         method.
1713         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1714         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1715         method instead of plt_entry_size.
1716         (Output_data_plt_i386::plt_entry_size)
1717         (Output_data_plt_i386::plt_eh_frame_fde_size)
1718         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1719         (Output_data_plt_i386_standard): ... here, new class.
1720         (Output_data_plt_i386_exec): New class.
1721         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1722         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1723         (Output_data_plt_i386::exec_plt_entry): Move to ...
1724         (Output_data_plt_i386_exec::plt_entry): ... here.
1725         (Output_data_plt_i386_dyn): New class.
1726         (Output_data_plt_i386::first_plt_entry): Move to ...
1727         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1728         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1729         (Output_data_plt_i386_dyn::plt_entry): ... here.
1730         (Target_i386::Target_i386): Take optional argument for the Target_info
1731         pointer to use.
1732         (Target_i386::do_make_data_plt): New virtual method.
1733         (Target_i386::make_data_plt): New method to call it.
1734         (Target_i386::make_plt_section): Use that.
1735         Call this->plt_->add_eh_frame method here.
1736         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1737         rather than plt_entry_size variable.
1738         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1739         (Output_data_plt_i386::address_for_local): Likewise.
1740         (Output_data_plt_i386::do_write): Likewise.
1741         Move guts of PLT filling to...
1742         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1743         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1744         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1745         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1746
1747 2012-05-01  Cary Coutant  <ccoutant@google.com>
1748
1749         * dwarf_reader.cc (Dwarf_die::read_attributes)
1750         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1751         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1752         * reduced_debug_output.cc
1753         (Output_reduced_debug_info_section::get_die_end): Remove
1754         DW_FORM_GNU_ref_index.  Add default case.
1755
1756 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1757
1758         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1759         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1760         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1761         DW_AT_high_pc as offset from DW_AT_low_pc.
1762
1763         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1764         * testsuite/Makefile.in: Regenerate.
1765         * testsuite/gdb_index_test_3.c: New test source file.
1766         * testsuite/gdb_index_test_3.sh: New test source file.
1767
1768 2012-04-25  Ian Lance Taylor  <iant@google.com>
1769
1770         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1771         pointer.
1772         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1773         as a class, not a struct.
1774         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1775         (Target_arm::apply_cortex_a8_workaround): Likewise.
1776         * gc.h: Declare Reloc_types as a struct, not a class.
1777         * object.h: Declare Symbols_data as a struct.
1778         * reloc.h: Declare Read_relocs_data as a struct.
1779         * target.h: Declare Relocate_info as a struct.
1780
1781 2012-04-24  David S. Miller  <davem@davemloft.net>
1782
1783         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1784         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1785         and R_SPARC_WPLT30.
1786
1787 2012-04-24  Cary Coutant  <ccoutant@google.com>
1788
1789         * incremental-dump.cc (find_input_containing_global): Replace
1790         magic number with symbolic constant.
1791         (dump_incremental_inputs): Update version number.
1792         * incremental.cc (Output_section_incremental_inputs): Update version
1793         number; import symbolic constants from Incremental_inputs_reader.
1794         (Incremental_inputs::create_data_sections): Align relocations
1795         section correctly for 64-bit targets.
1796         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1797         constants; add padding.
1798         (Output_section_incremental_inputs::write_header): Add assert for
1799         header_size.
1800         (Output_section_incremental_inputs::write_input_files): Add assert
1801         for input_entry_size.
1802         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1803         add assert for object_info_size, input_section_entry_size,
1804         global_sym_entry_size.
1805         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1806         for data structure sizes; use them.
1807         (Incremental_input_entry_reader): Import symbolic constants from
1808         Incremental_inputs_reader; use them.
1809
1810 2012-04-23  David S. Miller  <davem@davemloft.net>
1811
1812         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1813         and elf_flags_set_.
1814         (Target_sparc::Target_sparc): Initialize new fields.
1815         (Target_sparc::do_make_elf_object): New function.
1816         (Target_sparc::do_adjust_elf_header): New function.
1817
1818 2012-04-23  Cary Coutant  <ccoutant@google.com>
1819
1820         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1821         CU range table of gdb index.
1822
1823 2012-04-20  David S. Miller  <davem@davemloft.net>
1824
1825         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1826         instead of false.
1827
1828 2012-04-16  David S. Miller  <davem@davemloft.net>
1829
1830         * sparc.cc (Target_sparc::got_address): New function.
1831         (Sparc_relocate_functions::gdop_hix22): New function.
1832         (Sparc_relocate_functions::gdop_lox10): New function.
1833         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1834         relocs.
1835         (Target_sparc::Scan::local): Likewise if the global symbol is not
1836         preemptible and is not IFUNC.
1837         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1838         transformations for local and non-preemptible non-IFUNC global
1839         symbols.
1840
1841         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1842         writing out 64-bit part of ranges.
1843
1844         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1845         -fpic and -fpie respectively.
1846         * Makefile.in: Regenerate.
1847
1848         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1849         (Target_sparc::Target_sparc): Initialize new field.
1850         (Target_sparc::do_plt_section_for_global): New function.
1851         (Target_sparc::do_plt_section_for_local): New function.
1852         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1853         (Target_sparc::make_plt_section): New function, broken out of
1854         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1855         (Target_sparc::make_plt_entry): Call make_plt_section.
1856         (Target_sparc::make_local_ifunc_plt_entry): New function.
1857         (Target_sparc::rela_ifunc_section): New function.
1858         (Target_sparc::plt_section): Remove const.
1859         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1860         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1861         and ifunc_count_ fields.
1862         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1863         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1864         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1865         (Output_data_plt_sparc::rela_ifunc): New function.
1866         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1867         (Output_data_plt_sparc::has_ifunc_section): New function.
1868         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1869         (Output_data_plt_sparc::address_for_global): New function.
1870         (Output_data_plt_sparc::address_for_local): New function.
1871         (Output_data_plt_sparc::plt_index_to_offset): New function.
1872         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1873         and entry_count.
1874         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1875         entry_count.
1876         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1877         R_SPARC_JMP_IREL to switch.
1878         (Target_sparc::Scan::check_non_pic): Likewise.
1879         (Target_sparc::Scan::local): Handle IFUNC symbols.
1880         (Target_sparc::Scan::local): Likewise.
1881         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1882         and plt_address_for_local.
1883         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1884         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1885
1886         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1887         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1888         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1889         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1890         global relocs too.
1891         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1892         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1893         calls.
1894         * sparc.cc (Target_sparc::Scan::global): Likewise.
1895         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1896
1897 2012-04-16  Cary Coutant  <ccoutant@google.com>
1898
1899         * archive.cc (Library_base::should_include_member): Check for
1900         --export-dynamic-symbol.
1901         * options.h (class General_options): Add --export-dynamic-symbol.
1902         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1903         --export-dynamic-symbol.
1904         (Symbol_table::gc_mark_undef_symbols): Likewise.
1905         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1906
1907 2012-04-12  David S. Miller  <davem@davemloft.net>
1908
1909         * sparc.cc (Reloc::wdisp10): New relocation method.
1910         (Reloc::h34): Likewise.
1911         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1912         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1913         R_SPARC_WDISP10.
1914         (Target_sparc::Scan::local): Likewise.
1915         (Target_sparc::Scan::global): Likewise.
1916         (Target_sparc::Relocate::relocate): Likewise.
1917
1918 2012-04-09  Cary Coutant  <ccoutant@google.com>
1919
1920         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1921         low_pc == 0.
1922
1923 2012-04-06  Ian Lance Taylor  <iant@google.com>
1924
1925         * timer.cc: #include <unistd.h>.
1926
1927 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1928
1929         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1930         * config.in: Regenerate.
1931         * configure: Regenerate.
1932
1933 2012-04-05  Nick Clifton  <nickc@redhat.com>
1934
1935         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1936         (AM_LC_MESSAGES): Add.
1937         * aclocal.m4: Regenerate.
1938         * config.in: Regenerate.
1939         * configure: Regenerate.
1940
1941 2012-03-21  Cary Coutant  <ccoutant@google.com>
1942
1943         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1944         * Makefile.in: Regenerate.
1945         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1946         (Sized_elf_reloc_mapper::symbol_section): New function.
1947         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1948         (make_elf_reloc_mapper): New function.
1949         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1950         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1951         (Dwarf_abbrev_table::do_get_abbrev): New function.
1952         (Dwarf_ranges_table::read_ranges_table): New function.
1953         (Dwarf_ranges_table::read_range_list): New function.
1954         (Dwarf_pubnames_table::read_section): New function.
1955         (Dwarf_pubnames_table::read_header): New function.
1956         (Dwarf_pubnames_table::next_name): New function.
1957         (Dwarf_die::Dwarf_die): New function.
1958         (Dwarf_die::read_attributes): New function.
1959         (Dwarf_die::skip_attributes): New function.
1960         (Dwarf_die::set_name): New function.
1961         (Dwarf_die::set_linkage_name): New function.
1962         (Dwarf_die::attribute): New function.
1963         (Dwarf_die::string_attribute): New function.
1964         (Dwarf_die::int_attribute): New function.
1965         (Dwarf_die::uint_attribute): New function.
1966         (Dwarf_die::ref_attribute): New function.
1967         (Dwarf_die::child_offset): New function.
1968         (Dwarf_die::sibling_offset): New function.
1969         (Dwarf_info_reader::check_buffer): New function.
1970         (Dwarf_info_reader::parse): New function.
1971         (Dwarf_info_reader::do_parse): New function.
1972         (Dwarf_info_reader::do_read_string_table): New function.
1973         (Dwarf_info_reader::lookup_reloc): New function.
1974         (Dwarf_info_reader::get_string): New function.
1975         (Dwarf_info_reader::visit_compilation_unit): New function.
1976         (Dwarf_info_reader::visit_type_unit): New function.
1977         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1978         Sized_elf_reloc_mapper.
1979         (Sized_dwarf_line_info::symbol_section): Remove function.
1980         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1981         (Sized_dwarf_line_info::read_line_mappings): Remove object
1982         parameter, adjust callers.
1983         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1984         * dwarf_reader.h: Include <sys/types.h>.
1985         (class Track_relocs): Remove forward declaration.
1986         (class Elf_reloc_mapper): New class.
1987         (class Sized_elf_reloc_mapper): New class.
1988         (class Dwarf_abbrev_table): New class.
1989         (class Dwarf_range_list): New class.
1990         (class Dwarf_ranges_table): New class.
1991         (class Dwarf_pubnames_table): New class.
1992         (class Dwarf_die): New class.
1993         (class Dwarf_info_reader): New class.
1994         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1995         (Sized_dwarf_line_info::symbol_section): Remove member function.
1996         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1997         base class.
1998         * gdb-index.cc: New source file.
1999         * gdb-index.h: New source file.
2000         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2001         and .debug_types sections, call Layout::add_to_gdb_index.
2002         (Sized_relobj_incr::do_section_name): Implement.
2003         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2004         return type; Implement.
2005         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2006         return type.
2007         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2008         parameter list and return type.
2009         (Sized_incr_dynobj::do_section_contents): Likewise.
2010         * layout.cc: Include gdb-index.h.
2011         (Layout::Layout): Initialize gdb_index_data_.
2012         (Layout::init_fixed_output_section): Check for .gdb_index section.
2013         (Layout::add_to_gdb_index): New function. Instantiate.
2014         * layout.h: Add forward declaration for class Gdb_index.
2015         (Layout::add_to_gdb_index): New member function.
2016         (Layout::gdb_index_data_): New data member.
2017         * main.cc: Include gdb-index.h.
2018         (main): Print statistics for gdb index.
2019         * object.cc (Object::section_contents): Move code into
2020         do_section_contents.
2021         (need_decompressed_section): Check for sections needed when building
2022         gdb index.
2023         (build_compressed_section_map): Likewise.
2024         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2025         gdb index.
2026         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2027         sections; call Layout::add_to_gdb_index.
2028         (Sized_relobj_file::do_decompressed_section_contents): Call
2029         do_section_contents directly.
2030         * object.h (Object::do_section_contents): Adjust parameter list and
2031         return type.
2032         (Object::do_decompressed_section_contents): Call do_section_contents
2033         directly.
2034         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2035         return type.
2036         * options.h (class General_options): Add --gdb-index option.
2037         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2038         list and return type.
2039         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2040         * reloc.h (Track_relocs::checkpoint): New function.
2041         (Track_relocs::reset): New function.
2042
2043         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2044         New test cases.
2045         * testsuite/Makefile.in: Regenerate.
2046         * testsuite/gdb_index_test.cc: New test source file.
2047         * testsuite/gdb_index_test_1.sh: New test source file.
2048         * testsuite/gdb_index_test_2.sh: New test source file.
2049
2050 2012-03-19  Doug Kwan  <dougkwan@google.com>
2051
2052         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2053         (Target_arm::do_finalize_sections): Remove code which defines
2054         __exidx_start and __exidx_end.  Make symbol table parameter
2055         anonymous as it is not used.
2056         * gold.cc (queue_middle_tasks): Call target hook to define any
2057         target-specific symbols.
2058         * target.h (Target::define_standard_symbols): New method.
2059         (Target::do_define_standard_symbols): Same.
2060         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2061         * testsuite/Makefile.in: Regenerate.
2062         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2063         and __exidx_end.
2064         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2065         relocations are generated for __exidx_start and __exidx_end.
2066
2067 2012-03-16  Doug Kwan  <dougkwan@google.com>
2068
2069         * testsuite/Makefile.am: Disable test initpri3b.
2070         * testsuite/Makefile.in: Regenerate.
2071
2072 2012-03-15  Doug Kwan  <dougkwan@google.com>
2073
2074         * arm.cc (Target_arm::got_section): Make .got section read-only
2075         if -z now is given.
2076
2077 2012-03-15  Ian Lance Taylor  <iant@google.com>
2078
2079         PR gold/13850
2080         * layout.cc (Layout::make_output_section): Correctly mark
2081         SHT_INIT_ARRAY, et. al., as relro.
2082
2083 2012-03-14  Doug Kwan  <dougkwan@google.com>
2084
2085         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2086         dynamic relocations for protected symbols in shared objects.
2087
2088 2012-03-13  Ian Lance Taylor  <iant@google.com>
2089
2090         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2091         keep the larger alignment.
2092
2093 2012-03-12  Cary Coutant  <ccoutant@google.com>
2094
2095         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2096         handling of DW_LNE_define_file.
2097
2098 2012-03-12  Cary Coutant  <ccoutant@google.com>
2099
2100         * reduced_debug_output.cc
2101         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2102         codes to switch.
2103
2104 2012-02-29  Cary Coutant  <ccoutant@google.com>
2105
2106         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2107
2108 2012-02-29  Cary Coutant  <ccoutant@google.com>
2109
2110         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2111         Call Object::decompressed_section_contents.
2112         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2113         New dtor.
2114         (Sized_dwarf_line_info::buffer_start_): New data member.
2115         * merge.cc (Output_merge_data::do_add_input_section): Call
2116         Object::decompressed_section_contents.
2117         (Output_merge_string::do_add_input_section): Likewise.
2118         * object.cc (need_decompressed_section): New function.
2119         (build_compressed_section_map): Decompress sections needed later.
2120         (Sized_relobj_file::do_decompressed_section_contents): New function.
2121         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2122         * object.h (Object::decompressed_section_contents): New function.
2123         (Object::discard_decompressed_sections): New function.
2124         (Object::do_decompressed_section_contents): New function.
2125         (Object::do_discard_decompressed_sections): New function.
2126         (Compressed_section_info): New type.
2127         (Compressed_section_map): Include decompressed section contents.
2128         (Sized_relobj_file::do_decompressed_section_contents): New function.
2129         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2130
2131 2012-02-16  Cary Coutant  <ccoutant@google.com>
2132
2133         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2134         * testsuite/Makefile.in: Regenerate.
2135
2136 2012-02-14  Cary Coutant  <ccoutant@google.com>
2137
2138         * options.cc (General_options::finalize): Disallow -pie and -static.
2139
2140 2012-02-03  Doug Kwan  <dougkwan@google.com>
2141
2142         * arm.cc (Arm_relocate_functions::abs8,
2143         Arm_relocate_functions::abs16): Use
2144         Bits::has_signed_unsigned_overflow32.
2145         (Arm_relocate_functions::thm_abs8): Correct range of
2146         overflow check.
2147         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2148         in assertions.
2149
2150 2012-02-02  Doug Kwan  <dougkwan@google.com>
2151
2152         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2153         position independent outputs, not just shared objects.
2154
2155 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2156
2157         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2158         * configure: Regenerated.
2159
2160 2012-01-27  Ian Lance Taylor  <iant@google.com>
2161
2162         * reloc.h (Bits): New class with static functions, copied from
2163         namespace utils in arm.cc.
2164         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2165         instead.
2166
2167 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2168
2169         * incremental.cc (write_info_blocks): Correct relocation offset.
2170
2171 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2172
2173         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2174         (Relocate::tls_gd_to_le): Likewise.
2175
2176 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2177
2178         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2179
2180 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2181
2182         * configure.ac: Check if -mcmodel=medium works.
2183         * configure: Regenerated.
2184
2185 2012-01-24  Cary Coutant  <ccoutant@google.com>
2186
2187         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2188         definition and ...
2189         (read_unsigned_LEB_128_x): ... this new function.
2190         (read_signed_LEB_128): Replaced with inline definition and ...
2191         (read_signed_LEB_128_x): ... this new function.
2192         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2193         (read_unsigned_LEB_128): Add inline definition.
2194         (read_signed_LEB_128_x): New function.
2195         (read_signed_LEB_128): Add inline definition.
2196         * testsuite/Makefile.am (leb128_unittest): New unit test.
2197         * testsuite/Makefile.in: Regenerate.
2198         * testsuite/leb128_unittest.cc: New unit test.
2199
2200 2012-01-23  Ian Lance Taylor  <iant@google.com>
2201
2202         PR gold/13617
2203         * i386.cc (Target_i386::do_code_fill): When using a jmp
2204         instruction, pad with nop instructions.
2205         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2206
2207 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2208
2209         * x86_64.cc (gc_process_relocs): Add typename on types used in
2210         template.
2211         (scan_relocs): Likewise.
2212         (relocate_section): Likewise.
2213         (apply_relocation): Likewise.
2214
2215 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2216
2217         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2218         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2219         under x32.
2220
2221 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2222
2223         * x86_64.cc: Initial support for x32.
2224
2225 2012-01-03  Cary Coutant  <ccoutant@google.com>
2226
2227         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2228         Use abstract base class for GOT.
2229         * gold/output.h (class Output_data_got_base): New abstract base class.
2230         (class Output_data_got): Derive from new base class, adjust ctors.
2231         (Output_data_got::reserve_slot): Make virtual; rename to
2232         do_reserve_slot; Adjust callers.
2233         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2234         pointer to abstract base class.
2235         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2236
2237 2011-12-18  Ian Lance Taylor  <iant@google.com>
2238
2239         * object.h (Relobj::local_symbol_value): New function.
2240         (Relobj::local_plt_offset): New function.
2241         (Relobj::local_has_got_offset): New function.
2242         (Relobj::local_got_offset): New function.
2243         (Relobj::set_local_got_offset): New function.
2244         (Relobj::do_local_symbol_value): New pure virtual function.
2245         (Relobj::do_local_plt_offset): Likewise.
2246         (Relobj::do_local_has_got_offset): Likewise.
2247         (Relobj::do_local_got_offset): Likewise.
2248         (Relobj::do_set_local_got_offset): Likewise.
2249         (Sized_relobj::do_local_has_got_offset): Rename from
2250         local_has_got_offset.
2251         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2252         (Sized_relobj::do_set_local_got_offset): Rename from
2253         set_local_got_offset.
2254         (Sized_relobj_file::do_local_plt_offset): Rename from
2255         local_plt_offset.
2256         (Sized_relobj_file::do_local_symbol_value): New function.
2257         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2258         local_plt_offset.
2259         * output.cc (Output_data_got::Got_entry::write): Change object to
2260         Relobj.  Use local_symbol_value.
2261         (Output_data_got::add_global_with_rel): Change rel_dyn to
2262         Output_data_reloc_generic*.  Use add_global_generic.
2263         (Output_data_got::add_global_with_rela): Remove.  Change all
2264         callers to use add_global_with_rel.
2265         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2266         Output_data_reloc_generic*.  Use add_global_generic.
2267         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2268         callers to use add_global_pair_with_rel.
2269         (Output_data_got::add_local): Change object to Relobj*.
2270         (Output_data_got::add_local_plt): Likewise.
2271         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2272         change rel_dyn to Output_data_reloc_generic*.  Use
2273         add_local_generic.
2274         (Output_data_got::add_local_with_rela): Remove.  Change all
2275         callers to use all_local_with_rel.
2276         (Output_data_got::add_local_pair_with_rel): Change object to
2277         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2278         add_output_section_generic.
2279         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2280         callers to use add_local_pair_with_rel.
2281         (Output_data_got::reserve_local): Change object to Relobj*.
2282         * output.h: (class Output_data_reloc_generic): Add pure virtual
2283         declarations for add_global_generic, add_local_generic,
2284         add_output_section_generic.
2285         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2286         functions for Output_data_reloc_generic.  Update declarations for
2287         changes listed in output.cc.
2288         (class Output_data_got): Change template parameter to got_size.
2289         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2290         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2291         function.
2292         (Sized_relobj_incr::do_local_plt_offset): New function.
2293         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2294         add_global_generic.
2295
2296 2011-12-17  Cary Coutant  <ccoutant@google.com>
2297
2298         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2299         * resolve.cc (Symbol_table::resolve): Likewise.
2300         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2301         arrays.
2302         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2303
2304 2011-12-16  Ian Lance Taylor  <iant@google.com>
2305
2306         * output.h (Output_data_reloc_generic::add): Only call
2307         add_dynamic_reloc if this is a dynamic reloc section.
2308
2309 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2310
2311         PR gold/13505
2312         * target-reloc.h (apply_relocation): Replace <64, false> with
2313         <size, big_endian>.
2314
2315 2011-11-25  Nick Clifton  <nickc@redhat.com>
2316
2317         * po/it.po: New Italian translation.
2318
2319 2011-11-17  Sterling Augustine  <saugustine@google.com>
2320
2321         * script.cc (script_include_directive): Implement.
2322         (read_script_file): New local variables name and search_path. Update
2323         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2324         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2325         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2326
2327 2011-11-11  Sterling Augustine  <saugustine@google.com>
2328
2329         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2330         (file_or_sections_cmd): Likewise.
2331
2332 2011-11-11  Doug Kwan  <dougkwan@google.com>
2333
2334         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2335         if --just-symbols is given.
2336
2337 2011-11-10  Doug Kwan  <dougkwan@google.com>
2338
2339         PR gold/13362
2340         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2341         when processing data relocs.
2342         * reloc.h (Relocate_functions::rel_unaligned): New method.
2343         (Relocate_functions::pcrel_unaligned): Ditto.
2344         (Relocate_functions::rel32_unaligned): Ditto.
2345         (Relocate_functions::pcrel32_unaligned): Ditto.
2346
2347 2011-11-09  Doug Kwan  <dougkwan@google.com>
2348
2349         PR gold/13362
2350         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2351         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2352         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2353         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2354         (Relocate_functions::rel_unaligned): New.
2355         (Relocate_functions::rel32_unaligned): New.
2356         * target-reloc.h (relocate_for_relocatable): Add code to handle
2357         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2358         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2359         arm_unaligned_reloc_r): New targets.
2360         * testsuite/Makefile.in: Regenerate.
2361         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2362         linking.
2363
2364 2011-11-02  Ian Lance Taylor  <iant@google.com>
2365
2366         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2367         NATIVE_LINKER.
2368         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2369         * options.cc (General_options::finalize): Use library search path
2370         from configure script if specified.  If not native and no sysroot,
2371         only search TOOLLIBDIR.
2372         * options.h (Search_directory::Search_directory): Change name to
2373         const std::string&.
2374         (General_options::add_to_library_path_with_sysroot): Change arg to
2375         const std::string&.
2376         * configure, Makefile.in, config.in: Rebuild.
2377
2378 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2379
2380         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2381         we are working around the ARM1176 Erratum.
2382         * options.h (General_options::fix_arm1176): Add option.
2383         * testsuite/Makefile.am: Add testcases, and keep current ones
2384         working.
2385         * testsuite/Makefile.in: Regenerate.
2386         * testsuite/arm_fix_1176.s: New file.
2387         * testsuite/arm_fix_1176.sh: Likewise.
2388
2389 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2390
2391         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2392         may_use_blx_.
2393         (Target_arm::may_use_blx): Remove method.
2394         (Target_arm::set_may_use_blx): Likewise.
2395         (Target_arm::may_use_v4t_interworking): New method.
2396         (Target_arm::may_use_v5t_interworking): Likewise.
2397         (Target_arm::may_use_blx_): Remove member variable.
2398         (Arm_relocate_functions::arm_branch_common): Check for v5T
2399         interworking.
2400         (Arm_relocate_functions::thumb_branch_common): Likewise.
2401         (Reloc_stub::stub_type_for_reloc): Likewise.
2402         (Target_arm::do_finalize_sections): Correct interworking checks.
2403         * testsuite/Makefile.am: Add new tests.
2404         * testsuite/Makefile.in: Regenerate.
2405         * testsuite/arm_farcall_arm_arm.s: New test.
2406         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2407         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2408         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2409         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2410         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2411         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2412         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2413
2414 2011-10-31  Cary Coutant  <ccoutant@google.com>
2415
2416         PR gold/13023
2417         * expression.cc (Expression::eval_with_dot): Add
2418         is_section_dot_assignment parameter.
2419         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2420         absolute and assigning to dot within a section.
2421         * script-sections.cc
2422         (Output_section_element_assignment::set_section_addresses): Pass
2423         dot_section to set_if_absolute.
2424         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2425         as is_section_dot_assignment flag to eval_with_dot.
2426         (Output_section_element_dot_assignment::set_section_addresses):
2427         Likewise.
2428         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2429         parameter.  Also set value if relative to dot_section; set the
2430         symbol's output_section.
2431         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2432         parameter.  Adjust all callers.
2433         (Expression::eval_maybe_dot): Likewise.
2434         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2435         Adjust all callers.
2436         * testsuite/script_test_2.t: Test assignment of an absolute value
2437         to dot within an output section element.
2438
2439 2011-10-31  Cary Coutant  <ccoutant@google.com>
2440
2441         * options.h (class General_options): Add --[no-]gnu-unique options.
2442         * symtab.cc (Symbol_table::sized_write_globals): Convert
2443         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2444
2445 2011-10-31  Cary Coutant  <ccoutant@google.com>
2446
2447         PR gold/13359
2448         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2449         unnecessary assertion.
2450         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2451
2452 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2453
2454         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2455         gc_mark_symbol.
2456         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2457         gc_mark_symbol.
2458         Change to just keep the section associated with symbol.
2459         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2460         they are externally visible and --export-dynamic is turned on.
2461         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2462
2463 2011-10-19  Ian Lance Taylor  <iant@google.com>
2464
2465         PR gold/13163
2466         * script-sections.cc
2467         (Output_section_element_dot_assignment::needs_output_section): New
2468         function.
2469
2470 2011-10-19  Ian Lance Taylor  <iant@google.com>
2471
2472         PR gold/13204
2473         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2474         --section-start option was seen.
2475         * options.h (General_options::any_section_start): New function.
2476
2477 2011-10-18  David S. Miller  <davem@davemloft.net>
2478
2479         PR binutils/13301
2480         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2481         member to track relocation locations that have moved during TLS
2482         reloc optimizations.
2483         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2484         (Target_sparc::Relocate::relocate): Adjust view down by 4
2485         bytes if it matches reloc_adjust_addr_.
2486         (Target_sparc::Relocate::relocate_tls): Always move the
2487         __tls_get_addr call delay slot instruction forward 4 bytes when
2488         performing relaxation.
2489
2490 2011-10-18  Cary Coutant  <ccoutant@google.com>
2491
2492         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2493         (Output_file::map_no_anonymous): Check for non-zero
2494         return code from posix_fallocate.
2495
2496 2011-10-17  Cary Coutant  <ccoutant@google.com>
2497
2498         PR gold/13245
2499         * plugin.cc (is_visible_from_outside): Check for symbols
2500         referenced from dynamic objects.
2501         * resolve.cc (Symbol_table::resolve): Don't count references
2502         from dynamic objects as references from real ELF files.
2503         * testsuite/plugin_test_2.sh: Adjust expected result.
2504
2505 2011-10-17  Cary Coutant  <ccoutant@google.com>
2506
2507         * gold.cc: Include timer.h.
2508         (queue_middle_tasks): Stamp time.
2509         (queue_final_tasks): Likewise.
2510         * main.cc (main): Store timer in parameters.  Print timers
2511         for each pass.
2512         * parameters.cc (Parameters::Parameters): Initialize timer_.
2513         (Parameters::set_timer): New function.
2514         (set_parameters_timer): New function.
2515         * parameters.h (Parameters::set_timer): New function.
2516         (Parameters::timer): New function.
2517         (Parameters::timer_): New data member.
2518         (set_parameters_timer): New function.
2519         * timer.cc (Timer::stamp): New function.
2520         (Timer::get_pass_time): New function.
2521         * timer.h (Timer::stamp): New function.
2522         (Timer::get_pass_time): New function.
2523         (Timer::pass_times_): New data member.
2524
2525 2011-10-17  Cary Coutant  <ccoutant@google.com>
2526
2527         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2528         task for members of lib groups.
2529
2530 2011-10-17  Cary Coutant  <ccoutant@google.com>
2531
2532         PR gold/13288
2533         * fileread.cc (File_read::find_view): Add assert.
2534         (File_read::make_view): Move bounds check (replace with assert)...
2535         (File_read::find_or_make_view): ... to here.
2536
2537 2011-10-12  Cary Coutant  <ccoutant@google.com>
2538
2539         * output.cc (Output_file::open_base_file): Handle case where
2540         ::read returns less than requested size.
2541
2542 2011-10-10  Cary Coutant  <ccoutant@google.com>
2543
2544         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2545         Initialize defined_count_.
2546         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2547         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2548         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2549         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2550         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2551         * incremental.h (Sized_relobj_incr::defined_count_): New data
2552         member.
2553         (Sized_incr_dynobj::defined_count_): New data member.
2554         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2555         Return zeroes instead of internal error.
2556
2557 2011-10-10  Cary Coutant  <ccoutant@google.com>
2558
2559         PR gold/13249
2560         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2561         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2562         * output.h (class Output_reloc): Add use_plt_offset flag.
2563         (Output_reloc::type_): Adjust size of bit field.
2564         (Output_reloc::use_plt_offset_): New bit field.
2565         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2566         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2567         flag.  Adjust all callers.
2568         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2569         creating RELATIVE relocations.
2570
2571 2011-10-10  Nick Clifton  <nickc@redhat.com>
2572
2573         * po/es.po: Updated Spanish translation.
2574         * po/fi.po: Updated Finnish translation.
2575
2576 2011-10-03   Diego Novillo  <dnovillo@google.com>
2577
2578         * options.cc (parse_uint): Fix dereference of RETVAL.
2579
2580 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2581
2582         * layout.h (section_order_map_): New member.
2583         (get_section_order_map): New member function.
2584         * output.cc (Output_section::add_input_section): Check for patterns
2585         only when --section-ordering-file is specified.
2586         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2587         output_sections have been formed.
2588         * layout.cc (Layout_Layout): Initialize section_order_map_.
2589         * plugin.cc (update_section_order): Store order in order_map. Do not
2590         update the order.
2591         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2592         * testsuite/Makefile.in: Regenerate.
2593         * testsuite/plugin_section_order.c: New file.
2594         * testsuite/plugin_final_layout.cc: New file.
2595         * testsuite/plugin_final_layout.sh: New file.
2596
2597 2011-09-29  Cary Coutant  <ccoutant@google.com>
2598
2599         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2600         Check for NULL.
2601         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2602         symbols during incremental update.
2603         (Symbol_table::add_from_dynobj): Likewise.
2604
2605 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2606             Ian Lance Taylor  <iant@google.com>
2607
2608         * symtab.cc (Symbol_table::define_special_symbol): Always
2609         canonicalize version string.
2610
2611 2011-09-26  Cary Coutant  <ccoutant@google.com>
2612
2613         * gold.cc (queue_initial_tasks): Move option checks ...
2614         * options.cc (General_options::finalize): ... to here. Disable
2615         some options; make others fatal.
2616
2617 2011-09-26  Cary Coutant  <ccoutant@google.com>
2618
2619         gcc PR lto/47247
2620         * plugin.cc (get_symbols_v2): New function.
2621         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2622         (is_referenced_from_outside): New function.
2623         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2624         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2625         (get_symbols): Pass version parameter.
2626         (get_symbols_v2): New function.
2627         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2628         parameter.
2629         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2630         (onload): Add LDPT_GET_SYMBOLS_V2.
2631         (all_symbols_read_hook): Use get_symbols_v2; check for
2632         LDPR_PREVAILING_DEF_IRONLY_EXP.
2633         * testsuite/plugin_test_3.sh: Update expected results.
2634
2635 2011-09-23  Simon Baldwin  <simonb@google.com>
2636
2637         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2638         configuration options.
2639         * configure: Regenerate.
2640         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2641         * Makefile.in: Regenerate.
2642         * testsuite/Makefile.in: Regenerate.
2643
2644 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2645
2646         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2647
2648 2011-09-19  Cary Coutant  <ccoutant@google.com>
2649
2650         * incremental.cc (can_incremental_update): Fix typo in comment.
2651         * incremental.h (can_incremental_update): Likewise.
2652
2653 2011-09-18  Cary Coutant  <ccoutant@google.com>
2654
2655         * incremental.cc (can_incremental_update): New function.
2656         * incremental.h (can_incremental_update): New function.
2657         * layout.cc (Layout::init_fixed_output_section): Call it.
2658         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2659         * object.cc (Sized_relobj_file::do_layout): Call
2660         can_incremental_update.
2661
2662 2011-09-13  Cary Coutant  <ccoutant@google.com>
2663
2664         * configure.ac: Check for glibc support for gnu_indirect_function
2665         support with static linking, setting automake conditional
2666         IFUNC_STATIC.
2667         * Makefile.in: Regenerate.
2668         * configure: Regenerate.
2669
2670         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2671         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2672         for IFUNC_STATIC.
2673         * testsuite/Makefile.in: Regenerate.
2674
2675 2011-09-13  Cary Coutant  <ccoutant@google.com>
2676
2677         * incremental.cc (Sized_relobj_incr::do_layout): Call
2678         report_comdat_group for kept comdat sections.
2679         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2680         * testsuite/Makefile.in: Regenerate.
2681         * testsuite/incr_comdat_test_1.cc: New source file.
2682         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2683         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2684         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2685
2686 2011-09-13  Ian Lance Taylor  <iant@google.com>
2687
2688         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2689         variable external_symbols_offset.
2690
2691 2011-09-12  Ian Lance Taylor  <iant@google.com>
2692
2693         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2694         triggered if object has no symbols.
2695
2696 2011-09-09  David S. Miller  <davem@davemloft.net>
2697
2698         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2699         (Output_fill_debug_line::do_write): Likewise.
2700
2701 2011-08-29  Cary Coutant  <ccoutant@google.com>
2702
2703         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2704         casts to match formatting specs.
2705         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2706
2707 2011-08-26  Cary Coutant  <ccoutant@google.com>
2708
2709         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2710         remaining hole size when allocating.
2711         (Layout::make_output_section): Set fill methods for debug sections.
2712         * layout.h (Free_list::Free_list_node): Move from private to
2713         public.
2714         (Free_list::set_min_hole_size): New function.
2715         (Free_list::begin, Free_list::end): New functions.
2716         (Free_list::min_hole_): New data member.
2717         * output.cc: Include dwarf.h.
2718         (Output_fill_debug_info::do_minimum_hole_size): New function.
2719         (Output_fill_debug_info::do_write): New function.
2720         (Output_fill_debug_line::do_minimum_hole_size): New function.
2721         (Output_fill_debug_line::do_write): New function.
2722         (Output_section::Output_section): Initialize new data member.
2723         (Output_section::set_final_data_size): Ensure patch space is larger
2724         than minimum hole size.
2725         (Output_section::do_write): Fill holes in debug sections.
2726         * output.h (Output_fill): New class.
2727         (Output_fill_debug_info): New class.
2728         (Output_fill_debug_line): New class.
2729         (Output_section::set_free_space_fill): New function.
2730         (Output_section::free_space_fill_): New data member.
2731         * testsuite/Makefile.am (incremental_test_3): Add
2732         --incremental-patch option.
2733         (incremental_test_4): Likewise.
2734         (incremental_test_5): Likewise.
2735         (incremental_test_6): Likewise.
2736         (incremental_copy_test): Likewise.
2737         (incremental_common_test_1): Likewise.
2738         * testsuite/Makefile.in: Regenerate.
2739
2740 2011-08-26  Nick Clifton  <nickc@redhat.com>
2741
2742         * po/es.po: Updated Spanish translation.
2743
2744 2011-08-01  Cary Coutant  <ccoutant@google.com>
2745
2746         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2747         * gold/testsuite/Makefile.in: Regenerate.
2748         * gold/testsuite/justsyms_exec.c: New source file.
2749         * gold/testsuite/justsyms_lib.c: New source file.
2750
2751 2011-08-01  Cary Coutant  <ccoutant@google.com>
2752
2753         * layout.cc (Layout::set_segment_offsets): Don't realign text
2754         segment if -Ttext was specified.
2755         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2756         file type.
2757         * object.h (Sized_relobj_file::e_type): New function.
2758         (Sized_relobj_file::e_type_): New data member.
2759         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2760         base address for ET_EXEC files.
2761         * target.cc (Target::do_make_elf_object_implementation): Allow
2762         ET_EXEC files with --just-symbols option.
2763
2764 2011-07-28  Cary Coutant  <ccoutant@google.com>
2765
2766         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2767         Add thread_number parameter.
2768         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2769         * workqueue-threads.cc
2770         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2771         current thread if its thread number is greater than desired thread
2772         count.
2773         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2774         Add thread_number parameter.
2775         (Workqueue::should_cancel_thread): Likewise.
2776         (Workqueue::find_runnable_or_wait): Pass thread_number to
2777         should_cancel_thread.
2778         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2779         parameter.
2780
2781 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2782
2783         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2784         only after checking if it cannot be forced local.
2785         * symtab.h (is_externally_visible): Check if the symbol is not forced
2786         local.
2787
2788 2011-07-15  Ian Lance Taylor  <iant@google.com>
2789
2790         * options.h (class General_options): Add --print-output-format.
2791         Move -EL next to -EB, for  better --help output.
2792         * target-select.cc: Include <cstdio>, "options.h", and
2793         "parameters.h".
2794         (Target_selector::do_target_bfd_name): New function.
2795         (print_output_format): New function.
2796         * target-select.h (class Target_selector): Update declarations.
2797         (Target_selector::target_bfd_name): New function.
2798         (print_output_format): Declare.
2799         * main.cc: Include "target-select.h".
2800         (main): Handle --print-output-format.
2801         * gold.cc: Include "target-select.h".
2802         (queue_initial_tasks): Handle --print-output-format when there are
2803         no input files.
2804         * parameters.cc (parameters_force_valid_target): Give a better
2805         error message if -EB/-EL does not match target.
2806         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2807         function.
2808
2809 2011-07-15  Ian Lance Taylor  <iant@google.com>
2810
2811         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2812         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2813         (Output_data_plt_i386::do_write): Write address of .dynamic
2814         section to first entry in .got.plt section.
2815         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2816         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2817         Initialize layout_.
2818         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2819         section to first entry in .got.plt section.
2820         * layout.h (Layout::dynamic_section): New function.
2821
2822 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2823
2824         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2825         to claim_file call.
2826         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2827         input_section_position_, and input_section_glob_.
2828         (read_layout_from_file): Call function section_ordering_specified.
2829         * layout.h (is_section_ordering_specified): New function.
2830         (section_ordering_specified): New function.
2831         (section_ordering_specified_): New boolean member.
2832         * main.cc(main): Call load_plugins after layout object is defined.
2833         * output.cc (Output_section::add_input_section): Use
2834         function section_ordering_specified to check if section ordering is
2835         needed.
2836         * output.cc (Output_section::add_relaxed_input_section): Use
2837         function section_ordering_specified to check if section ordering is
2838         needed.
2839         (Output_section::update_section_layout): New function.
2840         (Output_section::sort_attached_input_sections): Check if input section
2841         must be reordered.
2842         * output.h (Output_section::update_section_layout): New function.
2843         * plugin.cc (get_section_count): New function.
2844         (get_section_type): New function.
2845         (get_section_name): New function.
2846         (get_section_contents): New function.
2847         (update_section_order): New function.
2848         (allow_section_ordering): New function.
2849         (Plugin::load): Add the new interfaces to the transfer vector.
2850         (Plugin_manager::load_plugins): New parameter.
2851         (Plugin_manager::all_symbols_read): New parameter.
2852         (Plugin_manager::claim_file): New parameter. Save the elf object for
2853         unclaimed objects.
2854         (Plugin_manager::get_elf_object): New function.
2855         (Plugin_manager::get_view): Change to directly use the bool to check
2856         if get_view is called from claim_file_hook.
2857         * plugin.h (input_objects): New function
2858         (Plugin__manager::load_plugins): New parameter.
2859         (Plugin_manager::claim_file): New parameter.
2860         (Plugin_manager::get_elf_object): New function.
2861         (Plugin_manager::in_claim_file_handler): New function.
2862         (Plugin_manager::in_claim_file_handler_): New member.
2863         (layout): New function.
2864         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2865         handler with an extra parameter. Make the elf object before calling
2866         claim_file handler.
2867         * testsuite/plugin_test.c (get_section_count): New function pointer.
2868         (get_section_type): New function pointer.
2869         (get_section_name): New function pointer.
2870         (get_section_contents): New function pointer.
2871         (update_section_order): New function pointer.
2872         (allow_section_ordering): New function pointer.
2873         (onload): Check if the new interfaces exist.
2874
2875 2011-07-13  Ian Lance Taylor  <iant@google.com>
2876
2877         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2878         relro section.
2879         * x86_64.cc (Target_x86_64::got_section): Likewise.
2880         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2881         (relro_now_test_SOURCES): New variable.
2882         (relro_now_test_DEPENDENCIES): New variable.
2883         (relro_now_test_LDFLAGS): New variable.
2884         (relro_now_test_LDADD): New variable.
2885         (relro_now_test.so): New target.
2886         * testsuite/Makefile.in: Rebuild.
2887
2888 2011-07-12  Ian Lance Taylor  <iant@google.com>
2889
2890         PR gold/12980
2891         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2892         GLOB_DAT relocation rather than a RELATIVE relocation for a
2893         protected symbol when creating a shared library.
2894         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2895         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2896         * testsuite/protected_main_1.cc (main): Test that protected
2897         function has same address.
2898
2899 2011-07-11  Ian Lance Taylor  <iant@google.com>
2900
2901         PR gold/12979
2902         * options.h (class General_options): Add -Bgroup.
2903         * options.cc (General_options::finalize): If -Bgroup is set,
2904         default to --unresolved-symbols=report-all.
2905         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2906         * target-reloc.h (issue_undefined_symbol_error): Handle
2907         --unresolved-symbols=report-all.
2908
2909 2011-07-08  Ian Lance Taylor  <iant@google.com>
2910
2911         PR gold/11985
2912         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2913         if linker script discards key sections.
2914         (Layout::create_dynamic_symtab): Likewise.
2915         (Layout::assign_local_dynsym_offsets): Likewise.
2916         (Layout::sized_create_version_sections): Likewise.
2917         (Layout::create_interp): Likewise.
2918         (Layout::finish_dynamic_section): Likewise.
2919         (Layout::set_dynamic_symbol_size): Likewise.
2920
2921 2011-07-08  Ian Lance Taylor  <iant@google.com>
2922
2923         PR gold/12386
2924         * options.h (class General_options): Add --unresolved-symbols.
2925         * target-reloc.h (issue_undefined_symbol_error): Check
2926         --unresolved-symbols.  Add comments.
2927
2928 2011-07-08  Ian Lance Taylor  <iant@google.com>
2929
2930         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2931         expression more complex.
2932
2933 2011-07-08  Ian Lance Taylor  <iant@google.com>
2934
2935         PR gold/11317
2936         * target-reloc.h (issue_undefined_symbol_error): New inline
2937         function, broken out of relocate_section.
2938         (relocate_section): Call issue_undefined_symbol_error.
2939         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2940         there is no TLS segment if we are about to issue an undefined
2941         symbol error.
2942         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2943
2944 2011-07-08  Ian Lance Taylor  <iant@google.com>
2945
2946         PR gold/12279
2947         * resolve.cc (Symbol_table::should_override): Add fromtype
2948         parameter.  Change all callers.  Give error when linking together
2949         TLS and non-TLS symbol.
2950         (Symbol_table::should_override_with_special): Add fromtype
2951         parameter.  Change all callers.
2952         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2953         there is no TLS segment if we have reported some errors.
2954         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2955
2956 2011-07-08  Ian Lance Taylor  <iant@google.com>
2957
2958         PR gold/12372
2959         * target.h (Target::plt_address_for_global): New function.
2960         (Target::plt_address_for_local): New function.
2961         (Target::plt_section_for_global): Remove.
2962         (Target::plt_section_for_local): Remove.
2963         (Target::do_plt_address_for_global): New virtual function.
2964         (Target::do_plt_address_for_local): New virtual function.
2965         (Target::do_plt_section_for_global): Remove.
2966         (Target::do_plt_section_for_local): Remove.
2967         (Target::register_global_plt_entry): Add Symbol_table and Layout
2968         parameters.
2969         * output.cc (Output_data_got::Got_entry::write): Use
2970         plt_address_for_global and plt_address_for_local.
2971         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2972         address of output section.
2973         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2974         got_irelative_, and irelative_count_ fields.  Update
2975         declarations.
2976         (Output_data_plt_i386::has_irelative_section): New function.
2977         (Output_data_plt_i386::entry_count): Add irelative_count_.
2978         (Output_data_plt_i386::set_final_data_size): Likewise.
2979         (class Target_i386): Add got_irelative_ and rel_irelative_
2980         fields.  Update declarations.
2981         (Target_i386::Target_i386): Initialize new fields.
2982         (Target_i386::do_plt_address_for_global): New function replacing
2983         do_plt_section_for_global.
2984         (Target_i386::do_plt_address_for_local): New function replacing
2985         do_plt_section_for_local.
2986         (Target_i386::got_section): Create got_irelative_.
2987         (Target_i386::rel_irelative_section): New function.
2988         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2989         fields.  Don't define __rel_iplt_{start,end}.
2990         (Output_data_plt_i386::add_entry): Add symtab and layout
2991         parameters.  Change all callers.  Use different PLT and GOT for
2992         IFUNC symbols.
2993         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2994         layout parameters.  Change all callers.  Use different PLT and
2995         GOT.
2996         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2997         (Output_data_plt_i386::rel_irelative): New function.
2998         (Output_data_plt_i386::address_for_global): New function.
2999         (Output_data_plt_i386::address_for_local): New function.
3000         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3001         IRELATIVE GOT when changing IFUNC GOT entries.
3002         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3003         reloc.
3004         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3005         if we didn't create an IRELATIVE GOT.
3006         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3007         plt_address_for_local.
3008         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3009         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3010         got_irelative_, and irelative_count_ fields.  Update
3011         declarations.
3012         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3013         Initialize new fields.  Remove symtab parameter.  Change all
3014         callers.
3015         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3016         irelative_count_.
3017         (Output_data_plt_x86_64::has_irelative_section): New function.
3018         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3019         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3020         fields.  Update declarations.
3021         (Target_x86_64::Target_x86_64): Initialize new fields.
3022         (Target_x86_64::do_plt_address_for_global): New function replacing
3023         do_plt_section_for_global.
3024         (Target_x86_64::do_plt_address_for_local): New function replacing
3025         do_plt_section_for_local.
3026         (Target_x86_64::got_section): Create got_irelative_.
3027         (Target_x86_64::rela_irelative_section): New function.
3028         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3029         all callers.  Don't create __rel_iplt_{start,end}.
3030         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3031         parameters.  Change all callers.  Use different PLT and GOT for
3032         IFUNC symbols.
3033         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3034         layout parameters.  Change all callers.  Use different PLT and
3035         GOT.
3036         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3037         parameters.  Change all callers.  Use different PLT and GOT for
3038         IFUNC symbols.
3039         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3040         (Output_data_plt_x86_64::rela_irelative): New function.
3041         (Output_data_plt_x86_64::address_for_global): New function.
3042         (Output_data_plt_x86_64::address_for_local): New function.
3043         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3044         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3045         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3046         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3047         parameters.
3048         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3049         reloc.
3050         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3051         symbols if we didn't create an IRELATIVE GOT.
3052         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3053         plt_address_for_local.
3054         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3055         * testsuite/ifuncvar1.c: New test file.
3056         * testsuite/ifuncvar2.c: New test file.
3057         * testsuite/ifuncvar3.c: New test file.
3058         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3059         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3060         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3061         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3062         * testsuite/Makefile.in: Rebuild.
3063
3064 2011-07-07  Cary Coutant  <ccoutant@google.com>
3065
3066         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3067         (two_file_test_1_ndebug.o): Likewise.
3068         (two_file_test_1b_ndebug.o): Likewise.
3069         (two_file_test_2_ndebug.o): Likewise.
3070         (two_file_test_main_ndebug.o): Likewise.
3071         (incremental_test_2): Link with no-debug versions.
3072
3073 2011-07-06  Cary Coutant  <ccoutant@google.com>
3074
3075         * gold/incremental.cc
3076         (Output_section_incremental_inputs::write_info_blocks): Check for
3077         hidden and internal symbols.
3078
3079 2011-07-06  Cary Coutant  <ccoutant@google.com>
3080
3081         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3082         Check disposition for startup file.
3083         (Incremental_inputs::report_command_line): Ignore
3084         --incremental-startup-unchanged option.
3085         * options.cc (General_options::parse_incremental_startup_unchanged):
3086         New function.
3087         (General_options::General_options): Initialize new data member.
3088         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3089         (General_options): Add --incremental-startup-unchanged option.
3090         (General_options::incremental_startup_disposition): New function.
3091         (General_options::incremental_startup_disposition_): New data member.
3092
3093 2011-07-06  Cary Coutant  <ccoutant@google.com>
3094
3095         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3096         input file index to Script_info ctor.
3097         (Sized_incremental_binary::do_file_has_changed): Find the
3098         command-line argument for files named in scripts.
3099         * incremental.h (Script_info::Script_info): New ctor
3100         with input file index.
3101         (Script_info::input_file_index): New function.
3102         (Script_info::input_file_index_): New data member.
3103         (Incremental_binary::get_library): Add const.
3104         (Incremental_binary::get_script_info): Add const.
3105         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3106         * testsuite/Makefile.am (incremental_test_5): New test case.
3107         (incremental_test_6): New test case.
3108         * testsuite/Makefile.in: Regenerate.
3109
3110 2011-07-06  Cary Coutant  <ccoutant@google.com>
3111
3112         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3113         debug output when command lines differ.
3114
3115 2011-07-06  Cary Coutant  <ccoutant@google.com>
3116
3117         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3118         --incremental-patch option.
3119         * layout.cc (Free_list::allocate): Extend allocation beyond original
3120         end if enabled.
3121         (Layout::make_output_section): Mark sections that should get
3122         patch space.
3123         * options.cc (parse_percent): New function.
3124         * options.h (parse_percent): New function.
3125         (DEFINE_percent): New macro.
3126         (General_options): Add --incremental-patch option.
3127         * output.cc (Output_section::Output_section): Initialize new data
3128         members.
3129         (Output_section::add_input_section): Print section name when out
3130         of patch space.
3131         (Output_section::add_output_section_data): Likewise.
3132         (Output_section::set_final_data_size): Add patch space when
3133         doing --incremental-full.
3134         (Output_section::do_reset_address_and_file_offset): Remove patch
3135         space.
3136         (Output_segment::set_section_list_addresses): Print debug output
3137         only if --incremental-update.
3138         * output.h (Output_section::set_is_patch_space_allowed): New function.
3139         (Output_section::is_patch_space_allowed_): New data member.
3140         (Output_section::patch_space_): New data member.
3141         * parameters.cc (Parameters::incremental_full): New function.
3142         * parameters.h (Parameters::incremental_full): New function
3143         * testsuite/Makefile.am (incremental_test_2): Add test for
3144         --incremental-patch option.
3145         * testsuite/Makefile.in: Regenerate.
3146         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3147         (t18): Remove function body.
3148
3149 2011-07-05  Doug Kwan  <dougkwan@google.com>
3150
3151         PR gold/12771
3152         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3153         Arm_Address type for relocation result.
3154         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3155         overflow check.
3156         (Arm_relocate_functions::abs32): Use unaligned access.
3157         (Arm_relocate_functions::rel32): Ditto.
3158         (Arm_relocate_functions::prel31): Ditto.
3159         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3160         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3161         static data relocations.
3162         * testsuite/Makefile.in: Regnerate.
3163         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3164
3165 2011-07-05  Ian Lance Taylor  <iant@google.com>
3166
3167         PR gold/12392
3168         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3169         symbols if necessary.
3170         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3171
3172 2011-07-05  Ian Lance Taylor  <iant@google.com>
3173
3174         PR gold/12952
3175         * resolve.cc (Symbol::override_base_with_special): Simply override
3176         version with special symbol version, ignoring previous version.
3177
3178 2011-07-05  Ian Lance Taylor  <iant@google.com>
3179
3180         * object.cc (Sized_relobj_file::include_section_group): Add
3181         information to comment about signature location.
3182
3183 2011-07-02  Ian Lance Taylor  <iant@google.com>
3184
3185         PR gold/12957
3186         * options.h (class General_options): Add -f and -F.
3187         * options.cc (General_options::finalize): Fatal error if -f/-F
3188         are used without -shared.
3189         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3190
3191 2011-07-02  Ian Lance Taylor  <iant@google.com>
3192
3193         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3194
3195 2011-07-01  Ian Lance Taylor  <iant@google.com>
3196
3197         PR gold/12525
3198         PR gold/12952
3199         * resolve.cc (Symbol::override_base_with_special): Don't override
3200         the version if the overriding symbol has a different name.
3201         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3202         all callers.  If we give an error about an undefined version,
3203         define the base version if necessary.
3204         * dynobj.h (class Versions): Update declaration.
3205         * testsuite/weak_alias_test_5.cc: New file.
3206         * testsuite/weak_alias_test.script: New file.
3207         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3208         and versioned_alias have the right value, and call t2.
3209         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3210         weak_alias_test_5.so.
3211         (weak_alias_test_LDADD): Likewise.
3212         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3213         * testsuite/Makefile.in: Rebuild.
3214
3215 2011-07-01  Ian Lance Taylor  <iant@google.com>
3216
3217         PR gold/12525
3218         * options.h (class General_options): Support -z notext.
3219         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3220         -Wl,-z,notext.
3221         (two_file_shared_nonpic.so): Likewise.
3222         (two_file_shared_mixed.so): Likewise.
3223         (two_file_shared_mixed_1.so): Likewise.
3224         (weak_undef_lib_nonpic.so): Likewise.
3225         (alt/weak_undef_lib_nonpic.so): Likewise.
3226         (tls_test_shared_nonpic.so): Likewise.
3227         * testsuite/Makefile.in: Rebuild.
3228
3229 2011-07-01  Ian Lance Taylor  <iant@google.com>
3230
3231         PR gold/12525
3232         * configure.ac: Test whether static linking works, setting
3233         the automake conditional HAVE_STATIC.
3234         * testsuite/Makefile.am: Disable tests using -static if
3235         HAVE_STATIC is not true.
3236         * configure, testsuite/Makefile.in: Rebuild.
3237
3238 2011-07-01  Ian Lance Taylor  <iant@google.com>
3239
3240         PR gold/12525
3241         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3242         Assert if we see DW_EH_PE_indirect.
3243         * target.h (Target::ehframe_datarel_base): New function.
3244         (Target::do_ehframe_datarel_base): New target function.
3245         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3246         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3247         function.
3248
3249 2011-07-01  Ian Lance Taylor  <iant@google.com>
3250
3251         PR gold/12571
3252         * options.h (class General_options): Add
3253         --ld-generated-unwind-info.
3254         * ehframe.cc (Fde::write): Add address parameter.  Change all
3255         callers.  If associated with PLT, fill in address and size.
3256         (Cie::set_output_offset): Only add merge mapping if there is an
3257         object.
3258         (Cie::write): Add address parameter.  Change all callers.
3259         (Eh_frame::add_ehframe_for_plt): New function.
3260         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3261         input_offset_ fields into union u_, with new plt field.
3262         (Fde::Fde): Adjust for new union field.
3263         (Fde::Fde) [Output_data version]: New constructor.
3264         (Fde::add_mapping): Only add merge mapping if there is an object.
3265         (class Cie): Update declarations.
3266         (class Eh_frame): Declare add_ehframe_for_plt.
3267         * layout.cc (Layout::layout_eh_frame): Break out code into
3268         make_eh_frame_section, and call it.
3269         (Layout::make_eh_frame_section): New function.
3270         (Layout::add_eh_frame_for_plt): New function.
3271         * layout.h (class Layout): Update declarations.
3272         * merge.cc (Merge_map::add_mapping): Add assertion.
3273         * i386.cc: Include "dwarf.h".
3274         (class Output_data_plt_i386): Make first_plt_entry,
3275         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3276         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3277         and plt_eh_frame_fde.
3278         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3279         boundary.  Call add_eh_frame_for_plt if appropriate.
3280         * x86_64.cc: Include "dwarf.h".
3281         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3282         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3283         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3284         and plt_eh_frame_fde.
3285         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3286         appropriate.
3287
3288 2011-06-29  Ian Lance Taylor  <iant@google.com>
3289
3290         PR gold/12629
3291         * object.cc (Sized_relobj_file::layout_section): Change shdr
3292         parameter to be const.
3293         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3294         out of do_layout.
3295         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3296         appropriate.  Call layout_eh_frame_section.
3297         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3298         sections.
3299         * object.h (class Sized_relobj_file): Update declarations.
3300
3301 2011-06-29  Ian Lance Taylor  <iant@google.com>
3302
3303         PR gold/12652
3304         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3305         modifier.
3306         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3307
3308 2011-06-29  Ian Lance Taylor  <iant@google.com>
3309
3310         PR gold/12675
3311         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3312         SHT_X86_64_UNWIND.
3313         * layout.cc (Layout::layout_eh_frame): Likewise.
3314
3315 2011-06-29  Ian Lance Taylor  <iant@google.com>
3316
3317         PR gold/12695
3318         * layout.cc (Layout::symtab_section_shndx): New function.
3319         * layout.h (class Layout): Declare symtab_section_shndx.
3320         * output.cc (Output_section::write_header): Call it.
3321
3322 2011-06-29  Ian Lance Taylor  <iant@google.com>
3323
3324         PR gold/12818
3325         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3326         symbols which are not used in a relocation.
3327
3328 2011-06-28  Ian Lance Taylor  <iant@google.com>
3329
3330         PR gold/12898
3331         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3332         script create indistinguishable segments.
3333         (Layout::set_segment_offsets): Use stable_sort when sorting
3334         segments.  Pass this to Compare_segments constructor.
3335         * layout.h (class Layout): Make segment_precedes non-static.
3336         (class Compare_segments): Change from struct to class.  Add
3337         layout_ field.  Add constructor.
3338         * script-sections.cc
3339         (Script_sections::attach_sections_using_phdrs_clause): Rename
3340         local orphan to is_orphan.  Don't report failure to put empty
3341         section in segment.  On attachment failure, report name of
3342         section, and attach to first PT_LOAD segment.
3343
3344 2011-06-28  Ian Lance Taylor  <iant@google.com>
3345
3346         PR gold/12934
3347         * target-select.cc (Target_selector::Target_selector): Add
3348         emulation parameter.  Change all callers.
3349         (select_target_by_bfd_name): Rename from select_target_by_name.
3350         Change all callers.
3351         (select_target_by_emulation): New function.
3352         (supported_emulation_names): New function.
3353         * target-select.h (class Target_selector): Add emulation_ field.
3354         Update declarations.
3355         (Target_selector::recognize_by_bfd_name): Rename from
3356         recognize_by_name.  Change all callers.
3357         (Target_selector::supported_bfd_names): Rename from
3358         supported_names.  Change all callers.
3359         (Target_selector::recognize_by_emulation): New function.
3360         (Target_selector::supported_emulations): New function.
3361         (Target_selector::emulation): New function.
3362         (Target_selector::do_recognize_by_bfd_name): Rename from
3363         do_recognize_by_name.  Change all callers.
3364         (Target_selector::do_supported_bfd_names): Rename from
3365         do_supported_names.  Change all callers.
3366         (Target_selector::do_recognize_by_emulation): New function.
3367         (Target_selector::do_supported_emulations): New function.
3368         (select_target_by_bfd_name): Change name in declaration.
3369         (select_target_by_emulation): Declare.
3370         (supported_emulation_names): Declare.
3371         * parameters.cc (parameters_force_valid_target): Try to find
3372         target based on emulation from -m option.
3373         * options.h (class General_options): Change doc string for -m.
3374         * options.cc (help): Print emulations.
3375         (General_options::parse_V): Likewise.
3376         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3377         Add emulation parameter.  Change all callers.
3378
3379 2011-06-28  Ian Lance Taylor  <iant@google.com>
3380
3381         * target.h (class Target): Add osabi_ field.
3382         (Target::osabi): New function.
3383         (Target::set_osabi): New function.
3384         (Target::Target): Initialize osabi_.
3385         (Target::do_adjust_elf_header): Make pure virtual.
3386         (Sized_target::do_adjust_elf_header): Declare.
3387         * target.cc (Sized_target::do_adjust_elf_header): New function.
3388         (class Sized_target): Instantiate all versions.
3389         * freebsd.h (class Target_freebsd): Remove.
3390         (Target_selector_freebsd::do_recognize): Call set_osabi on
3391         Target.
3392         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3393         (Target_selector_freebsd::set_osabi): Remove.
3394         * i386.cc (class Target_i386): Inherit from Sized_target rather
3395         than Target_freebsd.
3396         * x86_64.cc (class Target_x86_64): Likewise.
3397
3398 2011-06-28  Ian Lance Taylor  <iant@google.com>
3399
3400         * target.h (Target::can_check_for_function_pointers): Rewrite.
3401         Make non-virtual.
3402         (Target::can_icf_inline_merge_sections): Likewise.
3403         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3404         (Target::Target_info): Add can_icf_inline_merge_sections field.
3405         (Target::do_can_check_for_function_pointers): New virtual
3406         function.
3407         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3408         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3409         from can_check_for_function_pointers, move in file.
3410         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3411         section_may_have_icf_unsafe_poineters, move in file.
3412         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3413         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3414         Rename from can_check_for_function_pointers, move in file.
3415         (Target_i386::can_icf_inline_merge_sections): Remove.
3416         (Target_i386::i386_info): Initialize
3417         can_icf_inline_merge_sections.
3418         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3419         Initialize can_icf_inline_merge_sections.
3420         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3421         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3422         Rename from can_check_for_function_pointers, move in file.
3423         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3424         (Target_x86_64::x86_64_info): Initialize
3425         can_icf_inline_merge_sections.
3426         * testsuite/testfile.cc (Target_test::test_target_info):
3427         Likewise.
3428         * icf.cc (get_section_contents): Correct formatting.
3429
3430 2011-06-27  Ian Lance Taylor  <iant@google.com>
3431
3432         * symtab.cc (Symbol::versioned_name): New function.
3433         (Symbol_table::add_to_final_symtab): Use versioned_name when
3434         appropriate.
3435         (Symbol_table::sized_write_symbol): Likewise.
3436         * symtab.h (class Symbol): Declare versioned_name.
3437         * stringpool.h (class Stringpool_template): Add variant of add
3438         which takes a std::basic_string.
3439         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3440         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3441         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3442         (ver_test_12.o): New target.
3443         * testsuite/Makefile.in: Rebuild.
3444
3445 2011-06-27  Doug Kwan  <dougkwan@google.com>
3446
3447         * arm.cc (Arm_relocate_functions::thm_jump8,
3448         Arm_relocate_functions::thm_jump11): Use a wider signed
3449         type to compute offset.
3450         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3451         arm_thm_jump8.
3452         * testsuite/Makefile.in: Regenerate.
3453         * testsuite/arm_branch_in_range.sh: Check test results of
3454         arm_thm_jump11 and arm_thm_jump8.
3455         * testsuite/arm_thm_jump11.s: New test source file.
3456         * testsuite/arm_thm_jump11.t: New linker script.
3457         * testsuite/arm_thm_jump8.s: New test source file.
3458         * testsuite/arm_thm_jump8.t: New linker script.
3459
3460 2011-06-24  Ian Lance Taylor  <iant@google.com>
3461
3462         * layout.cc: Include "object.h".
3463         (ctors_sections_in_init_array): New static variable.
3464         (Layout::is_ctors_in_init_array): New function.
3465         (Layout::layout): Add entry to ctors_sections_in_init_array if
3466         appropriate.
3467         * layout.h (class Layout): Declare is_ctors_in_init_array.
3468         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3469         is_ctors_reverse_view is set.
3470         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3471         all callers.  Set is_ctors_reverse_view field of View_size.
3472         (Sized_relobj_file::reverse_words): New function.
3473         * object.h (Sized_relobj_file::View_size): Add
3474         is_ctors_reverse_view field.
3475         (class Sized_relobj_file): Update declarations.
3476         * testsuite/initpri3.c: New test.
3477         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3478         initpri3b.
3479         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3480         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3481         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3482         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3483         * testsuite/Makefile.in: Rebuild.
3484
3485 2011-06-24  Cary Coutant  <ccoutant@google.com>
3486
3487         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3488         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3489         (debug_msg_cdebug.err): New targets.
3490         * testsuite/Makefile.in: Regenerate.
3491         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3492         Fix checks for link with shared library.
3493
3494 2011-06-24  Doug Kwan  <dougkwan@google.com>
3495
3496         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3497         skip empty text sections.
3498         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3499
3500 2011-06-22  Ian Lance Taylor  <iant@google.com>
3501
3502         PR gold/12910
3503         * options.h (class General_options): Add --ctors-in-init-array.
3504         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3505         friends as SHT_PROGBITS for merging sections.
3506         (Layout::layout): Remove special handling of .init_array and
3507         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3508         and .dtors if ctors_in_init_array.
3509         (Layout::make_output_section): Force correct section types for
3510         .init_array and friends.  Don't sort if doing relocatable link,
3511         Don't sort .ctors and .dtors if ctors_in_init_array.
3512         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3513         (Layout::output_section_name): Add relobj parameter.  Change all
3514         callers.  Handle .ctors. and .dtors. in code rather than table.
3515         Handle .ctors and .dtors if ctors_in_init_array.
3516         (Layout::match_file_name): New function, moved from output.cc.
3517         * layout.h (class Layout): Update declarations.
3518         * output.cc: Include "layout.h".
3519         (Input_section_sort_entry::get_priority): New function.
3520         (Input_section_sort_entry::match_file_name): Just call
3521         Layout::match_file_name.
3522         (Output_section::Input_section_sort_init_fini_compare::operator()):
3523         Handle .ctors and .dtors.  Sort by explicit priority rather than
3524         by name.
3525         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3526         * testsuite/initpri2.c: New test.
3527         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3528         (check_PROGRAMS): Add initpri2.
3529         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3530         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3531         * configure, testsuite/Makefile.in: Rebuild.
3532
3533 2011-06-19  Ian Lance Taylor  <iant@google.com>
3534
3535         PR gold/12880
3536         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3537         .interp section to a PT_INTERP segment even if we have seen a
3538         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3539         clause in a linker script.
3540         (Layout::finalize): Don't create a .interp section if we've
3541         already create a PT_INTERP segment.
3542         (Layout::create_interp): Always call choose_output_section (revert
3543         patch of 2011-06-17).  Don't create PT_INTERP segment.
3544         * script-sections.cc
3545         (Script_sections::create_note_and_tls_segments): Add a .interp
3546         section to a PT_INTERP segment even if we have seen a
3547         --dynamic-linker option.
3548
3549 2011-06-18  Ian Lance Taylor  <iant@google.com>
3550
3551         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3552         merely because a non-PT_LOAD segment has a dynamic reloc.
3553
3554 2011-06-18  Ian Lance Taylor  <iant@google.com>
3555
3556         * layout.cc (Layout::finish_dynamic_section): Don't create
3557         DT_FLAGS entry if not needed.
3558
3559 2011-06-18  Ian Lance Taylor  <iant@google.com>
3560
3561         PR gold/12745
3562         * layout.cc (Layout::layout_eh_frame): Correct handling of
3563         writable .eh_frame section.
3564
3565 2011-06-17  Ian Lance Taylor  <iant@google.com>
3566
3567         PR gold/12893
3568         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3569         symbol is redefined with the exact same object and value.
3570
3571 2011-06-17  Ian Lance Taylor  <iant@google.com>
3572
3573         PR gold/12880
3574         * layout.h (class Layout): Add interp_segment_ field.
3575         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3576         (Layout::attach_allocated_section_to_segment): If making shared
3577         library, put .interp section in PT_INTERP segment.
3578         (Layout::finalize): Also call create_interp if -dynamic-linker
3579         option was used.
3580         (Layout::create_interp): Assert that there is no PT_INTERP
3581         segment.  If not using a SECTIONS clause, use make_output_section.
3582         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3583         * script-sections.cc
3584         (Script_sections::create_note_and_tls_segments): If making shared
3585         library, put .interp section in PT_INTERP segment.
3586
3587 2011-06-17  Ian Lance Taylor  <iant@google.com>
3588
3589         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3590         when making a shared library.
3591
3592 2011-06-17  Ian Lance Taylor  <iant@google.com>
3593
3594         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3595         parameter.  Change all callers.  Don't issue warning about PC32
3596         against locally defined symbol.
3597
3598 2011-06-16  Ian Lance Taylor  <iant@google.com>
3599
3600         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3601         occurs in same object.
3602
3603 2011-06-14  Alan Modra  <amodra@gmail.com>
3604
3605         * po/POTFILES.in: Regenerate.
3606
3607 2011-06-09  Ian Lance Taylor  <iant@google.com>
3608
3609         * script-sections.cc
3610         (Orphan_output_section::set_section_addresses): For a relocatable
3611         link set address to 0.
3612
3613 2011-06-09  Cary Coutant  <ccoutant@google.com>
3614
3615         PR gold/12804
3616         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3617         used with --compress-debug-sections.
3618         * gold/object.cc (Sized_relobj_file::do_layout): Report
3619         uncompressed size of compressed input sections.
3620
3621 2011-06-08  Cary Coutant  <ccoutant@google.com>
3622
3623         PR gold/12804
3624         * testsuite/two_file_test_2_v1.cc: Change initialization of
3625         v2 to keep it in .data.
3626
3627 2011-06-07  Cary Coutant  <ccoutant@google.com>
3628
3629         * common.cc (Symbol_table::do_allocate_commons_list): Call
3630         gold_fallback.
3631         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3632         (Errors::fallback): New function.
3633         (gold_fallback): New function.
3634         * errors.h (Errors::fallback): New function.
3635         * gold.cc (gold_exit): Change status parameter to enum; adjust
3636         all callers.
3637         (queue_initial_tasks): Call gold_fallback.
3638         * gold.h: Include cstdlib.
3639         (Exit_status): New enum type.
3640         (gold_exit): Change status parameter to enum.
3641         (gold_fallback): New function.
3642         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3643         (Layout::create_symtab_sections): Likewise.
3644         (Layout::create_shdrs): Likewise.
3645         * main.cc (main): Adjust call to gold_exit.
3646         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3647         (Output_data_got::add_got_entry_pair): Likewise.
3648         (Output_section::add_input_section): Likewise.
3649         (Output_section::add_output_section_data): Likewise.
3650         (Output_segment::set_section_list_addresses): Likewise.
3651         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3652
3653 2011-06-07  Cary Coutant  <ccoutant@google.com>
3654
3655         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3656         for incremental links.
3657         * output.cc (Output_segment::set_section_list_addresses): Remove
3658         FIXME and test for TLS or BSS.
3659
3660 2011-06-07  Cary Coutant  <ccoutant@google.com>
3661
3662         * testsuite/Makefile.am: Add incremental_copy_test,
3663         incremental_common_test_1.
3664         * testsuite/Makefile.in: Regenerate.
3665         * testsuite/common_test_1_v1.c: New source file.
3666         * testsuite/common_test_1_v2.c: New source file.
3667         * testsuite/copy_test_v1.cc: New source file.
3668
3669 2011-06-07  Cary Coutant  <ccoutant@google.com>
3670
3671         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3672         update, allocate common from bss section's free list.
3673         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3674         linker-defined symbols.
3675         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3676         Skip GOT and PLT entries that are no longer referenced.
3677         (Output_section_incremental_inputs::write_info_blocks): Mark
3678         linker-defined symbols.
3679         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3680         * output.cc (Output_section::allocate): New function.
3681         * output.h (Output_section::allocate): New function.
3682         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3683         linker-defined symbols.
3684         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3685         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3686         (Symbol::init_base_output_data): Likewise.
3687         (Symbol::init_base_output_segment): Likewise.
3688         (Symbol::init_base_constant): Likewise.
3689         (Sized_symbol::init_output_data): Likewise.
3690         (Sized_symbol::init_output_segment): Likewise.
3691         (Sized_symbol::init_constant): Likewise.
3692         (Symbol_table::do_define_in_output_data): Likewise.
3693         (Symbol_table::do_define_in_output_segment): Likewise.
3694         (Symbol_table::do_define_as_constant): Likewise.
3695         * symtab.h (Symbol::is_predefined): New function.
3696         (Symbol::init_base_output_data): Add is_predefined parameter.
3697         (Symbol::init_base_output_segment): Likewise.
3698         (Symbol::init_base_constant): Likewise.
3699         (Symbol::is_predefined_): New data member.
3700         (Sized_symbol::init_output_data): Add is_predefined parameter.
3701         (Sized_symbol::init_output_segment): Likewise.
3702         (Sized_symbol::init_constant): Likewise.
3703         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3704
3705 2011-06-07  Cary Coutant  <ccoutant@google.com>
3706
3707         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3708         instead of emit_copy_reloc.
3709         (Copy_relocs::emit_copy_reloc): Refactor.
3710         (Copy_relocs::make_copy_reloc): New function.
3711         (Copy_relocs::add_copy_reloc): Remove.
3712         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3713         section.
3714         (Copy_relocs::make_copy_reloc): New function.
3715         (Copy_relocs::add_copy_reloc): Remove.
3716         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3717         unchanged input files.
3718         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3719         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3720         Reserve BSS space for COPY relocations.
3721         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3722         (Output_section_incremental_inputs::write_info_blocks): Record
3723         whether a symbol is copied from a shared object.
3724         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3725         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3726         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3727         (Incremental_input_entry_reader::get_output_symbol_index): Add
3728         is_copy parameter.
3729         (Incremental_binary::emit_copy_relocs): New function.
3730         (Incremental_binary::do_emit_copy_relocs): New function.
3731         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3732         new data member.
3733         (Sized_incremental_binary::add_copy_reloc): New function.
3734         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3735         (Sized_incremental_binary::Copy_reloc): New struct.
3736         (Sized_incremental_binary::Copy_relocs): New typedef.
3737         (Sized_incremental_binary::copy_relocs_): New data member.
3738         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3739         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3740         * target.h (Sized_target::emit_copy_reloc): New function.
3741         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3742
3743 2011-06-02  Cary Coutant  <ccoutant@google.com>
3744
3745         PR gold/12163
3746         * gold/archive.cc (Archive::Archive): Initialize new data member.
3747         (Archive::include_all_members): Return if archive has already been
3748         included.
3749         * gold/archive.h (Archive::include_all_members_): New data member.
3750
3751 2011-06-02  Nick Clifton  <nickc@redhat.com>
3752
3753         * dynobj.h: Fix spelling mistake in comment.
3754         * output.cc: Likewise.
3755
3756 2011-05-31  Doug Kwan  <dougkwan@google.com>
3757             Asier Llano
3758
3759         PR gold/12826
3760         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3761         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3762         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3763         redundant arm_exidx_test.so.
3764         * testsuite/Makefile.in: Regenerate.
3765         (check_SCRIPTS): Add pr12826.sh
3766         (check_DATA): Add pr12826.stdout
3767         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3768         * testsuite/pr12826.sh: New file.
3769         * testsuite/pr12826_1.s: Ditto.
3770         * testsuite/pr12826_1.s: Ditto.
3771
3772 2011-05-30  Ian Lance Taylor  <iant@google.com>
3773
3774         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3775         sections.
3776
3777 2011-05-29  Ian Lance Taylor  <iant@google.com>
3778
3779         PR gold/12804
3780         * testsuite/Makefile.am: Use different file name for two_file_test
3781         temporary file for each incremental test.
3782         * testsuite/Makefile.in: Rebuild.
3783
3784 2011-05-29  Ian Lance Taylor  <iant@google.com>
3785
3786         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3787         binary input file is empty.
3788
3789 2011-05-27  Ian Lance Taylor  <iant@google.com>
3790
3791         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3792         (ver_test_9.so): Likewise.
3793         * testsuite/Makefile.in: Rebuild.
3794
3795 2011-05-26 Cary Coutant  <ccoutant@google.com>
3796
3797         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3798         * incremental.cc (Incremental_inputs::report_input_section): Fix
3799         comment, indentation.
3800         (Incremental_inputs::report_comdat_group): New function.
3801         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3802         of data for incremental input file entry.
3803         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3804         group count, COMDAT group signatures.
3805         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3806         an unchanged input file.
3807         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3808         Initialize new data member.
3809         (Incremental_object_entry::add_comdat_group): New function.
3810         (Incremental_object_entry::get_comdat_group_count): New function.
3811         (Incremental_object_entry::get_comdat_signature_key): New function.
3812         (Incremental_object_entry::groups_): New data member.
3813         (Incremental_inputs::report_comdat_group): New function.
3814         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3815         data for incremental input file entry.
3816         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3817         (Incremental_input_entry_reader::get_input_section): Adjust size of
3818         data for incremental input file entry.
3819         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3820         (Incremental_input_entry_reader::get_comdat_group_signature): New
3821         function.
3822         * object.cc (Sized_relobj::include_section_group): Report kept
3823         COMDAT groups for incremental links.
3824
3825 2011-05-24  David Meyer  <pdox@google.com>
3826
3827         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3828         with name parameter.  Add found_name parameter.
3829         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3830         * dirsearch.h (class Dirsearch): Update declaration.
3831
3832 2011-05-24  Ian Lance Taylor  <iant@google.com>
3833
3834         * archive.cc (Library_base::should_include_member): Pull in object
3835         from archive if it defines the entry symbol.
3836         * parameters.cc (Parameters::entry): New function.
3837         * parameters.h (class Parameters): Declare entry.
3838         * output.h (class Output_file_header): Remove entry_ field.
3839         * output.cc (Output_file_header::Output_file_header): Remove entry
3840         parameter.  Change all callers.
3841         (Output_file_header::entry): Use parameters->entry.
3842         * gold.cc (queue_middle_tasks): Likewise.
3843         * plugin.cc (Plugin_hook::run): Likewise.
3844
3845 2011-05-24 Cary Coutant  <ccoutant@google.com>
3846
3847         * gold.cc (queue_initial_tasks): Pass incremental base filename
3848         to Output_file::open_base_file; don't print error message.
3849         * incremental-dump.cc (main): Adjust call to
3850         Output_file::open_for_modification.
3851         * incremental-dump.cc (main): Likewise.
3852         * incremental.cc (Incremental_inputs::report_command_line):
3853         Ignore --incremental-base option when comparing command lines.
3854         Ignore parameter when given as separate argument.
3855         * options.h (class General_options): Add --incremental-base.
3856         * output.cc (Output_file::Output_file):
3857         (Output_file::open_base_file): Add base_name and writable parameters;
3858         read base file into new file; print error message here.
3859         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3860         callers.
3861         * output.h (Output_file::open_for_modification): Rename to...
3862         (Output_file::open_base_file): ...this; add base_name and
3863         writable parameters; adjust all callers.
3864         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3865         callers.
3866         * testsuite/Makefile.am (incremental_test_4): Test
3867         --incremental-base.
3868         * testsuite/Makefile.in: Regenerate.
3869
3870 2011-05-24 Cary Coutant  <ccoutant@google.com>
3871
3872         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3873         incremental_test_4.
3874         * testsuite/Makefile.in: Regenerate.
3875         * testsuite/two_file_test_1_v1.cc: New test source file.
3876         * testsuite/two_file_test_1b_v1.cc: New test source file.
3877         * testsuite/two_file_test_2_v1.cc: New test source file.
3878
3879 2011-05-24 Cary Coutant  <ccoutant@google.com>
3880
3881         * dynobj.h (Dynobj::do_dynobj): New function.
3882         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3883         flag and soname for shared objects.
3884         * incremental.cc (Incremental_inputs::report_object): Make
3885         either Incremental_object_entry or Incremental_dynobj_entry; add
3886         soname to string table.
3887         (Incremental_inputs::report_input_section): Add assertion.
3888         (Output_section_incremental_inputs::set_final_data_size): Adjust
3889         type of input file entry for shared libraries; adjust size of
3890         shared library info entry.
3891         (Output_section_incremental_inputs::write_input_files): Write
3892         as_needed flag for shared libraries.
3893         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3894         of input file entry for shared libraries; write soname.
3895         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3896         soname from incremental info.
3897         * incremental.h (enum Incremental_input_flags): Add
3898         INCREMENTAL_INPUT_AS_NEEDED.
3899         (Incremental_input_entry::Incremental_input_entry): Initialize new
3900         data member.
3901         (Incremental_input_entry::set_as_needed): New function.
3902         (Incremental_input_entry::as_needed): New function.
3903         (Incremental_input_entry::do_dynobj_entry): New function.
3904         (Incremental_input_entry::as_needed_): New data member.
3905         (Incremental_object_entry::Incremental_object_entry): Don't check
3906         for shared library.
3907         (Incremental_object_entry::do_type): Likewise.
3908         (class Incremental_dynobj_entry): New class.
3909         (Incremental_input_entry_reader::as_needed): New function.
3910         (Incremental_input_entry_reader::get_soname): New function.
3911         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3912         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3913         size of shared library info entry.
3914         * layout.cc (Layout::finish_dynamic_section): Don't test for
3915         incremental link when adding DT_NEEDED entries.
3916         * object.h (Object::Object): Initialize new data member.
3917         (Object::dynobj): New function.
3918         (Object::set_as_needed): New function.
3919         (Object::as_needed): New function.
3920         (Object::do_dynobj): New function.
3921         (Object::as_needed_): New data member.
3922
3923 2011-05-24 Cary Coutant  <ccoutant@google.com>
3924
3925         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3926         info; adjust display of GOT entries.
3927         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3928         vector of input objects; remove file_status_.
3929         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3930         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3931         got_plt reader; call target hooks to reserve GOT entries.
3932         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3933         of input file info header and GOT info entry.
3934         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3935         relocation info.
3936         (Got_plt_view_info::got_descriptor): Remove.
3937         (Got_plt_view_info::sym_index): New data member.
3938         (Got_plt_view_info::input_index): New data member.
3939         (Local_got_offset_visitor::visit): Write input file index.
3940         (Global_got_offset_visitor::visit): Write 0 for input file index.
3941         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3942         with sym_index and input_index.
3943         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3944         incremental info GOT entry; replace got_descriptor with input_index.
3945         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3946         map from input file index to object.
3947         (Sized_relobj_incr::do_layout): Replace direct data member reference
3948         with accessor function.
3949         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3950         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3951         Adjust size of input file info header.
3952         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3953         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3954         (Incremental_input_entry_reader::get_input_section): Adjust size of
3955         input file info header.
3956         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3957         of incremental info GOT entry.
3958         (Incremental_got_plt_reader::get_got_desc): Remove.
3959         (Incremental_got_plt_reader::get_got_symndx): New function.
3960         (Incremental_got_plt_reader::get_got_input_index): New function.
3961         (Sized_incremental_binary::Sized_incremental_binary): Remove
3962         file_status_; add input_objects_.
3963         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3964         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3965         (Sized_incremental_binary::file_is_unchanged): Remove.
3966         (Sized_incremental_binary::set_input_object): New function.
3967         (Sized_incremental_binary::input_object): New function.
3968         (Sized_incremental_binary::file_status_): Remove.
3969         (Sized_incremental_binary::input_objects_): New data member.
3970         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3971         references.
3972         (Sized_relobj_incr::invalid_address): Move to base class.
3973         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3974         class.
3975         (Sized_relobj_incr::do_output_section_offset): Likewise.
3976         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3977         (Sized_relobj_incr::section_offsets_): Likewise.
3978         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3979         function.
3980         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3981         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3982         with accessor function.
3983         (Sized_relobj_file::do_layout): Likewise.
3984         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3985         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3986         (Sized_relobj_file::compute_final_local_value): Replace refs to
3987         section_offsets_ with accessor function.
3988         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3989         * object.h (Relobj::Relobj): Initialize new data members.
3990         (Relobj::add_dyn_reloc): New function.
3991         (Relobj::first_dyn_reloc): New function.
3992         (Relobj::dyn_reloc_count): New function.
3993         (Relobj::first_dyn_reloc_): New data member.
3994         (Relobj::dyn_reloc_count_): New data member.
3995         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3996         references.
3997         (Sized_relobj::Address): New typedef.
3998         (Sized_relobj::invalid_address): Move here from child class.
3999         (Sized_relobj::Sized_relobj): Initialize new data members.
4000         (Sized_relobj::sized_relobj): New function.
4001         (Sized_relobj::is_output_section_offset_invalid): Move here from
4002         child class.
4003         (Sized_relobj::get_output_section_offset): Likewise.
4004         (Sized_relobj::local_has_got_offset): Likewise.
4005         (Sized_relobj::local_got_offset): Likewise.
4006         (Sized_relobj::set_local_got_offset): Likewise.
4007         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4008         (Sized_relobj::clear_got_offsets): New function.
4009         (Sized_relobj::section_offsets): Move here from child class.
4010         (Sized_relobj::do_output_section_offset): Likewise.
4011         (Sized_relobj::do_set_section_offset): Likewise.
4012         (Sized_relobj::Local_got_offsets): Likewise.
4013         (Sized_relobj::local_got_offsets_): Likewise.
4014         (Sized_relobj::section_offsets_): Likewise.
4015         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4016         references.
4017         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4018         class.
4019         (Sized_relobj_file::sized_relobj): New function
4020         (Sized_relobj_file::local_has_got_offset): Move to base class.
4021         (Sized_relobj_file::local_got_offset): Likewise.
4022         (Sized_relobj_file::set_local_got_offset): Likewise.
4023         (Sized_relobj_file::get_output_section_offset): Likewise.
4024         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4025         (Sized_relobj_file::do_output_section_offset): Likewise.
4026         (Sized_relobj_file::do_set_section_offset): Likewise.
4027         (Sized_relobj_file::Local_got_offsets): Likewise.
4028         (Sized_relobj_file::local_got_offsets_): Likewise.
4029         (Sized_relobj_file::section_offsets_): Likewise.
4030         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4031         (all constructors).
4032         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4033         (Output_reloc::get_symbol_index): Likewise.
4034         (Output_reloc::local_section_offset): Likewise.
4035         (Output_reloc::get_address): Likewise.
4036         (Output_reloc::symbol_value): Likewise.
4037         (Output_data_got::reserve_slot): Move to class definition.
4038         (Output_data_got::reserve_local): New function.
4039         (Output_data_got::reserve_slot_for_global): Remove.
4040         (Output_data_got::reserve_global): New function.
4041         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4042         (all constructors, two instantiations).
4043         (Output_reloc::get_relobj): New function (two instantiations).
4044         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4045         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4046         (Output_data_reloc::add_global): Adjust type of relobj.
4047         (Output_data_reloc::add_global_relative): Likewise.
4048         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4049         (Output_data_reloc::add_local): Likewise.
4050         (Output_data_reloc::add_local_relative): Likewise.
4051         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4052         (Output_data_reloc::add_local_section): Likewise.
4053         (Output_data_reloc::add_output_section): Likewise.
4054         (Output_data_reloc::add_absolute): Likewise.
4055         (Output_data_reloc::add_target_specific): Likewise.
4056         (Output_data_got::reserve_slot): Move definition here.
4057         (Output_data_got::reserve_local): New function.
4058         (Output_data_got::reserve_global): New function.
4059         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4060         section_offsets_ with accessor function.
4061         (Sized_relobj_file::write_sections): Likewise.
4062         (Sized_relobj_file::do_relocate_sections): Likewise.
4063         * target.h (Sized_target::reserve_local_got_entry): New function.
4064         (Sized_target::reserve_global_got_entry): New function.
4065         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4066         (Target_x86_64::reserve_global_got_entry): New function.
4067         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4068
4069 2011-05-23 Cary Coutant  <ccoutant@google.com>
4070
4071         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4072         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4073         bit when checking got_type.
4074         * incremental.cc (Sized_incremental_binary::setup_readers):
4075         Store symbol table and string table locations; initialize bit vector
4076         of file status flags.
4077         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4078         unchanged files.
4079         (Sized_incremental_binary::do_process_got_plt): New function.
4080         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4081         (Output_section_incremental_inputs::set_final_data_size): Record
4082         file index for each input file.
4083         (Output_section_incremental_inputs::write_got_plt): Store file index
4084         instead of input entry offset for each GOT entry.
4085         * incremental.h
4086         (Incremental_input_entry::Incremental_input_entry): Initialize new
4087         data member.
4088         (Incremental_input_entry::set_offset): Store file index.
4089         (Incremental_input_entry::get_file_index): New function.
4090         (Incremental_input_entry::file_index_): New data member.
4091         (Incremental_binary::process_got_plt): New function.
4092         (Incremental_binary::do_process_got_plt): New function.
4093         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4094         data members.
4095         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4096         (Sized_incremental_binary::set_file_is_unchanged): New function.
4097         (Sized_incremental_binary::file_is_unchanged): New function.
4098         (Sized_incremental_binary::do_process_got_plt): New function.
4099         (Sized_incremental_binary::file_status_): New data member.
4100         (Sized_incremental_binary::main_symtab_loc_): New data member.
4101         (Sized_incremental_binary::main_strtab_loc_): New data member.
4102         * output.cc (Output_data_got::Got_entry::write): Add case
4103         RESERVED_CODE.
4104         (Output_data_got::add_global): Call add_got_entry.
4105         (Output_data_got::add_global_plt): Likewise.
4106         (Output_data_got::add_global_with_rel): Likewise.
4107         (Output_data_got::add_global_with_rela): Likewise.
4108         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4109         (Output_data_got::add_global_pair_with_rela): Likewise.
4110         (Output_data_got::add_local): Call add_got_entry.
4111         (Output_data_got::add_local_plt): Likewise.
4112         (Output_data_got::add_local_with_rel): Likewise.
4113         (Output_data_got::add_local_with_rela): Likewise.
4114         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4115         (Output_data_got::add_local_pair_with_rela): Likewise.
4116         (Output_data_got::reserve_slot): New function.
4117         (Output_data_got::reserve_slot_for_global): New function.
4118         (Output_data_got::add_got_entry): New function.
4119         (Output_data_got::add_got_entry_pair): New function.
4120         (Output_section::add_output_section_data): Edit FIXME.
4121         * output.h
4122         (Output_section_data_build::Output_section_data_build): New
4123         constructor with size parameter.
4124         (Output_data_space::Output_data_space): Likewise.
4125         (Output_data_got::Output_data_got): Initialize new data member; new
4126         constructor with size parameter.
4127         (Output_data_got::add_constant): Call add_got_entry.
4128         (Output_data_got::reserve_slot): New function.
4129         (Output_data_got::reserve_slot_for_global): New function.
4130         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4131         (Output_data_got::add_got_entry): New function.
4132         (Output_data_got::add_got_entry_pair): New function.
4133         (Output_data_got::free_list_): New data member.
4134         * target.h (Sized_target::init_got_plt_for_update): New function.
4135         (Sized_target::register_global_plt_entry): New function.
4136         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4137         Initialize new data member; call init; add constructor with PLT count.
4138         (Output_data_plt_x86_64::init): New function.
4139         (Output_data_plt_x86_64::add_relocation): New function.
4140         (Output_data_plt_x86_64::reserve_slot): New function.
4141         (Output_data_plt_x86_64::free_list_): New data member.
4142         (Target_x86_64::init_got_plt_for_update): New function.
4143         (Target_x86_64::register_global_plt_entry): New function.
4144         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4145         incremental updates.
4146         (Output_data_plt_x86_64::add_relocation): New function.
4147         * testsuite/object_unittest.cc (Object_test): Set default options.
4148
4149 2011-05-16  Ian Lance Taylor  <iant@google.com>
4150
4151         * options.h (class General_options): Make -i a synonym for -r.
4152
4153 2011-05-16  Ian Lance Taylor  <iant@google.com>
4154
4155         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4156
4157 2011-05-10 Cary Coutant  <ccoutant@google.com>
4158
4159         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4160         strip_all (-s).
4161
4162 2011-05-06  Ian Lance Taylor  <iant@google.com>
4163
4164         * layout.cc (Layout::layout): If the output section flags change,
4165         update the ordering.
4166
4167 2011-04-25 Cary Coutant  <ccoutant@google.com>
4168
4169         * incremental-dump.cc (dump_incremental_inputs): Print local
4170         symbol info for each input file.
4171         * incremental.cc
4172         (Output_section_incremental_inputs::set_final_data_size): Add local
4173         symbol info to input file entries in incremental info.
4174         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4175         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4176         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4177         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4178         implementation.
4179         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4180         (Sized_incr_relobj::do_relocate): Write the local symbols.
4181         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4182         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4183         Adjust size of input file header.
4184         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4185         (Incremental_inputs_reader::get_local_symbol_count): New function.
4186         (Incremental_inputs_reader::get_input_section): Adjust size of input
4187         file header.
4188         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4189         (Sized_incr_relobj::This): New typedef.
4190         (Sized_incr_relobj::sym_size): New const data member.
4191         (Sized_incr_relobj::Local_symbol): New struct.
4192         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4193         (Sized_incr_relobj::do_local_symbol_offset): New function.
4194         (Sized_incr_relobj::local_symbol_count_): New data member.
4195         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4196         (Sized_incr_relobj::local_symbol_index_): New data member.
4197         (Sized_incr_relobj::local_symbol_offset_): New data member.
4198         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4199         (Sized_incr_relobj::local_symbols_): New data member.
4200         * object.h (Relobj::output_local_symbol_count): New function.
4201         (Relobj::local_symbol_offset): New function.
4202         (Relobj::do_output_local_symbol_count): New function.
4203         (Relobj::do_local_symbol_offset): New function.
4204         (Sized_relobj::do_output_local_symbol_count): New function.
4205         (Sized_relobj::do_local_symbol_offset): New function.
4206
4207 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4208
4209         * descriptors.cc (set_close_on_exec): New function.
4210         (Descriptors::open): Use set_close_on_exec.
4211         * output.cc (S_ISLNK): Define if not defined.
4212
4213 2011-04-22 Cary Coutant  <ccoutant@google.com>
4214
4215         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4216         global symbol map.
4217         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4218         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4219         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4220         relocations.
4221         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4222         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4223         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4224         * incremental.h
4225         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4226         function.
4227         (Incremental_binary::apply_incremental_relocs): New function.
4228         (Incremental_binary::do_apply_incremental_relocs): New function.
4229         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4230         data member.
4231         (Sized_incremental_binary::add_global_symbol): New function.
4232         (Sized_incremental_binary::global_symbol): New function.
4233         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4234         (Sized_incremental_binary::symbol_map_): New data member.
4235         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4236         * target.h (Sized_target::apply_relocation): New function.
4237         * target-reloc.h (apply_relocation): New function.
4238         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4239
4240 2011-04-22  Doug Kwan  <dougkwan@google.com>
4241
4242         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4243         flag of a SHT_ARM_EXIDX section.
4244         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4245         * testsuite/Makefile.in: Regenerate.
4246         * testsuite/arm_exidx_test.s: New file.
4247         * testsuite/arm_exidx_test.sh: Same.
4248
4249 2011-04-20 Cary Coutant  <ccoutant@google.com>
4250
4251         PR gold/12689
4252         * archive.h (Incremental_archive_entry::Archive_member):
4253         Initialize arg_serial_ (second constructor).
4254
4255 2011-04-17  Ian Lance Taylor  <iant@google.com>
4256
4257         * object.cc (Relocate_info::location): Simplify location string.
4258         * errors.cc (Errors::error_at_location): Don't print program
4259         name.
4260         (Errors::warning_at_location): Likewise.
4261         (Errors::undefined_symbol): Likewise.
4262         * testsuite/debug_msg.sh: Update accordingly.
4263
4264 2011-04-14 Cary Coutant  <ccoutant@google.com>
4265
4266         * gold/layout.cc (Layout::symtab_section_offset): New function.
4267         * gold/layout.h (Layout::symtab_section_offset): New function.
4268         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4269
4270 2011-04-12  Ian Lance Taylor  <iant@google.com>
4271
4272         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4273         with MREMAP_MAYMOVE.
4274         * output.h (class Output_file): Add map_is_allocated_ field.
4275         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4276         not available, provide stubs.  If mremap is not available, #define
4277         it to gold_mremap.
4278         (MREMAP_MAYMOVE): Define if not defined.
4279         (Output_file::Output_file): Initialize map_is_allocated_.
4280         (Output_file::resize): Check map_is_allocated_.
4281         (Output_file::map_anonymous): If mmap fails, use malloc.
4282         (Output_file::unmap): Don't do anything for an anonymous map.
4283         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4284         is not available, provide stubs.
4285         (File_read::View::~View): Use free rather than delete[].
4286         (File_read::make_view): Use malloc rather than new[].  If mmap
4287         fails, use malloc.
4288         (File_read::find_or_make_view): Use malloc rather than new[].
4289         * gold.h: Remove HAVE_REMAP code.
4290         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4291         exists.  Rename mremap to gold_mremap.  If mmap is not available
4292         don't do anything.
4293         * configure, config.in: Rebuild.
4294
4295 2011-04-11  Ian Lance Taylor  <iant@google.com>
4296
4297         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4298         initialize local variable v.
4299
4300 2011-04-11  Cary Coutant  <ccoutant@google.com>
4301
4302         * archive.cc (Archive::include_member): Adjust call to
4303         report_object.
4304         (Add_archive_symbols::run): Track argument serial numbers.
4305         (Lib_group::include_member): Likewise.
4306         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4307         * archive.h (Incremental_archive_entry::Archive_member):
4308         Initialize arg_serial_.
4309         (Archive_member::arg_serial_): New data member.
4310         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4311         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4312         incremental link.
4313         (Sized_dynobj::do_for_all_local_got_entries): New function.
4314         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4315         function.
4316         * fileread.cc (get_mtime): New function.
4317         * fileread.h (get_mtime): New function.
4318         * gold.cc (queue_initial_tasks): Check for incremental update.
4319         (process_incremental_input): New function.
4320         (queue_middle_tasks): Don't force valid target for incremental
4321         update.
4322         * incremental-dump.cc (find_input_containing_global): Adjust
4323         size of symbol info entry.
4324         (dump_incremental_inputs): Dump argument serial number and
4325         in_system_directory flag; bias shndx by 1; print symbol names
4326         when dumping per-file symbol lists; use new symbol info readers.
4327         * incremental.cc
4328         (Output_section_incremental_inputs:update_data_size): New function.
4329         (Sized_incremental_binary::setup_readers): Setup input readers
4330         for each input file; build maps for files added from libraries
4331         and scripts.
4332         (Sized_incremental_binary::check_input_args): New function.
4333         (Sized_incremental_binary::do_check_inputs): Build map of argument
4334         serial numbers to input arguments.
4335         (Sized_incremental_binary::do_file_has_changed): Rename
4336         do_file_is_unchanged to this; compare file modification times.
4337         (Sized_incremental_binary::do_init_layout): New function.
4338         (Sized_incremental_binary::do_reserve_layout): New function.
4339         (Sized_incremental_binary::do_get_input_reader): Remove.
4340         (Sized_incremental_binary::get_symtab_view): New function.
4341         (Incremental_checker::can_incrementally_link_output_file): Remove.
4342         (Incremental_inputs::report_command_line): Exclude --debug options.
4343         (Incremental_inputs::report_archive_begin): Add parameter; track
4344         argument serial numbers; don't put input file entry for archive
4345         before archive members.
4346         (Incremental_inputs::report_archive_end): Put input file entry
4347         for archive after archive members.
4348         (Incremental_inputs::report_object): Add parameter; track argument
4349         serial numbers and in_system_directory flag.
4350         (Incremental_inputs::report_script): Add parameter; track argument
4351         serial numbers.
4352         (Output_section_incremental_inputs::set_final_data_size): Adjust
4353         size of symbol info entry; check for forwarding symbols.
4354         (Output_section_incremental_inputs::write_input_files): Write
4355         in_system_directory flag and argument serial number.
4356         (Output_section_incremental_inputs::write_info_blocks): Map section
4357         indices between incremental info and original input file; store
4358         input section index for each symbol.
4359         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4360         change operator() to visit().
4361         (class Global_got_offset_visitor): Likewise.
4362         (class Global_symbol_visitor_got_plt):
4363         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4364         classes.
4365         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4366         (Sized_incr_relobj::do_read_symbols): New function.
4367         (Sized_incr_relobj::do_layout): New function.
4368         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4369         (Sized_incr_relobj::do_add_symbols): New function.
4370         (Sized_incr_relobj::do_should_include_member): New function.
4371         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4372         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4373         (Sized_incr_relobj::do_section_size): New function.
4374         (Sized_incr_relobj::do_section_name): New function.
4375         (Sized_incr_relobj::do_section_contents): New function.
4376         (Sized_incr_relobj::do_section_flags): New function.
4377         (Sized_incr_relobj::do_section_entsize): New function.
4378         (Sized_incr_relobj::do_section_address): New function.
4379         (Sized_incr_relobj::do_section_type): New function.
4380         (Sized_incr_relobj::do_section_link): New function.
4381         (Sized_incr_relobj::do_section_info): New function.
4382         (Sized_incr_relobj::do_section_addralign): New function.
4383         (Sized_incr_relobj::do_initialize_xindex): New function.
4384         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4385         (Sized_incr_relobj::do_read_relocs): New function.
4386         (Sized_incr_relobj::do_gc_process_relocs): New function.
4387         (Sized_incr_relobj::do_scan_relocs): New function.
4388         (Sized_incr_relobj::do_count_local_symbols): New function.
4389         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4390         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4391         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4392         (Sized_incr_relobj::do_relocate): New function.
4393         (Sized_incr_relobj::do_set_section_offset): New function.
4394         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4395         (Sized_incr_dynobj::do_read_symbols): New function.
4396         (Sized_incr_dynobj::do_layout): New function.
4397         (Sized_incr_dynobj::do_add_symbols): New function.
4398         (Sized_incr_dynobj::do_should_include_member): New function.
4399         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4400         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4401         (Sized_incr_dynobj::do_section_size): New function.
4402         (Sized_incr_dynobj::do_section_name): New function.
4403         (Sized_incr_dynobj::do_section_contents): New function.
4404         (Sized_incr_dynobj::do_section_flags): New function.
4405         (Sized_incr_dynobj::do_section_entsize): New function.
4406         (Sized_incr_dynobj::do_section_address): New function.
4407         (Sized_incr_dynobj::do_section_type): New function.
4408         (Sized_incr_dynobj::do_section_link): New function.
4409         (Sized_incr_dynobj::do_section_info): New function.
4410         (Sized_incr_dynobj::do_section_addralign): New function.
4411         (Sized_incr_dynobj::do_initialize_xindex): New function.
4412         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4413         (make_sized_incremental_object): New function.
4414         (Incremental_library::copy_unused_symbols): New function.
4415         (Incremental_library::do_for_all_unused_symbols): New function.
4416         * incremental.h (enum Incremental_input_flags): New type.
4417         (class Incremental_checker): Remove.
4418         (Incremental_input_entry::Incremental_input_entry): Add argument
4419         serial number.
4420         (Incremental_input_entry::arg_serial): New function.
4421         (Incremental_input_entry::set_is_in_system_directory): New function.
4422         (Incremental_input_entry::is_in_system_directory): New function.
4423         (Incremental_input_entry::arg_serial_): New data member.
4424         (Incremental_input_entry::is_in_system_directory_): New data member.
4425         (class Script_info): Move here from script.h.
4426         (Script_info::Script_info): Add filename parameter.
4427         (Script_info::filename): New function.
4428         (Script_info::filename_): New data member.
4429         (Incremental_script_entry::Incremental_script_entry): Add argument
4430         serial number.
4431         (Incremental_object_entry::Incremental_object_entry): Likewise.
4432         (Incremental_object_entry::add_input_section): Build list of input
4433         sections with map to original shndx.
4434         (Incremental_object_entry::get_input_section_index): New function.
4435         (Incremental_object_entry::shndx_): New data member.
4436         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4437         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4438         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4439         serial number.
4440         (Incremental_inputs::report_archive_begin): Likewise.
4441         (Incremental_inputs::report_object): Likewise.
4442         (Incremental_inputs::report_script): Likewise.
4443         (class Incremental_global_symbol_reader): New class.
4444         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4445         and store flags and input file type.
4446         (Incremental_input_entry_reader::arg_serial): New function.
4447         (Incremental_input_entry_reader::type): Extract type from flags.
4448         (Incremental_input_entry_reader::is_in_system_directory): New function.
4449         (Incremental_input_entry_reader::get_input_section_count): Call
4450         accessor function for type.
4451         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4452         function for type; adjust size of global symbol entry.
4453         (Incremental_input_entry_reader::get_global_symbol_count): Call
4454         accessor function for type.
4455         (Incremental_input_entry_reader::get_object_count): Likewise.
4456         (Incremental_input_entry_reader::get_object_offset): Likewise.
4457         (Incremental_input_entry_reader::get_member_count): Likewise.
4458         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4459         (Incremental_input_entry_reader::get_member_offset): Likewise.
4460         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4461         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4462         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4463         (Incremental_input_entry_reader::get_global_symbol_reader): New
4464         function.
4465         (Incremental_input_entry_reader::get_output_symbol_index): New
4466         function.
4467         (Incremental_input_entry_reader::type_): Remove.
4468         (Incremental_input_entry_reader::flags_): New data member.
4469         (Incremental_inputs_reader::input_file_offset): New function.
4470         (Incremental_inputs_reader::input_file_index): New function.
4471         (Incremental_inputs_reader::input_file): Call input_file_offset.
4472         (Incremental_inputs_reader::input_file_at_offset): New function.
4473         (Incremental_relocs_reader::get_r_type): Reformat.
4474         (Incremental_relocs_reader::get_r_shndx): Reformat.
4475         (Incremental_relocs_reader::get_r_offset): Reformat.
4476         (Incremental_relocs_reader::data): New function.
4477         (Incremental_binary::Incremental_binary): Initialize new data members.
4478         (Incremental_binary::check_inputs): Add cmdline parameter.
4479         (Incremental_binary::file_is_unchanged): Remove.
4480         (Input_reader::arg_serial): New function.
4481         (Input_reader::get_unused_symbol_count): New function.
4482         (Input_reader::get_unused_symbol): New function.
4483         (Input_reader::do_arg_serial): New function.
4484         (Input_reader::do_get_unused_symbol_count): New function.
4485         (Input_reader::do_get_unused_symbol): New function.
4486         (Incremental_binary::input_file_count): New function.
4487         (Incremental_binary::get_input_reader): Change signature to use
4488         index instead of filename.
4489         (Incremental_binary::file_has_changed): New function.
4490         (Incremental_binary::get_input_argument): New function.
4491         (Incremental_binary::get_library): New function.
4492         (Incremental_binary::get_script_info): New function.
4493         (Incremental_binary::init_layout): New function.
4494         (Incremental_binary::reserve_layout): New function.
4495         (Incremental_binary::output_file): New function.
4496         (Incremental_binary::do_check_inputs): New function.
4497         (Incremental_binary::do_file_is_unchanged): Remove.
4498         (Incremental_binary::do_file_has_changed): New function.
4499         (Incremental_binary::do_init_layout): New function.
4500         (Incremental_binary::do_reserve_layout): New function.
4501         (Incremental_binary::do_input_file_count): New function.
4502         (Incremental_binary::do_get_input_reader): Change signature.
4503         (Incremental_binary::input_args_map_): New data member.
4504         (Incremental_binary::library_map_): New data member.
4505         (Incremental_binary::script_map_): New data member.
4506         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4507         new data members.
4508         (Sized_incremental_binary::output_section): New function.
4509         (Sized_incremental_binary::inputs_reader): Add const.
4510         (Sized_incremental_binary::symtab_reader): Add const.
4511         (Sized_incremental_binary::relocs_reader): Add const.
4512         (Sized_incremental_binary::got_plt_reader): Add const.
4513         (Sized_incremental_binary::get_symtab_view): New function.
4514         (Sized_incremental_binary::Inputs_reader): New typedef.
4515         (Sized_incremental_binary::Input_entry_reader): New typedef.
4516         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4517         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4518         (Sized_incremental_binary::do_file_has_changed): New function.
4519         (Sized_incremental_binary::do_init_layout): New function.
4520         (Sized_incremental_binary::do_reserve_layout): New function.
4521         (Sized_input_reader::Inputs_reader): Remove.
4522         (Sized_input_reader::Input_entry_reader): Remove.
4523         (Sized_input_reader::do_arg_serial): New function.
4524         (Sized_input_reader::do_get_unused_symbol_count): New function.
4525         (Sized_input_reader::do_get_unused_symbol): New function.
4526         (Sized_incremental_binary::do_input_file_count): New function.
4527         (Sized_incremental_binary::do_get_input_reader): Change signature;
4528         use index instead of filename.
4529         (Sized_incremental_binary::section_map_): New data member.
4530         (Sized_incremental_binary::input_entry_readers_): New data member.
4531         (class Sized_incr_relobj): New class.
4532         (class Sized_incr_dynobj): New class.
4533         (make_sized_incremental_object): New function.
4534         (class Incremental_library): New class.
4535         * layout.cc (Free_list::num_lists): New static data member.
4536         (Free_list::num_nodes): New static data member.
4537         (Free_list::num_removes): New static data member.
4538         (Free_list::num_remove_visits): New static data member.
4539         (Free_list::num_allocates): New static data member.
4540         (Free_list::num_allocate_visits): New static data member.
4541         (Free_list::init): New function.
4542         (Free_list::remove): New function.
4543         (Free_list::allocate): New function.
4544         (Free_list::dump): New function.
4545         (Free_list::print_stats): New function.
4546         (Layout_task_runner::run): Resize output file for incremental updates.
4547         (Layout::Layout): Initialize new data members.
4548         (Layout::set_incremental_base): New function.
4549         (Layout::init_fixed_output_section): New function.
4550         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4551         incremental updates.
4552         (Layout::create_gold_note): Do not create gold note section for
4553         incremental updates.
4554         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4555         for incremental updates.
4556         (Layout::set_section_offsets): For incremental updates, allocate space
4557         from free list.
4558         (Layout::create_symtab_sections): Layout with offsets relative to
4559         start of section; for incremental updates, allocate space from free
4560         list.
4561         (Layout::create_shdrs): For incremental updates, allocate space from
4562         free list.
4563         (Layout::finish_dynamic_section): For incremental updates, do not
4564         check --as-needed (fixed in subsequent patch).
4565         * layout.h (class Free_list): New class.
4566         (Layout::set_incremental_base): New function.
4567         (Layout::incremental_base): New function.
4568         (Layout::init_fixed_output_section): New function.
4569         (Layout::allocate): New function.
4570         (Layout::incremental_base_): New data member.
4571         (Layout::free_list_): New data member.
4572         * main.cc (main): Print Free_list statistics.
4573         * object.cc (Relobj::finalize_incremental_relocs): Add
4574         clear_counts parameter; clear counts only when clear_counts is set.
4575         (Sized_relobj::Sized_relobj): Initialize new base class.
4576         (Sized_relobj::do_layout): Don't report special sections.
4577         (Sized_relobj::do_for_all_local_got_entries): New function.
4578         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4579         symtab_off to all symbol table offsets.
4580         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4581         * object.h (class Got_offset_list): Move to top of file.
4582         (Object::Object): Allow case where input_file == NULL.
4583         (Object::~Object): Likewise.
4584         (Object::input_file): Assert that input_file != NULL.
4585         (Object::lock): Allow case where input_file == NULL.
4586         (Object::unlock): Likewise.
4587         (Object::is_locked): Likewise.
4588         (Object::token): Likewise.
4589         (Object::release): Likewise.
4590         (Object::is_incremental): New function.
4591         (Object::get_mtime): New function.
4592         (Object::for_all_local_got_entries): New function.
4593         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4594         (Object::set_is_in_system_directory): New function.
4595         (Object::is_in_system_directory): New function.
4596         (Object::do_is_incremental): New function.
4597         (Object::do_get_mtime): New function.
4598         (Object::do_for_all_local_got_entries): New function.
4599         (Object::is_in_system_directory_): New data member.
4600         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4601         (class Sized_relobj_base): New class.
4602         (class Sized_relobj): Derive from Sized_relobj_base.
4603         (class Sized_relobj::Symbols): Redeclare from base class.
4604         (class Sized_relobj::local_got_offset_list): Remove.
4605         (class Sized_relobj::Output_sections): Redeclare from base class.
4606         (class Sized_relobj::do_for_all_local_got_entries): New function.
4607         (class Sized_relobj::write_local_symbols): Add offset parameter.
4608         (class Sized_relobj::local_symbol_offset_): Update comment.
4609         (class Sized_relobj::local_dynsym_offset_): Update comment.
4610         * options.cc (Input_arguments::add_file): Remove const.
4611         * options.h (Input_file_argument::Input_file_argument):
4612         Initialize arg_serial_ (all constructors).
4613         (Input_file_argument::set_arg_serial): New function.
4614         (Input_file_argument::arg_serial): New function.
4615         (Input_file_argument::arg_serial_): New data member.
4616         (Input_arguments::Input_arguments): Initialize file_count_.
4617         (Input_arguments::add_file): Remove const.
4618         (Input_arguments::number_of_input_files): New function.
4619         (Input_arguments::file_count_): New data member.
4620         (Command_line::number_of_input_files): Call
4621         Input_arguments::number_of_input_files.
4622         * output.cc (Output_segment_headers::Output_segment_headers):
4623         Set current size.
4624         (Output_section::Input_section::current_data_size): New function.
4625         (Output_section::Output_section): Initialize new data members.
4626         (Output_section::add_input_section): Don't do merge sections for
4627         an incremental link; allocate space from free list for an
4628         incremental update.
4629         (Output_section::add_output_section_data): Allocate space from
4630         free list for an incremental update.
4631         (Output_section::update_data_size): New function.
4632         (Output_section::set_fixed_layout): New function.
4633         (Output_section::reserve): New function.
4634         (Output_segment::set_section_addresses): Remove const.
4635         (Output_segment::set_section_list_addresses): Remove const; allocate
4636         space from free list for an incremental update.
4637         (Output_segment::set_offset): Adjust size of RELRO segment for an
4638         incremental update.
4639         * output.h (Output_data::current_data_size): Move here from
4640         child classes.
4641         (Output_data::pre_finalize_data_size): New function.
4642         (Output_data::update_data_size): New function.
4643         (Output_section_headers::update_data_size): new function.
4644         (Output_section_data_build::current_data_size): Move to Output_data.
4645         (Output_data_strtab::update_data_size): New function.
4646         (Output_section::current_data_size): Move to Output_data.
4647         (Output_section::set_fixed_layout): New function.
4648         (Output_section::has_fixed_layout): New function.
4649         (Output_section::reserve): New function.
4650         (Output_section::update_data_size): New function.
4651         (Output_section::has_fixed_layout_): New data member.
4652         (Output_section::free_list_): New data member.
4653         (Output_segment::set_section_addresses): Remove const.
4654         (Output_segment::set_section_list_addresses): Remove const.
4655         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4656         New function.
4657         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4658         New function.
4659         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4660         parameter when calling Add_symbols constructor; store argument
4661         serial number for members of a lib group.
4662         (Add_symbols::locks): Allow case where token == NULL.
4663         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4664         (Read_member::~Read_member): New function.
4665         (Read_member::is_runnable): New function.
4666         (Read_member::locks): New function.
4667         (Read_member::run): New function.
4668         (Check_script::~Check_script): New function.
4669         (Check_script::is_runnable): New function.
4670         (Check_script::locks): New function.
4671         (Check_script::run): New function.
4672         (Check_library::~Check_library): New function.
4673         (Check_library::is_runnable): New function.
4674         (Check_library::locks): New function.
4675         (Check_library::run): New function.
4676         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4677         (Add_symbols::library_): New data member.
4678         (class Read_member): New class.
4679         (class Check_script): New class.
4680         (class Check_library): New class.
4681         * reloc.cc (Read_relocs::is_runnable): Allow case where
4682         token == NULL.
4683         (Read_relocs::locks): Likewise.
4684         (Scan_relocs::locks): Likewise.
4685         (Relocate_task::locks): Likewise.
4686         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4687         to clear counters.
4688         (Sized_relobj::incremental_relocs_scan): Fix comment.
4689         (Sized_relobj::do_relocate): Pass output file offset to
4690         write_local_symbols.
4691         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4692         from class declaration.
4693         * script.cc (read_input_script): Allocate Script_info; pass
4694         argument serial number to report_script.
4695         * script.h (class Script_info): Move to incremental.h.
4696         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4697         * symtab.h (Symbol_table::add_from_incrobj): New function.
4698         (Symbol_table::set_file_offset): New function.
4699
4700 2011-04-05  Cary Coutant  <ccoutant@google.com>
4701
4702         * incremental-dump.cc (dump_incremental_inputs): Change signature
4703         to take a Sized_incremental_binary; change caller.  Use readers
4704         in Sized_incremental_binary.
4705         * incremental.cc
4706         (Sized_incremental_binary::find_incremental_inputs_sections):
4707         Rename do_find_incremental_inputs_sections to this.
4708         (Sized_incremental_binary::setup_readers): New function.
4709         (Sized_incremental_binary::do_check_inputs): Check
4710         has_incremental_info_ flag; move setup code to setup_readers;
4711         use input readers.
4712         (Sized_incremental_binary::do_file_is_unchanged): New function.
4713         (Sized_incremental_binary::do_get_input_reader): New function.
4714         * incremental.h (class Incremental_binary): Move to end of file.
4715         (Incremental_binary::file_is_unchanged): New function.
4716         (Incremental_binary::do_file_is_unchanged): New function.
4717         (Incremental_binary::Input_reader): New class.
4718         (Incremental_binary::get_input_reader): New function.
4719         (class Sized_incremental_binary): Move to end of file.
4720         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4721         input section reader classes.
4722         (Sized_incremental_binary::has_incremental_info): New function.
4723         (Sized_incremental_binary::inputs_reader): New function.
4724         (Sized_incremental_binary::symtab_reader): New function.
4725         (Sized_incremental_binary::relocs_reader): New function.
4726         (Sized_incremental_binary::got_plt_reader): New function.
4727         (Sized_incremental_binary::do_file_is_unchanged): New function.
4728         (Sized_incremental_binary::Sized_input_reader): New class.
4729         (Sized_incremental_binary::get_input_reader): New function.
4730         (Sized_incremental_binary::find_incremental_inputs_sections):
4731         Rename do_find_incremental_inputs_sections to this.
4732         (Sized_incremental_binary::setup_readers): New function.
4733         (Sized_incremental_binary::has_incremental_info_): New data member.
4734         (Sized_incremental_binary::inputs_reader_): New data member.
4735         (Sized_incremental_binary::symtab_reader_): New data member.
4736         (Sized_incremental_binary::relocs_reader_): New data member.
4737         (Sized_incremental_binary::got_plt_reader_): New data member.
4738         (Sized_incremental_binary::current_input_file_): New data member.
4739
4740 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4741
4742         PR gold/12640
4743         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4744         violation.
4745
4746 2011-03-30  Cary Coutant  <ccoutant@google.com>
4747
4748         * archive.cc (Archive::include_member): Adjust call to report_object.
4749         (Add_archive_symbols::run): Add script_info to call to
4750         report_archive_begin.
4751         (Lib_group::include_member): Adjust call to report_object.
4752         (Add_lib_group_symbols::run): Adjust call to report_object.
4753         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4754         blocks.  Add object count for script input files.
4755         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4756         script_info parameter; change all callers.
4757         (Incremental_inputs::report_object): Add script_info parameter;
4758         change all callers.
4759         (Incremental_inputs::report_script): Store backpointer to
4760         incremental info entry.
4761         (Output_section_incremental_inputs::set_final_data_size): Record
4762         additional information for scripts.
4763         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4764         * incremental.h (Incremental_script_entry::add_object): New function.
4765         (Incremental_script_entry::get_object_count): New function.
4766         (Incremental_script_entry::get_object): New function.
4767         (Incremental_script_entry::objects_): New data member; adjust
4768         constructor.
4769         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4770         (Incremental_inputs::report_object): Add script_info parameter.
4771         (Incremental_inputs_reader::get_object_count): New function.
4772         (Incremental_inputs_reader::get_object_offset): New function.
4773         * options.cc (Input_arguments::add_file): Return reference to
4774         new input argument.
4775         * options.h (Input_argument::set_script_info): New function.
4776         (Input_argument::script_info): New function.
4777         (Input_argument::script_info_): New data member; adjust all
4778         constructors.
4779         (Input_file_group::add_file): Return reference to new input argument.
4780         (Input_file_lib::add_file): Likewise.
4781         (Input_arguments::add_file): Likewise.
4782         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4783         * script.cc (Parser_closure::Parser_closure): Add script_info
4784         parameter; adjust all callers.
4785         (Parser_closure::script_info): New function.
4786         (Parser_closure::script_info_): New data member.
4787         (read_input_script): Report scripts earlier to incremental info.
4788         (script_add_file): Set script_info in Input_argument.
4789         (script_add_library): Likewise.
4790         * script.h (Script_options::Script_info): Rewrite class.
4791
4792 2011-03-29  Cary Coutant  <ccoutant@google.com>
4793
4794         * archive.cc (Library_base::should_include_member): Move
4795         method here from class Archive.
4796         (Archive::Archive): Initialize base class.
4797         (Archive::should_include_member): Move to base class.
4798         (Archive::do_for_all_unused_symbols): New function.
4799         (Add_archive_symbols::run): Remove redundant access to
4800         incremental_inputs.
4801         (Lib_group::Lib_group): Initialize base class.
4802         (Lib_group::do_filename): New function.
4803         (Lib_group::include_member): Pass pointer to Lib_group to
4804         report_object.
4805         (Lib_group::do_for_all_unused_symbols): New function.
4806         (Add_lib_group_symbols::run): Report archive information for
4807         incremental links.
4808         * archive.h (class Library_base): New base class.
4809         (class Archive): Derive from Library_base.
4810         (Archive::filename): Move to base class.
4811         (Archive::set_incremental_info): Likewise.
4812         (Archive::incremental_info): Likewise.
4813         (Archive::Should_include): Likewise.
4814         (Archive::should_include_member): Likewise.
4815         (Archive::Armap_entry): Remove.
4816         (Archive::Unused_symbol_iterator): Remove.
4817         (Archive::unused_symbols_begin): Remove.
4818         (Archive::unused_symbols_end): Remove.
4819         (Archive::do_filename): New function.
4820         (Archive::do_get_mtime): New function.
4821         (Archive::do_for_all_unused_symbols): New function.
4822         (Archive::task_): Move to base class.
4823         (Archive::incremental_info_): Likewise.
4824         (class Lib_group): Derive from Library_base.
4825         (Lib_group::do_filename): New function.
4826         (Lib_group::do_get_mtime): New function.
4827         (Lib_group::do_for_all_unused_symbols): New function.
4828         (Lib_group::task_): Move to base class.
4829         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4830         function.
4831         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4832         function.
4833         * incremental.cc (Incremental_inputs::report_archive_begin):
4834         Use Library_base; call library's get_mtime; add incremental inputs
4835         entry before members.
4836         (class Unused_symbol_visitor): New class.
4837         (Incremental_inputs::report_archive_end): Use Library_base; use
4838         visitor class to record unused symbols; don't add incremental inputs
4839         entry after members.
4840         (Incremental_inputs::report_object): Use Library_base.
4841         * incremental.h
4842         (Incremental_archive_entry::Incremental_archive_entry): Remove
4843         unused Archive parameter.
4844         (Incremental_inputs::report_archive_begin): Use Library_base.
4845         (Incremental_inputs::report_archive_end): Likewise.
4846         (Incremental_inputs::report_object): Likewise.
4847         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4848         function.
4849         * object.h (Object::for_all_global_symbols): New function.
4850         (Object::do_for_all_global_symbols): New function.
4851         (Sized_relobj::do_for_all_global_symbols): New function.
4852         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4853         function.
4854         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4855         function.
4856
4857 2011-03-27  Ian Lance Taylor  <iant@google.com>
4858
4859         * archive.cc (Archive::interpret_header): Return -1 if something
4860         goes wrong.  Change callers accordingly.
4861
4862 2011-03-25  Cary Coutant  <ccoutant@google.com>
4863
4864         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4865         * testsuite/Makefile.in: Regenerate.
4866
4867 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4868
4869         * plugin.cc (get_view): New.
4870         (Plugin::load): Pass get_view to the plugin.
4871         (Plugin_manager::get_view): New.
4872
4873 2011-03-21  Ian Lance Taylor  <iant@google.com>
4874
4875         * testsuite/final_layout.sh: Rewrite to not use dc.
4876         * testsuite/relro_test.sh: Fail if dc is not present.
4877
4878 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4879
4880         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4881         Change == to -eq.
4882         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4883         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4884         Change == to -eq.
4885         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4886         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4887
4888 2011-03-14  Ian Lance Taylor  <iant@google.com>
4889
4890         * script-sections.cc (Sort_output_sections::script_compare):
4891         Rename from is_before, change return type.
4892         (Sort_output_sections::operator()): Adjust accordingly.
4893
4894 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4895
4896         PR gold/12572
4897         * testsuite/odr_violation2.cc: Add comment to make all error line
4898         numbers double digits.
4899         * testsuite/debug_msg.sh: Adjust expected errors.
4900
4901 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4902
4903         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4904         but mark earlier ones as non-canonical
4905         (offset_to_iterator): Update search target and example
4906         (do_addr2line): Return extra lines in a vector*
4907         (format_file_lineno): Extract from do_addr2line
4908         (one_addr2line): Add vector* out-param
4909         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4910         when a lineno entry appeared last for its instruction
4911         (Dwarf_line_info): Add vector* out-param
4912         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4913         * symtab.cc (Odr_violation_compare): Include the lineno in the
4914         comparison again.
4915         (linenos_from_loc): New. Combine the canonical line for an
4916         address with its other lines.
4917         (True_if_intersect): New. Helper functor to make
4918         std::set_intersection a query.
4919         (detect_odr_violations): Compare sets of lines instead of just
4920         one line for each function. This became less deterministic, but
4921         has fewer false positives.
4922         * symtab.h: Declarations.
4923         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4924         mix an optimized and non-optimized object in the same binary
4925         (odr_violation2.so): Same.
4926         * testsuite/Makefile.in: Regenerate from Makefile.am.
4927         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4928         * testsuite/debug_msg.sh: Update line numbers and add
4929         assertions.
4930         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4931         non-optimized context.
4932         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4933         isn't inlined, and use OdrDerived in an optimized context.
4934         * testsuite/odr_header1.h: Defines OdrDerived, where
4935         optimization will change the
4936         first-instruction-in-the-destructor's file and line number.
4937         * testsuite/odr_header2.h: Defines OdrBase.
4938
4939 2011-03-09  Ian Lance Taylor  <iant@google.com>
4940
4941         * fileread.cc (File_read::clear_views): Don't delete the whole
4942         file view.
4943
4944 2011-03-08  Ian Lance Taylor  <iant@google.com>
4945
4946         PR gold/12525
4947         * fileread.cc: #include <climits>.
4948         (GOLD_IOV_MAX): Define.
4949         (File_read::read_multiple): Limit number of entries by iov_max.
4950         * fileread.h (class File_read): Always set max_readv_entries to
4951         128.
4952
4953 2011-03-07  Ian Lance Taylor  <iant@google.com>
4954
4955         PR gold/12525
4956         * options.h (class General_options): Add -dy and -dn.
4957
4958 2011-03-02  Cary Coutant  <ccoutant@google.com>
4959
4960         * testsuite/script_test_9.t: Add TLS segment.
4961
4962 2011-03-02  Simon Baldwin  <simonb@google.com>
4963
4964         * configure.ac: Add check for gnu_indirect_function support in
4965         the toolchain building binutils.
4966         * configure: Rebuild.
4967
4968 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4969
4970         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4971         plugin only symbols.
4972         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4973         in plugin files as not needed in the symbol table.
4974
4975 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4976
4977         * output.cc (Output_section::add_input_section): Delay fill
4978         generation for section ordering.
4979
4980 2011-02-09  Ian Lance Taylor  <iant@google.com>
4981
4982         PR gold/12316
4983         * object.h (class Sized_relobj): Remove clear_local_symbols.
4984         * reloc.cc (Sized_relobj::do_relocate): Don't call
4985         clear_local_symbols.
4986
4987 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4988
4989         * plugin.cc (is_visible_from_outside): Return true for symbols
4990         in the -u option.
4991
4992 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4993
4994         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4995         filename.
4996
4997 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4998
4999         * icf.h (is_section_foldable_candidate): Change type of parameter
5000         to std::string.
5001         * icf.cc (Icf::find_identical_sections): Change type of local variable
5002         section_name to be std::string.
5003         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5004
5005 2011-01-25  Ian Lance Taylor  <iant@google.com>
5006
5007         * script.cc (script_add_extern): Rewrite to use
5008         add_symbol_reference.
5009
5010 2011-01-25  Doug Kwan  <dougkwan@google.com>
5011
5012         * icf.cc (get_section_contents): Always lock section's object.
5013
5014 2011-01-24  Ian Lance Taylor  <iant@google.com>
5015
5016         * options.h (class General_options): Accept
5017         --no-detect-odr-violations.
5018
5019 2011-01-24  Ian Lance Taylor  <iant@google.com>
5020
5021         * version.cc (version_string): Bump to 1.11.
5022
5023 2011-01-24  Ian Lance Taylor  <iant@google.com>
5024
5025         * plugin.cc (class Plugin_rescan): Define new class.
5026         (Plugin_manager::claim_file): Set any_claimed_.
5027         (Plugin_manager::save_archive): New function.
5028         (Plugin_manager::save_input_group): New function.
5029         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5030         necessary.
5031         (Plugin_manager::new_undefined_symbol): New function.
5032         (Plugin_manager::rescan): New function.
5033         (Plugin_manager::rescannable_defines): New function.
5034         (Plugin_manager::add_input_file): Set any_added_.
5035         * plugin.h (class Plugin_manager): define new fields rescannable_,
5036         undefined_symbols_, any_claimed_, and any_added_.  Declare
5037         Plugin_rescan as friend.  Declare new functions.
5038         (Plugin_manager::Rescannable): Define type.
5039         (Plugin_manager::Rescannable_list): Define type.
5040         (Plugin_manager::Undefined_symbol_list): Define type.
5041         (Plugin_manager::Plugin_manager): Initialize new fields.
5042         * archive.cc (Archive::defines_symbol): New function.
5043         (Add_archive_symbols::run): Pass archive to plugins if any.
5044         * archive.h (class Archive): Declare defines_symbol.
5045         * readsyms.cc (Input_group::~Input_group): New function.
5046         (Finish_group::run): Pass input_group to plugins if any.
5047         * readsyms.h (class Input_group): Declare destructor.
5048         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5049         any.
5050
5051 2011-01-10  Ian Lance Taylor  <iant@google.com>
5052
5053         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5054         section as relro.
5055         (Layout::set_segment_offsets): Reset increase_relro before calling
5056         set_section_addresses a second time.
5057
5058 2011-01-04  Cary Coutant  <ccoutant@google.com>
5059
5060         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5061         sections before NOBITS sections.
5062
5063 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5064
5065         * version.cc (print_version): Update copyright to 2011.
5066
5067 2010-12-23  Cary Coutant  <ccoutant@google.com>
5068
5069         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5070         of OS to this->add.  Add OD parameter to second form of the function.
5071
5072 2010-12-20  Ian Lance Taylor  <iant@google.com>
5073
5074         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5075         second of two consecutive entries with same offset.
5076
5077 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5078
5079         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5080         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5081         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5082         to avoid unneeded links against $(LDADD).
5083         * testsuite/Makefile.in: Regenerate.
5084
5085 2010-12-15  Ian Lance Taylor  <iant@google.com>
5086
5087         PR gold/12324
5088         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5089         for R_X86_64_32 and R_X86_64_PC32.
5090         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5091         ver_matching_def_pic.o.
5092         (ver_matching_def_pic.o): New target.
5093
5094 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5095
5096         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5097         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5098         Move definition before File_read::View member definitions.
5099         (File_read::View::~View): Initialize and hold lock before
5100         updating current_mapped_bytes.
5101
5102 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5103
5104         * dwarf_reader.cc: Remove outdated comment.
5105         * gold-threads.cc: Fix typo in error message.
5106         * archive.cc: Fix typos in comments.
5107         * archive.h: Likewise.
5108         * arm-reloc-property.cc: Likewise.
5109         * arm-reloc-property.h: Likewise.
5110         * arm-reloc.def: Likewise.
5111         * arm.cc: Likewise.
5112         * attributes.h: Likewise.
5113         * cref.cc: Likewise.
5114         * ehframe.cc: Likewise.
5115         * fileread.h: Likewise.
5116         * gold.h: Likewise.
5117         * i386.cc: Likewise.
5118         * icf.cc: Likewise.
5119         * incremental.h: Likewise.
5120         * int_encoding.cc: Likewise.
5121         * layout.h: Likewise.
5122         * main.cc: Likewise.
5123         * merge.h: Likewise.
5124         * object.cc: Likewise.
5125         * object.h: Likewise.
5126         * options.cc: Likewise.
5127         * readsyms.cc: Likewise.
5128         * reduced_debug_output.cc: Likewise.
5129         * reloc.cc: Likewise.
5130         * script-sections.cc: Likewise.
5131         * sparc.cc: Likewise.
5132         * symtab.h: Likewise.
5133         * target-reloc.h: Likewise.
5134         * target.cc: Likewise.
5135         * target.h: Likewise.
5136         * timer.cc: Likewise.
5137         * timer.h: Likewise.
5138         * x86_64.cc: Likewise.
5139
5140 2010-12-09  Cary Coutant  <ccoutant@google.com>
5141
5142         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5143         stack.
5144         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5145         parameter; change all callers.
5146         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5147         * options.h (warn_execstack): New option.
5148
5149 2010-12-07  Doug Kwan  <dougkwan@google.com>
5150
5151         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5152         like function call relocations.
5153
5154 2010-12-07  Ian Lance Taylor  <iant@google.com>
5155
5156         * archive.cc (Archive::get_elf_object_for_member): Permit
5157         punconfigured to be NULL.
5158         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5159         (Archive::include_member): Pass NULL to get_elf_object_for_member
5160         if we searched for the archive and this is the first included
5161         object.
5162
5163 2010-12-01  Ian Lance Taylor  <iant@google.com>
5164
5165         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5166         track_relocs_type_ field.
5167         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5168         Set track_relocs_type_.
5169         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5170         contents when using RELA relocs.
5171         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5172         reloc_map_.
5173         * reloc.cc (Track_relocs::next_addend): New function.
5174         * reloc.h (class Track_relocs): Declare next_addend.
5175
5176 2010-12-01  Ian Lance Taylor  <iant@google.com>
5177
5178         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5179         virtual destructor.
5180
5181 2010-12-01  Ian Lance Taylor  <iant@google.com>
5182
5183         * README: Update compilers known to work and fail.
5184
5185 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5186
5187         * configure.in: For --enable-gold, handle value `default' instead of
5188         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5189         not the default.
5190         * configure: Regenerate.
5191
5192 2010-11-18  Doug Kwan  <dougkwan@google.com>
5193
5194         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5195         and right_alignment to be zero.  Store result alignment only if it is
5196         greater than existing alignment.
5197
5198 2010-11-16  Cary Coutant  <ccoutant@google.com>
5199
5200         PR gold/12220
5201         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5202         Check for ".zdebug_line".
5203
5204 2010-11-16  Doug Kwan  <dougkwan@google.com>
5205             Cary Coutant  <ccoutant@google.com>
5206
5207         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5208         by reference; adjust all callers.
5209         * output.cc (Output_segment::set_section_addresses): Adjust references
5210         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5211         list is empty.
5212         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5213         end at page boundary.
5214
5215 2010-11-16  Cary Coutant  <ccoutant@google.com>
5216
5217         PR gold/12220
5218         * layout.cc (Layout::choose_output_section): Transform names of
5219         compressed sections even when using a script with a SECTIONS clause.
5220         (Layout::output_section_name): Remove code to transform
5221         compressed debug section names.
5222         * output.cc (Output_section::add_input_section): Use uncompressed
5223         section size when tracking input sections.
5224
5225 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5226
5227         * symtab.h (Symbol::NON_PIC_REF): Remove.
5228         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5229         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5230         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5231         (Symbol::use_plt_offset): Take a flags argument and pass it
5232         directly to needs_dynamic_reloc.  Restrict check for undefined
5233         weak symbols to function calls.
5234         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5235         (Target_arm::Scan::global): Use it.
5236         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5237         (Target_arm::Relocate::relocate): Likewise.
5238         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5239         parameter with an r_type parameter.  Use get_reference_flags
5240         to get the flags.
5241         (Target_arm::Relocate::relocate): Update accordingly.
5242         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5243         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5244         (Target_i386::Scan::global): Likewise.
5245         (Target_i386::Relocate::relocate): Likewise.
5246         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5247         parameter with an r_type parameter.  Use get_reference_flags
5248         to get the flags.
5249         (Target_i386::Relocate::relocate): Update accordingly.
5250         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5251         (Target_powerpc::Scan::global): Use it.
5252         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5253         (Target_powerpc::Relocate::relocate): Likewise.
5254         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5255         (Target_sparc::Scan::global): Use it.
5256         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5257         (Target_sparc::Relocate::relocate): Likewise.
5258         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5259         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5260         (Target_x86_64::Scan::global): Likewise.
5261         (Target_x86_64::Relocate::relocate): Likewise.
5262
5263 2010-11-08  Doug Kwan  <dougkwan@google.com>
5264             Cary Coutant  <ccoutant@google.com>
5265
5266         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5267         (Arm_exidx_merge_section::section_contents_): New data member.
5268         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5269         (Arm_input_section::~Arm_input_section): De-allocate memory.
5270         (Arm_input_section::original_contents_): New data member.
5271         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5272         in parameters instead of calling Object::section_contents without
5273         locking.
5274         (Arm_output_section::group_section): New parameter TASK.  Pass it
5275         to callees that need locking objects.
5276         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5277         to lock EXIDX input sections.  Fix a formatting issue.  Call
5278         Arm_exidx_merged_section::build_contents to create merged section
5279         contents.
5280         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5281         to lock object of stub table owner.
5282         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5283         TEXT_SIZE to initialize data member TEXT_SIZE_.
5284         (Arm_exidx_input_section::addralign): Fix typo in comment.
5285         (Arm_exidx_input_section::text_size): New method.
5286         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5287         that require locking objects.  Lock objects before scanning for stubs
5288         and updating local symbols.
5289         (Arm_input_section<big_endian>::init): Copy contents of original
5290         input section.
5291         (Arm_input_section<big_endian>::do_write): Use saved contents of
5292         original input section instead of calling Object::section_contents
5293         without locking.
5294         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5295         size without calling Object::section_size().
5296         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5297         for size.  Allocate a buffer for merged EXIDX entries.
5298         (Arm_exidx_merged_section::build_contents): New method.
5299         (Arm_exidx_merged_section::do_write): Move merge section contents
5300         building code to Arm_exidx_merged_section::build_contetns.  Write
5301         out contetns in buffer instead of building it on the fly.
5302         (Arm_relobj::make_exidx_input_section): Also pass text section size
5303         to Arm_exidx_input_section constructor.
5304         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5305         (Arm_dynobj::do_read_symbols): Fix memory leak.
5306         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5307         * target.h: (class Task): Add forward declaration.
5308         (Target::relax): Add new parameter TASK and pass it to
5309         Target::do_relax().
5310         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5311
5312 2010-11-05  Cary Coutant  <ccoutant@google.com>
5313
5314         PR gold/10708
5315         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5316         object when reading from the file.
5317         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5318         second layout pass.
5319         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5320         when reading section contents.
5321         (get_section_contents): Likewise.
5322         (icf::find_identical_sections): Likewise.
5323         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5324         object when reading from the file.
5325         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5326         the object when doing deferred section layout.
5327
5328 2010-11-03  Nick Clifton  <nickc@redhat.com>
5329
5330         PR gold/12001
5331         * script.h (class Symbol_assignment: name): New member.  Returns
5332         the name of the symbol.
5333         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5334         Returns true if the given symbol name is on the list of
5335         assignments wating to be processed.
5336         * archive.cc (should_incldue_member): If the symbol is undefined,
5337         check to see if it is on the list of symbols pending assignment.
5338
5339 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5340
5341         * script-sections.cc (Script_sections::find_memory_region): Check
5342         for a NULL output section pointer.
5343
5344 2010-10-29  Doug Kwan  <dougkwan@google.com>
5345
5346         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5347         Output_section::add_relaxed_input_section.
5348         * output.cc (Output_section::add_relaxed_input_section): Add new
5349         arguments LAYOUT and NAME.  Set section order index.
5350         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5351         Copy section order index.
5352         * output.h (Output_section::add_relaxed_input_section): Add new
5353         arguments LAYOUT and NAME.
5354
5355 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5356
5357         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5358         NATIVE_OR_CROSS_LINKER.
5359         * testsuite/Makefile.in: Regenerate.
5360
5361 2010-10-20  Doug Kwan  <dougkwan@google.com>
5362
5363         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5364         without SHF_LINK_ORDER flags.
5365         * layout.cc (Layout::choose_output_section): Do not filter
5366         SHF_LINK_ORDER flag in a relocatable link.
5367
5368 2010-10-17  Cary Coutant  <ccoutant@google.com>
5369
5370         * output.h (Output_segment::set_section_addresses): Change function
5371         signature.  Update all callers.
5372         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5373         sections.
5374         (Output_segment::set_section_addresses): Align after last TLS
5375         section.  Add padding before last relro section instead of after.
5376
5377 2010-10-17  Doug Kwan  <dougkwan@google.com>
5378
5379         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5380         GOT output section to be writable.
5381
5382 2010-10-14  Cary Coutant  <ccoutant@google.com>
5383
5384         * debug.h (DEBUG_INCREMENTAL): New flag.
5385         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5386         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5387         mode.
5388         * incremental.cc (report_command_line): Ignore all forms of
5389         --incremental.
5390         * layout.cc (Layout::Layout): Check parameters for incremental link
5391         mode.
5392         * options.cc (General_options::parse_incremental): New function.
5393         (General_options::parse_no_incremental): New function.
5394         (General_options::parse_incremental_full): New function.
5395         (General_options::parse_incremental_update): New function.
5396         (General_options::incremental_mode_): New data member.
5397         (General_options::finalize): Check incremental_mode_.
5398         * options.h (General_options): Update help text for --incremental.
5399         Add --no-incremental, --incremental-full, --incremental-update.
5400         (General_options::Incremental_mode): New enum type.
5401         (General_options::incremental_mode): New function.
5402         (General_options::incremental_mode_): New data member.
5403         * parameters.cc (Parameters::incremental_mode_): New data member.
5404         (Parameters::set_options): Set incremental_mode_.
5405         (Parameters::set_incremental_full): New function.
5406         (Parameters::incremental): New function.
5407         (Parameters::incremental_update): New function.
5408         (set_parameters_incremental_full): New function.
5409         * parameters.h (Parameters::set_incremental_full): New function.
5410         (Parameters::incremental): New function.
5411         (Parameters::incremental_update): New function.
5412         (Parameters::incremental_mode_): New data member.
5413         (set_parameters_incremental_full): New function.
5414         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5415         incremental link mode.
5416         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5417         (Sized_relobj::do_relocate_sections): Likewise.
5418         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5419         option.
5420         * testsuite/Makefile.in: Regenerate.
5421         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5422
5423 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5424
5425         * script-sections.h (class Script_sections): Make
5426         Sections_elements typedef public.
5427         * script-sections.cc (class Sort_output_sections): Add elements_
5428         field.  Add constructor which sets it; change all callers.
5429         (Sort_output_sections::is_before): New function.
5430         (Sort_output_sections::operator()): Call is_before.
5431         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5432         conditional.
5433         * testsuite/script_test_10.sh: New test. Test script section
5434         order.
5435         * testsuite/script_test_10.t: Likewise.
5436         * testsuite/script_test_10.s: Likewise.
5437         * testsuite/Makefile.am: Wrap the cross linker tests and the
5438         common tests into NATIVE_OR_CROSS_LINKER.
5439         (check_SCRIPTS): Add script_test_10.sh.
5440         (check_DATA): Add script_test_10.stdout.
5441         (script_test_10.o, script_test_10): New targets.
5442         (script_test_10.stdout): New target.
5443         * configure, testsuite/Makefile.in: Regenerate.
5444
5445 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5446
5447         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5448         error for the deprecated relocations.
5449         (Target_arm::Scan::global): Likewise.
5450         (Target_arm::Relocate::relocate): Likewise.
5451
5452 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5453
5454         * fileread.cc (Input_file::find_file): Initialize *found_name
5455         and *namep when using the fallback search for case 4.
5456
5457 2010-10-11  Cary Coutant  <ccoutant@google.com>
5458
5459         * options.h (class General_options): Redefine -z lazy as an alias for
5460         the negation of -z now.
5461
5462 2010-10-11  Ian Lance Taylor  <iant@google.com>
5463
5464         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5465         binding.
5466
5467 2010-10-06  Nick Clifton  <nickc@redhat.com>
5468
5469         * script-sections.cc(class Memory_region): Remove
5470         current_lma_offset_ field.  Rename current_vma_offset_ to
5471         current_offset_.  Add last_section_ field.
5472         (Memory_region::get_current_vma_address): Rename to
5473         get_current_address.
5474         (Memory_region::get_current_lma_address): Delete.
5475         (Memory_region::increment_vma_offset): Rename to
5476         increment_offset.
5477         (Memory_region::increment_lma_offset): Delete.
5478         (Memory_region::attributes_compatible): New method.  Returns
5479         true if the provided section is compatible with the region.
5480         (Memory_region::get_last_section): New method.  Returns the last
5481         section to use the region.
5482         (Memory_region::set_last_section): New method.  Stores the last
5483         section to use the region.
5484         (Script_sections::block_in_region): New method.  Returns true if
5485         a block of memory is contained within a region.
5486         (Script_sections::find_memory_region): New method.  Locates a
5487         memory region to be used to set a VMA or LMA address.
5488         (Output_section_definition::set_section_addresses): Add code to
5489         check for addresses set by memory regions.
5490         (Output_segment::set_section_addresses): Remove memory region
5491         walking code.
5492         (Script_sections::create_segment): Add a warning if a header
5493         segment is created outside of any region.
5494         * script-sections.h (class Script_sections): Add prototypes for
5495         find_memory_region and block_in_region methods.
5496         * testsuite/memory_test.s: Use .long instead of .word.
5497         * testsuite/memory_test.t: Add some more output sections.
5498         * testsuite/memory_test.sh: Update expected output.
5499
5500 2010-10-02  Doug Kwan  <dougkwan@google.com>
5501
5502         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5503         defintion to symtab.h
5504         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5505         declaration to defintion.
5506
5507 2010-10-01  Nick Clifton  <nickc@redhat.com>
5508
5509         * expression.cc (eval): Replace dummy argument with NULL.
5510         (eval_maybe_dot): Check for a NULL result section pointer.
5511         (Symbol_expression::value): Likewise.
5512         (Dot_expression::value): Likewise.
5513         (BINARY_EXPRESSION): Likewise.
5514         (Max_expression::value): Likewise.
5515         (Min_expression::value): Likewise.
5516         (Absolute_expression::value): Likewise.
5517         (Addr_expression::value_from_output_section): Likewise.
5518         (Loaddddr_expression::value_from_output_section): Likewise.
5519         (Segment_start_expression::value): Likewise.
5520         * script-sections.cc
5521         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5522         argument with NULL.
5523         (Sections_elememt_dot_assignment::set_section_addresses):
5524         Likewise.
5525         (Output_data_expression::do_write_to_buffer): Likewise.
5526         (Output_section_definition::finalize_symbols): Likewise.
5527         (Output_section_definition::set_section_addresses): Likewise.
5528
5529 2010-09-30  Doug Kwan  <dougkwan@google.com>
5530
5531         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5532
5533 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5534
5535         * target.h (Target::can_icf_inline_merge_sections): New virtual
5536         function.
5537         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5538         virtual function.
5539         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5540         virtual function.
5541         * icf.cc (get_section_contents): Inline merge sections only when
5542         target allows it.
5543
5544 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5545
5546         * configure: Regenerate.
5547
5548 2010-09-17  Ian Lance Taylor  <iant@google.com>
5549
5550         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5551         * testsuite/Makefile.am (memory_test.o): New target.
5552         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5553         memory_test.t.
5554         * testsuite/Makefile.in: Rebuild.
5555
5556 2010-09-17  Doug Kwan  <dougkwan@google.com>
5557
5558         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5559         defintion if relocation uses GOT entries of the symbol.
5560         * testsuite/icf_safe_test.sh: Fix test.
5561         * testsuite/icf_safe_so_test.sh: Fix test.
5562
5563 2010-09-16  Cary Coutant  <ccoutant@google.com>
5564
5565         * script_sections.cc (class Memory_region): Remove "NULL" from
5566         vector initializations.
5567
5568 2010-09-15  Cary Coutant  <ccoutant@google.com>
5569
5570         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5571         Resolve forwarding symbols.
5572
5573 2010-09-15  Doug Kwan  <dougkwan@google.com>
5574
5575         * gold/testsuite/script_test_3.t: Add ARM special sections.
5576         * gold/testsuite/script_test_4.t: Same.
5577         * gold/testsuite/script_test_5.t: Same.
5578         * gold/testsuite/script_test_6.t: Same.
5579         * gold/testsuite/script_test_7.t: Same.
5580         * gold/testsuite/script_test_7.t: Same.
5581         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5582
5583 2010-09-14  Cary Coutant  <ccoutant@google.com>
5584
5585         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5586         (Target_x86_64::Relocate::relocate_tls): Replace check for
5587         saw_tls_block_reloc_ with test for executable section.
5588
5589 2010-09-12  Cary Coutant  <ccoutant@google.com>
5590
5591         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5592         position-independent executables to shared libraries need dynamic
5593         relocations.
5594         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5595         position-independent executables.
5596         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5597         * testsuite/Makefile.in: Regenerate.
5598
5599 2010-09-10  Nick Clifton  <nickc@redhat.com>
5600
5601         PR gold/11997
5602         * testsuite/memory_test.t: Discard any sections that are not
5603         needed.
5604
5605 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5606
5607         PR gold/11996
5608         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5609         "This::" to work around a bug in gcc 4.2.
5610
5611         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5612
5613 2010-09-09  Rafael Espindola  <espindola@google.com>
5614
5615         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5616         sections with different PF_X flags in the same segment.
5617         (Layout::find_first_load_seg): Search all segments to find the first
5618         one.
5619         * options.h (rosegment): New.
5620
5621 2010-09-08  Rafael Espindola  <espindola@google.com>
5622
5623         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5624
5625 2010-09-08  Doug Kwan  <dougkwan@google.com>
5626
5627         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5628         (Arm_relobj::do_relocate_sections): Add new parameter for output
5629         file to match the parent.
5630         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5631         of local symbols instead of input values.  Update code to track
5632         changes in gold::relocate_section.
5633         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5634         (Sized_relobj::compute_final_local_value_internal): New methods.
5635         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5636         body into private version of Sized_relobj::compute_final_local_value.
5637         Call the inline method.
5638         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5639         merged symbol value if there is one.
5640         (Symbol_value::has_output_value): New method defintiion.
5641         (Sized_relobj::Compute_final_local_value_status): New enum type.
5642         (Sized_relobj::compute_final_local_value): New methods.
5643         (Sized_relobj::compute_final_local_value_internal): New methods.
5644         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5645         and arm_cortex_a8.sh.
5646         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5647         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5648         New tests.
5649         * Makefile.in: Regenerate.
5650         * testsuite/arm_bl_out_of_range.s: Update test.
5651         * testsuite/thumb_bl_out_of_range.s: Ditto.
5652         * testsuite/thumb_blx_out_of_range.s: Ditto.
5653         * testsuite/arm_branch_out_of_range.sh: New file.
5654         * testsuite/arm_cortex_a8.sh: Ditto.
5655         * testsuite/arm_cortex_a8_b.s: Ditto.
5656         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5657         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5658         * testsuite/arm_cortex_a8_bl.s: Ditto.
5659         * testsuite/arm_cortex_a8_blx.s: Ditto.
5660         * testsuite/arm_cortex_a8_local.s: Ditto.
5661         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5662         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5663
5664 2010-09-08  Rafael Espindola  <espindola@google.com>
5665
5666         * Makefile.am (memory_test.stdout): Run readelf with -W.
5667         * Makefile.in: Regenerate.
5668         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5669         64 bit output.
5670
5671 2010-09-08  Rafael Espindola  <espindola@google.com>
5672
5673         * script-sections.cc (Script_sections::add_memory_region): Convert
5674         field precision to int.
5675         * script.cc (script_set_section_region, script_set_section_region):
5676         Convert field precision to int.
5677
5678 2010-09-08  Rafael Espindola  <espindola@google.com>
5679
5680         * arm.cc (do_finalize_sections): Create the __exidx_start and
5681         __exdix_end symbols even when the section is missing.
5682
5683 2010-09-08  Nick Clifton  <nickc@redhat.com>
5684
5685         * README: Remove claim that MEMORY is not supported.
5686         * expression.cc (script_exp_function_origin)
5687         (script_exp_function_length): Move from here to ...
5688         * script.cc: ... here.
5689         (script_set_section_region, script_add_memory)
5690         (script_parse_memory_attr, script_include_directive): New
5691         functions.
5692         * script-sections.cc
5693         (class Memory_region): New class.
5694         (class Output_section_definition): Add set_memory_region,
5695         set_section_vma, set_section_lma and get_section_name methods.
5696         (class Script_Sections): Add add_memory_region,
5697         find_memory_region, find_memory_region_origin,
5698         find_memory_region_length and set_memory_region methods.
5699         Have set_section_addresses method walk the list of set memory
5700         regions.
5701         Extend the print methos to display memory regions.
5702         * script-sections.h: Add prototypes for new methods.
5703         Add enum for MEMORY region attributes.
5704         * yyscript.y: Add support for parsing MEMORY regions.
5705         * script-c.h: Add prototypes for new functions.
5706         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5707         * testsuite/Makefile.in: Regenerate.
5708         * testsuite/memory_test.sh: New script.
5709         * testsuite/memory_test.s: New assembler source file.
5710         * testsuite/memory_test.t: New linker script.
5711
5712 2010-08-27  Doug Kwan  <dougkwan@google.com>
5713
5714         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5715         reference override an existing dynamic weak reference.
5716         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5717         * testsuite/Makefile.in: Regenerate.
5718         * testsuite/dyn_weak_ref.sh: New file.
5719         * testsuite/dyn_weak_ref_1.c: Ditto.
5720         * testsuite/dyn_weak_ref_2.c: Ditto.
5721
5722 2010-08-27  Ian Lance Taylor  <iant@google.com>
5723
5724         * incremental.h (class Incremental_input_entry): Add virtual
5725         destructor.
5726
5727 2010-08-27  Ian Lance Taylor  <iant@google.com>
5728
5729         * testsuite/start_lib_test_3.c: Mark t3 as used.
5730
5731 2010-08-27  Nick Clifton  <nickc@redhat.com>
5732
5733         * options.cc (version_script): Fix small typo in previous
5734         whitespace tidyup.
5735
5736 2010-08-25  Nick Clifton  <nickc@redhat.com>
5737
5738         * archive.cc: Formatting fixes: Remove whitespace between
5739         typename and following asterisk.  Remove whitespace between
5740         function name and opening parenthesis.
5741         * archive.h: Likewise.
5742         * arm.cc: Likewise.
5743         * attributes.cc: Likewise.
5744         * attributes.h: Likewise.
5745         * common.cc: Likewise.
5746         * copy-relocs.cc: Likewise.
5747         * dirsearch.h: Likewise.
5748         * dynobj.cc: Likewise.
5749         * ehframe.cc: Likewise.
5750         * ehframe.h: Likewise.
5751         * expression.cc: Likewise.
5752         * fileread.cc: Likewise.
5753         * fileread.h: Likewise.
5754         * gc.h: Likewise.
5755         * gold-threads.cc: Likewise.
5756         * gold.cc: Likewise.
5757         * i386.cc: Likewise.
5758         * icf.h: Likewise.
5759         * incremental-dump.cc: Likewise.
5760         * incremental.cc: Likewise.
5761         * layout.cc: Likewise.
5762         * layout.h: Likewise.
5763         * main.cc: Likewise.
5764         * merge.cc: Likewise.
5765         * merge.h: Likewise.
5766         * object.cc: Likewise.
5767         * object.h: Likewise.
5768         * options.cc: Likewise.
5769         * options.h: Likewise.
5770         * output.cc: Likewise.
5771         * output.h: Likewise.
5772         * plugin.cc: Likewise.
5773         * plugin.h: Likewise.
5774         * powerpc.cc: Likewise.
5775         * reloc.cc: Likewise.
5776         * script-c.h: Likewise.
5777         * script-sections.cc: Likewise.
5778         * script.cc: Likewise.
5779         * stringpool.cc: Likewise.
5780         * symtab.cc: Likewise.
5781         * symtab.h: Likewise.
5782         * target.cc: Likewise.
5783         * timer.cc: Likewise.
5784         * timer.h: Likewise.
5785         * version.cc: Likewise.
5786         * x86_64.cc: Likewise.
5787
5788 2010-08-24  Nick Clifton  <nickc@redhat.com>
5789
5790         PR 11899
5791         * layout.cc (segment_precedes): Sort segments by their physical
5792         addresses, if they have been set.
5793
5794 2010-08-23  Cary Coutant  <ccoutant@google.com>
5795
5796         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5797         symbols data.
5798         (Lib_group::include_member): Unlock object after deleting its
5799         symbols data.
5800         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5801         the bug fixed here.
5802
5803 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5804             Cary Coutant  <ccoutant@google.com>
5805
5806         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5807         constructor, and set_blocker.
5808         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5809         readsyms_blocker_.
5810         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5811         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5812         * testsuite/Makefile.am (start_lib_test): New test case.
5813         * testsuite/Makefile.in: Regenerate.
5814         * testsuite/start_lib_test_main.c: New file.
5815         * testsuite/start_lib_test_1.c: New file.
5816         * testsuite/start_lib_test_2.c: New file.
5817         * testsuite/start_lib_test_3.c: New file.
5818
5819 2010-08-19  Ian Lance Taylor  <iant@google.com>
5820
5821         * Makefile.in: Rebuild with automake 1.11.1.
5822         * aclocal.m4: Likewise.
5823         * testsuite/Makefile.in: Likewise.
5824
5825 2010-08-19  Ian Lance Taylor  <iant@google.com>
5826
5827         PR 10893
5828         * i386.cc (class Output_data_plt_i386): Update declarations.
5829         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5830         local_ifuncs_ fields.
5831         (Target_i386::do_plt_section_for_global): New function.
5832         (Target_i386::do_plt_section_for_local): New function.
5833         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5834         parameter; change all callers.  Initialize global_ifuncs_ and
5835         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5836         __rel_iplt_end.
5837         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5838         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5839         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5840         symbols.
5841         (Target_i386::make_plt_section): New function, broken out of
5842         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5843         (Target_i386::make_plt_entry): Call make_plt_section.
5844         (Target_i386::make_local_ifunc_plt_entry): New function.
5845         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5846         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5847         R_386_IRELATIVE to switch.
5848         (Target_i386::Scan::global): Likewise.
5849         (Target_i386::Relocate::relocate): Likewise.
5850         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5851         switch.
5852         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5853         (Target_x86_64::do_plt_section_for_global): New function.
5854         (Target_x86_64::do_plt_section_for_local): New function.
5855         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5856         parameter; change all callers.  If doing a static link define
5857         __rela_iplt_start and __rela_iplt_end.
5858         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5859         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5860         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5861         to point to .plt.
5862         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5863         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5864         switch.
5865         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5866         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5867         R_X86_64_IRELATIVE to switch.
5868         (Target_x86_64::Scan::global): Likewise.
5869         (Target_x86_64::Relocate::relocate): Likewise.
5870         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5871         switch.
5872         * target.h (class Target): Add plt_section_for_global and
5873         plt_section_for_local functions.  Add do_plt_section_for_global
5874         and do_plt_section_for_local virtual functions.
5875         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5876         clarifying comments.
5877         (Symbol::use_plt_offset): Handle IFUNC symbol.
5878         * object.cc (Sized_relobj::Sized_relobj): Initialize
5879         local_plt_offsets_.
5880         (Sized_relobj::local_has_plt_offset): New function.
5881         (Sized_relobj::local_plt_offset): New function.
5882         (Sized_relobj::set_local_plt_offset): New function.
5883         (Sized_relobj::do_count): Handle IFUNC symbol.
5884         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5885         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5886         is_ifunc_symbol functions.
5887         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5888         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5889         local_plt_offsets_ field.
5890         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5891         * output.h (class Output_section_data): Add non-const
5892         output_section function.
5893         (class Output_data_got): Update declarations.
5894         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5895         Add use_plt_offset parameter to global and local constructors.
5896         Change all callers.  Change local_sym_index_ field to 31 bits.
5897         Change GSYM_CODE and CONSTANT_CODE accordingly.
5898         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5899         doing a static link don't set sh_link field.
5900         (Output_data_got::Got_entry::write): Use PLT offset if
5901         appropriate.
5902         (Output_data_got::add_global_plt): New function.
5903         (Output_data_got::add_local_plt): New function.
5904         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5905         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5906         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5907         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5908         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5909         IFUNC conditional.
5910         * testsuite/ifunc-sel.h: New file.
5911         * testsuite/ifuncmain1.c: New file.
5912         * testsuite/ifuncmain1vis.c: New file.
5913         * testsuite/ifuncmod1.c: New file.
5914         * testsuite/ifuncdep2.c: New file.
5915         * testsuite/ifuncmain2.c: New file.
5916         * testsuite/ifuncmain3.c: New file.
5917         * testsuite/ifuncmod3.c: New file.
5918         * testsuite/ifuncmain4.c: New file.
5919         * testsuite/ifuncmain5.c: New file.
5920         * testsuite/ifuncmod5.c: New file.
5921         * testsuite/ifuncmain6pie.c: New file.
5922         * testsuite/ifuncmod6.c: New file.
5923         * testsuite/ifuncmain7.c: New file.
5924         * configure, testsuite/Makefile.in: Rebuild.
5925
5926 2010-08-18  Ian Lance Taylor  <iant@google.com>
5927
5928         * incremental.cc
5929         (Output_section_incremental_inputs::write_input_files): Add cast
5930         to avoid signed/unsigned comparison warning.
5931         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5932
5933 2010-08-12  Cary Coutant  <ccoutant@google.com>
5934
5935         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5936
5937 2010-08-13  Ian Lance Taylor  <iant@google.com>
5938
5939         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5940
5941 2010-08-12  Cary Coutant  <ccoutant@google.com>
5942             Doug Kwan  <dougkwan@google.com>
5943
5944         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5945         defintion overrides non-weak undef, remember that the original undef
5946         is not weak.
5947         * symtab.cc (Symbol_table::sized_write_global): For undef without
5948         an original weak binding, set binding to global in output.
5949         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5950         * testsuite/Makefile.in: Regenerate.
5951         * testsuite/strong_ref_weak_def.sh: New file.
5952         * testsuite/strong_ref_weak_def_1.c: Ditto.
5953         * testsuite/strong_ref_weak_def_2.c: Ditto.
5954
5955 2010-08-12  Cary Coutant  <ccoutant@google.com>
5956
5957         * testsuite/incremental_test.sh: Rewrite.
5958         * testsuite/incremental_test_1.c: Rewrite.
5959         * testsuite/incremental_test_2.c: Rewrite.
5960
5961 2010-08-12  Cary Coutant  <ccoutant@google.com>
5962
5963         * arm.cc (Target_arm::got_size): Add const.
5964         (Target_arm::got_entry_count): New function.
5965         (Target_arm::plt_entry_count): New function.
5966         (Target_arm::first_plt_entry_offset): New function.
5967         (Target_arm::plt_entry_size): New function.
5968         (Output_data_plt_arm::entry_count): New function.
5969         (Output_data_plt_arm::first_plt_entry_offset): New function.
5970         (Output_data_plt_arm::get_plt_entry_size): New function.
5971         * i386.cc (Target_i386::got_size): Add const.
5972         (Target_i386::got_entry_count): New function.
5973         (Target_i386::plt_entry_count): New function.
5974         (Target_i386::first_plt_entry_offset): New function.
5975         (Target_i386::plt_entry_size): New function.
5976         (Output_data_plt_i386::entry_count): New function.
5977         (Output_data_plt_i386::first_plt_entry_offset): New function.
5978         (Output_data_plt_i386::get_plt_entry_size): New function.
5979         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5980         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5981         * incremental.cc: Include target.h.
5982         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5983         parameter.  Adjust all callers.  Find incremental_got_plt section.
5984         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5985         section.
5986         (Output_section_incremental_inputs::set_final_data_size): Calculate
5987         size of incremental_got_plt section.
5988         (Output_section_incremental_inputs::do_write): Write the
5989         incremental_got_plt section.
5990         (Got_plt_view_info): New struct.
5991         (Local_got_offset_visitor): New class.
5992         (Global_got_offset_visitor): New class.
5993         (Global_symbol_visitor_got_plt): New class.
5994         (Output_section_incremental_inputs::write_got_plt): New function.
5995         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5996         Add parameter.  Adjust all callers.
5997         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5998         (Incremental_inputs::got_plt_section): New function.
5999         (Incremental_inputs::got_plt_section_): New data member.
6000         (Incremental_got_plt_reader): New class.
6001         * layout.cc (Layout::create_incremental_info_sections): Add the
6002         incremental_got_plt section.
6003         * object.h (Got_offset_list::get_list): New function.
6004         (Got offset_list::for_all_got_offsets): New function.
6005         (Sized_relobj::local_got_offset_list): New function.
6006         * powerpc.cc (Target_powerpc::got_size): Add const.
6007         (Target_powerpc::got_entry_count): New function.
6008         (Target_powerpc::plt_entry_count): New function.
6009         (Target_powerpc::first_plt_entry_offset): New function.
6010         (Target_powerpc::plt_entry_size): New function.
6011         (Output_data_plt_powerpc::entry_count): New function.
6012         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6013         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6014         * sparc.cc (Target_sparc::got_size): Add const.
6015         (Target_sparc::got_entry_count): New function.
6016         (Target_sparc::plt_entry_count): New function.
6017         (Target_sparc::first_plt_entry_offset): New function.
6018         (Target_sparc::plt_entry_size): New function.
6019         (Output_data_plt_sparc::entry_count): New function.
6020         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6021         (Output_data_plt_sparc::get_plt_entry_size): New function.
6022         * symtab.h (Symbol::got_offset_list): New function.
6023         (Symbol_table::for_all_symbols): New function.
6024         * target.h (Sized_target::got_entry_count): New function.
6025         (Sized_target::plt_entry_count): New function.
6026         (Sized_target::plt_entry_size): New function.
6027         * x86_64.cc (Target_x86_64::got_size): Add const.
6028         (Target_x86_64::got_entry_count): New function.
6029         (Target_x86_64::plt_entry_count): New function.
6030         (Target_x86_64::first_plt_entry_offset): New function.
6031         (Target_x86_64::plt_entry_size): New function.
6032         (Output_data_plt_x86_64::entry_count): New function.
6033         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6034         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6035
6036 2010-08-12  Cary Coutant  <ccoutant@google.com>
6037
6038         * archive.cc: Include incremental.h.
6039         (Archive::Archive): Initialize incremental_info_.
6040         (Archive::include_member): Record archive members in incremental info.
6041         (Add_archive_symbols::run): Record begin and end of an archive in
6042         incremental info.
6043         (Lib_group::include_member): Record objects in incremental info.
6044         * archive.h (Incremental_archive_entry): Forward declaration.
6045         (Archive::set_incremental_info): New member function.
6046         (Archive::incremental_info): New member function.
6047         (Archive::Unused_symbol_iterator): New class.
6048         (Archive::unused_symbols_begin): New member function.
6049         (Archive::unused_symbols_end): New member function.
6050         (Archive::incremental_info_): New data member.
6051         * incremental-dump.cc (find_input_containing_global): New function.
6052         (dump_incremental_inputs): Dump new incremental info sections.
6053         * incremental.cc: Include symtab.h.
6054         (Output_section_incremental_inputs): New class.
6055         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6056         new incremental info sections.
6057         (Sized_incremental_binary::do_check_inputs): Likewise.
6058         (Incremental_inputs::report_archive): Remove.
6059         (Incremental_inputs::report_archive_begin): New function.
6060         (Incremental_inputs::report_archive_end): New function.
6061         (Incremental_inputs::report_object): New function.
6062         (Incremental_inputs::finalize_inputs): Remove.
6063         (Incremental_inputs::report_input_section): New function.
6064         (Incremental_inputs::report_script): Rewrite.
6065         (Incremental_inputs::finalize): Do nothing but finalize string table.
6066         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6067         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6068         (Incremental_inputs::create_data_sections): New function.
6069         (Incremental_inputs::relocs_entsize): New function.
6070         (Output_section_incremental_inputs::set_final_data_size): New function.
6071         (Output_section_incremental_inputs::do_write): New function.
6072         (Output_section_incremental_inputs::write_header): New function.
6073         (Output_section_incremental_inputs::write_input_files): New function.
6074         (Output_section_incremental_inputs::write_info_blocks): New function.
6075         (Output_section_incremental_inputs::write_symtab): New function.
6076         * incremental.h (Incremental_script_entry): Forward declaration.
6077         (Incremental_object_entry): Forward declaration.
6078         (Incremental_archive_entry): Forward declaration.
6079         (Incremental_inputs): Forward declaration.
6080         (Incremental_inputs_header_data): Remove.
6081         (Incremental_inputs_header): Remove.
6082         (Incremental_inputs_header_write): Remove.
6083         (Incremental_inputs_entry_data): Remove.
6084         (Incremental_inputs_entry): Remove.
6085         (Incremental_inputs_entry_write): Remove.
6086         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6087         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6088         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6089         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6090         Likewise.
6091         (Incremental_input_entry): New class.
6092         (Incremental_script_entry): New class.
6093         (Incremental_object_entry): New class.
6094         (Incremental_archive_entry): New class.
6095         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6096         (Incremental_inputs::report_inputs): Remove.
6097         (Incremental_inputs::report_archive): Remove.
6098         (Incremental_inputs::report_archive_begin): New function.
6099         (Incremental_inputs::report_archive_end): New function.
6100         (Incremental_inputs::report_object): Change prototype.
6101         (Incremental_inputs::report_input_section): New function.
6102         (Incremental_inputs::report_script): Change prototype.
6103         (Incremental_inputs::get_reloc_count): New function.
6104         (Incremental_inputs::set_reloc_count): New function.
6105         (Incremental_inputs::create_data_sections): New function.
6106         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6107         (Incremental_inputs::inputs_section): New function.
6108         (Incremental_inputs::symtab_section): New function.
6109         (Incremental_inputs::relocs_section): New function.
6110         (Incremental_inputs::get_stringpool): Add const.
6111         (Incremental_inputs::command_line): Add const.
6112         (Incremental_inputs::inputs): Remove.
6113         (Incremental_inputs::command_line_key): New function.
6114         (Incremental_inputs::input_file_count): New function.
6115         (Incremental_inputs::input_files): New function.
6116         (Incremental_inputs::relocs_entsize): New function.
6117         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6118         (Incremental_inputs::finalize_inputs): Remove.
6119         (Incremental_inputs::Input_info): Remove.
6120         (Incremental_inputs::lock_): Remove.
6121         (Incremental_inputs::inputs_): Change type.
6122         (Incremental_inputs::inputs_map_): Remove.
6123         (Incremental_inputs::current_object_entry_): New data member.
6124         (Incremental_inputs::inputs_section_): New data member.
6125         (Incremental_inputs::symtab_section_): New data member.
6126         (Incremental_inputs::relocs_section_): New data member.
6127         (Incremental_inputs::reloc_count_): New data member.
6128         (Incremental_inputs_reader): New class.
6129         (Incremental_symtab_reader): New class.
6130         (Incremental_relocs_reader): New class.
6131         * layout.cc (Layout::finalize): Move finalization of incremental info
6132         and creation of incremental info sections to follow finalization of
6133         symbol table.  Set offsets for postprocessing sections.
6134         (Layout::create_incremental_info_sections): Call
6135         Incremental_inputs::create_data_sections.  Add incremental symtab
6136         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6137         sections to layout after input sections.
6138         * layout.h (struct Timespec): Forward declaration.
6139         (Layout::incremental_inputs): Add const.
6140         (Layout::create_incremental_info_sections): Add parameter.
6141         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6142         * object.cc: Include incremental.h.
6143         (Relobj::finalize_incremental_relocs): New function.
6144         (Sized_relobj::do_layout): Record input sections in incremental info.
6145         * object.h (Object::output_section): New function.
6146         (Object::output_section_offset): Moved from Relobj.
6147         (Object::get_incremental_reloc_base): New function.
6148         (Object::get_incremental_reloc_count): New function.
6149         (Object::do_output_section): New function.
6150         (Object::do_output_section_offset): Moved from Relobj.
6151         (Object::do_get_incremental_reloc_base): New function.
6152         (Object::do_get_incremental_reloc_count): New function.
6153         (Object::Object): Initialize new data members.
6154         (Relobj::output_section): Renamed do_output_section and moved to
6155         protected.
6156         (Relobj::output_section_offset): Moved to Object.
6157         (Relobj::do_get_incremental_reloc_base): New function.
6158         (Relobj::do_get_incremental_reloc_count): New function.
6159         (Relobj::allocate_incremental_reloc_counts): New function.
6160         (Relobj::count_incremental_reloc): New function.
6161         (Relobj::finalize_incremental_relocs): New function.
6162         (Relobj::next_incremental_reloc_index): New function.
6163         (Relobj::reloc_counts_): New data member.
6164         (Relobj::reloc_bases_): New data member.
6165         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6166         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6167         (Sized_relobj::incremental_relocs_scan): New function.
6168         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6169         (Sized_relobj::incremental_relocs_write): New function.
6170         (Sized_relobj::incremental_relocs_write_reltype): New function.
6171         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6172         incremental link.
6173         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6174         archives and object files elsewhere.
6175         (Add_symbols::run): Report object files here.
6176         (Finish_group::run): Report end of archive at end of group.
6177         * reloc.cc: Include layout.h, incremental.h.
6178         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6179         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6180         (Sized_relobj::incremental_relocs_scan): New function.
6181         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6182         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6183         (Sized_relobj::incremental_relocs_write): New function.
6184         (Sized_relobj::incremental_relocs_write_reltype): New function.
6185         * script.cc (read_input_script): Rewrite test for incremental link.
6186         Change call to Incremental_inputs::report_script.
6187         * symtab.h (Symbol_table::first_global_index): New function.
6188         (Symbol_table::output_count): New function.
6189
6190 2010-08-12  Doug Kwan  <dougkwan@google.com>
6191
6192         * arm.cc (Target_arm::merge_object_attributes): Check command line
6193         options --no-wchar-size-warning and --no-enum-size-warning.
6194         * options.h (General_options): Add ld-compatible options
6195         --no-enum-size-warning and --no-wchar-size-warning.
6196
6197 2010-08-04  Ian Lance Taylor  <iant@google.com>
6198
6199         * x86_64.cc (Target_x86_64::Scan::local): Use
6200         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6201         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6202         (Target_x86_64::Scan::global): Likewise.
6203         (Target_x86_64::Relocate::relocate): Likewise.
6204         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6205         Likewise.
6206
6207 2010-08-03  Cary Coutant  <ccoutant@google.com>
6208
6209         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6210         to reserve space in merged_strings vector. Keep total input size
6211         for stats.
6212         (Output_merge_string::do_print_merge_stats): Print total input size.
6213         * merge.h (Output_merge_string): Add input_size_ field.
6214         * stringpool.cc (Stringpool_template::string_length): Move
6215         implementations out of Stringpool_template class and place in
6216         stringpool.h.
6217         * stringpool.h (string_length): Move out of Stringpool_template.
6218
6219 2010-08-03  Ian Lance Taylor  <iant@google.com>
6220
6221         PR 11712
6222         * layout.cc (relaxation_loop_body): If address of load segment is
6223         set, adjust address to include headers if possible.
6224
6225 2010-08-03  Ian Lance Taylor  <iant@google.com>
6226
6227         * version.cc (version_string): Bump to 1.10.
6228
6229 2010-08-03  Ian Lance Taylor  <iant@google.com>
6230
6231         PR 11805
6232         * layout.h (enum Output_section_order): Define.
6233         (class Layout): Update declarations.
6234         * layout.cc (Layout::get_output_section): Add order parameter.
6235         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6236         is_first_non_relro parameters.  Change all callers.
6237         (Layout::choose_output_section): Likewise.
6238         (Layout::add_output_section_data): Likewise.
6239         (Layout::make_output_section): Likewise.  Set order.
6240         (Layout::default_section_order): New function.
6241         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6242         * output.cc (Output_section::Output_section): Initialize order_.
6243         Don't initialize deleted fields.
6244         (Output_segment::Output_segment): Don't initialize deleted
6245         fields.
6246         (Output_segment::add_output_section_to_load): New function
6247         replacing add_output_section.  Change all callers to call this or
6248         add_output_section_to_nonload.
6249         (Output_segment::add_output_section_to_nonload): New function.
6250         (Output_segment::remove_output_section): Rewrite.
6251         (Output_segment::add_initial_output_data): Likewise.
6252         (Output_segment::has_any_data_sections): Likewise.
6253         (Output_segment::is_first_section_relro): Likewise.
6254         (Output_segment::maximum_alignment): Likewise.
6255         (Output_segment::has_dynamic_reloc): New function replacing
6256         dynamic_reloc_count.  Change all callers.
6257         (Output_segment::has_dynamic_reloc_list): New function replacing
6258         dynamic_reloc_count_list.  Change all callers.
6259         (Output_segment::set_section_addresses): Rewrite.
6260         (Output_segment::set_offset): Rewrite.
6261         (Output_segment::find_first_and_last_list): Remove.
6262         (Output_segment::set_tls_offsets): Rewrite.
6263         (Output_segment::first_section_load_address): Likewise.
6264         (Output_segment::output_section_count): Likewise.
6265         (Output_segment::section_with_lowest_load_address): Likewise.
6266         (Output_segment::write_section_headers): Likewise.
6267         (Output_segment::print_sections_to_map): Likewise.
6268         * output.h (class Output_data): Remove dynamic_reloc_count_
6269         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6270         (Output_data::add_dynamic_reloc): Rewrite.
6271         (Output_data::has_dynamic_reloc): New function.
6272         (Output_data::dynamic_reloc_count): Remove.
6273         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6274         is_last_relro_, is_first_non_relro_, is_interp_,
6275         is_dynamic_linker_section_ fields.  Add order and set_order
6276         functions.  Remove is_relro_local, set_is_relro_local,
6277         is_last_relro, set_is_last_relro, is_first_non_relro,
6278         set_is_first_non_relro functions, is_interp, set_is_interp,
6279         is_dynamic_linker_section, and set_is_dynamic_linker_section
6280         functions.
6281         (class Output_segment): Change Output_data_list from std::list to
6282         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6283         output_bss_ fields.  Update declarations.
6284
6285 2010-08-02  Ian Lance Taylor  <iant@google.com>
6286
6287         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6288         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6289         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6290
6291 2010-08-02  Ian Lance Taylor  <iant@google.com>
6292
6293         PR 11855
6294         * script.cc (Script_options::Script_options): Initialize
6295         symbol_definitions_ and symbol_references_.
6296         (Script_options::add_symbol_assignment): Update
6297         symbol_definitions_ and symbol_references_.
6298         (Script_options::add_symbol_reference): New function.
6299         (script_symbol): New function.
6300         * script.h (class Script_options): Add symbol_definitions_ and
6301         symbol_references_ fields.
6302         (Script_options::referenced_const_iterator): New type.
6303         (Script_options::referenced_begin): New function.
6304         (Script_options::referenced_end): New function.
6305         (Script_options::is_referenced): New function.
6306         (Script_options::any_unreferenced): New function.
6307         * script-c.h (script_symbol): Declare.
6308         * yyscript.y (exp): Call script_symbol.
6309         * symtab.cc: Include "script.h".
6310         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6311         Change all callers.  Check symbols referenced by scripts.
6312         (Symbol_table::add_undefined_symbols_from_command_line): Add
6313         layout parameter.  Change all callers.
6314         (Symbol_table::do_add_undefined_symbols_from_command_line):
6315         Likewise.  Break out loop body.  Check symbols referenced by
6316         scripts.
6317         (Symbol_table::add_undefined_symbol_from_command_line): New
6318         function broken out of
6319         do_add_undefined_symbols_from_command_line.
6320         * symtab.h (class Symbol_table): Update declarations.
6321         * archive.cc: Include "layout.h".
6322         (Archive::should_include_member): Add layout parameter.  Change
6323         all callers.  Check for symbol mentioned in expression.
6324         * archive.h (class Archive): Update declaration.
6325         * object.cc (Sized_relobj::do_should_include_member): Add layout
6326         parameter.
6327         * object.h (Object::should_include_member): Add layout parameter.
6328         Change all callers.
6329         (Object::do_should_include_member): Add layout parameter.
6330         (class Sized_relobj): Update declaration.
6331         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6332         parameter.
6333         * dynobj.h (class Sized_dynobj): Update declaration.
6334         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6335         layout parameter.
6336         * plugin.h (class Sized_pluginobj): Update declaration.
6337
6338 2010-08-02  Ian Lance Taylor  <iant@google.com>
6339
6340         PR 11866
6341         * output.cc (Output_segment::set_offset): Search for the first and
6342         last sections rather than assuming that the list is in order.
6343         (Output_segment::find_first_and_last_list): New function.
6344         * output.h (class Output_segment): Update declarations.
6345         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6346         (relro_strip_test_SOURCES): New variable.
6347         (relro_strip_test_DEPENDENCIES): New variable.
6348         (relro_strip_test_LDFLAGS): New variable.
6349         (relro_strip_test_LDADD): New variable.
6350         (relro_strip_test.so): New target.
6351
6352 2010-08-02  Ian Lance Taylor  <iant@google.com>
6353
6354         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6355         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6356         (Target_i386::got_tlsdesc_section): New function.
6357         (Target_i386::got_section): Create space for GOT entries for
6358         TLSDESC relocations.
6359         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6360         R_386_TLS_GOTDESC.
6361         (Target_i386::Scan::global): Likewise.
6362         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6363         using TLSDESC GOT.
6364         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6365         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6366         (Target_x86_64::got_tlsdesc_section): New function.
6367         (Target_x86_64::got_section): Create space for GOT entries for
6368         TLSDESC relocations.
6369         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6370         R_386_TLS_GOTDESC.
6371         (Target_x86_64::Scan::global): Likewise.
6372         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6373         using TLSDESC GOT.
6374
6375 2010-08-02  Ian Lance Taylor  <iant@google.com>
6376
6377         * testsuite/final_layout.sh: Use dc to convert from hex to
6378         decimal.
6379
6380 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6381
6382         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6383         paramter to the call to gold::gc_process_relocs.
6384         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6385         paramter to the call to gold::gc_process_relocs.
6386         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6387         parameter to the call to gold::gc_process_relocs.
6388         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6389         template parameter to the call to gold::gc_process_relocs.
6390         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6391         paramter to the call to gold::gc_process_relocs.
6392         * gc.h (get_embedded_addend_size): New function.
6393         (gc_process_relocs): Save the size of the reloc for use by ICF.
6394         * icf.cc (get_section_contents): Get the addend from the text section
6395         for SHT_REL relocation sections.
6396         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6397         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6398         * int_encoding.h (read_from_pointer): New overloaded function.
6399         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6400         * testsuite/icf_sht_rel_addend_test.sh: New file.
6401         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6402         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6403
6404 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6405
6406         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6407         * Makefile.in: Regenerate.
6408         * testsuite/Makefile.in: Regenerate.
6409
6410 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6411
6412         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6413         * gold/testsuite/debug_msg.cc: Likewise.
6414         * gold/testsuite/odr_violation1.cc
6415         * gold/testsuite/odr_violation2.cc
6416
6417 2010-07-21  Cary Coutant  <ccoutant@google.com>
6418
6419         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6420         string, and length fields.
6421         (Output_merge_string::Merged_strings_list): New type.
6422         (Output_merge_string::Merged_strings_lists): New typedef.
6423         (Output_merge_string): Replace merged_strings_ with
6424         merged_strings_lists_.
6425         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6426         Merged_strings_list per input object and section.  Don't store pointer
6427         to the string.  Don't store length with each merged string entry.
6428         (Output_merge_string::finalize_merged_data): Loop over list of merged
6429         strings lists.  Recompute length of each merged string.
6430
6431 2010-07-15  Cary Coutant  <ccoutant@google.com>
6432
6433         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6434         here.
6435
6436 2010-07-14  Ian Lance Taylor  <iant@google.com>
6437
6438         * descriptors.cc (Descriptors::open): Report correct name in error
6439         message.
6440
6441 2010-07-13  Doug Kwan  <dougkwan@google.com>
6442
6443         * arm.cc (Arm_input_section::Arm_input_section): For a
6444         SHT_ARM_EXIDX section, always keeps the input sections.
6445         (Arm_input_section::set_exidx_section_link): New method.
6446         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6447         has_errors_ to false.
6448         (Arm_exidx_input_section::has_errors,
6449         Arm_exidx_input_section::set_has_errors): New methods.
6450         (Arm_exidx_input_section::has_errors_): New data member.
6451         (Arm_relobj::get_exidx_shndx_list): New method.
6452         (Arm_output_section::append_text_sections_to_list): Do not skip
6453         section without SHF_EXECINSTR.
6454         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6455         errors.
6456         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6457         section header.  Make error messages more verbose.  Check for
6458         a non-executable section linked to an EXIDX section.
6459         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6460         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6461         check that there is no deferred EXIDX section if we exit early.
6462         Instead of not making an EXIDX section in case of an error, make one
6463         and set the has_errors flag of it.
6464         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6465         in a relocatable link.
6466         (Target_arm::do_relax): Look for the EXIDX output section instead of
6467         assuming that it is called .ARM.exidx.
6468         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6469         section list.  Do not check for SHF_EXECINSTR section flags but
6470         skip any input section with errors.
6471         * output.cc (Output_section::Output_section): Initialize
6472         always_keeps_input_sections_ to false.
6473         (Output_section::add_input_section): Check for
6474         always_keeps_input_sections_.
6475         *  output.h (Output_section::always_keeps_input_sections,
6476         Output_section::set_always_keeps_input_sections): New methods.
6477         (Output_section::always_keeps_input_sections): New data member.
6478
6479 2010-07-13  Rafael Espindola  <espindola@google.com>
6480
6481         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6482         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6483
6484 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6485             Ian Lance Taylor  <iant@google.com>
6486
6487         * output.h (Output_section_lookup_maps::add_merge_section):
6488         Correct check of whether value was inserted.
6489         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6490         (Output_section_lookup_maps::add_relaxed_input_section):
6491         Likewise.
6492         * arm.cc (Target_arm::got_section): Remove used local os.
6493         * i386.cc (Target_i386::got_section): Likewise.
6494         * x86_64.cc (Target_x86_64::got_section): Likewise.
6495         * sparc.cc (Target_sparc::got_section): Likewise.
6496         (Target_sparc::relocate): Remove unused local have_got_offset.
6497         * powerpc.cc (Target_powerpc::relocate): Likewise.
6498
6499 2010-07-13  Ian Lance Taylor  <iant@google.com>
6500
6501         * compressed_output.cc (zlib_decompress): Fix signature in
6502         !HAVE_ZLIB_H case.
6503
6504         * archive.cc (Archive::include_member): Unlock an external member
6505         of a thin archive.  Don't bother to delete an object we know is
6506         NULL.
6507
6508 2010-07-12  Cary Coutant  <ccoutant@google.com>
6509
6510         * compressed_output.cc (zlib_decompress): New function.
6511         (get_uncompressed_size): New function.
6512         (decompress_input_section): New function.
6513         * compressed_output.h (get_uncompressed_size): New function.
6514         (decompress_input_section): New function.
6515         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6516         Handle compressed debug sections.
6517         * layout.cc (is_compressed_debug_section): New function.
6518         (Layout::output_section_name): Map compressed section names to
6519         canonical names.
6520         * layout.h (is_compressed_debug_section): New function.
6521         (is_debug_info_section): Recognize compressed debug sections.
6522         * merge.cc: Include compressed_output.h.
6523         (Output_merge_data::do_add_input_section): Handle compressed
6524         debug sections.
6525         (Output_merge_string::do_add_input_section): Handle compressed
6526         debug sections.
6527         * object.cc: Include compressed_output.h.
6528         (Sized_relobj::Sized_relobj): Initialize new data members.
6529         (build_compressed_section_map): New function.
6530         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6531         * object.h (Object::section_is_compressed): New method.
6532         (Object::do_section_is_compressed): New method.
6533         (Sized_relobj::Compressed_section_map): New type.
6534         (Sized_relobj::do_section_is_compressed): New method.
6535         (Sized_relobj::compressed_sections_): New data member.
6536         * output.cc (Output_section::add_input_section): Handle compressed
6537         debug sections.
6538         * reloc.cc: Include compressed_output.h.
6539         (Sized_relobj::write_sections): Handle compressed debug sections.
6540
6541 2010-07-08  Cary Coutant  <ccoutant@google.com>
6542
6543         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6544         weak when resolving to a dynamic def.
6545         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6546         for weak undef/dynamic def cases. Adjust callers.
6547         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6548         undef_binding_weak_.
6549         (Symbol_table::sized_write_globals): Adjust symbol binding.
6550         (Symbol_table::sized_write_symbol): Add binding parameter.
6551         * symtab.h (Symbol::set_undef_binding): New method.
6552         (Symbol::is_undef_binding_weak): New method.
6553         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6554         (Symbol_table::should_override): Add new parameter.
6555         (Symbol_table::sized_write_symbol): Add new parameter.
6556
6557         * testsuite/weak_undef_file1.cc: Add new test case.
6558         * testsuite/weak_undef_file2.cc: Fix header comment.
6559         * testsuite/weak_undef_test.cc: Add new test case.
6560
6561 2010-06-29  Doug Kwan  <dougkwan@google.com>
6562
6563         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6564         Initialize USE_SYMBOL_.
6565         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6566         definition.
6567         (Arm_reloc_property::uses_symbol_): New data member declaration.
6568         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6569         uses symbol value and symbol is undefined but not weakly undefined.
6570
6571 2010-06-28  Rafael Espindola  <espindola@google.com>
6572
6573         * plugin.cc (Plugin::load): Use dlerror.
6574
6575 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6576
6577         * symtab.cc (detect_odr_violations): When reporting an ODR
6578         violation, report an object where the symbol is defined.
6579
6580 2010-06-25  Doug Kwan  <dougkwan@google.com>
6581
6582         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6583         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6584         definition.
6585         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6586         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6587         target hook to detect function points.
6588         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6589         * icf.h (Icf::check_section_for_function_pointers): Change type of
6590         parameter SECTION_NAME to const reference to std::string.  Use
6591         target hook to determine if section may have unsafe pointers.
6592         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6593         method definition.
6594
6595 2010-06-21  Rafael Espindola  <espindola@google.com>
6596
6597         * fileread.cc (Input_file::find_fie): New
6598         (Input_file::open): Use Input_file::find_fie.
6599         * fileread.h (Input_file::find_fie): New
6600         * plugin.cc (set_extra_library_path): New.
6601         (Plugin::load): Add set_extra_library_path to the transfer vector.
6602         (Plugin_manager::set_extra_library_path): New.
6603         (Plugin_manager::add_input_file): Use the extra search path if set.
6604         (set_extra_library_path(): New.
6605         * plugin.h (Plugin_manager): Add set_extra_library_path and
6606         extra_search_path_.
6607
6608 2010-06-19  Cary Coutant  <ccoutant@google.com>
6609
6610         * layout.cc (gdb_sections): Add .debug_types.
6611         (lines_only_debug_sections): Likewise.
6612
6613 2010-06-18  Rafael Espindola  <espindola@google.com>
6614
6615         * plugin.cc (add_input_file,add_input_library)
6616         (Plugin_manager::add_input_file): Make filename arguments const.
6617         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6618         const.
6619
6620 2010-06-16  Doug Kwan  <dougkwan@google.com>
6621
6622         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6623         .ARM.attributes section if we have not merged any input
6624         attributes sections.
6625
6626 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6627
6628         * arm.cc: Allow combining objects with no EABI version
6629         information.
6630
6631 2010-06-15  Rafael Espindola  <espindola@google.com>
6632
6633         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6634
6635 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6636
6637         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6638         (struct iovec): Correct !HAVE_READV definition.
6639
6640 2010-06-10  Cary Coutant  <ccoutant@google.com>
6641
6642         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6643         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6644         reloc sections.
6645         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6646
6647         PR 11683
6648         * symtab.h (Symbol::is_placeholder): New member function.
6649         * target-reloc.h (relocate_section): Check for placeholder symbols.
6650
6651         * testsuite/Makefile.am (plugin_test_8): New test.
6652         (plugin_test_9): New test.
6653         * testsuite/Makefile.in: Regenerate.
6654
6655 2010-06-09  Nick Clifton  <nickc@redhat.com>
6656
6657         * yyscript.y (input_list_element): Allow strings prefixed with
6658         the '-' character.  Treat these as libraries.
6659         * script.cc (script_add_library): New function.  Adds a library
6660         specified by "-l<name>" found in an input script.
6661         * script-c.h: Add prototype for script_add_library.
6662
6663 2010-06-07  Doug Kwan  <dougkwan@google.com>
6664
6665         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6666         Restrict stub-group size to be within long conditional branch
6667         range when working around cortex-A8 erratum.
6668
6669 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6670
6671         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6672         #ifdef typo.
6673
6674 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6675
6676         PR gold/11658
6677         * output.cc
6678         (Output_section::Input_section_sort_entry::compare_section_ordering):
6679         Change to return non-zero correctly.
6680         (Output_section::Input_section_sort_section_order_index_compare
6681         ::operator()): Change to fix ambiguity in comparisons.
6682
6683 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6684
6685         * gold.h (is_wildcard_string): New function.
6686         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6687         (Layout::layout_eh_frame): Ditto.
6688         (Layout::find_section_order_index): New method.
6689         (Layout::read_layout_from_file): New method.
6690         * layout.h (Layout::find_section_order_index): New method.
6691         (Layout::read_layout_from_file): New method.
6692         (Layout::input_section_position_): New private member.
6693         (Layout::input_section_glob_): New private member.
6694         * main.cc (main): Call read_layout_from_file here.
6695         * options.h (--section-ordering-file): New option.
6696         * output.cc (Output_section::input_section_order_specified_): New
6697         member.
6698         (Output_section::Output_section): Initialize new member.
6699         (Output_section::add_input_section): Add new parameter.
6700         Keep input sections when --section-ordering-file is used.
6701         (Output_section::set_final_data_size): Sort input sections when
6702         section ordering file is specified.
6703         (Output_section::Input_section_sort_entry): Add new parameter.
6704         Check sorting type.
6705         (Output_section::Input_section_sort_entry::compare_section_ordering):
6706         New method.
6707         (Output_section::Input_section_sort_compare::operator()): Change to
6708         consider section_order_index.
6709         (Output_section::Input_section_sort_init_fini_compare::operator()):
6710         Change to consider section_order_index.
6711         (Output_section::Input_section_sort_section_order_index_compare
6712         ::operator()): New method.
6713         (Output_section::sort_attached_input_sections): Change to sort
6714         according to section order when specified.
6715         (Output_section::add_input_section<32, true>): Add new parameter.
6716         (Output_section::add_input_section<64, true>): Add new parameter.
6717         (Output_section::add_input_section<32, false>): Add new parameter.
6718         (Output_section::add_input_section<64, false>): Add new parameter.
6719         * output.h (Output_section::add_input_section): Add new parameter.
6720         (Output_section::input_section_order_specified): New
6721         method.
6722         (Output_section::set_input_section_order_specified): New method.
6723         (Input_section::Input_section): Initialize section_order_index_.
6724         (Input_section::section_order_index): New method.
6725         (Input_section::set_section_order_index): New method.
6726         (Input_section::section_order_index_): New member.
6727         (Input_section::Input_section_sort_section_order_index_compare): New
6728         struct.
6729         (Output_section::input_section_order_specified_): New member.
6730         * script-sections.cc (is_wildcard_string): Delete and move modified
6731         method to gold.h.
6732         (Output_section_element_input::Output_section_element_input): Modify
6733         call to is_wildcard_string.
6734         (Output_section_element_input::Input_section_pattern
6735         ::Input_section_pattern): Ditto.
6736         (Output_section_element_input::Output_section_element_input): Ditto.
6737         * testsuite/Makefile.am (final_layout): New test case.
6738         * testsuite/Makefile.in: Regenerate.
6739         * testsuite/final_layout.cc: New file.
6740         * testsuite/final_layout.sh: New file.
6741
6742 2010-06-01  Rafael Espindola  <espindola@google.com>
6743
6744         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6745
6746 2010-06-01  Rafael Espindola  <espindola@google.com>
6747
6748         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6749         visibility of symbols.
6750
6751 2010-05-27  Doug Kwan  <dougkwan@google.com>
6752
6753         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6754         from start of output section instead of address for a local symbol
6755         in a merged or relaxed section when doing a relocatable link.
6756
6757 2010-05-26  Rafael Espindola  <espindola@google.com>
6758
6759         PR 11604
6760         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6761         adding sections the garbage collector removed.
6762         * gold/testsuite/Makefile.am: Add test.
6763         * gold/testsuite/Makefile.in: Regenerate.
6764         * gold/testsuite/plugin_test_7.sh: New.
6765         * gold/testsuite/plugin_test_7_1.c: New.
6766         * gold/testsuite/plugin_test_7_2.c: New.
6767
6768 2010-05-26  Rafael Espindola  <espindola@google.com>
6769
6770         * script-sections.cc (Output_section_definition::set_section_addresses):
6771         Check for --section-start.
6772
6773 2010-05-26  Doug Kwan  <dougkwan@google.com>
6774
6775         * arm.cc (Arm_scan_relocatable_relocs): New class.
6776         (Target_arm::relocate_special_relocatable): New method.
6777         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6778         (Arm_relocate_functions::thumb_branch_common): Same.
6779         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6780         instead of Default_scan_relocatable_relocs.
6781         * target-reloc.h (relocate_for_relocatable): Let target handle
6782         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6783         * target.h (Sized_target::relocate_special_relocatable): New method.
6784
6785 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6786
6787         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6788
6789 2010-05-23  Doug Kwan  <dougkwan@google.com>
6790
6791         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6792         instead of a cast.
6793         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6794         with a direct branch, not a conditional branch, to a stub.
6795         * merge.cc (Output_merge_base::record_input_section): New method
6796         defintion.
6797         (Output_merge_data::do_add_input_section): Record input section if
6798         keeps-input-sections flag is set.
6799         (Output_merge_string::do_add_input_section): Ditto.
6800         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6801         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6802         INPUT_SECTIONS_.
6803         (Output_merge_base::keeps_input_sections,
6804         Output_merge_base::set_keeps_input_sections,
6805         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6806         method definitions.
6807         (Output_merge_base::Input_sections): New type declaration.
6808         (Output_merge_base::input_sections_begin,
6809         Output_merge_base::input_sections_end,
6810         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6811         (Output_merge_base::bool keeps_input_sections_,
6812         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6813         Output_merge_base::input_sections_): New data members.
6814         (Output_merge_data::do_set_keeps_input_sections): New method
6815         defintion.
6816         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6817         * output.cc (Output_section::Input_section::relobj): Move method
6818         defintion from class declaration to here and handle merge sections.
6819         (Output_section::Input_section::shndx): Ditto.
6820         (Output_section::Output_section): Remove initializations of removed
6821         data members and initialize new data member LOOKUP_MAPS_.
6822         (Output_section::add_input_section): Set keeps-input-sections flag
6823         for a newly created merge output section as appropriate.  Adjust code
6824         to use Output_section_lookup_maps class.
6825         (Output_section::add_relaxed_input_section): Adjst code for lookup
6826         maps code refactoring.
6827         (Output_section::add_merge_input_section): Add a new parameter
6828         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6829         class.  If adding input section to a newly created merge output
6830         section fails, remove the new merge section.
6831         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6832         Adjust code for use of the Output_section_lookup_maps class.
6833         (Output_section::find_merge_section): Ditto.
6834         (Output_section::build_lookup_maps): New method defintion.
6835         (Output_section::find_relaxed_input_section): Adjust code to use
6836         Output_section_lookup_maps class.
6837         (Output_section::get_input_sections): Export merge sections.  Adjust
6838         code to use Output_section_lookup_maps class.
6839         (Output_section:::add_script_input_section): Adjust code to use
6840         Output_section_lookup_maps class.  Update lookup maps for merge
6841         sections also.
6842         (Output_section::discard_states): Use Output_section_lookup_maps.
6843         (Output_section::restore_states): Same.
6844         * output.h (Merge_section_properties): Move class defintion out of
6845         Output_section.
6846         (Output_section_lookup_maps): New class.
6847         (Output_section::Input_section::is_merge_section): New method
6848         defintion.
6849         (Output_section::Input_section::relobj): Move defintion out of class
6850         defintion.  Declare method only.
6851         (Output_section::Input_section::shndx): Ditto.
6852         (Output_section::Input_section::output_merge_base): New method defintion.
6853         (Output_section::Input_section::u2_.pomb): New union field.
6854         (Output_section::Merge_section_by_properties_map,
6855         Output_section::Output_section_data_by_input_section_map,
6856         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6857         Remove types.
6858         (Output_section::add_merge_input_section): Add new parameter
6859         KEEPS_INPUT_SECTIONS.
6860         (Output_section::build_lookup_maps): New method declaration.
6861         (Output_section::merge_section_map_,
6862         Output_section::merge_section_by_properties_map_,
6863         Output_section::relaxed_input_section_map_,
6864         Output_section::is_relaxed_input_section_map_valid_): Remove data
6865         members.
6866         (Output_section::lookup_maps_): New data member.
6867
6868 2010-05-21  Doug Kwan  <dougkwan@google.com>
6869
6870         PR gold/11619
6871         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6872         avoid a compilation error.
6873
6874 2010-05-19  Rafael Espindola  <espindola@google.com>
6875
6876         * script-sections.cc (Output_section_definition::allocate_to_segment):
6877         Update the phdrs_list even when the output section is NULL.
6878         * testsuite/Makefile.am: Add test.
6879         * testsuite/Makefile.in: Regenerate.
6880         * testsuite/script_test_9.cc: New.
6881         * testsuite/script_test_9.sh: New.
6882         * testsuite/script_test_9.t: New.
6883
6884 2010-05-19  Doug Kwan  <dougkwan@google.com>
6885
6886         * arm.cc (Arm_input_section::original_size): New method.
6887         (Arm_input_section::do_addralign): Add a cast.
6888         (Arm_input_section::do_output_offset): Remove static cast.
6889         (Arm_input_section::original_addralign,
6890          Arm_input_section::original_size_): Change type to uint32_t.
6891         (Arm_input_section::init): Add safe casts for section alignment
6892         and size.
6893         (Arm_input_section::set_final_data_size): Do not set address and
6894         offset of stub table.
6895         (Arm_output_section::fix_exidx_coverage): Change use of of
6896         Output_section::Simple_input_section to that of
6897         Output_section::Input_section.
6898         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6899         except for the first pass.
6900         * output.cc (Output_section::get_input_sections): Change type of
6901         input_sections to std::list<Input_section>.
6902         (Output_section::add_script_input_section): Rename from
6903         Output_section::add_simple_input_section.  Change type of SIS
6904         parameter from Simple_input_section to Input_section.
6905         * output.h (Output_section::Simple_input_section): Remove class.
6906         (Output_section::Input_section): Change class visibility to public.
6907         (Output_section::Input_section::addralign): Use stored alignments
6908         for special input sections if set.
6909         (Output_section::Input_section::set_addralign): New method.
6910         (Output_section::get_input_sections): Change parameter type from
6911         list of Simple_input_section to list of Input_section.
6912         (Output_section::add_script_input_section): Rename from
6913         Output_section::add_simple_input_section. Change first parameter's
6914         type from Simple_input_section to Input_section and remove the
6915         second and third parameters.
6916         * script-sections.cc (Input_section::Input_section_list): Change
6917         type to list of Output_section::Input_section/
6918         (Input_section_info::Input_section_info): Change parameter type of
6919         INPUT_SECTION to Output_section::Input_section.
6920         (Input_section_info::input_section): Change return type.
6921         (Input_section_info::input_section_): Change type to
6922         Output_section::Input_section.
6923         (Output_section_element_input::set_section_addresses): Adjust code
6924         to use Output_section::Input_section instead of
6925         Output_section::Simple_input_section.  Adjust code for renaming
6926         of Output_section::add_simple_input_section.
6927         (Orphan_output_section::set_section_addresses): Ditto.
6928
6929 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6930
6931         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6932         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6933
6934 2010-05-18  Rafael Espindola  <espindola@google.com>
6935
6936         * options.cc (General_options::finalize): Handle -nostdlib.
6937         * options.h (nostdlib): New option.
6938         * script.cc (script_add_search_dir): Handle -nostdlib.
6939
6940 2010-05-12  Doug Kwan  <dougkwan@google.com>
6941
6942         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6943         attributes section only if there no attributes section after merging.
6944         (Target_arm::merge_object_attributes): Move value of
6945         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6946         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6947         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6948         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6949         and arm_attr_merge_7.stdout.
6950         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6951         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6952         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6953         arm_attr_merge_7b.o): New rules.
6954         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6955         arm_attr_merge_7
6956         * testsuite/Makefile.in: Regenerate.
6957         * testsuite/arm_attr_merge.sh: New file.
6958         * testsuite/arm_attr_merge_[67][ab].s: Same.
6959
6960 2010-05-05  Nick Clifton  <nickc@redhat.com>
6961
6962         * po/es.po: Updated Spanish translation.
6963
6964 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6965
6966         * Makefile.am (install-exec-local): Properly install gold as
6967         default cross linker.
6968         * Makefile.in: Regenerated.
6969
6970 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6971             Nick Clifton  <nickc@redhat.com>
6972
6973         * configure.ac (install_as_default): Define and set to false
6974         unless --enable-gold or --enable-gold=both/gold has been
6975         specified.
6976         * configure: Regenerate.
6977
6978         * Makefile.am (install-exec-local): Install the executable as
6979         'ld.gold'.  If install_as_default is true then also install it as
6980         'ld'.
6981         * Makefile.in: Regenerated.
6982
6983 2010-04-24  Ian Lance Taylor  <iant@google.com>
6984
6985         * layout.cc (Layout::layout_reloc): In relocatable link don't
6986         combine reloc sections for grouped sections.
6987
6988 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6989
6990         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6991         sections that are not ordinary to icf.
6992         * icf.cc (get_section_contents): Handle relocation pointing to section
6993         with no object or shndx information.
6994         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6995         * testsuite/Makefile.in: Regenerate.
6996         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6997         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6998
6999 2010-04-22  Ian Lance Taylor  <iant@google.com>
7000
7001         * expression.cc (Expression::Expression_eval_info): Add
7002         result_alignment_pointer field.
7003         (Expression::eval_with_dot): Add result_alignment_pointer
7004         parameter.  Change all callers.
7005         (Expression::eval_maybe_dot): Likewise.
7006         (class Binary_expression): Add alignment_pointer parameter to
7007         left_value and right_value.  Change all callers.
7008         (BINARY_EXPRESSION): Set result alignment.
7009         (class Trinary_expression): Add alignment_pointer parameter to
7010         arg2_value and arg3_value.  Change all callers.
7011         (Trinary_cond::value): Set result alignment.
7012         (Max_expression::value, Min_expression::value): Likewise.
7013         (Align_expression::value): Likewise.
7014         * script-sections.cc (class Sections_element): Add dot_alignment
7015         parameter to set_section_addresses virtual function.  Update
7016         instantiations.
7017         (class Output_section_element): Likewise.
7018         (Script_sections::create_segments): Add dot_alignment parameter.
7019         Change all callers.
7020         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7021         (Script_sections::set_phdrs_clause_addresses): Likewise.
7022         * script-sections.h: Update declarations.
7023         * script.h: Update declarations.
7024         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7025         min_p_align.
7026         * testsuite/script_test_3.t: Set large alignment.
7027         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7028         segment has expected alignment.
7029
7030 2010-04-22  Nick Clifton  <nickc@redhat.com>
7031
7032         * po/gold.pot: Updated by the Translation project.
7033         * po/vi.po: Updated Vietnamese translation.
7034
7035 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7036
7037         * testsuite/Makefile.am (check_PROGRAMS): Add
7038         icf_virtual_function_folding_test.
7039         * testsuite/Makefile.in: Regenerated.
7040
7041 2010-04-15  Andrew Haley  <aph@redhat.com>
7042
7043         * options.h (merge_exidx_entries): New option.
7044         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7045         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7046         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7047         (Target_arm::merge_exidx_entries): New function.
7048         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7049         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7050         to Arm_exidx_fixup constructor.
7051         Add new arg, merge_exidx_entries.
7052         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7053         Arm_output_section::fix_exidx_coverage.
7054
7055 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7056
7057         * icf.cc (get_section_contents): Check for preemptible functions.
7058         Ignore addend when appropriate.
7059         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7060         section folded.
7061         (add_from_relobj): Check for section folded.
7062         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7063         * symtab.h (should_add_dynsym_entry): Add new parameter.
7064         * target-reloc.h (scan_relocs): Check for section folded.
7065         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7066         Check reloc types for function pointers in shared objects.
7067         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7068         case.
7069         (icf_preemptible_functions_test): New test case.
7070         (icf_string_merge_test): New test case.
7071         * testsuite.Makefile.in: Regenerate.
7072         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7073         bar_glob.  Refactor code.
7074         * testsuite/icf_preemptible_functions_test.cc: New file.
7075         * testsuite/icf_preemptible_functions_test.sh: New file.
7076         * testsuite/icf_string_merge_test.cc: New file.
7077         * testsuite/icf_string_merge_test.sh: New file.
7078         * testsuite/icf_virtual_function_folding_test.cc: New file.
7079         * testsuite/icf_virtual_function_folding_test.sh: New file.
7080
7081 2010-04-14  Doug Kwan  <dougkwan@google.com>
7082
7083         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7084         for local symbol recounting if we remove a section due to ICF.
7085         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7086         there are no regular objects in input.
7087
7088 2010-04-13  Doug Kwan  <dougkwan@google.com>
7089
7090         * arm.cc (Arm_input_section::set_final_data_size): Compute
7091         accurate final data size instead of using current data size.
7092
7093 2010-04-09  Doug Kwan  <dougkwan@google.com>
7094
7095         * layout.cc (Layout::choose_output_section): Handle script section
7096         types.
7097         (Layout::make_output_section_for_script): Add section type parameter.
7098         Handle script section types.
7099         * layout.h (Layout::make_output_section_for_script): Add section
7100         type parameter.
7101         * output.cc (Output_section::Output_section): Initialize data member
7102         is_noload_.
7103         (Output_section::do_reset_address_and_file_offset): Do not set address
7104         to 0 if section is a NOLOAD section.
7105         * output.h (Output_section::is_noload): New method.
7106         (Output_section::set_is_noload): Ditto.
7107         (Output_section::is_noload_): New data member.
7108         * script-c.h (Script_section_type): New enum type.
7109         (struct Parser_output_section_header): Add new file section_type.
7110         * script-sections.cc (Sections_element::output_section_name): Add
7111         parameter for returning script section type.
7112         (Output_section_definition::output_section_name): Ditto.
7113         (Output_section_definition::section_type)P; New method.
7114         (Output_section_definiton::script_section_type_name): Ditto.
7115         (Output_section_definition::script_section_type_): New data member.
7116         (Output_section_definition::Output_section_definition): Initialize
7117         data member Output_section_definition::script_section_type_.
7118         (Output_section_definition::create_sections): Pass script section type
7119         to Layout::make_output_section_for_script.
7120         (Output_section_definition::output_section_name): Return script
7121         section type to caller.
7122         (Output_section_definition::set_section_address): Do not advance
7123         dot value and load address if section type is NOLOAD.  Set address
7124         of NOLOAD sections regardless of section flags.
7125         (Output_section_definition::print): Print section type if it is
7126         not SCRIPT_SECTION_TYPE_NONE.
7127         (Output_section_definition::section_type): New method.
7128         (Output_section_definition::script_section_type_name): Ditto.
7129         (Script_sections::output_section_name): Add new parameter
7130         PSECTION_TYPE for returning script section type.  Pass it to
7131         section elements.  Handle discard sections.
7132         (Sort_output_sections::operator()): Handle NOLOAD sections.
7133         * script-sections.h (Script_sections::Section_type): New enum type.
7134         (Script_sections::output_section_name): Add a new parameter for
7135         returning script section type.
7136         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7137         INFO and NOLOAD.
7138         * yyscript.y (union): Add new field SECTION_TYPE.
7139         (COPY, DSECT, INFO, NOLOAD): New tokens.
7140         (opt_address_and_section_type): Change type to output_section_header.
7141         (section_type): New non-terminal
7142         (section_header): Handle section type.
7143         (opt_address_and_section_type): Return section type value.
7144
7145 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7146
7147         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7148         * testsuite/plugin_common_test_2.c (foo): Likewise.
7149
7150 2010-04-08  Doug Kwan  <dougkwan@google.com>
7151
7152         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7153         Output_merge_data.
7154         * output.cc (Output_section::add_merge_input_section): Simplify
7155         code and return status of Output_merge_base::add_input_section.
7156         Update merge section map only if Output_merge_base::add_input_section
7157         returns true.
7158
7159 2010-04-07  Doug Kwan  <dougkwan@google.com>
7160
7161         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7162         if section is marked as containing instructions but has no mapping
7163         symbols.
7164         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7165         correct section index.
7166         (Arm_relobj::find_linked_text_section): Ditto.
7167
7168 2010-04-07  Cary Coutant  <ccoutant@google.com>
7169
7170         * archive.cc (include_member): Destroy Read_symbols_data object before
7171         releasing file.
7172         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7173         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7174         (Read_symbols_data::~Read_symbols_data) New destructor.
7175         (Section_relocs::Section_relocs) New constructor.
7176         (Section_relocs::~Section_relocs) New destructor.
7177         (Read_relocs_data::Read_relocs_data) New constructor.
7178         (Read_relocs_data::~Read_relocs_data) New destructor.
7179         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7180         pointers to NULL after deleting.
7181
7182 2010-04-07  Doug Kwan  <dougkwan@google.com>
7183
7184         * arm.cc: Replace "endianity" with "endianness" in comments.
7185         (Arm_exidx_cantunwind): Ditto.
7186         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7187         (Arm_relobj::merge_flags_and_attributes): New method.
7188         (Arm_relobj::merge_flags_and_attributes_): New data member.
7189         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7190         (Arm_relobj::scan_sections_for_stubs): Ditto.
7191         (Arm_relobj::do_read_symbols): Check to see if we really want to
7192         merge processor-specific flags and attributes.  Exit early if
7193         an object is empty except for section names and the undefined symbol.
7194         (Target_arm::do_finalize_sections): Move check for ELF format to
7195         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7196         attributes from a regular object only when we have determined that
7197         it is aapropriate.  Do not create an .ARM.attributes section in
7198         output if there is no regular input object.
7199         (Target_arm::merge_processor_specific_flags): Check
7200         --warn-mismatch before printing any error.
7201         (Target_arm::merge_object_attributes): Ditto.
7202         * gold.cc (queue_middle_tasks): Handle the case in which there is
7203         no regular object in input.
7204         * options.cc (General_options::parse_EB): New method.
7205         (General_options::parse_EL): Same.
7206         (General_options::General_options): Initialize endianness_.
7207         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7208         New options.
7209         (General_options::Endianness): New enum.
7210         (General_options::endianness): New method.
7211         (General_options::endianness_): New data member.
7212         * parameters.cc (Parameters::set_options): Check target endianness.
7213         (Parameters::set_target_once): Ditto.
7214         (Parameters::check_target_endianness): New method.
7215         (parameters_force_valid_target): If either -EL or -EB is specified,
7216         use it to define endianness of default target.
7217         * parameters.h (Parameters::check_target_endianness): New method
7218         declaration.
7219         * target.h (class Target): Change "endianity" to "endianness"
7220         in comments.
7221
7222 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7223
7224         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7225         * configure: Regenerate.
7226         * Makefile.in: Regenerate.
7227         * testsuite/Makefile.in: Regenerate.
7228
7229 2010-04-06  Cary Coutant  <ccoutant@google.com>
7230
7231         gcc PR lto/42757
7232         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7233         prevailing definitions of common symbols.
7234         * testsuite/plugin_test_6.sh: New test case.
7235         * testsuite/plugin_common_test_1.c: New test case.
7236         * testsuite/plugin_common_test_2.c: New test case.
7237         * testsuite/Makefile.am (plugin_test_6): New test case.
7238         * testsuite/Makefile.in: Regenerate.
7239
7240 2010-04-06  Nick Clifton  <nickc@redhat.com>
7241
7242         * po/vi.po: New Vietnamese translation.
7243
7244 2010-03-30  Doug Kwan  <dougkwan@google.com>
7245
7246         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7247
7248 2010-03-25  Doug Kwan  <dougkwan@google.com>
7249
7250         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7251         to avoid a conversion warning on a 32-bit host.
7252
7253 2010-03-24  Ian Lance Taylor  <iant@google.com>
7254
7255         * testsuite/script_test_3.t: Add a TLS segment.
7256         * testsuite/Makefile.am (check_PROGRAMS): Add
7257         tls_phdrs_script_test.
7258         (tls_phdrs_script_test_SOURCES): Define.
7259         (tls_phdrs_script_test_DEPENDENCIES): Define.
7260         (tls_phdrs_script_test_LDFLAGS): Define.
7261         (tls_phdrs_script_test_LDADD): Define.
7262         * testsuite/Makefile.in: Rebuild.
7263
7264 2010-03-23  Cary Coutant  <ccoutant@google.com>
7265
7266         * fileread.cc (find_or_make_view): Fix comment.
7267
7268 2010-03-23  Ian Lance Taylor  <iant@google.com>
7269
7270         * script-sections.cc (class Orphan_section_placement): Define
7271         PLACE_TLS and PLACE_TLS_BSS.
7272         (Orphan_section_placement::Orphan_section_placement): Initialize
7273         new places.
7274         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7275         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7276         (tls_script_test_SOURCES): Define.
7277         (tls_script_test_DEPENDENCIES): Define.
7278         (tls_script_test_LDFLAGS): Define.
7279         (tls_script_test_LDADD): Define.
7280         * testsuite/Makefile.in: Rebuild.
7281
7282 2010-03-22  Doug Kwan  <dougkwan@google.com>
7283
7284         * arm.cc (Arm_relocate_functions::abs8,
7285         Arm_relocate_functions::abs16): Use correct check for overflow
7286         specified in the ARM ELF specs.
7287         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7288         target of a BLX instruction specially.
7289         (Reloc_stub::stub_type_for_reloc): Ditto.
7290         (Relocate::relocate): Use symbolic names instead of numeric relocation
7291         codes to report error.
7292         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7293         workaround.
7294         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7295         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7296         thumb2_blx_out_of_range.stdout
7297         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7298         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7299         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7300         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7301         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7302         thumb2_blx_in_range, thumb2_blx_in_range.o,
7303         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7304         thumb2_blx_out_of_range.o): New rules.
7305         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7306         thumb2_blx_in_range and thumb2_blx_out_of_range.
7307         * testsuite/Makefile.in: Regenerate.
7308         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7309         * testsuite/thumb_blx_in_range.s: New file.
7310         * testsuite/thumb_blx_out_of_range.s: New file.
7311
7312 2010-03-22  Rafael Espindola  <espindola@google.com>
7313
7314         * archive.cc (Should_include): Move to archive.h.
7315         (should_include_member): Make it a member of Archive.
7316         (Lib_group): New.
7317         (Add_lib_group_symbols): New.
7318         * archive.h: Include options.h.
7319         (Archive_member): Moved from Archive.
7320         (Should_include): Moved from archive.cc.
7321         (Lib_group): New.
7322         (Add_lib_group_symbols): New.
7323         * dynobj.cc (do_should_include_member): New.
7324         * dynobj.h (do_should_include_member): New.
7325         * gold.cc (queue_initial_tasks): Update call to queue.
7326         * main.cc (main): Print lib group stats.
7327         * object.cc (do_should_include_member): New.
7328         * object.h: Include archive.h.
7329         (Object::should_include_member): New.
7330         (Object::do_should_include_member): New.
7331         (Sized_relobj::do_should_include_member): New.
7332         * options.cc (General_options::parse_start_lib): New.
7333         (General_options::parse_end_lib): New.
7334         (Input_arguments::add_file): Handle lib groups.
7335         (Input_arguments::start_group): Check we are not in a lib.
7336         (Input_arguments::start_lib): New.
7337         (Input_arguments::end_lib): New.
7338         * options.h (General_options): Add start_lib and end_lib.
7339         (Input_argument::lib_): New.
7340         (Input_argument::lib): New.
7341         (Input_argument::is_lib): New.
7342         (Input_file_lib): New.
7343         (Input_arguments::in_lib_): New.
7344         (Input_arguments::in_lib): New.
7345         (Input_arguments::start_lib): New.
7346         (Input_arguments::end_lib_): New.
7347         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7348         in unused members as preempted.
7349         (Sized_pluginobj::do_should_include_member): New.
7350         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7351         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7352         return the blocker.
7353         (Read_symbols::do_whole_lib_group): New.
7354         (Read_symbols::do_lib_group): New.
7355         (Read_symbols::do_read_symbols): Handle lib groups.
7356         (Read_symbols::get_name): Handle lib groups.
7357         * readsyms.h (Read_symbols): Add an archive member pointer.
7358         (Read_symbols::do_whole_lib_group): New.
7359         (Read_symbols::do_lib_group): New.
7360         (Read_symbols::member_): New.
7361         * script.cc (read_input_script): Update call to queue_soon.
7362
7363 2010-03-19  Doug Kwan  <dougkwan@google.com>
7364
7365         * arm.cc (Stub_table::Stub_table): Initialize new data members
7366         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7367         (Stub_table::add_reloc_stub): Assign stub offset and update
7368         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7369         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7370         New data members.
7371         (Stub_table::update_data_size_and_addralign): Use
7372         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7373         instead of going over all reloc stubs.
7374         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7375         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7376         Stringpool_template::offset_ to size of Stringpool_char.
7377         (Stringpool_template::new_key_offset): Remove code to initialize
7378         Stringpool_template::offset_.
7379         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7380         Stringpool_template::offset_ to zero.
7381
7382 2010-03-15  Doug Kwan  <dougkwan@google.com>
7383
7384         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7385         offset_.
7386         (Stringpool_template::new_key_offset): New method.
7387         (Stringpool_template::add_string): Assign offsets when adding new
7388         strings.
7389         (Stringpool_template::set_string_offsets): Do not set string offsets
7390         when not optimizing.
7391         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7392         member size_.
7393         (Chunked_vector::clear): Clear size_.
7394         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7395         (Chunked_vector::size): Return size_.
7396         (Chunked_vector::push_back): Use size_ to find insert position.
7397         (Chunked_vector::size_): New data member.
7398         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7399         (Stringpool_template::new_key_offset): New method declaration.
7400         (Stringpool_template::offset_): New data member.
7401
7402 2010-03-15   Rafael Espindola  <espindola@google.com>
7403
7404         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7405         Add_symbols' constructor.
7406         * readsyms.h (Add_symbols): Remove the input_group member.
7407
7408 2010-03-10  Ian Lance Taylor  <iant@google.com>
7409
7410         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7411         target to ask whether a reference to a symbol requires a stack
7412         split.
7413         * target.h (Target::is_call_to_non_split): New function.
7414         (Target::do_is_call_to_non_split): Declare virtual function.
7415         * target.cc: Include "symtab.h".
7416         (Target::do_is_call_to_non_split): New function.
7417         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7418
7419 2010-03-10  Cary Coutant  <ccoutant@google.com>
7420
7421         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7422         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7423         (File_read::open[2]): Add whole_file_view_ to list of views.
7424         (File_read::make_view): Remove test of whole_file_view_.
7425         (File_read::find_or_make_view): Create whole_file_view_ if
7426         necessary.
7427         (File_read::clear_views): Replace bool parameter with enum;
7428         adjust all callers.  Don't delete views with permanent data;
7429         do delete cached views and views from archives if
7430         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7431         if clearing the corresponding view.
7432         * fileread.h (File_read::Clear_views_mode): New enum.
7433         (File_read::View::is_permanent_view): New method.
7434         (File_read::clear_views): Replace bool parameter
7435         with enum; adjust all callers.
7436         * options.h (General_options): Change keep_files_mapped option;
7437         add map_whole_files.
7438         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7439         releasing the file.
7440         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7441         the file.
7442
7443 2010-03-10  David S. Miller  <davem@davemloft.net>
7444
7445         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7446
7447 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7448
7449         * icf.cc (get_section_contents): Add '@' marker after processing the
7450         merge reloc.
7451
7452 2010-03-08  Doug Kwan  <dougkwan@google.com>
7453
7454         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7455         due to a conversion warning.
7456         (Arm_relobj::update_output_local_symbol_count): Check for local
7457         symbol with unset output index.
7458
7459 2010-03-05  Ian Lance Taylor  <iant@google.com>
7460
7461         * options.h (class General_options): Add --spare-dynamic-tags.
7462         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7463         --spare-dynamic-tags.
7464
7465 2010-03-05  Ian Lance Taylor  <iant@google.com>
7466
7467         * incremental.cc: Include "libiberty.h".
7468
7469 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7470
7471         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7472         function, is_info_ member.
7473         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7474         (Versions::Versions): Update caller.
7475         (Versions::define_base_version): Likewise.
7476         (Versions::add_def): Likewise.
7477
7478 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7479
7480         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7481         (Scan::possible_function_pointer_reloc): New function.
7482         (Scan::local_reloc_may_be_function_pointer): Change to call
7483         possible_function_pointer_reloc.
7484         (Scan::global_reloc_may_be_function_pointer): Ditto.
7485         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7486         relocations in ".data.rel.ro._ZTV" section.
7487         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7488         * testsuite/icf_safe_so_test.cc: Ditto.
7489         * testsuite/icf_safe_test.cc: Ditto.
7490         * testsuite/icf_safe_test.sh: Ditto.
7491
7492 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7493             Ian Lance Taylor  <iant@google.com>
7494
7495         * target-reloc.h (relocate_section): Check the symbol table index
7496         for -1U before setting the local symbol index.
7497         (scan_relocatable_relocs): If copying the relocation, record that
7498         the local symbol is required.
7499         * object.h (Symbol_value::is_output_symtab_index_set): New
7500         function.
7501         (Symbol_value::may_be_discarded_from_output_symtab): New
7502         function.
7503         (Symbol_value::has_output_symtab_entry): New function.
7504         (Symbol_value::needs_output_symtab_entry): Remove.
7505         (Symbol_value::output_symtab_index): Make sure the symbol index is
7506         set.
7507         (Symbol_value::set_output_symtab_index): Make sure the symbol
7508         index is not set.  Make sure the new index is valid.
7509         (Symbol_value::set_must_have_output_symtab_entry): New function.
7510         (Symbol_value::has_output_dynsym_entry): New function.
7511         (Symbol_value::set_output_dynsym_index): Make sure the new index
7512         is valid.
7513         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7514         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7515         local symbol if permitted.
7516         (Sized_relobj::do_finalize_local_symbols): Call
7517         is_output_symtab_index_set rather than needs_output_symtab_entry.
7518         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7519         rather than needs_output_symtab_entry.  Call
7520         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7521         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7522         is_output_symtab_index_set rather than needs_output_symtab_entry.
7523         * testsuite/discard_locals_relocatable_test.c: New file.
7524         * testsuite/discard_locals_test.sh: Test -r.
7525         * testsuite/Makefile.am (check_DATA): Add
7526         discard_locals_relocatable_test1.syms,
7527         discard_local_relocatable_test2.syms.
7528         (MOSTLYCLEANFILES): Likewise.  Also add
7529         discard_locals_relocatable_test1.lout and
7530         discard_locals_relocatable_test2.out.
7531         (discard_locals_relocatable_test1.syms): New target.
7532         (discard_locals_relocatable_test.o): New target.
7533         (discard_locals_relocatable_test1.out): New target.
7534         (discard_locals_relocatable_test2.syms): New target.
7535         (discard_locals_relocatable_test2.out): New target.
7536         (various): Add missing ../ld-new dependencies.
7537         * testsuite/Makefile.in: Rebuild.
7538
7539 2010-03-03  Nick Clifton  <nickc@redhat.com>
7540
7541         * po/fi.po: New Finnish translation.
7542
7543 2010-03-01  Doug Kwan  <dougkwan@google.com>
7544
7545         * layout.cc (Layout::Layout): Force section types of .init_array*,
7546         .preinit_array* and .fini_array* sections.
7547         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7548         Fix check of return value of std::string::find.().
7549         (Output_section::Input_section_sort_compare::operator()): Remove
7550         comment about .init_array.
7551         (Output_section::Input_section_sort_init_fini_compare::operator()):
7552         New method.
7553         (Output_section::sort_attached_input_sections): Handle .init_array
7554         and .fini_array specially.
7555         * output.h (Output_section::Inut_section_sort_compare): Update
7556         comment.
7557         (Output_section::Input_section_sort_init_fini_compare): New struct.
7558
7559 2010-02-26  Doug Kwan  <dougkwan@google.com>
7560
7561         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7562         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7563         * testsuite/debug_msg.sh: Avoid matching source line number for
7564         use of global variable undef_int.
7565
7566 2010-02-26  Doug Kwan  <dougkwan@google.com>
7567
7568         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7569         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7570         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7571         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7572         * options.cc (General_options::General_options): Initialize member
7573         fix_v4bx_.
7574         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7575         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7576         and rm_no_fix_v4bx.stdout
7577         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7578         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7579         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7580         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7581         and arm_no_fix_v4bx.
7582         * Makefile.in: Regenerate.
7583         * testsuite/arm_fix_v4bx.s: New file.
7584         * testsuite/arm_fix_v4bx.sh: Ditto.
7585
7586 2010-02-24  Doug Kwan  <dougkwan@google.com>
7587
7588         * arm.cc (Target_arm::got_section): Make the .got section the first
7589         non RELRO section in the data segment.
7590         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7591         suffixes of section names.
7592
7593 2010-02-24  Doug Kwan  <dougkwan@google.com>
7594
7595         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7596         flags and attributes merging if an input file is a binary file.
7597         * fileread.cc (Input_file::open): Record format of original file.
7598         * fileread.h (Input_file::Format): New enum type.
7599         (Input_file::Input_file): Initialize data member format_.
7600         (Input_file::format): New method definition.
7601         (Input_file::format_):: New data member.
7602
7603 2010-02-24  Doug Kwan  <dougkwan@google.com>
7604
7605         * arm.cc (Arm_output_data_got): New class.
7606         (ARM_TCB_SIZE): New constant
7607         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7608         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7609         If user uses a script with a SECTIONS clause, issue only a warning
7610         for a misplaced EXIDX input section.  Otherwise, issue an error.
7611         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7612         garbage collection.
7613         (Target_arm::got_mode_index_entry): Handle static linking.
7614         (Target_arm::Scan::local): Ditto.
7615         (Target_arm::Scan::global): Ditto.
7616         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7617         all incorrectly implemented relocations.
7618         (Target_arm::fix_exidx_coverage): Pass layout to
7619         Arm_output_section::fix_exidx_coverage.
7620         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7621         from ".ARM.exidx." and ".ARM.extab.".
7622
7623 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7624
7625         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7626         section if it does not already exist.
7627         * attributes.cc (Attributes_section_data::Attributes_section_data):
7628         Don't crash if size is zero.
7629
7630 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7631             Ian Lance Taylor  <iant@google.com>
7632
7633         * gold.cc (queue_middle_tasks): If no input files were opened,
7634         exit.
7635         * workqueue.h (Task_function::Task_function): Assert that there is
7636         a blocker.
7637
7638 2010-02-22  Doug Kwan  <dougkwan@google.com>
7639
7640         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7641         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7642         types to avoid warnings due to different uint64_t implementations
7643         on different hosts.
7644
7645 2010-02-21  Doug Kwan  <dougkwan@google.com>
7646
7647         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7648         handling of the maximum backward branch offset.
7649         (Arm_relocate_functions::thumb_branch_common): Ditto.
7650         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7651         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7652         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7653         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7654         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7655         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7656         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7657         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7658         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7659         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7660         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7661         thumb2_bl_out_of_range.o): New rules.
7662         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7663         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7664         thumb2_bl_out_of_range
7665         * testsuite/Makefile.in: Regenerate.
7666         * testsuite/arm_bl_in_range.s: New file.
7667         * testsuite/arm_bl_out_of_range.s: Ditto.
7668         * testsuite/arm_branch_in_range.sh: Ditto.
7669         * testsuite/arm_branch_range.t: Ditto.
7670         * testsuite/thumb2_branch_range.t: Ditto.
7671         * testsuite/thumb_bl_in_range.s: Ditto.
7672         * testsuite/thumb_bl_out_of_range.s: Ditto.
7673         * testsuite/thumb_branch_range.t: Ditto.
7674
7675 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7676
7677         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7678         Add reloc offset information.
7679         * icf.cc (get_section_contents): Change iterators to point to the new
7680         vectors. Add reloc offset information to the contents.
7681         * icf.h (Icf::Sections_reachable_info): New typedef.
7682         (Icf::Sections_reachable_list): New typedef.
7683         (Icf::Offset_info): New typedef.
7684         (Icf::Reloc_info): New struct typedef.
7685         (Icf::Reloc_info_list): New typedef.
7686         (Icf::symbol_reloc_list): Delete method.
7687         (Icf::addend_reloc_list): Delete method.
7688         (Icf::section_reloc_list): Delete method.
7689         (Icf::reloc_info_list): New method.
7690         (Icf::reloc_info_list_): New member.
7691
7692 2010-02-19  Doug Kwan  <dougkwan@google.com>
7693
7694         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7695         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7696         * arm.cc (Arm_relocation_functions): New forward declaration.
7697         (Target_arm::Target_arm): Initialize new data members
7698         got_mod_index_offset_ and tls_base_symbol_defined_.
7699         (Target_arm::Relocate::relocate_tls): New method.
7700         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7701          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7702         New methods.
7703         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7704         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7705         (Target_arm::got_mod_index_offset_,
7706         Target_arm::tls_base_symbol_defined_): New data members.
7707         (Target_arm::Scan::local, Target::Scan::global,
7708         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7709         relocations.
7710
7711 2010-02-18  Doug Kwan  <dougkwan@google.com>
7712
7713         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7714         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7715         text section as a parameter becuase some broken tools may not set
7716         the link in section header.
7717         (Target_arm::has_got_section): New method.
7718         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7719         without any mapping symbol as data only.  Remove warning.
7720         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7721         link in its section header, try to discover the link by inspecting the
7722         REL31 relocation at the beginning of the section.
7723         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7724         in error message.
7725         (Target_arm::Scan::global): Treat any reference to the symbol
7726         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7727
7728 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7729
7730         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7731         (Scan::global_reloc_may_be_function_pointer): New function.
7732         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7733         (Scan::global_reloc_may_be_function_pointer): New function.
7734         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7735         (Scan::global_reloc_may_be_function_pointer): New function.
7736         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7737         (Scan::global_reloc_may_be_function_pointer): New function.
7738         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7739         (Scan::global_reloc_may_be_function_pointer): New function.
7740         (Scan::possible_function_pointer_reloc): New function.
7741         (Target_x86_64::can_check_for_function_pointers): New function.
7742         * gc.h (gc_process_relocs): Scan relocation types to determine if
7743         function pointers were taken for targets that support it.
7744         * icf.cc (Icf::find_identical_sections): Include functions for
7745         folding in safe ICF whose pointer is not taken.
7746         * icf.h (Secn_fptr_taken_set): New typedef.
7747         (fptr_section_id_): New member.
7748         (section_has_function_pointers): New function.
7749         (set_section_has_function_pointers): New function.
7750         (check_section_for_function_pointers): New function.
7751         * options.h: Fix comment for safe ICF option.
7752         * target.h (can_check_for_function_pointers): New function.
7753         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7754         Modify icf_safe_test for X86-64.
7755         * testsuite/Makefile.in: Regenerate.
7756         * testsuite/icf_safe_so_test.cc: New file.
7757         * testsuite/icf_safe_so_test.sh: New file.
7758         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7759         (main): Change to take pointer to function kept_func_3.
7760         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7761         folding is done correctly for X86-64.
7762
7763 2010-02-12  David S. Miller  <davem@davemloft.net>
7764
7765         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7766         is_symbolless parameter.
7767         (Output_reloc<SHT_REL>::is_symbolless): New.
7768         (Output_reloc<SHT_REL>::is_symbolless_): New.
7769         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7770         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7771         (Output_reloc<SHT_RELA>::is_symbolless): New.
7772         (Output_data_reloc::add_global): Handle is_symbolless.
7773         (Output_data_reloc::add_global_relative): Likewise.
7774         (Output_data_reloc::add_local): Likewise.
7775         (Output_data_reloc::add_local_relative): Likewise.
7776         (Output_data_reloc::add_symbolless_global_addend): New.
7777         (Output_data_reloc::add_symbolless_local_addend): New.
7778         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7779         is_symbolless.
7780         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7781         instead of ->is_relative_
7782         (Output_reloc::write): Likewise.
7783         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7784         (Output_reloc::write_rel): Simplify.
7785
7786         * sparc.cc (Target_sparc::Scan::local): Use
7787         ->add_symbolless_local_addend as needed.
7788         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7789         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7790         based upon relocation offset.
7791
7792 2010-02-11  Doug Kwan  <dougkwan@google.com>
7793
7794         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7795         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7796         beginning of function.
7797         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7798         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7799         parameter is_32bit in calls to should_apply_static_reloc.
7800         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7801         (check_DATA): Add arm_abs_global.stdout.
7802         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7803         arm_abs_global.stdout): New rules.
7804         (MOSTLLYCLEANFILES): Add arm_abs_global
7805         * Makefile.in: Regenerate.
7806         * testsuite/arm_abs_global.s: New file.
7807         * testsuite/arm_abs_global.sh: Ditto.
7808         * testsuite/arm_abs_lib.s: Ditto.
7809
7810 2010-02-11  Ian Lance Taylor  <iant@google.com>
7811
7812         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7813         Read_relocs task.
7814         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7815         Allocate_commons_task first.
7816         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7817         task, rather than symtab_lock_.
7818         (Gc_process_relocs::~Gc_process_relocs): New function.
7819         (Gc_process_relocs::is_runnable): Check this_blocker_.
7820         (Gc_process_relocs::locks): Use next_blocker_ rather than
7821         blocker_.
7822         (Scan_relocs::~Scan_relocs): New function.
7823         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7824         symtab_lock_.
7825         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7826         next_blocker_.
7827         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7828         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7829         constructor accordingly.
7830         (class Gc_process_relocs): Likewise.
7831         (class Scan_relocs): Likewise.
7832         * common.h (class Allocate_commons_task): Remove symtab_lock_
7833         field, and corresponding constructor parameter.
7834         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7835         symtab_lock_.
7836         (Allocate_commons_task::locks): Likewise.
7837
7838 2010-02-11  Ian Lance Taylor  <iant@google.com>
7839
7840         * gold-threads.h (class Once): Define.
7841         (class Initialize_lock): Rewrite as child of Once.
7842         * gold-threads.cc (class Once_initialize): Define.
7843         (once_pointer_control): New static variable.
7844         (once_pointer, once_arg): New static variables.
7845         (c_run_once): New static function.
7846         (Once::Once, Once::run_once, Once::internal_run): New functions.
7847         (class Initialize_lock_once): Remove.
7848         (initialize_lock_control): Remove.
7849         (initialize_lock_pointer): Remove.
7850         (initialize_lock_once): Remove.
7851         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7852         (Initialize_lock::initialize): Rewrite.
7853         (Initialize_lock::do_run_once): New function.
7854         * archive.cc (Archive::interpret_header): Only clear name if it is
7855         not already empty.
7856         * fileread.cc: Include "gold-threads.h"
7857         (file_counts_lock): New static variable.
7858         (file_counts_initialize_lock): Likewise.
7859         (File_read::release): Only increment counts when using --stats.
7860         Use a lock around the increment.
7861         * parameters.cc (class Set_parameters_target_once): Define.
7862         (set_parameters_target_once): New static variable.
7863         (Parameters::Parameters): Move here from parameters.h.
7864         (Parameters::set_target): Rewrite.
7865         (Parameters::set_target_once): New function.
7866         (Parameters::clear_target): Move here and rewrite.
7867         * parameters.h (class Parameters): Update declarations.  Add
7868         set_parameters_target_once_ field.
7869         (Parameters::Parameters): Move to parameters.cc.
7870         (Parameters::clear_target): Likewise.
7871         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7872         task.
7873         (Start_group::~Start_group): New function.
7874         (Start_group::is_runnable): New function.
7875         (Start_group::locks, Start_group::run): New functions.
7876         (Finish_group::run): Change saw_undefined to size_t.
7877         * readsyms.h (class Start_group): Define.
7878         (class Finish_group): Change saw_undefined_ field to size_t.
7879         (Finish_group::Finish_group): Remove saw_undefined and
7880         this_blocker parameters.  Change all callers.
7881         (Finish_group::set_saw_undefined): New function.
7882         (Finish_group::set_blocker): New function.
7883         * symtab.h (class Symbol_table): Change saw_undefined to return
7884         size_t.  Change saw_undefined_ field to size_t.
7885         * target-select.cc (Set_target_once::do_run_once): New function.
7886         (Target_selector::Target_selector): Initialize set_target_once_
7887         field.  Don't initialize lock_ and initialize_lock_ fields.
7888         (Target_selector::instantiate_target): Rewrite.
7889         (Target_selector::set_target): New function.
7890         * target-select.h (class Set_target_once): Define.
7891         (class Target_selector): Update declarations.  Make
7892         Set_target_once a friend.  Remove lock_ and initialize_lock_
7893         fields.  Add set_target_once_ field.
7894
7895 2010-02-10  Ian Lance Taylor  <iant@google.com>
7896
7897         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7898         queueing any tasks.
7899         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7900         (queue_middle_tasks): Add all blockers before queueing any tasks.
7901         (queue_final_tasks): Likewise.
7902         * token.h (Task_token::add_blockers): New function.
7903         * object.h (Input_objects::number_of_relobjs): New function.
7904
7905 2010-02-10  Ian Lance Taylor  <iant@google.com>
7906
7907         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7908         shared, not if not position independent.
7909         * x86_64.cc (Relocate::relocate_tls): Likewise.
7910         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7911         (tls_pie_pic_test): New target.
7912         * testsuite/Makefile.in: Rebuild.
7913
7914         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7915         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7916         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7917         * testsuite/Makefile.in: Rebuild.
7918
7919 2010-02-09  David S. Miller  <davem@davemloft.net>
7920
7921         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7922         R_SPARC_RELATIVE using ->add_local_relative().
7923         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7924
7925         * output.h (Output_data_dynamic::add_section_size): New method
7926         that takes two Output_data objects.
7927         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7928         entry param.  Handle it in initializers.
7929         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7930         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7931         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7932         arg.
7933         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7934         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7935         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7936         for dynrel_includes_plt.
7937         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7938         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7939         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7940         before .rela.plt
7941         (Target_sparc::do_finalize_sections): Update to pass true for
7942         dynrel_includes_plt.
7943         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7944         output before .rela.plt
7945         (Target_powerpc::do_finalize_sections): Update to pass true for
7946         dynrel_includes_plt when 32-bit.
7947
7948 2010-02-08  Doug Kwan  <dougkwan@google.com>
7949
7950         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7951         method.
7952         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7953         Arm_relobj::scan_section_for_cortex_a8_stubs,
7954         Arm_relobj::do_relocation_section): Instead of calling
7955         Output_section::output_address, use faster
7956         Arm_relobj::simple_input_section_output_address.
7957
7958 2010-02-08  David S. Miller  <davem@davemloft.net>
7959
7960         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7961         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7962         relocation helper function.
7963
7964         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7965         just like R_SPARC_GOT{10,13,22}.
7966         (Target_sparc::Scan::local): Likewise.
7967         (Target_sparc::Relocate:relocate): Likewise.
7968
7969 2010-02-06  Ian Lance Taylor  <iant@google.com>
7970
7971         * configure.ac: Rewrite targetobjs duplicate removal code to use
7972         only shell constructs.
7973         * configure: Rebuild.
7974
7975 2010-02-05  Doug Kwan  <dougkwan@google.com>
7976
7977         PR 11247
7978         * arm.cc (Arm_relobj::section_is_scannable): New method.
7979         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7980         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7981
7982 2010-02-04  Doug Kwan  <dougkwan@google.com>
7983
7984         PR 11247
7985         * arm-reloc-property.cc (cstdio): Include.
7986         * configure.ac (targetobjs): Remove duplicates.
7987         * configure: Regenerate.
7988         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7989         big and little endian version for a given address size.
7990
7991 2010-02-03  Doug Kwan  <dougkwan@google.com>
7992
7993         * arm-reloc-property.cc
7994         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7995         definition.
7996         * arm-reloc-property.h
7997         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7998         New method definition.
7999         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8000         declaration.
8001         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8002         overflow to N.
8003         (GOT_PREL): Change implemented to Y.
8004         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8005         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8006         (Arm_relocate_functions::movw_abs_nc): Remove method.
8007         (Arm_relocate_functions::movt_abs): Ditto.
8008         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8009         (Arm_relocate_functions::thm_movt_abs): Ditto.
8010         (Arm_relocate_functions::movw_rel_nc): Ditto.
8011         (Arm_relocate_functions::movw_rel): Ditto.
8012         (Arm_relocate_functions::movt_rel): Ditto.
8013         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8014         (Arm_relocate_functions:thm_movw_rel): Ditto.
8015         (Arm_relocate_functions:thm_movt_rel): Ditto.
8016         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8017         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8018         New method definitions.
8019         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8020         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8021         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8022         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8023         (Target_arm::Relocate::relocate): Check for non-static or
8024         unimplemented relocation code and exit early.  Change calls to
8025         Target_arm::reloc_uses_thumb_bit and
8026         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8027         instead.  Refactor code to handle similar relocations to increase
8028         code sharing.  Remove check for unsupported relocation code in switch
8029         statement.
8030         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8031         relocation property table to find out size.  Change error message to
8032         print out the name of a relocation code instead of the numeric value.
8033         (Target_arm::scan_reloc_for_stub): Use relocation property table
8034         instead of calling Target_arm::reloc_uses_thumb_bit().
8035
8036 2010-02-02  Doug Kwan  <dougkwan@google.com>
8037
8038         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8039         types of relaxed input section.
8040
8041 2010-02-02  Doug Kwan  <dougkwan@google.com>
8042
8043         * Makefile.am (HFILES): Add arm-reloc-property.h.
8044         (DEFFILES): New.
8045         (TARGETSOURCES): Add arm-reloc-property.cc
8046         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8047         (libgold_a_SOURCES): $(DEFFILES)
8048         * Makefile.in: Regenerate.
8049         * arm-reloc-property.cc: New file.
8050         * arm-reloc-property.h: New file.
8051         * arm-reloc.def: New file.
8052         * arm.cc: Update comments.
8053         (arm-reloc-property.h): New included header.
8054         (arm_reloc_property_table): New global variable.
8055         (Target_arm::do_select_as_default_target): New method definition.
8056         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8057         arm-reloc-property to targ_extra_obj.
8058         * parameters.cc (set_parameters_target): Call
8059         Target::select_as_default_target().
8060         * target.h (Target::select_as_default_target): New method definition.
8061         (Target::do_select_as_default_target): Same.
8062
8063 2010-02-01  Doug Kwan  <dougkwan@google.com>
8064
8065         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8066         first_output_text_section_.
8067         (Arm_exidx_fixup::first_output_text_section): New method definition.
8068         (Arm_exidx_fixup::first_output_text_section_): New data member.
8069         (Arm_exidx_fixup::process_exidx_section): Record the first text
8070         output section seen.
8071         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8072         and entsize in output section header.
8073
8074 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8075
8076         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8077         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8078         (Arm_relocate_functions::thm_alu11): New Method.
8079         (Arm_relocate_functions::thm_pc8): New Method.
8080         (Arm_relocate_functions::thm_pc12): New Method.
8081         (Target_arm::Scan::local): Handle the relocations.
8082         (Target_arm::Scan::global): Likewise.
8083         (Target_arm::Relocate::relocate): Likewise.
8084         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8085
8086 2010-01-29  Doug Kwan  <dougkwan@google.com>
8087
8088         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8089         of relocation types as ld.
8090
8091 2010-01-29  Doug Kwan  <dougkwan@google.com>
8092
8093         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8094         to public.
8095         (Arm_relocate_functions::thumb_branch_common): Ditto.
8096         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8097         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8098         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8099         Arm_relocate_functions::jump24): Remove.
8100         (Target_arm::Relocate::relocate): Adjust code to call
8101         Arm_relocation_functions::arm_branch_common and
8102         Arm_relocation_functions::thumb_branch_common instead of their removed
8103         wrappers.  Merge switch-cases together to reduce source code size.
8104
8105 2010-01-29  Doug Kwan  <dougkwan@google.com>
8106
8107         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8108         output_local_symbol_count_needs_update_.
8109         (Arm_relobj::output_local_symbol_count_needs_update,
8110          Arm_relobj::set_output_local_symbol_count_needs_update,
8111          Arm_relobj::update_output_local_symbol_count): New methods.
8112         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8113         member.
8114         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8115         of pointed function as in a R_ARM_PREL31 relocation.
8116         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8117         for output local symbol count updating.
8118         (Target_arm::do_relax): Update output local symbol counts in objects
8119         if necessary.
8120         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8121
8122 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8123
8124         * arm.cc: Added support for the ARM relocations:
8125         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8126         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8127         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8128         movw_prel_nc).
8129         (Arm_relocate_functions::movw_rel): New method.
8130         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8131         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8132         thm_movw_prel_nc).
8133         (Arm_relocate_functions::thm_movw_rel): New method.
8134         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8135         thm_movt_prel).
8136         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8137         relocations.
8138         (Target_arm::Scan::global): Likewise.
8139         (Target_arm::Relocate::relocate): Likewise.
8140         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8141         Likewise.
8142
8143 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8144
8145         * arm.cc: Added support for ARM group relocations.
8146         (Target_arm::reloc_needs_sym_origin): New method.
8147         (Arm_relocate_functions::calc_grp_kn): New method.
8148         (Arm_relocate_functions::calc_grp_residual): New method.
8149         (Arm_relocate_functions::calc_grp_gn): New method.
8150         (Arm_relocate_functions::arm_grp_alu): New Method.
8151         (Arm_relocate_functions::arm_grp_ldr): New Method.
8152         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8153         (Arm_relocate_functions::arm_grp_ldc): New Method.
8154         (Target_arm::Scan::local): Handle the ARM group relocations.
8155         (Target_arm::Scan::global): Likewise.
8156         (Target_arm::Relocate::relocate): Likewise.
8157         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8158         Likewise.
8159
8160 2010-01-26  Doug Kwan  <dougkwan@google.com>
8161
8162         * arm.cc (set): Include.
8163         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8164         pointer type.
8165         (Arm_output_section::Text_section_list): New type.
8166         (Arm_output_section::append_text_sections_to_list): New method.
8167         (Arm_output_section::fix_exidx_coverage): Ditto.
8168         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8169         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8170         Relobj::set_section_offset() instead of
8171         Sized_relobj::invalidate_section_offset().
8172         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8173         parameter for section headers. Ignore relocation sections for
8174         unallocated sections and EXIDX sections.
8175         (Target_arm::fix_exidx_coverage): New method.
8176         (Target_arm::output_section_address_less_than): New type.
8177         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8178         linked text section instead of the EXIDX section.
8179         (Arm_output_section::create_stub_group): Add an assertion to check
8180         that this is not an EXIDX output section.
8181         (Arm_output_section::append_text_sections_to_list): New method.
8182         (Arm_output_section::fix_exidx_coverage): Ditto.
8183         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8184         Arm_relobj::section_needs_reloc_stub_scanning.
8185         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8186         first pass.
8187         (Target_arm::fix_exidx_coverage): New method.
8188         * object.h (Relobj::set_output_section): New method.
8189         (Sized_relobj::invalidate_section_offset): Remove method.
8190         (Sized_relobj::do_invalidate_section_offset): Remove method.
8191         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8192
8193 2010-01-25  Doug Kwan  <dougkwan@google.com>
8194
8195         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8196         Fix warning due to signed and unsigned comparison on a 32-bit host.
8197
8198 2010-01-22  Doug Kwan  <dougkwan@google.com>
8199
8200         * arm.cc (Target_arm::do_relax): Record an output section for section
8201         offset adjustment it contains any stub table that has changed.
8202         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8203         offsets in an output section if necessary.
8204         * output.cc (Output_section::Output_section): Initialize
8205         section_offsets_need_adjustments_.
8206         (Output_section::add_input_section_for_script): Renamed to
8207         Output_section::add_simple_input_section.
8208         (Output_section::save_states): Add a comment.
8209         (Output_section::discard_states): New method defintion.
8210         (Output_section::adjust_section_offsets): Same.
8211         * output.h (Output_section::add_input_section_for_script): Renamed to
8212         Output_section::add_simple_input_section.
8213         (Output_section::discard_states): New method declaration.
8214         (Output_section::adjust_section_offsets): Same.
8215         (Output_section::section_offsets_need_adjustment,
8216         Output_section::set_section_offsets_need_adjustment): New method
8217         definitions.
8218         (Output_section::section_offsets_need_adjustment_): New data member.
8219         * script-sections.cc
8220         (Output_section_element_input::set_section_address): Adjust code for
8221         renaming of Output_section::add_input_section_for_script.
8222         (Orphan_output_section::set_section_address): Same.
8223
8224 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8225
8226         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8227         Fix_v4bx enum values .
8228         * gold/options.h (General_options): New option definitions.
8229         (General_options::fix_v4bx): New method.
8230         (General_options::Fix_v4bx): New enum.
8231         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8232         (General_options::parse_fix_v4bx_interworking): New method.
8233
8234 2010-01-22  Doug Kwan  <dougkwan@google.com>
8235
8236         * arm.cc (Arm_exidx_fixup): New class.
8237
8238 2010-01-21  Doug Kwan  <dougkwan@google.com>
8239
8240         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8241         classes.
8242         (Arm_exidx_section_offset_map): New type.
8243
8244 2010-01-21  Doug Kwan  <dougkwan@google.com>
8245
8246         * arm.cc (Arm_exidx_input_section): New class.
8247         (Arm_relobj::exidx_input_section_by_link,
8248         Arm_relobj::exidx_input_section_by_shndx,
8249         Arm_relobj::make_exidx_input_section): New methods.
8250         (read_arm_attributes_section): Remove.
8251         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8252         information about them.
8253         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8254         to here.
8255
8256 2010-01-20  Doug Kwan  <dougkwan@google.com>
8257
8258         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8259         Input_section_specifier to Section_id.
8260         (Target_arm::new_arm_input_section: Adjust code for change of key
8261         type.
8262         (Target_arm::find_arm_input_section): Ditto.
8263         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8264         (Section_id): Remove.
8265         (Garbage_collection::Section_id_hash): Remove.
8266         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8267         (Section_id): Remove.
8268         (Icf::Section_id_hash): Remove.
8269         * object.h (Section_id, Const_section_id, Section_id_hash,
8270         Const_section_id_hash): New type definitions.
8271         * output.cc (Output_section::add_relaxed_input_section): Change to
8272         use Const_section_id instead of Input_section_specifier as key type.
8273         (Output_section::add_merge_input_section): Ditto.
8274         (Output_section::build_relaxation_map): Change to use Section_id
8275         instead of Input_section_specifier as key type.
8276         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8277         Ditto.
8278         (Output_section::convert_input_sections_to_relaxed_sections): Change
8279         to use Const_section_id instead of Input_section_specifier as key type.
8280         (Output_section::find_merge_section): Ditto.
8281         (Output_section::find_relaxed_input_section): Ditto.
8282         * output.h (Input_section_specifier): Remove class.
8283         (Output_section::Output_section_data_by_input_section_map): Change
8284         key type to Const_section_id.
8285         (Output_section::Output_relaxed_input_section_by_input_section_map):
8286         Ditto.
8287         (Output_section::Relaxation_map): Change key type to Section_id.
8288
8289 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8290
8291         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8292         (class Arm_v4bx_stub): New class.
8293         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8294         (Stub_factory::make_arm_v4bx_stub): New method.
8295         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8296         (Stub_table::empty): Handle v4bx stubs.
8297         (Stub_table::add_arm_v4bx_stub): New method.
8298         (Stub_table::find_arm_v4bx_stub): New method.
8299         (Arm_relocate_functions::v4bx): New method.
8300         (Target_arm::fix_v4bx): New method.
8301         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8302         (Stub_table::relocate_stubs): Likewise.
8303         (Stub_table::do_write): Likewise.
8304         (Stub_table::update_data_size_and_addralign): Likewise.
8305         (Stub_table::finalize_stubs):  Likewise.
8306         (Target_arm::Scan::local): Likewise.
8307         (Target_arm::Scan::global): Likewise.
8308         (Target_arm::do_finalize_sections): Likewise.
8309         (Target_arm::Relocate::relocate): Likewise.
8310         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8311         Likewise.
8312         (Target_arm::scan_reloc_for_stub): Likewise.
8313         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8314
8315 2010-01-19  Ian Lance Taylor  <iant@google.com>
8316
8317         * output.cc (Output_section_headers::do_sized_write): Write large
8318         segment count to sh_info field.
8319         (Output_file_header::do_sized_write): For large segment count,
8320         write PN_XNUM to e_phnum field.
8321
8322 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8323
8324         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8325         (Arm_relocate_functions::thm_jump8): New function.
8326         (Arm_relocate_functions::thm_jump11): New function.
8327         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8328         R_ARM_THM_JUMP11.
8329         (Target_arm::Scan::global): Likewise.
8330         (Target_arm::Relocate::relocate): Likewise.
8331         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8332         Likewise.
8333
8334 2010-01-14  Doug Kwan  <dougkwan@google.com>
8335
8336         * arm.cc (map, utility): Include headers.
8337         (Target_arm::apply_cortex_a8_workaround): New method.
8338         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8339         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8340         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8341         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8342         the --[no-]fix-cortex-a8 command line options.
8343         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8344         (Target_arm::relocate_stub): Use addend in instruction template.
8345         * options.h (DEFINE_bool): Set the user-set flag.
8346         (General_options): Add --[no-]-fix-cortex options.
8347         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8348         : Update fast look-up map after conversion.
8349
8350 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8351
8352         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8353         in the first pass of do_layout.
8354
8355 2010-01-13  Doug Kwan  <dougkwan@google.com>
8356
8357         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8358         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8359         apparent compiler problem of not folding static constant integral
8360         data members of elfcpp::Elf_sizes<32>.
8361
8362 2010-01-13  Doug Kwan  <dougkwan@google.com>
8363
8364         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8365         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8366         Arm_relobj::scan_section_for_cortex_a8_erratum,
8367         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8368         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8369         sections to scan for relocation stubs into a new method
8370         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8371         relocation and Cortex-A8 stub scanning.
8372         (Target_arm::do_relax): Force stubs to be after stubbed sections
8373         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8374         the beginning of a new relaxation pass.  Update a comment.
8375         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8376
8377 2010-01-12  Ian Lance Taylor  <iant@google.com>
8378
8379         * target-reloc.h (visibility_error): New inline function.
8380         (relocate_section): Call visibility_error.
8381         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8382         (MOSTLYCLEANFILES): Likewise.
8383         (protected_4_pic.o, protected_3.err): New targets.
8384         * testsuite/protected_4.cc: New file.
8385
8386 2010-01-12  Doug Kwan  <dougkwan@google.com>
8387
8388         * arm.cc (Cortex_a8_reloc): New class.
8389         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8390         and cortex_a8_relocs_info_.
8391         (Target_arm::fix_cortex_a8): New method definition.
8392         (Target_arm::Cortex_a8_relocs_info): New type.
8393         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8394         New data member declarations.
8395         (Target_arm::scan_reloc_for_stub): Record information about
8396         relocations for THUMB branches that might be exempted from the
8397         Cortex-A8 workaround.
8398         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8399         at the beginning of a relaxation pass.
8400
8401 2010-01-12  Doug Kwan  <dougkwan@google.com>
8402
8403         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8404         (Arm_relobj::Mapping_symbol_position,
8405          Arm_reloj::Mapping_symbol_position_less,
8406          Arm_relobj::Mapping_symbols_info): New types.
8407         (Target_arm::is_mapping_symbol_name): New method definition.
8408         (Arm_relobj::do_count_local_symbols): Save information about mapping
8409         symbols.
8410
8411 2010-01-11  Doug Kwan  <dougkwan@google.com>
8412
8413         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8414         Arm_relocate_functions::thumb32_branch_upper,
8415         Arm_relocate_functions::thumb32_branch_lower,
8416         Arm_relocate_functions::thumb32_cond_branch_offset,
8417         Arm_relocate_functions::thumb32_cond_branch_upper,
8418         Arm_relocate_functions::thumb32_cond_branch_lower,
8419         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8420         branch offset encoding.
8421         (Arm_relocate_functions::thumb_branch_common): Use new branch
8422         offset encoding methods to avoid code duplication.
8423         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8424         (Stub_addend_reader::operator()): Use new branch encoding method
8425         to avoid code duplication.
8426
8427 2010-01-11  Doug Kwan  <dougkwan@google.com>
8428
8429         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8430         (Target_arm::do_finalize_sections): Define special EXIDX section
8431         symbols only if referenced.
8432         * gc.h (Garbage_collection::add_reference): New method.
8433         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8434         code duplication.
8435
8436 2010-01-11  Ian Lance Taylor  <iant@google.com>
8437
8438         * script.cc (Version_script_info::build_expression_list_lookup):
8439         Change complaing about duplicate wildcard match from error to
8440         warning.
8441
8442         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8443         of 2009-12-30.
8444         (Version_script_info::Version_script_info): Initialize globs_,
8445         default_version_, default_is_global_, and exact_.  Don't
8446         initialize globals_ or locals_.
8447         (Version_script_info::build_lookup_tables): Build local symbols
8448         first.
8449         (Version_script_info::unquote): New function.
8450         (Version_script_info::add_exact_match): New function.
8451         (Version_script_info::build_expression_list_lookup): Remove lookup
8452         parameter.  Add is_global parameter.  Change all callers.  Handle
8453         wildcard pattern specially.  Unquote pattern.  Call
8454         add_exact_match.
8455         (Version_script_info::get_name_to_match): New function.
8456         (Version_script_info::get_symbol_version): New function.
8457         (Version_script_info::get_symbol_version_helper): Remove.
8458         (Version_script_info::check_unmatched_names): Call unquote.
8459         * script.h (class Version_script_info): Change get_symbol_version
8460         to be non-inline and add is_global parameter; change all callers.
8461         Rewrite symbol_is_local.  Update declarations.  Define struct
8462         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8463         Remove globals_ and locals_ members.  Add exact_, globs_,
8464         default_version_, is_global_.
8465         (Version_script_info::Glob): Remove pattern, add expression and
8466         is_global.  Update constructor.  Change all callers.
8467         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8468         default version.
8469         (Versions::symbol_section_contents): If a symbol is undefined, or
8470         defined in a dynamic object, set the version index to
8471         VER_NDX_LOCAL.
8472         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8473         symbol_is_local.
8474         (Symbol_table::add_from_pluginobj): Likewise.
8475         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8476
8477 2010-01-11  Doug Kwan  <dougkwan@google.com>
8478
8479         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8480         (incremental_dump_LDADD): Add linking option for libintl.
8481         * Makefile.in: Regenerate.
8482
8483 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8484
8485         PR gold/11144
8486         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8487         instead of -Ds.
8488         * testsuite/Makefile.in: Regenerated.
8489
8490 2010-01-10  Doug Kwan  <dougkwan@google.com>
8491
8492         * options.h (DEFINE_var): Use parentheses around argument varname__
8493         in macro body to avoid any unintended subsequent substitutions.
8494
8495 2010-01-10  Ian Lance Taylor  <iant@google.com>
8496
8497         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8498         candidates before doing symbol resolution.
8499
8500         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8501         ODR candidates if only one is weak.
8502
8503 2010-01-08  Ian Lance Taylor  <iant@google.com>
8504
8505         * script.cc (Version_script_info::build_expression_list_lookup):
8506         Don't warn about ambiguous version, just record the ambiguity.
8507         (Version_script_info::get_symbol_version_helper): Give error if
8508         version is ambiguous.
8509
8510 2010-01-08  Doug Kwan  <dougkwan@google.com>
8511
8512         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8513         prev_data_size_ and prev_addralign_.  Remove initializer for
8514         deleted data member has_been_changed_.
8515         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8516         to determine if the table is empty.
8517         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8518         Remove.
8519         (Stub_table::add_reloc_stub): Define method in class definition
8520         instead of just declaring it there.
8521         (Stub_table::add_cortex_a8_stub): New method definition.
8522         (Stub_table::update_data_size_and_addralign): Ditto.
8523         (Stub_table::finalize_stubs): Ditto.
8524         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8525         (Stub_table::do_addralign_): Return address alignment in the
8526         (Stub_table::do_reset_address_and_file_offset): Define method in
8527         class definition instead of declaring it there.  Set current data
8528         size to be the data size of the previous pass.
8529         (Stub_table::set_final_data_size): Use current data size as the
8530         final data size.
8531         (Stub_table::relocate_stub): Change parameter type of stub from
8532         Reloc_stub pointer to Stub pointer.
8533         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8534         (Stub_table::Cortex_a8_stub_list): New typedef.
8535         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8536          Stub_table::prev_addralign_): New data member.
8537         (Arm_relobj::Arm_relobj): Initialize data member
8538         section_has_cortex_a8_workaround_.
8539         (Arm_relobj::section_has_cortex_a8_workaround,
8540          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8541          definitions.
8542         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8543         declarations.
8544         (Target_arm::relocate_stub): Change parameter type of stub from
8545         Reloc_stub pointer to Stub pointer.
8546         (Insn_template::size, Insn_template::alignment): Handle
8547         THUMB16_SPECIAL_TYPE.
8548         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8549          Stub_table::update_data_size_and_addralign,
8550          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8551         definitions.
8552         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8553         (Stub_table::do_write): Ditto.
8554         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8555
8556 2010-01-08  Ian Lance Taylor  <iant@google.com>
8557
8558         PR 11108
8559         * symtab.h (class Symbol): Remove fields is_target_special_ and
8560         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8561         (Symbol::is_defined_in_discarded_section): New function.
8562         (Symbol::set_is_defined_in_discarded_section): New function.
8563         (Symbol::has_plt_offset): Rewrite.
8564         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8565         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8566         Don't initialize is_target_special_ or has_plt_offset_.
8567         Initialize is_defined_in_discarded_section_.
8568         (Symbol_table::add_from_relobj): If appropriate, set
8569         is_defined_in_discarded_section.
8570         * resolve.cc (Symbol::override_base_with_special): Don't test
8571         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8572         * target-reloc.h (relocate_section): Do special handling for
8573         symbols defined in discarded sections for global symbols as well
8574         as local symbols.
8575
8576 2010-01-08  Ian Lance Taylor  <iant@google.com>
8577
8578         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8579         the SHT_SYMTAB case.
8580
8581 2010-01-08  Ian Lance Taylor  <iant@google.com>
8582
8583         * object.cc (Sized_relobj::do_layout): Don't get confused if
8584         layout_eh_frame returns NULL.
8585
8586 2010-01-08  Ian Lance Taylor  <iant@google.com>
8587
8588         PR 11084
8589         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8590         dynamic symbol table, use the normal symbol table.
8591         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8592         symbol table.
8593
8594 2010-01-08  Ian Lance Taylor  <iant@google.com>
8595
8596         PR 11072
8597         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8598         sections.
8599
8600 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8601
8602         * version.cc (print_version): Change to "Copyright 2010".
8603
8604 2010-01-08  Ian Lance Taylor  <iant@google.com>
8605
8606         PR 10287
8607         PR 11063
8608         * i386.cc (class Target_i386): Change return type of plt_section
8609         to be non-const.
8610         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8611         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8612         tls_desc_rel_ field.
8613         (Output_data_plt_i386::rel_tls_desc): New function.
8614         (Target_i386::rel_tls_desc_section): New function.
8615         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8616         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8617         R_386_TLS_DESC reloc in rel_tls_desc_section.
8618         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8619         Define struct Tlsdesc_info.
8620         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8621         (Target_x86_64::do_reloc_symbol_index): New function.
8622         (Target_x86_64::add_tlsdesc_info): New function.
8623         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8624         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8625         tlsdesc_rel_ field.
8626         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8627         all callers.
8628         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8629         (Target_x86_64::rela_tlsdesc_section): New function.
8630         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8631         handling.
8632         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8633         (Target_x86_64::do_reloc_addend): New function.
8634         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8635         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8636         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8637         (Output_reloc::type): New function.
8638         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8639         (Output_reloc::is_target_specific): New function.
8640         (Output_reloc::target_arg): New function.
8641         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8642         absolute relocs and target specific relocs.
8643         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8644         add_target_specific.
8645         (class Output_data_reloc) [SHT_RELA]: Likewise.
8646         * output.cc (Output_reloc::Output_reloc): Add four new versions
8647         for absolute relocs and target specific relocs.
8648         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8649         (Output_reloc::get_symbol_index): Likewise.
8650         (Output_reloc::local_section_offset): Check that local_sym_index_
8651         is not TARGET_CODE or 0.
8652         (Output_reloc::symbol_value): Likewise.
8653         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8654         reloc.
8655         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8656         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8657         functions.
8658         * layout.cc (add_target_dynamic_tags): Use output section for
8659         DT_PLTRELSZ and DT_JMPREL.
8660
8661 2010-01-07  Ian Lance Taylor  <iant@google.com>
8662
8663         PR 11061
8664         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8665         function.
8666         (class Output_data_reloc_generic): Define.
8667         (class Output_data_reloc_base): Change base class to
8668         Output_data_reloc_generic.  Change add() method to call
8669         bump_relative_reloc_count for a relative reloc.  Remove
8670         sort_relocs_ field.
8671         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8672         to sort_relocs().
8673         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8674         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8675         appropriate.
8676         * layout.h (class Layout): Update declaration.
8677
8678 2010-01-07  Ian Lance Taylor  <iant@google.com>
8679
8680         * output.h (class Output_data): Add const version of
8681         output_section and do_output_section.
8682         (class Output_section_data): Add const version of
8683         do_output_section.
8684         (class Output_section): Likewise.
8685         * layout.cc (Layout::add_target_dynamic_tags): New function.
8686         * layout.h (class Layout): Update declarations.
8687         * arm.cc (Target_arm::do_finalize_sections): Use
8688         add_target_dynamic_tags.
8689         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8690         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8691         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8692         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8693
8694 2010-01-07  Ian Lance Taylor  <iant@google.com>
8695
8696         PR 11042
8697         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8698         object as needed.
8699
8700 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8701             Ian Lance Taylor  <iant@google.com>
8702
8703         PR 11019
8704         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8705         Xindex::read_symtab_xindex.
8706
8707 2010-01-07  Doug Kwan  <dougkwan@google.com>
8708
8709         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8710         (Insn_template::thumb16_bcond_insn): New method declaration.
8711         (Insn_template): Fix spelling.
8712         (Stub::thumb16_special): New method declaration.
8713         (Stub::do_write): Define virtual method which was previously pure
8714         virtual.
8715         (Stub::do_thumb16_special): New method declaration.
8716         (Stub::do_fixed_endian_write): New template member.
8717         (Reloc_stub::do_write): Remove.
8718         (Reloc_stub::do_fixed_endian_write): Remove.
8719         (Cortex_a8_stub): New class definition.
8720         (Stub_factory::make_cortex_a8_stub): New method definition.
8721         (Stub_factory::Stub_factory): Add missing static storage class
8722         qualifier for elf32_arm_stub_a8_veneer_blx.
8723
8724 2010-01-07  Ian Lance Taylor  <iant@google.com>
8725
8726         PR 10980
8727         * options.h (class General_options): Add --warn-unresolved-symbols
8728         and --error-unresolved-symbols.
8729         * errors.cc (Errors::undefined_symbol): Implement
8730         --warn-unresolved-symbols.
8731
8732         * options.h (class General_options): Add -z text and -z textoff.
8733         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8734
8735 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8736
8737         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8738         (Garbage_collection::cident_sections): New function.
8739         (Garbage_collection::add_cident_section): New function.
8740         (Garbage_collection::cident_sections_): New member.
8741         (gc_process_relocs): Add references to sections whose names are C
8742         identifiers.
8743         * gold.h (cident_section_start_prefix): New constant.
8744         (cident_section_stop_prefix): New constant.
8745         (is_cident): New function.
8746         * layout.cc (Layout::define_section_symbols): Replace string constants
8747         with the newly defined constants.
8748         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8749         C identifiers.
8750         * testsuite/Makefile.am: Add gc_orphan_section_test.
8751         * testsuite/Makefile.in: Regenerate.
8752         * testsuite/gc_orphan_section_test.cc: New file.
8753         * testsuite/gc_orphan_section_test.sh: New file.
8754
8755 2010-01-06  Ian Lance Taylor  <iant@google.com>
8756
8757         PR 10980
8758         * options.h (class General_options): Add --warn-shared-textrel.
8759         * layout.cc (Layout::finish_dynamic_section): Implement
8760         --warn-shared-textrel.
8761
8762         PR 10980
8763         * options.h (class General_options): Add --warn-multiple-gp.
8764
8765 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8766
8767         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8768         $(THREADSLIB) and $(LIBDL).
8769         * Makefile.in: Rebuild.
8770
8771 2010-01-06  Ian Lance Taylor  <iant@google.com>
8772
8773         PR 10980
8774         * options.cc (General_options::parse_section_start): New function.
8775         (General_options::section_start): New function.
8776         (General_options::General_options): Initialize all members.
8777         * options.h: Include <map>
8778         (class General_options): Add --section-start.  Add section_starts_
8779         member.
8780         * layout.cc (Layout::attach_allocated_section_to_segment): If
8781         --section-start was used, set the address of the segment.  Remove
8782         local sort_sections.
8783         (Layout::relaxation_loop_body): If the address of the load segment
8784         has been set by --section-start, don't use it.
8785         * output.h (Output_segment::update_flags_for_output_section): New
8786         function.
8787         * output.cc (Output_segment::add_output_section): Call
8788         update_flags_for_output_section.
8789
8790 2010-01-05  Ian Lance Taylor  <iant@google.com>
8791
8792         PR 10980
8793         * options.h (class General_options): Add --undefined-version.
8794         * script.cc (struct Version_expression): Add was_matched_by_symbol
8795         field.
8796         (Version_script_info::matched_symbol): New function.
8797         (Version_script_info::get_symbol_version_helper): Call
8798         matched_symbol.
8799         (Version_script_info::check_unmatched_names): New function.
8800         * script.h (class Version_script_info): Update declarations.
8801         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8802
8803         * options.h (class General_options): Use DEFINE_bool_alias for
8804         allow_multiple_definition.
8805         * resolve.cc (Symbol_table::should_override): Don't test
8806         allow_multiple_definition.
8807
8808         PR 10980
8809         * options.h (class General_options): Add --cref.
8810         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8811         until after printing cref table.
8812         * cref.cc: Include "symtab.h".
8813         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8814         (Cref_table_compare::operator()): New function.
8815         (Cref_inputs::gather_cref): New function.
8816         (filecol): New static const.
8817         (Cref_inputs::print_cref): New function.
8818         (Cref::print_cref): New function.
8819         * cref.h: Include <cstdio>.
8820         (class Cref): Update declarations.
8821         * mapfile.h (Mapfile::file): New function.
8822         * object.h (class Object): Define Symbols.  Declare virtual
8823         do_get_global_symbols.
8824         (Object::get_global_symbols): New function.
8825         * object.cc (Input_objects::add_object): Pass object to cref_ if
8826         --cref.
8827         (Input_objects::archive_start): Likewise.
8828         (Input_objects::archive_stop): Likewise.
8829         (Input_objects::print_cref): New function.
8830         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8831         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8832         --cref.
8833         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8834         function.
8835         * plugin.h (class Sized_pluginobj): Update declarations.
8836
8837 2010-01-05  Ian Lance Taylor  <iant@google.com>
8838
8839         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8840         to is_default_version.  Rename insdef to insdefault.
8841         (Symbol_table::add_from_relobj): Rename def to is_default_version
8842         and local to is_forced_local.
8843         (Symbol_table::add_from_pluginobj): Likewise.
8844         (Symbol_table::add_from_dynobj): Likewise.
8845         (Symbol_table::define_special_symbol): Rename insdef to
8846         insdefault.
8847
8848 2010-01-04  Ian Lance Taylor  <iant@google.com>
8849
8850         PR 10980
8851         * options.h (class General_options): Add
8852         --allow-multiple-definition and -z muldefs.
8853         * resolve.cc (Symbol_table::should_override): Don't warn about a
8854         multiple symbol definition if --allow-multiple-definition or -z
8855         muldefs.
8856
8857         PR 10980
8858         * options.h (class General_options): Add --add-needed and
8859         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8860         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8861         error if --copy-dt-needed-entries aka --add-needed is used and
8862         would cause a change in behaviour.
8863
8864         PR 10980
8865         * options.h (class General_options): Add -G as a short version of
8866         --shared.  Add no-op options -assert, -g, and -i.
8867
8868 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8869
8870         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8871         check for .text or .gnu.linkonce.t sections.
8872         * icf.cc (Icf::find_identical_sections): Ditto.
8873         Change the detection for mangled function name within the section
8874         name.
8875         * icf.h (is_section_foldable_candidate): New function.
8876
8877 2009-12-30  Ian Lance Taylor  <iant@google.com>
8878
8879         PR 10980
8880         * options.h (class General_options): Permit two dashes with
8881         --retain-symbols-file.
8882
8883 2009-12-30  Ian Lance Taylor  <iant@google.com>
8884
8885         PR 10979
8886         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8887         don't put the file header and segment headers in the text
8888         segment.
8889
8890         PR 10979
8891         * common.cc (Sort_commons::operator()): Stabilize sort when both
8892         entries are NULL.
8893         (Symbol_table::do_allocate_commons_list): When allocating common
8894         symbols, skip a symbol which is no longer common.
8895         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8896         an object before checking its type.
8897         * testsuite/common_test_2.c: New file.
8898         * testsuite/common_test_3.c: New file.
8899         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8900         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8901         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8902         (common_test_2_pic.o, common_test_2.so): New targets.
8903         (common_test_3_pic.o, common_test_3.so): New targets.
8904         * testsuite/Makefile.in: Rebuild.
8905
8906         PR 10979
8907         * script.cc (read_input_script): If we see a new SECTIONS clause,
8908         and we have added an input section, give an error.
8909         * layout.h (class Layout): Add have_added_input_section function.
8910         Add have_added_input_section_ field.
8911         * layout.cc (Layout::Layout): Initialize
8912         have_added_input_section_.
8913         (Layout::layout): Set have_added_input_section_.
8914         (Layout::layout_eh_frame): Likewise.
8915
8916 2009-12-30  Ian Lance Taylor  <iant@google.com>
8917
8918         PR 10931
8919         * options.h (class General_options): Add --sort-common option.
8920         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8921         * common.cc (Sort_common): Add sort_order parameter to
8922         constructor.  Add sort_order_ field.
8923         (Sort_commons::operator): Check sort_order_.
8924         (Symbol_table::allocate_commons): Determine the sort order.
8925         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8926         Change all callers.
8927         (Symbol_table::do_allocate_commons_list): Likewise.
8928
8929 2009-12-30  Ian Lance Taylor  <iant@google.com>
8930
8931         PR 10916
8932         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8933         symbols from this object, don't change the visibility of an
8934         undefined symbol.
8935         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8936
8937 2009-12-30  Ian Lance Taylor  <iant@google.com>
8938
8939         PR 10861
8940         * script.h (class Version_script_info): Define Language enum.
8941         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8942         new fields globals_, locals_, and is_finalized_.
8943         * script.cc: Various formatting fixes.
8944         (class Parser_closure): Change language_stack_ from a vector of
8945         std::string to one of Version_script_info::Language.  Adjust all
8946         uses accordingly.
8947         (class Lazy_demangler): Remove.
8948         (struct Version_expression): Change language from std::string to
8949         Version_script_info::Language.
8950         (Version_script_info::Version_script_info): New function.
8951         (Version_script_info::~Version_script_info): Don't call clear.
8952         (Version_script_info::finalize): New function.
8953         (Version_script_info::build_lookup_tables): New function.
8954         (Version_script_info::build_expression_list_lookup): New
8955         function.
8956         (Version_script_info::get_symbol_version_helper): Rewrite to use
8957         lookup tables.
8958         (Version_script_info::print_expression_list): Adjust to use
8959         Version_script_info::Language.
8960         (script_push_lex_into_version_mode): Check that the version script
8961         has not been finalized.
8962         (version_script_push_lang): Change language string to
8963         Version_script_info::Language.
8964         * options.cc (Command_line::version_script): New function.
8965         * options.h (class General_options): Add finalize_dynamic_list
8966         function.  Change version_script from declaration to definition.
8967         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8968         * testsuite/version_script.map: Remove duplicate def of foo.
8969         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8970         version_script.map.
8971         * testsuite/Makefile.in: Rebuild.
8972
8973 2009-12-30  Ian Lance Taylor  <iant@google.com>
8974
8975         PR 10843
8976         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8977         if the input symbol index is 0, make the output symbol index 0.
8978
8979 2009-12-30  Ian Lance Taylor  <iant@google.com>
8980
8981         PR 10670
8982         * options.h (class General_options): Add -x/--discard-all.
8983         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8984         --discard-all.  If the local symbol needs a dynamic entry, check
8985         that before handling --discard-locals.
8986
8987 2009-12-30  Ian Lance Taylor  <iant@google.com>
8988
8989         PR 10450
8990         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8991         flags to PF_R.
8992         (Output_segment::add_output_section): Don't change the flags if
8993         the type is PT_TLS.
8994
8995         PR 10450
8996         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8997         GNU hash table if they need a dynamic value.  Otherwise, don't add
8998         them if they are defined in a dynamic object or are forced local.
8999
9000 2009-12-29  Ian Lance Taylor  <iant@google.com>
9001
9002         PR 10450
9003         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9004         .gnu.hash table for a 32-bit target.
9005
9006         PR 10450
9007         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9008         regular and a dynamic object only needs a dynamic symbol table
9009         entry if it is externally visible.
9010
9011         PR 10450
9012         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9013         constructor.  Add global_offset_table_ field.
9014         (Target_i386::got_section): Set global_offset_table_.
9015         (Target_i386::do_finalize_sections): Set global_offset_table_
9016         size.
9017         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9018         in constructor.  Add global_offset_table_ field.
9019         (Target_x86_64::got_section): Set global_offset_table_.
9020         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9021         size.
9022
9023         * layout.cc (Layout::Layout): Initialize increase_relro_.
9024         (Layout::get_output_section): Add is_relro, is_last_relro, and
9025         is_first_non_relro parameters.  Change all callers.
9026         (Layout::choose_output_section): Likewise.
9027         (Layout::add_output_section_data): Likewise.
9028         (Layout::make_output_section): Likewise.
9029         (Layout::set_segment_offsets): Clear increase_relro when using a
9030         linker script.
9031         * layout.h (class Layout): Add increase_relro method.  Add
9032         increase_relro_ field.  Update declarations.
9033         * output.cc (Output_section::Output_section): Initialize
9034         is_last_relro_ and is_first_non_relro_.
9035         (Output_segment::add_output_section): Group relro sections is
9036         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9037         (Output_segment::maximum_alignment): Remove relro handling.
9038         (Output_segment::set_section_addresses): Add increase_relro
9039         parameter.  Change all callers.  Add initial alignment to align
9040         relro sections on separate page.  Remove old relro handling.
9041         (Output_segment::set_section_list_addresses): Remove in_relro
9042         parameter.  Change all callers.
9043         (Output_segment::set_offset): Add increase parameter.  Change all
9044         callers.  Remove old relro handling.
9045         * output.h (class Output_section): Add new methods: is_last_relro,
9046         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9047         Add is_last_relro_ and is_first_non_relro_ fields.
9048         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9049         Create separate .got.plt section.  Call increase_relro.
9050         * x86_64.cc (Target_x86_64::got_section): Likewise.
9051         * testsuite/relro_script_test.t: Add .got.plt.
9052
9053         PR 10450
9054         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9055         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9056         (Layout::finalize): Call set_dynamic_symbol_size.
9057         (Layout::set_dynamic_symbol_size): New function.
9058         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9059         set_dynamic_symbol_size.
9060
9061         PR 10450
9062         * output.h (class Output_section): Add is_entsize_zero_ field.
9063         * output.cc (Output_section::Output_section): Initialize
9064         is_entsize_zero_.
9065         (Output_section::set_entsize): If two different entsizes are
9066         requested, force it to zero.
9067         (Output_section::add_input_section): Set flags for .debug_str
9068         before updating section flags.  Set entsize.
9069         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9070         and SHF_STRING if all input sections have those flags.
9071
9072 2009-12-29   Rafael Espindola  <espindola@google.com>
9073
9074         * main.cc (main): Fix the sys time reporting.
9075         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9076         reporting.
9077
9078 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9079
9080         * options.cc (General_options::parse_version): Allow -v to exit
9081         without an error if there is nothing to link.
9082
9083 2009-12-29  Ian Lance Taylor  <iant@google.com>
9084
9085         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9086         using a version of gcc before 4.1.
9087         * configure: Rebuild.
9088
9089 2009-12-28  Chris Demetriou  <cgd@google.com>
9090
9091         * attributes.cc (Output_attributes_section_data::do_write): Use
9092         std::vector::front rather than std::vector::data.
9093
9094 2009-12-28  Ian Lance Taylor  <iant@google.com>
9095
9096         * symtab.h (class Symbol_table): Add enum Defined.
9097         * resolve.cc (Symbol_table::should_override): Add defined
9098         parameter.  Change all callers.  Test whether object is NULL
9099         before calling a method on it.
9100         (Symbol_table::report_resolve_problem): Add defined parameter.
9101         Change all callers.
9102         (Symbol_table::should_override_with_special): Likewise.
9103         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9104         parameter.  Change all callers.
9105         (Symbol_table::do_define_in_output_data): Likewise.
9106         (Symbol_table::define_in_output_segment): Likewise.
9107         (Symbol_table::do_define_in_output_segment): Likewise.
9108         (Symbol_table::define_as_constant): Likewise.
9109         (Symbol_table::do_define_as_constant): Likewise.
9110         * script.h (class Symbol_assignment): Add is_defsym parameter to
9111         constructor; change all callers.
9112         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9113         parameter.  Change all callers.  Add is_defsym_ field.
9114         (class Parser_closure): Add parsing_defsym parameter to
9115         constructor; change all callers.  Add parsing_defsym accessor
9116         function.  Add parsing_defsym_ field.
9117
9118 2009-12-28  Ian Lance Taylor  <iant@google.com>
9119
9120         * gold.cc (queue_middle_tasks): Fix formatting.
9121         * object.cc (Relobj::is_section_name_included): Likewise.
9122
9123 2009-12-23  Ian Lance Taylor  <iant@google.com>
9124
9125         * i386.cc (Target_i386::do_calls_non_split): Recognize
9126         -fsplit-stack prologue for a function with a static chain.
9127         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9128         -fsplit-stack prologue when using %r11.
9129
9130 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9131
9132         * options.cc (General_options::parse_version): Make -v continue and do
9133         the link like GNU ld does.
9134
9135 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9136
9137         * Makefile.am (CCFILES): Add timer.cc.
9138         (HFILES): Add timer.h.
9139         * configure.ac: Check for sysconf and times.
9140         * main.cc: include timer.h.
9141         (main): Use Timer instead of get_run_time.
9142         * timer.cc: New.
9143         * timer.h: New.
9144         * workqueue.cc: include timer.h.
9145         (Workqueue::find_and_run_task):
9146         Report user, sys and wall time.
9147         * Makefile.in: Regenerate.
9148         * config.in: Regenerate.
9149         * configure: Regenerate.
9150
9151 2009-12-16  Doug Kwan  <dougkwan@google.com>
9152
9153         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9154         sections.
9155         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9156         relaxed input sections.
9157         * output.cc (Output_section::find_relaxed_input_section): Change
9158         return type to Output_relaxed_input_section pointer.  Adjust code
9159         for new type of relaxed_input_section_map_.
9160         * output.h (Output_section::find_relaxed_input_section): Change
9161         return type to Output_relaxed_input_section pointer.
9162         (Output_section::Output_relaxed_input_section_by_input_section_map):
9163         New type.
9164         (Output_section::relaxed_input_section_map_): Change type to
9165         Output_section::Output_relaxed_input_section_by_input_section_map.
9166         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9167         input section.
9168
9169 2009-12-15  Ian Lance Taylor  <iant@google.com>
9170
9171         * layout.cc (Layout::create_shstrtab): Only write out after input
9172         sections if we are compressing debug sections.
9173
9174 2009-12-15  Ian Lance Taylor  <iant@google.com>
9175
9176         * archive.cc (Archive::add_symbols): Only look up a symbol without
9177         a version if there is, in fact, a version.
9178
9179 2009-12-14  Ian Lance Taylor  <iant@google.com>
9180
9181         Revert -Wshadow changes, all changes from:
9182         2009-12-11  Doug Kwan  <dougkwan@google.com>
9183         2009-12-11  Nick Clifton  <nickc@redhat.com>
9184         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9185
9186 2009-12-11  Doug Kwan  <dougkwan@google.com>
9187
9188         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9189         due to -Wshadow.
9190         * attributes.cc (Object_attribute::size): Ditto.
9191         (Attributes_section_data::size): Ditto.
9192         (Attributes_section_data::Attributes_section_data): Ditto.
9193         (Output_attributes_section_data::do_write): Ditto.
9194         * attributes.h (Object_attribute::set_type): Ditto.
9195         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9196
9197 2009-12-11  Nick Clifton  <nickc@redhat.com>
9198
9199         * archive.cc: Fix shadowed variable warnings.
9200         * arm.cc: Likewise.
9201         * compressed_output.cc: Likewise.
9202         * compressed_output.h: Likewise.
9203         * configure: Likewise.
9204         * dwarf_reader.cc: Likewise.
9205         * dynobj.cc: Likewise.
9206         * dynobj.h: Likewise.
9207         * ehframe.cc: Likewise.
9208         * ehframe.h: Likewise.
9209         * errors.cc: Likewise.
9210         * expression.cc: Likewise.
9211         * fileread.cc: Likewise.
9212         * fileread.h: Likewise.
9213         * freebsd.h: Likewise.
9214         * i386.cc: Likewise.
9215         * icf.cc: Likewise.
9216         * incremental.h: Likewise.
9217         * layout.cc: Likewise.
9218         * layout.h: Likewise.
9219         * mapfile.cc: Likewise.
9220         * merge.cc: Likewise.
9221         * merge.h: Likewise.
9222         * object.cc: Likewise.
9223         * object.h: Likewise.
9224         * options.h: Likewise.
9225         * output.cc: Likewise.
9226         * output.h: Likewise.
9227         * parameters.cc: Likewise.
9228         * plugin.cc: Likewise.
9229         * powerpc.cc: Likewise.
9230         * reduced_debug_output.cc: Likewise.
9231         * reduced_debug_output.h: Likewise.
9232         * reloc.cc: Likewise.
9233         * reloc.h: Likewise.
9234         * resolve.cc: Likewise.
9235         * script-sections.cc: Likewise.
9236         * script.cc: Likewise.
9237         * script.h: Likewise.
9238         * sparc.cc: Likewise.
9239         * symtab.cc: Likewise.
9240         * symtab.h: Likewise.
9241         * target-select.cc: Likewise.
9242         * target-select.h: Likewise.
9243         * token.h: Likewise.
9244         * workqueue.cc: Likewise.
9245         * workqueue.h: Likewise.
9246         * x86_64.cc: Likewise.
9247
9248 2009-12-10  Doug Kwan  <dougkwan@google.com>
9249
9250         * arm.cc (attributes.h): New include.
9251         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9252         (Arm_relobj::~Arm_relobj): Delete object pointed by
9253         attributes_section_data_.
9254         (Arm_relobj::attributes_section_data): New method definition.
9255         (Arm_relobj::attributes_section_data_): New data member declaration.
9256         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9257         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9258         attributes_section_data_.
9259         (Arm_dynobj::attributes_section_data): New method definition.
9260         (Arm_dynobj::attributes_section_data_): New data member declaration.
9261         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9262         initialization value of may_use_blx_ to false.
9263         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9264         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9265         object attributes to compute results instead of hard-coding.
9266         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9267         Target_arm::get_secondary_compatible_arch,
9268         Target_arm::set_secondary_compatible_arch
9269         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9270         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9271         New method declarations.
9272         (Target_arm::get_aeabi_object_attribute): New method definition.
9273         (Target_arm::attributes_section_data_): New data member declaration.
9274         (read_arm_attributes_section): New template definition.
9275         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9276         (Arm_dynobj::do_read_symbols): Ditto.
9277         (Target_arm::do_finalize_sections): Merge attributes sections from
9278         input.  Check for BLX use after attributes section merging.
9279         Fix __exidx_start and __exidx_end visibility.  Create an
9280         .ARM.attributes section if necessary.
9281         (Target_arm::get_secondary_compatible_arch,
9282         Target_arm::set_secondary_compatible_arch,
9283         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9284         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9285         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9286         New method definitions.
9287
9288 2009-12-09  Ian Lance Taylor  <iant@google.com>
9289
9290         * plugin.cc (Plugin::load): Don't cast from void* to a function
9291         pointer.
9292
9293 2009-12-09  Ian Lance Taylor  <iant@google.com>
9294
9295         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9296         information fields.
9297
9298 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9299
9300         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9301         Replace two_file_shared_1.so with two_file_shared_2.so.
9302         * testsuite/Makefile.in: Regenerated.
9303
9304 2009-12-08  Doug Kwan  <dougkwan@google.com>
9305
9306         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9307         (HFILES): Add attributes.h and int_encoding.h.
9308         * Makefile.in: Regenerate.
9309         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9310         function definitions to int_encoding.cc
9311         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9312         prototypes to int_encoding.h
9313         * reduced_debug_output.cc (int_encoding.h): New include.
9314         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9315         function definitions to int_encoding.cc
9316         (insert_into_vector, read_from_pointer): Move template definitions to
9317         int_encoding.h
9318         * attributes.cc: New file.
9319         * attributes.h: New file.
9320         * int_encoding.cc: New file.
9321         * int_encoding.h: New file.
9322
9323 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9324
9325         PR gold/11055
9326         * incremental-dump.cc (dump_incremental_inputs): New.
9327         (main): Use dump_incremental_inputs.
9328
9329 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9330
9331         PR gold/10893
9332         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9333         checking elfcpp::STT_FUNC.
9334         (Target_i386::Relocate::relocate): Likewise.
9335         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9336
9337         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9338         symbols from shared libraries into normal FUNC symbols.
9339
9340         * symtab.h (Symbol): Add is_func and use it.
9341
9342 2009-12-05  Doug Kwan  <dougkwan@google.com>
9343
9344         * arm.cc (Target_arm::arm_info): Initialize new fields
9345         attributes_section and attributes_vendor.
9346         * i386.cc (Target_i386::i386_info): Same.
9347         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9348         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9349         fields attributes_section and attributes_vendor.
9350         * sparc.cc (Target_sparc::sparc_info): Same.
9351         * target.h (Target::attributes_section, Target::attributes_vendor,
9352         Target::is_attributes_section, Target::attribute_arg_type,
9353         Target::attributes_order): New method definitions.
9354         (Target::Target_info::attributes_section,
9355         Target::Target_info::attributes_vendor): New fields.
9356         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9357         virtual method definitions.
9358         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9359         attributes_section and attributes_vendor.
9360         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9361
9362 2009-12-05  Doug Kwan  <dougkwan@google.com>
9363
9364         * arm.cc: Update comments about interworking and stub generation.
9365         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9366         considered as non-PIC.
9367         (Arm_relocate_functions::base_abs): Fix formatting.
9368         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9369         of function to use GOT entry address instead of offset.
9370         (Target_arm::Scan::global): Issue an error if a symbol would need a
9371         PLT does not get one because it is untyped.  Remove code to create
9372         dynamic symbols for relative branches.
9373         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9374         takes unsigned integer instead of boolean.
9375
9376 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9377
9378         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9379         (two_file_test_LDADD): Likewise.
9380         (common_test_1_LDADD): Likewise.
9381         (exception_test_LDADD) Likewise.
9382         (weak_test_LDADD): Likewise.
9383         (many_sections_test_LDADD): Likewise.
9384         (initpri1_LDADD): Likewise.
9385         (script_test_1_LDADD): Likewise.
9386         (script_test_2_LDADD): Likewise.
9387         (justsyms_LDADD): Likewise.
9388         (binary_test_LDADD): Likewise.
9389         (large_LDADD): Likewise.
9390         * testsuite/Makefile.in: Regenerated.
9391
9392 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9393
9394         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9395         (Symbol_table::override_with_special): Likewise.
9396         (Symbol_table::add_from_object): Likewise.
9397
9398 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9399
9400         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9401         Don't set the data_offset twice.
9402
9403 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9404
9405         * testsuite/Makefile.in: Regenerate.
9406
9407 2009-12-03  Doug Kwan  <dougkwan@google.com>
9408
9409         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9410         (Target_arm::do_finalize_sections): Add parameter for symbol table
9411         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9412         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9413         parameter for symbol table pointer.
9414         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9415         an additional parameter for a pointer to symbol table.
9416         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9417         parameter for a symbol table pointer.
9418         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9419         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9420         Ditto.
9421         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9422         parameter for a symbol table pointer.
9423
9424 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9425
9426         * incremental.cc (Incremental_inputs_header)
9427         (Incremental_inputs_header_write, Incremental_inputs_entry)
9428         (Incremental_inputs_entry_write): Move ...
9429         * incremental.h (Incremental_inputs_header)
9430         (Incremental_inputs_header_write, Incremental_inputs_entry)
9431         (Incremental_inputs_entry_write): here.
9432
9433 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9434
9435         * incremental.cc (make_sized_incremental_binary): Set the target.
9436         Error if it is incompatible.
9437         * output.h (Output_file): Add filename method.
9438
9439 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9440
9441         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9442         from the get_* methods.
9443
9444 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9445
9446         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9447         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9448         Write 0 for the data_offset of scripts.
9449
9450 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9451
9452         * testsuite/Makefile.am: Add the incremental_test.sh test.
9453         * testsuite/incremental_test.sh: New.
9454         * testsuite/incremental_test_1.c: New.
9455         * testsuite/incremental_test_2.c: New.
9456
9457 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9458
9459         * incremental-dump.cc (main): Fix typos.
9460
9461 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9462
9463         PR gold/11025
9464         * incremental-dump.cc (main): Use llu to print 64 bit values.
9465
9466 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9467             H.J. Lu  <hongjiu.lu@intel.com>
9468
9469         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9470         $(LIBDL).
9471         (incremental_dump_LDADD): Likewise.
9472         * Makefile.in: Regenerated.
9473
9474 2009-11-25  Doug Kwan  <dougkwan@google.com>
9475
9476         Revert:
9477
9478         2009-11-25  Doug Kwan  <dougkwan@google.com>
9479
9480                 * arm.cc (Target_arm::Target_arm): Move method definition
9481                 outside of class definition.  Add code to handle
9482                 --target1-rel, --target1-abs and --target2= options.
9483                 (Target_arm::get_reloc_reloc_type): Change method to be
9484                 non-static and const.
9485                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9486                 New data member declaration.
9487                 (Target_arm::Scan::local, Target_arm::Scan::global,
9488                 Target_arm::Relocate::relocate,
9489                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9490                 Adjust call to Target_arm::get_real_reloc_type.
9491                 (Target_arm::get_real_reloc_type): Use command line options
9492                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9493                 * options.h (--target1-rel, --target1-abs, --target2): New
9494                 ARM-only options.
9495
9496 2009-11-25  Doug Kwan  <dougkwan@google.com>
9497
9498         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9499         class definition.  Add code to handle --target1-rel, --target1-abs
9500         and --target2= options.
9501         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9502         and const.
9503         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9504         member declaration.
9505         (Target_arm::Scan::local, Target_arm::Scan::global,
9506         Target_arm::Relocate::relocate,
9507         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9508         call to Target_arm::get_real_reloc_type.
9509         (Target_arm::get_real_reloc_type): Use command line options to
9510         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9511         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9512         options.
9513
9514 2009-11-25  Doug Kwan  <dougkwan@google.com>
9515
9516         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9517         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9518         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9519         formatting.
9520         (Arm_relocate_functions::thm_call): Replace body with a call to
9521         Arm_relocate_functions::thumb_branch_common.
9522         (Arm_relocate_functions::thm_jump24,
9523         Arm_relocate_functions::thm_xpc22): New method definitions.
9524         (Arm_relocate_functions::thumb_branch_common): New method definition.
9525         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9526         operator.
9527         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9528         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9529
9530 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9531
9532         * Makefile.am: Build incremental-dump
9533         * Makefile.in: Regenerate.
9534         * incremental-dump.cc: New.
9535         * incremental.cc (Incremental_inputs_header_data,
9536         Incremental_inputs_entry_data): Move to incremental.h
9537         * incremental.h: (Incremental_inputs_header_data,
9538         Incremental_inputs_entry_data): Move from incremental.cc
9539
9540 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9541
9542         * incremental.cc (Incremental_inputs_header,
9543         Incremental_inputs_header_write, Incremental_inputs_entry,
9544         Incremental_inputs_entry_write): Add a typedef with the data type.
9545
9546 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9547
9548         * incremental.cc (Incremental_inputs_header,
9549         Incremental_inputs_header_write, Incremental_inputs_entry,
9550         Incremental_inputs_entry_write): Update comment about which
9551         type has the filed descriptions.
9552
9553 2009-11-15  Doug Kwan  <dougkwan@google.com>
9554
9555         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9556         (Arm_relocate_functions::arm_branch_common): Change method defintion
9557         in class definition to a method declaration and update list of formal
9558         parameters.
9559         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9560         Arm_relocation_functions::jump24): Adjust call to
9561         Arm_relocate_functions::arm_branch_common.  Update list of formal
9562         parameters.
9563         (Arm_relocate_functions::xpc25): New method definition.
9564         (Arm_relocate_functions::arm_branch_common): Move method defintion
9565         out from class definition.  Use stubs for mode-switching and extending
9566         branch ranges.
9567         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9568         specially.  Change code to enable use of stubs in ARM branches.
9569
9570 2009-11-10  Doug Kwan  <dougkwan@google.com>
9571
9572         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9573         in method declaration.
9574         (Target_arm::relocate_stub): New method declaration.
9575         (Target_arm::default_target): Change to return a pointer instead of
9576         a const reference.
9577         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9578         Target_arm::default_target.
9579         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9580         method definition.
9581         (Target_arm::relocate_section): Adjust view.
9582         (Target_arm::relocate_stub): New method definition.
9583
9584 2009-11-10  Doug Kwan  <dougkwan@google.com>
9585
9586         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9587         a format warning.
9588         * incremental.cc (open_incremental_binary): Initialized local
9589         variables to avoid warnings.
9590         * object.cc (make_elf_object): Ditto.
9591         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9592         a format warning.
9593
9594 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9595
9596         PR gold/10930
9597         * testsuite/plugin_test.c: Include "config.h".
9598
9599 2009-11-09  Doug Kwan  <dougkwan@google.com>
9600
9601         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9602         (arm_symbol_value): Remove.
9603         (Arm_relocate_functions::arm_branch_common,
9604         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9605         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9606         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9607         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9608         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9609         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9610         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9611         Arm_relocate_functions::thm_mobw_abs_nc,
9612         Arm_relocate_functions::thm_mov_abs,
9613         Arm_relocate_functions::movw_prel_nc,
9614         Arm_relocate_functions::thm_movt_abs,
9615         Arm_relocate_functions::movt_prel,
9616         Arm_relocate_functions::thm_movw_prel_nc,
9617         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9618         (Target_arm::Relocate::relocate): Only decompose address into two
9619         parts if relocation type uses the thumb-bit and pass the actual
9620         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9621         calls to methods in Arm_relocate_functions for this change.
9622
9623 2009-11-08  Ian Lance Taylor  <iant@google.com>
9624
9625         PR 10925
9626         * reloc.cc: Instantiate
9627         Sized_relobj::initialize_input_to_output_maps and
9628         Sized_relobj:free_input_to_output_maps.
9629
9630 2009-11-06  Ian Lance Taylor  <iant@google.com>
9631
9632         PR 10876
9633         * defstd.cc (in_segment): Set only_if_ref true for "end".
9634
9635 2009-11-06  Doug Kwan  <dougkwan@google.com>
9636
9637         * arm.cc (class Reloc_stub): Correct a comment.
9638         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9639         (Target_arm::scan_section_for_stubs): New method declaration.
9640         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9641         Change methods from private to protected.
9642         (Target_arm::do_may_relax): New method definition.
9643         (Target_arm::do_relax, Target_arm::group_sections,
9644         Target_arm::scan_reloc_for_stub,
9645         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9646         (Target_arm::arm_input_section_map_): New data member declaration.
9647         (Target_arm::scan_reloc_for_stub,
9648         Target_arm::scan_reloc_section_for_stubs,
9649         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9650         Target_arm::do_relax): New method definitions.
9651
9652 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9653
9654         * configure.ac: Check for (struct stat)::st_mtim
9655         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9656         * config.in: Regenerate.
9657         * configure: Regenerate.
9658
9659 2009-11-05  Ian Lance Taylor  <iant@google.com>
9660
9661         PR 10910
9662         * output.cc (Output_segment::add_output_section): Add missing
9663         return statement.
9664
9665 2009-11-04  Ian Lance Taylor  <iant@google.com>
9666
9667         PR 10880
9668         * object.h (class Object): Add is_needed and set_is_needed
9669         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9670         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9671         defined in a dynamic object and referenced by a regular object,
9672         set is_needed for the dynamic object.
9673         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9674         if the file is marked with as_needed and it is not needed.
9675
9676 2009-11-04  Ian Lance Taylor  <iant@google.com>
9677
9678         PR 10887
9679         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9680         tags if data is discarded by linker script.
9681         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9682         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9683         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9684         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9685
9686 2009-11-04  Ian Lance Taylor  <iant@google.com>
9687
9688         * layout.cc (Layout::get_output_section): Add is_interp and
9689         is_dynamic_linker_section parameters.  Change all callers.
9690         (Layout::choose_output_section): Likewise.
9691         (Layout::make_output_section): Likewise.
9692         (Layout::add_output_section_data): Add is_dynamic_linker_section
9693         parameter.  Change all callers.
9694         * layout.h (class Layout): Update declarations.
9695         * output.h (class Output_section): Add is_interp, set_is_interp,
9696         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9697         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9698         generate_code_fills_at_write_ to a bitfield.
9699         * output.cc (Output_section::Output_sections): Initialize new
9700         fields.
9701         (Output_segment::add_output_section): Add do_sort parameter.
9702         Change all callers.
9703
9704 2009-11-03  Ian Lance Taylor  <iant@google.com>
9705
9706         PR 10860
9707         * options.h (class General_options): Add --warn-common.
9708         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9709         merging two common symbols.
9710         (Symbol_table::should_override): Handle --warn-common when merging
9711         a common symbol with a defined symbol.  Use report_resolve_problem
9712         for multiple definitions.
9713         (Symbol_table::report_resolve_problem): New function.
9714         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9715
9716 2009-11-03  Doug Kwan  <dougkwan@google.com>
9717
9718         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9719         stub_factory_.
9720         (Target_arm::stub_factory): New method definition.
9721         (Target_arm::new_arm_input_section,
9722         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9723         Target_arm::reloc_uses_thumb_bit): New method declarations.
9724         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9725         New type definitions.
9726         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9727         member declarations.
9728         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9729         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9730         New method definitions.
9731
9732 2009-11-03  Ian Lance Taylor  <iant@google.com>
9733
9734         * options.h (class General_options): Add --warn_constructors.
9735
9736 2009-11-03  Ian Lance Taylor  <iant@google.com>
9737
9738         PR 10893
9739         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9740         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9741
9742 2009-11-03  Ian Lance Taylor  <iant@google.com>
9743
9744         PR 10895
9745         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9746         --msgid-bugs-address.
9747         (install-pdf): New target.
9748         (install-data_yes): Look up one directory to find mkinstalldirs.
9749
9750 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9751
9752         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9753         tree.
9754
9755 2009-10-30  Doug Kwan  <dougkwan@google.com>
9756
9757         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9758
9759 2009-10-30  Doug Kwan  <dougkwan@google.com>
9760
9761         * arm.cc (Stub_addend_reader): New struct template definition
9762         and partial specializations.
9763         (Stub_addend_reader::operator()): New method definition for a
9764         partially specialized template.
9765
9766 2009-10-30  Doug Kwan  <dougkwan@google.com>
9767
9768         * arm.cc (Arm_relobj::processor_specific_flags): New method
9769         definition.
9770         (Arm_relobj::do_read_symbols): New method declaration.
9771         (Arm_relobj::processor_specific_flags_): New data member declaration.
9772         (Arm_dynobj): New class definition.
9773         (Target_arm::do_finalize_sections): Add input_objects parameter.
9774         (Target_arm::do_adjust_elf_header): New method declaration.
9775         (Target_arm::are_eabi_versions_compatible,
9776         (Target_arm::merge_processor_specific_flags): New method declaration.
9777         (Target_arm::do_make_elf_object): New overloaded method definitions
9778         and declaration.
9779         (Arm_relobj::do_read_symbols): New method definition.
9780         (Arm_dynobj::do_read_symbols): Ditto.
9781         (Target_arm::do_finalize_sections): Add input_objects parameters.
9782         Merge processor-specific flags from all input objects.
9783         (Target_arm::are_eabi_versions_compatible,
9784         Target_arm::merge_processor_specific_flags,
9785         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9786         New method definitions.
9787         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9788         Input_objects pointer type parameter.
9789         * layout.cc (Layout::finalize): Pass input objects to target's.
9790         finalize_sections function.
9791         * output.cc (Output_file_header::do_sized_write): Set ELF file
9792         header's processor-specific flags.
9793         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9794         Input_objects pointer type parameter.
9795         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9796         * target.h (Input_objects): New forward class declaration.
9797         (Target::processor_specific_flags,
9798         Target::are_processor_specific_flags_sect): New method definitions.
9799         (Target::finalize_sections): Add input_objects parameter.
9800         (Target::Target): Initialize processor_specific_flags_ and
9801         are_processor_specific_flags_set_.
9802         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9803         parameter.
9804         (Target::set_processor_specific_flags): New method definition.
9805         (Target::processor_specific_flags_,
9806         Target::are_processor_specific_flags_set_): New data member
9807         declarations.
9808         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9809         Input_objects pointer type parameter.
9810
9811 2009-10-30  Doug Kwan  <dougkwan@google.com>
9812
9813         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9814
9815 2009-10-28  Ian Lance Taylor  <iant@google.com>
9816
9817         * object.h (class Relobj): Drop options parameter from
9818         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9819         do_scan_relocs, do_relocate.  Change all callers.
9820         (class Sized_relobj): Drop options parameters from
9821         do_gc_process_relocs, do_scan_relocs, do_relocate,
9822         do_relocate_sections, relocate_sections, emit_relocs_scan,
9823         emit_relocs_scan_reltype.  Change all callers.
9824         (struct Relocate_info): Remove options field and all references to
9825         it.
9826         * reloc.h (class Read_relocs): Remove options constructor
9827         parameter and options_ field.  Change all callers.
9828         (class Gc_process_relocs, class Scan_relocs): Likewise.
9829         (class Relocate_task): Likewise.
9830         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9831         all callers.
9832         (scan_relocatable_relocs): Likewise.
9833         * target.h (class Sized_target): Remove options parameter from
9834         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9835         all callers.
9836         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9837         callers.
9838         * arm.cc: Update functions to remove options parameters.
9839         * i386.cc: Likewise.
9840         * powerpc.cc: Likewise.
9841         * sparc.cc: Likewise.
9842         * x86_64.cc: Likewise.
9843         * testsuite/testfile.cc: Likewise.
9844
9845 2009-10-28  Doug Kwan  <dougkwan@google.com>
9846
9847         * arm.cc (Arm_relobj): New class definition.
9848         (Arm_relobj::scan_sections_for_stubs,
9849         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9850         New method definitions.
9851
9852 2009-10-28  Cary Coutant  <ccoutant@google.com>
9853
9854         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9855         (Plugin::cleanup_done_): New member.
9856         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9857         (Plugin_manager::cleanup_done_): Remove.
9858         (Plugin_manager::add_input_file): Edit error message.
9859         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9860         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9861
9862 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9863
9864         * fileread.cc: (File_read::View::~View): Use the new
9865         data_ownership_ filed.
9866         (File_read::~File_read): Dispose the new whole_file_view_.
9867         (File_read::open): Mmap the whole file if needed.
9868         (File_read::open): Use whole_file_view_ instead of contents_.
9869         (File_read::find_view): Use whole_file_view_ if applicable.
9870         (File_read::do_read): Use whole_file_view_ instead of contents_.
9871         (File_read::make_view): Use whole_file_view_ instead of contents_,
9872         update File_read::View::View call.
9873         (File_read::find_or_make_view): Update File_read::View::View
9874         call.
9875         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9876         remove contents_
9877         (File_read::View::Data_ownership): New enum.
9878         (File_read::View::View): Replace bool mapped_ with Data_ownership
9879         argument.
9880         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9881         (File_read::View::data_ownership_): New field.
9882         (File_read::contents_): Remove (replaced by whole_file_view_).
9883         (File_read::whole_file_view_): New field.
9884         * options.h (class General_options): Add --keep-files-mapped.
9885
9886 2009-10-27  Cary Coutant  <ccoutant@google.com>
9887
9888         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9889         * testsuite/Makefile.am (plugin_test_5): New test case.
9890         * testsuite/Makefile.in: Regenerate.
9891
9892 2009-10-25  Doug Kwan  <dougkwan@google.com>
9893
9894         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9895         from private to protected to allow access by child class.
9896         (Sized_relobj::do_relocate_sections): New method declaration.
9897         (Sized_relobj::relocate_sections): Virtualize.
9898         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9899         Sized_relobj::relocate_sections.  Instantiate template explicitly
9900         for different target sizes and endianity.
9901
9902 2009-10-24  Doug Kwan  <dougkwan@google.com>
9903
9904         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9905         (Arm_input_section::as_arm_input_section): New method.
9906         (Arm_output_section): New class definition.
9907         (Arm_output_section::create_stub_group,
9908         Arm_output_section::group_sections): New method definitions.
9909
9910 2009-10-22  Doug Kwan  <dougkwan@google.com>
9911
9912         * arm.cc (Arm_input_section): New class definition.
9913         (Arm_input_section::init, Arm_input_section:do_write,
9914         Arm_input_section::set_final_data_size,
9915         Arm_input_section::do_reset_address_and_file_offset): New method
9916         definitions.
9917
9918 2009-10-21  Doug Kwan  <dougkwan@google.com>
9919
9920         * arm.cc (Stub_table, Arm_input_section): New forward class
9921         declarations.
9922         (Stub_table): New class defintion.
9923         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9924         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9925         New method definition.
9926
9927 2009-10-21  Doug Kwan  <dougkwan@google.com>
9928
9929         * arm.cc: Update copyright comments.
9930         (Target_arm): New forward class template declaration.
9931         (Arm_address): New type.
9932         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9933         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9934         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9935         constants.
9936         (Insn_template): Same.
9937         (DEF_STUBS): New macro.
9938         (Stub_type): New enum type.
9939         (Stub_template): New class definition.
9940         (Stub): Same.
9941         (Reloc_stub): Same.
9942         (Stub_factory): Same.
9943         (Target_arm::Target_arm): Initialize may_use_blx_ and
9944         should_force_pic_veneer_.
9945         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9946         Target_arm::should_force_pic_veneer,
9947         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9948         Target_arm::using_thumb_only, Target_arm:;default_target): New
9949         method defintions.
9950         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9951         New data member declarations.
9952         (Insn_template::size, Insn_template::alignment): New method defintions.
9953         (Stub_template::Stub_template): New method definition.
9954         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9955         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9956         (Stub_factory::Stub_factory): New method definition.
9957         * gold.h (string_hash): New template.
9958         * output.h (Input_section_specifier::hash_value): Use
9959         gold::string_hash.
9960         (Input_section_specifier::string_hash): Remove.
9961         * stringpool.cc (Stringpool_template::string_hash): Use
9962         gold::string_hash.
9963
9964 2009-10-20  Doug Kwan  <dougkwan@google.com>
9965
9966         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9967         symbols of relaxed input sections.
9968         * output.h (Output_section::find_relaxed_input_section): Make
9969         method public.
9970
9971 2009-10-16  Doug Kwan  <dougkwan@google.com>
9972
9973         * dynobj.cc (Versions::Versions): Initialize version_script_.
9974         Only insert base version symbol definition for a shared object
9975         if version script defines any version versions.
9976         (Versions::define_base_version): New method definition.
9977         (Versions::add_def): Check that base version is not needed.
9978         (Versions::add_need): Define base version lazily.
9979         * dynobj.h (Versions::define_base_version): New method declaration.
9980         (Versions::needs_base_version_): New data member declaration.
9981         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9982         (check_DATA): Add no_version_test.stdout.
9983         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9984         New make rules.
9985         * testsuite/Makefile.in: Regenerate.
9986         * testsuite/no_version_test.c: New file.
9987         * testsuite/no_version_test.sh: Ditto.
9988
9989 2009-10-16  Doug Kwan  <dougkwan@google.com>
9990
9991         * expression.cc (class Segment_start_expression): New class definition.
9992         (Segment_start_expression::value): New method definition.
9993         (script_exp_function_segment_start): Return a new
9994         Segment_start_expression.
9995         * gold/script-c.h (script_saw_segment_start_expression): New function
9996         prototype.
9997         * script-sections.cc (Script_sections::Script_sections): Initialize
9998         SAW_SEGMENT_START_EXPRESSION_ to false.
9999         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10000         and -Tbbs options to specify section addresses if given in
10001         command line and no SEGMENT_START expression is seen in a script.
10002         * script-sections.h (Script_sections::saw_segment_start_expression,
10003         Script_sections::set_saw_segment_start_expression): New method
10004         definition.
10005         (Script_sections::saw_segment_start_expression_): New data member
10006         declaration.
10007         * script.cc (script_saw_segment_start_expression): New function.
10008         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10009         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10010         script_test_7.sh and script_test_8.sh.
10011         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10012         script_test_8.stdout.
10013         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10014         (script_test_6, script_test_6.stdout, script_test_7,
10015         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10016         * Makefile.in: Regenerate.
10017         * testsuite/script_test_6.sh: New file.
10018         * testsuite/script_test_6.t: Same.
10019         * testsuite/script_test_7.sh: Same.
10020         * testsuite/script_test_7.t: Same.
10021         * testsuite/script_test_8.sh: Same.
10022
10023 2009-10-16  Doug Kwan  <dougkwan@google.com>
10024
10025         * output.cc (Output_segment::set_section_list_address): Cast
10026         expressions to unsigned long long type to avoid format warnings.
10027
10028 2009-10-15  Ian Lance Taylor  <iant@google.com>
10029
10030         * script.cc (Script_options::add_symbol_assignment): Always add a
10031         dot assignment to script_sections_.
10032         * script-sections.cc (Script_sections::add_dot_assignment):
10033         Initialize if necessary.
10034
10035         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10036         program headers with no load segment if there is a linker script.
10037
10038         * layout.cc (Layout::set_segment_offsets): Align the file offset
10039         to the segment aligment for -N or -n with no load segment.
10040         * output.cc (Output_segment::add_output_section): Don't crash if
10041         the first section is a TLS section.
10042         (Output_segment::set_section_list_addresses): Print an error
10043         message if the address moves backward in a linker script.
10044         * script-sections.cc
10045         (Output_section_element_input::set_section_addresses): Don't
10046         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10047         (Orphan_output_section::set_section_addresses): Likewise.
10048
10049 2009-10-15  Doug Kwan  <dougkwan@google.com>
10050
10051         * layout.cc (Layout::finish_dynamic_section): Generate tags
10052         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10053         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10054         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10055
10056 2009-10-14  Ian Lance Taylor  <iant@google.com>
10057
10058         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10059         fields.
10060         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10061         data_shdr fields of relinfo.
10062         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10063         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10064         R_386_TLS_LDO_32, adjust based on section flags.
10065         (Target_i386::Relocate::fix_up_ldo): Remove.
10066
10067 2009-10-13  Ian Lance Taylor  <iant@google.com>
10068
10069         Add support for -pie.
10070         * options.h (class General_options): Add -pie and
10071         --pic-executable.
10072         (General_options::output_is_position_independent): Test -pie.
10073         (General_options::output_is_executable): Return true if not shared
10074         and not relocatable.
10075         (General_options::output_is_pie): Remove.
10076         * options.cc (General_options::finalize): Reject incompatible uses
10077         of -pie.
10078         * gold.cc (queue_middle_tasks): A -pie link is not static.
10079         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10080         * symtab.cc (Symbol::final_value_is_known): Return false if
10081         output_is_position_independent.
10082         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10083         output_is_position_independent.
10084         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10085         output_is_position_independent.
10086         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10087         output_is_position_independent.
10088         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10089         two_file_pie_test.
10090         (basic_pie_test.o, basic_pie_test): New targets.
10091         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10092         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10093         (two_file_pie_test): New target.
10094         * testsuite/Makefile.in: Rebuild.
10095         * README: Remove note saying that -pie is not supported.
10096
10097 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10098
10099         * options.h (class General_options): Add -init and -fini.
10100         * layout.cc (Layout::finish_dynamic_section): Emit
10101         given init and fini functions.
10102
10103 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10104
10105         * gc.h (gc_process_relocs): Check if icf is enabled using new
10106         function.
10107         * gold.cc (queue_initial_tasks): Likewise.
10108         (queue_middle_tasks): Likewise.
10109         * object.cc (do_layout): Likewise.
10110         * symtab.cc (is_section_folded): Likewise.
10111         * main.cc (main): Likewise.
10112         * reloc.cc (Read_relocs::run): Likewise.
10113         (Sized_relobj::do_scan_relocs): Likewise.
10114         * icf.cc (is_function_ctor_or_dtor): New function.
10115         (Icf::find_identical_sections): Check if function is ctor or dtor when
10116         safe icf is chosen.
10117         * options.h (General_options::icf): Change option to be an enum.
10118         (Icf_status): New enum.
10119         (icf_enabled): New method.
10120         (icf_safe_folding): New method.
10121         (set_icf_status): New method.
10122         (icf_status_): New variable.
10123         * (options.cc) (General_options::finalize): Set icf_status_.
10124         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10125         icf_test and icf_keep_unique_test to use the --icf enum flag.
10126         * testsuite/icf_safe_test.sh: New file.
10127         * testsuite/icf_safe_test.cc: New file.
10128
10129 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10130
10131         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10132         includes to gc.h and icf.h.
10133         * arm.cc: Include gc.h.
10134         * gold.cc: Likewise.
10135         * i386.cc: Likewise.
10136         * powerpc.cc: Likewise.
10137         * sparc.cc: Likewise.
10138         * x86_64.cc: Likewise.
10139         * gc.h: Include icf.h.
10140
10141 2009-10-11  Ian Lance Taylor  <iant@google.com>
10142
10143         * plugin.cc: Include "gold.h" before other header files.
10144
10145 2009-10-10  Chris Demetriou  <cgd@google.com>
10146
10147         * options.h (Input_file_argument::Input_file_type): New enum.
10148         (Input_file_argument::is_lib_): Replace with...
10149         (Input_file_argument::type_): New member.
10150         (Input_file_argument::Input_file_argument): Take Input_file_type
10151         'type' rather than boolean 'is_lib' as second argument.
10152         (Input_file_argument::is_lib): Use type_.
10153         (Input_file_argument::is_searched_file): New function.
10154         (Input_file_argument::may_need_search): Handle is_searched_file.
10155         * options.cc (General_options::parse_library): Support -l:filename.
10156         (General_options::parse_just_symbols): Update for Input_file_argument
10157         changes.
10158         (Command_line::process): Likewise.
10159         * archive.cc (Archive::get_file_and_offset): Likewise.
10160         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10161         * script.cc (read_script_file, script_add_file): Likewise.
10162         * fileread.cc (Input_file::Input_file): Likewise.
10163         (Input_file::will_search_for): Handle is_searched_file.
10164         (Input_file::open): Likewise.
10165         * readsyms.cc (Read_symbols::get_name): Likewise.
10166         * testsuite/Makefile.am (searched_file_test): New test.
10167         * testsuite/Makefile.in: Regenerate.
10168         * testsuite/searched_file_test.cc: New file.
10169         * testsuite/searched_file_test_lib.cc: New file.
10170
10171 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10172             Ian Lance Taylor  <iant@google.com>
10173
10174         * descriptor.cc: Include <cstdio> and "binary-io.h".
10175         (Descriptors::open): Open the files in binary mode always.
10176         * script.cc (Lex::get_token): Treat \r as whitespace.
10177
10178 2009-10-09  Ian Lance Taylor  <iant@google.com>
10179
10180         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10181
10182 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10183             Ian Lance Taylor  <iant@google.com>
10184
10185         * configure.ac: Check for readv function also.
10186         * fileread.cc (readv): Define if not HAVE_READV.
10187         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10188         does not exist.
10189         * config.in: Regenerate.
10190         * configure: Regenerate.
10191
10192 2009-10-09  Doug Kwan  <dougkwan@google.com>
10193
10194         * layout.cc (Layout::make_output_section): Call target hook to make
10195         ordinary output section.
10196         (Layout::finalize): Adjust parameter list of call the
10197         Target::may_relax().
10198         * layout.h (class Layout::section_list): New method.
10199         * merge.h (Output_merge_base::entsize): Change visibility to public.
10200         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10201         New methods.
10202         (Output_merge_string::do_is_string): New method.
10203         * object.cc (Sized_relobj::do_setup): renamed from
10204         Sized_relobj::set_up.
10205         * object.h (Sized_relobj::adjust_shndx,
10206         Sized_relobj::initializ_input_to_output_maps,
10207         Sized_relobj::free_input_to_output_maps): Change visibilities to
10208         protected.
10209         (Sized_relobj::setup): Virtualize.
10210         (Sized_relobj::do_setup): New method declaration.
10211         (Sized_relobj::invalidate_section_offset,
10212         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10213         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10214         * options.cc (parse_int): New function.
10215         * options.h (parse_int): New declaration.
10216         (DEFINE_int): New macro.
10217         (stub_group_size): New option.
10218         * output.cc (Output_section::Output_section): Initialize memebers
10219         merge_section_map_, merge_section_by_properties_map_,
10220         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10221         (Output_section::add_input_section): Handled deferred code-fill
10222         generation and remove an old comment.
10223         (Output_section::add_relaxed_input_section): New method definition.
10224         (Output_section::add_merge_input_section): Use merge section by
10225         properties map to speed to search.  Update merge section maps
10226         as appropriate.
10227         (Output_section::build_relaxation_map): New method definition.
10228         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10229         Same.
10230         (Output_section::relax_input_section): Renamed to
10231         Output_section::convert_input_sections_to_relaxed_sections and change
10232         interface to take a vector of pointers to relaxed sections.
10233         (Output_section::find_merge_section,
10234         Output_section::find_relaxed_input_section): New method definitions.
10235         (Output_section::is_input_address_mapped,
10236         Output_section::output_offset, Output_section::output_address):
10237         Use output section data maps to speed up searching.
10238         (Output_section::find_starting_output_address): Add comments.
10239         (Output_section::do_write,
10240         Output_section::write_to_postprocessing_buffer): Do code-fill
10241         generation as appropriate.
10242         (Output_section::get_input_sections): Invalidate relaxed input section
10243         map.
10244         (Output_section::restore_states): Adjust type of checkpoint .
10245         Invalidate relaxed input section map.
10246         * output.h (Output_merge_base): New class declaration.
10247         (Input_section_specifier): New class defintion.
10248         (class Output_relaxed_input_section) Change base class to
10249         Output_section_data_build.
10250         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10251         base class initializer.
10252         (Output_section::add_relaxed_input_section): New method declaration.
10253         (Output_section::Input_section): Change visibility to protected.
10254         (Output_section::Input_section::relobj,
10255         Output_section::Input_section::shndx): Handle relaxed input sections.
10256         Output_section::input_sections) Change visibility to protected.  Also
10257         define overload to return a non-const pointer.
10258         (Output_section::Merge_section_properties): New class defintion.
10259         (Output_section::Merge_section_by_properties_map,
10260         Output_section::Output_section_data_by_input_section_map,
10261         Output_section::Relaxation_map): New types.
10262         (Output_section::relax_input_section): Rename method to
10263         Output_section::convert_input_sections_to_relaxed_sections and change
10264         interface to take a vector of relaxed section pointers.
10265         (Output_section::find_merge_section,
10266         Output_section::find_relaxed_input_section,
10267         Output_section::build_relaxation_map,
10268         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10269         New method declarations.
10270         (Output_section::merge_section_map_
10271         Output_section::merge_section_by_properties_map_,
10272         Output_section::relaxed_input_section_map_,
10273         Output_section::is_relaxed_input_section_map_valid_,
10274         Output_section::generate_code_fills_at_write_): New data members.
10275         * script-sections.cc
10276         (Output_section_element_input::set_section_addresses): Call
10277         current_data_size and addralign methods of relaxed input sections.
10278         (Orphan_output_section::set_section_addresses): Call current_data_size
10279         and addralign methods of relaxed input sections.
10280         * symtab.cc (Symbol_table::compute_final_value): Extract template
10281         from the body of Symbol_table::sized_finalize_symbol.
10282         (Symbol_table::sized_finalized_symbol): Call
10283         Symbol_table::compute_final_value.
10284         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10285         (Symbol_table::compute_final_value): New templated method declaration.
10286         * target.cc (Target::do_make_output_section): New method defintion.
10287         * target.h (Target::make_output_section): New method declaration.
10288         (Target::relax): Add more parameters for input objects, symbol table
10289         and layout.  Adjust call to do_relax.
10290         (Target::do_make_output_section): New method declaration.
10291         (Target::do_relax): Add parameters for input objects, symbol table
10292         and layout.
10293
10294 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10295
10296         * pread.c: Include stdio.h.
10297
10298 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10299
10300         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10301         defined.
10302
10303 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10304
10305         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10306         Change read_shndx type to unsigned int.
10307         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10308         int.
10309         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10310         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10311         Change read_shndx type to unsigned int.
10312         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10313         int.
10314         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10315         * layout.cc (Layout::create_symtab_sections): Cast the result of
10316         local_symcount * symsize to off_t in the gold_assert.
10317
10318 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10319
10320         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10321         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10322         R_ARM_BASE_ABS.
10323         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10324         (Arm_relocate_functions::thm_abs5): New function.
10325         (Arm_relocate_functions::abs12): New function.
10326         (Arm_relocate_functions::abs16): New function.
10327         (Arm_relocate_functions::base_abs): New function.
10328         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10329         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10330         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10331         R_ARM_BASE_ABS.
10332         (Scan::global): Likewise.
10333         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10334         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10335         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10336         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10337         R_ARM_BASE_ABS.
10338
10339 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10340
10341         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10342         (Arm_relocate_functions::movt_prel): New function.
10343         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10344         (Arm_relocate_functions::thm_movt_prel): New function.
10345         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10346         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10347         (Scan::global, Relocate::relocate): Likewise.
10348         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10349
10350 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10351
10352         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10353         Incremental_checker.
10354         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10355         unsigned int.
10356         (class Incremental_inputs_header): New class.
10357         (Incremental_inputs_header_writer): Edit comment.
10358         (Incremental_inputs_entry): New class.
10359         (Incremental_inputs_entry_writer): Edit comment.
10360         (Sized_incremental_binary::do_find_incremental_inputs_section):
10361         Add *strtab_shndx parameter, fill it.
10362         (Sized_incremental_binary::do_check_inputs): New method.
10363         (Incremental_checker::can_incrementally_link_output_file): Use
10364         Sized_incremental_binary::check_inputs.
10365         (Incremental_inputs::report_command_line): Save command line in
10366         command_line_.
10367         * incremental.h:
10368         (Incremental_binary::find_incremental_inputs_section): New
10369         method.
10370         (Incremental_binary::do_find_incremental_inputs_section): Add
10371         strtab_shndx parameter.
10372         (Incremental_binary::do_check_inputs): New pure virtual method.
10373         (Sized_incremental_binary::do_check_inputs): Declare.
10374         (Incremental_checker::Incremental_checker): Add incremental_inputs
10375         parameter, use it to initialize incremental_inputs_.
10376         (Incremental_checker::incremental_inputs_): New field.
10377         (Incremental_checker::command_line): New method.
10378         (Incremental_checker::inputs): New method.
10379         (Incremental_checker::command_line_): New field.
10380
10381 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10382
10383         * incremental.cc: Include <cstdarg> and "target-select.h".
10384         (vexplain_no_incremental): New function.
10385         (explain_no_incremental): New function.
10386         (Incremental_binary::error): New method.
10387         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10388         method.
10389         (make_sized_incremental_binary): New function.
10390         (open_incremental_binary): New function.
10391         (can_incrementally_link_file): Add checks if output is ELF and has
10392         inputs section.
10393         * incremental.h: Include "elfcpp_file.h" and "output.h".
10394         (Incremental_binary): New class.
10395         (Sized_incremental_binary): New class.
10396         (open_incremental_binary): Declare.
10397         * object.cc (is_elf_object): Use
10398         elfcpp::Elf_recognizer::is_elf_file.
10399         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10400         * output.h (Output_file::filesize): New method.
10401
10402 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10403
10404         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10405         New function.
10406         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10407         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10408         function.
10409         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10410         function.
10411         (Arm_relocate_functions::movw_abs_nc): New function.
10412         (Arm_relocate_functions::movt_abs): New function.
10413         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10414         (Arm_relocate_functions::thm_movt_abs): New function.
10415         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10416         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10417         (Scan::global): Likewise.
10418         (Relocate::relocate): Likewise.
10419         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10420
10421 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10422
10423         * arm.cc (Arm_relocate_functions::got_prel) New function.
10424         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10425         (Relocate::relocate): Likewise.
10426         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10427
10428 2009-10-06  Ian Lance Taylor  <iant@google.com>
10429
10430         * options.h (class General_options): Define
10431         split_stack_adjust_size parameter.
10432         * object.h (class Object): Add uses_split_stack_ and
10433         has_no_split_stack_ fields.  Add uses_split_stack and
10434         has_no_split_stack accessor functions.  Declare
10435         handle_split_stack_section.
10436         (class Reloc_symbol_changes): Define.
10437         (class Sized_relobj): Define Function_offsets.  Declare
10438         split_stack_adjust, split_stack_adjust_reltype, and
10439         find_functions.
10440         * object.cc (Object::handle_split_stack_section): New function.
10441         (Sized_relobj::do_layout): Call handle_split_stack_section.
10442         * dynobj.cc (Sized_dynobj::do_layout): Call
10443         handle_split_stack_section.
10444         * reloc.cc (Sized_relobj::relocate_sections): Call
10445         split_stack_adjust for executable sections in split_stack
10446         objects.  Pass reloc_map to relocate_section.
10447         (Sized_relobj::split_stack_adjust): New function.
10448         (Sized_relobj::split_stack_adjust_reltype): New function.
10449         (Sized_relobj::find_functions): New function.
10450         * target-reloc.h: Include "object.h".
10451         (relocate_section): Add reloc_symbol_changes parameter.  Change
10452         all callers.
10453         * target.h (class Target): Add calls_non_split method.  Declare
10454         do_calls_non_split virtual method.  Declare match_view and
10455         set_view_to_nop.
10456         * target.cc: Include "elfcpp.h".
10457         (Target::do_calls_non_split): New function.
10458         (Target::match_view): New function.
10459         (Target::set_view_to_nop): New function.
10460         * gold.cc (queue_middle_tasks): Give an error if mixing
10461         split-stack and non-split-stack objects with -r.
10462         * i386.cc (Target_i386::relocate_section): Add
10463         reloc_symbol_changes parameter.
10464         (Target_i386::do_calls_non_split): New function.
10465         * x86_64.cc (Target_x86_64::relocate_section): Add
10466         reloc_symbol_changes parameter.
10467         (Target_x86_64::do_calls_non_split): New function.
10468         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10469         parameter.
10470         * powerpc.cc (Target_powerpc::relocate_section): Add
10471         reloc_symbol_changes parameter.
10472         * sparc.cc (Target_sparc::relocate_section): Add
10473         reloc_symbol_changes parameter.
10474         * configure.ac: Call AM_CONDITIONAL for the default target.
10475         * configure: Rebuild.
10476         * testsuite/Makefile.am (TEST_AS): New variable.
10477         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10478         (check_DATA): Add split_i386 and split_x86_64 files.
10479         (SPLIT_DEFSYMS): Define.
10480         (split_i386_[1234n].o): New targets.
10481         (split_i386_[124]): New targets.
10482         (split_i386_[1234r].stdout): New targets.
10483         (split_x86_64_[1234n].o): New targets.
10484         (split_x86_64_[124]): New targets.
10485         (split_x86_64_[1234r].stdout): New targets.
10486         (MOSTLYCLEANFILES): Add new executables.
10487         * testsuite/split_i386.sh: New file.
10488         * testsuite/split_x86_64.sh: New file.
10489         * testsuite/split_i386_1.s: New file.
10490         * testsuite/split_i386_2.s: New file.
10491         * testsuite/split_i386_3.s: New file.
10492         * testsuite/split_i386_4.s: New file.
10493         * testsuite/split_i386_n.s: New file.
10494         * testsuite/split_x86_64_1.s: New file.
10495         * testsuite/split_x86_64_2.s: New file.
10496         * testsuite/split_x86_64_3.s: New file.
10497         * testsuite/split_x86_64_4.s: New file.
10498         * testsuite/split_x86_64_n.s: New file.
10499         * testsuite/testfile.cc (Target_test): Update relocation_section
10500         function.
10501         * testsuite/Makefile.in: Rebuild.
10502
10503 2009-10-06  Ian Lance Taylor  <iant@google.com>
10504
10505         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10506         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10507         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10508         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10509         the address on ldo_addrs_.
10510         (Target_i386::Relocate::fix_up_ldo): New function.
10511
10512 2009-10-06   Rafael Espindola  <espindola@google.com>
10513
10514         * plugin.cc (add_input_library): New.
10515         (Plugin::load): Add add_input_library to tv.
10516         (Plugin_manager::add_input_file): Add the is_lib argument.
10517         (add_input_file): Update call to Plugin_manager::add_input_file.
10518         (add_input_library): New.
10519         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10520
10521 2009-09-30  Doug Kwan  <dougkwan@google.com>
10522
10523         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10524         symbol and call Symbol::may_need_copy_reloc to determine if
10525         a copy reloc is needed.
10526         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10527         nocopyreloc is given in command line.
10528         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10529         given in command line.
10530         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10531         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10532         of the removed Target_i386::may_need_copy_reloc.
10533         * options.h (copyreloc): New option with default value false.
10534         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10535         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10536         instead of the removed Target_powerpc::may_need_copy_reloc.
10537         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10538         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10539         instead of the removed Target_sparc::may_need_copy_reloc.
10540         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10541         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10542         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10543         instead of the removed Target_x86_64::may_need_copy_reloc.
10544
10545 2009-09-30  Ian Lance Taylor  <iant@google.com>
10546
10547         * object.h (class Object): Remove target_ field, and target,
10548         sized_target, and set_target methods.
10549         (Object::sized_target): Remove.
10550         (class Sized_relobj): Update declarations.  Remove sized_target.
10551         * object.cc (Sized_relobj::setup): Remove target parameter.
10552         Change all callers.
10553         (Input_objects::add_object): Don't do anything with the target.
10554         (make_elf_sized_object): Add punconfigured parameter.  Change all
10555         callers.  Set or test parameter target.
10556         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10557         Change all callers.
10558         * parameters.cc (Parameters::set_target): Change parameter type to
10559         be non-const.
10560         (Parameters::default_target): Remove.
10561         (set_parameters_target): Change parameter type to be non-const.
10562         (parameters_force_valid_target): New function.
10563         (parameters_clear_target): New function.
10564         * parameters.h (class Parameters): Update declarations.  Remove
10565         default_target method.  Add sized_target and clear_target
10566         methods.  Change target_ to be non-const.
10567         (set_parameters_target): Update declaration.
10568         (parameters_force_valid_target): Declare.
10569         (parameters_clear_target): Declare.
10570         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10571         as NULL if we aren't searching.
10572         (Add_symbols::run): Don't check for compatible target.
10573         * fileread.cc (Input_file::open_binary): Call
10574         parameters_force_valid_target.
10575         * gold.cc (queue_middle_tasks): Likewise.
10576         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10577         set_target on object.
10578         * dynobj.h (class Sized_dynobj): Update declarations.
10579         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10580         make_elf_object returns NULL.
10581         (Archive::include_member): Don't check whether object target is
10582         compatible.
10583         * output.cc (Output_section::add_input_section): Get target from
10584         parameters.
10585         (Output_section::relax_input_section): Likewise.
10586         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10587         parameters.
10588         (Sized_relobj::do_scan_relocs): Likewise.
10589         (Sized_relobj::relocate_sections): Likewise.
10590         * resolve.cc (Symbol_table::resolve): Likewise.
10591         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10592         parameter.  Change all callers.
10593         (Symbol_table::add_from_object): Get target from parameters.
10594         (Symbol_table::add_from_relobj): Don't check object target.
10595         (Symbol_table::add_from_dynobj): Likewise.
10596         (Symbol_table::define_special_symbol): Get target from
10597         parameters.
10598         * symtab.h (class Symbol_table): Update declaration.
10599         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10600         parameter.  Change all callers.  Clear parameter target.
10601         (Binary_test): Test target here.
10602         * testsuite/object_unittest.cc (gold_testsuite): Remove
10603         target_test_pointer parameter.  Change all callers.
10604         (Object_test): Test target here.
10605
10606 2009-09-26  Ian Lance Taylor  <iant@google.com>
10607
10608         * testsuite/initpri1.c: Don't try to use constructor priorities if
10609         compiling with gcc before 4.3.
10610
10611 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10612
10613         * testsuite/retain_symbols_file_test.sh (check_present): Change
10614         output file name to retain_symbols_file_test.stdout.
10615         (check_absent): Likewise.
10616
10617 2009-09-18  Craig Silverstein  <csilvers@google.com>
10618
10619         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10620         * options.cc: Include <cerrno> and <fstream>.
10621         (General_options::finalize): Parse -retain-symbols-file tag.
10622         * options.h: New flag.
10623         (General_options): New method should_retain_symbol, new
10624         variable symbols_to_retain.
10625         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10626         should_retain_symbol map.
10627         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10628         * testsuite/Makefile.in: Regenerate.
10629         * testsuite/retain_symbols_file_test.sh: New file.
10630
10631 2009-09-18  Nick Clifton  <nickc@redhat.com>
10632
10633         * po/es.po: Updated Spanish translation.
10634
10635 2009-09-17  Doug Kwan  <dougkwan@google.com>
10636
10637         * debug.h (DEBUG_RELAXATION): New constant.
10638         (DEBUG_ALL): Add DEBUG_RELAXATION.
10639         (debug_string_to_enum): Add relaxation debug option.
10640         * layout.cc
10641         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10642         Layout::Relaxation_debug_check::read_sections,
10643         Layout::Relaxation_debug_check::read_sections): New method definitions.
10644         (Layout::Layout): Initialize data members
10645         record_output_section_data_from_scrips_,
10646         script_output_section_data_list_ and relaxation_debug_check_.
10647         (Layout::save_segments, Layout::restore_segments,
10648         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10649         Layout::relaxation_loop_body): New method definitions.
10650         (Layout::finalize): Support relaxation.  Move section layout code to
10651         Layout::relaxation_loop_body.
10652         (Layout::set_asection_address_from_script): Move code for orphan
10653         section placement out.
10654         (Layout::place_orphan_sections_in_script): New method definition.
10655         * layout.h (Output_segment_headers, Output_file_header):
10656         New forward class declarations.
10657         (Layout::~Layout): Define.
10658         (Layout::new_output_section_data_from_script): New method definition.
10659         (Layout::place_orphan_sections_in_script): New method declaration.
10660         (Layout::Segment_states): New type declaration.
10661         (Layout::save_segments, Layout::restore_segments,
10662         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10663         Layout::relaxation_loop_body): New method declarations.
10664         (Layout::Output_section_data_list): New type declaration.
10665         (Layout::Relaxation_debug_check): New class definition.
10666         (Layout::record_output_section_data_from_script_,
10667         Layout::script_output_section_data_list_, Layout::segment_states_,
10668         Layout::relaxation_debug_check_): New data members.
10669         * output.cc: (Output_section_headers::do_size): New method definition.
10670         (Output_section_headers::Output_section_headers): Move size
10671         computation to Output_section_headers::do_size.
10672         (Output_segment_headers::do_size): New method definition.
10673         (Output_file_header::Output_file_header): Move size computation to
10674         Output_file_header::do_size and call it.
10675         (Output_file_header::do_size): New method definition.
10676         (Output_data_group::Output_data_group): Adjust call to
10677         Output_section_data.
10678         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10679         (Output_symtab_xindex::do_write): Add array bound check.
10680         (Output_section::Input_section::print_to_mapfile): Handle
10681         RELAXED_INPUT_SECTION_CODE.
10682         (Output_section::Output_section): Initialize data member checkpoint_.
10683         (Output_section::~Output_section): Delete checkpoint object pointed
10684         by checkpoint_.
10685         (Output_section::add_input_section): Always add an Input_section if
10686         relaxing.
10687         (Output_section::add_merge_input_section): Add assert.
10688         (Output_section::relax_input_section): New method definition.
10689         (Output_section::set_final_data_size): Set load address to zero for
10690         an unallocated section.
10691         (Output_section::do_address_and_file_offset_have_reset_values):
10692         New method definition.
10693         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10694         Handle relaxed input section.
10695         (Output_section::sort_attached_input_sections): Checkpoint input
10696         section list lazily.
10697         (Output_section::get_input_sections): Change type of input_sections to
10698         list of Simple_input_section pointers.  Checkpoint input section list
10699         lazily.  Also handle relaxed input sections.
10700         (Output_section::add_input_section_for_script): Take a reference to
10701         a Simple_input_section object instead of Relobj pointer and section
10702         index as parameter.  Handle relaxed input sections.
10703         (Output_section::save_states, Output_section::restore_states): New
10704         method definitions.
10705         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10706         (Output_data::is_data_size_fixed): New method definition.
10707         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10708         if it is fixed.
10709         (Output_data::address_and_file_offset_have_reset_values): New method
10710         definition.
10711         (Output_data::do_address_and_file_offset_have_reset_values): New method
10712         definition.
10713         (Output_data::set_data_size): Check that data size is not fixed.
10714         (Output_data::fix_data_size): New method definition.
10715         (Output_data::is_data_size_fixed_): New data member.
10716         (Output_section_headers::set_final_data_size): New method definition.
10717         (Output_section_headers::do_size): New method declaration.
10718         (Output_segment_headers::set_final_data_size): New method definition.
10719         (Output_segment_headers::do_size): New method declaration.
10720         (Output_file_header::set_final_data_size)::New method definition.
10721         (Output_file_header::do_size)::New method declaration.
10722         (Output_section_data::Output_section_data): Add new parameter
10723         is_data_size_fixed and use it to fix data size.
10724         (Output_data_const::Output_data_const): Adjust call to base class
10725         constructor and fix data size.
10726         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10727         base class constructor and fix data size.
10728         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10729         base class constructor and fix data size.
10730         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10731         class constructor and fix data size.
10732         (Output_data_group::set_final_data_size): New method definition.
10733         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10734         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10735         class constructor and fix data size.
10736         (Output_relaxed_input_section): New class definition.
10737         (Output_section::Simple_input_section): New class definition.
10738         (Output_section::get_input_sections): Adjust parameter list.
10739         (Output_section::add_input_section_for_script): Same.
10740         (Output_section::save_states, Output_section::restore_states,
10741         Output_section::do_address_and_file_offset_have_reset_values,
10742         (Output_section::Input_section::Input_section): Handle
10743         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10744         Output_relaxed_input_section.
10745         (Output_section::Input_section::is_input_section,
10746         Output_section::Input_section::set_output_section): Handle relaxed
10747         input section.
10748         (Output_section::Input_section::is_relaxed_input_section,
10749         Output_section::Input_section::output_section_data,
10750         Output_section::Input_section::relaxed_input_section): New method
10751         definitions.
10752         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10753         value.
10754         (Output_section::Input_section::u1_): Update comments.
10755         (Output_section::Input_section::u2_): Add new union member poris.
10756         (Output_section::Checkpoint_output_section): New classs definition.
10757         (Output_section::relax_input_section): New method declaration.
10758         (Output_section::checkpoint_): New data member.
10759         (Output_segment): Update comments.
10760         (Output_segment::Output_segment): Un-privatize copy constructor.
10761         (Output_segment::operator=): Un-privatize.
10762         * script-sections.cc (Output_section_element::Input_section_list):
10763         Change element type to Output_section::Simple_input_section.
10764         (Output_section_element_dot_assignment::set_section_addresses):
10765         Register output section data for relaxation clean up.
10766         (Output_data_exression::Output_data_expression): Adjust call to base
10767         constructor to fix data size.
10768         (Output_section_element_data::set_section_addresses): Register
10769         Output_data_expression object for relaxation clean up.
10770         (struct Input_section_info): Replace Relobj pointer and section index
10771         pair with Output_section::Simple_input_section and Convert struct to a
10772         class.
10773         (Input_section_sorter::operator()): Adjust access to
10774         Input_section_info data member to use accessors.
10775         (Output_section_element_input::set_section_addresses): Use layout
10776         parameter.  Adjust code to use Output_section::Simple_input_section
10777         and Input_secction_info classes.  Register filler for relaxation
10778         clean up.
10779         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10780         and section index pair with Output_section::Simple_input_section
10781         class.  Adjust code accordingly.
10782         (Phdrs_element::release_segment): New method definition.
10783         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10784         segment list.
10785         (Script_sections::release_segments): New method definition.
10786         * gold/script-sections.h (Script_sections::release_segments): New
10787         method declaration.
10788         * gold/target.h (Target::may_relax, Target::relax,
10789         Target::do_may_relax, Target::do_relax): New method definitions.
10790
10791 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10792
10793         * arm.cc (has_signed_unsigned_overflow): New function.
10794         (Arm_relocate_functions::abs8): New function.
10795         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10796         (Target_arm::Scan::global): Likewise.
10797         (Target_arm::relocate::relocate): Likewise.
10798         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10799         Likewise.
10800
10801 2009-09-16  Cary Coutant  <ccoutant@google.com>
10802
10803         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10804         * testsuite/Makefile.in: Regenerate.
10805
10806 2009-09-11  Nick Clifton  <nickc@redhat.com>
10807
10808         * po/gold.pot: Updated by the Translation project.
10809
10810 2009-09-08  Cary Coutant  <ccoutant@google.com>
10811
10812         * output.cc (Output_file::open): Add execute permission to empty file.
10813         * testsuite/Makefile.am (permission_test): New test.
10814         * testsuite/Makefile.in: Regenerate.
10815
10816 2009-09-02  Ian Lance Taylor  <iant@google.com>
10817
10818         * output.cc (Output_file::resize): Call map_no_anonymous rather
10819         than map.
10820
10821 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10822
10823         * gold.cc: Include "incremental.h".
10824         (queue_initial_tasks): Call Incremental_checker methods.
10825         * incremental.cc: Include "output.h".
10826         (Incremental_checker::can_incrementally_link_output_file): New
10827         method.
10828         * incremental.h (Incremental_checker): New class.
10829
10830         * output.cc (Output_file::open_for_modification): New method.
10831         (Output_file::map_anonymous): Changed return type to bool.  Record
10832         map in base_ field.
10833         (Output_file::map_no_anonymous): New method, broken out of map.
10834         (Output_file::map): Use map_no_anonymous and map_anonymous.
10835         * output.h (class Output_file): Update declarations.
10836
10837 2009-08-24  Cary Coutant  <ccoutant@google.com>
10838
10839         * options.h (Command_line::Pre_options): New class.
10840         (Command_line::pre_options): New member.
10841         * options.cc (gold::options::ready_to_register): New variable.
10842         (One_option::register_option): Do nothing if not registering options.
10843         Assert if same short option registered twice.
10844         (General_options::General_options): Turn off option registration when
10845         done constructing.
10846         (Command_line::Pre_options::Pre_options): New constructor.
10847
10848 2009-08-24  Cary Coutant  <ccoutant@google.com>
10849
10850         * options.h (General_options::no_keep_memory): Remove incorrect
10851         short option.
10852
10853 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10854
10855         * Makefile.am (am__skiplex, am__skipyacc): New.
10856         * Makefile.in: Regenerate.
10857
10858 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10859
10860         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10861         (INCLUDES): ... this.
10862         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10863         (AM_CPPFLAGS): Renamed from ...
10864         (INCLUDE): ... this.
10865         * Makefile.in, testsuite/Makefile.in: Regenerate.
10866
10867         * Makefile.in: Regenerate.
10868         * aclocal.m4: Likewise.
10869         * config.in: Likewise.
10870         * configure: Likewise.
10871         * testsuite/Makefile.in: Likewise.
10872
10873         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10874         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10875         * Makefile.in: Regenerate.
10876         * testsuite/Makefile.in: Regenerate.
10877
10878 2009-08-19  Cary Coutant  <ccoutant@google.com>
10879
10880         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10881         symbols in shared libraries overridden by hidden or internal symbols
10882         in the main program.
10883
10884 2009-08-19  Chris Demetriou  <cgd@google.com>
10885
10886         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10887         checking source file names in error messages.
10888
10889 2009-08-18  Doug Kwan  <dougkwan@google.com>
10890
10891         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10892         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10893         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10894         an elfcpp::Ehdr as parameter.
10895         * object.cc (Object::set_target): Remove the version that looks up
10896         a target and sets it.
10897         (Sized_relobj::setup): Take a Target object instead of
10898         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10899         (make_elf_sized_object): Find target and ask target to
10900         make an ELF object.
10901         * object.h: (Object::set_target): Remove the version that looks up
10902         a target and sets it.
10903         (Sized_relobj::setup): Take a Target object instead of
10904         an elfcpp:Ehdr as parameter.
10905         * target.cc: Include dynobj.h.
10906         (Target::do_make_elf_object_implementation): New.
10907         (Target::do_make_elf_object): New.
10908         * target.h (Target::make_elf_object): New template declaration.
10909         (Target::do_make_elf_object): New method declarations.
10910         (Target::do_make_elf_object_implementation): New template declaration.
10911
10912 2009-08-14  Ian Lance Taylor  <iant@google.com>
10913
10914         * gold.h (FUNCTION_NAME): Define.
10915         (gold_unreachable): Use FUNCTION_NAME.
10916
10917 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10918
10919         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10920         symbol in the --keep-unique list is not found.
10921
10922 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10923
10924         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10925         been maked as --keep-unique.
10926         (Icf::unfold_section): New function.
10927         * icf.h (Icf::unfold_section): New function.
10928         * options.h (General_options::keep_unique): New option.
10929         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10930         * testsuite/Makefile.in: Regenerate.
10931         * testsuite/icf_keep_unique_test.sh: New file.
10932         * testsuite/icf_keep_unique_test.cc: New file.
10933
10934 2009-08-12  Cary Coutant  <ccoutant@google.com>
10935
10936         PR 10471
10937         * resolve.cc (Symbol_table::resolve): Check for references from
10938         dynamic objects to hidden and internal symbols.
10939         * testsuite/Makefile.am (hidden_test.sh): New test.
10940         * testsuite/Makefile.in: Regenerate.
10941         * testsuite/hidden_test.sh: New script.
10942         * testsuite/hidden_test_1.c: New test source.
10943         * testsuite/hidden_test_main.c: New test source.
10944
10945 2009-08-11  Doug Kwan  <dougkwan@google.com>
10946
10947         * arm.cc: Update comments.
10948         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10949         segment to locate the .ARM.exidx section if present.
10950
10951 2009-08-09  Doug Kwan  <dougkwan@google.com>
10952
10953         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10954         patch.
10955
10956 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10957         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10958         compiler warnings.
10959
10960 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10961
10962         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10963         valid tls_segment only for non-debug-section relocations.
10964         * testsuite/Makefile.am: Add gc_tls_test.
10965         * testsuite/Makefile.in: Regenerate.
10966         * testsuite/gc_tls_test.cc: New file.
10967         * testsuite/gc_tls_test.sh: New file.
10968
10969 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10970
10971         * icf.cc: New file.
10972         * icf.h: New file.
10973         * Makefile.am (CCFILES): Add icf.cc.
10974         (HFILES): Add icf.h
10975         * Makefile.in: Regenerate.
10976         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10977         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10978         section, symbol and addend information for the relocs.
10979         * gold.cc (queue_middle_tasks): Call identical code folding.
10980         * gold.h: Add defines for multimap.
10981         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10982         to the call of finalize_local_symbols.
10983         * main.cc (main): Create object of class Icf.
10984         * object.cc (Sized_relobj::do_layout): Allow this function to be
10985         called twice during icf.
10986         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10987         to sections marked as identical by icf.
10988         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10989         when available.
10990         (Sized_relobj::do_section_entsize): New function.
10991         * object.h (Object::section_entsize): New function.
10992         (Object::do_section_entsize): New pure virtual function.
10993         (Relobj::finalize_local_symbols): Add new parameter.
10994         (Relobj::do_section_entsize): New function.
10995         * options.h (General_options::icf): New option.
10996         (General_options::icf_iterations): New option.
10997         (General_options::print_icf_sections): New option.
10998         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10999         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11000         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11001         icf.
11002         * symtab.cc (Symbol_table::is_section_folded): New function.
11003         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11004         to sections marked as identical by icf.
11005         * symtab.h (Symbol_table::set_icf): New function.
11006         (Symbol_table::icf): New function.
11007         (Symbol_table::is_section_folded): New function.
11008         (Symbol_table::icf_): New data member.
11009         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11010         * testsuite/Makefile.am: Add commands to build icf_test.
11011         * testsuite/Makefile.in: Regenerate.
11012         * testsuite/icf_test.sh: New file.
11013         * testsuite/icf_test.cc: New file.
11014
11015 2009-07-24  Chris Demetriou  <cgd@google.com>
11016
11017         * layout.cc (is_compressible_debug_section): Fix incorrect
11018         comment about compressed section names.
11019
11020 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11021
11022         PR 10419
11023         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11024
11025 2009-07-16  Ian Lance Taylor  <iant@google.com>
11026
11027         PR 10400
11028         * layout.h: #include <map>.
11029         (class Kept_section): Change from struct to class.  Add accessors
11030         and setters.  Add section size to Comdat_group mapping.  Change
11031         Comdat_group to std::map.  Add is_comdat_ field.  Add
11032         linkonce_size field in union.
11033         (class Layout): Update declaration of find_or_add_kept_section.
11034         Don't declare find_kept_object.
11035         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11036         parameter.  Add object, shndx, is_comdat, and is_group_name
11037         parameters.  Change all callers.  Adjust for new Kept_section.
11038         (Layout::find_kept_object): Remove.
11039         * object.cc (Sized_relobj::include_section_group): Update use of
11040         Kept_section.  Rename secnum to shndx.  Only record
11041         Kept_comdat_section if sections are the same size.
11042         (Sized_relobj::include_linkonce_section): Update use of
11043         Kept_section.  Only record Kept_comdat_section if sections are the
11044         same size.  Set size of linkonce section.
11045         (Sized_relobj::map_to_kept_section): Update call to
11046         get_kept_comdat_section.
11047         * object.h (class Sized_relobj): Rename fields in
11048         Kept_comdat_section to drop trailing underscores; change object
11049         field to Relobj*.  Change Kept_comdat_section_table to store
11050         struct rather than pointer.
11051         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11052         Add kept_object and kept_shndx parameters.  Change all callers.
11053         (Sized_relobj::get_kept_comdat_section): Change return type to
11054         bool.  Add kept_object and kept_shndx parameters.  Change all
11055         callers.
11056         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11057         Layout::find_or_add_kept_section.
11058
11059 2009-07-09  Ian Lance Taylor  <iant@google.com>
11060
11061         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11062         Reserve space in the hash table.
11063
11064 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11065
11066         * fileread.cc (File_read::get_mtime): New method.
11067         * fileread.h (Timespec): New structure.
11068         (File_read::get_mtime): New method.
11069         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11070         Renamed from timestamp_nsec.
11071         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11072         Elf_Xword.
11073         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11074         timestamp_nsec.
11075         (Incremental_inputs::report_archive): Save mtime; style fix.
11076         (Incremental_inputs::report_obejct): Save mtime; style fix.
11077         (Incremental_inputs::report_script): Save mtime; style fix.
11078         (Incremental_inputs::finalize_inputs): Style fix.
11079         (Incremental_inputs::finalize): Style fix.
11080         (Incremental_inputs::create_input_section_data): Store inputs
11081         mtime.
11082         * incremental.h (Incremental_inputs::report_script): Add mtime
11083         argument.
11084         (Incremental_inputs::Input_info::Input_info): Intialize only one
11085         union member.
11086         (Incremental_inputs::Input_info::archive): Move to nameless
11087         union.
11088         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11089         (Incremental_inputs::Input_info::script): Move to nameless union.
11090         (Incremental_inputs::mtime): New field.
11091         * script.cc (read_input_script): Pass file mtime to
11092         Incremental_input.
11093         * script.h (Script_info::inputs): Style fix.
11094
11095 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11096
11097         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11098         instead of 32.
11099
11100 2009-06-24  Ian Lance Taylor  <iant@google.com>
11101
11102         PR 10156
11103         * layout.cc (Layout::choose_output_section): If we find an
11104         existing section, update the flags.
11105         (Layout::create_notes): New function, broken out of
11106         Layout::finalize.
11107         (Layout::finalize): Don't create note sections.
11108         (Layout::create_note): Don't crash if linker script discards
11109         section.
11110         (Layout::create_gold_note): Likewise.
11111         (Layout::create_build_id): Likewise.  Don't set
11112         after_input_sections on the section.
11113         (Layout::create_executable_stack_info): Remove target parameter.
11114         Change caller.
11115         * layout.h (class Layout): Declare create_notes.  Update
11116         declaration of create_executable_stack_info.
11117         * gold.cc (queue_middle_tasks): Call create_notes.
11118         * output.cc (Output_section::update_flags_for_input_section): Move
11119         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11120         invalid.
11121         * output.h (Output_data::mark_address_invalid): New function.
11122         (class Output_section): Only declare, not define,
11123         update_flags_for_input_section.  Remove set_flags.
11124
11125 2009-06-24  Ian Lance Taylor  <iant@google.com>
11126
11127         * script-sections.cc (Output_section_definition::
11128         set_section_addresses): Rename shadowing local load_address to
11129         laddr.
11130
11131 2009-06-24  Ian Lance Taylor  <iant@google.com>
11132
11133         PR 10244
11134         * reloc.cc (relocate_sections): Skip empty relocation sections.
11135
11136 2009-06-23  Ian Lance Taylor  <iant@google.com>
11137
11138         PR 10156
11139         * layout.cc (Layout::create_note): Use choose_output_section
11140         rather than make_output_section.
11141
11142 2009-06-23  Ian Lance Taylor  <iant@google.com>
11143
11144         PR 10237
11145         * options.cc (General_options::parse_V): Set printed_version_.
11146         (General_options::General_options): Initialize printed_version_.
11147         * options.h (class General_options): Add printed_version_ field.
11148         * gold.cc (queue_initial_tasks): If there are no input files,
11149         don't give a fatal error if we printed the version information.
11150         (queue_middle_tasks): If using -r with a shared object, give a
11151         fatal error rather than an ordinary error.
11152
11153 2009-06-23  Ian Lance Taylor  <iant@google.com>
11154
11155         PR 10219
11156         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11157         (Layout::make_output_section): Set have_stabstr_section_ if we see
11158         a .stab*str section.
11159         (Layout::finalize): Call link_stabs_sections.
11160         (Layout::link_stabs_sections): New file.
11161         * layout.h (class Layout): Add have_stabstr_section_ field.
11162         Declare link_stabs_sections.
11163
11164 2009-06-23  Doug Kwan  <dougkwan@google.com>
11165
11166         * Makefile.am (libgold_a_LIBADD): New.
11167         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11168         * Makefile.in: Regenerate.
11169         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11170         * configure: Regenerate.
11171         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11172         * fileread.cc: Include sys/state.h
11173         * gold.h: Declare memmem and strndup if found missing.
11174         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11175
11176 2009-06-23  Ian Lance Taylor  <iant@google.com>
11177
11178         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11179         * configure: Rebuild.
11180
11181 2009-06-23  Ian Lance Taylor  <iant@google.com>
11182
11183         PR 10147
11184         * object.cc (Object::section_contents): Don't try to get a view if
11185         the section has length zero.
11186         (Object::handle_gnu_warning_section): If the section is empty, use
11187         the name of the section as the warning.
11188
11189 2009-06-23  Ian Lance Taylor  <iant@google.com>
11190
11191         PR 10133
11192         * stringpool.h (class Stringpool_template): Add optimize_ field.
11193         (Stringpool_template::set_optimize): New function.
11194         * stringpool.cc (Stringpool_template::Stringpool_template):
11195         Initialize optimize_ field.
11196         (Stringpool_template::set_string_offsets): Test local optimize
11197         fild rather than parameter.
11198         * layout.cc (Layout::Layout): Call set_optimize on the section
11199         name stringpool.
11200
11201 2009-06-22  Ian Lance Taylor  <iant@google.com>
11202
11203         PR 10030
11204         * yyscript.y: Parse TARGET.
11205         * script.cc (script_set_target): New function.
11206         * script-c.h (script_set_target): Declare.
11207         * options.cc (General_options::string_to_object_format): Rename
11208         from string_to_object_format in anonymous namespace.  Change
11209         callers.
11210         * options.h (class General_options): Declare
11211         string_to_object_format.
11212
11213 2009-06-22  Ian Lance Taylor  <iant@google.com>
11214
11215         * script-sections.cc (Script_sections::create_segments): Don't put
11216         program headers in a PT_LOAD segment if -n or -N.
11217
11218 2009-06-22  Ian Lance Taylor  <iant@google.com>
11219
11220         PR 10141
11221         * options.h (class General_options): Add -z lazy and -z now.  Sort
11222         -z options into alphabetical order.
11223         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11224
11225 2009-06-21  Ian Lance Taylor  <iant@google.com>
11226
11227         * layout.cc (Layout::make_output_section): Call
11228         Target::new_output_section.
11229         (Layout::attach_allocated_section_to_segment): Put large section
11230         sections in a separate load segment with the large segment flag
11231         set.
11232         (Layout::segment_precedes): Sort large data segments after other
11233         load segments.
11234         (align_file_offset): New static function.
11235         (Layout::set_segment_offsets): Use align_file_offset.
11236         * output.h (class Output_section): Add is_small_section_ and
11237         is_large_section_ fields.
11238         (Output_section::is_small_section): New function.
11239         (Output_section::set_is_small_section):  New function.
11240         (Output_section::is_large_section): New function.
11241         (Output_section::set_is_large_section): New function.
11242         (Output_section::is_large_data_section): New function.
11243         (class Output_segment): Add is_large_data_segment_ field.
11244         (Output_segment::is_large_data_segment): New function.
11245         (Output_segment::set_is_large_data_segment): New function.
11246         * output.cc (Output_section::Output_section): Initialize new
11247         fields.
11248         (Output_segment::Output_segment): Likewise.
11249         (Output_segment::add_output_section): Add assertion that large
11250         data sections always go in large data segments.  Force small data
11251         sections to the end of the list of data sections.  Force small BSS
11252         sections to the start of the list of BSS sections.  For large BSS
11253         sections to the end of the list of BSS sections.
11254         * symtab.h (class Symbol): Declare is_common_shndx.
11255         (Symbol::is_defined): Check Symbol::is_common_shndx.
11256         (Symbol::is_common): Likewise.
11257         (class Symbol_table): Define enum Commons_section_type.  Update
11258         declarations.  Add small_commons_ and large_commons_ fields.
11259         * symtab.cc (Symbol::is_common_shndx): New function.
11260         (Symbol_table::Symbol_table): Initialize new fields.
11261         (Symbol_table::add_from_object): Put small and large common
11262         symbols in the right list.
11263         (Symbol_table::sized_finalized_symbol): Check
11264         Symbol::is_common_shndx.
11265         (Symbol_table::sized_write_globals): Likewise.
11266         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11267         common symbol lists.  Don't call do_allocate_commons_list if the
11268         list is empty.
11269         (Symbol_table::do_allocate_commons_list): Remove is_tls
11270         parameter.  Add comons_section_type parameter.  Change all
11271         callers.  Handle small and large common symbols.
11272         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11273         Symbol::is_common_shndx.
11274         * resolve.cc (symbol_to_bits): Likewise.
11275         * target.h (Target::small_common_shndx): New function.
11276         (Target::small_common_section_flags): New function.
11277         (Target::large_common_shndx): New function.
11278         (Target::large_common_section_flags): New function.
11279         (Target::new_output_section): New function.
11280         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11281         small_common_section_flags, and large_common_section_flags
11282         fields.
11283         (Target::do_new_output_section): New virtual function.
11284         * arm.cc (Target_arm::arm_info): Initialize new fields.
11285         * i386.cc (Target_i386::i386_info): Likewise.
11286         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11287         Likewise.
11288         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11289         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11290         (Target_x86_64::do_new_output_section): New function.
11291         * configure.ac: Define conditional MCMODEL_MEDIUM.
11292         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11293         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11294         (large_LDFLAGS): Define.
11295         * testsuite/large.c: New file.
11296         * testsuite/testfile.cc (Target_test::test_target_info):
11297         Initialize new fields.
11298         * configure, testsuite/Makefile.in: Rebuild.
11299
11300 2009-06-05  Doug Kwan  <dougkwan@google.com>
11301
11302         * Makefile.am (CCFILES): Add target.cc.
11303         * Makefile.in: Regenerate.
11304         * i386.cc (class Target_i386): Define new virtual method to
11305         override do_is_local_label_name in parent.
11306         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11307         local symbols if --discard-locals or -X is given.
11308         * options.h (class General_options): Declare new options
11309         '--discard-locals' and '-X' for discarding locals.
11310         * target.h (class Target): Define new methods is_local_label_name.
11311         Declare new virtual method do_is_local_label_name.
11312         * target.cc: New file.
11313         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11314         (check_SCRIPTS): Add discard_locals_test.sh.
11315         (check_DATA): Add discard_local_tests.syms.
11316         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11317         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11318         * testsuite/Makefile.in: Regenerate.
11319         * testsuite/discard_locals_test.c: New file.
11320         * testsuite/discard_locals_test.sh: Same.
11321
11322 2009-06-05  Doug Kwan  <dougkwan@google.com>
11323
11324         * object.cc (Sized_relobj::Sized_relobj): Initialize
11325         discarded_eh_frame_shndx_ to -1U.
11326         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11327         section.
11328         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11329         a discarded .eh_frame section.
11330         (Sized_relobj::do_finalize_local_symbols): Ditto.
11331         * object.h (class Sized_relobj): Declare new member
11332         discarded_eh_frame_shndx_.
11333         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11334         (local_labels_test.o, local_labels_test): New rules.
11335         * testsuite/Makefile.in: Regenerate.
11336
11337 2009-06-04  Doug Kwan  <dougkwan@google.com>
11338
11339         * layout.cc (Layout::section_name_mapping): Add mapping for
11340         special ARM sections.
11341
11342 2009-06-03  Doug Kwan  <dougkwan@google.com>
11343
11344         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11345         (utils::has_overflow): Same.
11346
11347 2009-06-03  Ian Lance Taylor  <iant@google.com>
11348
11349         * layout.cc (Layout::section_name_mapping): New array, replacing
11350         Layout::linkonce_mapping.
11351         (Layout::section_name_mapping_count): New variable, replacing
11352         Layout::linkonce_mapping_count.
11353         (Layout::linkonce_output_name): Remove.
11354         (Layout::output_section_name): Rewrite.
11355         * layout.h (class Layout): Rename Linkonce_mapping to
11356         Section_name_mapping, linkonce_mapping to section_name_mapping,
11357         linkonce_mapping_count to section_name_mapping_count.  Don't
11358         declare linkonce_output_name.
11359
11360 2009-06-03  Doug Kwan  <dougkwan@google.com>
11361
11362         * gold/arm.cc (namespace utils): New.
11363         (Target_arm::reloc_is_non_pic): Define new method.
11364         (class Arm_relocate_functions): New.
11365         (Target_arm::Relocate::relocate): Handle relocation types used by
11366         Android.
11367
11368 2009-06-03  Ian Lance Taylor  <iant@google.com>
11369
11370         * arm.cc (Target_arm::scan::global): Use || instead of |.
11371
11372 2009-06-02  Doug Kwan  <dougkwan@google.com>
11373
11374         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11375         issued_non_pic_error_.
11376         (class Target_arm::Scan): Declare new method check_non_pic.
11377         Define new method symbol_needs_plt_entry.
11378         Declare new data member issued_non_pic_error_.
11379         (class Target_arm::Relocate): Declare new method
11380         should_apply_static_reloc.
11381         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11382         (Target_arm::Scan::check_non_pic): Define new method.
11383         (Target_arm::Scan::local): Handle a small subset of reloc types used
11384         by Android.
11385         (Target_arm::Scan::local): Same.
11386         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11387
11388 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11389
11390         * incremental.cc (Incremental_inputs::report_command_line): Filter
11391         out --incremental-* options.
11392
11393 2009-05-29  Doug Kwan  <dougkwan@google.com>
11394
11395         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11396         template class.
11397         (class Target_arm): Update comment.
11398         (Target_arm::Target_arm): Initialize new data members GOT_,
11399         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11400         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11401         and Target_arm::rel_dyn_section.
11402         Declare new_enum Target_arm::Got_type.
11403         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11404         and DYNBSS_.
11405         Update commments for member do_dynsym_value.
11406         (Target_arm::got_size, Target_arm::plt_section,
11407         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11408         new methods inside class defintion.
11409         (Target_arm::got_section): Define new method.
11410         (Target_arm::rel_dyn_section): Same.
11411         (Output_data_plt_arm): New template class.
11412         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11413         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11414         (Output_data_plt_arm::add_entry): Same.
11415         (Output_data_plt_arm::first_plt_entry): Define new
11416         static data member for PLT instruction template.
11417         (Output_data_plt_arm::plt_entry): Same.
11418         (Output_data_plt_arm::do_write): Define new method.
11419         (Target_arm::make_plt_entry): Same.
11420         (Target_arm::do_finalize_sections): Same.
11421         (Target_arm::do_dynsym_value): Same.
11422
11423 2009-05-28  Doug Kwan  <dougkwan@google.com>
11424
11425         * Makefile.am (TARGETSOURCES): Add arm.cc.
11426         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11427         * Makefile.in: Regenerate.
11428         * arm.cc: New file.
11429         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11430
11431 2009-05-26  Doug Kwan  <dougkwan@google.com>
11432
11433         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11434         (General_options::check_excluded_libs): Strip off directories in
11435         archive name before matching like GNU ld does.
11436         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11437         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11438         (exclude_libs_test_LDFLAGS): Add linker option
11439         -Wl,--exclude-libs,libexclude_libs_test_3
11440         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11441         an explicit archive without using -l.
11442         (alt/libexclude_libs_test_3.a): New make rule.
11443         * testsuite/Makefile.in: Regenerate.
11444         * testsuite/exclude_libs_test.c : Declare lib3_default().
11445         (main): Call it.
11446         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11447         * exclude_libs_test_3.c: New file.
11448
11449 2009-05-26  Nick Clifton  <nickc@redhat.com>
11450
11451         * po/id.po: New Indonesian translation.
11452         * po/gold.pot: Updated template file.
11453
11454 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11455
11456         * testsuite/Makefile.am: Add -ffunction-sections to compile
11457         gc_comdat_test files.  Add -Wl,--gc-sections to build
11458         gc_comdat_test.
11459         * testsuite/Makefile.in: Regenerate.
11460         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11461
11462 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11463
11464         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11465         kept comdat section was garbage collected.
11466         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11467         * testsuite/Makefile.in: Regenerate.
11468         * testsuite/gc_comdat_test.sh: New file.
11469         * testsuite/gc_comdat_test_1.cc: New file.
11470         * testsuite/gc_comdat_test_2.cc: New file.
11471
11472 2009-05-19  Doug Kwan  <dougkwan@google.com>
11473
11474         * archive.cc (Archive::Archive): Move constructor from archive.h
11475         to here.  Initialize no_export_.
11476         (Archive::get_elf_object_for_member): Set no_export flag of object.
11477         * archive.h (Archive::Archive): Move constructor body to
11478         archive.cc.
11479         (Archive::no_export): New method.
11480         (Archive::no_export_): New field.
11481         * object.h (Object::Object): Initialize no_export_ to false.
11482         (Object::no_export, Object::set_no_export): New methods.
11483         (Object::no_export_): New field.
11484         * options.cc (General_options::parse_exclude_libs): New method.
11485         (General_options::check_excluded_libs) Same.
11486         * options.h (exclude_libs): New option.
11487         (General_options::check_excluded_libs): New method declaration.
11488         (General_options::excluded_libs_): New field.
11489         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11490         default or protected visibility if an object has no-export flag set.
11491         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11492         (check_SCRIPTS): Add exclude_libs_test.sh.
11493         (check_DATA): Add exclude_libs_test.syms.
11494         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11495         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11496         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11497         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11498         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11499         libexclude_libs_test_2.a): New rules.
11500         * testsuite/Makefile.in: Regenerate.
11501         * testsuite/exclude_libs_test.c: New file.
11502         * testsuite/exclude_libs_test.sh: Ditto.
11503         * testsuite/exclude_libs_test_1.c: Ditto.
11504         * testsuite/exclude_libs_test_2.c: Ditto.
11505
11506 2009-05-15  Ian Lance Taylor  <iant@google.com>
11507
11508         * configure.ac: Check for declarations for cases where libiberty.h
11509         checks HAVE_DECL_xxx.
11510         * configure, config.in: Rebuild.
11511
11512 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11513
11514         * gold.h (Incremental_argument_list): Remove (invalid) forward
11515         declaration.
11516         * incremental.cc (Incremental_inputs::report_achive): New method.
11517         (Incremental_inputs::report_object): New method.
11518         (Incremental_inputs::report_script): New method.
11519         (Incremental_inputs::finalize_inputs): New method.
11520         (Incremental_inputs::finalize): Call finalize_inputs().
11521         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11522         Create inputs entries.
11523         * incremental.h (Incremental_input_type): New enum.
11524         (Incremental_inputs::Incremental_input): Initialize new fields.
11525         (Incremental_inputs::report_inputs): New method.
11526         (Incremental_inputs::report_achive): New method.
11527         (Incremental_inputs::report_object): New method.
11528         (Incremental_inputs::report_script): New method.
11529         (Incremental_inputs::finalize_inputs): New method.
11530         (Incremental_inputs::Input_info): New struct.
11531         (Incremental_inputs::Input_info_map): New typedef.
11532         (Incremental_inputs::lock_): New field.
11533         (Incremental_inputs::Inputs_): New field.
11534         (Incremental_inputs::Inputs_map): New field.
11535         * main.cc (main): Call Incremental_input::report_inputs.
11536         * options.h (Input_argument_list): Typedef moved from
11537         Input_arguments.
11538         (Input_file_group::Files): Remove, use ::Input_argument_list.
11539         (Input_file_group::Input_argument_list): Remove, use
11540         ::Input_argument_list.
11541         * plugin.cc (Plugin_manager::add_input_file): Add error in
11542         incremental build.
11543         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11544         functions.
11545         * script.cc (read_input_script): Call
11546         Incremental_input::report_script.
11547         * script.h (Script_info): New class.
11548
11549 2009-04-27  Ian Lance Taylor  <iant@google.com>
11550
11551         * x86_64.cc (do_adjust_output_section): Set entsize to
11552         plt_entry_size.
11553
11554 2009-04-23  Elliott Hughes  <enh@google.com>
11555
11556         * output.cc (Output_file::close): After short writes, continue
11557         writing from the correct offset in the buffer being written.
11558
11559 2009-04-23  Chris Demetriou  <cgd@google.com>
11560
11561         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11562         * configure: Regenerate.
11563         * config.in: Regenerate.
11564         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11565         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11566
11567 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11568
11569         * incremental.cc (Incremental_inputs_header_data): Renamed from
11570         Incremental_input_header_data.
11571         (Incremental_inputs_header_data::data_size): New field.
11572         (Incremental_inputs_header_data::put_input_file_count): Renamed
11573         from input_file_count.
11574         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11575         from command_line_offset.
11576         (Incremental_inputs_header_data::put_reserved): Renamed from
11577         put_reserved.
11578         (Incremental_inputs_entry_data): Renamed from
11579         Incremental_input_entry_data.
11580         (Incremental_inputs_entry_data::data_size): New field.
11581         (Incremental_inputs::report_command_line): New method.
11582         (Incremental_inputs::finalize): New method.
11583         (Incremental_inputs::create_incremental_inputs_data): New method.
11584         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11585         * incremental.h: New file.
11586         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11587         (Layout::finalize): Create incremental inputs section in
11588         incremental builds.
11589         (Layout::create_incremental_info_sections): New method.
11590         * layout.h (Layout::incremental_inputs): New method.
11591         (Layout::create_incremental_info_sections): New method.
11592         (Layout::incremental_inputs_): New field.
11593         * main.cc (main): Notify Incremental_input of the command line.
11594
11595 2009-04-01  Ian Lance Taylor  <iant@google.com>
11596             Mikolaj Zalewski  <mikolajz@google.com>
11597
11598         * gold.h (reserve_unordered_map): Define, three versions, one for
11599         each version of Unordered_map.
11600         * layout.cc (Layout::Layout): Remove options parameter.  Add
11601         number_of_input_files parameter.  Don't initialize options_.
11602         Initialize number_of_input_files_ and resized_signatures_.  Move
11603         sections_are_attached_.
11604         (Layout::layout_group): Reserve space for group_signatures_.
11605         (Layout::find_or_add_kept_section): Change name parameter to be a
11606         reference.  Resize signatures_ map when it gets large enough.
11607         (Layout::layout_eh_frame): Use parameters->options() instead of
11608         this->options_.
11609         (Layout::make_output_section): Likewise.
11610         (Layout::attach_allocated_section_to_segment): Likewise.
11611         (Layout::finalize, Layout::create_executable_stack): Likewise.
11612         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11613         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11614         * layout.h (class Layout): Update declarations.  Remove options_
11615         field.  Add number_of_input_files_ and resized_signatures_
11616         fields.  Move sections_are_attached_ field.
11617         * main.cc (main): Pass number of input files to Layout
11618         constructor.  Don't pass options.
11619
11620 2009-03-30  Ian Lance Taylor  <iant@google.com>
11621
11622         * ffsll.c (ffsll): Correct implementation.
11623
11624 2009-03-27  Ian Lance Taylor  <iant@google.com>
11625
11626         * ffsll.c: New file.
11627         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11628         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11629         * ftruncate.c (ftruncate): Declare before definition.
11630         * mremap.c (mremap): Likewise.
11631         * pread.c (pread): Likewise.
11632         * configure, Makefile.in, config.in: Rebuild.
11633
11634         * mremap.c: New file.
11635         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11636         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11637         (mremap): Declare if HAVE_MREMAP is not defined.
11638         * configure, Makefile.in, config.in: Rebuild.
11639
11640 2009-03-27  Cary Coutant  <ccoutant@google.com>
11641
11642         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11643         position independent.
11644         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11645         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11646
11647 2009-03-24  Cary Coutant  <ccoutant@google.com>
11648
11649         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11650         an executable.
11651         (needs_dynamic_reloc): Likewise.
11652
11653 2009-03-24  Ian Lance Taylor  <iant@google.com>
11654
11655         * yyscript.y (file_cmd): Recognize EXTERN.
11656         (extern_name_list, extern_name_list_body): New nonterminals.
11657         * script.cc (script_add_extern): Define.
11658         * script-c.h (script_add_extern): Declare.
11659
11660 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11661
11662         * object.cc (is_elf_object): Define.
11663         * object.h (is_elf_object): Declare.
11664         * archive.cc (Archive::get_elf_object_for_member): Call
11665         is_elf_object.
11666         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11667
11668 2009-03-24  Elliott Hughes  <enh@google.com>
11669
11670         * output.cc (Output_file::map_anonymous): Define.
11671         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11672         try an anonymous one.  Report the size if the mmap fails.
11673         * output.h (class Output_file): Declare map_anonymous.
11674
11675 2009-03-24  Ian Lance Taylor  <iant@google.com>
11676
11677         * target-select.cc (instantiate_target): Don't acquire the lock if
11678         the instantiated_target_ field has already been set.
11679
11680 2009-03-23  Ian Lance Taylor  <iant@google.com>
11681
11682         * gold-threads.h (class Initialize_lock): Define.
11683         * gold-threads.cc (class Initialize_lock_once): Define.
11684         (initialize_lock_control): New static variable.
11685         (initialize_lock_pointer): New static variable.
11686         (initialize_lock_once): New static function.
11687         (Initialize_lock::Initialize_lock): Define.
11688         (Initialize_lock::initialize): Define.
11689         * target-select.h: Include "gold-threads.h".
11690         (class Target_selector): Add lock_ and initialize_lock_ fields.
11691         Don't define instantiate_target, just declare it.
11692         * target-select.cc (Target_selector::Target_selector): Initialize
11693         new fields.
11694         (Target_selector::instantiate_target): Define.
11695         * descriptors.h: Include "gold-threads.h".
11696         (class Descriptors): Add initialize_lock_ field.
11697         * descriptors.cc (Descriptors::Descriptors): Initialize new
11698         field.
11699         (Descriptors::open): Use initialize_lock_ field
11700         * errors.h (class Errors): Add initialize_lock_ field.
11701         * errors.cc (Errors::Errors): Initialize new field.
11702         (Errors::initialize_lock): Use initialize_lock_ field.
11703         * powerpc.cc (class Target_selector_powerpc): Remove
11704         instantiated_target_ field.  In do_recognize call
11705         instantiate_target rather than do_instantiate_target.  In
11706         do_instantiate_target just allocate a new target.
11707         * sparc.cc (class Target_selector_sparc): Likewise.
11708
11709         * freebsd.h: New file.
11710         * i386.cc: Include "freebsd.h".
11711         (Target_i386): Derive from Target_freebsd rather than
11712         Sized_target.
11713         (Target_selector_i386): Derive from Target_selector_freebsd rather
11714         than Target_selector.
11715         * x86_64.cc: Include "freebsd.h".
11716         (Target_x86_64): Derive from Target_freebsd rather than
11717         Sized_target.
11718         (Target_selector_x86_64): Derive from Target_selector_freebsd
11719         rather than Target_selector.
11720         * target.h (class Target): Add adjust_elf_header and
11721         do_adjust_elf_header.
11722         * output.cc (Output_file_header:: do_sized_write): Call target
11723         adjust_elf_header routine.
11724         * configure.tgt: Set targ_osabi.
11725         * configure.ac: Define GOLD_DEFAULT_OSABI.
11726         * parameters.cc (Parameters::default_target): Pass
11727         GOLD_DEFAULT_OSABI to select_target.
11728         * target-select.h (class Target_selector): Make instantiate_target
11729         protected rather than private.
11730         * Makefile.am (HFILES): Add freebsd.h.
11731         * configure, Makefile.in, config.in: Rebuild.
11732
11733         * merge.cc (do_add_input_section): Correct pend value.  Change
11734         message about last entry not being null terminated from error to
11735         warning.
11736
11737 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11738
11739         * incremental.cc: New file.
11740         * Makefile.am (CCFILES): Add incremental.cc.
11741         * Makefile.in: Rebuild.
11742
11743 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11744
11745         * layout.cc (Layout::output_section_name): Preserve names
11746         of '.note.' sections.
11747
11748 2009-03-19  Ian Lance Taylor  <iant@google.com>
11749
11750         * descriptors.cc (Descriptors::open): Check that the options are
11751         valid before using them.
11752
11753 2009-03-18  Ian Lance Taylor  <iant@google.com>
11754
11755         * script-sections.h: Include <list>.
11756         (class Script_sections): Change Sections_elements from std::vector
11757         to std::list.  Typedef public Elements_iterator.  Add
11758         orphan_section_placement_, data_segment_align_start_, and
11759         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11760         field.
11761         * script-sections.cc (class Orphan_section_placement): New class.
11762         (class Sections_element): Add virtual functions is_relro and
11763         orphan_section_init.  Remove virtual function place_orphan_here.
11764         (class Output_section_definition): Add is_relro and
11765         orphan_section_init.  Remove place_orphan_here.
11766         (class Orphan_output_section): Likewise.
11767         (Script_sections::Script_sections): Update for field changes.
11768         (Script_sections::data_segment_align): Set saw_data_segment_align_
11769         and data_segment_align_start_, not data_segment_align_index.
11770         (Script_sections::data_segment_relro_end): Check
11771         saw_data_segment_align_.  Use data_segment_align_start_ rather
11772         than data_segment_align_index_.
11773         (Script_sections::place_orphan): Rewrite to use
11774         Orphan_section_placement.
11775
11776 2009-03-17  Ian Lance Taylor  <iant@google.com>
11777
11778         * archive.cc (Archive::add_symbols): Check for a version attached
11779         to the symbol name in the archive map.
11780         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11781         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11782         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11783         (ver_test_11.a): New target.
11784         * testsuite/Makefile.in: Rebuild.
11785
11786         * configure.ac: Check for chsize and posix_fallocate.  Replace
11787         ftruncate.
11788         * ftruncate.c: New file, from gnulib.
11789         * output.cc (posix_fallocate): Define dummy version if not
11790         HAVE_POSIX_FALLOCATE.
11791         (Output_file::map): Call posix_fallocate rather than lseek and
11792         write.
11793         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11794         * configure, Makefile.in, config.in: Rebuild.
11795
11796 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11797
11798         * layout.h (Layout::create_note): Add section_name parameter.
11799         * layout.cc (Layout::create_note): Likewise.
11800         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11801
11802 2009-03-17  Ian Lance Taylor  <iant@google.com>
11803
11804         * descriptors.cc: Include "options.h".
11805         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11806         (Descriptors::open): Always use O_CLOEXEC when opening a new
11807         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11808         then set FD_CLOEXEC.
11809
11810         * sparc.cc (class Target_sparc): Add has_got_section.
11811         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11812         make sure we have a GOT section.
11813
11814         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11815         (Target_sparc::Scan::local): Likewise.
11816         (Target_sparc::Scan::global): Likewise.
11817         (Target_sparc::Relocate::relocate): Likewise.
11818         (Target_sparc::Relocate::relocate_tls): Likewise.
11819
11820         * symtab.cc (Symbol_table::define_default_version): New function,
11821         broken out of add_from_object.
11822         (Symbol_table::add_from_object): Call define_default_version.
11823         (Symbol_table::define_special_symbol): Add resolve_oldsym
11824         parameter.  Change all callers.  If the version for a symbol comes
11825         from a version script, resolve it with the symbol with the same
11826         name with no version.  Also add the symbol without a version if
11827         appropriate.
11828         (do_define_in_output_data): If resolving with oldsym, don't delete
11829         sym.
11830         (do_define_in_output_segment): Likewise.
11831         (do_define_as_constant): Likewise.
11832         * symtab.h (class Symbol_table): Update declarations.
11833
11834 2009-03-13  Ian Lance Taylor  <iant@google.com>
11835
11836         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11837         (Read_symbols::requeue): New function.
11838         (Read_symbols::do_read_symbols): If make_elf_object fails because
11839         the target type is not configured, and the file was searched for,
11840         issue a warning and retry with the next directory.
11841         (Add_symbols::run): If the file has an incompatible format, and
11842         it was searched for, requeue the Read_symbols task.  On error,
11843         release the object.
11844         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11845         dirindex parameter to constructor.  Change all callers.  Declare
11846         incompatible_warning and requeue.
11847         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11848         input_argument_ and input_group_ fields.  Add them to
11849         constructor.  Change all callers.
11850         (class Read_script): Add dirindex_ field.  Add it to constructor.
11851         Change all callers.
11852         * archive.cc (Archive::setup): Remove input_objects parameter.
11853         Change all callers.
11854         (Archive::get_file_and_offset): Likewise.
11855         (Archive::read_all_symbols): Likewise.
11856         (Archive::read_symbols): Likewise.
11857         (Archive::get_elf_object_for_member): Remove input_objects
11858         parameter.  Add punconfigured parameter.  Change all callers.
11859         (Archive::add_symbols): Change return type to bool.  Check return
11860         value of include_member.
11861         (Archive::include_all_members): Likewise.
11862         (Archive::include_member): Change return type to bool.  Return
11863         false if first included object has incompatible target.  Set
11864         included_member_ field.
11865         (Add_archive_symbols::run): If add_symbols returns false, requeue
11866         Read_symbols task.
11867         * archive.h (class Archive): Add included_member_ field.
11868         Initialize it in constructor.  Add input_file and searched_for
11869         methods.  Update declarations.
11870         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11871         input_argument_ fields.  Add them to constructor.  Change all
11872         callers.
11873         * script.cc: Include "target-select.h".
11874         (class Parser_closure): Add skip_on_incompatible_target_ and
11875         found_incompatible_target_ fields.  Add
11876         skip_on_incompatible_target parameter to constructor.  Change all
11877         callers.  Add methods skip_on_incompatible_target,
11878         clear_skip_on_incompatible_target, found_incompatible_target, and
11879         set_found_incompatible_target.
11880         (read_input_script): Add dirindex parameter.  Change all callers.
11881         If parser finds an incompatible target, requeue Read_symbols
11882         task.
11883         (script_set_symbol): Clear skip_on_incompatible_target in
11884         closure.
11885         (script_add_assertion, script_parse_option): Likewise.
11886         (script_start_sections, script_add_phdr): Likewise.
11887         (script_check_output_format): New function.
11888         * script.h (read_input_script): Update declaration.
11889         * script-c.h (script_check_output_format): Declare.
11890         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11891         (ignore_cmd): Remove OUTPUT_FORMAT.
11892         * fileread.cc (Input_file::Input_file): Add explicit this.
11893         (Input_file::will_search_for): New function.
11894         (Input_file::open): Add pindex parameter.  Change all callers.
11895         * fileread.h (class Input_file): Add input_file_argument method.
11896         Declare will_search_for.  Update declarations.
11897         * object.cc (make_elf_object): Add punconfigured parameter.
11898         Change all callers.
11899         * object.h (class Object): Make input_file public.  Add
11900         searched_for method.
11901         (make_elf_object): Update declaration.
11902         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11903         restart search.
11904         * dirsearch.h (class Dirsearch): Update declaration.
11905         * options.h (class General_options): Add --warn-search-mismatch.
11906         * parameters.cc (Parameters::is_compatible_target): New function.
11907         * parameters.h (class Parameters): Declare is_compatible_target.
11908         * workqueue.cc (Workqueue::add_blocker): New function.
11909         * workqueue.h (class Workqueue): Declare add_blocker.
11910
11911         * fileread.cc (Input_file::open): Remove options parameter.
11912         Change all callers.
11913         (Input_file::open_binary): Likewise.
11914         * script.cc (read_input_script): Likewise.
11915         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11916         options parameter from constructor.  Change all callers.
11917         (class Read_script): Likewise.
11918         * fileread.h (class Input_file): Update declarations.
11919         * script.h (read_input_script): Update declaration.
11920
11921 2009-03-10  Nick Clifton  <nickc@redhat.com>
11922
11923         * po/es.po: New Spanish translation.
11924
11925 2009-03-06  Cary Coutant  <ccoutant@google.com>
11926
11927         * options.cc (parse_short_option): Keep dash_z from registering itself.
11928
11929 2009-03-03  Ian Lance Taylor  <iant@google.com>
11930
11931         PR 9918
11932         * target-reloc.h (relocate_section): Pass output_section to
11933         relocate.
11934         * i386.cc (Target_i386::should_apply_static_reloc): Add
11935         output_section parameter.  Change all callers.
11936         (Target_i386::Relocate::relocate): Add output_section parameter.
11937         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11938         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11939         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11940         * testsuite/two_file_shared.sh: New script.
11941         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11942         (check_DATA): Add two_file_shared.dbg.
11943         (two_file_shared.dbg): New target.
11944         * testsuite/Makefile.in: Rebuild.
11945
11946 2009-03-01  Ian Lance Taylor  <iant@google.com>
11947
11948         * configure.ac: Check for byteswap.h.
11949         * configure: Rebuild.
11950         * config.in: Rebuild.
11951
11952 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11953
11954         * layout.cc (Layout::find_or_add_kept_section): New function.
11955         (Layout::add_comdat): Removed.
11956         * layout.h (struct Kept_section): Move out of class Layout.
11957         Remove trailing underscores from field names.  Add group_sections
11958         field.  Rename group_ field to is_group.  Change all uses.
11959         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11960         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11961         comdat_groups_ field.
11962         (Sized_relobj::include_section_group): Use
11963         find_or_add_kept_section and Kept_section::group_sections.
11964         (Sized_relobj::include_linkonce_section): Likewise.
11965         * object.cc (class Sized_relobj): Don't define Comdat_group or
11966         Comdat_group_table.  Remove find_comdat_group and
11967         add_comdat_group.  Remove comdat_groups_ field.
11968         * plugin.cc (include_comdat_group): Use
11969         Layout::find_or_add_kept_section.
11970
11971 2009-02-28  Ian Lance Taylor  <iant@google.com>
11972
11973         * README: --gc-sections and map files are now supported.  Document
11974         some build requirements.
11975
11976         PR 6992
11977         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11978         relocatable link set the value of the section symbol to zero.
11979         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11980         relocatable link don't include the section address in the local
11981         symbol value.
11982
11983 2009-02-27  Ian Lance Taylor  <iant@google.com>
11984
11985         PR 6811
11986         * options.h (class Search_directory): Add is_system_directory.
11987         (class General_options): Declare is_in_system_directory.
11988         * options.cc (get_relative_sysroot): Make static.
11989         (get_default_sysroot): Make static.
11990         (General_optoins::is_in_system_directory): New function.
11991         * fileread.cc (Input_file::is_in_system_directory): New function.
11992         * fileread.h (class Input_file): Declare is_in_system_directory.
11993         * object.h (class Object): Add is_in_system_directory.
11994         (class Input_objects): Remove system_library_directory_ field.
11995         * object.cc (Input_objects::add_object): Don't set
11996         system_library_directory_.
11997         (input_objects::found_in_system_library_directory): Remove.
11998         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11999         parameter.  Change all callers.
12000         (Symbol_table::sized_write_globals): Likewise.
12001         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12002         Call Object::is_in_system_directory.
12003         * symtab.h (class Symbol_table): Update declarations.
12004
12005         PR 5990
12006         * descriptors.h (Open_descriptor): Add is_on_stack field.
12007         * descriptors.cc (Descriptors::open): If the descriptor is on the
12008         top of the stack, remove it.  Initialize is_on_stack field.
12009         (Descriptors::release): Only add pod to stack if it is not on the
12010         stack already.
12011         (Descriptors::close_some_descriptor): Clear stack_next and
12012         is_on_stack fields.
12013
12014         PR 7091
12015         * output.cc (Output_section::find_starting_output_address): Rename
12016         from starting_output_address; add PADDR parameter; change return
12017         type.
12018         * output.h (class Output_section): Declare
12019         find_starting_output_address instead of starting_output_address.
12020         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12021         section symbol for which we can't find a merge section.
12022
12023         PR 9836
12024         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12025         hidden or internal, force the symbol to be local.
12026         * resolve.cc (Symbol::override_visibility): Define.
12027         (Symbol::override_base): Use override_visibility.
12028         (Symbol_table::resolve): Likewise.
12029         (Symbol::override_base_with_special): Likewise.
12030         (Symbol_table::override_with_special): If the visibility is hidden
12031         or internal, force the symbol to be local.
12032         * symtab.h (class Symbol): Add set_visibility and
12033         override_visibility.
12034         * testsuite/ver_test_1.sh: New file.
12035         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12036         (check_DATA): Add ver_test_1.syms.
12037         (ver_test_1.syms): New target.
12038         * testsuite/Makefile.in: Rebuild.
12039
12040 2009-02-25  Cary Coutant  <ccoutant@google.com>
12041
12042         * layout.cc (Layout::choose_output_section): Don't rename sections
12043         when using a linker script that has a SECTIONS clause.
12044         * Makefile.in: Regenerate.
12045
12046         * testsuite/Makefile.am (script_test_5.sh): New test case.
12047         * testsuite/Makefile.in: Regenerate.
12048         * testsuite/script_test_5.cc: New file.
12049         * testsuite/script_test_5.sh: New file.
12050         * testsuite/script_test_5.t: New file.
12051
12052 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12053
12054         * archive.cc (Archive::include_member): Update calls to add_symbols.
12055         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12056         the Layout argument.
12057         * dynobj.h (do_add_symbols): Add the Layout argument.
12058         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12059         Layout argument.
12060         * object.h (Object::add_symbols): Add the Layout argument.
12061         (Object::do_add_symbols): Add the Layout argument.
12062         (Sized_relobj::do_add_symbols): Add the Layout argument.
12063         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12064         Unify the two versions.
12065         (Add_plugin_symbols): Remove.
12066         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12067         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12068         (Add_plugin_symbols): Remove.
12069         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12070         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12071         (Add_symbols::run): Make it work with Pulginobj.
12072
12073 2009-02-06  Ian Lance Taylor  <iant@google.com>
12074
12075         * object.cc (Sized_relobj::do_layout): Make info message start
12076         with lower case letter.
12077
12078 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12079
12080         * binary.cc: Fix file comment.
12081
12082         * options.h (enum Incremental_disposition): Define.
12083         (class General_options): Add new options: --incremental,
12084         --incremental_changed, --incremental_unchanged,
12085         --incremental_unknown.  Add incremental_disposition_ and
12086         implicit_incremental_ fields.
12087         (General_options::incremental_disposition): New function.
12088         (class Position_dependent_options): Add incremental_disposition
12089         option.
12090         (Position_dependent_options::copy_from_options): Set incremental
12091         dispositions.
12092         * options.cc (General_options::parse_incremental_changed): New
12093         function.
12094         (General_options::parse_incremental_unchanged): New function.
12095         (General_options::parse_incremental_unknown): New function.
12096         (General_options::General_options): Initialize new fields
12097         incremental_disposition_ and implicit_incremental_.
12098         (General_options::finalize): Check for uasge of --incremental-*
12099         without --incremental.
12100
12101 2009-02-06  Chris Demetriou  <cgd@google.com>
12102
12103         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12104         pointer and to report location as the file name associated with
12105         the symbol.
12106         (gold_undefined_symbol_at_location): New function to replace the
12107         old gold_undefined_symbol functionality.
12108         * target-reloc.h (relocate_section): Update to use
12109         gold_undefined_symbol_at_location.
12110         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12111         Call gold_undefined_symbol function rather than gold_error.
12112         * errors.h (Errors::undefined_symbol): Take location as a
12113         string, rather than calculating it from a relocation.
12114         * errors.cc (Errors::fatal): Print "fatal error:" before the
12115         formatted message.
12116         (Errors::error, Errors::error_at_location): Print "error: "
12117         before the formatted message.
12118         (Errors::undefined_symbol): Take location as a string, rather
12119         than calculating it from a relocation.
12120         (gold_undefined_symbol_at_location): New function akin to
12121         old gold_undefined_symbol, calculates location from relocation.
12122         (gold_undefined_symbol): Change to take only a Symbol pointer
12123         and to report location as the file name associated with the symbol.
12124         * testsuite/debug_msg.sh: Update for changed error messages.
12125         * testsuite/undef_symbol.sh: Likewise.
12126
12127 2009-02-04  Duncan Sands  <baldrick@free.fr>
12128
12129         PR 9812
12130         * reduced_debug_output.h
12131         (Output_reduced_debug_abbrev_section::failed): Use format for
12132         gold_warning.
12133         (Output_reduced_debug_info_section::faild): Likewise.
12134
12135 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12136
12137         * script.cc (Lazy_demangler): New class.
12138         (Version_script_info::get_symbol_version_helper): Demangle a
12139         symbol only once.
12140
12141 2009-01-29  Cary Coutant  <ccoutant@google.com>
12142
12143         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12144         to __tls_get_addr.
12145         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12146
12147 2009-01-28  Ian Lance Taylor  <iant@google.com>
12148
12149         * version.cc (version_string): Bump to 1.9.
12150
12151         * gold.h: Include <cstring> and <stdint.h>.
12152         * version.cc: Include <cstdio>.
12153         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12154         warning.
12155         * reduced_debug_output.cc (insert_into_vector): Rename from
12156         Insert_into_vector; change all callers.  Use Swap_unaligned to
12157         avoid aliasing issue; remove union since it is unnecessary.
12158
12159 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12160
12161         * Makefile.am (CCFILES): Add gc.cc.
12162         (HFILES): Add gc.h.
12163         * Makefile.in: Regenerate.
12164         * gold.cc (Gc_runner): New class.
12165         (queue_initial_tasks): Call garbage collection related tasks
12166         when corresponding options are invoked.
12167         (queue_middle_gc_tasks): New function.
12168         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12169         processed early before laying out sections during garbage collection.
12170         * gold.h (queue_middle_gc_tasks): New function.
12171         (is_prefix_of): Move from "layout.cc".
12172         * i386.cc (Target_i386::gc_process_relocs): New function.
12173         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12174         * main.cc (main): Create object of class "Garbage_collection".
12175         * object.cc (Relobj::copy_symbols_data): New function.
12176         (Relobj::is_section_name_included): New function.
12177         (Sized_relobj::do_layout): Allow this function to be called twice
12178         during garbage collection and defer layout of section during the
12179         first call.
12180         * object.h (Relobj::get_symbols_data): New function.
12181         (Relobj::is_section_name_included): New function.
12182         (Relobj::copy_symbols_data): New function.
12183         (Relobj::set_symbols_data): New function.
12184         (Relobj::get_relocs_data): New function.
12185         (Relobj::set_relocs_data): New function.
12186         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12187         (Relobj::gc_process_relocs): New function.
12188         (Relobj::do_gc_process_relocs): New pure virtual function.
12189         (Relobj::sd_): New data member.
12190         (Sized_relobj::is_output_section_offset_invalid): New function.
12191         (Sized_relobj::do_gc_process_relocs): New function.
12192         * options.h (General_options::gc_sections): Modify to not be a no-op.
12193         (General_options::print_gc_sections): New option.
12194         * plugin.cc (Plugin_finish::run): Remove function call to
12195         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12196         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12197         * reloc.cc (Read_relocs::run): Add task to process relocs and
12198         determine unreferenced sections when doing garbage collection.
12199         (Gc_process_relocs): New class.
12200         (Sized_relobj::do_gc_process_relocs): New function.
12201         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12202         sections that are garbage collected.
12203         * reloc.h (Gc_process_relocs): New class.
12204         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12205         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12206         symbols whose corresponding sections are garbage collected.
12207         (Symbol_table::Symbol_table): Add new parameter for the garbage
12208         collection object.
12209         (Symbol_table::gc_mark_undef_symbols): New function.
12210         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12211         (Symbol_table::gc_mark_dyn_syms): New function.
12212         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12213         as garbage.
12214         (Symbol_table::add_from_object): Likewise.
12215         (Symbol_table::add_from_relobj): When building shared objects, do not
12216         treat externally visible symbols as garbage.
12217         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12218         table information for static and relocatable links.
12219         * symtab.h (Symbol_table::set_gc): New function.
12220         (Symbol_table::gc): New function.
12221         (Symbol_table::gc_mark_undef_symbols): New function.
12222         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12223         (Symbol_table::gc_mark_dyn_syms): New function.
12224         (Symbol_table::gc_): New data member.
12225         * target.h (Sized_target::gc_process_relocs): New pure virtual
12226         function.
12227         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12228         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12229
12230 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12231
12232         * options.h (General_options::gc_sections): Define as a no-op for now.
12233         (General_options::no_keep_memory): Ditto.
12234         (General_options::Bshareable): Define.
12235         * options.cc (General_options::finalize): Honor -Bshareable.
12236
12237 2009-01-20  Andreas Schwab  <schwab@suse.de>
12238
12239         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12240         read the value in the contents, since we don't use it.  Use the
12241         template endianness when writing.
12242         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12243
12244 2009-01-19  Andreas Schwab  <schwab@suse.de>
12245
12246         * configure.tgt (powerpc64-*): Fix targ_obj.
12247
12248 2009-01-15  Ian Lance Taylor  <iant@google.com>
12249
12250         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12251         local symbols when stripping all symbols.
12252
12253 2009-01-14  Cary Coutant  <ccoutant@google.com>
12254
12255         * output.cc (Output_reloc): Add explicit instantiations.
12256
12257 2009-01-14  Cary Coutant  <ccoutant@google.com>
12258
12259         * archive.cc (Archive::get_elf_object_for_member): Remove call
12260         to File_read::claim_for_plugin.
12261         * descriptors.cc (Descriptors::open): Remove reference to
12262         is_claimed.
12263         (Descriptors::claim_for_plugin): Remove.
12264         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12265         (Descriptors::is_claimed): Remove.
12266         (claim_descriptor_for_plugin): Remove.
12267         * fileread.cc (File_read::claim_for_plugin): Remove.
12268         * fileread.h (File_read::claim_for_plugin): Remove.
12269         (File_read::descriptor): Reopen descriptor if necessary.
12270         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12271         (Plugin_manager::all_symbols_read): Add task parameter. Change
12272         all callers.
12273         (Plugin_manager::get_input_file): New function.
12274         (Plugin_manager::release_input_file): New function.
12275         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12276         corresponding data member.
12277         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12278         and pass to base constructor. Change all callers.
12279         (get_input_file, release_input_file): New functions.
12280         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12281         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12282         (Plugin_manager::all_symbols_read): Add task parameter.
12283         (Plugin_manager::get_input_file): New function.
12284         (Plugin_manager::release_input_file): New function.
12285         (Plugin_manager::task_): New data member.
12286         (Pluginobj::Pluginobj): Add filesize parameter.
12287         (Pluginobj::filename): New function.
12288         (Pluginobj::descriptor): New function.
12289         (Pluginobj::filesize): New function.
12290         (Pluginobj::filesize_): New data member.
12291         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12292         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12293         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12294
12295         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12296         with archive libraries.
12297         * testsuite/Makefile.in: Regenerate.
12298         * testsuite/plugin_test.c (struct sym_info): New type.
12299         (get_input_file, release_input_file): New static variables.
12300         (onload): Capture new transfer vector entries.
12301         (claim_file_hook): Stop reading at end of file according to filesize.
12302         Factor out parsing of readelf output into separate function.
12303         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12304         APIs and get the source file name from the symbol table.  Convert
12305         source file name to corresponding object file name.  Print info
12306         message when adding new input files.
12307         (parse_readelf_line): New function.
12308         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12309         * testsuite/plugin_test_2.sh: Likewise.
12310         * testsuite/plugin_test_3.sh: Likewise.
12311         * testsuite/plugin_test_4.sh: New test case.
12312
12313 2009-01-07  Ian Lance Taylor  <iant@google.com>
12314
12315         * version.cc (version_string): Bump to 1.8.
12316
12317 2008-12-23  Cary Coutant  <ccoutant@google.com>
12318
12319         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12320         * plugin.cc (Plugin_manager::finish): Rename as
12321         layout_deferred_objects.  Move cleanup to separate function.
12322         (Plugin_manager::cleanup): New function.
12323         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12324         separately.
12325         * plugin.h (Plugin_manager::finish): Rename as
12326         layout_deferred_objects.
12327         (Plugin_manager::cleanup): New function.
12328         (Plugin_manager::cleanup_done): New field.
12329
12330 2008-12-23  Cary Coutant  <ccoutant@google.com>
12331
12332         * plugin.cc (is_visible_from_outside): New function.
12333         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12334         so we don't return "IR only" status for exported symbols or -r links.
12335
12336         * testsuite/Makefile.am (plugin_test_3): New test case.
12337         * testsuite/Makefile.in: Regenerate.
12338         * testsuite/plugin_test_3.sh: New file.
12339
12340 2008-12-22  Cary Coutant  <ccoutant@google.com>
12341
12342         * object.cc (Sized_relobj::layout_section): New function.
12343         (Sized_relobj::do_layout): Defer layout of input sections until after
12344         plugin has provided replacement files.
12345         (Sized_relobj::do_layout_deferred_sections): New function.
12346         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12347         (Relobj::layout_deferred_sections): New function.
12348         (Relobj::do_layout_deferred_sections): New function.
12349         (Sized_relobj::do_layout_deferred_sections): New function.
12350         (Sized_relobj::layout_section): New function.
12351         (Sized_relobj::Deferred_layout): New structure.
12352         (Sized_relobj::deferred_layout_): New field.
12353         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12354         Change all callers.  Layout deferred sections.
12355         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12356         references.
12357         (Plugin_hook::run): Move code from do_plugin_hook inline.
12358         (Plugin_hook::do_plugin_hook): Remove.
12359         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12360         (Plugin_manager::finish): Renamed, was cleanup.
12361         (Plugin_manager::should_defer_layout): New function.
12362         (Plugin_manager::add_deferred_layout_object): New function.
12363         (Plugin_manager::Deferred_layout_list): New type.
12364         (Plugin_manager::deferred_layout_objects_): New field.
12365         (Plugin_hook::do_plugin_hook): Remove.
12366
12367 2008-12-17  Ian Lance Taylor  <iant@google.com>
12368
12369         * options.h (class General_options): Add --no case for
12370         --export-dynamic.
12371
12372 2008-12-16  Cary Coutant  <ccoutant@google.com>
12373
12374         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12375         vector.
12376         (Plugin_manager::claim_file): Create plugin object even if
12377         plugin did not call the add_symbols callback.
12378         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12379         asking for more symbols than were added.
12380         * testsuite/Makefile.am (plugin_test_1): Add test case with
12381         no global symbols.
12382         (empty.syms): New target.
12383         * testsuite/Makefile.in: Regenerate.
12384         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12385         message. Don't call add_symbols if no globals.
12386         (all_symbols_read_hook): Don't provide replacement for empty
12387         claimed file.
12388
12389 2008-12-12  Ian Lance Taylor  <iant@google.com>
12390
12391         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12392         r_type == 0 for a local symbol with r_sym == 0.
12393         (scan_relocatable_relocs): Pass r_sym to
12394         local_non_section_strategy.
12395         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12396         r_sym parameter.
12397
12398         * configure.ac: Update test for TLS descriptors: they are
12399         supported as of glibc 2.9.
12400         * configure: Rebuild.
12401
12402 2008-12-11  Ian Lance Taylor  <iant@google.com>
12403
12404         PR 7091
12405         * target-reloc.h (Default_scan_relocatable_relocs): For each
12406         function, map r_type == 0 to RELOC_DISCARD.
12407
12408 2008-12-10  Cary Coutant  <ccoutant@google.com>
12409
12410         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12411         object to override a kept COMDAT group from a plugin object.
12412
12413 2008-12-09  Ian Lance Taylor  <iant@google.com>
12414
12415         PR 7088
12416         * yyscript.y (file_cmd): Handle INPUT.
12417
12418         * testsuite/initpri1.c: Change all declarations to be full
12419         prototypes by adding void, to avoid compiler warnings.
12420
12421 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12422
12423         * options.cc (General_options::parse_plugin_opt): New.
12424         (General_options::add_plugin): The argument now is just the filename.
12425         (General_options::add_plugin_option): New.
12426         * options.h (plugin_opt): New.
12427         (add_plugin): Change argument name.
12428         (add_plugin_option): New.
12429         * plugin.cc (Plugin::load): Don't parse the plugin option.
12430         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12431         (Plugin::add_option): New.
12432         (Plugin::args_): Change type.
12433         (Plugin::filename_): New.
12434         (Plugin_manager::add_plugin_option): New.
12435         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12436         * testsuite/Makefile.in: Regenerate.
12437
12438 2008-12-05  Cary Coutant  <ccoutant@google.com>
12439
12440         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12441         Handle --strip-lto-sections option.
12442         * options.h (strip_lto_sections): New option.
12443
12444 2008-12-01  Cary Coutant  <ccoutant@google.com>
12445
12446         * plugin.cc (ld_plugin_message): Change format parameter to const.
12447         Fix mismatch between new[] and delete.
12448
12449 2008-11-14  Cary Coutant  <ccoutant@google.com>
12450
12451         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12452         instead of -1U.
12453
12454 2008-11-05  Craig Silverstein  <csilvers@google.com>
12455
12456         * options.cc (General_options::parse_dynamic_list): New function.
12457         * options.h (General_options): New flags dynamic_list,
12458         dynamic_list_data, dynamic_list_cpp_new, and
12459         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12460         (General_options::in_dynamic_list): New function.
12461         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12462         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12463         (Lex::can_continue_name): Likewise.
12464         (yylex): Likewise.
12465         (read_script_file): New parameter script_options.
12466         (read_dynamic_list): New function.
12467         (Script_options::define_dynamic_list): New function.
12468         (dynamic_list_keyword_parsecodes): New variable.
12469         (dynamic_list_keywords): New variable.
12470         * script.h (Script_options::define_dynamic_list): New function
12471         prototype.
12472         (read_dynamic_list): New function prototype.
12473         * symtab.cc (strprefix): New macro.
12474         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12475         dynamic_list_data, dynamic_list_cpp_new, and
12476         dynamic_list_cpp_typeinfo.
12477         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12478         (dynamic_list_expr): New rule.
12479         (dynamic_list_nodes): Likewise.
12480         (dynamic_list_node): Likewise.
12481         * testsuite/Makefile.am (dynamic_list): New test.
12482         * testsuite/Makefile.in: Regenerated.
12483         * testsuite/dynamic_list.t: New file.
12484         * testsuite/dynamic_list.sh: New file.
12485
12486 2008-11-05  Craig Silverstein  <csilvers@google.com>
12487
12488         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12489         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12490         (t11_last): Likewise.
12491         * testsuite/ver_test_6.c (main): Likewise.
12492
12493 2008-10-07  Cary Coutant  <ccoutant@google.com>
12494
12495         * options.c (General_options::finalize): Add check for -static and
12496         -shared.
12497         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12498         is not empty.
12499
12500 2008-10-02  Cary Coutant  <ccoutant@google.com>
12501
12502         * plugin.cc (make_sized_plugin_object): Fix conditional
12503         compilation to work when not all targets are enabled.
12504
12505 2008-09-29  Cary Coutant  <ccoutant@google.com>
12506
12507         * archive.cc (Archive::get_file_and_offset): Use filename instead
12508         of name to get library path.
12509         (Archive::include_member): Unlock external member of a thin archive.
12510
12511         * testsuite/Makefile.am (TEST_AR): New variable.
12512         (thin_archive_test_1): New test.
12513         (thin_archive_test_2): New test.
12514         * testsuite/Makefile.in: Regenerate.
12515         * testsuite/thin_archive_main.cc: New file.
12516         * testsuite/thin_archive_test_1.cc: New file.
12517         * testsuite/thin_archive_test_2.cc: New file.
12518         * testsuite/thin_archive_test_3.cc: New file.
12519         * testsuite/thin_archive_test_4.cc: New file.
12520
12521 2008-09-29  Cary Coutant  <ccoutant@google.com>
12522
12523         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12524         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12525         instead of -1U.
12526         (Sized_relobj::do_finalize_local_symbols): Likewise.
12527         (Sized_relobj::map_to_kept_section): Likewise.
12528         * object.h (Sized_relobj::invalid_address): New constant.
12529         (Sized_relobj::do_output_section_offset): Check for invalid_address
12530         and return -1ULL.
12531         * output.cc (Output_reloc::local_section_offset): Use constant
12532         invalid_address instead of -1U.
12533         (Output_reloc::get_address): Likewise.
12534         (Output_section::output_address): Change -1U to -1ULL.
12535         * output.h (Output_reloc::invalid_address): New constant.
12536         * reloc.cc (Sized_relobj::write_sections): Use constant
12537         invalid_address instead of -1U.
12538         (Sized_relobj::relocate_sections): Likewise.
12539         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12540         values for merge sections.
12541         * target-reloc.h (relocate_for_relocatable): Use constant
12542         invalid_address instead of -1U.
12543
12544 2008-09-19  Cary Coutant  <ccoutant@google.com>
12545
12546         Add plugin functionality for link-time optimization (LTO).
12547         * configure.ac (plugins): Add --enable-plugins option.
12548         * configure: Regenerate.
12549         * config.in: Regenerate.
12550         * Makefile.am (LIBDL): New variable.
12551         (CCFILES): Add plugin.cc.
12552         (HFILES): Add plugin.h.
12553         (ldadd_var): Add LIBDL.
12554         * Makefile.in: Regenerate.
12555
12556         * archive.cc: Include "plugin.h".
12557         (Archive::setup): Don't preread archive symbols when using a plugin.
12558         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12559         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12560         files.
12561         (Archive::include_member): Add symbols from plugin objects.
12562         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12563         * descriptors.cc (Descriptors::open): Check for file descriptors
12564         abandoned by plugins.
12565         (Descriptors::claim_for_plugin): New function.
12566         * descriptors.h (Descriptors::claim_for_plugin): New function.
12567         (Open_descriptor::is_claimed): New field.
12568         (claim_descriptor_for_plugin): New function.
12569         * fileread.cc (File_read::claim_for_plugin): New function.
12570         * fileread.h (File_read::claim_for_plugin): New function.
12571         (File_read::descriptor): New function.
12572         * gold.cc: Include "plugin.h".
12573         (queue_initial_tasks): Add task to call plugin hooks for generating
12574         new object files.
12575         * main.cc: Include "plugin.h".
12576         (main): Load plugin libraries.
12577         * object.h (Pluginobj): Declare.
12578         (Object::pluginobj): New function.
12579         (Object::do_pluginobj): New function.
12580         (Object::set_target): New function.
12581         * options.cc: Include "plugin.h".
12582         (General_options::parse_plugin): New function.
12583         (General_options::General_options): Initialize plugins_ field.
12584         (General_options::add_plugin): New function.
12585         * options.h (Plugin_manager): Declare.
12586         (General_options): Add --plugin option.
12587         (General_options::has_plugins): New function.
12588         (General_options::plugins): New function.
12589         (General_options::add_plugin): New function.
12590         (General_options::plugins_): New field.
12591         * plugin.cc: New file.
12592         * plugin.h: New file.
12593         * readsyms.cc: Include "plugin.h".
12594         (Read_symbols::do_read_symbols): Check for archive before checking
12595         for ELF file.  Call plugin hooks to claim files.
12596         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12597         from a real object file; force override when processing replacement
12598         files.
12599         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12600         (Symbol::init_base_object): Likewise.
12601         (Symbol::init_base_output_data): Likewise.
12602         (Symbol::init_base_output_segment): Likewise.
12603         (Symbol::init_base_constant): Likewise.
12604         (Symbol::init_base_undefined): Likewise.
12605         (Symbol::output_section): Assert that object is not a plugin.
12606         (Symbol_table::add_from_pluginobj): New function.
12607         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12608         undefined.
12609         (Symbol_table::sized_write_globals): Likewise.
12610         (Symbol_table::add_from_pluginobj): Instantiate template.
12611         * symtab.h (Sized_pluginobj): Declare.
12612         (Symbol::in_real_elf): New function.
12613         (Symbol::set_in_real_elf): New function.
12614         (Symbol::in_real_elf_): New field.
12615         (Symbol_table::add_from_pluginobj): New function.
12616
12617         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12618         (LIBDL): New variable.
12619         (LDADD): Add LIBDL.
12620         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12621         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12622         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12623         (MOSTLYCLEANFILES): Likewise.
12624         * testsuite/Makefile.in: Regenerate.
12625         * testsuite/plugin_test.c: New file.
12626         * testsuite/plugin_test_1.sh: New file.
12627         * testsuite/plugin_test_2.sh: New file.
12628
12629 2008-09-16  Ian Lance Taylor  <iant@google.com>
12630
12631         * target-reloc.h (relocate_section): Check whether a symbol is
12632         defined by the ABI before reporting an undefined symbol error.
12633         * target.h (Target::is_defined_by_abi): Make parameter const.
12634         (Target::do_is_defined_by_abi): Likewise.
12635         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12636         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12637         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12638         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12639         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12640         * testsuite/Makefile.in: Rebuild.
12641
12642         * fileread.cc (make_view): Add casts to avoid warning.
12643
12644 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12645
12646         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12647         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12648
12649 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12650
12651         * options.h (General_options::output_is_executable): New.
12652         (General_options::output_is_pie): New.
12653         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12654         for shared libraries.
12655         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12656
12657 2008-09-11  Chris Demetriou  <cgd@google.com>
12658
12659         * options.h (origin): New -z option.
12660         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12661         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12662         in DT_FLAGS_1.
12663
12664 2008-09-05  Cary Coutant  <ccoutant@google.com>
12665
12666         * fileread.cc (File_read::make_view): Add check for attempt to map
12667         beyond end of file.
12668
12669 2008-09-05  Cary Coutant  <ccoutant@google.com>
12670
12671         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12672         explicit instantiations.
12673
12674 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12675
12676         PR gold/6858
12677         * options.cc (General_options::finalize): Allow undefined symbols
12678         in shlibs if linking -shared.
12679
12680         PR gold/6859
12681         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12682         symbols as not needing a dynsym entry.
12683
12684 2008-08-20  Craig Silverstein  <csilvers@google.com>
12685
12686         * fileread.cc (File_read::open): Do not lock the file unless it
12687         was successfully opened.
12688
12689 2008-08-14  Cary Coutant  <ccoutant@google.com>
12690
12691         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12692         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12693         * testsuite/tls_test.cc (struct int128): 128-bit struct
12694         for testing TLS relocs with non-zero addend.
12695         (v12): New TLS variable.
12696         (t12): New test.
12697         (t_last): Add check for v12.
12698         * testsuite/tls_test.h (t12): New function.
12699         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12700
12701 2008-08-13  Ian Lance Taylor  <iant@google.com>
12702
12703         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12704         set tls_segment_ or relro_segment_.
12705         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12706         when appropriate.
12707         * output.h (Output_section::clear_is_relro): New function.
12708         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12709         sections specially even when output_data_ is empty.
12710         (Output_segment::maximum_alignment): When first section is relro,
12711         only force alignment for PT_LOAD segments.
12712         * script.cc (script_data_segment_align): New function.
12713         (script_data_segment_relro_end): New function.
12714         * script-c.h (script_data_segment_align): Declare.
12715         (script_data_segment_relro_end): Declare.
12716         * script-sections.h (class Script_sections): Declare
12717         data_segment_align and data_segment_relro_end.  Add fields
12718         segment_align_index_ and saw_relro_end_.
12719         * script-sections.cc (class Sections_element): Add set_is_relro
12720         virtual function.  Add new bool* parameter to place_orphan_here.
12721         Add get_output_section virtual function.
12722         (class Output_section_definition): Add set_is_relro.  Add new
12723         bool* parameter to place_orphan_here.  Add get_output_section.
12724         Add is_relro_ field.
12725         (Output_section_definition::Output_section_definition): Initialize
12726         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12727         and is_relro_ fields.
12728         (Output_section_definition::place_orphan_here): Add is_relro
12729         parameter.
12730         (Output_section_definition::set_section_addresses): Set relro for
12731         output section.
12732         (Output_section_definition::alternate_constraint): Likewise.
12733         (class Orphan_output_section): Add new bool* parameter to
12734         place_orphan_here.  Add get_output_section.
12735         (Orphan_output_section::place_orphan_here): Add is_relro
12736         parameter.
12737         (Script_sections::Script_sections): Initialize
12738         data_segment_align_index_ and saw_relro_end_.
12739         (Script_sections::data_segment_align): New function.
12740         (Script_sections::data_segment_relro_end): New function.
12741         (Script_sections::place_orphan): Set or clear is_relro.
12742         (Script_sections::set_section_addresses): Force alignment of first
12743         TLS section.
12744         * yyscript.y (exp): Call script_data_segment_align and
12745         script_data_segment_relro_end.
12746         * testsuite/relro_script_test.t: New file.
12747         * testsuite/relro_test.cc (using_script): Declare.
12748         (t1, t2): Test using_script.
12749         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12750         (relro_script_test_SOURCES): Define.
12751         (relro_script_test_DEPENDENCIES): Define.
12752         (relro_script_test_LDFLAGS): Define.
12753         (relro_script_test_LDADD): Define.
12754         (relro_script_test.so): New target.
12755         * testsuite/Makefile.in: Rebuild.
12756
12757 2008-08-06  Cary Coutant <ccoutant@google.com>
12758
12759         * archive.cc (Archive::total_archives, Archive::total_members)
12760         (Archive::total_members_loaded): New variables.
12761         (Archive::setup): Add parameter.  Add option to preread
12762         archive symbols.
12763         (Archive::read_armap): Add counter.
12764         (Archive::get_file_and_offset): New function.
12765         (Archive::get_elf_object_for_member): New function.
12766         (Archive::read_all_symbols): New function.
12767         (Archive::read_symbols): New function.
12768         (Archive::add_symbols): Add counters.
12769         (Archive::include_all_members): Use armap to find members if it's
12770         already built.
12771         (Archive::include_member): Skip reading symbols if already read.
12772         Factored code into Archive::get_file_and_offset and
12773         Archive::get_elf_object_for_member.  Changed call to
12774         Mapfile::report_include_archive_member.
12775         (Archive::print_stats): New function.
12776         * archive.h: Declare Object and Read_symbols_data classes.
12777         (Archive::Archive): Add initializers for new members.
12778         (Archive::setup): Add parameter.
12779         (Archive::print_stats): New function.
12780         (Archive::total_archives, Archive::total_members)
12781         (Archive::total_members_loaded): New variables.
12782         (Archive::get_file_and_offset): New function.
12783         (Archive::get_elf_object_for_member): New function.
12784         (Archive::read_all_symbols): New function.
12785         (Archive::read_symbols): New function.
12786         (Archive::Archive_member): New class.
12787         (Archive::members_): New member.
12788         (Archive::num_members_): New member.
12789         * main.cc: Include archive.h.
12790         (main): Call Archive::print_stats.
12791         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12792         archive parameter; member_name is now the fully-decorated name.
12793         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12794         * options.h: (General_options): Add --preread-archive-symbols option.
12795         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12796         Archive::setup.
12797
12798 2008-08-04  Ian Lance Taylor  <iant@google.com>
12799
12800         * symtab.h (Symbol::use_plt_offset): New function.
12801         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12802         * powerpc.cc (Relocate::relocate): Likewise.
12803         * sparc.cc (Relocate::relocate): Likewise.
12804         * x86_64.cc (Relocate::relocate): Likewise.
12805         * testsuite/weak_plt.sh: New test.
12806         * testsuite/weak_plt_main.cc: New test.
12807         * testsuite/weak_plt_shared.cc: New test.
12808         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12809         (check_PROGRAMS): Add weak_plt.
12810         (check_DATA): Add weak_plt_shared.so.
12811         (weak_plt_main_pic.o, weak_plt): New targets.
12812         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12813         * testsuite/Makefile.in: Rebuild.
12814
12815         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12816         gcctestdir/ld.
12817         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12818         * testsuite/Makefile.in: Rebuild.
12819
12820 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12821
12822         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12823         * Makefile.in: Regenerate.
12824         * po/POTFILES.in: Regenerate.
12825
12826 2008-07-29  Ian Lance Taylor  <iant@google.com>
12827
12828         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12829         symbols before other symbols.
12830         * testsuite/script_test_2.cc (test_addr): Declare.
12831         (test_addr_alias): Declare.
12832         (main): Check that test_addr and test_addr_alias have the right
12833         values.
12834         * testsuite/script_test_2.t: Define test_addr_alias and
12835         test_addr.
12836
12837 2008-07-24  Ian Lance Taylor  <iant@google.com>
12838
12839         PR 5990
12840         * descriptors.cc: New file.
12841         * descriptors.h: New file.
12842         * gold-threads.h (class Hold_optional_lock): New class.
12843         * fileread.cc: Include "descriptors.h".
12844         (File_read::~File_read): Release descriptor rather than closing
12845         it.
12846         (File_read::open) [file]: Call open_descriptor rather than open.
12847         Set is_descriptor_opened_.
12848         (File_read::open) [memory]: Assert that descriptor is not open.
12849         (File_read::reopen_descriptor): New function.
12850         (File_read::release): Release descriptor.
12851         (File_read::do_read): Make non-const.  Reopen descriptor.
12852         (File_read::read): Make non-const.
12853         (File_read::make_view): Reopen descriptor.
12854         (File_read::do_readv): Likewise.
12855         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12856         Update declarations.
12857         * layout.cc: Include "descriptors.h".
12858         (Layout::create_build_id): Use open_descriptor rather than open.
12859         * output.cc: Include "descriptors.h".
12860         (Output_file::open): Use open_descriptor rather than open.
12861         * archive.cc (Archive::const_iterator): Change Archive to be
12862         non-const.
12863         (Archive::begin, Archive::end): Make non-const.
12864         (Archive::count_members): Likewise.
12865         * archive.h (class Archive): Update declarations.
12866         * object.h (Object::read): Make non-const.
12867         * Makefile.am (CCFILES): Add descriptors.cc.
12868         (HFILES): Add descriptors.h.
12869         * Makefile.in: Rebuild.
12870
12871         PR 6716
12872         * gold.h: Always include <clocale>.  Add Solaris workarounds
12873         following code in binutils/sysdep.h.
12874
12875         PR 6048
12876         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12877         this->eh_frame_hdr_ is NULL before using it.
12878
12879         * dynobj.cc (Versions::Versions): Update comment.
12880
12881         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12882         the base version name.
12883
12884         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12885         array size plus one.
12886         (Stringpool_template::set_string_offsets): Subtract one from key
12887         before using it as an array index.
12888         (Stringpool_template::get_offset_with_length): Likewise.
12889         (Stringpool_template::write_to_buffer): Likewise.
12890         * stringpool.h (Stringpool_template::get_offset_from_key):
12891         Likewise.
12892
12893 2008-07-23  Ian Lance Taylor  <iant@google.com>
12894
12895         PR 6658
12896         * object.h (Merged_symbol_value::value): Do our best to handle a
12897         negative addend.
12898
12899         PR 6647
12900         * script.cc (Version_script_info::get_versions): Don't add empty
12901         version tag to return value.
12902         (Version_script_info::get_symbol_version_helper): Change return
12903         type to bool.  Add pversion parameter.  Change all callers.
12904         (script_register_vers_node): Don't require a non-NULL tag.
12905         * script.h (class Version_script_info): Update declarations.
12906         (Version_script_info::get_symbol_version): Change return type to
12907         bool.  Add version parameter.  Change all callers.
12908         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12909         handling.  Handle an empty version from a version script.
12910         (Symbol_table::define_special_symbol): Likewise.
12911         * testsuite/ver_test_10.script: New file.
12912         * testsuite/ver_test_10.sh: New file.
12913         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12914         (check_DATA): Add ver_test_10.syms.
12915         (ver_test_10.syms, ver_test_10.so): New target.
12916         * testsuite/Makefile.in: Rebuild.
12917
12918 2008-07-23  Simon Baldwin  <simonb@google.com>
12919
12920         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12921         to zero for undefined symbols from dynamic libraries.
12922
12923 2008-07-23  Ian Lance Taylor  <iant@google.com>
12924
12925         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12926         Change all callers.
12927         * symtab.h (class Symbol_table): Update declaration.
12928         * testsuite/ver_test_9.cc: New file.
12929         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12930         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12931         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12932         (ver_test_9.so, ver_test_9.o): New targets.
12933         * testsuite/Makefile.in: Rebuild.
12934
12935 2008-07-22  Ian Lance Taylor  <iant@google.com>
12936
12937         * options.h (class General_options): Define --check-sections.
12938         * layout.cc (Layout::set_segment_offsets): Handle
12939         --check-sections.
12940
12941         * options.h (class General_options): Define -n/--nmagic and
12942         -N/--omagic.
12943         * options.cc (General_options::finalize): For -n/--nmagic or
12944         -N/--omagic, set -static.
12945         * layout.cc (Layout::attach_allocated_section_to_segment): If
12946         -N/--omagic, don't put read-only and read-write sections in
12947         different segments.
12948         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12949         finding a read-only segment.
12950         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12951         don't set the minimum segment alignment to the common page size,
12952         and don't set the file offset to the address modulo the page size.
12953         * script-sections.cc (Script_sections::create_segments): If
12954         -n/--omagic, don't put read-only and read-write sections in
12955         different segments.
12956
12957         * cref.cc: New file.
12958         * cref.h: New file.
12959         * options.h (class General_options): Add --print-symbol-counts.
12960         * main.cc (main): Issue defined symbol report if requested.
12961         * archive.cc (Archive::interpret_header): Make into a const member
12962         function.
12963         (Archive::add_symbols): Call Input_objects::archive_start and
12964         archive_stop.
12965         (Archive::const_iterator): Define new class.
12966         (Archive::begin, Archive::end): New functions.
12967         (Archive::include_all_members): Rewrite to use iterator.
12968         (Archive::count_members): New function.
12969         * archive.h (class Archive): Update declarations.
12970         (Archive::filename): New function.
12971         * object.cc: Include "cref.h".
12972         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12973         (Sized_relobj::do_get_global_symbol_counts): New function.
12974         (Input_objects::add_object): Add object to cross-referencer.
12975         (Input_objects::archive_start): New function.
12976         (Input_objects::archive_stop): New function.
12977         (Input_objects::print_symbol_counts): New function.
12978         * object.h: Declare Cref and Archive.
12979         (Object::get_global_symbol_counts): New function.
12980         (Object::do_get_global_symbol_counts): New pure virtual function.
12981         (class Sized_relobj): Add defined_count_ field.  Update
12982         declarations.
12983         (class Input_objects): Add cref_ field.  Update constructor.
12984         Update declarations.
12985         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12986         defined_count_.
12987         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12988         symbol counts.
12989         (Sized_dynobj::do_get_global_symbol_counts): New function.
12990         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12991         defined_count_.  Update declarations.  Define Symbols typedef.
12992         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12993         parameter.  Change all callers.
12994         (Symbol_table::add_from_dynobj): Add sympointers and defined
12995         parameters.  Change all callers.
12996         * symtab.h (class Symbol_table): Update declarations.
12997         * Makefile.am (CCFILES): Add cref.cc.
12998         (HFILES): Add cref.h.
12999         * Makefile.in: Rebuild.
13000
13001 2008-07-22  Simon Baldwin  <simonb@google.com>
13002
13003         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13004         to zero when writing undefined symbols.
13005
13006 2008-07-22  Ian Lance Taylor  <iant@google.com>
13007
13008         * output.cc (Output_section::add_input_section): Don't try to
13009         merge empty merge sections.
13010
13011 2008-07-21  Craig Silverstein  <csilvers@google.com>
13012
13013         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13014         Include symbol version in error message.
13015
13016 2008-07-20  Chris Demetriou  <cgd@google.com>
13017
13018         * configure.ac (gold_cv_c_random_seed): New configured variable.
13019         (RANDOM_SEED_CFLAGS): New substituted variable.
13020         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13021         * configure: Rebuild.
13022         * Makefile.in: Likewise.
13023         * testsuite/Makefile.in: Likewise.
13024
13025 2008-07-18  Ian Lance Taylor  <iant@google.com>
13026
13027         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13028         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13029         * testsuite/ver_test_main.cc (main): Call t4.
13030         (t4, t4_2a): Define.
13031         * testsuite/ver_test_2.cc (t4_2): Define.
13032         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13033         * testsuite/ver_test_4.cc (t4_2a): Define.
13034         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13035         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13036
13037 2008-07-17  Ian Lance Taylor  <iant@google.com>
13038
13039         * dynobj.cc (Versions::add_def): If we give an error about a
13040         missing version, go ahead and create the version anyhow.
13041
13042 2008-07-10  Ian Lance Taylor  <iant@google.com>
13043
13044         Handle output sections with more than 0x7fffffff bytes.
13045         * object.h (class Relobj): Change map_to_output_ to
13046         output_sections_, and just keep a section pointer.  Change all
13047         uses.  Move comdat group support to Sized_relobj.
13048         (Relobj::is_section_specially_mapped): Remove.
13049         (Relobj::output_section): Remove poff parameter.  Change all
13050         callers.
13051         (Relobj::output_section_offset): New function.
13052         (Relobj::set_section_offset): Rewrite.
13053         (Relobj::map_to_output): Remove.
13054         (Relobj::output_sections): New function.
13055         (Relobj::do_output_section_offset): New pure virtual function.
13056         (Relobj::do_set_section_offset): Likewise.
13057         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13058         group support from Relobj.  Update declarations.
13059         (Sized_relobj::get_output_section_offset): New function.
13060         (Sized_relobj::do_output_section_offset): New function.
13061         (Sized_relobj::do_set_section_offset): New function.
13062         * object.cc (Relobj::output_section_address): Remove.
13063         (Sized_relobj::Sized_relobj): Initialize new fields.
13064         (Sized_relobj::include_section_group): Cast find_kept_object to
13065         Sized_relobj.
13066         (Sized_relobj::include_linkonce_section): Likewise.
13067         (Sized_relobj::do_layout): Use separate arrays for output section
13068         and output offset.
13069         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13070         output_sections.
13071         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13072         output_sections and section_offsets.
13073         (Sized_relobj::write_local_symbols): Likewise.
13074         (map_to_kept_section): Compute output address directly.
13075         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13076         output_sections and section_offsets.
13077         (Sized_relobj::write_sections): Likewise.
13078         (Sized_relobj::relocate_sections): Likewise.
13079         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13080         * output.h (class Output_reloc): Update declarations.  Change
13081         u2_.relobj to Sized_relobj*.
13082         (class Output_data_reloc): Change add functions to use
13083         Sized_relobj*.
13084         * output.cc (Output_reloc::Output_reloc): Change relobj to
13085         Sized_relobj*.
13086         (Output_reloc::local_section_offset): Change return type to
13087         Elf_Addr.  Use get_output_section_offset.
13088         (Output_reloc::get_address): Likewise.
13089         (Output_section::is_input_address_mapped): Don't call
13090         is_section_specially_mapped.
13091         (Output_section::output_offset): Likewise.
13092         (Output_section::output_address): Likewise.
13093         (Output_section::starting_output_address): Likewise.
13094         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13095         parameter to Sized_relobj*.
13096         (Copy_relocs::need_copy_reloc): Likewise.
13097         (Copy_relocs::save): Likewise.
13098         * copy-relocs.h (class Copy_relocs): Update declarations.
13099         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13100         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13101         * target-reloc.h (relocate_for_relocatable): Change
13102         offset_in_output_section type to Elf_Addr.  Change code that uses
13103         it as well.
13104         * layout.cc (Layout::layout): Always set *off.
13105         * mapfile.cc (Mapfile::print_input_section): Use
13106         output_section_offset.
13107         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13108         Sized_relobj*.
13109         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13110         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13111         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13112
13113 2008-07-03  Ian Lance Taylor  <iant@google.com>
13114
13115         * layout.cc (Layout::include_section): Do not discard unrecognized
13116         SHT_STRTAB sections.
13117
13118 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13119
13120         * script.cc (Lex::can_continue_name): Make '?' allowable in
13121         version-script names.
13122         * testsuite/version_script.map: Change glob pattern to use '?'
13123
13124 2008-06-30  Manish Singh  <yosh@gimp.org>
13125
13126         PR 6585
13127         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13128         Correct typo.
13129
13130 2008-06-30  Ian Lance Taylor  <iant@google.com>
13131
13132         PR 6660
13133         PR 6682
13134         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13135         versions]: Don't try to read the value in the contents, since we
13136         don't use it.  Use the template endianness when writing.
13137
13138 2008-06-25  Cary Coutant  <ccoutant@google.com>
13139
13140         * fileread.cc (File_read::make_view): Assert on zero-length view.
13141         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13142         symbol table when there are no symbols to read.
13143
13144 2008-06-23  Craig Silverstein  <csilvers@google.com>
13145
13146         * version.cc (version_string): Bump to 1.7
13147
13148 2008-06-18  Craig Silverstein  <csilvers@google.com>
13149
13150         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13151         constant 0xFFFF to type Valtype.
13152         (Powerpc_relocate_functions::rel16_ha): Likewise.
13153
13154 2008-06-17  Ian Lance Taylor  <iant@google.com>
13155
13156         * output.h (Output_section::Input_section): Initialize p2align_ to
13157         zero for Output_section_data constructors.
13158         (Output_section::Input_section::addralign): If not an input
13159         section, return the alignment of the Output_section_data.
13160         * testsuite/copy_test.cc: New file.
13161         * testsuite/copy_test_1.cc: New file.
13162         * testsuite/copy_test_2.cc: New file.
13163         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13164         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13165         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13166         (copy_test_1_pic.o, copy_test_1.so): New targets.
13167         (copy_test_2_pic.o, copy_test_2.so): New targets.
13168         * testsuite/Makefile.in: Rebuild.
13169
13170         * script-sections.cc (Script_sections::place_orphan): Initialize
13171         local variable exact.
13172
13173 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13174
13175         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13176
13177 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13178             David S. Miller  <davem@davemloft.net>
13179
13180         * powerpc.cc: New file.
13181         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13182         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13183         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13184         * Makefile.in: Rebuild.
13185
13186 2008-06-09  Ian Lance Taylor  <iant@google.com>
13187
13188         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13189         <exception>.
13190         (throwing, orig_terminate): New static variables.
13191         (terminate_handler): New static function.
13192         (t2): Set terminate handler.
13193
13194 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13195
13196         PR 6584
13197         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13198         alignment.
13199
13200 2008-05-30  Cary Coutant  <ccoutant@google.com>
13201
13202         * archive.cc (Archive::include_all_members) Correct to step
13203         over symbol table and extended name table in thin archives.
13204
13205 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13206
13207         PR 6407
13208         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13209         calculation.
13210
13211 2008-05-28  Caleb Howe  <cshowe@google.com>
13212
13213         * reduced_debug_output.cc: New file.
13214         * reduced_debug_output.h: New file.
13215         * options.h (class General_options): Add --strip-debug-non-line.
13216         * options.cc (General_options::finalize): Add strip_debug_non_line
13217         to the strip heirarchy.
13218         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13219         fields.
13220         * layout.cc: Include "reduced_debug_output.h".
13221         (Layout::Layout): Initialize new fields.
13222         (line_only_debug_sections): New static array.
13223         (is_lines_only_debug_sections): New static inline function.
13224         (Layout::include_section): Handle --strip-debug-non-line.
13225         (Layout::make_output_section): If --strip-debug-non-line, build
13226         new output sections for .debug_abbrev and .debug_info.
13227         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13228         gold.  Warn about possible overflow.
13229         (read_signed_LEB_128): Likewise.
13230         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13231         (read_signed_LEB_128): Declare.
13232         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13233         (HFILES): Add reduced_debug_output.h.
13234         * Makefile.in: Rebuild.
13235
13236 2008-05-21  Ian Lance Taylor  <iant@google.com>
13237
13238         * mapfile.cc: New file.
13239         * mapfile.h: New file.
13240         * options.h (class General_options): Add -M/--print-map and -Map.
13241         * options.cc (General_options::finalize): Make -M equivalent to
13242         -Map -.
13243         * main.cc: Include <cstdio> and "mapfile.h".
13244         (main): Open mapfile if requested.
13245         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13246         constructor.  Change caller.
13247         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13248         (queue_middle_tasks): Likewise.
13249         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13250         declarations.
13251         * archive.cc: Include "mapfile.h".
13252         (Archive::add_symbols): Add mapfile parameter.  Change all
13253         callers.  Pass mapfile, symbol, and reason to include_member.
13254         (Archive::include_all_members): Add mapfile parameter.  Change all
13255         callers.
13256         (Archive::include_member): Add mapfile, sym, and why parameters.
13257         Change all callers.  Report inclusion to map file.
13258         * archive.h: Include "fileread.h".
13259         (class Archive): Update declarations.
13260         (Archive::file): New const method.
13261         (class Add_archive_symbols): Add mapfile_ field.  Update
13262         constructor.  Change all callers.
13263         * readsyms.h (class Read_symbols): Likewise.
13264         (class Finish_group): Likewise.
13265         (class Read_script): Likewise.
13266         * common.cc: Include "mapfile.h".
13267         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13268         all callers.
13269         (Symbol_table::do_allocate_commons): Likewise.
13270         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13271         symbol allocation to mapfile.
13272         * common.h (class Allocate_commons_task): Add mapfile_ field.
13273         Update constructor.  Change all callers.
13274         * symtab.h (class Symbol_table): Update declarations.
13275         * layout.cc: Include "mapfile.h".
13276         (Layout_task_runner::run): Print information to mapfile.
13277         (Layout::create_gold_note): Change Output_data_fixed_space to
13278         Output_data_zero_fill.
13279         (Layout::create_build_id): Likewise.
13280         (Layout::print_to_mapfile): New function.
13281         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13282         constructor.  Change caller.
13283         (class Layout): Declare print_to_mapfile.
13284         * output.cc (Output_section::Input_section::print_to_mapfile): New
13285         function.
13286         (Output_section::add_input_section): If producing a map, always
13287         add to input_sections_ list.
13288         (Output_section::do_print_to_mapfile): New function.
13289         (Output_segment::print_sections_to_mapfile): New function.
13290         (Output_segment::print_section_list_to_mapfile): New function.
13291         * output.h: Include "mapfile.h".
13292         (Output_data::print_to_mapfile): New function.
13293         (Output_data::do_print_to_mapfile): New virtual function.
13294         (Output_segment_headers::do_print_to_mapfile): New function.
13295         (Output_file_header::do_print_to_mapfile): New function.
13296         (Output_data_const::do_print_to_mapfile): New function.
13297         (class Output_data_const_buffer): Add map_name_ field.  Update
13298         constructor.  Change all callers.  Add do_print_to_mapfile
13299         function.
13300         (class Output_data_fixed_space): Likewise.
13301         (class Output_data_space): Likewise.
13302         (class Output_data_zero_fill): New class.
13303         (Output_data_strtab::do_print_to_mapfile): New function.
13304         (Output_data_reloc_base::do_print_to_mapfile): New function.
13305         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13306         (Output_data_group::do_print_to_mapfile): New function.
13307         (Output_data_got::do_print_to_mapfile): New function.
13308         (Output_data_dynamic::do_print_to_mapfile): New function.
13309         (Output_symtab_xindex::do_print_to_mapfile): New function.
13310         (class Output_section): Declare do_print_to_mapflie.  Declare
13311         print_to_mapfile in Input_section.
13312         (class Output_segment): Declare new functions.
13313         * object.h (Sized_relobj::symbol_count): New function.
13314         * script-sections.cc
13315         (Output_section_element_dot_assignment::set_section_addresses):
13316         Change Output_data_fixed_space to Output_data_zero_fill.
13317         (Output_data_expression::do_print_to_mapfile): New function.
13318         * script.cc (read_input_script): Add mapfile parameter.  Change
13319         all callers.
13320         * script.h (read_input_script): Update declaration.
13321         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13322         (Eh_frame::do_print_to_mapfile): New function.
13323         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13324         (Output_merge_string::do_print_to_mapfile): New function.
13325         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13326         function.
13327         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13328         function.
13329         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13330         function.
13331         * Makefile.am (CCFILES): Add mapfile.cc.
13332         (HFILES): Add mapfile.h.
13333         * Makefile.in: Rebuild.
13334
13335 2008-05-19  Ian Lance Taylor  <iant@google.com>
13336
13337         * options.h (class General_options): Add -z relro.
13338         * layout.cc (Layout::Layout): Initialize relro_segment_.
13339         (Layout::add_output_section_data): Return the output section.
13340         (Layout::make_output_section): Rcognize relro sections and mark
13341         them appropriately.
13342         (Layout::attach_allocated_section_to_segment): Put relro sections
13343         in a PT_GNU_RELRO segment.
13344         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13345         section as relro.
13346         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13347         PT_TLS segments.
13348         (Layout::linkonce_mapping): Map d.rel.ro.local to
13349         .data.rel.ro.local.
13350         (Layout::output_section_name): Us .data.rel.ro.local for any
13351         section which begins with that.
13352         * layout.h (class Layout): Update add_output_section_data
13353         declaration.  Add relro_segment_ field.
13354         * output.cc (Output_section::Output_section): Initialize is_relro_
13355         and is_relro_local_ fields.
13356         (Output_segment::add_output_section): Group relro sections.
13357         (Output_segment::is_first_section_relro): New function.
13358         (Output_segment::maximum_alignment): If there is a relro section,
13359         align the segment to the common page size.
13360         (Output_segment::set_section_addresses): Track whether we are
13361         looking at relro sections.  If the last section is a relro
13362         section, align to the common page size.
13363         (Output_segment::set_section_list_addresses): Add in_relro
13364         parameter.  Change all callers.  Align to the page size when
13365         moving from relro to non-relro section.
13366         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13367         segment.
13368         * output.h (class Output_section): Add is_relro_ and
13369         is_relro_local_ fields.
13370         (Output_section::is_relro): New function.
13371         (Output_section::set_is_relro): New function.
13372         (Output_section::is_relro_local): New function.
13373         (Output_section::set_is_relro_local): New function.
13374         (class Output_segment): Update declarations.
13375         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13376         * sparc.cc (Target_sparc::got_section): Likewise.
13377         * x86_64.cc (Target_x86_64::got_section): Likewise.
13378         * testsuite/relro_test_main.cc: New file.
13379         * testsuite/relro_test.cc: New file.
13380         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13381         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13382         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13383         (relro_test.so, relro_test_pic.o): New targets.
13384         * testsuite/Makefile.in: Rebuild.
13385
13386 2008-05-16  Ian Lance Taylor  <iant@google.com>
13387
13388         * output.cc (Output_segment::add_output_section): Remove front
13389         parameter.
13390         * output.h (class Output_segment): Remove
13391         add_initial_output_section and overloaded add_output_section.
13392         Update declaration of remaining add_output_section.
13393         * layout.cc (Layout::create_interp): Call add_output_section
13394         rather than add_initial_output_section.
13395         (Layout::finish_dynamic_section): Likewise.
13396
13397         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13398         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13399         know the dynamic type.
13400         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13401         field.  Initialize it in constructor.
13402         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13403         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13404         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13405         reloc.
13406
13407         * output.cc (Output_reloc::get_address): Change return type to
13408         Elf_Addr.
13409         * output.h (class Output_reloc): Update get_address declaration.
13410         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13411         for section addresses.
13412
13413 2008-05-09  Ian Lance Taylor  <iant@google.com>
13414
13415         PR 6493
13416         * gold.cc (gold_nomem): Use return value of write.
13417
13418 2008-05-08  Ian Lance Taylor  <iant@google.com>
13419
13420         * symtab.c (Symbol::init_base_output_data): Add version
13421         parameter.  Change all callers.
13422         (Symbol::init_base_output_segment): Likewise.
13423         (Symbol::init_base_constant): Likewise.
13424         (Symbol::init_base_undefined): Likewise.
13425         (Sized_symbol::init_output_data): Likewise.
13426         (Sized_symbol::init_output_segment): Likewise.
13427         (Sized_symbol::init_constant): Likewise.
13428         (Sized_symbol::init_undefined): Likewise.
13429         (Symbol_table::do_define_in_output_data): If the new symbol has a
13430         version, mark it as the default.
13431         (Symbol_table::do_define_in_output_segment): Likewise.
13432         (Symbol_table::do_define_as_constant): Likewise.
13433         * symtab.h (class Symbol): Update declarations.
13434         (class Sized_symbol): Likewise.
13435         * resolve.cc (Symbol::override_version): New function.
13436         (Symbol::override_base): Call override_version.
13437         (Symbol::override_base_with_special): Likewise.
13438         * testsuite/ver_script_8.script: New file.
13439         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13440         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13441         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13442         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13443
13444 2008-05-06  Ian Lance Taylor  <iant@google.com>
13445
13446         PR 6049
13447         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13448         functions.
13449         (class General_options): Remove existing --undefined, and add
13450         --no-undefined instead.  Add new --undefined as synonym for -u.
13451         * archive.cc (Archive::add_symbols): Check whether symbol was
13452         named with -u.
13453         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13454         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13455         all uses.  Add IS_UNDEFINED.  Update declarations to split
13456         different versions of init_base.  Declare init_base_undefined.
13457         (Symbol::is_defined): Handle IS_UNDEFINED.
13458         (Symbol::is_undefined): Likewise.
13459         (Symbol::is_weak_undefined): Call is_undefined.
13460         (Symbol::is_absolute): Handle IS_CONSTANT.
13461         (class Sized_symbol): Update declarations to split different
13462         versions of init.  Declare init_undefined.
13463         (class Symbol_table): Declare new functions.
13464         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13465         Change all callers.
13466         (Symbol::init_base_output_data): Likewise.
13467         (Symbol::init_base_output_segment): Likewise.
13468         (Symbol::init_base_constant): Likewise.
13469         (Symbol::init_base_undefined): New function.
13470         (Sized_symbol::init_object): Rename from init.  Change all
13471         callers.
13472         (Sized_symbol::init_output_data): Likewise.
13473         (Sized_symbol::init_output_segment): Likewise.
13474         (Sized_symbol::init_constant): Likewise.
13475         (Sized_symbol::init_undefined): New function.
13476         (Symbol_table::add_undefined_symbols_from_command_line): New
13477         function.
13478         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13479         function.
13480         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13481         (Symbol::output_section): Likewise.
13482         (Symbol::set_output_section): Likewise.
13483         (Symbol_table::sized_finalize_symbol): Likewise.
13484         (Symbol_table::sized_write_globals): Likewise.
13485         * resolve.cc (Symbol_table::should_override): Likewise.
13486         (Symbol::override_base_with_special): Likewise.
13487
13488         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13489         symbol, change it to have default visibility.
13490         * testsuite/protected_1.cc: New file.
13491         * testsuite/protected_2.cc: New file.
13492         * testsuite/protected_3.cc: New file.
13493         * testsuite/protected_main_1.cc: New file.
13494         * testsuite/protected_main_2.cc: New file.
13495         * testsuite/protected_main_3.cc: New file.
13496         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13497         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13498         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13499         (protected_1.so): New target.
13500         (protected_1_pic.o, protected_2_pic.o): New targets.
13501         (protected_3_pic.o): New target.
13502         (check_PROGRAMS): Add protected_2.
13503         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13504         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13505         * testsuite/Makefile.in: Rebuild.
13506
13507         * options.h (DEFINE_var): Add set_user_set_##varname__.
13508         (DEFINE_bool_alias): New macro.
13509         (class General_options): Define -Bstatic using DEFINE_bool_alias
13510         rather than DEFINE_special.  Add --undefined as an alias for -z
13511         defs.
13512         * options.cc (General_options::parse_Bstatic): Remove.
13513
13514         * options.h (class General_options): Add --fatal-warnings.
13515         * main.cc (main): Implement --fatal-warnings.
13516         * errors.h (Errors::warning_count): New function.
13517
13518         * options.h (class General_options): Add -Bsymbolic-functions.
13519         * symtab.h (Symbol::is_preemptible): Check for
13520         -Bsymbolic-functions.
13521
13522 2008-05-05  Ian Lance Taylor  <iant@google.com>
13523
13524         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13525         as noVARNAME rather than no-VARNAME.
13526         (class General_options): Add option -z combreloc.
13527         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13528         get_address.
13529         (Output_reloc::sort_before) [SHT_REL]: New function.
13530         (Output_reloc::sort_before) [SHT_RELA]: New function.
13531         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13532         Sort_relocs_comparison.
13533         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13534         parameter.  Change all callers.
13535         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13536         sort_relocs parameter.  Change all callers.
13537         * output.cc (Output_reloc::get_address): New function, broken out
13538         of write_rel.
13539         (Output_reloc::write_rel): Call it.
13540         (Output_reloc::compare): New function.
13541         (Output_data_reloc_base::do_write): Optionally sort relocs.
13542
13543         * configure.ac: If targ_extra_obj is set, link it in.
13544         * configure.tgt: Initialize all variables.
13545         (x86_64*): Set targ_extra_obj and targ_extra_size.
13546         * configure: Rebuild.
13547
13548         * object.cc (Sized_relobj::include_section_group): Adjust section
13549         indexes read from group data.  Build vector to pass to
13550         layout_group.
13551         * layout.cc (Layout::layout_group): Add flags and shndxes
13552         parameters.  Remove contents parameter.  Change caller.  Update
13553         explicit instantiations.
13554         * layout.h (class Layout): Update layout_group declaration.
13555         * output.cc (Output_data_group::Output_data_group): Add flags and
13556         input_shndxes parameters.  Remove contents parameter.  Change
13557         caller.
13558         (Output_data_group::do_write): Change input_sections_ to
13559         input_shndxes_.
13560         * output.h (class Output_data_group): Update constructor
13561         declaration.  Rename input_sections_ to input_shndxes_.
13562         * testsuite/many_sections_test.cc: Add template.
13563
13564 2008-04-30  Cary Coutant  <ccoutant@google.com>
13565
13566         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13567
13568         * layout.cc (Layout::include_section): Refactored check for debug
13569         info section.
13570         (Layout::add_comdat): Add new parameters.  Change type
13571         of signature parameter.  Add object and shndx to signatures table.
13572         (Layout::find_kept_object): New function.
13573         * layout.h: Include <cstring>.
13574         (Layout::is_debug_info_section): New function.
13575         (Layout::add_comdat): Add new parameters.
13576         (Layout::find_kept_object): New function.
13577         (Layout::Kept_section): New struct.
13578         (Layout::Signatures): Change type of map range.
13579         * object.cc (Relobj::output_section_address): New function.
13580         (Sized_relobj::include_section_group): Add new parameters.  Change
13581         calls to Layout::add_comdat.  Change to build table of kept comdat
13582         groups and table mapping discarded sections to kept sections.
13583         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13584         (Sized_relobj::do_layout): Change calls to include_section_group and
13585         include_linkonce_section.
13586         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13587         value to zero when section is discarded.
13588         (Sized_relobj::map_to_kept_section): New function.
13589         * object.h (Relobj::output_section_address): New function.
13590         (Relobj::Comdat_group): New type.
13591         (Relobj::find_comdat_group): New function.
13592         (Relobj::Comdat_group_table): New type.
13593         (Relobj::Kept_comdat_section): New type.
13594         (Relobj::Kept_comdat_section_table): New type.
13595         (Relobj::add_comdat_group): New function.
13596         (Relobj::set_kept_comdat_section): New function.
13597         (Relobj::get_kept_comdat_section): New function.
13598         (Relobj::comdat_groups_): New field.
13599         (Relobj::kept_comdat_sections_): New field.
13600         (Symbol_value::input_value): Update comment.
13601         (Sized_relobj::map_to_kept_section) New function.
13602         (Sized_relobj::include_linkonce_section): Add new parameter.
13603         * target-reloc.h (Comdat_behavior): New type.
13604         (get_comdat_behavior): New function.
13605         (relocate_section): Add code to map a discarded section to the
13606         corresponding kept section when applying a relocation.
13607
13608 2008-04-30  Craig Silverstein  <csilvers@google.com>
13609
13610         * dwarf_reader.cc (next_generation_count): New static var.
13611         (Addr2line_cache_entry): New struct.
13612         (addr2line_cache): New static var.
13613         (Dwarf_line_info::one_addr2line): Added caching.
13614         (Dwarf_line_info::clear_addr2line_cache): New function.
13615         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13616         cache-size parameter.
13617         (Dwarf_line_info::one_addr2line_cache): New function.
13618         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13619         new cache-size argument to one_addr2line(), and clear cache.
13620
13621 2008-04-28  Cary Coutant  <ccoutant@google.com>
13622
13623         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13624         R_386_PC8 relocations.
13625
13626 2008-04-23  Ian Lance Taylor  <iant@google.com>
13627
13628         * object.cc (Sized_relobj::include_section_group): Check for
13629         invalid section group.
13630
13631         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13632         header size.
13633
13634         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13635         than read for file header.
13636         * archive.cc (Archive::include_member): Likewise.
13637
13638 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13639
13640         * aclocal.m4: Regenerate.
13641         * configure: Regenerate.
13642
13643 2008-04-19  Ian Lance Taylor  <iant@google.com>
13644
13645         * version.cc (version_string): Bump to 1.6.
13646
13647         * testsuite/Makefile.am (many_sections_r_test): New target.
13648         (many_sections_r_test_SOURCES): Remove.
13649         (many_sections_r_test_DEPENDENCIES): Remove.
13650         (many_sections_r_test_LDFLAGS): Remove.
13651         (many_sections_r_test_LDADD): Remove.
13652
13653         * object.cc (Sized_relobj::do_add_symbols): Always pass
13654         local_symbol_count_ to add_from_relobj.
13655
13656         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13657         every thousand variables.
13658         * testsuite/Makefile.in: Rebuild.
13659
13660         * object.cc (Xindex::initialize_symtab_xindex): New function.
13661         (Xindex::read_symtab_xindex): New function.
13662         (Xindex::sym_xindex_to_shndx): New function.
13663         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13664         available.
13665         (Sized_relobj::do_initialize_xindex): New function.
13666         (Sized_relobj::do_read_symbols): Adjust section links.
13667         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13668         parameter.  Change all callers.
13669         (Sized_relobj::include_section_group): Adjust section links and
13670         symbol section indexes.
13671         (Sized_relobj::do_layout): Adjust section links.
13672         (Sized_relobj::do_count_local_symbols): Adjust section links and
13673         symbol section indexes.
13674         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13675         ordinary and special symbols.
13676         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13677         dynsym_xindex parameters.  Change all callers.  Adjust section
13678         links.  Use SHN_XINDEX when needed.
13679         (Sized_relobj::get_symbol_location_info): Adjust section links.
13680         Don't get fooled by special symbols.
13681         * object.h (class Xindex): Define.
13682         (class Object): Add xindex_ parameter.  Declare virtual functoin
13683         do_initialize_xindex.
13684         (Object::adjust_sym_shndx): New function.
13685         (Object::set_xindex): New protected function.
13686         (class Symbol_value): Add is_ordinary_shndx_ field.
13687         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13688         (Symbol_value::value): Assert ordinary section.
13689         (Symbol_value::initialize_input_to_output_map): Likewise.
13690         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13691         Change all callers.
13692         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13693         all callers.
13694         (class Sized_relobj): Update declarations.
13695         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13696         parameter.  Change all callers.
13697         (Sized_relobj::adjust_shndx): New function.
13698         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13699         field.
13700         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13701         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13702         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13703         (Sized_dynobj::read_dynsym_section): Adjust section links.
13704         (Sized_dynobj::read_dynamic): Likewise.
13705         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13706         section links.
13707         (Sized_dynobj::do_initialize_xindex): New function.
13708         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13709         do_initialize_xindex.
13710         (Sized_dynobj::adjust_shndx): New function.
13711         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13712         dynsym_xindex_ fields.
13713         (Layout::finalize): Add a call to set_section_indexes before
13714         creating the symtab sections.
13715         (Layout::set_section_indexes): Don't do anything if the section
13716         already has a section index.
13717         (Layout::create_symtab_sections): Add shnum parameter.  Change
13718         caller.  Create .symtab_shndx section if needed.
13719         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13720         caller.
13721         (Layout::allocated_output_section_count): New function.
13722         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13723         needed.
13724         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13725         fields.  Update declarations.
13726         (Layout::symtab_xindex): New function.
13727         (Layout::dynsym_xindex): New function.
13728         (class Write_symbols_task): Add layout_ field.
13729         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13730         Change caller.
13731         * output.cc (Output_section_headers::Output_section_headers): Add
13732         shstrtab_section parameter.  Change all callers.
13733         (Output_section_headers::do_sized_write): Store overflow values
13734         for section count and section string table section index in
13735         section header zero.
13736         (Output_file_header::do_sized_write): Check for overflow of
13737         section count and section string table section index.
13738         (Output_symtab_xindex::do_write): New function.
13739         (Output_symtab_xindex::endian_do_write): New function.
13740         * output.h (class Output_section_headers): Add shstrtab_section_.
13741         Update declarations.
13742         (class Output_symtab_xindex): Define.
13743         (Output_section::has_out_shndx): New function.
13744         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13745         field.
13746         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13747         Change all callers.
13748         (Sized_symbol::init): Likewise.
13749         (Symbol::output_section): Check for ordinary symbol.
13750         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13751         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13752         callers.
13753         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13754         Change all callers.  Simplify handling of symbols from sections
13755         not included in the link.
13756         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13757         distinction.
13758         (Weak_alias_sorter::operator()): Assert that symbols are
13759         ordinary.
13760         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13761         distinction.
13762         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13763         parameters.  Change all callers.
13764         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13765         symbol distinction.  Use SHN_XINDEX when needed.
13766         (Symbol_table::write_section_symbol): Add symtab_xindex
13767         parameter.  Change all callers.
13768         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13769         SHN_XINDEX when needed.
13770         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13771         declarations.
13772         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13773         (Symbol::is_defined): Check is_ordinary.
13774         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13775         (Symbol::is_absolute, Symbol::is_common): Likewise.
13776         (class Sized_symbol): Update declarations.
13777         (class Symbol_table): Update declarations.
13778         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13779         parameters.  Change all callers.
13780         (Sized_symbol::override): Likewise.
13781         (Symbol_table::override): Likewise.
13782         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13783         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13784         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13785         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13786         to be in an ordinary section.
13787         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13788         object and is_ordinary parameters.  Change all callers.
13789         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13790         Change all callers.  Don't add undefined or non-ordinary symbols
13791         to reloc_map_.
13792         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13793         Change all callers.
13794         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13795         declarations.
13796         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13797         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13798         (Sized_relobj::relocate_sections): Likewise.
13799         * target-reloc.h (scan_relocs): Adjust section symbol index.
13800         (scan_relocatable_relocs): Likewise.
13801         * i386.cc (Scan::local): Check for ordinary symbols.
13802         * sparc.cc (Scan::local): Likewise.
13803         * x86_64.cc (Scan::local): Likewise.
13804         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13805         to symbol_section_and_value.
13806         * testsuite/many_sections_test.cc: New file.
13807         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13808         (check_PROGRAMS): Add many_sections_test.
13809         (many_sections_test_SOURCES): Define.
13810         (many_sections_test_DEPENDENCIES): Define.
13811         (many_sections_test_LDFLAGS): Define.
13812         (BUILT_SOURCES): Add many_sections_define.h.
13813         (many_sections_define.h): New target.
13814         (BUILT_SOURCES): Add many_sections_check.h.
13815         (many_sections_check.h): New target.
13816         (check_PROGRAMS): Add many_sections_r_test.
13817         (many_sections_r_test_SOURCES): Define.
13818         (many_sections_r_test_DEPENDENCIES): Define.
13819         (many_sections_r_test_LDFLAGS): Define.
13820         (many_sections_r_test_LDADD): Define.
13821         (many_sections_r_test.o): New target.
13822         * testsuite/Makefile.in: Rebuild.
13823
13824 2008-04-17  Cary Coutant  <ccoutant@google.com>
13825
13826         * errors.cc (Errors::info): New function.
13827         (gold_info): New function.
13828         * errors.h (Errors::info): New function.
13829         * gold.h (gold_info): New function.
13830         * object.cc (Input_objects::add_object): Print trace output.
13831         * options.cc (options::parse_set): New function.
13832         (General_options::parse_wrap): Deleted.
13833         (General_options::General_options): Deleted initializer.
13834         * options.h (options::String_set): New typedef.
13835         (options::parse_set): New function.
13836         (DEFINE_set): New macro.
13837         (General_options::wrap): Changed to use DEFINE_set. Changed
13838         callers of any_wrap_symbols and is_wrap_symbol.
13839         (General_options::trace, General_options::trace_symbol):
13840         New options.
13841         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13842         (General_options::wrap_symbols_): Deleted.
13843         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13844
13845 2008-04-17  David S. Miller  <davem@davemloft.net>
13846
13847         * options.cc (General_options::parse_V): New function.
13848         * options.h: Add entries for -V and -Qy.
13849
13850 2008-04-17  Ian Lance Taylor  <iant@google.com>
13851
13852         * common.cc (Symbol_table::allocate_commons): Remove options
13853         parameter.  Change caller.
13854         (Symbol_table::do_allocate_commons): Remove options parameter.
13855         Change caller.  Just call do_allocate_commons_list twice.
13856         (Symbol_table::do_allocate_commons_list): New function, broken out
13857         of do_allocate_commons.
13858         * common.h (class Allocate_commons_task): Remove options_ field.
13859         Update constructor.
13860         * symtab.cc (Symbol_table::Symbol_table): Initialize
13861         tls_commons_.
13862         (Symbol_table::add_from_object): Put TLS common symbols on
13863         tls_commons_ list.
13864         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13865         which are IN_OUTPUT_DATA.
13866         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13867         allocate_commons and do_allocate_commons declarations.  Declare
13868         do_allocate_commons_list.
13869         * gold.cc (queue_middle_tasks): Update creation of
13870         Allocate_commons_task to not pass options.
13871         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13872         (TLS_TEST_C_FLAGS): New variable.
13873         (tls_test_c_pic.o): New target.
13874         (tls_test_shared.so): Link in tls_test_c_pic.o.
13875         (tls_test_c_pic_ie.o): New target.
13876         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13877         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13878         (tls_test_c.o): New target.
13879         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13880         (tls_pic_test_LDADD): Likewise.
13881         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13882         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13883         (tls_test_c_gnu2.o): New target.
13884         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13885         tls_test_c_gnu2.o.
13886         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13887         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13888         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13889         * testsuite/tls_test.cc: Include "config.h".
13890         (t_last): Call t11_last.
13891         * testsuite/tls_test.h (t11, t11_last): Declare.
13892         * testsuite/tls_test_c.c: New file.
13893         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13894         * configure.ac: Check for OpenMP support.
13895         * configure, config.in, Makefile.in: Rebuild.
13896         * testsuite/Makefile.in: Rebuild.
13897
13898 2008-04-16  Cary Coutant  <ccoutant@google.com>
13899
13900         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13901         (Target_i386::tls_base_symbol_defined_): New field.
13902         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13903         (Target_i386::Scan::global): Likewise.
13904         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13905         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13906         (Target_x86_64::tls_base_symbol_defined_): New field.
13907         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13908         (Target_x86_64::Scan::global): Likewise.
13909
13910 2008-04-16  Cary Coutant  <ccoutant@google.com>
13911
13912         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13913         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13914         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13915         building shared libraries.
13916         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13917         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13918         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13919         * testsuite/Makefile.in: Rebuild.
13920         * testsuite/weak_undef.h: New file.
13921         * testsuite/weak_undef_file1.cc: Add extra test cases.
13922         * testsuite/weak_undef_file2.cc: Likewise.
13923         * testsuite/weak_undef_test.cc: Likewise.
13924
13925 2008-04-16  David S. Miller  <davem@davemloft.net>
13926
13927         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13928         Add issued_non_pic_error_ field.  Declare check_non_pic.
13929         (Target_sparc::Scan::check_non_pic): New function.
13930         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13931         (Target_sparc::Scan::global): Likewise.
13932
13933         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13934         * configure: Rebuild.
13935
13936         * options.h (DEFINE_enable): New macro.
13937         (new_dtags): New enable option.
13938         (initfirst, interpose, loadfltr, nodefaultlib,
13939         nodelete, nodlopen, nodump): New -z options.
13940         * layout.cc (Layout:finish_dynamic_section): If new
13941         dtags enabled, emit DT_RUNPATH.  Also, emit a
13942         DT_FLAGS_1 containing any specified -z flags.
13943
13944 2008-04-16  Ian Lance Taylor  <iant@google.com>
13945
13946         * copy-relocs.cc: New file.
13947         * copy-relocs.h: New file.
13948         * reloc.cc: Remove Copy_relocs code.
13949         * reloc.h: Likewise.
13950         * reloc-types.h (struct Reloc_types) [both versions]: Add
13951         get_reloc_addend_noerror.
13952         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13953         variants of add_global which take an addend which must be zero.
13954         * i386.cc: Include "copy-relocs.h".
13955         (class Target_i386): Change type of copy_relocs_ to variable,
13956         update initializer.
13957         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13958         Change all callers.
13959         (Target_i386::do_finalize_sections): Change handling of
13960         copy_relocs_.
13961         * sparc.cc: Include "copy-relocs.h".
13962         (class Target_sparc): Change type of copy_relocs_ to variable,
13963         update initializer.
13964         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13965         Change all callers.
13966         (Target_sparc::do_finalize_sections): Change handling of
13967         copy_relocs_.
13968         * x86_64.cc: Include "copy-relocs.h".
13969         (class Target_x86_64): Change type of copy_relocs_ to variable,
13970         update initializer.
13971         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13972         class.  Change all callers.
13973         (Target_x86_64::do_finalize_sections): Change handling of
13974         copy_relocs_.
13975         * Makefile.am (CCFILES): Add copy-relocs.cc.
13976         (HFILES): Add copy-relocs.h.
13977
13978         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13979
13980         * testsuite/script_test_4.sh: Permit leading zeroes.
13981
13982 2008-04-15  Ian Lance Taylor  <iant@google.com>
13983
13984         * script-sections.cc (Script_sections::create_segments): Use
13985         header_size_adjustment even when there is enough room for the
13986         headers.
13987         * testsuite/script_test_4.sh: New file.
13988         * testsuite/script_test_4.t: New file.
13989         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13990         (check_DATA): Add script_test_4.stdout.
13991         (MOSTLYCLEANFILES): Likewise.
13992         (script_test_4): New target.
13993         (script_test_4.stdout): New target.
13994         * testsuite/Makefile.in: Rebuild.
13995
13996         * sparc.cc: Add definitions for Output_data_plt_sparc class
13997         constants.
13998
13999 2008-04-14  David S. Miller  <davem@davemloft.net>
14000
14001         * sparc.cc: New file.
14002         * Makefile.am (TARGETSOURCES): Add sparc.cc
14003         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14004         * configure.tgt: Document targ_extra_size and
14005         targ_extra_big_endian.  Add entries for sparc-* and
14006         sparc64-*.
14007         * configure.ac: Handle targ_extra_size and
14008         targ_extra_big_endian.
14009         * Makefile.in: Rebuild.
14010         * configure: Likewise.
14011         * po/POTFILES.in: Likewise.
14012         * po/gold.pot: Likewise.
14013
14014 2008-04-14  Ian Lance Taylor  <iant@google.com>
14015
14016         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14017         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14018         in the name/type/flags to section mapping.  Don't call
14019         allocate_output_section.
14020         (Layout::choose_output_section): Change parameter from adjust_name
14021         to is_input_section.  Don't permit input sections after sections
14022         are attached to segments.  Don't call allocate_output_section.
14023         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14024         not write_enable_output_section.
14025         (Layout::make_output_section): Don't push to
14026         unattached_section_list_ nor call attach_to_segment.  Call
14027         attach_section_to_segment if sections are attached.
14028         (Layout::attach_sections_to_segments): New function.
14029         (Layout::attach_section_to_segment): New function.
14030         (Layout::attach_allocated_section_to_segment): Rename from
14031         attach_to_segment.  Remove flags parameter.
14032         (Layout::allocate_output_section): Remove function.
14033         (Layout::write_enable_output_section): Remove function.
14034         * layout.h (class Layout): Update for above changes.  Add new
14035         field sections_are_attached_.
14036         * output.h (Output_section::update_flags_for_input_section): New
14037         function.
14038         * output.cc (Output_section::add_input_section): Call
14039         update_flags_for_input_section.
14040         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14041
14042 2008-04-11  Cary Coutant  <ccoutant@google.com>
14043
14044         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14045         thought unnecessary.
14046         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14047
14048 2008-04-11  Ian Lance Taylor  <iant@google.com>
14049
14050         * output.h (class Output_section_data): Remove inline definition
14051         of set_addralign.
14052         * output.cc (Output_section_data::set_addralign): New function.
14053
14054 2008-04-11  Cary Coutant  <ccoutant@google.com>
14055
14056         Add support for TLS descriptors for i386 and x86_64.
14057         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14058         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14059         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14060         GOT_TYPE_TLS_DESC.
14061         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14062         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14063         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14064         relocations.
14065         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14066         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14067         Fix problem with initial-exec relocations.
14068         (Target_i386::Relocate::relocate_tls): Likewise.
14069         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14070         relaxation.
14071         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14072         support for section-plus-offset dynamic table entries.
14073         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14074         (Output_data_dynamic::Dynamic_entry): Add support for
14075         section-plus-offset dynamic table entries.
14076         (Output_data_dynamic::Classification): Likewise.
14077         (Output_data_dynamic::classification_): Renamed offset_.
14078         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14079         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14080         (Target_x86_64::make_plt_section): New function.
14081         (Target_x86_64::reserve_tlsdesc_entries): New function.
14082         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14083         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14084         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14085         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14086         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14087         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14088         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14089         add extra PLT entry for TLS descriptors.
14090         (Output_data_plt_x86_64::got_): New field.
14091         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14092         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14093         fields.
14094         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14095         descriptors.
14096         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14097         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14098         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14099         R_386_TLS_DESC_CALL relocations.
14100         (Target_x86_64::Scan::global): Likewise.
14101         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14102         for TLS descriptors.
14103         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14104         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14105         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14106         GD-to-IE relaxation.
14107         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14108         and TLS_DESCRIPTORS.
14109         * Makefile.in: Rebuild.
14110         * configure: Rebuild.
14111         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14112         (tls_test_shared2.so): New target.
14113         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14114         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14115         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14116         (tls_shared_gd_to_ie_test_LDADD): New variable.
14117         (tls_shared_gnu2_gd_to_ie_test): New target.
14118         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14119         New targets.
14120         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14121         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14122         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14123         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14124         (tls_shared_gnu2_test): New target.
14125         (tls_test_gnu2_shared.so): New target.
14126         (tls_shared_gnu2_test_SOURCES): New variable.
14127         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14128         (tls_shared_gnu2_test_LDFLAGS): New variable.
14129         (tls_shared_gnu2_test_LDADD): New variable.
14130         * testsuite/Makefile.in: Rebuild.
14131         * testsuite/Makefile.
14132
14133 2008-04-11  Ian Lance Taylor  <iant@google.com>
14134
14135         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14136         justsyms.t.
14137         * testsuite/Makefile.in: Rebuild.
14138
14139         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14140         long.
14141         * testsuite/script_test_2.cc (main): Adjust test.
14142
14143 2008-04-11  David S. Miller  <davem@davemloft.net>
14144             Ian Lance Taylor  <iant@google.com>
14145
14146         * options.h (General_options): Add entries for '-Y' and
14147         '-relax'.
14148         * options.cc (General_options:finalize): If -Y was used, add those
14149         entries to the library path instead of the default "/lib" and
14150         "/usr/lib".
14151
14152 2008-04-11  David S. Miller  <davem@davemloft.net>
14153
14154         * testsuite/justsyms.t: Start at 0x100.
14155         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14156         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14157         long.
14158         * testsuite/script_test_2.cc: Adjust string and section length
14159         checks.
14160
14161 2008-04-09  Ian Lance Taylor  <iant@google.com>
14162
14163         PR gold/5996
14164         * script-sections.cc (Sections_element::allocate_to_segment): Add
14165         orphan parameter.
14166         (Output_section_definition::allocate_to_segment): Likewise.
14167         (Orphan_output_section::allocate_to_segment): Likewise.
14168         (Script_sections::attach_sections_using_phdrs_clause): Don't
14169         propagate non-PT_LOAD segments to orphan sections.
14170         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14171         readelf rather than objdump.
14172         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14173         .interp section and PT_INTERP segment are the same size.
14174         * testsuite/Makefile.in: Rebuild.
14175
14176         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14177         aliases for symbols defined in the same object.
14178         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14179         (weak_alias_test_SOURCES): New variable.
14180         (weak_alias_test_DEPENDENCIES): New variable.
14181         (weak_alias_test_LDFLAGS): New variable.
14182         (weak_alias_test_LDADD): New variable.
14183         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14184         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14185         (weak_alias_test_3.o): New target.
14186         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14187         * testsuite/weak_alias_test_main.cc: New file.
14188         * testsuite/weak_alias_test_1.cc: New file.
14189         * testsuite/weak_alias_test_2.cc: New file.
14190         * testsuite/weak_alias_test_3.cc: New file.
14191
14192 2008-04-08  Ian Lance Taylor  <iant@google.com>
14193
14194         * options.h (class General_options): Add --noinhibit-exec option.
14195         * main.cc (main): Check --noinhibit-exec.
14196
14197         * options.h (class General_options): Define --wrap as a special
14198         option.  Add wrap_symbols_ field.
14199         (General_options::any_wrap_symbols): New function.
14200         (General_options::is_wrap_symbol): New function.
14201         * options.cc (General_options::parse_wrap): New function.
14202         (General_options::General_options): Initialize wrap_symbols_.
14203         * symtab.cc (Symbol_table::wrap_symbol): New function.
14204         (Symbol_table::add_from_object): Handle --wrap.
14205         * symtab.h (class Symbol_table): Declare wrap_symbol.
14206         * target.h (Target::wrap_char): New function.
14207         (Target::Target_info): Add wrap_char field.
14208         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14209         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14210         * testsuite/testfile.cc (Target_test::test_target_info):
14211         Likewise.
14212
14213         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14214         there is one.
14215
14216         * layout.h (class Layout): Add added_eh_frame_data_ field.
14217         * layout.cc (Layout::Layout): Initialize new field.
14218         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14219         output section until we find a section we merged successfully.
14220         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14221         that the size be non-zero.
14222
14223         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14224         qualifier.
14225
14226 2008-04-08  Craig Silverstein  <csilvers@google.com>
14227
14228         * configure.ac: Export new conditional variable HAVE_ZLIB.
14229         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14230         on HAVE_ZLIB.
14231         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14232         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14233
14234 2008-04-07  Ian Lance Taylor  <iant@google.com>
14235
14236         * version.cc (version_string): Set to "1.5".
14237
14238         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14239         Add issued_non_pic_error_ field.  Declare check_non_pic.
14240         (Target_x86_64::Scan::check_non_pic): New function.
14241         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14242         (Target_x86_64::Scan::global): Likewise.
14243
14244         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14245         addend parameter.  Change caller.  Handle merge sections.
14246         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14247         Address to Addend.  Don't add in the result of
14248         local_section_offset, pass down the addend and use the returned
14249         value.
14250         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14251         Update declarations of local_section_offset and symbol_value.
14252         * testsuite/two_file_test_1.cc (t18): New function.
14253         * testsuite/two_file_test_2.cc (f18): New function.
14254         * testsuite/two_file_test_main.cc (main): Call t18.
14255         * testsuite/two_file_test.h (t18, f18): Declare.
14256
14257         * configure.ac: Don't test for objdump, c++filt, or readelf.
14258         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14259         conditionals.
14260         (TEST_READELF): New variable.
14261         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14262         (check_PROGRAMS): Add two_file_strip_test.
14263         (two_file_strip_test): New target.
14264         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14265         (two_file_same_shared_strip_test_SOURCES): New variable.
14266         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14267         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14268         (two_file_same_shared_strip_test_LDADD): New variable.
14269         (two_file_shared_strip.so): New target.
14270         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14271         (ver_test_5.syms, ver_test_7.syms): Likewise.
14272         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14273         (strip_test_3.stdout): Use TEST_OBJDUMP.
14274         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14275
14276 2008-04-04  Cary Coutant  <ccoutant@google.com>
14277
14278         * symtab.h (Symbol::is_weak_undefined): New function.
14279         (Symbol::is_strong_undefined): New function.
14280         (Symbol::is_absolute): New function.
14281         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14282         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14283         absolute symbols.
14284         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14285         (weak_undef_test): New target.
14286         * testsuite/Makefile.in: Rebuild.
14287         * testsuite/weak_undef_file1.cc: New file.
14288         * testsuite/weak_undef_file2.cc: New file.
14289         * testsuite/weak_undef_test.cc: New file.
14290
14291 2008-04-03  Craig Silverstein  <csilvers@google.com>
14292
14293         * compressed_output.h (class Output_compressed_section): Use
14294         unsigned buffer.
14295         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14296         add zlib header.
14297         (zlib_compressed_suffix): Removed.
14298         (Output_compressed_section::set_final_data_size): Use unsigned
14299         buffers.
14300         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14301         Fix linker invocation.
14302         (flagstest_o_specialfile_and_compress_debug_sections):
14303         Likewise.
14304         * testsuite/Makefile.in: Regenerated.
14305
14306 2008-04-02  David S. Miller  <davem@davemloft.net>
14307
14308         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14309         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14310
14311 2008-04-02  Craig Silverstein  <csilvers@google.com>
14312
14313         * TODO: New file.
14314
14315 2008-04-02  Ian Lance Taylor  <iant@google.com>
14316
14317         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14318         parameters.  Update for new key type to views_.  Change all
14319         callers.
14320         (File_read::read): Adjust for byteshift in returned view.
14321         (File_read::add_view): New function, broken out of
14322         find_and_make_view.
14323         (File_read::make_view): New function, broken out of
14324         find_and_make_view.
14325         (File_read::find_or_make_view): Add offset and aligned
14326         parameters.  Rewrite accordingly.  Change all callers.
14327         (File_read::get_view): Add offset and aligned parameters.  Adjust
14328         for byteshift in return value.
14329         (File_read::get_lasting_view): Likewise.
14330         * fileread.h (class File_read): Update declarations.
14331         (class File_read::View): Add byteshift_ field.  Add byteshift to
14332         constructor.  Add byteshift method.
14333         * archive.h (Archive::clear_uncached_views): New function.
14334         (Archive::get_view): Add aligned parameter.  Change all callers.
14335         * object.h (Object::get_view): Add aligned parameter.  Change all
14336         callers.
14337         (Object::get_lasting_view): Likewise.
14338
14339         * fileread.cc (File_read::release): Don't call clear_views if
14340         there are multiple objects.
14341         * fileread.h (File_read::clear_uncached_views): New function.
14342         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14343         on the archive.
14344
14345 2008-03-31  Cary Coutant  <ccoutant@google.com>
14346
14347         Add thin archive support.
14348         * archive.cc (Archive::armagt): New const.
14349         (Archive::setup): Remove task parameter and calls to unlock.
14350         (Archive::unlock_nested_archives): New function.
14351         (Archive::read_header): Add nested_off parameter. Change
14352         all callers.
14353         (Archive::interpret_header): Likewise.
14354         (Archive::include_all_members): Change to handle thin
14355         archives.
14356         (Archive::include_member): Likewise.
14357         * archive.h (Archive::Archive): Add new parameters and
14358         initializers.
14359         (Archive::armagt): New const.
14360         (Archive::setup): Remove task parameter.
14361         (Archive::unlock_nested_archives): New function.
14362         (Archive::read_header): Add nested_off parameter.
14363         (Archive::interpret_header): Likewise.
14364         (Archive::Nested_archive_table): New typedef.
14365         (Archive::is_thin_archive_): New field.
14366         (Archive::nested_archives_): New field.
14367         (Archive::options_): New field.
14368         (Archive::dirpath_): New field.
14369         (Archive::task_): New field.
14370         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14371         for thin archives.  Pass additional parameters to
14372         Archive::Archive.  Unlock the archive file after calling
14373         Archive::setup.
14374
14375 2008-03-29  Ian Lance Taylor  <iant@google.com>
14376
14377         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14378         version symbol to be local.
14379         * testsuite/ver_test_4.sh: New file.
14380         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14381         (check_DATA): Add ver_test_4.syms.
14382         (ver_test_4.syms): New target.
14383         * testsuite/Makefile.in: Rebuild.
14384
14385         * output.cc
14386         (Output_section::Input_section_sort_entry::has_priority): New
14387         function.
14388         (Output_section::Input_section_sort_entry::match_file_name): New
14389         function.
14390         (Output_section::Input_section_sort_entry::match_section_name):
14391         Remove.
14392         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14393         Remove.
14394         (Output_section::Input_section_sort_entry::match_section_file):
14395         Remove.
14396         (Output_section::Input_section_sort_compare::operator()): Rewrite
14397         using new Input_section_sort_entry functions.  Sort crtbegin and
14398         crtend first.  Sort sections with no priority before sections with
14399         a priority.
14400         * testsuite/initpri1.c (d3): Check j != 4.
14401         (cd5): New constructor/destructor function.
14402         (main): Check j != 2.
14403
14404         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14405         new symbol when resolving, don't call set_is_default.
14406         * testsuite/ver_test_7.cc: New file.
14407         * testsuite/ver_test_7.sh: New file.
14408         * testsuite/Makefile.am (ver_test_7.so): New target.
14409         (ver_test_7.o): New target.
14410         (check_SCRIPTS): Add ver_test_7.sh.
14411         (check_DATA): Add ver_test_7.syms.
14412         (ver_test_7.syms): New target.
14413
14414 2008-03-28  Ian Lance Taylor  <iant@google.com>
14415
14416         * layout.cc (Layout::layout): If we see an input section with a
14417         name that needs sorting, set the must_sort flag for the output
14418         section.
14419         (Layout::make_output_section): If the name of the output section
14420         indicates that it might require sorting, set the may_sort flag.
14421         * output.h (Output_section::may_sort_attached_input_sections): New
14422         function.
14423         (Output_section::set_may_sort_attached_input_sections): New
14424         function.
14425         (Output_section::must_sort_attached_input_sections): New
14426         function.
14427         (Output_section::set_must_sort_attached_input_sections): New
14428         function.
14429         (class Output_section): Declare Input_section_sort_entry.  Define
14430         Input_section_sort_compare.  Declare
14431         sort_attached_input_sections.  Add new fields:
14432         may_sort_attached_input_sections_,
14433         must_sort_attached_input_sections_,
14434         attached_input_sections_are_sorted_.
14435         * output.cc (Output_section::Output_section): Initialize new
14436         fields.
14437         (Output_section::add_input_section): Add an entry to
14438         input_sections_ if may_sort or must_sort are true.
14439         (Output_section::set_final_data_size): Call
14440         sort_attached_input_sections if necessary.
14441         (Output_section::Input_section_sort_entry): Define new class.
14442         (Output_section::Input_section_sort_compare::operator()): New
14443         function.
14444         (Output_section::sort_attached_input_sections): New function.
14445         * configure.ac: Check whether the compiler supports constructor
14446         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14447         * testsuite/initpri1.c: New file.
14448         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14449         CONSTRUCTOR_PRIORITY.
14450         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14451         (initpri1_LDFLAGS): New variable.
14452         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14453
14454 2008-03-27  Ian Lance Taylor  <iant@google.com>
14455
14456         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14457         * testsuite/common_test_1.c: New file.
14458         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14459         (common_test_1_SOURCES): New variable.
14460         (common_test_1_DEPENDENCIES): New variable.
14461         (common_test_1_LDFLAGS): New variable.
14462
14463         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14464         and commons_ correctly when NAME/VERSION does not override
14465         NAME/NULL.
14466         * testsuite/ver_test_6.c: New file.
14467         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14468         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14469         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14470
14471 2008-03-26  Ian Lance Taylor  <iant@google.com>
14472
14473         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14474         of an undefined symbol from a version script.
14475         * testsuite/Makefile.am (ver_test_5.so): New target.
14476         (ver_test_5.o): New target.
14477         (check_SCRIPTS): Add ver_test_5.sh.
14478         (check_DATA): Add ver_test_5.syms.
14479         (ver_test_5.syms): New target.
14480         * testsuite/ver_test_5.cc: New file.
14481         * testsuite/ver_test_5.script: New file.
14482         * testsuite/ver_test_5.sh: New file.
14483         * Makefile.in, testsuite/Makefile.in: Rebuild.
14484
14485         PR gold/5986
14486         Fix problems building gold with gcc 4.3.0.
14487         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14488         (gold_error_at_location, gold_warning_at_location): Use it.
14489         * configure.ac: Check whether we can compile and use a template
14490         function with a printf attribute.
14491         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14492         when jumping over bytes.
14493         * object.cc: Instantiate Object::read_section_data.
14494         * debug.h: Include <cstring>
14495         * dwarf_reader.cc: Include <algorithm>
14496         * main.cc: Include <cstring>.
14497         * options.cc: Include <cstring>.
14498         * output.cc: Include <cstring>.
14499         * script.cc: Include <cstring>.
14500         * script.h: Include <string>.
14501         * symtab.cc: Include <cstring> and <algorithm>.
14502         * target-select.cc: Include <cstring>.
14503         * version.cc: Include <string>.
14504         * testsuite/testmain.cc: Include <cstdlib>.
14505         * configure, config.in: Rebuild.
14506
14507 2008-03-25  Ian Lance Taylor  <iant@google.com>
14508
14509         * options.cc: Include "../bfd/bfdver.h".
14510         (options::help): Print bug reporting address.
14511
14512         * version.cc (print_version): Adjust output for current value of
14513         BFD_VERSION_STRING.
14514
14515         * NEWS: New file.
14516
14517         * options.cc (options::help): Print list of supported targets.
14518         * target-select.h: Include <vector>.
14519         (class Target_selector): Make machine_, size_, and is_big_endian_
14520         fields const.  Add bfd_name_ and instantiated_target_ fields.
14521         (Target_selector::Target_selector): Add bfd_name parameter.
14522         (Target_selector::recognize): Make non-virtual, call
14523         do_recognize.
14524         (Target_selector::recognize_by_name): Make non-virtual, call
14525         do_recognize_by_name.
14526         (Target_selector::supported_names): New function.
14527         (Target_selector::bfd_name): New function.
14528         (Target_selector::do_instantiate_target): New pure virtual
14529         function.
14530         (Target_selector::do_recognize): New virtual function.
14531         (Target_selector::do_recognize_by_name): New virtual function.
14532         (Target_selector::instantiate_target): New private function.
14533         (supported_target_names): Declare.
14534         * target-select.cc (Target_selector::Target_selector): Update for
14535         new parameter and fields.
14536         (select_target_by_name): Check that the name matches before
14537         calling recognize_by_name.
14538         (supported_target_names): New function.
14539         * i386.cc (class Target_selector_i386): Update Target_selector
14540         constructor call.  Remove recognize and recognize_by_name.  Add
14541         do_instantiate_target.
14542         * x86_64.cc (class Target_selector_x86_64): Likewise.
14543         * testsuite/testfile.cc (class Target_selector_test): Update for
14544         changes to Target_selector.
14545
14546         * README: Rewrite, with some notes on unsupported features.
14547
14548 2008-03-24  Cary Coutant  <ccoutant@google.com>
14549
14550         * i386.cc (Target_i386::Got_type): New enum declaration.
14551         (Target_i386::Scan::local): Updated callers of Output_data_got
14552         member functions.
14553         (Target_i386::Scan::global): Likewise.
14554         (Target_i386::Relocate::relocate): Likewise.
14555         (Target_i386::Relocate::relocate_tls): Likewise.
14556         * object.h (Got_offset_list): New class.
14557         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14558         (Sized_relobj::local_got_offset): Likewise.
14559         (Sized_relobj::set_local_got_offset): Likewise.
14560         (Sized_relobj::local_has_tls_got_offset): Removed.
14561         (Sized_relobj::local_tls_got_offset): Removed.
14562         (Sized_relobj::set_local_tls_got_offset): Removed.
14563         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14564         * output.cc (Output_data_got::add_global): Added got_type parameter.
14565         (Output_data_got::add_global_with_rel): Likewise.
14566         (Output_data_got::add_global_with_rela): Likewise.
14567         (Output_data_got::add_global_pair_with_rel): New function.
14568         (Output_data_got::add_global_pair_with_rela): New function.
14569         (Output_data_got::add_local): Added got_type parameter.
14570         (Output_data_got::add_local_with_rel): Likewise.
14571         (Output_data_got::add_local_with_rela): Likewise.
14572         (Output_data_got::add_local_pair_with_rel): New function.
14573         (Output_data_got::add_local_pair_with_rela): New function.
14574         (Output_data_got::add_global_tls): Removed.
14575         (Output_data_got::add_global_tls_with_rel): Removed.
14576         (Output_data_got::add_global_tls_with_rela): Removed.
14577         (Output_data_got::add_local_tls): Removed.
14578         (Output_data_got::add_local_tls_with_rel): Removed.
14579         (Output_data_got::add_local_tls_with_rela): Removed.
14580         * output.h (Output_data_got::add_global): Added got_type parameter.
14581         (Output_data_got::add_global_with_rel): Likewise.
14582         (Output_data_got::add_global_with_rela): Likewise.
14583         (Output_data_got::add_global_pair_with_rel): New function.
14584         (Output_data_got::add_global_pair_with_rela): New function.
14585         (Output_data_got::add_local): Added got_type parameter.
14586         (Output_data_got::add_local_with_rel): Likewise.
14587         (Output_data_got::add_local_with_rela): Likewise.
14588         (Output_data_got::add_local_pair_with_rel): New function.
14589         (Output_data_got::add_local_pair_with_rela): New function.
14590         (Output_data_got::add_global_tls): Removed.
14591         (Output_data_got::add_global_tls_with_rel): Removed.
14592         (Output_data_got::add_global_tls_with_rela): Removed.
14593         (Output_data_got::add_local_tls): Removed.
14594         (Output_data_got::add_local_tls_with_rel): Removed.
14595         (Output_data_got::add_local_tls_with_rela): Removed.
14596         * resolve.cc (Symbol::override_base_with_special): Removed
14597         reference to has_got_offset_ field.
14598         * symtab.cc (Symbol::init_fields): Replaced initialization
14599         of got_offset_ with got_offsets_.  Removed initialization
14600         of has_got_offset_
14601         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14602         (Symbol::got_offset): Likewise.
14603         (Symbol::set_got_offset): Likewise.
14604         (Symbol::has_tls_got_offset): Removed.
14605         (Symbol::tls_got_offset): Removed.
14606         (Symbol::set_tls_got_offset): Removed.
14607         (Symbol::got_offset_): Removed.
14608         (Symbol::tls_mod_got_offset_): Removed.
14609         (Symbol::tls_pair_got_offset_): Removed.
14610         (Symbol::got_offsets_): New field.
14611         (Symbol::has_got_offset): Removed.
14612         (Symbol::has_tls_mod_got_offset): Removed.
14613         (Symbol::has_tls_pair_got_offset): Removed.
14614         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14615         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14616         member functions.
14617         (Target_x86_64::Scan::global): Likewise.
14618         (Target_x86_64::Relocate::relocate): Likewise.
14619         (Target_x86_64::Relocate::relocate_tls): Likewise.
14620
14621 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14622
14623         * yyscript.y: Fix spelling error in comment.
14624
14625 2008-03-24  Ian Lance Taylor  <iant@google.com>
14626
14627         * options.h (class General_options): Define build_id option.
14628         * layout.h (class Layout): Declare write_build_id, create_note,
14629         create_build_id.  Add build_id_note_ member.
14630         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14631         "libiberty.h", "md5.h", "sha1.h".
14632         (Layout::Layout): Initialize eh_frame_data_,
14633         eh_frame_hdr_section_, and build_id_note_.
14634         (Layout::finalize): Call create_build_id.
14635         (Layout::create_note): New function, broken out of
14636         Layout::create_gold_note.
14637         (Layout::create_gold_note): Call create_note.
14638         (Layout::create_build_id): New function.
14639         (Layout::write_build_id): New function.
14640         (Close_task_runner::run): Call write_build_id.
14641
14642         * x86_64.cc: Correct license to GPLv3.
14643
14644 2008-03-23  Ian Lance Taylor  <iant@google.com>
14645
14646         * options.cc: Include "demangle.h".
14647         (parse_optional_string): New function.
14648         (parse_long_option): Handle takes_optional_argument.
14649         (parse_short_option): Update dash_z initializer.  Handle
14650         takes_optional_argument.
14651         (General_options::General_options): Initialize do_demangle_.
14652         (General_options::finalize): Set do_demangle_.  Handle demangling
14653         style.
14654         * options.h (parse_optional_string): Declare.
14655         (struct One_option): Add optional_arg field.  Update constructor.
14656         Update call constructor calls.  Add takes_optional_argument
14657         function.
14658         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14659         (DEFINE_optional_string): Define.
14660         (General_options::demangle): Change from DEFINE_bool to
14661         DEFINE_optional_string.
14662         (General_options::no_demangle): New function.
14663         (General_options::do_demangle): New function.
14664         (General_options::set_do_demangle): New function.
14665         (General_options::execstack_status_): Move definition to end of
14666         class definition.
14667         (General_options::static_): Likewise.
14668         (General_options::do_demangle_): New field.
14669         * object.cc (big_endian>::get_symbol_location_info): Call
14670         Options::do_demangle, not Options::demangle.
14671         * symtab.cc (demangle): Likewise.
14672
14673 2008-03-22  Ian Lance Taylor  <iant@google.com>
14674
14675         * gold.h: Include <cstddef> and <sys/types.h>
14676         * options.h: Include <cstring>.
14677
14678 2008-03-21  Ian Lance Taylor  <iant@google.com>
14679
14680         * Added source code to GNU binutils.
14681 \f
14682 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14683
14684 Copying and distribution of this file, with or without modification,
14685 are permitted in any medium without royalty provided the copyright
14686 notice and this notice are preserved.
14687
14688 Local Variables:
14689 mode: change-log
14690 left-margin: 8
14691 fill-column: 74
14692 version-control: never
14693 End: