gold/
[external/binutils.git] / gold / ChangeLog
1 2013-04-15  Cary Coutant  <ccoutant@google.com>
2
3         * script-sections.cc (Orphan_output_section): Reset address
4         to zero after each orphaned section for relocatable links.
5
6 2013-04-15  Cary Coutant  <ccoutant@google.com>
7
8         * symtab.cc (Symbol_table::sized_write_globals): Subtract
9         section starting address for relocatable link.
10         * testsuite/Makefile.am (script_test_11): New test.
11         * testsuite/Makefile.in: Regenerate.
12         * testsuite/script_test_11.c: New source file.
13         * testsuite/script_test_11.t: New linker script.
14
15 2013-04-13  Alan Modra  <amodra@gmail.com>
16
17         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
18         owner when sections are not adjacent and exceed group size.
19         (Target_powerpc::group_sections): Handle corner case.
20         (Target_powerpc::Branch_info::make_stub): Handle case where
21         stub table doesn't exist due to branches in non-exec sections.
22         (Target_powerpc::Relocate::relocate): Likewise.
23
24 2013-04-11  Alan Modra  <amodra@gmail.com>
25
26         PR gold/15354
27         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
28         .branch_lt to match bfd ld.  Adjust comments throughout file.
29
30 2013-04-04  Ian Lance Taylor  <iant@google.com>
31
32         GCC PR c++/56840
33         * object.cc (do_layout_deferred_sections): Handle .eh_frame
34         sections before checking whether they are included in the link.
35
36 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
37
38         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
39         object before calling the plugin claim_file handler.  Pass the elf
40         object of the archive to the plugin. Delete the elf object if the
41         plugin claims the file.
42
43 2013-03-21  Alan Modra  <amodra@gmail.com>
44
45         * layout.cc (Layout::set_segment_offsets): Accept writable .text
46         segment when omagic.
47
48 2013-03-21  Alan Modra  <amodra@gmail.com>
49
50         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
51         comparison warning.
52         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
53         uninitialized" warning.
54
55 2013-03-20  Alan Modra  <amodra@gmail.com>
56
57         * symtab.h (Symbol::clear_version): New function.
58         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
59         is_needed by weak references.  Clear version for symbols defined
60         in as-needed objects that are not needed.
61
62 2013-03-15  Alan Modra  <amodra@gmail.com>
63
64         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
65         static and public.  Add report_err param.  Return false for data refs.
66         (Target_powerpc::rela_dyn_section): New overloaded function.
67         (Target_powerpc::plt_, iplt_): Elucidate.
68         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
69         (Output_data_plt_powerpc::do_write): Don't write .iplt.
70         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
71         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
72         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
73         push_branch and make_plt_entry for ifunc syms when
74         reloc_needs_plt_for_ifunc.
75         (Target_powerpc::Relocate::relocate): Don't use plt entry value
76         for ifunc unless reloc_needs_plt_for_ifunc.
77
78 2013-03-15  Alan Modra  <amodra@gmail.com>
79
80         * gc.h (gc_process_relocs): Don't look through function descriptors.
81         * icf.cc (get_section_contents): Do so here instead.
82
83 2013-03-13  Alan Modra  <amodra@gmail.com>
84
85         * powerpc.cc (is_branch_reloc): Forward declare.
86         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
87         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
88         false for 64-bit, true for 32-bit non-branch relocs.
89         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
90         * testsuite/Makefile.am (icf_test): Use linker map file instead of
91         nm output.
92         (icf_safe_test): Generate linker map file as well as nm output.
93         (icf_safe_so_test): Likewise.
94         * testsuite/Makefile.in: Regenerate.
95         * testsuite/icf_test.sh: Parse linker map file to determine
96         section folding.
97         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
98         * testsuite/icf_safe_so_test.sh: Likewise.
99         (X86_32_or_ARM_specific_safe_fold): Merge into..
100         (arch_specific_safe_fold): ..this.
101         (X86_64_specific_safe_fold): Delete unused function.
102
103 2013-03-12  Alan Modra  <amodra@gmail.com>
104
105         * gc.h (gc_process_relocs): Look through function descriptors
106         to determine shndx, symvalue and addend used by ICF.  Tidy
107         variable duplication.
108
109 2013-03-11  Alan Modra  <amodra@gmail.com>
110
111         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
112         * layout.cc (Layout_task_runner::run): ..to here.
113         * symtab.h (struct Symbol_location): Extract from..
114         (class Symbol_table): ..here.
115         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
116         * target.h (class Target): Add function_location and
117         do_function_location functions.
118         (class Sized_target): Add do_function_location.
119         * object.h (class Sized_relobj_file): Move find_shdr..
120         (class Object): ..to here.
121         * object.cc: Likewise.  Update to suit.  Instantiate.
122         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
123         * powerpc.cc (class Powerpc_dynobj): New.
124         (Target_powerpc::do_function_location): New function.
125         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
126         (Powerpc_dynobj::do_read_symbols): New function.
127         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
128
129 2013-03-08  Ian Lance Taylor  <iant@google.com>
130
131         * options.cc (General_options::string_to_object_format): Accept
132         "default".
133
134 2013-03-08  Alan Modra  <amodra@gmail.com>
135
136         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
137         pointer to Post_fde.
138         (struct Post_fde): Move definition to here..
139         * ehframe.cc (struct Post_fde): ..from here.
140         (Cie::write): Don't alloc Post_fde.
141         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
142
143 2013-03-07  Alan Modra  <amodra@gmail.com>
144
145         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
146         relocation referencing .LC0.
147         * testsuite/discard_locals_test.sh: Remove FIXMEs.
148
149 2013-03-07  Alan Modra  <amodra@gmail.com>
150
151         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
152         always_inline.  Add assembly for powerpc to avoid GOT.
153
154 2013-03-07  Alan Modra  <amodra@gmail.com>
155
156         * testsuite/script_test_10.sh: Don't test .bss section
157         header number.
158
159 2013-03-06  Alan Modra  <amodra@gmail.com>
160
161         * powerpc.cc (class Powerpc_relobj): Move some member functions.
162         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
163         all callers.  Handle folded sections.
164         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
165         to Powerpc_relobj.
166         (Global_symbol_visitor_opd::operator()): Likewise.
167
168 2013-03-04  Alan Modra  <amodra@gmail.com>
169
170         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
171         * testsuite/Makefile.in: Regenerate.
172
173 2013-03-01  Cary Coutant  <ccoutant@google.com>
174
175         Add dwp support for v2 DWARF package file format.
176         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
177         tu_length parameter.  Adjust all callers.
178         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
179         * dwp.cc: Include dwarf.h.
180         (Section_bounds): New struct type.
181         (Unit_set): New struct type.
182         (Dwo_file::Dwo_file): Initialize new data member.
183         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
184         Combine and rename to...
185         (Dwo_file::read_unit_index): ...this.
186         (Dwo_file::sized_read_compunit_index)
187         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
188         (Dwo_file::sized_read_unit_index): ...this.
189         (Dwo_file::copy_section): Remove section_name, is_str_offsets
190         parameters; add section_id parameter.
191         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
192         (Dwo_file::add_unit_set): ...this.
193         (Dwo_file::shndx_map_): Remove.
194         (Dwo_file::sect_offsets_): New data member.
195         (Dwp_output_file::Dwp_output_file): Initialize new data members.
196         (Dwp_output_file::add_section): Rename to...
197         (Dwp_output_file::add_contribution): ...this.
198         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
199         (Dwp_output_file::add_tu_set): Likewise.
200         (Dwp_output_file::Contribution): New type.
201         (Dwp_output_file::Section::contributions): New data member.
202         (Dwp_output_file::Cu_or_tu_set): Remove.
203         (Dwp_output_file::Section::Section): New ctor.
204         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
205         (Dwp_output_file::Dwp_index::Section_table): New type.
206         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
207         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
208         parameter.
209         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
210         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
211         (Dwp_output_file::Dwp_index::section_table): New member function.
212         (Dwp_output_file::Dwp_index::section_table_end): New member function.
213         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
214         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
215         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
216         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
217         (Dwp_output_file::Dwp_index::section_table_): New data member.
218         (Dwp_output_file::Dwp_index::section_mask_): New data member.
219         (Dwp_output_file::add_output_section): New member function.
220         (Dwp_output_file::write_new_section): New member function.
221         (Dwp_output_file::write_contributions): New member function.
222         (Dwp_output_file::section_id_map_): New data member.
223         (class Dwo_id_info_reader): Remove.
224         (class Unit_reader): New class.
225         (get_dwarf_section_name): New function.
226         (Dwo_file::read_executable): Adjust initializations of class data.
227         (Dwo_file::read): Add support for v2 package file format.
228         (Dwo_file::read_unit_index): Likewise.
229         (Dwo_file::sized_read_unit_index): Likewise.
230         (Dwo_file::copy_section): Likewise.
231         (Dwo_file::add_unit_set): Likewise.
232         (Dwp_output_file::add_output_section): Likewise.
233         (Dwp_output_file::add_contribution): Likewise.
234         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
235         for empty slot.
236         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
237         file format.
238         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
239         slot.
240         (Dwp_output_file::initialize): Remove unused function.
241         (Dwp_output_file::finalize): Add support for v2 package file format.
242         (Dwp_output_file::write_index): Likewise.
243         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
244         function prototype.
245
246 2013-03-01  Cary Coutant  <ccoutant@google.com>
247
248         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
249         function into class definition in header file.
250         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
251         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
252         New function.
253         (Dwarf_info_reader::check_buffer): Move here from .cc file.
254
255 2013-02-28  Alan Modra  <amodra@gmail.com>
256
257         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
258         * target.cc (Target::do_plt_fde_location): New function.
259         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
260         accessor function, and constructor param.
261         (struct Post_fde, Post_fdes): Declare.
262         (Cie::write): Add post_fdes param.
263         * ehframe.cc (Fde::write): Use plt_fde_location.
264         (struct Post_fde): Define.
265         (Cie::write): Stash FDEs added post merge mapping.
266         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
267         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
268         (Eh_frame::do_sized_write): Arrange to write post map FDES after
269         other FDEs.
270         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
271         (Target_powerpc::has_glink): New function.
272         (Target_powerpc::do_relax): Add eh_frame info for stubs.
273         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
274         glink_eh_frame_fde_32, default_fde): New data.
275         (Stub_table::eh_frame_added_): New var.
276         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
277         Make const.
278         (Stub_table::add_eh_frame): New function.
279         (Output_data_glink::add_eh_frame): New function.
280         (Target_powerpc::make_glink_section): Call add_eh_frame.
281
282 2013-02-15  Ian Lance Taylor  <iant@google.com>
283
284         * options.h (DEFINE_uint64_alias): Define.
285         (class General_options): Add -Ttext-segment as an alias for
286         -Ttext.
287
288 2013-02-15  Alan Modra  <amodra@gmail.com>
289
290         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
291         (Stub_table::do_write): ..here, two places.
292         (Stub_table::plt_call_size): Use it here too.
293
294 2013-02-11  Ian Lance Taylor  <iant@google.com>
295
296         * descriptors.cc (Descriptors::close_all): New function.
297         * descriptors.h (class Descriptors): Declare close_all.
298         (close_all_descriptors): New inline function.
299         * plugin.cc: Include "descriptors.h".
300         (Plugin_manager::cleanup): Call close_all_descriptors.
301
302 2013-02-06  Alan Modra  <amodra@gmail.com>
303
304         * README: Update coding style link.
305
306 2013-01-28  Cary Coutant  <ccoutant@google.com>
307
308         * dwp.cc (File_list): New typedef.
309         (Dwo_name_info_reader): New class.
310         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
311         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
312         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
313         (Dwo_file::read_executable): New function.
314         (Dwo_file::read): Move common setup code to ...
315         (Dwo_file::make_object): ... here.
316         (dwp_options): Add --exec/-e.
317         (usage): Likewise.
318         (main): Likewise.
319
320 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
321
322         * layout.cc (Layout::layout): Check for option text_reorder.
323         (Layout::make_output_section): Ditto.
324         * options.h (text_reorder): New option.
325         * output.cc (Input_section_sort_compare): Remove special ordering
326         of section names.
327         (Output_section::
328          Input_section_sort_section_name_special_ordering_compare::
329          operator()): New function.
330         (Output_section::sort_attached_input_sections): Use new sort function
331         for .text.
332         * output.h (Input_section_sort_section_name_special_ordering_compare):
333         New struct.
334         * testsuite/Makefile.am (text_section_grouping): Test option
335         --no-text-reorder
336         * testsuite/Makefile.in: Regenerate.
337         * testsuite/text_section_grouping.sh: Check order of functions without
338         default text reordering.
339
340 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
341
342         * options.h (General_options): Change default to true for new_dtags.
343
344 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
345
346         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
347         when enable_new_dtags is false.  Only add DT_RUNPATH when
348         enable_new_dtags is true.
349
350 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
351
352         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
353         used in declaration and definition consistent.
354         (Target_powerpc::symval_for_branch): Ditto.
355
356 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
357
358         * testsuite/plugin_final_layout.cc: Fix comment.
359
360 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
361
362         * layout.cc (Layout::layout): Do not do default sorting for
363         text sections when section ordering is specified.
364         (make_output_section): Ditto.
365         * testsuite/plugin_final_layout.cc: Name the function sections
366         to catch reordering issues.
367
368 2013-01-15  Alan Modra  <amodra@gmail.com>
369
370         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
371         plt-thread-safe.
372
373 2013-01-15  Alan Modra  <amodra@gmail.com>
374
375         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
376         * testsuite/Makefile.in: Regenerate.
377
378 2013-01-14  Alan Modra  <amodra@gmail.com>
379
380         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
381         * testsuite/Makefile.in: Regenerate.
382
383 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
384
385         PR bfd/14430
386         Fix mingw gold build with plugins enabled
387         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
388         * configure.ac: Export DLOPEN_LIBS and add headers check.
389         * plugin.cc: Handle non-dlfcn case.
390         * Makefile.in: Regenerate.
391         * config.in: Regenerate.
392         * configure: Regenerate.
393         * testsuite/Makefile.in: Regenerate.
394
395 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
396
397         * output.h (sort_attached_input_sections): Change to be public.
398         * script-sections.cc
399         (Output_section_definition::set_section_addresses): Sort
400         attached input sections according to section order before linker
401         script assigns section addresses.
402         (Orphan_output_section::set_section_addresses): Sort
403         attached input sections according to section order before linker
404         script assigns section addresses.
405         * Makefile.am (final_layout.sh): Use a simple linker script to
406         check if section ordering still works.
407         * Makefile.in: Regenerate.
408
409 2013-01-09  Ben Cheng  <bccheng@google.com>
410
411         * arm.cc (Target_arm::attributes_accept_div): New function.
412         (Target_arm::attributes_forbid_div): New function.
413         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
414         attribute using the same new functions as what bfd/elf32_arm.c
415         does.
416
417 2013-01-07  Cary Coutant  <ccoutant@google.com>
418
419         PR gold/14993
420         * output.cc (Output_section::add_input_section): For incremental
421         updates, don't track input sections that are allocated from patch
422         space.
423
424 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
425             Ian Lance Taylor  <iant@google.com>
426
427         PR gold/14897
428         * configure.ac (--enable-ld): Removed.
429         (install_as_default): Set to yes only for --enable-gold=default
430         or --disable-ld.
431         * configure: Regenerated.
432
433 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
434
435         * options.h (General_options): Add -fuse-ld= for GCC linker
436         option compatibility.
437
438 2013-01-04  Cary Coutant  <ccoutant@google.com>
439
440         * configure.ac: Fix typo restoring CXXFLAGS.
441         * configure: Regenerate.
442
443 2013-01-04  Cary Coutant  <ccoutant@google.com>
444
445         * testsuite/Makefile.am (CXXLINK_S): New macro.
446         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
447         * testsuite/Makefile.in: Regenerate.
448
449 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
450
451         * version.cc (print_version): Update copyright year to 2013.
452
453 2012-12-20  Ian Lance Taylor  <iant@google.com>
454
455         * layout.cc (Layout::special_ordering_of_input_section): New
456         function.
457         (Layout::layout): If input section requires special ordering, must
458         sort input sections.
459         (Layout::make_output_section): May sort .text input sections.
460         (Layout::is_section_name_prefix_grouped): Remove.
461         * layout.h (class Layout): Declare
462         special_ordering_of_input_section.  Don't declare
463         is_section_name_prefix_grouped.
464         * output.cc (Output_section::add_input_section): Revert last
465         change.
466         (Output_section::Input_section_sort::match_file_name): Don't crash
467         if called on output section data.
468         (Output_section::Input_section_sort_compare): Sort based on
469         special ordering.
470         (Output_section::Input_section_sort_section_order_index_compare):
471         Revert last patch.
472         (Output_section::sort_attached_input_sections): Likewise.
473
474 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
475
476         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
477         * layout.h (Layout::is_section_name_prefix_grouped): New function.
478         * output.cc (Output_section::add_input_section): Check if section
479         name contains special prefix.  Keep input sections to sort such
480         sections.
481         (Output_section::Input_section_sort_section_order_index_compare
482          ::operator()): Group sections according to prefixes.
483         (Output_section::sort_attached_input_sections): Add condition to
484         Input_section_entry constructor call.
485         * testsuite/Makefile.am (text_section_grouping): New test.
486         * testsuite/Makefile.in: Regenerate.
487         * testsuite/text_section_grouping.cc: New file.
488         * testsuite/text_section_grouping.sh: New file.
489
490 2012-12-17  Nick Clifton  <nickc@redhat.com>
491
492         * Makefile.am: Add copyright notice.
493         * NEWS: Likewise.
494         * README: Likewise.
495         * configure.ac: Likewise.
496         * ftruncate.c: Likewise.
497         * Makefile.in: Regenerate.
498
499 2012-12-14  Cary Coutant  <ccoutant@google.com>
500
501         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
502         --no-as-needed flag.
503         (exception_separate_shared_12_test): Likewise.
504         (incremental_copy_test): Likewise.
505         * testsuite/Makefile.in: Regenerate.
506
507 2012-12-14  Cary Coutant  <ccoutant@google.com>
508
509         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
510         (Dwp_output_file::Dwp_index::enter_set): Add assert.
511
512 2012-12-12  Alan Modra  <amodra@gmail.com>
513
514         * powerpc.cc (class Track_tls): New.
515         (class Relocate, class Scan): Inherit Track_tls.
516         (Target_powerpc::Scan::local, global): Track tls optimization
517         and avoid creating plt entry for __tls_get_addr if all uses
518         are optimized away.
519         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
520
521 2012-12-12  Alan Modra  <amodra@gmail.com>
522
523         * options.h (General_options): Add --toc-sort/--no-toc-sort.
524         Replace no_toc_optimize with toc_optimize.
525         * output.h (Output_section::input_sections): Provide non-const variant.
526         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
527         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
528         accessors.
529         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
530         (class Sort_toc_sections): New.
531         (Target_powerpc::do_finalize_sections): Sort toc sections.
532         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
533
534 2012-12-10  Roland McGrath  <mcgrathr@google.com>
535
536         * testsuite/binary_unittest.cc (read_all): New function.
537         (Sized_binary_test): Use it instead of ::read.
538         * fileread.cc (do_read): Don't assume pread always reads the whole
539         amount in a single call.
540
541 2012-12-10  Alan Modra  <amodra@gmail.com>
542
543         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
544         Set EM_PPC64 or EM_PPC here.
545         (Target_selector_powerpc::do_recognize): Delete.
546
547 2012-12-10  Alan Modra  <amodra@gmail.com>
548
549         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
550         stub_table_.
551         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
552
553 2012-12-07  Roland McGrath  <mcgrathr@google.com>
554
555         * testsuite/binary_unittest.cc (Sized_binary_test):
556         Use open_descriptor rather than ::open.
557
558 2012-12-07  Alan Modra  <amodra@gmail.com>
559
560         * powerpc.cc (Stub_table::do_write): Delete redundant Address
561         typedef and invalid_address constant.
562         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
563         instantiate constants.
564
565 2012-12-06  Roland McGrath  <mcgrathr@google.com>
566
567         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
568         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
569         * aclocal.m4: Regenerate.
570         * configure: Regenerate.
571         * Makefile.in: Regenerate.
572         * testsuite/Makefile.in: Regenerate.
573
574 2012-12-07  Alan Modra  <amodra@gmail.com>
575
576         * options.h (General_options): Add no_toc_optimize.
577         * powerpc.cc (ok_lo_toc_insn): New function.
578         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
579
580 2012-12-06  Alan Modra  <amodra@gmail.com>
581
582         * options.h (General_options): Add plt_align, plt_static_chain,
583         plt_thread_safe.  Update stub_group_size help text.
584         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
585         for new plt_thread_safe_ var.
586         (use_plt_offset): Correct comments.
587         (Target_powerpc::do_relax): Look for thread creation symbols to
588         determine default plt_thread_safe value.  Clear plt call stubs
589         as well as branch stubs each iteration.
590         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
591         insn constants.
592         (l, hi, ha, write_insn): Move earlier.
593         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
594         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
595         plt stubs too.
596         (Stub_table::update_size): Adjust.
597         (Stub_table::prev_size, set_prev_size): Delete.
598         (Stub_table::stub_align): Let --plt-align affect result.
599         (Stub_table::plt_call_size): Calculate sizes for various stubs.
600         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
601         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
602         (Stub_table::do_write): Support more stub variants.
603
604 2012-12-04  Alan Modra  <amodra@gmail.com>
605
606         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
607         (Target_powerpc::do_define_standard_symbols): New function.
608
609 2012-12-03  Alan Modra  <amodra@gmail.com>
610
611         * output.h: Formatting, whitespace.
612
613 2012-12-03  Alan Modra  <amodra@gmail.com>
614
615         * layout.h (Layout::get_executable_sections): Declare.
616         * layout.cc (Layout::get_executable_sections): New function.
617         * arm.cc (Target_arm::group_sections): Use it.
618         (Arm_output_section::group_sections): Delete now redundant test.
619         * output.cc (Output_reloc::Output_reloc): Add is_relative.
620         param to handle relative relocs.
621         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
622         (Output_data_reloc::add_absolute): Adjust.
623         (Output_data_reloc::add_relative): New function.
624         (Output_data::reset_data_size): New function.
625         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
626         (Output_section::set_addralign): New function.
627         (Output_section::checkpoint_set_addralign): New function.
628         (Output_section::clear_section_offsets_need_adjustment): New function.
629         (Output_section::input_sections): Make public.
630         * powerpc.cc (class Output_data_brlt_powerpc): New.
631         (class Stub_table, class Stub_control): New.
632         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
633         stub_table_, set_stub_table, stub_table): New vectors and accessor
634         functions.
635         (Target_powerpc::do_may_relax, do_relax, push_branch,
636         new_stub_table, stub_tables, brlt_section, group_sections,
637         add_branch_lookup_table, find_branch_lookup_table,
638         write_branch_lookup_table, make_brlt_section): New functions.
639         (Target_powerpc::struct Sort_sections, class Branch_info): New.
640         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
641         branch_info_): New vars.
642         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
643         make call stubs here.
644         (Output_data_glink): Remove all call stub handling from this class.
645         (Target_powerpc::Scan::local, global): Save interesting branch
646         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
647         (Target_powerpc::do_finalize_sections): Only make reg save/restore
648         functions on final link.
649         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
650         Handle long branch destinations too.
651         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
652         do_plt_address_for_local): Adjust lookup of plt call stubs.
653
654 2012-11-30  Alan Modra  <amodra@gmail.com>
655
656         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
657         relocs against protected symbols when building 32-bit shared libs.
658
659 2012-11-30  Alan Modra  <amodra@gmail.com>
660
661         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
662         param.  Call got_section() to make .got.  Update all callers
663         and their callers and so on.
664
665 2012-11-30  Alan Modra  <amodra@gmail.com>
666
667         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
668         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
669         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
670         value if it already exists.
671
672 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
673
674         PR gold/14858
675         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
676
677 2012-11-14  Roland McGrath  <mcgrathr@google.com>
678
679         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
680         than bfc instruction for data sandboxing.
681
682 2012-11-08  Alan Modra  <amodra@gmail.com>
683
684         * po/POTFILES.in: Regenerate.
685
686 2012-11-05  Alan Modra  <amodra@gmail.com>
687
688         * configure.ac: Apply 2012-09-10 change to config.in here.
689         * configure: Regenerate.
690
691 2012-11-05  Alan Modra  <amodra@gmail.com>
692
693         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
694         (struct Opd_ent): Use "Address" rather than "Offset".
695         (Output_data_got_powerpc::got_base_offset): Return Valtype.
696         (Target_powerpc::got_section): Make public.
697         (Target_powerpc::scan_relocs): Move code setting symbols..
698         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
699         Create _SDA_BASE_ only when referenced.
700
701 2012-11-02  Roland McGrath  <mcgrathr@google.com>
702
703         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
704         from last change.
705
706 2012-11-01  Roland McGrath  <mcgrathr@google.com>
707
708         * target.h (Sized_target::relocate_relocs): Use Elf_Off
709         for offset_in_output_section parameter.
710         (Sized_target::relocate_special_relocatable): Likewise.
711         * arm.cc (Target_arm::relocate_relocs): Likewise.
712         (Target_arm::relocate_special_relocatable): Likewise.
713         * i386.cc (Target_i386::relocate_relocs): Likewise.
714         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
715         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
716         * target-reloc.h (relocate_relocs): Likewise.
717         * testsuite/testfile.cc (Target_test): Likewise.
718         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
719         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
720
721         * system.h: Move inclusion of <clocale> to after <libintl.h> in
722         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
723
724         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
725         parameter, which is unused in the [!F_SETFD] case.
726
727         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
728         SYMNDX to off_t before comparing it to this->data_size().
729         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
730         * incremental.cc (Output_section_incremental_inputs::do_write):
731         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
732
733         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
734
735 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
736
737         * gold.cc (Target_arm::do_adjust_elf_header): Add the
738         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
739         in EABI_VER5.
740
741 2012-10-29  Cary Coutant  <ccoutant@google.com>
742
743         * dwp.cc (usage): Add file and exit status parameters;
744         add --help and --version options.
745         (print_version): New function.
746         (main): Add --help and --version options.
747
748 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
749
750         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
751         final_layout_sequence.txt.
752         * testsuite/Makefile.in: Regenerated.
753
754 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
755
756         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
757         COMPILE generated by automake.
758         (LINK1): Likewise.
759         (CXXCOMPILE1): Likewise.
760         (CXXLINK1): Likewise.
761         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
762         (LINK): Likewise.
763         (CXXCOMPILE): Likewise.
764         (CXXLINK): Likewise.
765         * testsuite/Makefile.in: Regenerated.
766
767 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
768
769         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
770         on bad fwrite return.
771
772 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
773
774         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
775         on val.
776
777 2012-10-23  Cary Coutant  <ccoutant@google.com>
778
779         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
780         * testsuite/Makefile.in: Regenerate.
781         * testsuite/dwp_test.h: New source file.
782         * testsuite/dwp_test_1.cc: New source file.
783         * testsuite/dwp_test_1.s: New source file.
784         * testsuite/dwp_test_1.sh: New source file.
785         * testsuite/dwp_test_1b.cc: New source file.
786         * testsuite/dwp_test_1b.s: New source file.
787         * testsuite/dwp_test_2.cc: New source file.
788         * testsuite/dwp_test_2.s: New source file.
789         * testsuite/dwp_test_2.sh: New source file.
790         * testsuite/dwp_test_main.cc: New source file.
791         * testsuite/dwp_test_main.s: New source file.
792
793 2012-10-23  Cary Coutant  <ccoutant@google.com>
794
795         * dwp.h: New header file.
796         * dwp.cc: New source file.
797         * gold.h: Move shared declarations to system.h.
798         * system.h: New header file.
799         * Makefile.am: Add dwp.
800         * Makefile.in: Regenerate.
801
802 2012-10-23  Cary Coutant  <ccoutant@google.com>
803
804         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
805         Dwarf_info_reader::read_from_pointer.
806         (Dwarf_pubnames_table::read_header): Likewise.
807         (Dwarf_pubnames_table::next_name): Likewise.
808         (Dwarf_die::read_attributes): Likewise.
809         (Dwarf_die::skip_attributes): Likewise.
810         (Dwarf_info_reader::read_from_pointer): New function template.
811         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
812         (Dwarf_pubnames_table): Likewise.
813         (Dwarf_info_reader::read_from_pointer): New function template.
814         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
815         Dwarf_pubnames_table ctor.
816
817 2012-10-23  Cary Coutant  <ccoutant@google.com>
818
819         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
820         abbrev_shndx.
821         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
822         abbrev_shndx_.
823         (Dwarf_info_reader::set_abbrev_shndx): New method.
824         (Dwarf_info_reader::abbrev_shndx_): New data member.
825
826 2012-10-23  Cary Coutant  <ccoutant@google.com>
827
828         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
829         from object, not parameters.
830         (Dwarf_info_reader::parse): Likewise.
831         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
832         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
833         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
834         methods.
835
836 2012-10-23  Cary Coutant  <ccoutant@google.com>
837
838         * fileread.cc (Input_file::Input_file): New constructor.
839         * fileread.h (class Input_file): Add new constructor.
840
841 2012-10-18  Alan Modra  <amodra@gmail.com>
842
843         PR gold/14727
844         * object.cc (Relobj::is_section_name_included): Also match
845         .sdata personality section.
846
847 2012-10-18  Alan Modra  <amodra@gmail.com>
848
849         * target-reloc.h (class Default_comdat_behavior): New, package up..
850         (get_comdat_behaviour): ..this.
851         (relocate_section): Add Relocate_comdat_behavior template arg,
852         adjust code to suit.
853         * arm.cc (Target_arm::relocate_section): Adjust to suit.
854         (Target_arm::scan_reloc_section): Likewise.
855         * i386.cc (Target_i386::relocate_section): Likewise.
856         * sparc.cc (Target_sparc::relocate_section): Likewise.
857         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
858         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
859         * powerpc.cc (class Relocate_comdat_behavior): New.
860         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
861         gold::relocate_section with new template arg.
862
863 2012-10-18  Alan Modra  <amodra@gmail.com>
864
865         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
866         dynamic relocs for GOT_TPREL got entries, without symbol if
867         resolving locally.
868         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
869         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
870         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
871
872 2012-10-17  Alan Modra  <amodra@gmail.com>
873
874         PR gold/14726
875         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
876
877 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
878
879         * layout.cc (Layout::include_section): Keep sections marked
880         SHF_EXCLUDE when doing relocatable links.
881
882 2012-10-16  Alan Modra  <amodra@gmail.com>
883
884         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
885         (Target_powerpc::do_finalize_sections): Call it.
886         (Output_data_save_res): New class and supporting functions.
887         (Target_powerpc::symval_for_branch): Only look up .opd entry for
888         normal symbols defined in object files.
889
890 2012-10-12  Alan Modra  <amodra@gmail.com>
891
892         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
893         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
894         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
895         section if scan_opd_relocs not yet called.
896         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
897
898 2012-10-12  Alan Modra  <amodra@gmail.com>
899
900         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
901         add_local_ifunc_entry): Revert last change.
902         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
903
904 2012-10-05  Alan Modra  <amodra@gmail.com>
905
906         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
907         do_plt_address_for_global): New functions.
908         (Output_data_got_powerpc::do_write): Don't segfault when linking
909         statically.
910         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
911         add_local_ifunc_entry): Return true on adding entry..
912         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
913         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
914         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
915         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
916         set up symbols here.
917         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
918         syms here.  Do so even when no .iplt.  Don't segfault when linking
919         statically.
920         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
921         new variants without reloc param.
922         (Glink_sym_ent::Glink_sym_ent): Likewise.
923         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
924         reloc when refs will resolve to plt call stub.
925         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
926         R_PPC_PLTREL24 to resolve locally.
927         (Target_powerpc::Scan::global): Correct ifunc handling.
928         (Target_powerpc::Relocate::relocate): Correct local sym glink
929         lookup.  Don't destroy "value" when we have a plt call stub,
930         and when checking plt call validity.
931         (Target_powerpc::do_dynsym_value): Simplify.
932
933 2012-10-05  Alan Modra  <amodra@gmail.com>
934
935         * i386.cc (Output_data_plt_i386::address_for_global,
936         address_for_local): Add plt offset to returned value.  Adjust uses.
937         * sparc.cc (Output_data_plt_sparc::address_for_global,
938         address_for_local): Likewise.
939         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
940         address_for_local): Likewise.
941         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
942         address_for_local): Likewise.
943         * target.h (Target::plt_address_for_global, plt_address_for_local):
944         Update comment.
945         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
946         (Output_data_got::Got_entry::write): Nor here.
947         * output.h: Comment fix.
948
949 2012-10-02  Jiong Wang  <jiwang@tilera.com>
950
951         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
952         global_offset_table_ value for larget got.
953         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
954
955 2012-09-29  Alan Modra  <amodra@gmail.com>
956
957         * powerpc.cc (Target_powerpc::iplt_): New output section.
958         (Target_powerpc::iplt_section, make_iplt_section,
959         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
960         (Target_powerpc::make_plt_entry): Handle ifunc syms.
961         Target_powerpc::plt_entry_count): Count iplt entries too.
962         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
963         reloc section in constructor.  New params.
964         (Target_powerpc::make_plt_section): Create reloc section here instead.
965         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
966         functions.
967         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
968         (Output_data_glink::add_entry, find_entry): New functions to
969         deal with local syms.
970         (Glink_sym_ent): Add support for local syms.
971         (Output_data_glink::do_write): Handle ifunc plt entries.
972         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
973         (Target_powerpc::Scan::local, global): Handle ifunc syms.
974         (Target_powerpc::Relocate::relocate): Likewise.
975         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
976
977 2012-09-25  Alan Modra  <amodra@gmail.com>
978
979         * object.h (Sized_relobj_file::adjust_local_symbol,
980         do_adjust_local_symbol): New functions.
981         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
982         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
983         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
984         and irregular opd entry spacing.
985         (Powerpc_relobj::do_read_relocs): Add opd size checks.
986         (Global_symbol_visitor_opd): New functor.
987         (Target_powerpc::do_finalize_sections): Omit global symbols defined
988         on deleted opd entries.
989
990 2012-09-15  Jiong Wang  <jiwang@tilera.com>
991
992         * tilegx.cc: New file.
993         * Makefile.am (TARGETSOURCES): Add tilegx.cc
994         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
995         * configure.tgt: Add entries for tilegx*.
996         * configure.ac: Likewise.
997         * Makefile.in: Rebuild.
998         * configure: Likewise.
999         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1000         tilegx.
1001
1002 2012-09-13  Alan Modra  <amodra@gmail.com>
1003
1004         * target-reloc.h (scan_relocs): Call scan.local for relocs
1005         against symbols in discarded sections.  Pass is_discarded
1006         param.
1007         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1008         Add is_discarded param.
1009         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1010         is_discarded to flag opd entry as discarded.  Don't emit dyn
1011         relocs on such entries.
1012         (Target_powerpc::Scan::global): Similarly detect and handle
1013         such opd entries.
1014         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1015         opd_ent_.  Update all uses.
1016         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1017         (Target_powerpc::relocate_section): Zero out discarded opd
1018         entry relocs.
1019
1020 2012-09-12  Ian Lance Taylor  <iant@google.com>
1021
1022         PR gold/14570
1023         * output.cc: Rename Output_data_got template parameter from size
1024         to got_size for all functions.  Compile all variants of
1025         Output_data_got.
1026         (Output_data_got::Got_entry::write): Correct use of size for
1027         symbol value.  Use local_is_tls rather than casting to
1028         Sized_relobj_file.
1029         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1030         (class Sized_relobj_file): Add do_local_is_tls.
1031         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1032
1033 2012-09-11  Alan Modra  <amodra@gmail.com>
1034
1035         PR gold/14566
1036         * layout.cc (Layout::set_segment_offsets): When using
1037         common-page-size alignment, ensure we are on a new max-page-size
1038         page.
1039         * output.cc (Output_segment::set_section_addresses): Use
1040         abi_pagesize, not common_pagesize for relro boundary.
1041         (Output_segment::set_offset): Likewise.
1042
1043 2012-09-11  Alan Modra  <amodra@gmail.com>
1044
1045         * output.h (Output_data_got::add_global_tls, add_local_tls,
1046         add_local_tls_pair): New functions.
1047         (Output_data_got::add_local_pair_with_rel): Remove second
1048         reloc param.  Expand comment.
1049         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1050         use_plt_or_tls_offset_, similarly for constructor param.
1051         (Output_data_got::Got_entry::write): Add got_index param.
1052         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1053         add_local_tls_pair): New functions.
1054         (Output_data_got::Got_entry::write): Handle tls symbols
1055         with use_plt_or_tls_offset_ set specially.
1056         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1057         (Output_data_got::do_write): Replace iterator with index, pass
1058         index to entry write function.
1059         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1060         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1061         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1062         call.
1063         * i386.cc (Target_i386::Scan::local): Likewise.
1064         * sparc.cc (Target_sparc::Scan::local): Likewise.
1065         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1066         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1067         do_tls_offset_for_global): New functions.
1068         (Target_powerpc::Scan::local): Correct TLS relocations and got
1069         entry values.
1070         (Target_powerpc::Scan::global): Don't emit unnecessary
1071         dynamic relocations on TLS GOT entries.
1072
1073 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1074
1075         * config.in: Disable sanity check for kfreebsd.
1076
1077 2012-09-10  Sterling Augustine  <saugustine@google.com>
1078
1079         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1080         (Gdb_index::pubtypes_read): New parameter.
1081         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1082         to calls.
1083         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1084         pubtypes_object_.
1085
1086 2012-09-09  Alan Modra  <amodra@gmail.com>
1087
1088         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1089         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1090         * gc.h (gc_process_relocs): Call target gc_add_reference.
1091         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1092         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1093         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1094         unnecessary cast.
1095         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1096         to cater for when we don't need code offset.  Update use.
1097         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1098         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1099         set_opd_valid): New functions.
1100         (Target_powerpc::do_gc_add_reference): New function.
1101         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1102         stashed refs.
1103         (Target_powerpc::do_gc_mark_symbol): New function.
1104
1105 2012-09-06  Cary Coutant  <ccoutant@google.com>
1106
1107         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1108         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1109         (Dwarf_die::skip_attributes): Likewise.
1110         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1111         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1112         (main): Call it.
1113         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1114
1115 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1116
1117         * testsuite/script_test_3.t: Add .got.plt output section
1118         statement.
1119         * testsuite/script_test_4.t: Likewise.
1120
1121 2012-09-05  Alan Modra  <amodra@gmail.com>
1122
1123         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1124         update all uses and lose "enum" when using type.
1125
1126 2012-09-05  Alan Modra  <amodra@gmail.com>
1127
1128         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1129         * configure: Regenerate.
1130         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1131         (plugin_final_layout.stdout): Likewise.
1132         (memory_test): Set page sizes to 0x1000.
1133         * testsuite/Makefile.in: Regenerate.
1134         * testsuite/discard_locals_test.sh: Add FIXME comment.
1135         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1136         * testsuite/pr14265.t: Add .got output section statement.
1137         * testsuite/script_test_2.t: Likewise.
1138         * testsuite/script_test_3.t: Likewise.
1139         * testsuite/script_test_4.t: Likewise.
1140         * testsuite/script_test_5.t: Likewise.
1141         * testsuite/script_test_6.t: Likewise.
1142         * testsuite/script_test_7.t: Likewise.
1143         * testsuite/script_test_9.t: Likewise.
1144
1145 2012-09-05  Alan Modra  <amodra@gmail.com>
1146
1147         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1148         (Powerpc_relocate_functions::Status): New typedef.
1149         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1150         (Target_powerpc::Scan::local): Handle REL64.
1151         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1152         for REL32 and REL64.
1153         (Target_powerpc::symval_for_branch): New function, extracted from..
1154         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1155         checks.  Report overflow errors.
1156
1157 2012-09-05  Alan Modra  <amodra@gmail.com>
1158
1159         * object.h (Sized_relobj_file::emit_relocs): Delete.
1160         (Sized_relobj_file::emit_relocs_reltype): Delete.
1161         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1162         relocate_relocs for --emit-relocs.
1163         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1164         * output.h: Update comment.
1165         (Output_segment::first_section): New function.
1166         (Output_segment::first_section_load_address): Use first_section.
1167         * output.cc (Output_segment::first_section): New function extracted..
1168         (Output_segment::first_section_load_address): ..from here.  Delete.
1169         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1170         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1171         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1172         adjust call to target.h function.
1173         * i386.cc (Target_i386): Likewise.
1174         * sparc.cc (Target_sparc): Likewise.
1175         * x86_64.cc (Target_x86_64): Likewise.
1176         * powerpc.cc (Target_powerpc): Likewise.
1177         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1178         first tls section has section symbol for optimised local dynamic
1179         output relocs.
1180         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1181         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1182         optimised tls code.
1183         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1184         Rename to relocate_relocs.  Update error message.
1185
1186 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1187
1188         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1189         --just-symbols.
1190
1191 2012-08-31  Alan Modra  <amodra@gmail.com>
1192
1193         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1194         (Powerpc_relobj::toc_base_offset): New stub function.
1195         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1196         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1197         (Target_powerpc::Relocate::enum skip_tls): New.
1198         (Target_powerpc::call_tls_get_addr_): New var.
1199         (Target_powerpc::is_branch_reloc): Move to file scope.
1200         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1201         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1202         New functions.
1203         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1204         (powerpc_info): Correct common_pagesize for ppc64.
1205         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1206         (Powerpc_relocate_functions): Add overflow check enums and functions.
1207         Add non-shift version of rela, rela_ua.  Delete all rel public
1208         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1209         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1210         addr16_ha3, addr14 functions.
1211         (Output_data_got_powerpc::add_constant_pair): New function.
1212         (Output_data_got_powerpc::got_base_offset): Likewise.
1213         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1214         (instruction constants): Sort, add some more.
1215         (Output_data_glink::do_write): Add and use Address typedef.  Use
1216         object->toc_base_offset() stub for 64-bit.
1217         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1218         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1219         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1220         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1221         Always treat .opd relocs as against locally defined symbol.
1222         Correct condition for RELATIVE relocs.
1223         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1224         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1225         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1226         calculations.  Handle TLS relocs, and more.  Add overflow
1227         checking and adjust for Powerpc_relocate_functions changes.
1228         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1229         Reinstate --emit-relocs code with FIXME.
1230
1231 2012-08-30  Alan Modra  <amodra@gmail.com>
1232
1233         * layout.cc (Layout::set_segment_offsets): Set p_align to
1234         abi_pagesize, not common_pagesize.
1235         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1236         to determine whether file header can go in segment.
1237
1238 2012-08-30  Alan Modra  <amodra@gmail.com>
1239
1240         * output.h (Output_reloc::Output_reloc <output section>): Add
1241         is_relative param.  Adjust calls.
1242         (Output_reloc::add_output_section_relative): New functions.
1243         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1244         is_relative.
1245         (Output_reloc::symbol_value): Handle SECTION_CODE.
1246
1247 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1248
1249         * gold.cc (queue_middle_tasks): Call layout again when unique
1250         segments for sections is desired.
1251         * layout.cc (Layout::Layout): Initialize new members.
1252         (Layout::get_output_section_flags): New function.
1253         (Layout::choose_output_section): Call get_output_section_flags.
1254         (Layout::layout): Make output section for mapping to a unique segment.
1255         (Layout::insert_section_segment_map): New function.
1256         (Layout::attach_allocated_section_to_segment): Make unique segment for
1257         output sections marked so.
1258         (Layout::segment_precedes): Check for unique segments when sorting.
1259         * layout.h (Layout::Unique_segment_info): New struct.
1260         (Layout::Section_segment_map): New typedef.
1261         (Layout::insert_section_segment_map): New function.
1262         (Layout::get_output_section_flags): New function.
1263         (Layout::is_unique_segment_for_sections_specified): New function.
1264         (Layout::set_unique_segment_for_sections_specified): New function.
1265         (Layout::unique_segment_for_sections_specified_): New member.
1266         (Layout::section_segment_map_): New member.
1267         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1268         Rename is_gc_pass_one to is_pass_one.
1269         Rename is_gc_pass_two to is_pass_two.
1270         Rename is_gc_or_icf to is_two_pass.
1271         Check for which pass based on whether symbols data is present.
1272         Make it two pass when unique segments for sections is desired.
1273         * output.cc (Output_section::Output_section): Initialize new
1274         members.
1275         * output.h (Output_section::is_unique_segment): New function.
1276         (Output_section::set_is_unique_segment): New function.
1277         (Output_section::is_unique_segment_): New member.
1278         (Output_section::extra_segment_flags): New function.
1279         (Output_section::set_extra_segment_flags): New function.
1280         (Output_section::extra_segment_flags_): New member.
1281         (Output_section::segment_alignment): New function.
1282         (Output_section::set_segment_alignment): New function.
1283         (Output_section::segment_alignment_): New member.
1284         (Output_segment::Output_segment): Initialize is_unique_segment_.
1285         (Output_segment::is_unique_segment): New function.
1286         (Output_segment::set_is_unique_segment): New function.
1287         (Output_segment::is_unique_segment_): New member.
1288         * plugin.cc (allow_unique_segment_for_sections): New function.
1289         (unique_segment_for_sections): New function.
1290         (Plugin::load): Add new functions to transfer vector.
1291         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1292         * Makefile.in: Regenerate.
1293         * testsuite/plugin_final_layout.sh: Check if unique segment
1294         functionality works.
1295         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1296         are available.
1297         (allow_unique_segment_for_sections): New global.
1298         (unique_segment_for_sections): New global.
1299         (claim_file_hook): Call allow_unique_segment_for_sections.
1300         (all_symbols_read_hook): Call unique_segment_for_sections.
1301
1302 2012-08-22  Cary Coutant  <ccoutant@google.com>
1303
1304         * layout.cc (Layout::include_section): Don't assert on GROUP
1305         sections with --emit-relocs.
1306
1307 2012-08-21  Cary Coutant  <ccoutant@google.com>
1308
1309         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1310         if --export-dynamic-symbol names an undef symbol.
1311
1312 2012-08-18  Alan Modra  <amodra@gmail.com>
1313
1314         * powerpc.cc: Formatting and white space.
1315         (Powerpc_relobj): Rename got2_section_ to special_.
1316         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1317         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1318         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1319         (Target_powerpc): Add Address typedef and invalid_address.  Use
1320         throughout.
1321         (Target_powerpc::is_branch_reloc): New function.
1322         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1323         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1324         for dst_mask, value and addend.
1325         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1326         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1327         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1328         uint16_t for 24-bit offset.  Use get_output_section_offset and
1329         check return.
1330         (Target_powerpc::Scan::local): Handle more relocs.
1331         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1332         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1333         Plug in toc restoring insn after plt calls.  Translate branches
1334         to function descriptor symbols to corresponding entry point.
1335         (Target_powerpc::relocate_for_relocatable): Check return from
1336         get_output_section_offset.
1337         * symtab.h: Comment typo.
1338
1339 2012-08-14  Ian Lance Taylor  <iant@google.com>
1340
1341         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1342         unsupported_relocal_local to call unsupported_reloc_global.
1343
1344 2012-08-14  Nick Clifton  <nickc@redhat.com>
1345
1346         PR ld/14265
1347         * script-sections.cc (Sections_element::output_section_name): Add
1348         keep return parameter.
1349         (Output_section_element::match_name): Add keep return parameter.
1350         Return the value of the keep_ member.
1351         * script-sections.h (class Output_section): Update
1352         output_section_name prototype.
1353         * layout.cc (Layout::keep_input_section): New public member
1354         function.
1355         (Layout::choose_output_section): Pass keep parameter to
1356         output_section_name.
1357         * layout.h (class Layout): Add keep_input_section.
1358         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1359         sections.
1360         * testsuite/Makefile.am: Add a test.
1361         * testsuite/Makefile.in: Regenerate.
1362         * testsuite/pr14265.c: Source file for the test.
1363         * testsuite/pr14265.t: Linker script for the test.
1364         * testsuite/pr14265.sh: Shell script for the test.
1365
1366 2012-08-14  Alan Modra  <amodra@gmail.com>
1367
1368         * target.h (Target::output_section_name): New function.
1369         (Target::do_output_section_name): New function.
1370         * layout.cc (Layout::choose_output_section): Call the above.
1371         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1372
1373 2012-08-14  Alan Modra  <amodra@gmail.com>
1374
1375         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1376         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1377         for replace_constant call.
1378         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1379         (Output_data_glink::do_print_to_mapfile): New function.
1380         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1381         (Target_powerpc::Relocate::relocate): Likewise.
1382
1383 2012-08-14  Alan Modra  <amodra@gmail.com>
1384
1385         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1386         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1387         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1388         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1389         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1390         here.
1391         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1392         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1393         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1394         here.
1395         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1396         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1397
1398 2012-08-12  Alan Modra  <amodra@gmail.com>
1399
1400         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1401         (glink insn constants): Use uint32_t.
1402         (Output_data_glink::add_entry): Use insert, not [] operator.
1403
1404 2012-08-11  Alan Modra  <amodra@gmail.com>
1405
1406         * object.h (Sized_relobj_file::find_shdr): New function.
1407         (Sized_relobj_file::find_special_sections): New function.
1408         * object.cc (Sized_relobj_file::find_shdr): New function.
1409         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1410         (Sized_relobj_file::find_special_sections): New function, split out..
1411         (Sized_relobj_file::do_read_symbols): ..from here.
1412         * output.h (Output_data_got::replace_constant): New function.
1413         (Output_data_got::num_entries): New function.
1414         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1415         (Output_data_got::got_offset): Protected rather than private.
1416         (Output_data_got::replace_got_entry): New function.
1417         * output.cc (Output_data_got::replace_got_entry): New function.
1418         * powerpc.cc (class Powerpc_relobj): New.
1419         (class Powerpc_relocate_functions): Delete all psymval variants or
1420         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1421         Implement _ha functions using corresponding _hi function.
1422         (Powerpc_relobj::find_special_sections): New function.
1423         (Target_powerpc::do_make_elf_object): New function.
1424         (class Output_data_got_powerpc): New.
1425         (class Output_data_glink): New.
1426         (class Powerpc_scan_relocatable_reloc): New.
1427         Many more changes througout file.
1428
1429 2012-08-09  Nick Clifton  <nickc@redhat.com>
1430
1431         * po/vi.po: Updated Vietnamese translation.
1432
1433 2012-08-07  Ian Lance Taylor  <iant@google.com>
1434
1435         * layout.cc (Layout::add_target_dynamic_tags): If
1436         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1437         plt_rel.
1438
1439 2012-07-30  Nick Clifton  <nickc@redhat.com>
1440
1441         * po/gold.pot: Updated template.
1442         * po/es.po: Updated Spanish translation.
1443
1444 2012-07-18  Cary Coutant  <ccoutant@google.com>
1445
1446         PR gold/14344
1447         * configure.ac: Add check for -gpubnames support.
1448         * configure: Regenerate.
1449         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1450         support; force -gno-pubnames.
1451         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1452         support.
1453         (gdb_index_test_4): New test.
1454         * testsuite/Makefile.in: Regenerate.
1455         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1456         * testsuite/gdb_index_test_2.sh: Likewise.
1457         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1458         * testsuite/gdb_index_test_4.sh: New script.
1459         * testsuite/gdb_index_test_comm.sh: New script with common code;
1460         don't look for space after colon.
1461
1462 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1463
1464         * gold.cc (queue_middle_tasks): Update function order only after
1465         deferred objects due to plugins are processed.
1466
1467 2012-07-11  Ian Lance Taylor  <iant@google.com>
1468
1469         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1470         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1471         (Target_arm::scan_reloc_for_stub): Likewise.
1472         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1473         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1474         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1475         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1476         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1477
1478 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1479             Ian Lance Taylor  <iant@google.com>
1480
1481         PR gold/14309
1482         * configure.ac: Test whether std::tr1::hash<off_t> works.
1483         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1484         needed.
1485         * output.h (class Output_fill): Add virtual destructor.
1486         * configure, config.in: Rebuild.
1487
1488 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1489
1490         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1491
1492 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1493
1494         * plugin.cc (Plugin::load): Handle position independent executables.
1495
1496 2012-06-06  Cary Coutant  <ccoutant@google.com>
1497
1498         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1499         add .debug_macro.
1500         (lines_only_debug_sections): Likewise.
1501         (gdb_fast_lookup_sections): New static array.
1502         (is_gdb_debug_section): Rename formal parameter.
1503         (is_lines_only_debug_section): Likewise.
1504         (is_gdb_fast_lookup_section): New function.
1505         (Layout::include_section): Check for ".zdebug_" prefix; pass
1506         section name suffix to is_gdb_debug_section, et al.; check for
1507         fast-lookup sections when building .gdb_index.
1508         * options.h (--strip-debug-gdb): Update GDB version number.
1509
1510 2012-06-06  Cary Coutant  <ccoutant@google.com>
1511
1512         * configure.ac: Add check for fallocate.
1513         * configure: Regenerate.
1514         * config.in: Regenerate.
1515
1516         * options.h (class General_options): Add --mmap-output-file and
1517         --posix-fallocate options.
1518         * output.cc: (posix_fallocate): Remove; replace with...
1519         (gold_fallocate): New function.
1520         (Output_file::map_no_anonymous): Call gold_fallocate.
1521         (Output_file::map): Check --mmap-output-file option.
1522
1523 2012-06-05  Jing Yu  <jingyu@google.com>
1524
1525         * gold.h (textdomain): Add do {} to empty while(0).
1526         (bindtextdomain): Likewise.
1527
1528 2012-06-04  Cary Coutant  <ccoutant@google.com>
1529
1530         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1531         has_dynsym_index.
1532
1533 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1534
1535         * symtab.cc (Symbol_table::define_special_symbol):
1536         Initialize *poldsym to prevent uninitialized variable errors.
1537
1538 2012-05-23  Cary Coutant  <ccoutant@google.com>
1539
1540         * layout.cc (Layout::section_name_mapping): Add rules to handle
1541         exact match on .data.rel.ro.local or .data.rel.ro.
1542         (Layout::output_section_name): Check for exact matches.
1543
1544 2012-05-23  Cary Coutant  <ccoutant@google.com>
1545
1546         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1547         more carefully.
1548
1549 2012-05-22  Cary Coutant  <ccoutant@google.com>
1550
1551         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1552         object before exporting symbol.
1553
1554 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1555
1556         * testsuite/tls_test.cc: Include "config.h" first.
1557         * testsuite/tls_test_c.c: Likewise.
1558
1559 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1560             Nick Clifton  <nickc@redhat.com>
1561
1562         PR 14072
1563         * configure.in: Add check that sysdep.h has been included before
1564         any system header files.
1565         * configure: Regenerate.
1566         * config.in: Regenerate.
1567
1568 2012-05-14  Cary Coutant  <ccoutant@google.com>
1569
1570         * layout.cc (Layout::make_output_section): Mark .tdata section
1571         as RELRO.
1572         * testsuite/relro_test.cc: Add a TLS variable.
1573
1574 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1575
1576         PR gold/14091
1577         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1578         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1579         R_X86_64_64.
1580
1581 2012-05-08  Cary Coutant  <ccoutant@google.com>
1582
1583         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1584         (lines_only_debug_sections): Likewise.
1585
1586 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1587
1588         * nacl.cc: New file.
1589         * nacl.h: New file.
1590         * Makefile.am (CCFILES, HFILES): Add them.
1591         * Makefile.in: Regenerate.
1592         * i386.cc (Output_data_plt_i386_nacl): New class.
1593         (Output_data_plt_i386_nacl_exec): New class.
1594         (Output_data_plt_i386_nacl_dyn): New class.
1595         (Target_i386_nacl): New class.
1596         (Target_selector_i386_nacl): New class.
1597         (target_selector_i386): Use it instead of Target_selector_i386.
1598         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1599         (Target_x86_64_nacl): New class.
1600         (Target_selector_x86_64_nacl): New class.
1601         (target_selector_x86_64, target_selector_x32): Use it instead of
1602         Target_selector_x86_64.
1603         * arm.cc (Output_data_plt_arm_nacl): New class.
1604         (Target_arm_nacl): New class.
1605         (Target_selector_arm_nacl): New class.
1606         (target_selector_arm, target_selector_armbe): Use it instead of
1607         Target_selector_arm.
1608
1609         * target-select.cc (select_target): Take new Input_file* and off_t
1610         arguments, pass them on to recognize method of selector.
1611         * object.cc (make_elf_sized_object): Update caller.
1612         * parameters.cc (parameters_force_valid_target): Likewise.
1613         * incremental.cc (make_sized_incremental_binary): Likewise.
1614         * target-select.h: Update decl.
1615         (Target_selector::recognize): Take new Input_file* argument,
1616         pass it on to do_recognize.
1617         (Target_selector::do_recognize): Take new Input_file* argument.
1618         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1619         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1620         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1621         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1622
1623         * target.h (Target::Target_info): New members isolate_execinstr
1624         and rosegment_gap.
1625         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1626         * arm.cc (Target_arm::arm_info): Update initializer.
1627         * i386.cc (Target_i386::i386_info): Likewise.
1628         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1629         * sparc.cc (Target_sparc::sparc_info): Likewise.
1630         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1631         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1632         * layout.cc (Layout::attach_allocated_section_to_segment):
1633         Take new const Target* argument.  If target->isolate_execinstr(), act
1634         like --rosegment.
1635         (Layout::find_first_load_seg): Take new const Target* argument;
1636         if target->isolate_execinstr(), reject PF_X segments.
1637         (Layout::relaxation_loop_body): Update caller.
1638         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1639         reset file offset to zero when we hit LOAD_SEG, and then do a second
1640         loop over the segments before LOAD_SEG to reassign offsets after
1641         addresses have been determined.  Handle target->rosegment_gap().
1642         (Layout::attach_section_to_segment): Take new const Target* argument;
1643         pass it to attach_allocated_section_to_segment.
1644         (Layout::make_output_section): Update caller.
1645         (Layout::attach_sections_to_segments): Take new const Target* argument;
1646         pass it to attach_section_to_segment.
1647         * gold.cc (queue_middle_tasks): Update caller.
1648         * layout.h (Layout): Update method decls with new arguments.
1649
1650         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1651         Target_info pointer to use.
1652         (Target_arm::do_make_data_plt): New virtual method.
1653         (Target_arm::make_data_plt): New method that calls it.
1654         (Target_arm::make_plt_entry): Use it.
1655         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1656         for the section alignment.
1657         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1658         method.
1659         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1660         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1661         method.
1662         (Output_data_plt_arm::get_plt_entry_size): Call it.
1663         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1664         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1665         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1666         method.
1667         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1668         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1669         method instead of sizeof(plt_entry).
1670         (Output_data_plt_arm::add_entry): Likewise.
1671         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1672         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1673         than static method.
1674         (Target_arm::plt_entry_size): Likewise.
1675         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1676         Move to ...
1677         (Output_data_plt_arm_standard): ... here, new class.
1678         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1679         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1680         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1681
1682         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1683         Take additional argument for the PLT entry size.
1684         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1685         Use get_plt_entry_size method rather than plt_entry_size variable.
1686         (Output_data_plt_x86_64::reserve_slot): Likewise.
1687         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1688         (Output_data_plt_x86_64::add_entry): Likewise.
1689         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1690         (Output_data_plt_x86_64::address_for_global): Likewise.
1691         (Output_data_plt_x86_64::address_for_local): Likewise.
1692         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1693         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1694         Make method non-static.
1695         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1696         method.
1697         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1698         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1699         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1700         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1701         virtual method.
1702         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1703         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1704         virtual method.
1705         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1706         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1707         virtual method.
1708         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1709         (Output_data_plt_x86_64::plt_entry_size)
1710         (Output_data_plt_x86_64::first_plt_entry)
1711         (Output_data_plt_x86_64::plt_entry)
1712         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1713         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1714         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1715         (Output_data_plt_x86_64_standard): ... here, new class.
1716         (Target_x86_64::Target_x86_64): Take optional argument for the
1717         Target_info pointer to use.
1718         (Target_x86_64::do_make_data_plt): New virtual method.
1719         (Target_x86_64::make_data_plt): New method to call it.
1720         (Target_x86_64::init_got_plt_for_update): Use that.
1721         Call this->plt_->add_eh_frame method here.
1722         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1723         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1724         rather than static method.
1725         (Target_x86_64::plt_entry_size): Likewise.
1726         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1727         rather than plt_entry_size variable.  Move guts of PLT filling to...
1728         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1729         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1730         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1731
1732         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1733         additional argument for the section alignment.
1734         Don't do add_eh_frame_for_plt here.
1735         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1736         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1737         variable.
1738         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1739         method.
1740         (Output_data_plt_i386::get_plt_entry_size): Call it.
1741         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1742         (Output_data_plt_i386::add_eh_frame): New method to call it.
1743         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1744         method.
1745         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1746         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1747         method.
1748         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1749         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1750         method instead of plt_entry_size.
1751         (Output_data_plt_i386::plt_entry_size)
1752         (Output_data_plt_i386::plt_eh_frame_fde_size)
1753         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1754         (Output_data_plt_i386_standard): ... here, new class.
1755         (Output_data_plt_i386_exec): New class.
1756         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1757         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1758         (Output_data_plt_i386::exec_plt_entry): Move to ...
1759         (Output_data_plt_i386_exec::plt_entry): ... here.
1760         (Output_data_plt_i386_dyn): New class.
1761         (Output_data_plt_i386::first_plt_entry): Move to ...
1762         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1763         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1764         (Output_data_plt_i386_dyn::plt_entry): ... here.
1765         (Target_i386::Target_i386): Take optional argument for the Target_info
1766         pointer to use.
1767         (Target_i386::do_make_data_plt): New virtual method.
1768         (Target_i386::make_data_plt): New method to call it.
1769         (Target_i386::make_plt_section): Use that.
1770         Call this->plt_->add_eh_frame method here.
1771         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1772         rather than plt_entry_size variable.
1773         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1774         (Output_data_plt_i386::address_for_local): Likewise.
1775         (Output_data_plt_i386::do_write): Likewise.
1776         Move guts of PLT filling to...
1777         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1778         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1779         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1780         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1781
1782 2012-05-01  Cary Coutant  <ccoutant@google.com>
1783
1784         * dwarf_reader.cc (Dwarf_die::read_attributes)
1785         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1786         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1787         * reduced_debug_output.cc
1788         (Output_reduced_debug_info_section::get_die_end): Remove
1789         DW_FORM_GNU_ref_index.  Add default case.
1790
1791 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1792
1793         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1794         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1795         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1796         DW_AT_high_pc as offset from DW_AT_low_pc.
1797
1798         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1799         * testsuite/Makefile.in: Regenerate.
1800         * testsuite/gdb_index_test_3.c: New test source file.
1801         * testsuite/gdb_index_test_3.sh: New test source file.
1802
1803 2012-04-25  Ian Lance Taylor  <iant@google.com>
1804
1805         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1806         pointer.
1807         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1808         as a class, not a struct.
1809         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1810         (Target_arm::apply_cortex_a8_workaround): Likewise.
1811         * gc.h: Declare Reloc_types as a struct, not a class.
1812         * object.h: Declare Symbols_data as a struct.
1813         * reloc.h: Declare Read_relocs_data as a struct.
1814         * target.h: Declare Relocate_info as a struct.
1815
1816 2012-04-24  David S. Miller  <davem@davemloft.net>
1817
1818         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1819         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1820         and R_SPARC_WPLT30.
1821
1822 2012-04-24  Cary Coutant  <ccoutant@google.com>
1823
1824         * incremental-dump.cc (find_input_containing_global): Replace
1825         magic number with symbolic constant.
1826         (dump_incremental_inputs): Update version number.
1827         * incremental.cc (Output_section_incremental_inputs): Update version
1828         number; import symbolic constants from Incremental_inputs_reader.
1829         (Incremental_inputs::create_data_sections): Align relocations
1830         section correctly for 64-bit targets.
1831         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1832         constants; add padding.
1833         (Output_section_incremental_inputs::write_header): Add assert for
1834         header_size.
1835         (Output_section_incremental_inputs::write_input_files): Add assert
1836         for input_entry_size.
1837         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1838         add assert for object_info_size, input_section_entry_size,
1839         global_sym_entry_size.
1840         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1841         for data structure sizes; use them.
1842         (Incremental_input_entry_reader): Import symbolic constants from
1843         Incremental_inputs_reader; use them.
1844
1845 2012-04-23  David S. Miller  <davem@davemloft.net>
1846
1847         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1848         and elf_flags_set_.
1849         (Target_sparc::Target_sparc): Initialize new fields.
1850         (Target_sparc::do_make_elf_object): New function.
1851         (Target_sparc::do_adjust_elf_header): New function.
1852
1853 2012-04-23  Cary Coutant  <ccoutant@google.com>
1854
1855         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1856         CU range table of gdb index.
1857
1858 2012-04-20  David S. Miller  <davem@davemloft.net>
1859
1860         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1861         instead of false.
1862
1863 2012-04-16  David S. Miller  <davem@davemloft.net>
1864
1865         * sparc.cc (Target_sparc::got_address): New function.
1866         (Sparc_relocate_functions::gdop_hix22): New function.
1867         (Sparc_relocate_functions::gdop_lox10): New function.
1868         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1869         relocs.
1870         (Target_sparc::Scan::local): Likewise if the global symbol is not
1871         preemptible and is not IFUNC.
1872         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1873         transformations for local and non-preemptible non-IFUNC global
1874         symbols.
1875
1876         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1877         writing out 64-bit part of ranges.
1878
1879         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1880         -fpic and -fpie respectively.
1881         * Makefile.in: Regenerate.
1882
1883         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1884         (Target_sparc::Target_sparc): Initialize new field.
1885         (Target_sparc::do_plt_section_for_global): New function.
1886         (Target_sparc::do_plt_section_for_local): New function.
1887         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1888         (Target_sparc::make_plt_section): New function, broken out of
1889         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1890         (Target_sparc::make_plt_entry): Call make_plt_section.
1891         (Target_sparc::make_local_ifunc_plt_entry): New function.
1892         (Target_sparc::rela_ifunc_section): New function.
1893         (Target_sparc::plt_section): Remove const.
1894         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1895         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1896         and ifunc_count_ fields.
1897         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1898         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1899         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1900         (Output_data_plt_sparc::rela_ifunc): New function.
1901         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1902         (Output_data_plt_sparc::has_ifunc_section): New function.
1903         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1904         (Output_data_plt_sparc::address_for_global): New function.
1905         (Output_data_plt_sparc::address_for_local): New function.
1906         (Output_data_plt_sparc::plt_index_to_offset): New function.
1907         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1908         and entry_count.
1909         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1910         entry_count.
1911         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1912         R_SPARC_JMP_IREL to switch.
1913         (Target_sparc::Scan::check_non_pic): Likewise.
1914         (Target_sparc::Scan::local): Handle IFUNC symbols.
1915         (Target_sparc::Scan::local): Likewise.
1916         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1917         and plt_address_for_local.
1918         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1919         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1920
1921         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1922         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1923         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1924         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1925         global relocs too.
1926         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1927         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1928         calls.
1929         * sparc.cc (Target_sparc::Scan::global): Likewise.
1930         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1931
1932 2012-04-16  Cary Coutant  <ccoutant@google.com>
1933
1934         * archive.cc (Library_base::should_include_member): Check for
1935         --export-dynamic-symbol.
1936         * options.h (class General_options): Add --export-dynamic-symbol.
1937         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1938         --export-dynamic-symbol.
1939         (Symbol_table::gc_mark_undef_symbols): Likewise.
1940         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1941
1942 2012-04-12  David S. Miller  <davem@davemloft.net>
1943
1944         * sparc.cc (Reloc::wdisp10): New relocation method.
1945         (Reloc::h34): Likewise.
1946         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1947         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1948         R_SPARC_WDISP10.
1949         (Target_sparc::Scan::local): Likewise.
1950         (Target_sparc::Scan::global): Likewise.
1951         (Target_sparc::Relocate::relocate): Likewise.
1952
1953 2012-04-09  Cary Coutant  <ccoutant@google.com>
1954
1955         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1956         low_pc == 0.
1957
1958 2012-04-06  Ian Lance Taylor  <iant@google.com>
1959
1960         * timer.cc: #include <unistd.h>.
1961
1962 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1963
1964         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1965         * config.in: Regenerate.
1966         * configure: Regenerate.
1967
1968 2012-04-05  Nick Clifton  <nickc@redhat.com>
1969
1970         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1971         (AM_LC_MESSAGES): Add.
1972         * aclocal.m4: Regenerate.
1973         * config.in: Regenerate.
1974         * configure: Regenerate.
1975
1976 2012-03-21  Cary Coutant  <ccoutant@google.com>
1977
1978         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1979         * Makefile.in: Regenerate.
1980         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1981         (Sized_elf_reloc_mapper::symbol_section): New function.
1982         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1983         (make_elf_reloc_mapper): New function.
1984         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1985         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1986         (Dwarf_abbrev_table::do_get_abbrev): New function.
1987         (Dwarf_ranges_table::read_ranges_table): New function.
1988         (Dwarf_ranges_table::read_range_list): New function.
1989         (Dwarf_pubnames_table::read_section): New function.
1990         (Dwarf_pubnames_table::read_header): New function.
1991         (Dwarf_pubnames_table::next_name): New function.
1992         (Dwarf_die::Dwarf_die): New function.
1993         (Dwarf_die::read_attributes): New function.
1994         (Dwarf_die::skip_attributes): New function.
1995         (Dwarf_die::set_name): New function.
1996         (Dwarf_die::set_linkage_name): New function.
1997         (Dwarf_die::attribute): New function.
1998         (Dwarf_die::string_attribute): New function.
1999         (Dwarf_die::int_attribute): New function.
2000         (Dwarf_die::uint_attribute): New function.
2001         (Dwarf_die::ref_attribute): New function.
2002         (Dwarf_die::child_offset): New function.
2003         (Dwarf_die::sibling_offset): New function.
2004         (Dwarf_info_reader::check_buffer): New function.
2005         (Dwarf_info_reader::parse): New function.
2006         (Dwarf_info_reader::do_parse): New function.
2007         (Dwarf_info_reader::do_read_string_table): New function.
2008         (Dwarf_info_reader::lookup_reloc): New function.
2009         (Dwarf_info_reader::get_string): New function.
2010         (Dwarf_info_reader::visit_compilation_unit): New function.
2011         (Dwarf_info_reader::visit_type_unit): New function.
2012         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2013         Sized_elf_reloc_mapper.
2014         (Sized_dwarf_line_info::symbol_section): Remove function.
2015         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2016         (Sized_dwarf_line_info::read_line_mappings): Remove object
2017         parameter, adjust callers.
2018         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2019         * dwarf_reader.h: Include <sys/types.h>.
2020         (class Track_relocs): Remove forward declaration.
2021         (class Elf_reloc_mapper): New class.
2022         (class Sized_elf_reloc_mapper): New class.
2023         (class Dwarf_abbrev_table): New class.
2024         (class Dwarf_range_list): New class.
2025         (class Dwarf_ranges_table): New class.
2026         (class Dwarf_pubnames_table): New class.
2027         (class Dwarf_die): New class.
2028         (class Dwarf_info_reader): New class.
2029         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2030         (Sized_dwarf_line_info::symbol_section): Remove member function.
2031         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2032         base class.
2033         * gdb-index.cc: New source file.
2034         * gdb-index.h: New source file.
2035         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2036         and .debug_types sections, call Layout::add_to_gdb_index.
2037         (Sized_relobj_incr::do_section_name): Implement.
2038         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2039         return type; Implement.
2040         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2041         return type.
2042         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2043         parameter list and return type.
2044         (Sized_incr_dynobj::do_section_contents): Likewise.
2045         * layout.cc: Include gdb-index.h.
2046         (Layout::Layout): Initialize gdb_index_data_.
2047         (Layout::init_fixed_output_section): Check for .gdb_index section.
2048         (Layout::add_to_gdb_index): New function. Instantiate.
2049         * layout.h: Add forward declaration for class Gdb_index.
2050         (Layout::add_to_gdb_index): New member function.
2051         (Layout::gdb_index_data_): New data member.
2052         * main.cc: Include gdb-index.h.
2053         (main): Print statistics for gdb index.
2054         * object.cc (Object::section_contents): Move code into
2055         do_section_contents.
2056         (need_decompressed_section): Check for sections needed when building
2057         gdb index.
2058         (build_compressed_section_map): Likewise.
2059         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2060         gdb index.
2061         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2062         sections; call Layout::add_to_gdb_index.
2063         (Sized_relobj_file::do_decompressed_section_contents): Call
2064         do_section_contents directly.
2065         * object.h (Object::do_section_contents): Adjust parameter list and
2066         return type.
2067         (Object::do_decompressed_section_contents): Call do_section_contents
2068         directly.
2069         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2070         return type.
2071         * options.h (class General_options): Add --gdb-index option.
2072         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2073         list and return type.
2074         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2075         * reloc.h (Track_relocs::checkpoint): New function.
2076         (Track_relocs::reset): New function.
2077
2078         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2079         New test cases.
2080         * testsuite/Makefile.in: Regenerate.
2081         * testsuite/gdb_index_test.cc: New test source file.
2082         * testsuite/gdb_index_test_1.sh: New test source file.
2083         * testsuite/gdb_index_test_2.sh: New test source file.
2084
2085 2012-03-19  Doug Kwan  <dougkwan@google.com>
2086
2087         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2088         (Target_arm::do_finalize_sections): Remove code which defines
2089         __exidx_start and __exidx_end.  Make symbol table parameter
2090         anonymous as it is not used.
2091         * gold.cc (queue_middle_tasks): Call target hook to define any
2092         target-specific symbols.
2093         * target.h (Target::define_standard_symbols): New method.
2094         (Target::do_define_standard_symbols): Same.
2095         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2096         * testsuite/Makefile.in: Regenerate.
2097         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2098         and __exidx_end.
2099         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2100         relocations are generated for __exidx_start and __exidx_end.
2101
2102 2012-03-16  Doug Kwan  <dougkwan@google.com>
2103
2104         * testsuite/Makefile.am: Disable test initpri3b.
2105         * testsuite/Makefile.in: Regenerate.
2106
2107 2012-03-15  Doug Kwan  <dougkwan@google.com>
2108
2109         * arm.cc (Target_arm::got_section): Make .got section read-only
2110         if -z now is given.
2111
2112 2012-03-15  Ian Lance Taylor  <iant@google.com>
2113
2114         PR gold/13850
2115         * layout.cc (Layout::make_output_section): Correctly mark
2116         SHT_INIT_ARRAY, et. al., as relro.
2117
2118 2012-03-14  Doug Kwan  <dougkwan@google.com>
2119
2120         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2121         dynamic relocations for protected symbols in shared objects.
2122
2123 2012-03-13  Ian Lance Taylor  <iant@google.com>
2124
2125         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2126         keep the larger alignment.
2127
2128 2012-03-12  Cary Coutant  <ccoutant@google.com>
2129
2130         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2131         handling of DW_LNE_define_file.
2132
2133 2012-03-12  Cary Coutant  <ccoutant@google.com>
2134
2135         * reduced_debug_output.cc
2136         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2137         codes to switch.
2138
2139 2012-02-29  Cary Coutant  <ccoutant@google.com>
2140
2141         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2142
2143 2012-02-29  Cary Coutant  <ccoutant@google.com>
2144
2145         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2146         Call Object::decompressed_section_contents.
2147         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2148         New dtor.
2149         (Sized_dwarf_line_info::buffer_start_): New data member.
2150         * merge.cc (Output_merge_data::do_add_input_section): Call
2151         Object::decompressed_section_contents.
2152         (Output_merge_string::do_add_input_section): Likewise.
2153         * object.cc (need_decompressed_section): New function.
2154         (build_compressed_section_map): Decompress sections needed later.
2155         (Sized_relobj_file::do_decompressed_section_contents): New function.
2156         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2157         * object.h (Object::decompressed_section_contents): New function.
2158         (Object::discard_decompressed_sections): New function.
2159         (Object::do_decompressed_section_contents): New function.
2160         (Object::do_discard_decompressed_sections): New function.
2161         (Compressed_section_info): New type.
2162         (Compressed_section_map): Include decompressed section contents.
2163         (Sized_relobj_file::do_decompressed_section_contents): New function.
2164         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2165
2166 2012-02-16  Cary Coutant  <ccoutant@google.com>
2167
2168         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2169         * testsuite/Makefile.in: Regenerate.
2170
2171 2012-02-14  Cary Coutant  <ccoutant@google.com>
2172
2173         * options.cc (General_options::finalize): Disallow -pie and -static.
2174
2175 2012-02-03  Doug Kwan  <dougkwan@google.com>
2176
2177         * arm.cc (Arm_relocate_functions::abs8,
2178         Arm_relocate_functions::abs16): Use
2179         Bits::has_signed_unsigned_overflow32.
2180         (Arm_relocate_functions::thm_abs8): Correct range of
2181         overflow check.
2182         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2183         in assertions.
2184
2185 2012-02-02  Doug Kwan  <dougkwan@google.com>
2186
2187         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2188         position independent outputs, not just shared objects.
2189
2190 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2191
2192         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2193         * configure: Regenerated.
2194
2195 2012-01-27  Ian Lance Taylor  <iant@google.com>
2196
2197         * reloc.h (Bits): New class with static functions, copied from
2198         namespace utils in arm.cc.
2199         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2200         instead.
2201
2202 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2203
2204         * incremental.cc (write_info_blocks): Correct relocation offset.
2205
2206 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2207
2208         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2209         (Relocate::tls_gd_to_le): Likewise.
2210
2211 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2212
2213         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2214
2215 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2216
2217         * configure.ac: Check if -mcmodel=medium works.
2218         * configure: Regenerated.
2219
2220 2012-01-24  Cary Coutant  <ccoutant@google.com>
2221
2222         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2223         definition and ...
2224         (read_unsigned_LEB_128_x): ... this new function.
2225         (read_signed_LEB_128): Replaced with inline definition and ...
2226         (read_signed_LEB_128_x): ... this new function.
2227         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2228         (read_unsigned_LEB_128): Add inline definition.
2229         (read_signed_LEB_128_x): New function.
2230         (read_signed_LEB_128): Add inline definition.
2231         * testsuite/Makefile.am (leb128_unittest): New unit test.
2232         * testsuite/Makefile.in: Regenerate.
2233         * testsuite/leb128_unittest.cc: New unit test.
2234
2235 2012-01-23  Ian Lance Taylor  <iant@google.com>
2236
2237         PR gold/13617
2238         * i386.cc (Target_i386::do_code_fill): When using a jmp
2239         instruction, pad with nop instructions.
2240         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2241
2242 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2243
2244         * x86_64.cc (gc_process_relocs): Add typename on types used in
2245         template.
2246         (scan_relocs): Likewise.
2247         (relocate_section): Likewise.
2248         (apply_relocation): Likewise.
2249
2250 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2251
2252         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2253         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2254         under x32.
2255
2256 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2257
2258         * x86_64.cc: Initial support for x32.
2259
2260 2012-01-03  Cary Coutant  <ccoutant@google.com>
2261
2262         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2263         Use abstract base class for GOT.
2264         * gold/output.h (class Output_data_got_base): New abstract base class.
2265         (class Output_data_got): Derive from new base class, adjust ctors.
2266         (Output_data_got::reserve_slot): Make virtual; rename to
2267         do_reserve_slot; Adjust callers.
2268         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2269         pointer to abstract base class.
2270         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2271
2272 2011-12-18  Ian Lance Taylor  <iant@google.com>
2273
2274         * object.h (Relobj::local_symbol_value): New function.
2275         (Relobj::local_plt_offset): New function.
2276         (Relobj::local_has_got_offset): New function.
2277         (Relobj::local_got_offset): New function.
2278         (Relobj::set_local_got_offset): New function.
2279         (Relobj::do_local_symbol_value): New pure virtual function.
2280         (Relobj::do_local_plt_offset): Likewise.
2281         (Relobj::do_local_has_got_offset): Likewise.
2282         (Relobj::do_local_got_offset): Likewise.
2283         (Relobj::do_set_local_got_offset): Likewise.
2284         (Sized_relobj::do_local_has_got_offset): Rename from
2285         local_has_got_offset.
2286         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2287         (Sized_relobj::do_set_local_got_offset): Rename from
2288         set_local_got_offset.
2289         (Sized_relobj_file::do_local_plt_offset): Rename from
2290         local_plt_offset.
2291         (Sized_relobj_file::do_local_symbol_value): New function.
2292         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2293         local_plt_offset.
2294         * output.cc (Output_data_got::Got_entry::write): Change object to
2295         Relobj.  Use local_symbol_value.
2296         (Output_data_got::add_global_with_rel): Change rel_dyn to
2297         Output_data_reloc_generic*.  Use add_global_generic.
2298         (Output_data_got::add_global_with_rela): Remove.  Change all
2299         callers to use add_global_with_rel.
2300         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2301         Output_data_reloc_generic*.  Use add_global_generic.
2302         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2303         callers to use add_global_pair_with_rel.
2304         (Output_data_got::add_local): Change object to Relobj*.
2305         (Output_data_got::add_local_plt): Likewise.
2306         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2307         change rel_dyn to Output_data_reloc_generic*.  Use
2308         add_local_generic.
2309         (Output_data_got::add_local_with_rela): Remove.  Change all
2310         callers to use all_local_with_rel.
2311         (Output_data_got::add_local_pair_with_rel): Change object to
2312         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2313         add_output_section_generic.
2314         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2315         callers to use add_local_pair_with_rel.
2316         (Output_data_got::reserve_local): Change object to Relobj*.
2317         * output.h: (class Output_data_reloc_generic): Add pure virtual
2318         declarations for add_global_generic, add_local_generic,
2319         add_output_section_generic.
2320         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2321         functions for Output_data_reloc_generic.  Update declarations for
2322         changes listed in output.cc.
2323         (class Output_data_got): Change template parameter to got_size.
2324         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2325         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2326         function.
2327         (Sized_relobj_incr::do_local_plt_offset): New function.
2328         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2329         add_global_generic.
2330
2331 2011-12-17  Cary Coutant  <ccoutant@google.com>
2332
2333         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2334         * resolve.cc (Symbol_table::resolve): Likewise.
2335         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2336         arrays.
2337         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2338
2339 2011-12-16  Ian Lance Taylor  <iant@google.com>
2340
2341         * output.h (Output_data_reloc_generic::add): Only call
2342         add_dynamic_reloc if this is a dynamic reloc section.
2343
2344 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2345
2346         PR gold/13505
2347         * target-reloc.h (apply_relocation): Replace <64, false> with
2348         <size, big_endian>.
2349
2350 2011-11-25  Nick Clifton  <nickc@redhat.com>
2351
2352         * po/it.po: New Italian translation.
2353
2354 2011-11-17  Sterling Augustine  <saugustine@google.com>
2355
2356         * script.cc (script_include_directive): Implement.
2357         (read_script_file): New local variables name and search_path. Update
2358         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2359         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2360         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2361
2362 2011-11-11  Sterling Augustine  <saugustine@google.com>
2363
2364         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2365         (file_or_sections_cmd): Likewise.
2366
2367 2011-11-11  Doug Kwan  <dougkwan@google.com>
2368
2369         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2370         if --just-symbols is given.
2371
2372 2011-11-10  Doug Kwan  <dougkwan@google.com>
2373
2374         PR gold/13362
2375         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2376         when processing data relocs.
2377         * reloc.h (Relocate_functions::rel_unaligned): New method.
2378         (Relocate_functions::pcrel_unaligned): Ditto.
2379         (Relocate_functions::rel32_unaligned): Ditto.
2380         (Relocate_functions::pcrel32_unaligned): Ditto.
2381
2382 2011-11-09  Doug Kwan  <dougkwan@google.com>
2383
2384         PR gold/13362
2385         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2386         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2387         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2388         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2389         (Relocate_functions::rel_unaligned): New.
2390         (Relocate_functions::rel32_unaligned): New.
2391         * target-reloc.h (relocate_for_relocatable): Add code to handle
2392         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2393         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2394         arm_unaligned_reloc_r): New targets.
2395         * testsuite/Makefile.in: Regenerate.
2396         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2397         linking.
2398
2399 2011-11-02  Ian Lance Taylor  <iant@google.com>
2400
2401         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2402         NATIVE_LINKER.
2403         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2404         * options.cc (General_options::finalize): Use library search path
2405         from configure script if specified.  If not native and no sysroot,
2406         only search TOOLLIBDIR.
2407         * options.h (Search_directory::Search_directory): Change name to
2408         const std::string&.
2409         (General_options::add_to_library_path_with_sysroot): Change arg to
2410         const std::string&.
2411         * configure, Makefile.in, config.in: Rebuild.
2412
2413 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2414
2415         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2416         we are working around the ARM1176 Erratum.
2417         * options.h (General_options::fix_arm1176): Add option.
2418         * testsuite/Makefile.am: Add testcases, and keep current ones
2419         working.
2420         * testsuite/Makefile.in: Regenerate.
2421         * testsuite/arm_fix_1176.s: New file.
2422         * testsuite/arm_fix_1176.sh: Likewise.
2423
2424 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2425
2426         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2427         may_use_blx_.
2428         (Target_arm::may_use_blx): Remove method.
2429         (Target_arm::set_may_use_blx): Likewise.
2430         (Target_arm::may_use_v4t_interworking): New method.
2431         (Target_arm::may_use_v5t_interworking): Likewise.
2432         (Target_arm::may_use_blx_): Remove member variable.
2433         (Arm_relocate_functions::arm_branch_common): Check for v5T
2434         interworking.
2435         (Arm_relocate_functions::thumb_branch_common): Likewise.
2436         (Reloc_stub::stub_type_for_reloc): Likewise.
2437         (Target_arm::do_finalize_sections): Correct interworking checks.
2438         * testsuite/Makefile.am: Add new tests.
2439         * testsuite/Makefile.in: Regenerate.
2440         * testsuite/arm_farcall_arm_arm.s: New test.
2441         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2442         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2443         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2444         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2445         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2446         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2447         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2448
2449 2011-10-31  Cary Coutant  <ccoutant@google.com>
2450
2451         PR gold/13023
2452         * expression.cc (Expression::eval_with_dot): Add
2453         is_section_dot_assignment parameter.
2454         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2455         absolute and assigning to dot within a section.
2456         * script-sections.cc
2457         (Output_section_element_assignment::set_section_addresses): Pass
2458         dot_section to set_if_absolute.
2459         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2460         as is_section_dot_assignment flag to eval_with_dot.
2461         (Output_section_element_dot_assignment::set_section_addresses):
2462         Likewise.
2463         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2464         parameter.  Also set value if relative to dot_section; set the
2465         symbol's output_section.
2466         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2467         parameter.  Adjust all callers.
2468         (Expression::eval_maybe_dot): Likewise.
2469         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2470         Adjust all callers.
2471         * testsuite/script_test_2.t: Test assignment of an absolute value
2472         to dot within an output section element.
2473
2474 2011-10-31  Cary Coutant  <ccoutant@google.com>
2475
2476         * options.h (class General_options): Add --[no-]gnu-unique options.
2477         * symtab.cc (Symbol_table::sized_write_globals): Convert
2478         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2479
2480 2011-10-31  Cary Coutant  <ccoutant@google.com>
2481
2482         PR gold/13359
2483         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2484         unnecessary assertion.
2485         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2486
2487 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2488
2489         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2490         gc_mark_symbol.
2491         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2492         gc_mark_symbol.
2493         Change to just keep the section associated with symbol.
2494         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2495         they are externally visible and --export-dynamic is turned on.
2496         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2497
2498 2011-10-19  Ian Lance Taylor  <iant@google.com>
2499
2500         PR gold/13163
2501         * script-sections.cc
2502         (Output_section_element_dot_assignment::needs_output_section): New
2503         function.
2504
2505 2011-10-19  Ian Lance Taylor  <iant@google.com>
2506
2507         PR gold/13204
2508         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2509         --section-start option was seen.
2510         * options.h (General_options::any_section_start): New function.
2511
2512 2011-10-18  David S. Miller  <davem@davemloft.net>
2513
2514         PR binutils/13301
2515         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2516         member to track relocation locations that have moved during TLS
2517         reloc optimizations.
2518         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2519         (Target_sparc::Relocate::relocate): Adjust view down by 4
2520         bytes if it matches reloc_adjust_addr_.
2521         (Target_sparc::Relocate::relocate_tls): Always move the
2522         __tls_get_addr call delay slot instruction forward 4 bytes when
2523         performing relaxation.
2524
2525 2011-10-18  Cary Coutant  <ccoutant@google.com>
2526
2527         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2528         (Output_file::map_no_anonymous): Check for non-zero
2529         return code from posix_fallocate.
2530
2531 2011-10-17  Cary Coutant  <ccoutant@google.com>
2532
2533         PR gold/13245
2534         * plugin.cc (is_visible_from_outside): Check for symbols
2535         referenced from dynamic objects.
2536         * resolve.cc (Symbol_table::resolve): Don't count references
2537         from dynamic objects as references from real ELF files.
2538         * testsuite/plugin_test_2.sh: Adjust expected result.
2539
2540 2011-10-17  Cary Coutant  <ccoutant@google.com>
2541
2542         * gold.cc: Include timer.h.
2543         (queue_middle_tasks): Stamp time.
2544         (queue_final_tasks): Likewise.
2545         * main.cc (main): Store timer in parameters.  Print timers
2546         for each pass.
2547         * parameters.cc (Parameters::Parameters): Initialize timer_.
2548         (Parameters::set_timer): New function.
2549         (set_parameters_timer): New function.
2550         * parameters.h (Parameters::set_timer): New function.
2551         (Parameters::timer): New function.
2552         (Parameters::timer_): New data member.
2553         (set_parameters_timer): New function.
2554         * timer.cc (Timer::stamp): New function.
2555         (Timer::get_pass_time): New function.
2556         * timer.h (Timer::stamp): New function.
2557         (Timer::get_pass_time): New function.
2558         (Timer::pass_times_): New data member.
2559
2560 2011-10-17  Cary Coutant  <ccoutant@google.com>
2561
2562         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2563         task for members of lib groups.
2564
2565 2011-10-17  Cary Coutant  <ccoutant@google.com>
2566
2567         PR gold/13288
2568         * fileread.cc (File_read::find_view): Add assert.
2569         (File_read::make_view): Move bounds check (replace with assert)...
2570         (File_read::find_or_make_view): ... to here.
2571
2572 2011-10-12  Cary Coutant  <ccoutant@google.com>
2573
2574         * output.cc (Output_file::open_base_file): Handle case where
2575         ::read returns less than requested size.
2576
2577 2011-10-10  Cary Coutant  <ccoutant@google.com>
2578
2579         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2580         Initialize defined_count_.
2581         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2582         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2583         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2584         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2585         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2586         * incremental.h (Sized_relobj_incr::defined_count_): New data
2587         member.
2588         (Sized_incr_dynobj::defined_count_): New data member.
2589         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2590         Return zeroes instead of internal error.
2591
2592 2011-10-10  Cary Coutant  <ccoutant@google.com>
2593
2594         PR gold/13249
2595         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2596         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2597         * output.h (class Output_reloc): Add use_plt_offset flag.
2598         (Output_reloc::type_): Adjust size of bit field.
2599         (Output_reloc::use_plt_offset_): New bit field.
2600         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2601         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2602         flag.  Adjust all callers.
2603         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2604         creating RELATIVE relocations.
2605
2606 2011-10-10  Nick Clifton  <nickc@redhat.com>
2607
2608         * po/es.po: Updated Spanish translation.
2609         * po/fi.po: Updated Finnish translation.
2610
2611 2011-10-03   Diego Novillo  <dnovillo@google.com>
2612
2613         * options.cc (parse_uint): Fix dereference of RETVAL.
2614
2615 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2616
2617         * layout.h (section_order_map_): New member.
2618         (get_section_order_map): New member function.
2619         * output.cc (Output_section::add_input_section): Check for patterns
2620         only when --section-ordering-file is specified.
2621         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2622         output_sections have been formed.
2623         * layout.cc (Layout_Layout): Initialize section_order_map_.
2624         * plugin.cc (update_section_order): Store order in order_map. Do not
2625         update the order.
2626         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2627         * testsuite/Makefile.in: Regenerate.
2628         * testsuite/plugin_section_order.c: New file.
2629         * testsuite/plugin_final_layout.cc: New file.
2630         * testsuite/plugin_final_layout.sh: New file.
2631
2632 2011-09-29  Cary Coutant  <ccoutant@google.com>
2633
2634         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2635         Check for NULL.
2636         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2637         symbols during incremental update.
2638         (Symbol_table::add_from_dynobj): Likewise.
2639
2640 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2641             Ian Lance Taylor  <iant@google.com>
2642
2643         * symtab.cc (Symbol_table::define_special_symbol): Always
2644         canonicalize version string.
2645
2646 2011-09-26  Cary Coutant  <ccoutant@google.com>
2647
2648         * gold.cc (queue_initial_tasks): Move option checks ...
2649         * options.cc (General_options::finalize): ... to here. Disable
2650         some options; make others fatal.
2651
2652 2011-09-26  Cary Coutant  <ccoutant@google.com>
2653
2654         gcc PR lto/47247
2655         * plugin.cc (get_symbols_v2): New function.
2656         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2657         (is_referenced_from_outside): New function.
2658         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2659         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2660         (get_symbols): Pass version parameter.
2661         (get_symbols_v2): New function.
2662         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2663         parameter.
2664         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2665         (onload): Add LDPT_GET_SYMBOLS_V2.
2666         (all_symbols_read_hook): Use get_symbols_v2; check for
2667         LDPR_PREVAILING_DEF_IRONLY_EXP.
2668         * testsuite/plugin_test_3.sh: Update expected results.
2669
2670 2011-09-23  Simon Baldwin  <simonb@google.com>
2671
2672         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2673         configuration options.
2674         * configure: Regenerate.
2675         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2676         * Makefile.in: Regenerate.
2677         * testsuite/Makefile.in: Regenerate.
2678
2679 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2680
2681         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2682
2683 2011-09-19  Cary Coutant  <ccoutant@google.com>
2684
2685         * incremental.cc (can_incremental_update): Fix typo in comment.
2686         * incremental.h (can_incremental_update): Likewise.
2687
2688 2011-09-18  Cary Coutant  <ccoutant@google.com>
2689
2690         * incremental.cc (can_incremental_update): New function.
2691         * incremental.h (can_incremental_update): New function.
2692         * layout.cc (Layout::init_fixed_output_section): Call it.
2693         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2694         * object.cc (Sized_relobj_file::do_layout): Call
2695         can_incremental_update.
2696
2697 2011-09-13  Cary Coutant  <ccoutant@google.com>
2698
2699         * configure.ac: Check for glibc support for gnu_indirect_function
2700         support with static linking, setting automake conditional
2701         IFUNC_STATIC.
2702         * Makefile.in: Regenerate.
2703         * configure: Regenerate.
2704
2705         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2706         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2707         for IFUNC_STATIC.
2708         * testsuite/Makefile.in: Regenerate.
2709
2710 2011-09-13  Cary Coutant  <ccoutant@google.com>
2711
2712         * incremental.cc (Sized_relobj_incr::do_layout): Call
2713         report_comdat_group for kept comdat sections.
2714         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2715         * testsuite/Makefile.in: Regenerate.
2716         * testsuite/incr_comdat_test_1.cc: New source file.
2717         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2718         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2719         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2720
2721 2011-09-13  Ian Lance Taylor  <iant@google.com>
2722
2723         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2724         variable external_symbols_offset.
2725
2726 2011-09-12  Ian Lance Taylor  <iant@google.com>
2727
2728         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2729         triggered if object has no symbols.
2730
2731 2011-09-09  David S. Miller  <davem@davemloft.net>
2732
2733         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2734         (Output_fill_debug_line::do_write): Likewise.
2735
2736 2011-08-29  Cary Coutant  <ccoutant@google.com>
2737
2738         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2739         casts to match formatting specs.
2740         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2741
2742 2011-08-26  Cary Coutant  <ccoutant@google.com>
2743
2744         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2745         remaining hole size when allocating.
2746         (Layout::make_output_section): Set fill methods for debug sections.
2747         * layout.h (Free_list::Free_list_node): Move from private to
2748         public.
2749         (Free_list::set_min_hole_size): New function.
2750         (Free_list::begin, Free_list::end): New functions.
2751         (Free_list::min_hole_): New data member.
2752         * output.cc: Include dwarf.h.
2753         (Output_fill_debug_info::do_minimum_hole_size): New function.
2754         (Output_fill_debug_info::do_write): New function.
2755         (Output_fill_debug_line::do_minimum_hole_size): New function.
2756         (Output_fill_debug_line::do_write): New function.
2757         (Output_section::Output_section): Initialize new data member.
2758         (Output_section::set_final_data_size): Ensure patch space is larger
2759         than minimum hole size.
2760         (Output_section::do_write): Fill holes in debug sections.
2761         * output.h (Output_fill): New class.
2762         (Output_fill_debug_info): New class.
2763         (Output_fill_debug_line): New class.
2764         (Output_section::set_free_space_fill): New function.
2765         (Output_section::free_space_fill_): New data member.
2766         * testsuite/Makefile.am (incremental_test_3): Add
2767         --incremental-patch option.
2768         (incremental_test_4): Likewise.
2769         (incremental_test_5): Likewise.
2770         (incremental_test_6): Likewise.
2771         (incremental_copy_test): Likewise.
2772         (incremental_common_test_1): Likewise.
2773         * testsuite/Makefile.in: Regenerate.
2774
2775 2011-08-26  Nick Clifton  <nickc@redhat.com>
2776
2777         * po/es.po: Updated Spanish translation.
2778
2779 2011-08-01  Cary Coutant  <ccoutant@google.com>
2780
2781         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2782         * gold/testsuite/Makefile.in: Regenerate.
2783         * gold/testsuite/justsyms_exec.c: New source file.
2784         * gold/testsuite/justsyms_lib.c: New source file.
2785
2786 2011-08-01  Cary Coutant  <ccoutant@google.com>
2787
2788         * layout.cc (Layout::set_segment_offsets): Don't realign text
2789         segment if -Ttext was specified.
2790         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2791         file type.
2792         * object.h (Sized_relobj_file::e_type): New function.
2793         (Sized_relobj_file::e_type_): New data member.
2794         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2795         base address for ET_EXEC files.
2796         * target.cc (Target::do_make_elf_object_implementation): Allow
2797         ET_EXEC files with --just-symbols option.
2798
2799 2011-07-28  Cary Coutant  <ccoutant@google.com>
2800
2801         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2802         Add thread_number parameter.
2803         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2804         * workqueue-threads.cc
2805         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2806         current thread if its thread number is greater than desired thread
2807         count.
2808         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2809         Add thread_number parameter.
2810         (Workqueue::should_cancel_thread): Likewise.
2811         (Workqueue::find_runnable_or_wait): Pass thread_number to
2812         should_cancel_thread.
2813         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2814         parameter.
2815
2816 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2817
2818         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2819         only after checking if it cannot be forced local.
2820         * symtab.h (is_externally_visible): Check if the symbol is not forced
2821         local.
2822
2823 2011-07-15  Ian Lance Taylor  <iant@google.com>
2824
2825         * options.h (class General_options): Add --print-output-format.
2826         Move -EL next to -EB, for  better --help output.
2827         * target-select.cc: Include <cstdio>, "options.h", and
2828         "parameters.h".
2829         (Target_selector::do_target_bfd_name): New function.
2830         (print_output_format): New function.
2831         * target-select.h (class Target_selector): Update declarations.
2832         (Target_selector::target_bfd_name): New function.
2833         (print_output_format): Declare.
2834         * main.cc: Include "target-select.h".
2835         (main): Handle --print-output-format.
2836         * gold.cc: Include "target-select.h".
2837         (queue_initial_tasks): Handle --print-output-format when there are
2838         no input files.
2839         * parameters.cc (parameters_force_valid_target): Give a better
2840         error message if -EB/-EL does not match target.
2841         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2842         function.
2843
2844 2011-07-15  Ian Lance Taylor  <iant@google.com>
2845
2846         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2847         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2848         (Output_data_plt_i386::do_write): Write address of .dynamic
2849         section to first entry in .got.plt section.
2850         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2851         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2852         Initialize layout_.
2853         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2854         section to first entry in .got.plt section.
2855         * layout.h (Layout::dynamic_section): New function.
2856
2857 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2858
2859         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2860         to claim_file call.
2861         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2862         input_section_position_, and input_section_glob_.
2863         (read_layout_from_file): Call function section_ordering_specified.
2864         * layout.h (is_section_ordering_specified): New function.
2865         (section_ordering_specified): New function.
2866         (section_ordering_specified_): New boolean member.
2867         * main.cc(main): Call load_plugins after layout object is defined.
2868         * output.cc (Output_section::add_input_section): Use
2869         function section_ordering_specified to check if section ordering is
2870         needed.
2871         * output.cc (Output_section::add_relaxed_input_section): Use
2872         function section_ordering_specified to check if section ordering is
2873         needed.
2874         (Output_section::update_section_layout): New function.
2875         (Output_section::sort_attached_input_sections): Check if input section
2876         must be reordered.
2877         * output.h (Output_section::update_section_layout): New function.
2878         * plugin.cc (get_section_count): New function.
2879         (get_section_type): New function.
2880         (get_section_name): New function.
2881         (get_section_contents): New function.
2882         (update_section_order): New function.
2883         (allow_section_ordering): New function.
2884         (Plugin::load): Add the new interfaces to the transfer vector.
2885         (Plugin_manager::load_plugins): New parameter.
2886         (Plugin_manager::all_symbols_read): New parameter.
2887         (Plugin_manager::claim_file): New parameter. Save the elf object for
2888         unclaimed objects.
2889         (Plugin_manager::get_elf_object): New function.
2890         (Plugin_manager::get_view): Change to directly use the bool to check
2891         if get_view is called from claim_file_hook.
2892         * plugin.h (input_objects): New function
2893         (Plugin__manager::load_plugins): New parameter.
2894         (Plugin_manager::claim_file): New parameter.
2895         (Plugin_manager::get_elf_object): New function.
2896         (Plugin_manager::in_claim_file_handler): New function.
2897         (Plugin_manager::in_claim_file_handler_): New member.
2898         (layout): New function.
2899         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2900         handler with an extra parameter. Make the elf object before calling
2901         claim_file handler.
2902         * testsuite/plugin_test.c (get_section_count): New function pointer.
2903         (get_section_type): New function pointer.
2904         (get_section_name): New function pointer.
2905         (get_section_contents): New function pointer.
2906         (update_section_order): New function pointer.
2907         (allow_section_ordering): New function pointer.
2908         (onload): Check if the new interfaces exist.
2909
2910 2011-07-13  Ian Lance Taylor  <iant@google.com>
2911
2912         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2913         relro section.
2914         * x86_64.cc (Target_x86_64::got_section): Likewise.
2915         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2916         (relro_now_test_SOURCES): New variable.
2917         (relro_now_test_DEPENDENCIES): New variable.
2918         (relro_now_test_LDFLAGS): New variable.
2919         (relro_now_test_LDADD): New variable.
2920         (relro_now_test.so): New target.
2921         * testsuite/Makefile.in: Rebuild.
2922
2923 2011-07-12  Ian Lance Taylor  <iant@google.com>
2924
2925         PR gold/12980
2926         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2927         GLOB_DAT relocation rather than a RELATIVE relocation for a
2928         protected symbol when creating a shared library.
2929         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2930         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2931         * testsuite/protected_main_1.cc (main): Test that protected
2932         function has same address.
2933
2934 2011-07-11  Ian Lance Taylor  <iant@google.com>
2935
2936         PR gold/12979
2937         * options.h (class General_options): Add -Bgroup.
2938         * options.cc (General_options::finalize): If -Bgroup is set,
2939         default to --unresolved-symbols=report-all.
2940         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2941         * target-reloc.h (issue_undefined_symbol_error): Handle
2942         --unresolved-symbols=report-all.
2943
2944 2011-07-08  Ian Lance Taylor  <iant@google.com>
2945
2946         PR gold/11985
2947         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2948         if linker script discards key sections.
2949         (Layout::create_dynamic_symtab): Likewise.
2950         (Layout::assign_local_dynsym_offsets): Likewise.
2951         (Layout::sized_create_version_sections): Likewise.
2952         (Layout::create_interp): Likewise.
2953         (Layout::finish_dynamic_section): Likewise.
2954         (Layout::set_dynamic_symbol_size): Likewise.
2955
2956 2011-07-08  Ian Lance Taylor  <iant@google.com>
2957
2958         PR gold/12386
2959         * options.h (class General_options): Add --unresolved-symbols.
2960         * target-reloc.h (issue_undefined_symbol_error): Check
2961         --unresolved-symbols.  Add comments.
2962
2963 2011-07-08  Ian Lance Taylor  <iant@google.com>
2964
2965         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2966         expression more complex.
2967
2968 2011-07-08  Ian Lance Taylor  <iant@google.com>
2969
2970         PR gold/11317
2971         * target-reloc.h (issue_undefined_symbol_error): New inline
2972         function, broken out of relocate_section.
2973         (relocate_section): Call issue_undefined_symbol_error.
2974         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2975         there is no TLS segment if we are about to issue an undefined
2976         symbol error.
2977         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2978
2979 2011-07-08  Ian Lance Taylor  <iant@google.com>
2980
2981         PR gold/12279
2982         * resolve.cc (Symbol_table::should_override): Add fromtype
2983         parameter.  Change all callers.  Give error when linking together
2984         TLS and non-TLS symbol.
2985         (Symbol_table::should_override_with_special): Add fromtype
2986         parameter.  Change all callers.
2987         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2988         there is no TLS segment if we have reported some errors.
2989         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2990
2991 2011-07-08  Ian Lance Taylor  <iant@google.com>
2992
2993         PR gold/12372
2994         * target.h (Target::plt_address_for_global): New function.
2995         (Target::plt_address_for_local): New function.
2996         (Target::plt_section_for_global): Remove.
2997         (Target::plt_section_for_local): Remove.
2998         (Target::do_plt_address_for_global): New virtual function.
2999         (Target::do_plt_address_for_local): New virtual function.
3000         (Target::do_plt_section_for_global): Remove.
3001         (Target::do_plt_section_for_local): Remove.
3002         (Target::register_global_plt_entry): Add Symbol_table and Layout
3003         parameters.
3004         * output.cc (Output_data_got::Got_entry::write): Use
3005         plt_address_for_global and plt_address_for_local.
3006         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3007         address of output section.
3008         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3009         got_irelative_, and irelative_count_ fields.  Update
3010         declarations.
3011         (Output_data_plt_i386::has_irelative_section): New function.
3012         (Output_data_plt_i386::entry_count): Add irelative_count_.
3013         (Output_data_plt_i386::set_final_data_size): Likewise.
3014         (class Target_i386): Add got_irelative_ and rel_irelative_
3015         fields.  Update declarations.
3016         (Target_i386::Target_i386): Initialize new fields.
3017         (Target_i386::do_plt_address_for_global): New function replacing
3018         do_plt_section_for_global.
3019         (Target_i386::do_plt_address_for_local): New function replacing
3020         do_plt_section_for_local.
3021         (Target_i386::got_section): Create got_irelative_.
3022         (Target_i386::rel_irelative_section): New function.
3023         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3024         fields.  Don't define __rel_iplt_{start,end}.
3025         (Output_data_plt_i386::add_entry): Add symtab and layout
3026         parameters.  Change all callers.  Use different PLT and GOT for
3027         IFUNC symbols.
3028         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3029         layout parameters.  Change all callers.  Use different PLT and
3030         GOT.
3031         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3032         (Output_data_plt_i386::rel_irelative): New function.
3033         (Output_data_plt_i386::address_for_global): New function.
3034         (Output_data_plt_i386::address_for_local): New function.
3035         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3036         IRELATIVE GOT when changing IFUNC GOT entries.
3037         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3038         reloc.
3039         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3040         if we didn't create an IRELATIVE GOT.
3041         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3042         plt_address_for_local.
3043         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3044         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3045         got_irelative_, and irelative_count_ fields.  Update
3046         declarations.
3047         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3048         Initialize new fields.  Remove symtab parameter.  Change all
3049         callers.
3050         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3051         irelative_count_.
3052         (Output_data_plt_x86_64::has_irelative_section): New function.
3053         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3054         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3055         fields.  Update declarations.
3056         (Target_x86_64::Target_x86_64): Initialize new fields.
3057         (Target_x86_64::do_plt_address_for_global): New function replacing
3058         do_plt_section_for_global.
3059         (Target_x86_64::do_plt_address_for_local): New function replacing
3060         do_plt_section_for_local.
3061         (Target_x86_64::got_section): Create got_irelative_.
3062         (Target_x86_64::rela_irelative_section): New function.
3063         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3064         all callers.  Don't create __rel_iplt_{start,end}.
3065         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3066         parameters.  Change all callers.  Use different PLT and GOT for
3067         IFUNC symbols.
3068         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3069         layout parameters.  Change all callers.  Use different PLT and
3070         GOT.
3071         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3072         parameters.  Change all callers.  Use different PLT and GOT for
3073         IFUNC symbols.
3074         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3075         (Output_data_plt_x86_64::rela_irelative): New function.
3076         (Output_data_plt_x86_64::address_for_global): New function.
3077         (Output_data_plt_x86_64::address_for_local): New function.
3078         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3079         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3080         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3081         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3082         parameters.
3083         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3084         reloc.
3085         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3086         symbols if we didn't create an IRELATIVE GOT.
3087         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3088         plt_address_for_local.
3089         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3090         * testsuite/ifuncvar1.c: New test file.
3091         * testsuite/ifuncvar2.c: New test file.
3092         * testsuite/ifuncvar3.c: New test file.
3093         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3094         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3095         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3096         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3097         * testsuite/Makefile.in: Rebuild.
3098
3099 2011-07-07  Cary Coutant  <ccoutant@google.com>
3100
3101         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3102         (two_file_test_1_ndebug.o): Likewise.
3103         (two_file_test_1b_ndebug.o): Likewise.
3104         (two_file_test_2_ndebug.o): Likewise.
3105         (two_file_test_main_ndebug.o): Likewise.
3106         (incremental_test_2): Link with no-debug versions.
3107
3108 2011-07-06  Cary Coutant  <ccoutant@google.com>
3109
3110         * gold/incremental.cc
3111         (Output_section_incremental_inputs::write_info_blocks): Check for
3112         hidden and internal symbols.
3113
3114 2011-07-06  Cary Coutant  <ccoutant@google.com>
3115
3116         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3117         Check disposition for startup file.
3118         (Incremental_inputs::report_command_line): Ignore
3119         --incremental-startup-unchanged option.
3120         * options.cc (General_options::parse_incremental_startup_unchanged):
3121         New function.
3122         (General_options::General_options): Initialize new data member.
3123         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3124         (General_options): Add --incremental-startup-unchanged option.
3125         (General_options::incremental_startup_disposition): New function.
3126         (General_options::incremental_startup_disposition_): New data member.
3127
3128 2011-07-06  Cary Coutant  <ccoutant@google.com>
3129
3130         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3131         input file index to Script_info ctor.
3132         (Sized_incremental_binary::do_file_has_changed): Find the
3133         command-line argument for files named in scripts.
3134         * incremental.h (Script_info::Script_info): New ctor
3135         with input file index.
3136         (Script_info::input_file_index): New function.
3137         (Script_info::input_file_index_): New data member.
3138         (Incremental_binary::get_library): Add const.
3139         (Incremental_binary::get_script_info): Add const.
3140         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3141         * testsuite/Makefile.am (incremental_test_5): New test case.
3142         (incremental_test_6): New test case.
3143         * testsuite/Makefile.in: Regenerate.
3144
3145 2011-07-06  Cary Coutant  <ccoutant@google.com>
3146
3147         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3148         debug output when command lines differ.
3149
3150 2011-07-06  Cary Coutant  <ccoutant@google.com>
3151
3152         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3153         --incremental-patch option.
3154         * layout.cc (Free_list::allocate): Extend allocation beyond original
3155         end if enabled.
3156         (Layout::make_output_section): Mark sections that should get
3157         patch space.
3158         * options.cc (parse_percent): New function.
3159         * options.h (parse_percent): New function.
3160         (DEFINE_percent): New macro.
3161         (General_options): Add --incremental-patch option.
3162         * output.cc (Output_section::Output_section): Initialize new data
3163         members.
3164         (Output_section::add_input_section): Print section name when out
3165         of patch space.
3166         (Output_section::add_output_section_data): Likewise.
3167         (Output_section::set_final_data_size): Add patch space when
3168         doing --incremental-full.
3169         (Output_section::do_reset_address_and_file_offset): Remove patch
3170         space.
3171         (Output_segment::set_section_list_addresses): Print debug output
3172         only if --incremental-update.
3173         * output.h (Output_section::set_is_patch_space_allowed): New function.
3174         (Output_section::is_patch_space_allowed_): New data member.
3175         (Output_section::patch_space_): New data member.
3176         * parameters.cc (Parameters::incremental_full): New function.
3177         * parameters.h (Parameters::incremental_full): New function
3178         * testsuite/Makefile.am (incremental_test_2): Add test for
3179         --incremental-patch option.
3180         * testsuite/Makefile.in: Regenerate.
3181         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3182         (t18): Remove function body.
3183
3184 2011-07-05  Doug Kwan  <dougkwan@google.com>
3185
3186         PR gold/12771
3187         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3188         Arm_Address type for relocation result.
3189         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3190         overflow check.
3191         (Arm_relocate_functions::abs32): Use unaligned access.
3192         (Arm_relocate_functions::rel32): Ditto.
3193         (Arm_relocate_functions::prel31): Ditto.
3194         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3195         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3196         static data relocations.
3197         * testsuite/Makefile.in: Regnerate.
3198         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3199
3200 2011-07-05  Ian Lance Taylor  <iant@google.com>
3201
3202         PR gold/12392
3203         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3204         symbols if necessary.
3205         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3206
3207 2011-07-05  Ian Lance Taylor  <iant@google.com>
3208
3209         PR gold/12952
3210         * resolve.cc (Symbol::override_base_with_special): Simply override
3211         version with special symbol version, ignoring previous version.
3212
3213 2011-07-05  Ian Lance Taylor  <iant@google.com>
3214
3215         * object.cc (Sized_relobj_file::include_section_group): Add
3216         information to comment about signature location.
3217
3218 2011-07-02  Ian Lance Taylor  <iant@google.com>
3219
3220         PR gold/12957
3221         * options.h (class General_options): Add -f and -F.
3222         * options.cc (General_options::finalize): Fatal error if -f/-F
3223         are used without -shared.
3224         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3225
3226 2011-07-02  Ian Lance Taylor  <iant@google.com>
3227
3228         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3229
3230 2011-07-01  Ian Lance Taylor  <iant@google.com>
3231
3232         PR gold/12525
3233         PR gold/12952
3234         * resolve.cc (Symbol::override_base_with_special): Don't override
3235         the version if the overriding symbol has a different name.
3236         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3237         all callers.  If we give an error about an undefined version,
3238         define the base version if necessary.
3239         * dynobj.h (class Versions): Update declaration.
3240         * testsuite/weak_alias_test_5.cc: New file.
3241         * testsuite/weak_alias_test.script: New file.
3242         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3243         and versioned_alias have the right value, and call t2.
3244         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3245         weak_alias_test_5.so.
3246         (weak_alias_test_LDADD): Likewise.
3247         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3248         * testsuite/Makefile.in: Rebuild.
3249
3250 2011-07-01  Ian Lance Taylor  <iant@google.com>
3251
3252         PR gold/12525
3253         * options.h (class General_options): Support -z notext.
3254         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3255         -Wl,-z,notext.
3256         (two_file_shared_nonpic.so): Likewise.
3257         (two_file_shared_mixed.so): Likewise.
3258         (two_file_shared_mixed_1.so): Likewise.
3259         (weak_undef_lib_nonpic.so): Likewise.
3260         (alt/weak_undef_lib_nonpic.so): Likewise.
3261         (tls_test_shared_nonpic.so): Likewise.
3262         * testsuite/Makefile.in: Rebuild.
3263
3264 2011-07-01  Ian Lance Taylor  <iant@google.com>
3265
3266         PR gold/12525
3267         * configure.ac: Test whether static linking works, setting
3268         the automake conditional HAVE_STATIC.
3269         * testsuite/Makefile.am: Disable tests using -static if
3270         HAVE_STATIC is not true.
3271         * configure, testsuite/Makefile.in: Rebuild.
3272
3273 2011-07-01  Ian Lance Taylor  <iant@google.com>
3274
3275         PR gold/12525
3276         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3277         Assert if we see DW_EH_PE_indirect.
3278         * target.h (Target::ehframe_datarel_base): New function.
3279         (Target::do_ehframe_datarel_base): New target function.
3280         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3281         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3282         function.
3283
3284 2011-07-01  Ian Lance Taylor  <iant@google.com>
3285
3286         PR gold/12571
3287         * options.h (class General_options): Add
3288         --ld-generated-unwind-info.
3289         * ehframe.cc (Fde::write): Add address parameter.  Change all
3290         callers.  If associated with PLT, fill in address and size.
3291         (Cie::set_output_offset): Only add merge mapping if there is an
3292         object.
3293         (Cie::write): Add address parameter.  Change all callers.
3294         (Eh_frame::add_ehframe_for_plt): New function.
3295         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3296         input_offset_ fields into union u_, with new plt field.
3297         (Fde::Fde): Adjust for new union field.
3298         (Fde::Fde) [Output_data version]: New constructor.
3299         (Fde::add_mapping): Only add merge mapping if there is an object.
3300         (class Cie): Update declarations.
3301         (class Eh_frame): Declare add_ehframe_for_plt.
3302         * layout.cc (Layout::layout_eh_frame): Break out code into
3303         make_eh_frame_section, and call it.
3304         (Layout::make_eh_frame_section): New function.
3305         (Layout::add_eh_frame_for_plt): New function.
3306         * layout.h (class Layout): Update declarations.
3307         * merge.cc (Merge_map::add_mapping): Add assertion.
3308         * i386.cc: Include "dwarf.h".
3309         (class Output_data_plt_i386): Make first_plt_entry,
3310         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3311         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3312         and plt_eh_frame_fde.
3313         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3314         boundary.  Call add_eh_frame_for_plt if appropriate.
3315         * x86_64.cc: Include "dwarf.h".
3316         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3317         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3318         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3319         and plt_eh_frame_fde.
3320         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3321         appropriate.
3322
3323 2011-06-29  Ian Lance Taylor  <iant@google.com>
3324
3325         PR gold/12629
3326         * object.cc (Sized_relobj_file::layout_section): Change shdr
3327         parameter to be const.
3328         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3329         out of do_layout.
3330         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3331         appropriate.  Call layout_eh_frame_section.
3332         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3333         sections.
3334         * object.h (class Sized_relobj_file): Update declarations.
3335
3336 2011-06-29  Ian Lance Taylor  <iant@google.com>
3337
3338         PR gold/12652
3339         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3340         modifier.
3341         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3342
3343 2011-06-29  Ian Lance Taylor  <iant@google.com>
3344
3345         PR gold/12675
3346         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3347         SHT_X86_64_UNWIND.
3348         * layout.cc (Layout::layout_eh_frame): Likewise.
3349
3350 2011-06-29  Ian Lance Taylor  <iant@google.com>
3351
3352         PR gold/12695
3353         * layout.cc (Layout::symtab_section_shndx): New function.
3354         * layout.h (class Layout): Declare symtab_section_shndx.
3355         * output.cc (Output_section::write_header): Call it.
3356
3357 2011-06-29  Ian Lance Taylor  <iant@google.com>
3358
3359         PR gold/12818
3360         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3361         symbols which are not used in a relocation.
3362
3363 2011-06-28  Ian Lance Taylor  <iant@google.com>
3364
3365         PR gold/12898
3366         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3367         script create indistinguishable segments.
3368         (Layout::set_segment_offsets): Use stable_sort when sorting
3369         segments.  Pass this to Compare_segments constructor.
3370         * layout.h (class Layout): Make segment_precedes non-static.
3371         (class Compare_segments): Change from struct to class.  Add
3372         layout_ field.  Add constructor.
3373         * script-sections.cc
3374         (Script_sections::attach_sections_using_phdrs_clause): Rename
3375         local orphan to is_orphan.  Don't report failure to put empty
3376         section in segment.  On attachment failure, report name of
3377         section, and attach to first PT_LOAD segment.
3378
3379 2011-06-28  Ian Lance Taylor  <iant@google.com>
3380
3381         PR gold/12934
3382         * target-select.cc (Target_selector::Target_selector): Add
3383         emulation parameter.  Change all callers.
3384         (select_target_by_bfd_name): Rename from select_target_by_name.
3385         Change all callers.
3386         (select_target_by_emulation): New function.
3387         (supported_emulation_names): New function.
3388         * target-select.h (class Target_selector): Add emulation_ field.
3389         Update declarations.
3390         (Target_selector::recognize_by_bfd_name): Rename from
3391         recognize_by_name.  Change all callers.
3392         (Target_selector::supported_bfd_names): Rename from
3393         supported_names.  Change all callers.
3394         (Target_selector::recognize_by_emulation): New function.
3395         (Target_selector::supported_emulations): New function.
3396         (Target_selector::emulation): New function.
3397         (Target_selector::do_recognize_by_bfd_name): Rename from
3398         do_recognize_by_name.  Change all callers.
3399         (Target_selector::do_supported_bfd_names): Rename from
3400         do_supported_names.  Change all callers.
3401         (Target_selector::do_recognize_by_emulation): New function.
3402         (Target_selector::do_supported_emulations): New function.
3403         (select_target_by_bfd_name): Change name in declaration.
3404         (select_target_by_emulation): Declare.
3405         (supported_emulation_names): Declare.
3406         * parameters.cc (parameters_force_valid_target): Try to find
3407         target based on emulation from -m option.
3408         * options.h (class General_options): Change doc string for -m.
3409         * options.cc (help): Print emulations.
3410         (General_options::parse_V): Likewise.
3411         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3412         Add emulation parameter.  Change all callers.
3413
3414 2011-06-28  Ian Lance Taylor  <iant@google.com>
3415
3416         * target.h (class Target): Add osabi_ field.
3417         (Target::osabi): New function.
3418         (Target::set_osabi): New function.
3419         (Target::Target): Initialize osabi_.
3420         (Target::do_adjust_elf_header): Make pure virtual.
3421         (Sized_target::do_adjust_elf_header): Declare.
3422         * target.cc (Sized_target::do_adjust_elf_header): New function.
3423         (class Sized_target): Instantiate all versions.
3424         * freebsd.h (class Target_freebsd): Remove.
3425         (Target_selector_freebsd::do_recognize): Call set_osabi on
3426         Target.
3427         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3428         (Target_selector_freebsd::set_osabi): Remove.
3429         * i386.cc (class Target_i386): Inherit from Sized_target rather
3430         than Target_freebsd.
3431         * x86_64.cc (class Target_x86_64): Likewise.
3432
3433 2011-06-28  Ian Lance Taylor  <iant@google.com>
3434
3435         * target.h (Target::can_check_for_function_pointers): Rewrite.
3436         Make non-virtual.
3437         (Target::can_icf_inline_merge_sections): Likewise.
3438         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3439         (Target::Target_info): Add can_icf_inline_merge_sections field.
3440         (Target::do_can_check_for_function_pointers): New virtual
3441         function.
3442         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3443         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3444         from can_check_for_function_pointers, move in file.
3445         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3446         section_may_have_icf_unsafe_poineters, move in file.
3447         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3448         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3449         Rename from can_check_for_function_pointers, move in file.
3450         (Target_i386::can_icf_inline_merge_sections): Remove.
3451         (Target_i386::i386_info): Initialize
3452         can_icf_inline_merge_sections.
3453         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3454         Initialize can_icf_inline_merge_sections.
3455         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3456         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3457         Rename from can_check_for_function_pointers, move in file.
3458         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3459         (Target_x86_64::x86_64_info): Initialize
3460         can_icf_inline_merge_sections.
3461         * testsuite/testfile.cc (Target_test::test_target_info):
3462         Likewise.
3463         * icf.cc (get_section_contents): Correct formatting.
3464
3465 2011-06-27  Ian Lance Taylor  <iant@google.com>
3466
3467         * symtab.cc (Symbol::versioned_name): New function.
3468         (Symbol_table::add_to_final_symtab): Use versioned_name when
3469         appropriate.
3470         (Symbol_table::sized_write_symbol): Likewise.
3471         * symtab.h (class Symbol): Declare versioned_name.
3472         * stringpool.h (class Stringpool_template): Add variant of add
3473         which takes a std::basic_string.
3474         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3475         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3476         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3477         (ver_test_12.o): New target.
3478         * testsuite/Makefile.in: Rebuild.
3479
3480 2011-06-27  Doug Kwan  <dougkwan@google.com>
3481
3482         * arm.cc (Arm_relocate_functions::thm_jump8,
3483         Arm_relocate_functions::thm_jump11): Use a wider signed
3484         type to compute offset.
3485         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3486         arm_thm_jump8.
3487         * testsuite/Makefile.in: Regenerate.
3488         * testsuite/arm_branch_in_range.sh: Check test results of
3489         arm_thm_jump11 and arm_thm_jump8.
3490         * testsuite/arm_thm_jump11.s: New test source file.
3491         * testsuite/arm_thm_jump11.t: New linker script.
3492         * testsuite/arm_thm_jump8.s: New test source file.
3493         * testsuite/arm_thm_jump8.t: New linker script.
3494
3495 2011-06-24  Ian Lance Taylor  <iant@google.com>
3496
3497         * layout.cc: Include "object.h".
3498         (ctors_sections_in_init_array): New static variable.
3499         (Layout::is_ctors_in_init_array): New function.
3500         (Layout::layout): Add entry to ctors_sections_in_init_array if
3501         appropriate.
3502         * layout.h (class Layout): Declare is_ctors_in_init_array.
3503         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3504         is_ctors_reverse_view is set.
3505         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3506         all callers.  Set is_ctors_reverse_view field of View_size.
3507         (Sized_relobj_file::reverse_words): New function.
3508         * object.h (Sized_relobj_file::View_size): Add
3509         is_ctors_reverse_view field.
3510         (class Sized_relobj_file): Update declarations.
3511         * testsuite/initpri3.c: New test.
3512         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3513         initpri3b.
3514         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3515         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3516         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3517         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3518         * testsuite/Makefile.in: Rebuild.
3519
3520 2011-06-24  Cary Coutant  <ccoutant@google.com>
3521
3522         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3523         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3524         (debug_msg_cdebug.err): New targets.
3525         * testsuite/Makefile.in: Regenerate.
3526         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3527         Fix checks for link with shared library.
3528
3529 2011-06-24  Doug Kwan  <dougkwan@google.com>
3530
3531         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3532         skip empty text sections.
3533         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3534
3535 2011-06-22  Ian Lance Taylor  <iant@google.com>
3536
3537         PR gold/12910
3538         * options.h (class General_options): Add --ctors-in-init-array.
3539         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3540         friends as SHT_PROGBITS for merging sections.
3541         (Layout::layout): Remove special handling of .init_array and
3542         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3543         and .dtors if ctors_in_init_array.
3544         (Layout::make_output_section): Force correct section types for
3545         .init_array and friends.  Don't sort if doing relocatable link,
3546         Don't sort .ctors and .dtors if ctors_in_init_array.
3547         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3548         (Layout::output_section_name): Add relobj parameter.  Change all
3549         callers.  Handle .ctors. and .dtors. in code rather than table.
3550         Handle .ctors and .dtors if ctors_in_init_array.
3551         (Layout::match_file_name): New function, moved from output.cc.
3552         * layout.h (class Layout): Update declarations.
3553         * output.cc: Include "layout.h".
3554         (Input_section_sort_entry::get_priority): New function.
3555         (Input_section_sort_entry::match_file_name): Just call
3556         Layout::match_file_name.
3557         (Output_section::Input_section_sort_init_fini_compare::operator()):
3558         Handle .ctors and .dtors.  Sort by explicit priority rather than
3559         by name.
3560         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3561         * testsuite/initpri2.c: New test.
3562         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3563         (check_PROGRAMS): Add initpri2.
3564         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3565         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3566         * configure, testsuite/Makefile.in: Rebuild.
3567
3568 2011-06-19  Ian Lance Taylor  <iant@google.com>
3569
3570         PR gold/12880
3571         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3572         .interp section to a PT_INTERP segment even if we have seen a
3573         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3574         clause in a linker script.
3575         (Layout::finalize): Don't create a .interp section if we've
3576         already create a PT_INTERP segment.
3577         (Layout::create_interp): Always call choose_output_section (revert
3578         patch of 2011-06-17).  Don't create PT_INTERP segment.
3579         * script-sections.cc
3580         (Script_sections::create_note_and_tls_segments): Add a .interp
3581         section to a PT_INTERP segment even if we have seen a
3582         --dynamic-linker option.
3583
3584 2011-06-18  Ian Lance Taylor  <iant@google.com>
3585
3586         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3587         merely because a non-PT_LOAD segment has a dynamic reloc.
3588
3589 2011-06-18  Ian Lance Taylor  <iant@google.com>
3590
3591         * layout.cc (Layout::finish_dynamic_section): Don't create
3592         DT_FLAGS entry if not needed.
3593
3594 2011-06-18  Ian Lance Taylor  <iant@google.com>
3595
3596         PR gold/12745
3597         * layout.cc (Layout::layout_eh_frame): Correct handling of
3598         writable .eh_frame section.
3599
3600 2011-06-17  Ian Lance Taylor  <iant@google.com>
3601
3602         PR gold/12893
3603         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3604         symbol is redefined with the exact same object and value.
3605
3606 2011-06-17  Ian Lance Taylor  <iant@google.com>
3607
3608         PR gold/12880
3609         * layout.h (class Layout): Add interp_segment_ field.
3610         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3611         (Layout::attach_allocated_section_to_segment): If making shared
3612         library, put .interp section in PT_INTERP segment.
3613         (Layout::finalize): Also call create_interp if -dynamic-linker
3614         option was used.
3615         (Layout::create_interp): Assert that there is no PT_INTERP
3616         segment.  If not using a SECTIONS clause, use make_output_section.
3617         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3618         * script-sections.cc
3619         (Script_sections::create_note_and_tls_segments): If making shared
3620         library, put .interp section in PT_INTERP segment.
3621
3622 2011-06-17  Ian Lance Taylor  <iant@google.com>
3623
3624         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3625         when making a shared library.
3626
3627 2011-06-17  Ian Lance Taylor  <iant@google.com>
3628
3629         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3630         parameter.  Change all callers.  Don't issue warning about PC32
3631         against locally defined symbol.
3632
3633 2011-06-16  Ian Lance Taylor  <iant@google.com>
3634
3635         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3636         occurs in same object.
3637
3638 2011-06-14  Alan Modra  <amodra@gmail.com>
3639
3640         * po/POTFILES.in: Regenerate.
3641
3642 2011-06-09  Ian Lance Taylor  <iant@google.com>
3643
3644         * script-sections.cc
3645         (Orphan_output_section::set_section_addresses): For a relocatable
3646         link set address to 0.
3647
3648 2011-06-09  Cary Coutant  <ccoutant@google.com>
3649
3650         PR gold/12804
3651         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3652         used with --compress-debug-sections.
3653         * gold/object.cc (Sized_relobj_file::do_layout): Report
3654         uncompressed size of compressed input sections.
3655
3656 2011-06-08  Cary Coutant  <ccoutant@google.com>
3657
3658         PR gold/12804
3659         * testsuite/two_file_test_2_v1.cc: Change initialization of
3660         v2 to keep it in .data.
3661
3662 2011-06-07  Cary Coutant  <ccoutant@google.com>
3663
3664         * common.cc (Symbol_table::do_allocate_commons_list): Call
3665         gold_fallback.
3666         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3667         (Errors::fallback): New function.
3668         (gold_fallback): New function.
3669         * errors.h (Errors::fallback): New function.
3670         * gold.cc (gold_exit): Change status parameter to enum; adjust
3671         all callers.
3672         (queue_initial_tasks): Call gold_fallback.
3673         * gold.h: Include cstdlib.
3674         (Exit_status): New enum type.
3675         (gold_exit): Change status parameter to enum.
3676         (gold_fallback): New function.
3677         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3678         (Layout::create_symtab_sections): Likewise.
3679         (Layout::create_shdrs): Likewise.
3680         * main.cc (main): Adjust call to gold_exit.
3681         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3682         (Output_data_got::add_got_entry_pair): Likewise.
3683         (Output_section::add_input_section): Likewise.
3684         (Output_section::add_output_section_data): Likewise.
3685         (Output_segment::set_section_list_addresses): Likewise.
3686         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3687
3688 2011-06-07  Cary Coutant  <ccoutant@google.com>
3689
3690         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3691         for incremental links.
3692         * output.cc (Output_segment::set_section_list_addresses): Remove
3693         FIXME and test for TLS or BSS.
3694
3695 2011-06-07  Cary Coutant  <ccoutant@google.com>
3696
3697         * testsuite/Makefile.am: Add incremental_copy_test,
3698         incremental_common_test_1.
3699         * testsuite/Makefile.in: Regenerate.
3700         * testsuite/common_test_1_v1.c: New source file.
3701         * testsuite/common_test_1_v2.c: New source file.
3702         * testsuite/copy_test_v1.cc: New source file.
3703
3704 2011-06-07  Cary Coutant  <ccoutant@google.com>
3705
3706         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3707         update, allocate common from bss section's free list.
3708         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3709         linker-defined symbols.
3710         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3711         Skip GOT and PLT entries that are no longer referenced.
3712         (Output_section_incremental_inputs::write_info_blocks): Mark
3713         linker-defined symbols.
3714         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3715         * output.cc (Output_section::allocate): New function.
3716         * output.h (Output_section::allocate): New function.
3717         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3718         linker-defined symbols.
3719         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3720         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3721         (Symbol::init_base_output_data): Likewise.
3722         (Symbol::init_base_output_segment): Likewise.
3723         (Symbol::init_base_constant): Likewise.
3724         (Sized_symbol::init_output_data): Likewise.
3725         (Sized_symbol::init_output_segment): Likewise.
3726         (Sized_symbol::init_constant): Likewise.
3727         (Symbol_table::do_define_in_output_data): Likewise.
3728         (Symbol_table::do_define_in_output_segment): Likewise.
3729         (Symbol_table::do_define_as_constant): Likewise.
3730         * symtab.h (Symbol::is_predefined): New function.
3731         (Symbol::init_base_output_data): Add is_predefined parameter.
3732         (Symbol::init_base_output_segment): Likewise.
3733         (Symbol::init_base_constant): Likewise.
3734         (Symbol::is_predefined_): New data member.
3735         (Sized_symbol::init_output_data): Add is_predefined parameter.
3736         (Sized_symbol::init_output_segment): Likewise.
3737         (Sized_symbol::init_constant): Likewise.
3738         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3739
3740 2011-06-07  Cary Coutant  <ccoutant@google.com>
3741
3742         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3743         instead of emit_copy_reloc.
3744         (Copy_relocs::emit_copy_reloc): Refactor.
3745         (Copy_relocs::make_copy_reloc): New function.
3746         (Copy_relocs::add_copy_reloc): Remove.
3747         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3748         section.
3749         (Copy_relocs::make_copy_reloc): New function.
3750         (Copy_relocs::add_copy_reloc): Remove.
3751         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3752         unchanged input files.
3753         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3754         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3755         Reserve BSS space for COPY relocations.
3756         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3757         (Output_section_incremental_inputs::write_info_blocks): Record
3758         whether a symbol is copied from a shared object.
3759         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3760         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3761         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3762         (Incremental_input_entry_reader::get_output_symbol_index): Add
3763         is_copy parameter.
3764         (Incremental_binary::emit_copy_relocs): New function.
3765         (Incremental_binary::do_emit_copy_relocs): New function.
3766         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3767         new data member.
3768         (Sized_incremental_binary::add_copy_reloc): New function.
3769         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3770         (Sized_incremental_binary::Copy_reloc): New struct.
3771         (Sized_incremental_binary::Copy_relocs): New typedef.
3772         (Sized_incremental_binary::copy_relocs_): New data member.
3773         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3774         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3775         * target.h (Sized_target::emit_copy_reloc): New function.
3776         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3777
3778 2011-06-02  Cary Coutant  <ccoutant@google.com>
3779
3780         PR gold/12163
3781         * gold/archive.cc (Archive::Archive): Initialize new data member.
3782         (Archive::include_all_members): Return if archive has already been
3783         included.
3784         * gold/archive.h (Archive::include_all_members_): New data member.
3785
3786 2011-06-02  Nick Clifton  <nickc@redhat.com>
3787
3788         * dynobj.h: Fix spelling mistake in comment.
3789         * output.cc: Likewise.
3790
3791 2011-05-31  Doug Kwan  <dougkwan@google.com>
3792             Asier Llano
3793
3794         PR gold/12826
3795         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3796         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3797         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3798         redundant arm_exidx_test.so.
3799         * testsuite/Makefile.in: Regenerate.
3800         (check_SCRIPTS): Add pr12826.sh
3801         (check_DATA): Add pr12826.stdout
3802         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3803         * testsuite/pr12826.sh: New file.
3804         * testsuite/pr12826_1.s: Ditto.
3805         * testsuite/pr12826_1.s: Ditto.
3806
3807 2011-05-30  Ian Lance Taylor  <iant@google.com>
3808
3809         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3810         sections.
3811
3812 2011-05-29  Ian Lance Taylor  <iant@google.com>
3813
3814         PR gold/12804
3815         * testsuite/Makefile.am: Use different file name for two_file_test
3816         temporary file for each incremental test.
3817         * testsuite/Makefile.in: Rebuild.
3818
3819 2011-05-29  Ian Lance Taylor  <iant@google.com>
3820
3821         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3822         binary input file is empty.
3823
3824 2011-05-27  Ian Lance Taylor  <iant@google.com>
3825
3826         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3827         (ver_test_9.so): Likewise.
3828         * testsuite/Makefile.in: Rebuild.
3829
3830 2011-05-26 Cary Coutant  <ccoutant@google.com>
3831
3832         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3833         * incremental.cc (Incremental_inputs::report_input_section): Fix
3834         comment, indentation.
3835         (Incremental_inputs::report_comdat_group): New function.
3836         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3837         of data for incremental input file entry.
3838         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3839         group count, COMDAT group signatures.
3840         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3841         an unchanged input file.
3842         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3843         Initialize new data member.
3844         (Incremental_object_entry::add_comdat_group): New function.
3845         (Incremental_object_entry::get_comdat_group_count): New function.
3846         (Incremental_object_entry::get_comdat_signature_key): New function.
3847         (Incremental_object_entry::groups_): New data member.
3848         (Incremental_inputs::report_comdat_group): New function.
3849         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3850         data for incremental input file entry.
3851         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3852         (Incremental_input_entry_reader::get_input_section): Adjust size of
3853         data for incremental input file entry.
3854         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3855         (Incremental_input_entry_reader::get_comdat_group_signature): New
3856         function.
3857         * object.cc (Sized_relobj::include_section_group): Report kept
3858         COMDAT groups for incremental links.
3859
3860 2011-05-24  David Meyer  <pdox@google.com>
3861
3862         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3863         with name parameter.  Add found_name parameter.
3864         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3865         * dirsearch.h (class Dirsearch): Update declaration.
3866
3867 2011-05-24  Ian Lance Taylor  <iant@google.com>
3868
3869         * archive.cc (Library_base::should_include_member): Pull in object
3870         from archive if it defines the entry symbol.
3871         * parameters.cc (Parameters::entry): New function.
3872         * parameters.h (class Parameters): Declare entry.
3873         * output.h (class Output_file_header): Remove entry_ field.
3874         * output.cc (Output_file_header::Output_file_header): Remove entry
3875         parameter.  Change all callers.
3876         (Output_file_header::entry): Use parameters->entry.
3877         * gold.cc (queue_middle_tasks): Likewise.
3878         * plugin.cc (Plugin_hook::run): Likewise.
3879
3880 2011-05-24 Cary Coutant  <ccoutant@google.com>
3881
3882         * gold.cc (queue_initial_tasks): Pass incremental base filename
3883         to Output_file::open_base_file; don't print error message.
3884         * incremental-dump.cc (main): Adjust call to
3885         Output_file::open_for_modification.
3886         * incremental-dump.cc (main): Likewise.
3887         * incremental.cc (Incremental_inputs::report_command_line):
3888         Ignore --incremental-base option when comparing command lines.
3889         Ignore parameter when given as separate argument.
3890         * options.h (class General_options): Add --incremental-base.
3891         * output.cc (Output_file::Output_file):
3892         (Output_file::open_base_file): Add base_name and writable parameters;
3893         read base file into new file; print error message here.
3894         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3895         callers.
3896         * output.h (Output_file::open_for_modification): Rename to...
3897         (Output_file::open_base_file): ...this; add base_name and
3898         writable parameters; adjust all callers.
3899         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3900         callers.
3901         * testsuite/Makefile.am (incremental_test_4): Test
3902         --incremental-base.
3903         * testsuite/Makefile.in: Regenerate.
3904
3905 2011-05-24 Cary Coutant  <ccoutant@google.com>
3906
3907         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3908         incremental_test_4.
3909         * testsuite/Makefile.in: Regenerate.
3910         * testsuite/two_file_test_1_v1.cc: New test source file.
3911         * testsuite/two_file_test_1b_v1.cc: New test source file.
3912         * testsuite/two_file_test_2_v1.cc: New test source file.
3913
3914 2011-05-24 Cary Coutant  <ccoutant@google.com>
3915
3916         * dynobj.h (Dynobj::do_dynobj): New function.
3917         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3918         flag and soname for shared objects.
3919         * incremental.cc (Incremental_inputs::report_object): Make
3920         either Incremental_object_entry or Incremental_dynobj_entry; add
3921         soname to string table.
3922         (Incremental_inputs::report_input_section): Add assertion.
3923         (Output_section_incremental_inputs::set_final_data_size): Adjust
3924         type of input file entry for shared libraries; adjust size of
3925         shared library info entry.
3926         (Output_section_incremental_inputs::write_input_files): Write
3927         as_needed flag for shared libraries.
3928         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3929         of input file entry for shared libraries; write soname.
3930         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3931         soname from incremental info.
3932         * incremental.h (enum Incremental_input_flags): Add
3933         INCREMENTAL_INPUT_AS_NEEDED.
3934         (Incremental_input_entry::Incremental_input_entry): Initialize new
3935         data member.
3936         (Incremental_input_entry::set_as_needed): New function.
3937         (Incremental_input_entry::as_needed): New function.
3938         (Incremental_input_entry::do_dynobj_entry): New function.
3939         (Incremental_input_entry::as_needed_): New data member.
3940         (Incremental_object_entry::Incremental_object_entry): Don't check
3941         for shared library.
3942         (Incremental_object_entry::do_type): Likewise.
3943         (class Incremental_dynobj_entry): New class.
3944         (Incremental_input_entry_reader::as_needed): New function.
3945         (Incremental_input_entry_reader::get_soname): New function.
3946         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3947         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3948         size of shared library info entry.
3949         * layout.cc (Layout::finish_dynamic_section): Don't test for
3950         incremental link when adding DT_NEEDED entries.
3951         * object.h (Object::Object): Initialize new data member.
3952         (Object::dynobj): New function.
3953         (Object::set_as_needed): New function.
3954         (Object::as_needed): New function.
3955         (Object::do_dynobj): New function.
3956         (Object::as_needed_): New data member.
3957
3958 2011-05-24 Cary Coutant  <ccoutant@google.com>
3959
3960         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3961         info; adjust display of GOT entries.
3962         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3963         vector of input objects; remove file_status_.
3964         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3965         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3966         got_plt reader; call target hooks to reserve GOT entries.
3967         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3968         of input file info header and GOT info entry.
3969         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3970         relocation info.
3971         (Got_plt_view_info::got_descriptor): Remove.
3972         (Got_plt_view_info::sym_index): New data member.
3973         (Got_plt_view_info::input_index): New data member.
3974         (Local_got_offset_visitor::visit): Write input file index.
3975         (Global_got_offset_visitor::visit): Write 0 for input file index.
3976         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3977         with sym_index and input_index.
3978         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3979         incremental info GOT entry; replace got_descriptor with input_index.
3980         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3981         map from input file index to object.
3982         (Sized_relobj_incr::do_layout): Replace direct data member reference
3983         with accessor function.
3984         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3985         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3986         Adjust size of input file info header.
3987         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3988         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3989         (Incremental_input_entry_reader::get_input_section): Adjust size of
3990         input file info header.
3991         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3992         of incremental info GOT entry.
3993         (Incremental_got_plt_reader::get_got_desc): Remove.
3994         (Incremental_got_plt_reader::get_got_symndx): New function.
3995         (Incremental_got_plt_reader::get_got_input_index): New function.
3996         (Sized_incremental_binary::Sized_incremental_binary): Remove
3997         file_status_; add input_objects_.
3998         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3999         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4000         (Sized_incremental_binary::file_is_unchanged): Remove.
4001         (Sized_incremental_binary::set_input_object): New function.
4002         (Sized_incremental_binary::input_object): New function.
4003         (Sized_incremental_binary::file_status_): Remove.
4004         (Sized_incremental_binary::input_objects_): New data member.
4005         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4006         references.
4007         (Sized_relobj_incr::invalid_address): Move to base class.
4008         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4009         class.
4010         (Sized_relobj_incr::do_output_section_offset): Likewise.
4011         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4012         (Sized_relobj_incr::section_offsets_): Likewise.
4013         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4014         function.
4015         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4016         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4017         with accessor function.
4018         (Sized_relobj_file::do_layout): Likewise.
4019         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4020         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4021         (Sized_relobj_file::compute_final_local_value): Replace refs to
4022         section_offsets_ with accessor function.
4023         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4024         * object.h (Relobj::Relobj): Initialize new data members.
4025         (Relobj::add_dyn_reloc): New function.
4026         (Relobj::first_dyn_reloc): New function.
4027         (Relobj::dyn_reloc_count): New function.
4028         (Relobj::first_dyn_reloc_): New data member.
4029         (Relobj::dyn_reloc_count_): New data member.
4030         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4031         references.
4032         (Sized_relobj::Address): New typedef.
4033         (Sized_relobj::invalid_address): Move here from child class.
4034         (Sized_relobj::Sized_relobj): Initialize new data members.
4035         (Sized_relobj::sized_relobj): New function.
4036         (Sized_relobj::is_output_section_offset_invalid): Move here from
4037         child class.
4038         (Sized_relobj::get_output_section_offset): Likewise.
4039         (Sized_relobj::local_has_got_offset): Likewise.
4040         (Sized_relobj::local_got_offset): Likewise.
4041         (Sized_relobj::set_local_got_offset): Likewise.
4042         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4043         (Sized_relobj::clear_got_offsets): New function.
4044         (Sized_relobj::section_offsets): Move here from child class.
4045         (Sized_relobj::do_output_section_offset): Likewise.
4046         (Sized_relobj::do_set_section_offset): Likewise.
4047         (Sized_relobj::Local_got_offsets): Likewise.
4048         (Sized_relobj::local_got_offsets_): Likewise.
4049         (Sized_relobj::section_offsets_): Likewise.
4050         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4051         references.
4052         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4053         class.
4054         (Sized_relobj_file::sized_relobj): New function
4055         (Sized_relobj_file::local_has_got_offset): Move to base class.
4056         (Sized_relobj_file::local_got_offset): Likewise.
4057         (Sized_relobj_file::set_local_got_offset): Likewise.
4058         (Sized_relobj_file::get_output_section_offset): Likewise.
4059         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4060         (Sized_relobj_file::do_output_section_offset): Likewise.
4061         (Sized_relobj_file::do_set_section_offset): Likewise.
4062         (Sized_relobj_file::Local_got_offsets): Likewise.
4063         (Sized_relobj_file::local_got_offsets_): Likewise.
4064         (Sized_relobj_file::section_offsets_): Likewise.
4065         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4066         (all constructors).
4067         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4068         (Output_reloc::get_symbol_index): Likewise.
4069         (Output_reloc::local_section_offset): Likewise.
4070         (Output_reloc::get_address): Likewise.
4071         (Output_reloc::symbol_value): Likewise.
4072         (Output_data_got::reserve_slot): Move to class definition.
4073         (Output_data_got::reserve_local): New function.
4074         (Output_data_got::reserve_slot_for_global): Remove.
4075         (Output_data_got::reserve_global): New function.
4076         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4077         (all constructors, two instantiations).
4078         (Output_reloc::get_relobj): New function (two instantiations).
4079         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4080         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4081         (Output_data_reloc::add_global): Adjust type of relobj.
4082         (Output_data_reloc::add_global_relative): Likewise.
4083         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4084         (Output_data_reloc::add_local): Likewise.
4085         (Output_data_reloc::add_local_relative): Likewise.
4086         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4087         (Output_data_reloc::add_local_section): Likewise.
4088         (Output_data_reloc::add_output_section): Likewise.
4089         (Output_data_reloc::add_absolute): Likewise.
4090         (Output_data_reloc::add_target_specific): Likewise.
4091         (Output_data_got::reserve_slot): Move definition here.
4092         (Output_data_got::reserve_local): New function.
4093         (Output_data_got::reserve_global): New function.
4094         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4095         section_offsets_ with accessor function.
4096         (Sized_relobj_file::write_sections): Likewise.
4097         (Sized_relobj_file::do_relocate_sections): Likewise.
4098         * target.h (Sized_target::reserve_local_got_entry): New function.
4099         (Sized_target::reserve_global_got_entry): New function.
4100         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4101         (Target_x86_64::reserve_global_got_entry): New function.
4102         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4103
4104 2011-05-23 Cary Coutant  <ccoutant@google.com>
4105
4106         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4107         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4108         bit when checking got_type.
4109         * incremental.cc (Sized_incremental_binary::setup_readers):
4110         Store symbol table and string table locations; initialize bit vector
4111         of file status flags.
4112         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4113         unchanged files.
4114         (Sized_incremental_binary::do_process_got_plt): New function.
4115         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4116         (Output_section_incremental_inputs::set_final_data_size): Record
4117         file index for each input file.
4118         (Output_section_incremental_inputs::write_got_plt): Store file index
4119         instead of input entry offset for each GOT entry.
4120         * incremental.h
4121         (Incremental_input_entry::Incremental_input_entry): Initialize new
4122         data member.
4123         (Incremental_input_entry::set_offset): Store file index.
4124         (Incremental_input_entry::get_file_index): New function.
4125         (Incremental_input_entry::file_index_): New data member.
4126         (Incremental_binary::process_got_plt): New function.
4127         (Incremental_binary::do_process_got_plt): New function.
4128         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4129         data members.
4130         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4131         (Sized_incremental_binary::set_file_is_unchanged): New function.
4132         (Sized_incremental_binary::file_is_unchanged): New function.
4133         (Sized_incremental_binary::do_process_got_plt): New function.
4134         (Sized_incremental_binary::file_status_): New data member.
4135         (Sized_incremental_binary::main_symtab_loc_): New data member.
4136         (Sized_incremental_binary::main_strtab_loc_): New data member.
4137         * output.cc (Output_data_got::Got_entry::write): Add case
4138         RESERVED_CODE.
4139         (Output_data_got::add_global): Call add_got_entry.
4140         (Output_data_got::add_global_plt): Likewise.
4141         (Output_data_got::add_global_with_rel): Likewise.
4142         (Output_data_got::add_global_with_rela): Likewise.
4143         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4144         (Output_data_got::add_global_pair_with_rela): Likewise.
4145         (Output_data_got::add_local): Call add_got_entry.
4146         (Output_data_got::add_local_plt): Likewise.
4147         (Output_data_got::add_local_with_rel): Likewise.
4148         (Output_data_got::add_local_with_rela): Likewise.
4149         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4150         (Output_data_got::add_local_pair_with_rela): Likewise.
4151         (Output_data_got::reserve_slot): New function.
4152         (Output_data_got::reserve_slot_for_global): New function.
4153         (Output_data_got::add_got_entry): New function.
4154         (Output_data_got::add_got_entry_pair): New function.
4155         (Output_section::add_output_section_data): Edit FIXME.
4156         * output.h
4157         (Output_section_data_build::Output_section_data_build): New
4158         constructor with size parameter.
4159         (Output_data_space::Output_data_space): Likewise.
4160         (Output_data_got::Output_data_got): Initialize new data member; new
4161         constructor with size parameter.
4162         (Output_data_got::add_constant): Call add_got_entry.
4163         (Output_data_got::reserve_slot): New function.
4164         (Output_data_got::reserve_slot_for_global): New function.
4165         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4166         (Output_data_got::add_got_entry): New function.
4167         (Output_data_got::add_got_entry_pair): New function.
4168         (Output_data_got::free_list_): New data member.
4169         * target.h (Sized_target::init_got_plt_for_update): New function.
4170         (Sized_target::register_global_plt_entry): New function.
4171         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4172         Initialize new data member; call init; add constructor with PLT count.
4173         (Output_data_plt_x86_64::init): New function.
4174         (Output_data_plt_x86_64::add_relocation): New function.
4175         (Output_data_plt_x86_64::reserve_slot): New function.
4176         (Output_data_plt_x86_64::free_list_): New data member.
4177         (Target_x86_64::init_got_plt_for_update): New function.
4178         (Target_x86_64::register_global_plt_entry): New function.
4179         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4180         incremental updates.
4181         (Output_data_plt_x86_64::add_relocation): New function.
4182         * testsuite/object_unittest.cc (Object_test): Set default options.
4183
4184 2011-05-16  Ian Lance Taylor  <iant@google.com>
4185
4186         * options.h (class General_options): Make -i a synonym for -r.
4187
4188 2011-05-16  Ian Lance Taylor  <iant@google.com>
4189
4190         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4191
4192 2011-05-10 Cary Coutant  <ccoutant@google.com>
4193
4194         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4195         strip_all (-s).
4196
4197 2011-05-06  Ian Lance Taylor  <iant@google.com>
4198
4199         * layout.cc (Layout::layout): If the output section flags change,
4200         update the ordering.
4201
4202 2011-04-25 Cary Coutant  <ccoutant@google.com>
4203
4204         * incremental-dump.cc (dump_incremental_inputs): Print local
4205         symbol info for each input file.
4206         * incremental.cc
4207         (Output_section_incremental_inputs::set_final_data_size): Add local
4208         symbol info to input file entries in incremental info.
4209         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4210         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4211         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4212         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4213         implementation.
4214         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4215         (Sized_incr_relobj::do_relocate): Write the local symbols.
4216         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4217         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4218         Adjust size of input file header.
4219         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4220         (Incremental_inputs_reader::get_local_symbol_count): New function.
4221         (Incremental_inputs_reader::get_input_section): Adjust size of input
4222         file header.
4223         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4224         (Sized_incr_relobj::This): New typedef.
4225         (Sized_incr_relobj::sym_size): New const data member.
4226         (Sized_incr_relobj::Local_symbol): New struct.
4227         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4228         (Sized_incr_relobj::do_local_symbol_offset): New function.
4229         (Sized_incr_relobj::local_symbol_count_): New data member.
4230         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4231         (Sized_incr_relobj::local_symbol_index_): New data member.
4232         (Sized_incr_relobj::local_symbol_offset_): New data member.
4233         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4234         (Sized_incr_relobj::local_symbols_): New data member.
4235         * object.h (Relobj::output_local_symbol_count): New function.
4236         (Relobj::local_symbol_offset): New function.
4237         (Relobj::do_output_local_symbol_count): New function.
4238         (Relobj::do_local_symbol_offset): New function.
4239         (Sized_relobj::do_output_local_symbol_count): New function.
4240         (Sized_relobj::do_local_symbol_offset): New function.
4241
4242 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4243
4244         * descriptors.cc (set_close_on_exec): New function.
4245         (Descriptors::open): Use set_close_on_exec.
4246         * output.cc (S_ISLNK): Define if not defined.
4247
4248 2011-04-22 Cary Coutant  <ccoutant@google.com>
4249
4250         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4251         global symbol map.
4252         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4253         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4254         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4255         relocations.
4256         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4257         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4258         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4259         * incremental.h
4260         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4261         function.
4262         (Incremental_binary::apply_incremental_relocs): New function.
4263         (Incremental_binary::do_apply_incremental_relocs): New function.
4264         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4265         data member.
4266         (Sized_incremental_binary::add_global_symbol): New function.
4267         (Sized_incremental_binary::global_symbol): New function.
4268         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4269         (Sized_incremental_binary::symbol_map_): New data member.
4270         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4271         * target.h (Sized_target::apply_relocation): New function.
4272         * target-reloc.h (apply_relocation): New function.
4273         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4274
4275 2011-04-22  Doug Kwan  <dougkwan@google.com>
4276
4277         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4278         flag of a SHT_ARM_EXIDX section.
4279         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4280         * testsuite/Makefile.in: Regenerate.
4281         * testsuite/arm_exidx_test.s: New file.
4282         * testsuite/arm_exidx_test.sh: Same.
4283
4284 2011-04-20 Cary Coutant  <ccoutant@google.com>
4285
4286         PR gold/12689
4287         * archive.h (Incremental_archive_entry::Archive_member):
4288         Initialize arg_serial_ (second constructor).
4289
4290 2011-04-17  Ian Lance Taylor  <iant@google.com>
4291
4292         * object.cc (Relocate_info::location): Simplify location string.
4293         * errors.cc (Errors::error_at_location): Don't print program
4294         name.
4295         (Errors::warning_at_location): Likewise.
4296         (Errors::undefined_symbol): Likewise.
4297         * testsuite/debug_msg.sh: Update accordingly.
4298
4299 2011-04-14 Cary Coutant  <ccoutant@google.com>
4300
4301         * gold/layout.cc (Layout::symtab_section_offset): New function.
4302         * gold/layout.h (Layout::symtab_section_offset): New function.
4303         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4304
4305 2011-04-12  Ian Lance Taylor  <iant@google.com>
4306
4307         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4308         with MREMAP_MAYMOVE.
4309         * output.h (class Output_file): Add map_is_allocated_ field.
4310         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4311         not available, provide stubs.  If mremap is not available, #define
4312         it to gold_mremap.
4313         (MREMAP_MAYMOVE): Define if not defined.
4314         (Output_file::Output_file): Initialize map_is_allocated_.
4315         (Output_file::resize): Check map_is_allocated_.
4316         (Output_file::map_anonymous): If mmap fails, use malloc.
4317         (Output_file::unmap): Don't do anything for an anonymous map.
4318         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4319         is not available, provide stubs.
4320         (File_read::View::~View): Use free rather than delete[].
4321         (File_read::make_view): Use malloc rather than new[].  If mmap
4322         fails, use malloc.
4323         (File_read::find_or_make_view): Use malloc rather than new[].
4324         * gold.h: Remove HAVE_REMAP code.
4325         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4326         exists.  Rename mremap to gold_mremap.  If mmap is not available
4327         don't do anything.
4328         * configure, config.in: Rebuild.
4329
4330 2011-04-11  Ian Lance Taylor  <iant@google.com>
4331
4332         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4333         initialize local variable v.
4334
4335 2011-04-11  Cary Coutant  <ccoutant@google.com>
4336
4337         * archive.cc (Archive::include_member): Adjust call to
4338         report_object.
4339         (Add_archive_symbols::run): Track argument serial numbers.
4340         (Lib_group::include_member): Likewise.
4341         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4342         * archive.h (Incremental_archive_entry::Archive_member):
4343         Initialize arg_serial_.
4344         (Archive_member::arg_serial_): New data member.
4345         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4346         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4347         incremental link.
4348         (Sized_dynobj::do_for_all_local_got_entries): New function.
4349         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4350         function.
4351         * fileread.cc (get_mtime): New function.
4352         * fileread.h (get_mtime): New function.
4353         * gold.cc (queue_initial_tasks): Check for incremental update.
4354         (process_incremental_input): New function.
4355         (queue_middle_tasks): Don't force valid target for incremental
4356         update.
4357         * incremental-dump.cc (find_input_containing_global): Adjust
4358         size of symbol info entry.
4359         (dump_incremental_inputs): Dump argument serial number and
4360         in_system_directory flag; bias shndx by 1; print symbol names
4361         when dumping per-file symbol lists; use new symbol info readers.
4362         * incremental.cc
4363         (Output_section_incremental_inputs:update_data_size): New function.
4364         (Sized_incremental_binary::setup_readers): Setup input readers
4365         for each input file; build maps for files added from libraries
4366         and scripts.
4367         (Sized_incremental_binary::check_input_args): New function.
4368         (Sized_incremental_binary::do_check_inputs): Build map of argument
4369         serial numbers to input arguments.
4370         (Sized_incremental_binary::do_file_has_changed): Rename
4371         do_file_is_unchanged to this; compare file modification times.
4372         (Sized_incremental_binary::do_init_layout): New function.
4373         (Sized_incremental_binary::do_reserve_layout): New function.
4374         (Sized_incremental_binary::do_get_input_reader): Remove.
4375         (Sized_incremental_binary::get_symtab_view): New function.
4376         (Incremental_checker::can_incrementally_link_output_file): Remove.
4377         (Incremental_inputs::report_command_line): Exclude --debug options.
4378         (Incremental_inputs::report_archive_begin): Add parameter; track
4379         argument serial numbers; don't put input file entry for archive
4380         before archive members.
4381         (Incremental_inputs::report_archive_end): Put input file entry
4382         for archive after archive members.
4383         (Incremental_inputs::report_object): Add parameter; track argument
4384         serial numbers and in_system_directory flag.
4385         (Incremental_inputs::report_script): Add parameter; track argument
4386         serial numbers.
4387         (Output_section_incremental_inputs::set_final_data_size): Adjust
4388         size of symbol info entry; check for forwarding symbols.
4389         (Output_section_incremental_inputs::write_input_files): Write
4390         in_system_directory flag and argument serial number.
4391         (Output_section_incremental_inputs::write_info_blocks): Map section
4392         indices between incremental info and original input file; store
4393         input section index for each symbol.
4394         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4395         change operator() to visit().
4396         (class Global_got_offset_visitor): Likewise.
4397         (class Global_symbol_visitor_got_plt):
4398         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4399         classes.
4400         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4401         (Sized_incr_relobj::do_read_symbols): New function.
4402         (Sized_incr_relobj::do_layout): New function.
4403         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4404         (Sized_incr_relobj::do_add_symbols): New function.
4405         (Sized_incr_relobj::do_should_include_member): New function.
4406         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4407         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4408         (Sized_incr_relobj::do_section_size): New function.
4409         (Sized_incr_relobj::do_section_name): New function.
4410         (Sized_incr_relobj::do_section_contents): New function.
4411         (Sized_incr_relobj::do_section_flags): New function.
4412         (Sized_incr_relobj::do_section_entsize): New function.
4413         (Sized_incr_relobj::do_section_address): New function.
4414         (Sized_incr_relobj::do_section_type): New function.
4415         (Sized_incr_relobj::do_section_link): New function.
4416         (Sized_incr_relobj::do_section_info): New function.
4417         (Sized_incr_relobj::do_section_addralign): New function.
4418         (Sized_incr_relobj::do_initialize_xindex): New function.
4419         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4420         (Sized_incr_relobj::do_read_relocs): New function.
4421         (Sized_incr_relobj::do_gc_process_relocs): New function.
4422         (Sized_incr_relobj::do_scan_relocs): New function.
4423         (Sized_incr_relobj::do_count_local_symbols): New function.
4424         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4425         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4426         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4427         (Sized_incr_relobj::do_relocate): New function.
4428         (Sized_incr_relobj::do_set_section_offset): New function.
4429         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4430         (Sized_incr_dynobj::do_read_symbols): New function.
4431         (Sized_incr_dynobj::do_layout): New function.
4432         (Sized_incr_dynobj::do_add_symbols): New function.
4433         (Sized_incr_dynobj::do_should_include_member): New function.
4434         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4435         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4436         (Sized_incr_dynobj::do_section_size): New function.
4437         (Sized_incr_dynobj::do_section_name): New function.
4438         (Sized_incr_dynobj::do_section_contents): New function.
4439         (Sized_incr_dynobj::do_section_flags): New function.
4440         (Sized_incr_dynobj::do_section_entsize): New function.
4441         (Sized_incr_dynobj::do_section_address): New function.
4442         (Sized_incr_dynobj::do_section_type): New function.
4443         (Sized_incr_dynobj::do_section_link): New function.
4444         (Sized_incr_dynobj::do_section_info): New function.
4445         (Sized_incr_dynobj::do_section_addralign): New function.
4446         (Sized_incr_dynobj::do_initialize_xindex): New function.
4447         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4448         (make_sized_incremental_object): New function.
4449         (Incremental_library::copy_unused_symbols): New function.
4450         (Incremental_library::do_for_all_unused_symbols): New function.
4451         * incremental.h (enum Incremental_input_flags): New type.
4452         (class Incremental_checker): Remove.
4453         (Incremental_input_entry::Incremental_input_entry): Add argument
4454         serial number.
4455         (Incremental_input_entry::arg_serial): New function.
4456         (Incremental_input_entry::set_is_in_system_directory): New function.
4457         (Incremental_input_entry::is_in_system_directory): New function.
4458         (Incremental_input_entry::arg_serial_): New data member.
4459         (Incremental_input_entry::is_in_system_directory_): New data member.
4460         (class Script_info): Move here from script.h.
4461         (Script_info::Script_info): Add filename parameter.
4462         (Script_info::filename): New function.
4463         (Script_info::filename_): New data member.
4464         (Incremental_script_entry::Incremental_script_entry): Add argument
4465         serial number.
4466         (Incremental_object_entry::Incremental_object_entry): Likewise.
4467         (Incremental_object_entry::add_input_section): Build list of input
4468         sections with map to original shndx.
4469         (Incremental_object_entry::get_input_section_index): New function.
4470         (Incremental_object_entry::shndx_): New data member.
4471         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4472         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4473         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4474         serial number.
4475         (Incremental_inputs::report_archive_begin): Likewise.
4476         (Incremental_inputs::report_object): Likewise.
4477         (Incremental_inputs::report_script): Likewise.
4478         (class Incremental_global_symbol_reader): New class.
4479         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4480         and store flags and input file type.
4481         (Incremental_input_entry_reader::arg_serial): New function.
4482         (Incremental_input_entry_reader::type): Extract type from flags.
4483         (Incremental_input_entry_reader::is_in_system_directory): New function.
4484         (Incremental_input_entry_reader::get_input_section_count): Call
4485         accessor function for type.
4486         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4487         function for type; adjust size of global symbol entry.
4488         (Incremental_input_entry_reader::get_global_symbol_count): Call
4489         accessor function for type.
4490         (Incremental_input_entry_reader::get_object_count): Likewise.
4491         (Incremental_input_entry_reader::get_object_offset): Likewise.
4492         (Incremental_input_entry_reader::get_member_count): Likewise.
4493         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4494         (Incremental_input_entry_reader::get_member_offset): Likewise.
4495         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4496         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4497         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4498         (Incremental_input_entry_reader::get_global_symbol_reader): New
4499         function.
4500         (Incremental_input_entry_reader::get_output_symbol_index): New
4501         function.
4502         (Incremental_input_entry_reader::type_): Remove.
4503         (Incremental_input_entry_reader::flags_): New data member.
4504         (Incremental_inputs_reader::input_file_offset): New function.
4505         (Incremental_inputs_reader::input_file_index): New function.
4506         (Incremental_inputs_reader::input_file): Call input_file_offset.
4507         (Incremental_inputs_reader::input_file_at_offset): New function.
4508         (Incremental_relocs_reader::get_r_type): Reformat.
4509         (Incremental_relocs_reader::get_r_shndx): Reformat.
4510         (Incremental_relocs_reader::get_r_offset): Reformat.
4511         (Incremental_relocs_reader::data): New function.
4512         (Incremental_binary::Incremental_binary): Initialize new data members.
4513         (Incremental_binary::check_inputs): Add cmdline parameter.
4514         (Incremental_binary::file_is_unchanged): Remove.
4515         (Input_reader::arg_serial): New function.
4516         (Input_reader::get_unused_symbol_count): New function.
4517         (Input_reader::get_unused_symbol): New function.
4518         (Input_reader::do_arg_serial): New function.
4519         (Input_reader::do_get_unused_symbol_count): New function.
4520         (Input_reader::do_get_unused_symbol): New function.
4521         (Incremental_binary::input_file_count): New function.
4522         (Incremental_binary::get_input_reader): Change signature to use
4523         index instead of filename.
4524         (Incremental_binary::file_has_changed): New function.
4525         (Incremental_binary::get_input_argument): New function.
4526         (Incremental_binary::get_library): New function.
4527         (Incremental_binary::get_script_info): New function.
4528         (Incremental_binary::init_layout): New function.
4529         (Incremental_binary::reserve_layout): New function.
4530         (Incremental_binary::output_file): New function.
4531         (Incremental_binary::do_check_inputs): New function.
4532         (Incremental_binary::do_file_is_unchanged): Remove.
4533         (Incremental_binary::do_file_has_changed): New function.
4534         (Incremental_binary::do_init_layout): New function.
4535         (Incremental_binary::do_reserve_layout): New function.
4536         (Incremental_binary::do_input_file_count): New function.
4537         (Incremental_binary::do_get_input_reader): Change signature.
4538         (Incremental_binary::input_args_map_): New data member.
4539         (Incremental_binary::library_map_): New data member.
4540         (Incremental_binary::script_map_): New data member.
4541         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4542         new data members.
4543         (Sized_incremental_binary::output_section): New function.
4544         (Sized_incremental_binary::inputs_reader): Add const.
4545         (Sized_incremental_binary::symtab_reader): Add const.
4546         (Sized_incremental_binary::relocs_reader): Add const.
4547         (Sized_incremental_binary::got_plt_reader): Add const.
4548         (Sized_incremental_binary::get_symtab_view): New function.
4549         (Sized_incremental_binary::Inputs_reader): New typedef.
4550         (Sized_incremental_binary::Input_entry_reader): New typedef.
4551         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4552         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4553         (Sized_incremental_binary::do_file_has_changed): New function.
4554         (Sized_incremental_binary::do_init_layout): New function.
4555         (Sized_incremental_binary::do_reserve_layout): New function.
4556         (Sized_input_reader::Inputs_reader): Remove.
4557         (Sized_input_reader::Input_entry_reader): Remove.
4558         (Sized_input_reader::do_arg_serial): New function.
4559         (Sized_input_reader::do_get_unused_symbol_count): New function.
4560         (Sized_input_reader::do_get_unused_symbol): New function.
4561         (Sized_incremental_binary::do_input_file_count): New function.
4562         (Sized_incremental_binary::do_get_input_reader): Change signature;
4563         use index instead of filename.
4564         (Sized_incremental_binary::section_map_): New data member.
4565         (Sized_incremental_binary::input_entry_readers_): New data member.
4566         (class Sized_incr_relobj): New class.
4567         (class Sized_incr_dynobj): New class.
4568         (make_sized_incremental_object): New function.
4569         (class Incremental_library): New class.
4570         * layout.cc (Free_list::num_lists): New static data member.
4571         (Free_list::num_nodes): New static data member.
4572         (Free_list::num_removes): New static data member.
4573         (Free_list::num_remove_visits): New static data member.
4574         (Free_list::num_allocates): New static data member.
4575         (Free_list::num_allocate_visits): New static data member.
4576         (Free_list::init): New function.
4577         (Free_list::remove): New function.
4578         (Free_list::allocate): New function.
4579         (Free_list::dump): New function.
4580         (Free_list::print_stats): New function.
4581         (Layout_task_runner::run): Resize output file for incremental updates.
4582         (Layout::Layout): Initialize new data members.
4583         (Layout::set_incremental_base): New function.
4584         (Layout::init_fixed_output_section): New function.
4585         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4586         incremental updates.
4587         (Layout::create_gold_note): Do not create gold note section for
4588         incremental updates.
4589         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4590         for incremental updates.
4591         (Layout::set_section_offsets): For incremental updates, allocate space
4592         from free list.
4593         (Layout::create_symtab_sections): Layout with offsets relative to
4594         start of section; for incremental updates, allocate space from free
4595         list.
4596         (Layout::create_shdrs): For incremental updates, allocate space from
4597         free list.
4598         (Layout::finish_dynamic_section): For incremental updates, do not
4599         check --as-needed (fixed in subsequent patch).
4600         * layout.h (class Free_list): New class.
4601         (Layout::set_incremental_base): New function.
4602         (Layout::incremental_base): New function.
4603         (Layout::init_fixed_output_section): New function.
4604         (Layout::allocate): New function.
4605         (Layout::incremental_base_): New data member.
4606         (Layout::free_list_): New data member.
4607         * main.cc (main): Print Free_list statistics.
4608         * object.cc (Relobj::finalize_incremental_relocs): Add
4609         clear_counts parameter; clear counts only when clear_counts is set.
4610         (Sized_relobj::Sized_relobj): Initialize new base class.
4611         (Sized_relobj::do_layout): Don't report special sections.
4612         (Sized_relobj::do_for_all_local_got_entries): New function.
4613         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4614         symtab_off to all symbol table offsets.
4615         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4616         * object.h (class Got_offset_list): Move to top of file.
4617         (Object::Object): Allow case where input_file == NULL.
4618         (Object::~Object): Likewise.
4619         (Object::input_file): Assert that input_file != NULL.
4620         (Object::lock): Allow case where input_file == NULL.
4621         (Object::unlock): Likewise.
4622         (Object::is_locked): Likewise.
4623         (Object::token): Likewise.
4624         (Object::release): Likewise.
4625         (Object::is_incremental): New function.
4626         (Object::get_mtime): New function.
4627         (Object::for_all_local_got_entries): New function.
4628         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4629         (Object::set_is_in_system_directory): New function.
4630         (Object::is_in_system_directory): New function.
4631         (Object::do_is_incremental): New function.
4632         (Object::do_get_mtime): New function.
4633         (Object::do_for_all_local_got_entries): New function.
4634         (Object::is_in_system_directory_): New data member.
4635         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4636         (class Sized_relobj_base): New class.
4637         (class Sized_relobj): Derive from Sized_relobj_base.
4638         (class Sized_relobj::Symbols): Redeclare from base class.
4639         (class Sized_relobj::local_got_offset_list): Remove.
4640         (class Sized_relobj::Output_sections): Redeclare from base class.
4641         (class Sized_relobj::do_for_all_local_got_entries): New function.
4642         (class Sized_relobj::write_local_symbols): Add offset parameter.
4643         (class Sized_relobj::local_symbol_offset_): Update comment.
4644         (class Sized_relobj::local_dynsym_offset_): Update comment.
4645         * options.cc (Input_arguments::add_file): Remove const.
4646         * options.h (Input_file_argument::Input_file_argument):
4647         Initialize arg_serial_ (all constructors).
4648         (Input_file_argument::set_arg_serial): New function.
4649         (Input_file_argument::arg_serial): New function.
4650         (Input_file_argument::arg_serial_): New data member.
4651         (Input_arguments::Input_arguments): Initialize file_count_.
4652         (Input_arguments::add_file): Remove const.
4653         (Input_arguments::number_of_input_files): New function.
4654         (Input_arguments::file_count_): New data member.
4655         (Command_line::number_of_input_files): Call
4656         Input_arguments::number_of_input_files.
4657         * output.cc (Output_segment_headers::Output_segment_headers):
4658         Set current size.
4659         (Output_section::Input_section::current_data_size): New function.
4660         (Output_section::Output_section): Initialize new data members.
4661         (Output_section::add_input_section): Don't do merge sections for
4662         an incremental link; allocate space from free list for an
4663         incremental update.
4664         (Output_section::add_output_section_data): Allocate space from
4665         free list for an incremental update.
4666         (Output_section::update_data_size): New function.
4667         (Output_section::set_fixed_layout): New function.
4668         (Output_section::reserve): New function.
4669         (Output_segment::set_section_addresses): Remove const.
4670         (Output_segment::set_section_list_addresses): Remove const; allocate
4671         space from free list for an incremental update.
4672         (Output_segment::set_offset): Adjust size of RELRO segment for an
4673         incremental update.
4674         * output.h (Output_data::current_data_size): Move here from
4675         child classes.
4676         (Output_data::pre_finalize_data_size): New function.
4677         (Output_data::update_data_size): New function.
4678         (Output_section_headers::update_data_size): new function.
4679         (Output_section_data_build::current_data_size): Move to Output_data.
4680         (Output_data_strtab::update_data_size): New function.
4681         (Output_section::current_data_size): Move to Output_data.
4682         (Output_section::set_fixed_layout): New function.
4683         (Output_section::has_fixed_layout): New function.
4684         (Output_section::reserve): New function.
4685         (Output_section::update_data_size): New function.
4686         (Output_section::has_fixed_layout_): New data member.
4687         (Output_section::free_list_): New data member.
4688         (Output_segment::set_section_addresses): Remove const.
4689         (Output_segment::set_section_list_addresses): Remove const.
4690         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4691         New function.
4692         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4693         New function.
4694         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4695         parameter when calling Add_symbols constructor; store argument
4696         serial number for members of a lib group.
4697         (Add_symbols::locks): Allow case where token == NULL.
4698         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4699         (Read_member::~Read_member): New function.
4700         (Read_member::is_runnable): New function.
4701         (Read_member::locks): New function.
4702         (Read_member::run): New function.
4703         (Check_script::~Check_script): New function.
4704         (Check_script::is_runnable): New function.
4705         (Check_script::locks): New function.
4706         (Check_script::run): New function.
4707         (Check_library::~Check_library): New function.
4708         (Check_library::is_runnable): New function.
4709         (Check_library::locks): New function.
4710         (Check_library::run): New function.
4711         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4712         (Add_symbols::library_): New data member.
4713         (class Read_member): New class.
4714         (class Check_script): New class.
4715         (class Check_library): New class.
4716         * reloc.cc (Read_relocs::is_runnable): Allow case where
4717         token == NULL.
4718         (Read_relocs::locks): Likewise.
4719         (Scan_relocs::locks): Likewise.
4720         (Relocate_task::locks): Likewise.
4721         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4722         to clear counters.
4723         (Sized_relobj::incremental_relocs_scan): Fix comment.
4724         (Sized_relobj::do_relocate): Pass output file offset to
4725         write_local_symbols.
4726         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4727         from class declaration.
4728         * script.cc (read_input_script): Allocate Script_info; pass
4729         argument serial number to report_script.
4730         * script.h (class Script_info): Move to incremental.h.
4731         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4732         * symtab.h (Symbol_table::add_from_incrobj): New function.
4733         (Symbol_table::set_file_offset): New function.
4734
4735 2011-04-05  Cary Coutant  <ccoutant@google.com>
4736
4737         * incremental-dump.cc (dump_incremental_inputs): Change signature
4738         to take a Sized_incremental_binary; change caller.  Use readers
4739         in Sized_incremental_binary.
4740         * incremental.cc
4741         (Sized_incremental_binary::find_incremental_inputs_sections):
4742         Rename do_find_incremental_inputs_sections to this.
4743         (Sized_incremental_binary::setup_readers): New function.
4744         (Sized_incremental_binary::do_check_inputs): Check
4745         has_incremental_info_ flag; move setup code to setup_readers;
4746         use input readers.
4747         (Sized_incremental_binary::do_file_is_unchanged): New function.
4748         (Sized_incremental_binary::do_get_input_reader): New function.
4749         * incremental.h (class Incremental_binary): Move to end of file.
4750         (Incremental_binary::file_is_unchanged): New function.
4751         (Incremental_binary::do_file_is_unchanged): New function.
4752         (Incremental_binary::Input_reader): New class.
4753         (Incremental_binary::get_input_reader): New function.
4754         (class Sized_incremental_binary): Move to end of file.
4755         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4756         input section reader classes.
4757         (Sized_incremental_binary::has_incremental_info): New function.
4758         (Sized_incremental_binary::inputs_reader): New function.
4759         (Sized_incremental_binary::symtab_reader): New function.
4760         (Sized_incremental_binary::relocs_reader): New function.
4761         (Sized_incremental_binary::got_plt_reader): New function.
4762         (Sized_incremental_binary::do_file_is_unchanged): New function.
4763         (Sized_incremental_binary::Sized_input_reader): New class.
4764         (Sized_incremental_binary::get_input_reader): New function.
4765         (Sized_incremental_binary::find_incremental_inputs_sections):
4766         Rename do_find_incremental_inputs_sections to this.
4767         (Sized_incremental_binary::setup_readers): New function.
4768         (Sized_incremental_binary::has_incremental_info_): New data member.
4769         (Sized_incremental_binary::inputs_reader_): New data member.
4770         (Sized_incremental_binary::symtab_reader_): New data member.
4771         (Sized_incremental_binary::relocs_reader_): New data member.
4772         (Sized_incremental_binary::got_plt_reader_): New data member.
4773         (Sized_incremental_binary::current_input_file_): New data member.
4774
4775 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4776
4777         PR gold/12640
4778         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4779         violation.
4780
4781 2011-03-30  Cary Coutant  <ccoutant@google.com>
4782
4783         * archive.cc (Archive::include_member): Adjust call to report_object.
4784         (Add_archive_symbols::run): Add script_info to call to
4785         report_archive_begin.
4786         (Lib_group::include_member): Adjust call to report_object.
4787         (Add_lib_group_symbols::run): Adjust call to report_object.
4788         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4789         blocks.  Add object count for script input files.
4790         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4791         script_info parameter; change all callers.
4792         (Incremental_inputs::report_object): Add script_info parameter;
4793         change all callers.
4794         (Incremental_inputs::report_script): Store backpointer to
4795         incremental info entry.
4796         (Output_section_incremental_inputs::set_final_data_size): Record
4797         additional information for scripts.
4798         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4799         * incremental.h (Incremental_script_entry::add_object): New function.
4800         (Incremental_script_entry::get_object_count): New function.
4801         (Incremental_script_entry::get_object): New function.
4802         (Incremental_script_entry::objects_): New data member; adjust
4803         constructor.
4804         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4805         (Incremental_inputs::report_object): Add script_info parameter.
4806         (Incremental_inputs_reader::get_object_count): New function.
4807         (Incremental_inputs_reader::get_object_offset): New function.
4808         * options.cc (Input_arguments::add_file): Return reference to
4809         new input argument.
4810         * options.h (Input_argument::set_script_info): New function.
4811         (Input_argument::script_info): New function.
4812         (Input_argument::script_info_): New data member; adjust all
4813         constructors.
4814         (Input_file_group::add_file): Return reference to new input argument.
4815         (Input_file_lib::add_file): Likewise.
4816         (Input_arguments::add_file): Likewise.
4817         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4818         * script.cc (Parser_closure::Parser_closure): Add script_info
4819         parameter; adjust all callers.
4820         (Parser_closure::script_info): New function.
4821         (Parser_closure::script_info_): New data member.
4822         (read_input_script): Report scripts earlier to incremental info.
4823         (script_add_file): Set script_info in Input_argument.
4824         (script_add_library): Likewise.
4825         * script.h (Script_options::Script_info): Rewrite class.
4826
4827 2011-03-29  Cary Coutant  <ccoutant@google.com>
4828
4829         * archive.cc (Library_base::should_include_member): Move
4830         method here from class Archive.
4831         (Archive::Archive): Initialize base class.
4832         (Archive::should_include_member): Move to base class.
4833         (Archive::do_for_all_unused_symbols): New function.
4834         (Add_archive_symbols::run): Remove redundant access to
4835         incremental_inputs.
4836         (Lib_group::Lib_group): Initialize base class.
4837         (Lib_group::do_filename): New function.
4838         (Lib_group::include_member): Pass pointer to Lib_group to
4839         report_object.
4840         (Lib_group::do_for_all_unused_symbols): New function.
4841         (Add_lib_group_symbols::run): Report archive information for
4842         incremental links.
4843         * archive.h (class Library_base): New base class.
4844         (class Archive): Derive from Library_base.
4845         (Archive::filename): Move to base class.
4846         (Archive::set_incremental_info): Likewise.
4847         (Archive::incremental_info): Likewise.
4848         (Archive::Should_include): Likewise.
4849         (Archive::should_include_member): Likewise.
4850         (Archive::Armap_entry): Remove.
4851         (Archive::Unused_symbol_iterator): Remove.
4852         (Archive::unused_symbols_begin): Remove.
4853         (Archive::unused_symbols_end): Remove.
4854         (Archive::do_filename): New function.
4855         (Archive::do_get_mtime): New function.
4856         (Archive::do_for_all_unused_symbols): New function.
4857         (Archive::task_): Move to base class.
4858         (Archive::incremental_info_): Likewise.
4859         (class Lib_group): Derive from Library_base.
4860         (Lib_group::do_filename): New function.
4861         (Lib_group::do_get_mtime): New function.
4862         (Lib_group::do_for_all_unused_symbols): New function.
4863         (Lib_group::task_): Move to base class.
4864         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4865         function.
4866         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4867         function.
4868         * incremental.cc (Incremental_inputs::report_archive_begin):
4869         Use Library_base; call library's get_mtime; add incremental inputs
4870         entry before members.
4871         (class Unused_symbol_visitor): New class.
4872         (Incremental_inputs::report_archive_end): Use Library_base; use
4873         visitor class to record unused symbols; don't add incremental inputs
4874         entry after members.
4875         (Incremental_inputs::report_object): Use Library_base.
4876         * incremental.h
4877         (Incremental_archive_entry::Incremental_archive_entry): Remove
4878         unused Archive parameter.
4879         (Incremental_inputs::report_archive_begin): Use Library_base.
4880         (Incremental_inputs::report_archive_end): Likewise.
4881         (Incremental_inputs::report_object): Likewise.
4882         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4883         function.
4884         * object.h (Object::for_all_global_symbols): New function.
4885         (Object::do_for_all_global_symbols): New function.
4886         (Sized_relobj::do_for_all_global_symbols): New function.
4887         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4888         function.
4889         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4890         function.
4891
4892 2011-03-27  Ian Lance Taylor  <iant@google.com>
4893
4894         * archive.cc (Archive::interpret_header): Return -1 if something
4895         goes wrong.  Change callers accordingly.
4896
4897 2011-03-25  Cary Coutant  <ccoutant@google.com>
4898
4899         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4900         * testsuite/Makefile.in: Regenerate.
4901
4902 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4903
4904         * plugin.cc (get_view): New.
4905         (Plugin::load): Pass get_view to the plugin.
4906         (Plugin_manager::get_view): New.
4907
4908 2011-03-21  Ian Lance Taylor  <iant@google.com>
4909
4910         * testsuite/final_layout.sh: Rewrite to not use dc.
4911         * testsuite/relro_test.sh: Fail if dc is not present.
4912
4913 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4914
4915         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4916         Change == to -eq.
4917         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4918         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4919         Change == to -eq.
4920         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4921         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4922
4923 2011-03-14  Ian Lance Taylor  <iant@google.com>
4924
4925         * script-sections.cc (Sort_output_sections::script_compare):
4926         Rename from is_before, change return type.
4927         (Sort_output_sections::operator()): Adjust accordingly.
4928
4929 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4930
4931         PR gold/12572
4932         * testsuite/odr_violation2.cc: Add comment to make all error line
4933         numbers double digits.
4934         * testsuite/debug_msg.sh: Adjust expected errors.
4935
4936 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4937
4938         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4939         but mark earlier ones as non-canonical
4940         (offset_to_iterator): Update search target and example
4941         (do_addr2line): Return extra lines in a vector*
4942         (format_file_lineno): Extract from do_addr2line
4943         (one_addr2line): Add vector* out-param
4944         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4945         when a lineno entry appeared last for its instruction
4946         (Dwarf_line_info): Add vector* out-param
4947         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4948         * symtab.cc (Odr_violation_compare): Include the lineno in the
4949         comparison again.
4950         (linenos_from_loc): New. Combine the canonical line for an
4951         address with its other lines.
4952         (True_if_intersect): New. Helper functor to make
4953         std::set_intersection a query.
4954         (detect_odr_violations): Compare sets of lines instead of just
4955         one line for each function. This became less deterministic, but
4956         has fewer false positives.
4957         * symtab.h: Declarations.
4958         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4959         mix an optimized and non-optimized object in the same binary
4960         (odr_violation2.so): Same.
4961         * testsuite/Makefile.in: Regenerate from Makefile.am.
4962         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4963         * testsuite/debug_msg.sh: Update line numbers and add
4964         assertions.
4965         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4966         non-optimized context.
4967         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4968         isn't inlined, and use OdrDerived in an optimized context.
4969         * testsuite/odr_header1.h: Defines OdrDerived, where
4970         optimization will change the
4971         first-instruction-in-the-destructor's file and line number.
4972         * testsuite/odr_header2.h: Defines OdrBase.
4973
4974 2011-03-09  Ian Lance Taylor  <iant@google.com>
4975
4976         * fileread.cc (File_read::clear_views): Don't delete the whole
4977         file view.
4978
4979 2011-03-08  Ian Lance Taylor  <iant@google.com>
4980
4981         PR gold/12525
4982         * fileread.cc: #include <climits>.
4983         (GOLD_IOV_MAX): Define.
4984         (File_read::read_multiple): Limit number of entries by iov_max.
4985         * fileread.h (class File_read): Always set max_readv_entries to
4986         128.
4987
4988 2011-03-07  Ian Lance Taylor  <iant@google.com>
4989
4990         PR gold/12525
4991         * options.h (class General_options): Add -dy and -dn.
4992
4993 2011-03-02  Cary Coutant  <ccoutant@google.com>
4994
4995         * testsuite/script_test_9.t: Add TLS segment.
4996
4997 2011-03-02  Simon Baldwin  <simonb@google.com>
4998
4999         * configure.ac: Add check for gnu_indirect_function support in
5000         the toolchain building binutils.
5001         * configure: Rebuild.
5002
5003 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5004
5005         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5006         plugin only symbols.
5007         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5008         in plugin files as not needed in the symbol table.
5009
5010 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5011
5012         * output.cc (Output_section::add_input_section): Delay fill
5013         generation for section ordering.
5014
5015 2011-02-09  Ian Lance Taylor  <iant@google.com>
5016
5017         PR gold/12316
5018         * object.h (class Sized_relobj): Remove clear_local_symbols.
5019         * reloc.cc (Sized_relobj::do_relocate): Don't call
5020         clear_local_symbols.
5021
5022 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5023
5024         * plugin.cc (is_visible_from_outside): Return true for symbols
5025         in the -u option.
5026
5027 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5028
5029         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5030         filename.
5031
5032 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5033
5034         * icf.h (is_section_foldable_candidate): Change type of parameter
5035         to std::string.
5036         * icf.cc (Icf::find_identical_sections): Change type of local variable
5037         section_name to be std::string.
5038         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5039
5040 2011-01-25  Ian Lance Taylor  <iant@google.com>
5041
5042         * script.cc (script_add_extern): Rewrite to use
5043         add_symbol_reference.
5044
5045 2011-01-25  Doug Kwan  <dougkwan@google.com>
5046
5047         * icf.cc (get_section_contents): Always lock section's object.
5048
5049 2011-01-24  Ian Lance Taylor  <iant@google.com>
5050
5051         * options.h (class General_options): Accept
5052         --no-detect-odr-violations.
5053
5054 2011-01-24  Ian Lance Taylor  <iant@google.com>
5055
5056         * version.cc (version_string): Bump to 1.11.
5057
5058 2011-01-24  Ian Lance Taylor  <iant@google.com>
5059
5060         * plugin.cc (class Plugin_rescan): Define new class.
5061         (Plugin_manager::claim_file): Set any_claimed_.
5062         (Plugin_manager::save_archive): New function.
5063         (Plugin_manager::save_input_group): New function.
5064         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5065         necessary.
5066         (Plugin_manager::new_undefined_symbol): New function.
5067         (Plugin_manager::rescan): New function.
5068         (Plugin_manager::rescannable_defines): New function.
5069         (Plugin_manager::add_input_file): Set any_added_.
5070         * plugin.h (class Plugin_manager): define new fields rescannable_,
5071         undefined_symbols_, any_claimed_, and any_added_.  Declare
5072         Plugin_rescan as friend.  Declare new functions.
5073         (Plugin_manager::Rescannable): Define type.
5074         (Plugin_manager::Rescannable_list): Define type.
5075         (Plugin_manager::Undefined_symbol_list): Define type.
5076         (Plugin_manager::Plugin_manager): Initialize new fields.
5077         * archive.cc (Archive::defines_symbol): New function.
5078         (Add_archive_symbols::run): Pass archive to plugins if any.
5079         * archive.h (class Archive): Declare defines_symbol.
5080         * readsyms.cc (Input_group::~Input_group): New function.
5081         (Finish_group::run): Pass input_group to plugins if any.
5082         * readsyms.h (class Input_group): Declare destructor.
5083         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5084         any.
5085
5086 2011-01-10  Ian Lance Taylor  <iant@google.com>
5087
5088         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5089         section as relro.
5090         (Layout::set_segment_offsets): Reset increase_relro before calling
5091         set_section_addresses a second time.
5092
5093 2011-01-04  Cary Coutant  <ccoutant@google.com>
5094
5095         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5096         sections before NOBITS sections.
5097
5098 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5099
5100         * version.cc (print_version): Update copyright to 2011.
5101
5102 2010-12-23  Cary Coutant  <ccoutant@google.com>
5103
5104         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5105         of OS to this->add.  Add OD parameter to second form of the function.
5106
5107 2010-12-20  Ian Lance Taylor  <iant@google.com>
5108
5109         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5110         second of two consecutive entries with same offset.
5111
5112 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5113
5114         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5115         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5116         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5117         to avoid unneeded links against $(LDADD).
5118         * testsuite/Makefile.in: Regenerate.
5119
5120 2010-12-15  Ian Lance Taylor  <iant@google.com>
5121
5122         PR gold/12324
5123         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5124         for R_X86_64_32 and R_X86_64_PC32.
5125         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5126         ver_matching_def_pic.o.
5127         (ver_matching_def_pic.o): New target.
5128
5129 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5130
5131         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5132         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5133         Move definition before File_read::View member definitions.
5134         (File_read::View::~View): Initialize and hold lock before
5135         updating current_mapped_bytes.
5136
5137 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5138
5139         * dwarf_reader.cc: Remove outdated comment.
5140         * gold-threads.cc: Fix typo in error message.
5141         * archive.cc: Fix typos in comments.
5142         * archive.h: Likewise.
5143         * arm-reloc-property.cc: Likewise.
5144         * arm-reloc-property.h: Likewise.
5145         * arm-reloc.def: Likewise.
5146         * arm.cc: Likewise.
5147         * attributes.h: Likewise.
5148         * cref.cc: Likewise.
5149         * ehframe.cc: Likewise.
5150         * fileread.h: Likewise.
5151         * gold.h: Likewise.
5152         * i386.cc: Likewise.
5153         * icf.cc: Likewise.
5154         * incremental.h: Likewise.
5155         * int_encoding.cc: Likewise.
5156         * layout.h: Likewise.
5157         * main.cc: Likewise.
5158         * merge.h: Likewise.
5159         * object.cc: Likewise.
5160         * object.h: Likewise.
5161         * options.cc: Likewise.
5162         * readsyms.cc: Likewise.
5163         * reduced_debug_output.cc: Likewise.
5164         * reloc.cc: Likewise.
5165         * script-sections.cc: Likewise.
5166         * sparc.cc: Likewise.
5167         * symtab.h: Likewise.
5168         * target-reloc.h: Likewise.
5169         * target.cc: Likewise.
5170         * target.h: Likewise.
5171         * timer.cc: Likewise.
5172         * timer.h: Likewise.
5173         * x86_64.cc: Likewise.
5174
5175 2010-12-09  Cary Coutant  <ccoutant@google.com>
5176
5177         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5178         stack.
5179         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5180         parameter; change all callers.
5181         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5182         * options.h (warn_execstack): New option.
5183
5184 2010-12-07  Doug Kwan  <dougkwan@google.com>
5185
5186         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5187         like function call relocations.
5188
5189 2010-12-07  Ian Lance Taylor  <iant@google.com>
5190
5191         * archive.cc (Archive::get_elf_object_for_member): Permit
5192         punconfigured to be NULL.
5193         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5194         (Archive::include_member): Pass NULL to get_elf_object_for_member
5195         if we searched for the archive and this is the first included
5196         object.
5197
5198 2010-12-01  Ian Lance Taylor  <iant@google.com>
5199
5200         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5201         track_relocs_type_ field.
5202         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5203         Set track_relocs_type_.
5204         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5205         contents when using RELA relocs.
5206         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5207         reloc_map_.
5208         * reloc.cc (Track_relocs::next_addend): New function.
5209         * reloc.h (class Track_relocs): Declare next_addend.
5210
5211 2010-12-01  Ian Lance Taylor  <iant@google.com>
5212
5213         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5214         virtual destructor.
5215
5216 2010-12-01  Ian Lance Taylor  <iant@google.com>
5217
5218         * README: Update compilers known to work and fail.
5219
5220 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5221
5222         * configure.in: For --enable-gold, handle value `default' instead of
5223         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5224         not the default.
5225         * configure: Regenerate.
5226
5227 2010-11-18  Doug Kwan  <dougkwan@google.com>
5228
5229         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5230         and right_alignment to be zero.  Store result alignment only if it is
5231         greater than existing alignment.
5232
5233 2010-11-16  Cary Coutant  <ccoutant@google.com>
5234
5235         PR gold/12220
5236         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5237         Check for ".zdebug_line".
5238
5239 2010-11-16  Doug Kwan  <dougkwan@google.com>
5240             Cary Coutant  <ccoutant@google.com>
5241
5242         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5243         by reference; adjust all callers.
5244         * output.cc (Output_segment::set_section_addresses): Adjust references
5245         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5246         list is empty.
5247         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5248         end at page boundary.
5249
5250 2010-11-16  Cary Coutant  <ccoutant@google.com>
5251
5252         PR gold/12220
5253         * layout.cc (Layout::choose_output_section): Transform names of
5254         compressed sections even when using a script with a SECTIONS clause.
5255         (Layout::output_section_name): Remove code to transform
5256         compressed debug section names.
5257         * output.cc (Output_section::add_input_section): Use uncompressed
5258         section size when tracking input sections.
5259
5260 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5261
5262         * symtab.h (Symbol::NON_PIC_REF): Remove.
5263         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5264         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5265         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5266         (Symbol::use_plt_offset): Take a flags argument and pass it
5267         directly to needs_dynamic_reloc.  Restrict check for undefined
5268         weak symbols to function calls.
5269         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5270         (Target_arm::Scan::global): Use it.
5271         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5272         (Target_arm::Relocate::relocate): Likewise.
5273         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5274         parameter with an r_type parameter.  Use get_reference_flags
5275         to get the flags.
5276         (Target_arm::Relocate::relocate): Update accordingly.
5277         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5278         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5279         (Target_i386::Scan::global): Likewise.
5280         (Target_i386::Relocate::relocate): Likewise.
5281         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5282         parameter with an r_type parameter.  Use get_reference_flags
5283         to get the flags.
5284         (Target_i386::Relocate::relocate): Update accordingly.
5285         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5286         (Target_powerpc::Scan::global): Use it.
5287         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5288         (Target_powerpc::Relocate::relocate): Likewise.
5289         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5290         (Target_sparc::Scan::global): Use it.
5291         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5292         (Target_sparc::Relocate::relocate): Likewise.
5293         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5294         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5295         (Target_x86_64::Scan::global): Likewise.
5296         (Target_x86_64::Relocate::relocate): Likewise.
5297
5298 2010-11-08  Doug Kwan  <dougkwan@google.com>
5299             Cary Coutant  <ccoutant@google.com>
5300
5301         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5302         (Arm_exidx_merge_section::section_contents_): New data member.
5303         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5304         (Arm_input_section::~Arm_input_section): De-allocate memory.
5305         (Arm_input_section::original_contents_): New data member.
5306         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5307         in parameters instead of calling Object::section_contents without
5308         locking.
5309         (Arm_output_section::group_section): New parameter TASK.  Pass it
5310         to callees that need locking objects.
5311         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5312         to lock EXIDX input sections.  Fix a formatting issue.  Call
5313         Arm_exidx_merged_section::build_contents to create merged section
5314         contents.
5315         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5316         to lock object of stub table owner.
5317         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5318         TEXT_SIZE to initialize data member TEXT_SIZE_.
5319         (Arm_exidx_input_section::addralign): Fix typo in comment.
5320         (Arm_exidx_input_section::text_size): New method.
5321         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5322         that require locking objects.  Lock objects before scanning for stubs
5323         and updating local symbols.
5324         (Arm_input_section<big_endian>::init): Copy contents of original
5325         input section.
5326         (Arm_input_section<big_endian>::do_write): Use saved contents of
5327         original input section instead of calling Object::section_contents
5328         without locking.
5329         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5330         size without calling Object::section_size().
5331         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5332         for size.  Allocate a buffer for merged EXIDX entries.
5333         (Arm_exidx_merged_section::build_contents): New method.
5334         (Arm_exidx_merged_section::do_write): Move merge section contents
5335         building code to Arm_exidx_merged_section::build_contetns.  Write
5336         out contetns in buffer instead of building it on the fly.
5337         (Arm_relobj::make_exidx_input_section): Also pass text section size
5338         to Arm_exidx_input_section constructor.
5339         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5340         (Arm_dynobj::do_read_symbols): Fix memory leak.
5341         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5342         * target.h: (class Task): Add forward declaration.
5343         (Target::relax): Add new parameter TASK and pass it to
5344         Target::do_relax().
5345         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5346
5347 2010-11-05  Cary Coutant  <ccoutant@google.com>
5348
5349         PR gold/10708
5350         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5351         object when reading from the file.
5352         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5353         second layout pass.
5354         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5355         when reading section contents.
5356         (get_section_contents): Likewise.
5357         (icf::find_identical_sections): Likewise.
5358         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5359         object when reading from the file.
5360         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5361         the object when doing deferred section layout.
5362
5363 2010-11-03  Nick Clifton  <nickc@redhat.com>
5364
5365         PR gold/12001
5366         * script.h (class Symbol_assignment: name): New member.  Returns
5367         the name of the symbol.
5368         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5369         Returns true if the given symbol name is on the list of
5370         assignments wating to be processed.
5371         * archive.cc (should_incldue_member): If the symbol is undefined,
5372         check to see if it is on the list of symbols pending assignment.
5373
5374 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5375
5376         * script-sections.cc (Script_sections::find_memory_region): Check
5377         for a NULL output section pointer.
5378
5379 2010-10-29  Doug Kwan  <dougkwan@google.com>
5380
5381         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5382         Output_section::add_relaxed_input_section.
5383         * output.cc (Output_section::add_relaxed_input_section): Add new
5384         arguments LAYOUT and NAME.  Set section order index.
5385         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5386         Copy section order index.
5387         * output.h (Output_section::add_relaxed_input_section): Add new
5388         arguments LAYOUT and NAME.
5389
5390 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5391
5392         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5393         NATIVE_OR_CROSS_LINKER.
5394         * testsuite/Makefile.in: Regenerate.
5395
5396 2010-10-20  Doug Kwan  <dougkwan@google.com>
5397
5398         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5399         without SHF_LINK_ORDER flags.
5400         * layout.cc (Layout::choose_output_section): Do not filter
5401         SHF_LINK_ORDER flag in a relocatable link.
5402
5403 2010-10-17  Cary Coutant  <ccoutant@google.com>
5404
5405         * output.h (Output_segment::set_section_addresses): Change function
5406         signature.  Update all callers.
5407         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5408         sections.
5409         (Output_segment::set_section_addresses): Align after last TLS
5410         section.  Add padding before last relro section instead of after.
5411
5412 2010-10-17  Doug Kwan  <dougkwan@google.com>
5413
5414         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5415         GOT output section to be writable.
5416
5417 2010-10-14  Cary Coutant  <ccoutant@google.com>
5418
5419         * debug.h (DEBUG_INCREMENTAL): New flag.
5420         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5421         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5422         mode.
5423         * incremental.cc (report_command_line): Ignore all forms of
5424         --incremental.
5425         * layout.cc (Layout::Layout): Check parameters for incremental link
5426         mode.
5427         * options.cc (General_options::parse_incremental): New function.
5428         (General_options::parse_no_incremental): New function.
5429         (General_options::parse_incremental_full): New function.
5430         (General_options::parse_incremental_update): New function.
5431         (General_options::incremental_mode_): New data member.
5432         (General_options::finalize): Check incremental_mode_.
5433         * options.h (General_options): Update help text for --incremental.
5434         Add --no-incremental, --incremental-full, --incremental-update.
5435         (General_options::Incremental_mode): New enum type.
5436         (General_options::incremental_mode): New function.
5437         (General_options::incremental_mode_): New data member.
5438         * parameters.cc (Parameters::incremental_mode_): New data member.
5439         (Parameters::set_options): Set incremental_mode_.
5440         (Parameters::set_incremental_full): New function.
5441         (Parameters::incremental): New function.
5442         (Parameters::incremental_update): New function.
5443         (set_parameters_incremental_full): New function.
5444         * parameters.h (Parameters::set_incremental_full): New function.
5445         (Parameters::incremental): New function.
5446         (Parameters::incremental_update): New function.
5447         (Parameters::incremental_mode_): New data member.
5448         (set_parameters_incremental_full): New function.
5449         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5450         incremental link mode.
5451         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5452         (Sized_relobj::do_relocate_sections): Likewise.
5453         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5454         option.
5455         * testsuite/Makefile.in: Regenerate.
5456         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5457
5458 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5459
5460         * script-sections.h (class Script_sections): Make
5461         Sections_elements typedef public.
5462         * script-sections.cc (class Sort_output_sections): Add elements_
5463         field.  Add constructor which sets it; change all callers.
5464         (Sort_output_sections::is_before): New function.
5465         (Sort_output_sections::operator()): Call is_before.
5466         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5467         conditional.
5468         * testsuite/script_test_10.sh: New test. Test script section
5469         order.
5470         * testsuite/script_test_10.t: Likewise.
5471         * testsuite/script_test_10.s: Likewise.
5472         * testsuite/Makefile.am: Wrap the cross linker tests and the
5473         common tests into NATIVE_OR_CROSS_LINKER.
5474         (check_SCRIPTS): Add script_test_10.sh.
5475         (check_DATA): Add script_test_10.stdout.
5476         (script_test_10.o, script_test_10): New targets.
5477         (script_test_10.stdout): New target.
5478         * configure, testsuite/Makefile.in: Regenerate.
5479
5480 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5481
5482         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5483         error for the deprecated relocations.
5484         (Target_arm::Scan::global): Likewise.
5485         (Target_arm::Relocate::relocate): Likewise.
5486
5487 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5488
5489         * fileread.cc (Input_file::find_file): Initialize *found_name
5490         and *namep when using the fallback search for case 4.
5491
5492 2010-10-11  Cary Coutant  <ccoutant@google.com>
5493
5494         * options.h (class General_options): Redefine -z lazy as an alias for
5495         the negation of -z now.
5496
5497 2010-10-11  Ian Lance Taylor  <iant@google.com>
5498
5499         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5500         binding.
5501
5502 2010-10-06  Nick Clifton  <nickc@redhat.com>
5503
5504         * script-sections.cc(class Memory_region): Remove
5505         current_lma_offset_ field.  Rename current_vma_offset_ to
5506         current_offset_.  Add last_section_ field.
5507         (Memory_region::get_current_vma_address): Rename to
5508         get_current_address.
5509         (Memory_region::get_current_lma_address): Delete.
5510         (Memory_region::increment_vma_offset): Rename to
5511         increment_offset.
5512         (Memory_region::increment_lma_offset): Delete.
5513         (Memory_region::attributes_compatible): New method.  Returns
5514         true if the provided section is compatible with the region.
5515         (Memory_region::get_last_section): New method.  Returns the last
5516         section to use the region.
5517         (Memory_region::set_last_section): New method.  Stores the last
5518         section to use the region.
5519         (Script_sections::block_in_region): New method.  Returns true if
5520         a block of memory is contained within a region.
5521         (Script_sections::find_memory_region): New method.  Locates a
5522         memory region to be used to set a VMA or LMA address.
5523         (Output_section_definition::set_section_addresses): Add code to
5524         check for addresses set by memory regions.
5525         (Output_segment::set_section_addresses): Remove memory region
5526         walking code.
5527         (Script_sections::create_segment): Add a warning if a header
5528         segment is created outside of any region.
5529         * script-sections.h (class Script_sections): Add prototypes for
5530         find_memory_region and block_in_region methods.
5531         * testsuite/memory_test.s: Use .long instead of .word.
5532         * testsuite/memory_test.t: Add some more output sections.
5533         * testsuite/memory_test.sh: Update expected output.
5534
5535 2010-10-02  Doug Kwan  <dougkwan@google.com>
5536
5537         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5538         defintion to symtab.h
5539         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5540         declaration to defintion.
5541
5542 2010-10-01  Nick Clifton  <nickc@redhat.com>
5543
5544         * expression.cc (eval): Replace dummy argument with NULL.
5545         (eval_maybe_dot): Check for a NULL result section pointer.
5546         (Symbol_expression::value): Likewise.
5547         (Dot_expression::value): Likewise.
5548         (BINARY_EXPRESSION): Likewise.
5549         (Max_expression::value): Likewise.
5550         (Min_expression::value): Likewise.
5551         (Absolute_expression::value): Likewise.
5552         (Addr_expression::value_from_output_section): Likewise.
5553         (Loaddddr_expression::value_from_output_section): Likewise.
5554         (Segment_start_expression::value): Likewise.
5555         * script-sections.cc
5556         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5557         argument with NULL.
5558         (Sections_elememt_dot_assignment::set_section_addresses):
5559         Likewise.
5560         (Output_data_expression::do_write_to_buffer): Likewise.
5561         (Output_section_definition::finalize_symbols): Likewise.
5562         (Output_section_definition::set_section_addresses): Likewise.
5563
5564 2010-09-30  Doug Kwan  <dougkwan@google.com>
5565
5566         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5567
5568 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5569
5570         * target.h (Target::can_icf_inline_merge_sections): New virtual
5571         function.
5572         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5573         virtual function.
5574         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5575         virtual function.
5576         * icf.cc (get_section_contents): Inline merge sections only when
5577         target allows it.
5578
5579 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5580
5581         * configure: Regenerate.
5582
5583 2010-09-17  Ian Lance Taylor  <iant@google.com>
5584
5585         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5586         * testsuite/Makefile.am (memory_test.o): New target.
5587         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5588         memory_test.t.
5589         * testsuite/Makefile.in: Rebuild.
5590
5591 2010-09-17  Doug Kwan  <dougkwan@google.com>
5592
5593         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5594         defintion if relocation uses GOT entries of the symbol.
5595         * testsuite/icf_safe_test.sh: Fix test.
5596         * testsuite/icf_safe_so_test.sh: Fix test.
5597
5598 2010-09-16  Cary Coutant  <ccoutant@google.com>
5599
5600         * script_sections.cc (class Memory_region): Remove "NULL" from
5601         vector initializations.
5602
5603 2010-09-15  Cary Coutant  <ccoutant@google.com>
5604
5605         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5606         Resolve forwarding symbols.
5607
5608 2010-09-15  Doug Kwan  <dougkwan@google.com>
5609
5610         * gold/testsuite/script_test_3.t: Add ARM special sections.
5611         * gold/testsuite/script_test_4.t: Same.
5612         * gold/testsuite/script_test_5.t: Same.
5613         * gold/testsuite/script_test_6.t: Same.
5614         * gold/testsuite/script_test_7.t: Same.
5615         * gold/testsuite/script_test_7.t: Same.
5616         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5617
5618 2010-09-14  Cary Coutant  <ccoutant@google.com>
5619
5620         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5621         (Target_x86_64::Relocate::relocate_tls): Replace check for
5622         saw_tls_block_reloc_ with test for executable section.
5623
5624 2010-09-12  Cary Coutant  <ccoutant@google.com>
5625
5626         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5627         position-independent executables to shared libraries need dynamic
5628         relocations.
5629         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5630         position-independent executables.
5631         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5632         * testsuite/Makefile.in: Regenerate.
5633
5634 2010-09-10  Nick Clifton  <nickc@redhat.com>
5635
5636         PR gold/11997
5637         * testsuite/memory_test.t: Discard any sections that are not
5638         needed.
5639
5640 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5641
5642         PR gold/11996
5643         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5644         "This::" to work around a bug in gcc 4.2.
5645
5646         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5647
5648 2010-09-09  Rafael Espindola  <espindola@google.com>
5649
5650         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5651         sections with different PF_X flags in the same segment.
5652         (Layout::find_first_load_seg): Search all segments to find the first
5653         one.
5654         * options.h (rosegment): New.
5655
5656 2010-09-08  Rafael Espindola  <espindola@google.com>
5657
5658         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5659
5660 2010-09-08  Doug Kwan  <dougkwan@google.com>
5661
5662         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5663         (Arm_relobj::do_relocate_sections): Add new parameter for output
5664         file to match the parent.
5665         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5666         of local symbols instead of input values.  Update code to track
5667         changes in gold::relocate_section.
5668         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5669         (Sized_relobj::compute_final_local_value_internal): New methods.
5670         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5671         body into private version of Sized_relobj::compute_final_local_value.
5672         Call the inline method.
5673         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5674         merged symbol value if there is one.
5675         (Symbol_value::has_output_value): New method defintiion.
5676         (Sized_relobj::Compute_final_local_value_status): New enum type.
5677         (Sized_relobj::compute_final_local_value): New methods.
5678         (Sized_relobj::compute_final_local_value_internal): New methods.
5679         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5680         and arm_cortex_a8.sh.
5681         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5682         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5683         New tests.
5684         * Makefile.in: Regenerate.
5685         * testsuite/arm_bl_out_of_range.s: Update test.
5686         * testsuite/thumb_bl_out_of_range.s: Ditto.
5687         * testsuite/thumb_blx_out_of_range.s: Ditto.
5688         * testsuite/arm_branch_out_of_range.sh: New file.
5689         * testsuite/arm_cortex_a8.sh: Ditto.
5690         * testsuite/arm_cortex_a8_b.s: Ditto.
5691         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5692         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5693         * testsuite/arm_cortex_a8_bl.s: Ditto.
5694         * testsuite/arm_cortex_a8_blx.s: Ditto.
5695         * testsuite/arm_cortex_a8_local.s: Ditto.
5696         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5697         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5698
5699 2010-09-08  Rafael Espindola  <espindola@google.com>
5700
5701         * Makefile.am (memory_test.stdout): Run readelf with -W.
5702         * Makefile.in: Regenerate.
5703         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5704         64 bit output.
5705
5706 2010-09-08  Rafael Espindola  <espindola@google.com>
5707
5708         * script-sections.cc (Script_sections::add_memory_region): Convert
5709         field precision to int.
5710         * script.cc (script_set_section_region, script_set_section_region):
5711         Convert field precision to int.
5712
5713 2010-09-08  Rafael Espindola  <espindola@google.com>
5714
5715         * arm.cc (do_finalize_sections): Create the __exidx_start and
5716         __exdix_end symbols even when the section is missing.
5717
5718 2010-09-08  Nick Clifton  <nickc@redhat.com>
5719
5720         * README: Remove claim that MEMORY is not supported.
5721         * expression.cc (script_exp_function_origin)
5722         (script_exp_function_length): Move from here to ...
5723         * script.cc: ... here.
5724         (script_set_section_region, script_add_memory)
5725         (script_parse_memory_attr, script_include_directive): New
5726         functions.
5727         * script-sections.cc
5728         (class Memory_region): New class.
5729         (class Output_section_definition): Add set_memory_region,
5730         set_section_vma, set_section_lma and get_section_name methods.
5731         (class Script_Sections): Add add_memory_region,
5732         find_memory_region, find_memory_region_origin,
5733         find_memory_region_length and set_memory_region methods.
5734         Have set_section_addresses method walk the list of set memory
5735         regions.
5736         Extend the print methos to display memory regions.
5737         * script-sections.h: Add prototypes for new methods.
5738         Add enum for MEMORY region attributes.
5739         * yyscript.y: Add support for parsing MEMORY regions.
5740         * script-c.h: Add prototypes for new functions.
5741         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5742         * testsuite/Makefile.in: Regenerate.
5743         * testsuite/memory_test.sh: New script.
5744         * testsuite/memory_test.s: New assembler source file.
5745         * testsuite/memory_test.t: New linker script.
5746
5747 2010-08-27  Doug Kwan  <dougkwan@google.com>
5748
5749         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5750         reference override an existing dynamic weak reference.
5751         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5752         * testsuite/Makefile.in: Regenerate.
5753         * testsuite/dyn_weak_ref.sh: New file.
5754         * testsuite/dyn_weak_ref_1.c: Ditto.
5755         * testsuite/dyn_weak_ref_2.c: Ditto.
5756
5757 2010-08-27  Ian Lance Taylor  <iant@google.com>
5758
5759         * incremental.h (class Incremental_input_entry): Add virtual
5760         destructor.
5761
5762 2010-08-27  Ian Lance Taylor  <iant@google.com>
5763
5764         * testsuite/start_lib_test_3.c: Mark t3 as used.
5765
5766 2010-08-27  Nick Clifton  <nickc@redhat.com>
5767
5768         * options.cc (version_script): Fix small typo in previous
5769         whitespace tidyup.
5770
5771 2010-08-25  Nick Clifton  <nickc@redhat.com>
5772
5773         * archive.cc: Formatting fixes: Remove whitespace between
5774         typename and following asterisk.  Remove whitespace between
5775         function name and opening parenthesis.
5776         * archive.h: Likewise.
5777         * arm.cc: Likewise.
5778         * attributes.cc: Likewise.
5779         * attributes.h: Likewise.
5780         * common.cc: Likewise.
5781         * copy-relocs.cc: Likewise.
5782         * dirsearch.h: Likewise.
5783         * dynobj.cc: Likewise.
5784         * ehframe.cc: Likewise.
5785         * ehframe.h: Likewise.
5786         * expression.cc: Likewise.
5787         * fileread.cc: Likewise.
5788         * fileread.h: Likewise.
5789         * gc.h: Likewise.
5790         * gold-threads.cc: Likewise.
5791         * gold.cc: Likewise.
5792         * i386.cc: Likewise.
5793         * icf.h: Likewise.
5794         * incremental-dump.cc: Likewise.
5795         * incremental.cc: Likewise.
5796         * layout.cc: Likewise.
5797         * layout.h: Likewise.
5798         * main.cc: Likewise.
5799         * merge.cc: Likewise.
5800         * merge.h: Likewise.
5801         * object.cc: Likewise.
5802         * object.h: Likewise.
5803         * options.cc: Likewise.
5804         * options.h: Likewise.
5805         * output.cc: Likewise.
5806         * output.h: Likewise.
5807         * plugin.cc: Likewise.
5808         * plugin.h: Likewise.
5809         * powerpc.cc: Likewise.
5810         * reloc.cc: Likewise.
5811         * script-c.h: Likewise.
5812         * script-sections.cc: Likewise.
5813         * script.cc: Likewise.
5814         * stringpool.cc: Likewise.
5815         * symtab.cc: Likewise.
5816         * symtab.h: Likewise.
5817         * target.cc: Likewise.
5818         * timer.cc: Likewise.
5819         * timer.h: Likewise.
5820         * version.cc: Likewise.
5821         * x86_64.cc: Likewise.
5822
5823 2010-08-24  Nick Clifton  <nickc@redhat.com>
5824
5825         PR 11899
5826         * layout.cc (segment_precedes): Sort segments by their physical
5827         addresses, if they have been set.
5828
5829 2010-08-23  Cary Coutant  <ccoutant@google.com>
5830
5831         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5832         symbols data.
5833         (Lib_group::include_member): Unlock object after deleting its
5834         symbols data.
5835         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5836         the bug fixed here.
5837
5838 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5839             Cary Coutant  <ccoutant@google.com>
5840
5841         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5842         constructor, and set_blocker.
5843         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5844         readsyms_blocker_.
5845         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5846         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5847         * testsuite/Makefile.am (start_lib_test): New test case.
5848         * testsuite/Makefile.in: Regenerate.
5849         * testsuite/start_lib_test_main.c: New file.
5850         * testsuite/start_lib_test_1.c: New file.
5851         * testsuite/start_lib_test_2.c: New file.
5852         * testsuite/start_lib_test_3.c: New file.
5853
5854 2010-08-19  Ian Lance Taylor  <iant@google.com>
5855
5856         * Makefile.in: Rebuild with automake 1.11.1.
5857         * aclocal.m4: Likewise.
5858         * testsuite/Makefile.in: Likewise.
5859
5860 2010-08-19  Ian Lance Taylor  <iant@google.com>
5861
5862         PR 10893
5863         * i386.cc (class Output_data_plt_i386): Update declarations.
5864         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5865         local_ifuncs_ fields.
5866         (Target_i386::do_plt_section_for_global): New function.
5867         (Target_i386::do_plt_section_for_local): New function.
5868         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5869         parameter; change all callers.  Initialize global_ifuncs_ and
5870         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5871         __rel_iplt_end.
5872         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5873         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5874         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5875         symbols.
5876         (Target_i386::make_plt_section): New function, broken out of
5877         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5878         (Target_i386::make_plt_entry): Call make_plt_section.
5879         (Target_i386::make_local_ifunc_plt_entry): New function.
5880         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5881         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5882         R_386_IRELATIVE to switch.
5883         (Target_i386::Scan::global): Likewise.
5884         (Target_i386::Relocate::relocate): Likewise.
5885         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5886         switch.
5887         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5888         (Target_x86_64::do_plt_section_for_global): New function.
5889         (Target_x86_64::do_plt_section_for_local): New function.
5890         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5891         parameter; change all callers.  If doing a static link define
5892         __rela_iplt_start and __rela_iplt_end.
5893         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5894         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5895         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5896         to point to .plt.
5897         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5898         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5899         switch.
5900         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5901         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5902         R_X86_64_IRELATIVE to switch.
5903         (Target_x86_64::Scan::global): Likewise.
5904         (Target_x86_64::Relocate::relocate): Likewise.
5905         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5906         switch.
5907         * target.h (class Target): Add plt_section_for_global and
5908         plt_section_for_local functions.  Add do_plt_section_for_global
5909         and do_plt_section_for_local virtual functions.
5910         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5911         clarifying comments.
5912         (Symbol::use_plt_offset): Handle IFUNC symbol.
5913         * object.cc (Sized_relobj::Sized_relobj): Initialize
5914         local_plt_offsets_.
5915         (Sized_relobj::local_has_plt_offset): New function.
5916         (Sized_relobj::local_plt_offset): New function.
5917         (Sized_relobj::set_local_plt_offset): New function.
5918         (Sized_relobj::do_count): Handle IFUNC symbol.
5919         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5920         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5921         is_ifunc_symbol functions.
5922         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5923         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5924         local_plt_offsets_ field.
5925         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5926         * output.h (class Output_section_data): Add non-const
5927         output_section function.
5928         (class Output_data_got): Update declarations.
5929         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5930         Add use_plt_offset parameter to global and local constructors.
5931         Change all callers.  Change local_sym_index_ field to 31 bits.
5932         Change GSYM_CODE and CONSTANT_CODE accordingly.
5933         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5934         doing a static link don't set sh_link field.
5935         (Output_data_got::Got_entry::write): Use PLT offset if
5936         appropriate.
5937         (Output_data_got::add_global_plt): New function.
5938         (Output_data_got::add_local_plt): New function.
5939         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5940         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5941         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5942         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5943         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5944         IFUNC conditional.
5945         * testsuite/ifunc-sel.h: New file.
5946         * testsuite/ifuncmain1.c: New file.
5947         * testsuite/ifuncmain1vis.c: New file.
5948         * testsuite/ifuncmod1.c: New file.
5949         * testsuite/ifuncdep2.c: New file.
5950         * testsuite/ifuncmain2.c: New file.
5951         * testsuite/ifuncmain3.c: New file.
5952         * testsuite/ifuncmod3.c: New file.
5953         * testsuite/ifuncmain4.c: New file.
5954         * testsuite/ifuncmain5.c: New file.
5955         * testsuite/ifuncmod5.c: New file.
5956         * testsuite/ifuncmain6pie.c: New file.
5957         * testsuite/ifuncmod6.c: New file.
5958         * testsuite/ifuncmain7.c: New file.
5959         * configure, testsuite/Makefile.in: Rebuild.
5960
5961 2010-08-18  Ian Lance Taylor  <iant@google.com>
5962
5963         * incremental.cc
5964         (Output_section_incremental_inputs::write_input_files): Add cast
5965         to avoid signed/unsigned comparison warning.
5966         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5967
5968 2010-08-12  Cary Coutant  <ccoutant@google.com>
5969
5970         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5971
5972 2010-08-13  Ian Lance Taylor  <iant@google.com>
5973
5974         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5975
5976 2010-08-12  Cary Coutant  <ccoutant@google.com>
5977             Doug Kwan  <dougkwan@google.com>
5978
5979         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5980         defintion overrides non-weak undef, remember that the original undef
5981         is not weak.
5982         * symtab.cc (Symbol_table::sized_write_global): For undef without
5983         an original weak binding, set binding to global in output.
5984         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5985         * testsuite/Makefile.in: Regenerate.
5986         * testsuite/strong_ref_weak_def.sh: New file.
5987         * testsuite/strong_ref_weak_def_1.c: Ditto.
5988         * testsuite/strong_ref_weak_def_2.c: Ditto.
5989
5990 2010-08-12  Cary Coutant  <ccoutant@google.com>
5991
5992         * testsuite/incremental_test.sh: Rewrite.
5993         * testsuite/incremental_test_1.c: Rewrite.
5994         * testsuite/incremental_test_2.c: Rewrite.
5995
5996 2010-08-12  Cary Coutant  <ccoutant@google.com>
5997
5998         * arm.cc (Target_arm::got_size): Add const.
5999         (Target_arm::got_entry_count): New function.
6000         (Target_arm::plt_entry_count): New function.
6001         (Target_arm::first_plt_entry_offset): New function.
6002         (Target_arm::plt_entry_size): New function.
6003         (Output_data_plt_arm::entry_count): New function.
6004         (Output_data_plt_arm::first_plt_entry_offset): New function.
6005         (Output_data_plt_arm::get_plt_entry_size): New function.
6006         * i386.cc (Target_i386::got_size): Add const.
6007         (Target_i386::got_entry_count): New function.
6008         (Target_i386::plt_entry_count): New function.
6009         (Target_i386::first_plt_entry_offset): New function.
6010         (Target_i386::plt_entry_size): New function.
6011         (Output_data_plt_i386::entry_count): New function.
6012         (Output_data_plt_i386::first_plt_entry_offset): New function.
6013         (Output_data_plt_i386::get_plt_entry_size): New function.
6014         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6015         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6016         * incremental.cc: Include target.h.
6017         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6018         parameter.  Adjust all callers.  Find incremental_got_plt section.
6019         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6020         section.
6021         (Output_section_incremental_inputs::set_final_data_size): Calculate
6022         size of incremental_got_plt section.
6023         (Output_section_incremental_inputs::do_write): Write the
6024         incremental_got_plt section.
6025         (Got_plt_view_info): New struct.
6026         (Local_got_offset_visitor): New class.
6027         (Global_got_offset_visitor): New class.
6028         (Global_symbol_visitor_got_plt): New class.
6029         (Output_section_incremental_inputs::write_got_plt): New function.
6030         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6031         Add parameter.  Adjust all callers.
6032         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6033         (Incremental_inputs::got_plt_section): New function.
6034         (Incremental_inputs::got_plt_section_): New data member.
6035         (Incremental_got_plt_reader): New class.
6036         * layout.cc (Layout::create_incremental_info_sections): Add the
6037         incremental_got_plt section.
6038         * object.h (Got_offset_list::get_list): New function.
6039         (Got offset_list::for_all_got_offsets): New function.
6040         (Sized_relobj::local_got_offset_list): New function.
6041         * powerpc.cc (Target_powerpc::got_size): Add const.
6042         (Target_powerpc::got_entry_count): New function.
6043         (Target_powerpc::plt_entry_count): New function.
6044         (Target_powerpc::first_plt_entry_offset): New function.
6045         (Target_powerpc::plt_entry_size): New function.
6046         (Output_data_plt_powerpc::entry_count): New function.
6047         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6048         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6049         * sparc.cc (Target_sparc::got_size): Add const.
6050         (Target_sparc::got_entry_count): New function.
6051         (Target_sparc::plt_entry_count): New function.
6052         (Target_sparc::first_plt_entry_offset): New function.
6053         (Target_sparc::plt_entry_size): New function.
6054         (Output_data_plt_sparc::entry_count): New function.
6055         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6056         (Output_data_plt_sparc::get_plt_entry_size): New function.
6057         * symtab.h (Symbol::got_offset_list): New function.
6058         (Symbol_table::for_all_symbols): New function.
6059         * target.h (Sized_target::got_entry_count): New function.
6060         (Sized_target::plt_entry_count): New function.
6061         (Sized_target::plt_entry_size): New function.
6062         * x86_64.cc (Target_x86_64::got_size): Add const.
6063         (Target_x86_64::got_entry_count): New function.
6064         (Target_x86_64::plt_entry_count): New function.
6065         (Target_x86_64::first_plt_entry_offset): New function.
6066         (Target_x86_64::plt_entry_size): New function.
6067         (Output_data_plt_x86_64::entry_count): New function.
6068         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6069         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6070
6071 2010-08-12  Cary Coutant  <ccoutant@google.com>
6072
6073         * archive.cc: Include incremental.h.
6074         (Archive::Archive): Initialize incremental_info_.
6075         (Archive::include_member): Record archive members in incremental info.
6076         (Add_archive_symbols::run): Record begin and end of an archive in
6077         incremental info.
6078         (Lib_group::include_member): Record objects in incremental info.
6079         * archive.h (Incremental_archive_entry): Forward declaration.
6080         (Archive::set_incremental_info): New member function.
6081         (Archive::incremental_info): New member function.
6082         (Archive::Unused_symbol_iterator): New class.
6083         (Archive::unused_symbols_begin): New member function.
6084         (Archive::unused_symbols_end): New member function.
6085         (Archive::incremental_info_): New data member.
6086         * incremental-dump.cc (find_input_containing_global): New function.
6087         (dump_incremental_inputs): Dump new incremental info sections.
6088         * incremental.cc: Include symtab.h.
6089         (Output_section_incremental_inputs): New class.
6090         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6091         new incremental info sections.
6092         (Sized_incremental_binary::do_check_inputs): Likewise.
6093         (Incremental_inputs::report_archive): Remove.
6094         (Incremental_inputs::report_archive_begin): New function.
6095         (Incremental_inputs::report_archive_end): New function.
6096         (Incremental_inputs::report_object): New function.
6097         (Incremental_inputs::finalize_inputs): Remove.
6098         (Incremental_inputs::report_input_section): New function.
6099         (Incremental_inputs::report_script): Rewrite.
6100         (Incremental_inputs::finalize): Do nothing but finalize string table.
6101         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6102         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6103         (Incremental_inputs::create_data_sections): New function.
6104         (Incremental_inputs::relocs_entsize): New function.
6105         (Output_section_incremental_inputs::set_final_data_size): New function.
6106         (Output_section_incremental_inputs::do_write): New function.
6107         (Output_section_incremental_inputs::write_header): New function.
6108         (Output_section_incremental_inputs::write_input_files): New function.
6109         (Output_section_incremental_inputs::write_info_blocks): New function.
6110         (Output_section_incremental_inputs::write_symtab): New function.
6111         * incremental.h (Incremental_script_entry): Forward declaration.
6112         (Incremental_object_entry): Forward declaration.
6113         (Incremental_archive_entry): Forward declaration.
6114         (Incremental_inputs): Forward declaration.
6115         (Incremental_inputs_header_data): Remove.
6116         (Incremental_inputs_header): Remove.
6117         (Incremental_inputs_header_write): Remove.
6118         (Incremental_inputs_entry_data): Remove.
6119         (Incremental_inputs_entry): Remove.
6120         (Incremental_inputs_entry_write): Remove.
6121         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6122         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6123         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6124         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6125         Likewise.
6126         (Incremental_input_entry): New class.
6127         (Incremental_script_entry): New class.
6128         (Incremental_object_entry): New class.
6129         (Incremental_archive_entry): New class.
6130         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6131         (Incremental_inputs::report_inputs): Remove.
6132         (Incremental_inputs::report_archive): Remove.
6133         (Incremental_inputs::report_archive_begin): New function.
6134         (Incremental_inputs::report_archive_end): New function.
6135         (Incremental_inputs::report_object): Change prototype.
6136         (Incremental_inputs::report_input_section): New function.
6137         (Incremental_inputs::report_script): Change prototype.
6138         (Incremental_inputs::get_reloc_count): New function.
6139         (Incremental_inputs::set_reloc_count): New function.
6140         (Incremental_inputs::create_data_sections): New function.
6141         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6142         (Incremental_inputs::inputs_section): New function.
6143         (Incremental_inputs::symtab_section): New function.
6144         (Incremental_inputs::relocs_section): New function.
6145         (Incremental_inputs::get_stringpool): Add const.
6146         (Incremental_inputs::command_line): Add const.
6147         (Incremental_inputs::inputs): Remove.
6148         (Incremental_inputs::command_line_key): New function.
6149         (Incremental_inputs::input_file_count): New function.
6150         (Incremental_inputs::input_files): New function.
6151         (Incremental_inputs::relocs_entsize): New function.
6152         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6153         (Incremental_inputs::finalize_inputs): Remove.
6154         (Incremental_inputs::Input_info): Remove.
6155         (Incremental_inputs::lock_): Remove.
6156         (Incremental_inputs::inputs_): Change type.
6157         (Incremental_inputs::inputs_map_): Remove.
6158         (Incremental_inputs::current_object_entry_): New data member.
6159         (Incremental_inputs::inputs_section_): New data member.
6160         (Incremental_inputs::symtab_section_): New data member.
6161         (Incremental_inputs::relocs_section_): New data member.
6162         (Incremental_inputs::reloc_count_): New data member.
6163         (Incremental_inputs_reader): New class.
6164         (Incremental_symtab_reader): New class.
6165         (Incremental_relocs_reader): New class.
6166         * layout.cc (Layout::finalize): Move finalization of incremental info
6167         and creation of incremental info sections to follow finalization of
6168         symbol table.  Set offsets for postprocessing sections.
6169         (Layout::create_incremental_info_sections): Call
6170         Incremental_inputs::create_data_sections.  Add incremental symtab
6171         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6172         sections to layout after input sections.
6173         * layout.h (struct Timespec): Forward declaration.
6174         (Layout::incremental_inputs): Add const.
6175         (Layout::create_incremental_info_sections): Add parameter.
6176         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6177         * object.cc: Include incremental.h.
6178         (Relobj::finalize_incremental_relocs): New function.
6179         (Sized_relobj::do_layout): Record input sections in incremental info.
6180         * object.h (Object::output_section): New function.
6181         (Object::output_section_offset): Moved from Relobj.
6182         (Object::get_incremental_reloc_base): New function.
6183         (Object::get_incremental_reloc_count): New function.
6184         (Object::do_output_section): New function.
6185         (Object::do_output_section_offset): Moved from Relobj.
6186         (Object::do_get_incremental_reloc_base): New function.
6187         (Object::do_get_incremental_reloc_count): New function.
6188         (Object::Object): Initialize new data members.
6189         (Relobj::output_section): Renamed do_output_section and moved to
6190         protected.
6191         (Relobj::output_section_offset): Moved to Object.
6192         (Relobj::do_get_incremental_reloc_base): New function.
6193         (Relobj::do_get_incremental_reloc_count): New function.
6194         (Relobj::allocate_incremental_reloc_counts): New function.
6195         (Relobj::count_incremental_reloc): New function.
6196         (Relobj::finalize_incremental_relocs): New function.
6197         (Relobj::next_incremental_reloc_index): New function.
6198         (Relobj::reloc_counts_): New data member.
6199         (Relobj::reloc_bases_): New data member.
6200         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6201         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6202         (Sized_relobj::incremental_relocs_scan): New function.
6203         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6204         (Sized_relobj::incremental_relocs_write): New function.
6205         (Sized_relobj::incremental_relocs_write_reltype): New function.
6206         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6207         incremental link.
6208         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6209         archives and object files elsewhere.
6210         (Add_symbols::run): Report object files here.
6211         (Finish_group::run): Report end of archive at end of group.
6212         * reloc.cc: Include layout.h, incremental.h.
6213         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6214         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6215         (Sized_relobj::incremental_relocs_scan): New function.
6216         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6217         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6218         (Sized_relobj::incremental_relocs_write): New function.
6219         (Sized_relobj::incremental_relocs_write_reltype): New function.
6220         * script.cc (read_input_script): Rewrite test for incremental link.
6221         Change call to Incremental_inputs::report_script.
6222         * symtab.h (Symbol_table::first_global_index): New function.
6223         (Symbol_table::output_count): New function.
6224
6225 2010-08-12  Doug Kwan  <dougkwan@google.com>
6226
6227         * arm.cc (Target_arm::merge_object_attributes): Check command line
6228         options --no-wchar-size-warning and --no-enum-size-warning.
6229         * options.h (General_options): Add ld-compatible options
6230         --no-enum-size-warning and --no-wchar-size-warning.
6231
6232 2010-08-04  Ian Lance Taylor  <iant@google.com>
6233
6234         * x86_64.cc (Target_x86_64::Scan::local): Use
6235         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6236         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6237         (Target_x86_64::Scan::global): Likewise.
6238         (Target_x86_64::Relocate::relocate): Likewise.
6239         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6240         Likewise.
6241
6242 2010-08-03  Cary Coutant  <ccoutant@google.com>
6243
6244         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6245         to reserve space in merged_strings vector. Keep total input size
6246         for stats.
6247         (Output_merge_string::do_print_merge_stats): Print total input size.
6248         * merge.h (Output_merge_string): Add input_size_ field.
6249         * stringpool.cc (Stringpool_template::string_length): Move
6250         implementations out of Stringpool_template class and place in
6251         stringpool.h.
6252         * stringpool.h (string_length): Move out of Stringpool_template.
6253
6254 2010-08-03  Ian Lance Taylor  <iant@google.com>
6255
6256         PR 11712
6257         * layout.cc (relaxation_loop_body): If address of load segment is
6258         set, adjust address to include headers if possible.
6259
6260 2010-08-03  Ian Lance Taylor  <iant@google.com>
6261
6262         * version.cc (version_string): Bump to 1.10.
6263
6264 2010-08-03  Ian Lance Taylor  <iant@google.com>
6265
6266         PR 11805
6267         * layout.h (enum Output_section_order): Define.
6268         (class Layout): Update declarations.
6269         * layout.cc (Layout::get_output_section): Add order parameter.
6270         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6271         is_first_non_relro parameters.  Change all callers.
6272         (Layout::choose_output_section): Likewise.
6273         (Layout::add_output_section_data): Likewise.
6274         (Layout::make_output_section): Likewise.  Set order.
6275         (Layout::default_section_order): New function.
6276         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6277         * output.cc (Output_section::Output_section): Initialize order_.
6278         Don't initialize deleted fields.
6279         (Output_segment::Output_segment): Don't initialize deleted
6280         fields.
6281         (Output_segment::add_output_section_to_load): New function
6282         replacing add_output_section.  Change all callers to call this or
6283         add_output_section_to_nonload.
6284         (Output_segment::add_output_section_to_nonload): New function.
6285         (Output_segment::remove_output_section): Rewrite.
6286         (Output_segment::add_initial_output_data): Likewise.
6287         (Output_segment::has_any_data_sections): Likewise.
6288         (Output_segment::is_first_section_relro): Likewise.
6289         (Output_segment::maximum_alignment): Likewise.
6290         (Output_segment::has_dynamic_reloc): New function replacing
6291         dynamic_reloc_count.  Change all callers.
6292         (Output_segment::has_dynamic_reloc_list): New function replacing
6293         dynamic_reloc_count_list.  Change all callers.
6294         (Output_segment::set_section_addresses): Rewrite.
6295         (Output_segment::set_offset): Rewrite.
6296         (Output_segment::find_first_and_last_list): Remove.
6297         (Output_segment::set_tls_offsets): Rewrite.
6298         (Output_segment::first_section_load_address): Likewise.
6299         (Output_segment::output_section_count): Likewise.
6300         (Output_segment::section_with_lowest_load_address): Likewise.
6301         (Output_segment::write_section_headers): Likewise.
6302         (Output_segment::print_sections_to_map): Likewise.
6303         * output.h (class Output_data): Remove dynamic_reloc_count_
6304         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6305         (Output_data::add_dynamic_reloc): Rewrite.
6306         (Output_data::has_dynamic_reloc): New function.
6307         (Output_data::dynamic_reloc_count): Remove.
6308         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6309         is_last_relro_, is_first_non_relro_, is_interp_,
6310         is_dynamic_linker_section_ fields.  Add order and set_order
6311         functions.  Remove is_relro_local, set_is_relro_local,
6312         is_last_relro, set_is_last_relro, is_first_non_relro,
6313         set_is_first_non_relro functions, is_interp, set_is_interp,
6314         is_dynamic_linker_section, and set_is_dynamic_linker_section
6315         functions.
6316         (class Output_segment): Change Output_data_list from std::list to
6317         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6318         output_bss_ fields.  Update declarations.
6319
6320 2010-08-02  Ian Lance Taylor  <iant@google.com>
6321
6322         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6323         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6324         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6325
6326 2010-08-02  Ian Lance Taylor  <iant@google.com>
6327
6328         PR 11855
6329         * script.cc (Script_options::Script_options): Initialize
6330         symbol_definitions_ and symbol_references_.
6331         (Script_options::add_symbol_assignment): Update
6332         symbol_definitions_ and symbol_references_.
6333         (Script_options::add_symbol_reference): New function.
6334         (script_symbol): New function.
6335         * script.h (class Script_options): Add symbol_definitions_ and
6336         symbol_references_ fields.
6337         (Script_options::referenced_const_iterator): New type.
6338         (Script_options::referenced_begin): New function.
6339         (Script_options::referenced_end): New function.
6340         (Script_options::is_referenced): New function.
6341         (Script_options::any_unreferenced): New function.
6342         * script-c.h (script_symbol): Declare.
6343         * yyscript.y (exp): Call script_symbol.
6344         * symtab.cc: Include "script.h".
6345         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6346         Change all callers.  Check symbols referenced by scripts.
6347         (Symbol_table::add_undefined_symbols_from_command_line): Add
6348         layout parameter.  Change all callers.
6349         (Symbol_table::do_add_undefined_symbols_from_command_line):
6350         Likewise.  Break out loop body.  Check symbols referenced by
6351         scripts.
6352         (Symbol_table::add_undefined_symbol_from_command_line): New
6353         function broken out of
6354         do_add_undefined_symbols_from_command_line.
6355         * symtab.h (class Symbol_table): Update declarations.
6356         * archive.cc: Include "layout.h".
6357         (Archive::should_include_member): Add layout parameter.  Change
6358         all callers.  Check for symbol mentioned in expression.
6359         * archive.h (class Archive): Update declaration.
6360         * object.cc (Sized_relobj::do_should_include_member): Add layout
6361         parameter.
6362         * object.h (Object::should_include_member): Add layout parameter.
6363         Change all callers.
6364         (Object::do_should_include_member): Add layout parameter.
6365         (class Sized_relobj): Update declaration.
6366         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6367         parameter.
6368         * dynobj.h (class Sized_dynobj): Update declaration.
6369         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6370         layout parameter.
6371         * plugin.h (class Sized_pluginobj): Update declaration.
6372
6373 2010-08-02  Ian Lance Taylor  <iant@google.com>
6374
6375         PR 11866
6376         * output.cc (Output_segment::set_offset): Search for the first and
6377         last sections rather than assuming that the list is in order.
6378         (Output_segment::find_first_and_last_list): New function.
6379         * output.h (class Output_segment): Update declarations.
6380         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6381         (relro_strip_test_SOURCES): New variable.
6382         (relro_strip_test_DEPENDENCIES): New variable.
6383         (relro_strip_test_LDFLAGS): New variable.
6384         (relro_strip_test_LDADD): New variable.
6385         (relro_strip_test.so): New target.
6386
6387 2010-08-02  Ian Lance Taylor  <iant@google.com>
6388
6389         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6390         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6391         (Target_i386::got_tlsdesc_section): New function.
6392         (Target_i386::got_section): Create space for GOT entries for
6393         TLSDESC relocations.
6394         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6395         R_386_TLS_GOTDESC.
6396         (Target_i386::Scan::global): Likewise.
6397         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6398         using TLSDESC GOT.
6399         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6400         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6401         (Target_x86_64::got_tlsdesc_section): New function.
6402         (Target_x86_64::got_section): Create space for GOT entries for
6403         TLSDESC relocations.
6404         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6405         R_386_TLS_GOTDESC.
6406         (Target_x86_64::Scan::global): Likewise.
6407         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6408         using TLSDESC GOT.
6409
6410 2010-08-02  Ian Lance Taylor  <iant@google.com>
6411
6412         * testsuite/final_layout.sh: Use dc to convert from hex to
6413         decimal.
6414
6415 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6416
6417         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6418         paramter to the call to gold::gc_process_relocs.
6419         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6420         paramter to the call to gold::gc_process_relocs.
6421         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6422         parameter to the call to gold::gc_process_relocs.
6423         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6424         template parameter to the call to gold::gc_process_relocs.
6425         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6426         paramter to the call to gold::gc_process_relocs.
6427         * gc.h (get_embedded_addend_size): New function.
6428         (gc_process_relocs): Save the size of the reloc for use by ICF.
6429         * icf.cc (get_section_contents): Get the addend from the text section
6430         for SHT_REL relocation sections.
6431         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6432         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6433         * int_encoding.h (read_from_pointer): New overloaded function.
6434         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6435         * testsuite/icf_sht_rel_addend_test.sh: New file.
6436         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6437         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6438
6439 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6440
6441         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6442         * Makefile.in: Regenerate.
6443         * testsuite/Makefile.in: Regenerate.
6444
6445 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6446
6447         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6448         * gold/testsuite/debug_msg.cc: Likewise.
6449         * gold/testsuite/odr_violation1.cc
6450         * gold/testsuite/odr_violation2.cc
6451
6452 2010-07-21  Cary Coutant  <ccoutant@google.com>
6453
6454         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6455         string, and length fields.
6456         (Output_merge_string::Merged_strings_list): New type.
6457         (Output_merge_string::Merged_strings_lists): New typedef.
6458         (Output_merge_string): Replace merged_strings_ with
6459         merged_strings_lists_.
6460         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6461         Merged_strings_list per input object and section.  Don't store pointer
6462         to the string.  Don't store length with each merged string entry.
6463         (Output_merge_string::finalize_merged_data): Loop over list of merged
6464         strings lists.  Recompute length of each merged string.
6465
6466 2010-07-15  Cary Coutant  <ccoutant@google.com>
6467
6468         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6469         here.
6470
6471 2010-07-14  Ian Lance Taylor  <iant@google.com>
6472
6473         * descriptors.cc (Descriptors::open): Report correct name in error
6474         message.
6475
6476 2010-07-13  Doug Kwan  <dougkwan@google.com>
6477
6478         * arm.cc (Arm_input_section::Arm_input_section): For a
6479         SHT_ARM_EXIDX section, always keeps the input sections.
6480         (Arm_input_section::set_exidx_section_link): New method.
6481         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6482         has_errors_ to false.
6483         (Arm_exidx_input_section::has_errors,
6484         Arm_exidx_input_section::set_has_errors): New methods.
6485         (Arm_exidx_input_section::has_errors_): New data member.
6486         (Arm_relobj::get_exidx_shndx_list): New method.
6487         (Arm_output_section::append_text_sections_to_list): Do not skip
6488         section without SHF_EXECINSTR.
6489         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6490         errors.
6491         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6492         section header.  Make error messages more verbose.  Check for
6493         a non-executable section linked to an EXIDX section.
6494         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6495         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6496         check that there is no deferred EXIDX section if we exit early.
6497         Instead of not making an EXIDX section in case of an error, make one
6498         and set the has_errors flag of it.
6499         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6500         in a relocatable link.
6501         (Target_arm::do_relax): Look for the EXIDX output section instead of
6502         assuming that it is called .ARM.exidx.
6503         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6504         section list.  Do not check for SHF_EXECINSTR section flags but
6505         skip any input section with errors.
6506         * output.cc (Output_section::Output_section): Initialize
6507         always_keeps_input_sections_ to false.
6508         (Output_section::add_input_section): Check for
6509         always_keeps_input_sections_.
6510         *  output.h (Output_section::always_keeps_input_sections,
6511         Output_section::set_always_keeps_input_sections): New methods.
6512         (Output_section::always_keeps_input_sections): New data member.
6513
6514 2010-07-13  Rafael Espindola  <espindola@google.com>
6515
6516         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6517         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6518
6519 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6520             Ian Lance Taylor  <iant@google.com>
6521
6522         * output.h (Output_section_lookup_maps::add_merge_section):
6523         Correct check of whether value was inserted.
6524         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6525         (Output_section_lookup_maps::add_relaxed_input_section):
6526         Likewise.
6527         * arm.cc (Target_arm::got_section): Remove used local os.
6528         * i386.cc (Target_i386::got_section): Likewise.
6529         * x86_64.cc (Target_x86_64::got_section): Likewise.
6530         * sparc.cc (Target_sparc::got_section): Likewise.
6531         (Target_sparc::relocate): Remove unused local have_got_offset.
6532         * powerpc.cc (Target_powerpc::relocate): Likewise.
6533
6534 2010-07-13  Ian Lance Taylor  <iant@google.com>
6535
6536         * compressed_output.cc (zlib_decompress): Fix signature in
6537         !HAVE_ZLIB_H case.
6538
6539         * archive.cc (Archive::include_member): Unlock an external member
6540         of a thin archive.  Don't bother to delete an object we know is
6541         NULL.
6542
6543 2010-07-12  Cary Coutant  <ccoutant@google.com>
6544
6545         * compressed_output.cc (zlib_decompress): New function.
6546         (get_uncompressed_size): New function.
6547         (decompress_input_section): New function.
6548         * compressed_output.h (get_uncompressed_size): New function.
6549         (decompress_input_section): New function.
6550         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6551         Handle compressed debug sections.
6552         * layout.cc (is_compressed_debug_section): New function.
6553         (Layout::output_section_name): Map compressed section names to
6554         canonical names.
6555         * layout.h (is_compressed_debug_section): New function.
6556         (is_debug_info_section): Recognize compressed debug sections.
6557         * merge.cc: Include compressed_output.h.
6558         (Output_merge_data::do_add_input_section): Handle compressed
6559         debug sections.
6560         (Output_merge_string::do_add_input_section): Handle compressed
6561         debug sections.
6562         * object.cc: Include compressed_output.h.
6563         (Sized_relobj::Sized_relobj): Initialize new data members.
6564         (build_compressed_section_map): New function.
6565         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6566         * object.h (Object::section_is_compressed): New method.
6567         (Object::do_section_is_compressed): New method.
6568         (Sized_relobj::Compressed_section_map): New type.
6569         (Sized_relobj::do_section_is_compressed): New method.
6570         (Sized_relobj::compressed_sections_): New data member.
6571         * output.cc (Output_section::add_input_section): Handle compressed
6572         debug sections.
6573         * reloc.cc: Include compressed_output.h.
6574         (Sized_relobj::write_sections): Handle compressed debug sections.
6575
6576 2010-07-08  Cary Coutant  <ccoutant@google.com>
6577
6578         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6579         weak when resolving to a dynamic def.
6580         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6581         for weak undef/dynamic def cases. Adjust callers.
6582         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6583         undef_binding_weak_.
6584         (Symbol_table::sized_write_globals): Adjust symbol binding.
6585         (Symbol_table::sized_write_symbol): Add binding parameter.
6586         * symtab.h (Symbol::set_undef_binding): New method.
6587         (Symbol::is_undef_binding_weak): New method.
6588         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6589         (Symbol_table::should_override): Add new parameter.
6590         (Symbol_table::sized_write_symbol): Add new parameter.
6591
6592         * testsuite/weak_undef_file1.cc: Add new test case.
6593         * testsuite/weak_undef_file2.cc: Fix header comment.
6594         * testsuite/weak_undef_test.cc: Add new test case.
6595
6596 2010-06-29  Doug Kwan  <dougkwan@google.com>
6597
6598         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6599         Initialize USE_SYMBOL_.
6600         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6601         definition.
6602         (Arm_reloc_property::uses_symbol_): New data member declaration.
6603         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6604         uses symbol value and symbol is undefined but not weakly undefined.
6605
6606 2010-06-28  Rafael Espindola  <espindola@google.com>
6607
6608         * plugin.cc (Plugin::load): Use dlerror.
6609
6610 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6611
6612         * symtab.cc (detect_odr_violations): When reporting an ODR
6613         violation, report an object where the symbol is defined.
6614
6615 2010-06-25  Doug Kwan  <dougkwan@google.com>
6616
6617         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6618         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6619         definition.
6620         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6621         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6622         target hook to detect function points.
6623         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6624         * icf.h (Icf::check_section_for_function_pointers): Change type of
6625         parameter SECTION_NAME to const reference to std::string.  Use
6626         target hook to determine if section may have unsafe pointers.
6627         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6628         method definition.
6629
6630 2010-06-21  Rafael Espindola  <espindola@google.com>
6631
6632         * fileread.cc (Input_file::find_fie): New
6633         (Input_file::open): Use Input_file::find_fie.
6634         * fileread.h (Input_file::find_fie): New
6635         * plugin.cc (set_extra_library_path): New.
6636         (Plugin::load): Add set_extra_library_path to the transfer vector.
6637         (Plugin_manager::set_extra_library_path): New.
6638         (Plugin_manager::add_input_file): Use the extra search path if set.
6639         (set_extra_library_path(): New.
6640         * plugin.h (Plugin_manager): Add set_extra_library_path and
6641         extra_search_path_.
6642
6643 2010-06-19  Cary Coutant  <ccoutant@google.com>
6644
6645         * layout.cc (gdb_sections): Add .debug_types.
6646         (lines_only_debug_sections): Likewise.
6647
6648 2010-06-18  Rafael Espindola  <espindola@google.com>
6649
6650         * plugin.cc (add_input_file,add_input_library)
6651         (Plugin_manager::add_input_file): Make filename arguments const.
6652         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6653         const.
6654
6655 2010-06-16  Doug Kwan  <dougkwan@google.com>
6656
6657         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6658         .ARM.attributes section if we have not merged any input
6659         attributes sections.
6660
6661 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6662
6663         * arm.cc: Allow combining objects with no EABI version
6664         information.
6665
6666 2010-06-15  Rafael Espindola  <espindola@google.com>
6667
6668         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6669
6670 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6671
6672         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6673         (struct iovec): Correct !HAVE_READV definition.
6674
6675 2010-06-10  Cary Coutant  <ccoutant@google.com>
6676
6677         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6678         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6679         reloc sections.
6680         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6681
6682         PR 11683
6683         * symtab.h (Symbol::is_placeholder): New member function.
6684         * target-reloc.h (relocate_section): Check for placeholder symbols.
6685
6686         * testsuite/Makefile.am (plugin_test_8): New test.
6687         (plugin_test_9): New test.
6688         * testsuite/Makefile.in: Regenerate.
6689
6690 2010-06-09  Nick Clifton  <nickc@redhat.com>
6691
6692         * yyscript.y (input_list_element): Allow strings prefixed with
6693         the '-' character.  Treat these as libraries.
6694         * script.cc (script_add_library): New function.  Adds a library
6695         specified by "-l<name>" found in an input script.
6696         * script-c.h: Add prototype for script_add_library.
6697
6698 2010-06-07  Doug Kwan  <dougkwan@google.com>
6699
6700         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6701         Restrict stub-group size to be within long conditional branch
6702         range when working around cortex-A8 erratum.
6703
6704 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6705
6706         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6707         #ifdef typo.
6708
6709 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6710
6711         PR gold/11658
6712         * output.cc
6713         (Output_section::Input_section_sort_entry::compare_section_ordering):
6714         Change to return non-zero correctly.
6715         (Output_section::Input_section_sort_section_order_index_compare
6716         ::operator()): Change to fix ambiguity in comparisons.
6717
6718 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6719
6720         * gold.h (is_wildcard_string): New function.
6721         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6722         (Layout::layout_eh_frame): Ditto.
6723         (Layout::find_section_order_index): New method.
6724         (Layout::read_layout_from_file): New method.
6725         * layout.h (Layout::find_section_order_index): New method.
6726         (Layout::read_layout_from_file): New method.
6727         (Layout::input_section_position_): New private member.
6728         (Layout::input_section_glob_): New private member.
6729         * main.cc (main): Call read_layout_from_file here.
6730         * options.h (--section-ordering-file): New option.
6731         * output.cc (Output_section::input_section_order_specified_): New
6732         member.
6733         (Output_section::Output_section): Initialize new member.
6734         (Output_section::add_input_section): Add new parameter.
6735         Keep input sections when --section-ordering-file is used.
6736         (Output_section::set_final_data_size): Sort input sections when
6737         section ordering file is specified.
6738         (Output_section::Input_section_sort_entry): Add new parameter.
6739         Check sorting type.
6740         (Output_section::Input_section_sort_entry::compare_section_ordering):
6741         New method.
6742         (Output_section::Input_section_sort_compare::operator()): Change to
6743         consider section_order_index.
6744         (Output_section::Input_section_sort_init_fini_compare::operator()):
6745         Change to consider section_order_index.
6746         (Output_section::Input_section_sort_section_order_index_compare
6747         ::operator()): New method.
6748         (Output_section::sort_attached_input_sections): Change to sort
6749         according to section order when specified.
6750         (Output_section::add_input_section<32, true>): Add new parameter.
6751         (Output_section::add_input_section<64, true>): Add new parameter.
6752         (Output_section::add_input_section<32, false>): Add new parameter.
6753         (Output_section::add_input_section<64, false>): Add new parameter.
6754         * output.h (Output_section::add_input_section): Add new parameter.
6755         (Output_section::input_section_order_specified): New
6756         method.
6757         (Output_section::set_input_section_order_specified): New method.
6758         (Input_section::Input_section): Initialize section_order_index_.
6759         (Input_section::section_order_index): New method.
6760         (Input_section::set_section_order_index): New method.
6761         (Input_section::section_order_index_): New member.
6762         (Input_section::Input_section_sort_section_order_index_compare): New
6763         struct.
6764         (Output_section::input_section_order_specified_): New member.
6765         * script-sections.cc (is_wildcard_string): Delete and move modified
6766         method to gold.h.
6767         (Output_section_element_input::Output_section_element_input): Modify
6768         call to is_wildcard_string.
6769         (Output_section_element_input::Input_section_pattern
6770         ::Input_section_pattern): Ditto.
6771         (Output_section_element_input::Output_section_element_input): Ditto.
6772         * testsuite/Makefile.am (final_layout): New test case.
6773         * testsuite/Makefile.in: Regenerate.
6774         * testsuite/final_layout.cc: New file.
6775         * testsuite/final_layout.sh: New file.
6776
6777 2010-06-01  Rafael Espindola  <espindola@google.com>
6778
6779         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6780
6781 2010-06-01  Rafael Espindola  <espindola@google.com>
6782
6783         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6784         visibility of symbols.
6785
6786 2010-05-27  Doug Kwan  <dougkwan@google.com>
6787
6788         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6789         from start of output section instead of address for a local symbol
6790         in a merged or relaxed section when doing a relocatable link.
6791
6792 2010-05-26  Rafael Espindola  <espindola@google.com>
6793
6794         PR 11604
6795         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6796         adding sections the garbage collector removed.
6797         * gold/testsuite/Makefile.am: Add test.
6798         * gold/testsuite/Makefile.in: Regenerate.
6799         * gold/testsuite/plugin_test_7.sh: New.
6800         * gold/testsuite/plugin_test_7_1.c: New.
6801         * gold/testsuite/plugin_test_7_2.c: New.
6802
6803 2010-05-26  Rafael Espindola  <espindola@google.com>
6804
6805         * script-sections.cc (Output_section_definition::set_section_addresses):
6806         Check for --section-start.
6807
6808 2010-05-26  Doug Kwan  <dougkwan@google.com>
6809
6810         * arm.cc (Arm_scan_relocatable_relocs): New class.
6811         (Target_arm::relocate_special_relocatable): New method.
6812         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6813         (Arm_relocate_functions::thumb_branch_common): Same.
6814         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6815         instead of Default_scan_relocatable_relocs.
6816         * target-reloc.h (relocate_for_relocatable): Let target handle
6817         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6818         * target.h (Sized_target::relocate_special_relocatable): New method.
6819
6820 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6821
6822         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6823
6824 2010-05-23  Doug Kwan  <dougkwan@google.com>
6825
6826         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6827         instead of a cast.
6828         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6829         with a direct branch, not a conditional branch, to a stub.
6830         * merge.cc (Output_merge_base::record_input_section): New method
6831         defintion.
6832         (Output_merge_data::do_add_input_section): Record input section if
6833         keeps-input-sections flag is set.
6834         (Output_merge_string::do_add_input_section): Ditto.
6835         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6836         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6837         INPUT_SECTIONS_.
6838         (Output_merge_base::keeps_input_sections,
6839         Output_merge_base::set_keeps_input_sections,
6840         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6841         method definitions.
6842         (Output_merge_base::Input_sections): New type declaration.
6843         (Output_merge_base::input_sections_begin,
6844         Output_merge_base::input_sections_end,
6845         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6846         (Output_merge_base::bool keeps_input_sections_,
6847         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6848         Output_merge_base::input_sections_): New data members.
6849         (Output_merge_data::do_set_keeps_input_sections): New method
6850         defintion.
6851         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6852         * output.cc (Output_section::Input_section::relobj): Move method
6853         defintion from class declaration to here and handle merge sections.
6854         (Output_section::Input_section::shndx): Ditto.
6855         (Output_section::Output_section): Remove initializations of removed
6856         data members and initialize new data member LOOKUP_MAPS_.
6857         (Output_section::add_input_section): Set keeps-input-sections flag
6858         for a newly created merge output section as appropriate.  Adjust code
6859         to use Output_section_lookup_maps class.
6860         (Output_section::add_relaxed_input_section): Adjst code for lookup
6861         maps code refactoring.
6862         (Output_section::add_merge_input_section): Add a new parameter
6863         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6864         class.  If adding input section to a newly created merge output
6865         section fails, remove the new merge section.
6866         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6867         Adjust code for use of the Output_section_lookup_maps class.
6868         (Output_section::find_merge_section): Ditto.
6869         (Output_section::build_lookup_maps): New method defintion.
6870         (Output_section::find_relaxed_input_section): Adjust code to use
6871         Output_section_lookup_maps class.
6872         (Output_section::get_input_sections): Export merge sections.  Adjust
6873         code to use Output_section_lookup_maps class.
6874         (Output_section:::add_script_input_section): Adjust code to use
6875         Output_section_lookup_maps class.  Update lookup maps for merge
6876         sections also.
6877         (Output_section::discard_states): Use Output_section_lookup_maps.
6878         (Output_section::restore_states): Same.
6879         * output.h (Merge_section_properties): Move class defintion out of
6880         Output_section.
6881         (Output_section_lookup_maps): New class.
6882         (Output_section::Input_section::is_merge_section): New method
6883         defintion.
6884         (Output_section::Input_section::relobj): Move defintion out of class
6885         defintion.  Declare method only.
6886         (Output_section::Input_section::shndx): Ditto.
6887         (Output_section::Input_section::output_merge_base): New method defintion.
6888         (Output_section::Input_section::u2_.pomb): New union field.
6889         (Output_section::Merge_section_by_properties_map,
6890         Output_section::Output_section_data_by_input_section_map,
6891         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6892         Remove types.
6893         (Output_section::add_merge_input_section): Add new parameter
6894         KEEPS_INPUT_SECTIONS.
6895         (Output_section::build_lookup_maps): New method declaration.
6896         (Output_section::merge_section_map_,
6897         Output_section::merge_section_by_properties_map_,
6898         Output_section::relaxed_input_section_map_,
6899         Output_section::is_relaxed_input_section_map_valid_): Remove data
6900         members.
6901         (Output_section::lookup_maps_): New data member.
6902
6903 2010-05-21  Doug Kwan  <dougkwan@google.com>
6904
6905         PR gold/11619
6906         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6907         avoid a compilation error.
6908
6909 2010-05-19  Rafael Espindola  <espindola@google.com>
6910
6911         * script-sections.cc (Output_section_definition::allocate_to_segment):
6912         Update the phdrs_list even when the output section is NULL.
6913         * testsuite/Makefile.am: Add test.
6914         * testsuite/Makefile.in: Regenerate.
6915         * testsuite/script_test_9.cc: New.
6916         * testsuite/script_test_9.sh: New.
6917         * testsuite/script_test_9.t: New.
6918
6919 2010-05-19  Doug Kwan  <dougkwan@google.com>
6920
6921         * arm.cc (Arm_input_section::original_size): New method.
6922         (Arm_input_section::do_addralign): Add a cast.
6923         (Arm_input_section::do_output_offset): Remove static cast.
6924         (Arm_input_section::original_addralign,
6925          Arm_input_section::original_size_): Change type to uint32_t.
6926         (Arm_input_section::init): Add safe casts for section alignment
6927         and size.
6928         (Arm_input_section::set_final_data_size): Do not set address and
6929         offset of stub table.
6930         (Arm_output_section::fix_exidx_coverage): Change use of of
6931         Output_section::Simple_input_section to that of
6932         Output_section::Input_section.
6933         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6934         except for the first pass.
6935         * output.cc (Output_section::get_input_sections): Change type of
6936         input_sections to std::list<Input_section>.
6937         (Output_section::add_script_input_section): Rename from
6938         Output_section::add_simple_input_section.  Change type of SIS
6939         parameter from Simple_input_section to Input_section.
6940         * output.h (Output_section::Simple_input_section): Remove class.
6941         (Output_section::Input_section): Change class visibility to public.
6942         (Output_section::Input_section::addralign): Use stored alignments
6943         for special input sections if set.
6944         (Output_section::Input_section::set_addralign): New method.
6945         (Output_section::get_input_sections): Change parameter type from
6946         list of Simple_input_section to list of Input_section.
6947         (Output_section::add_script_input_section): Rename from
6948         Output_section::add_simple_input_section. Change first parameter's
6949         type from Simple_input_section to Input_section and remove the
6950         second and third parameters.
6951         * script-sections.cc (Input_section::Input_section_list): Change
6952         type to list of Output_section::Input_section/
6953         (Input_section_info::Input_section_info): Change parameter type of
6954         INPUT_SECTION to Output_section::Input_section.
6955         (Input_section_info::input_section): Change return type.
6956         (Input_section_info::input_section_): Change type to
6957         Output_section::Input_section.
6958         (Output_section_element_input::set_section_addresses): Adjust code
6959         to use Output_section::Input_section instead of
6960         Output_section::Simple_input_section.  Adjust code for renaming
6961         of Output_section::add_simple_input_section.
6962         (Orphan_output_section::set_section_addresses): Ditto.
6963
6964 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6965
6966         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6967         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6968
6969 2010-05-18  Rafael Espindola  <espindola@google.com>
6970
6971         * options.cc (General_options::finalize): Handle -nostdlib.
6972         * options.h (nostdlib): New option.
6973         * script.cc (script_add_search_dir): Handle -nostdlib.
6974
6975 2010-05-12  Doug Kwan  <dougkwan@google.com>
6976
6977         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6978         attributes section only if there no attributes section after merging.
6979         (Target_arm::merge_object_attributes): Move value of
6980         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6981         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6982         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6983         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6984         and arm_attr_merge_7.stdout.
6985         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6986         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6987         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6988         arm_attr_merge_7b.o): New rules.
6989         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6990         arm_attr_merge_7
6991         * testsuite/Makefile.in: Regenerate.
6992         * testsuite/arm_attr_merge.sh: New file.
6993         * testsuite/arm_attr_merge_[67][ab].s: Same.
6994
6995 2010-05-05  Nick Clifton  <nickc@redhat.com>
6996
6997         * po/es.po: Updated Spanish translation.
6998
6999 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7000
7001         * Makefile.am (install-exec-local): Properly install gold as
7002         default cross linker.
7003         * Makefile.in: Regenerated.
7004
7005 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7006             Nick Clifton  <nickc@redhat.com>
7007
7008         * configure.ac (install_as_default): Define and set to false
7009         unless --enable-gold or --enable-gold=both/gold has been
7010         specified.
7011         * configure: Regenerate.
7012
7013         * Makefile.am (install-exec-local): Install the executable as
7014         'ld.gold'.  If install_as_default is true then also install it as
7015         'ld'.
7016         * Makefile.in: Regenerated.
7017
7018 2010-04-24  Ian Lance Taylor  <iant@google.com>
7019
7020         * layout.cc (Layout::layout_reloc): In relocatable link don't
7021         combine reloc sections for grouped sections.
7022
7023 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7024
7025         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7026         sections that are not ordinary to icf.
7027         * icf.cc (get_section_contents): Handle relocation pointing to section
7028         with no object or shndx information.
7029         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7030         * testsuite/Makefile.in: Regenerate.
7031         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7032         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7033
7034 2010-04-22  Ian Lance Taylor  <iant@google.com>
7035
7036         * expression.cc (Expression::Expression_eval_info): Add
7037         result_alignment_pointer field.
7038         (Expression::eval_with_dot): Add result_alignment_pointer
7039         parameter.  Change all callers.
7040         (Expression::eval_maybe_dot): Likewise.
7041         (class Binary_expression): Add alignment_pointer parameter to
7042         left_value and right_value.  Change all callers.
7043         (BINARY_EXPRESSION): Set result alignment.
7044         (class Trinary_expression): Add alignment_pointer parameter to
7045         arg2_value and arg3_value.  Change all callers.
7046         (Trinary_cond::value): Set result alignment.
7047         (Max_expression::value, Min_expression::value): Likewise.
7048         (Align_expression::value): Likewise.
7049         * script-sections.cc (class Sections_element): Add dot_alignment
7050         parameter to set_section_addresses virtual function.  Update
7051         instantiations.
7052         (class Output_section_element): Likewise.
7053         (Script_sections::create_segments): Add dot_alignment parameter.
7054         Change all callers.
7055         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7056         (Script_sections::set_phdrs_clause_addresses): Likewise.
7057         * script-sections.h: Update declarations.
7058         * script.h: Update declarations.
7059         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7060         min_p_align.
7061         * testsuite/script_test_3.t: Set large alignment.
7062         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7063         segment has expected alignment.
7064
7065 2010-04-22  Nick Clifton  <nickc@redhat.com>
7066
7067         * po/gold.pot: Updated by the Translation project.
7068         * po/vi.po: Updated Vietnamese translation.
7069
7070 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7071
7072         * testsuite/Makefile.am (check_PROGRAMS): Add
7073         icf_virtual_function_folding_test.
7074         * testsuite/Makefile.in: Regenerated.
7075
7076 2010-04-15  Andrew Haley  <aph@redhat.com>
7077
7078         * options.h (merge_exidx_entries): New option.
7079         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7080         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7081         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7082         (Target_arm::merge_exidx_entries): New function.
7083         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7084         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7085         to Arm_exidx_fixup constructor.
7086         Add new arg, merge_exidx_entries.
7087         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7088         Arm_output_section::fix_exidx_coverage.
7089
7090 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7091
7092         * icf.cc (get_section_contents): Check for preemptible functions.
7093         Ignore addend when appropriate.
7094         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7095         section folded.
7096         (add_from_relobj): Check for section folded.
7097         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7098         * symtab.h (should_add_dynsym_entry): Add new parameter.
7099         * target-reloc.h (scan_relocs): Check for section folded.
7100         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7101         Check reloc types for function pointers in shared objects.
7102         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7103         case.
7104         (icf_preemptible_functions_test): New test case.
7105         (icf_string_merge_test): New test case.
7106         * testsuite.Makefile.in: Regenerate.
7107         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7108         bar_glob.  Refactor code.
7109         * testsuite/icf_preemptible_functions_test.cc: New file.
7110         * testsuite/icf_preemptible_functions_test.sh: New file.
7111         * testsuite/icf_string_merge_test.cc: New file.
7112         * testsuite/icf_string_merge_test.sh: New file.
7113         * testsuite/icf_virtual_function_folding_test.cc: New file.
7114         * testsuite/icf_virtual_function_folding_test.sh: New file.
7115
7116 2010-04-14  Doug Kwan  <dougkwan@google.com>
7117
7118         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7119         for local symbol recounting if we remove a section due to ICF.
7120         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7121         there are no regular objects in input.
7122
7123 2010-04-13  Doug Kwan  <dougkwan@google.com>
7124
7125         * arm.cc (Arm_input_section::set_final_data_size): Compute
7126         accurate final data size instead of using current data size.
7127
7128 2010-04-09  Doug Kwan  <dougkwan@google.com>
7129
7130         * layout.cc (Layout::choose_output_section): Handle script section
7131         types.
7132         (Layout::make_output_section_for_script): Add section type parameter.
7133         Handle script section types.
7134         * layout.h (Layout::make_output_section_for_script): Add section
7135         type parameter.
7136         * output.cc (Output_section::Output_section): Initialize data member
7137         is_noload_.
7138         (Output_section::do_reset_address_and_file_offset): Do not set address
7139         to 0 if section is a NOLOAD section.
7140         * output.h (Output_section::is_noload): New method.
7141         (Output_section::set_is_noload): Ditto.
7142         (Output_section::is_noload_): New data member.
7143         * script-c.h (Script_section_type): New enum type.
7144         (struct Parser_output_section_header): Add new file section_type.
7145         * script-sections.cc (Sections_element::output_section_name): Add
7146         parameter for returning script section type.
7147         (Output_section_definition::output_section_name): Ditto.
7148         (Output_section_definition::section_type)P; New method.
7149         (Output_section_definiton::script_section_type_name): Ditto.
7150         (Output_section_definition::script_section_type_): New data member.
7151         (Output_section_definition::Output_section_definition): Initialize
7152         data member Output_section_definition::script_section_type_.
7153         (Output_section_definition::create_sections): Pass script section type
7154         to Layout::make_output_section_for_script.
7155         (Output_section_definition::output_section_name): Return script
7156         section type to caller.
7157         (Output_section_definition::set_section_address): Do not advance
7158         dot value and load address if section type is NOLOAD.  Set address
7159         of NOLOAD sections regardless of section flags.
7160         (Output_section_definition::print): Print section type if it is
7161         not SCRIPT_SECTION_TYPE_NONE.
7162         (Output_section_definition::section_type): New method.
7163         (Output_section_definition::script_section_type_name): Ditto.
7164         (Script_sections::output_section_name): Add new parameter
7165         PSECTION_TYPE for returning script section type.  Pass it to
7166         section elements.  Handle discard sections.
7167         (Sort_output_sections::operator()): Handle NOLOAD sections.
7168         * script-sections.h (Script_sections::Section_type): New enum type.
7169         (Script_sections::output_section_name): Add a new parameter for
7170         returning script section type.
7171         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7172         INFO and NOLOAD.
7173         * yyscript.y (union): Add new field SECTION_TYPE.
7174         (COPY, DSECT, INFO, NOLOAD): New tokens.
7175         (opt_address_and_section_type): Change type to output_section_header.
7176         (section_type): New non-terminal
7177         (section_header): Handle section type.
7178         (opt_address_and_section_type): Return section type value.
7179
7180 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7181
7182         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7183         * testsuite/plugin_common_test_2.c (foo): Likewise.
7184
7185 2010-04-08  Doug Kwan  <dougkwan@google.com>
7186
7187         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7188         Output_merge_data.
7189         * output.cc (Output_section::add_merge_input_section): Simplify
7190         code and return status of Output_merge_base::add_input_section.
7191         Update merge section map only if Output_merge_base::add_input_section
7192         returns true.
7193
7194 2010-04-07  Doug Kwan  <dougkwan@google.com>
7195
7196         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7197         if section is marked as containing instructions but has no mapping
7198         symbols.
7199         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7200         correct section index.
7201         (Arm_relobj::find_linked_text_section): Ditto.
7202
7203 2010-04-07  Cary Coutant  <ccoutant@google.com>
7204
7205         * archive.cc (include_member): Destroy Read_symbols_data object before
7206         releasing file.
7207         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7208         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7209         (Read_symbols_data::~Read_symbols_data) New destructor.
7210         (Section_relocs::Section_relocs) New constructor.
7211         (Section_relocs::~Section_relocs) New destructor.
7212         (Read_relocs_data::Read_relocs_data) New constructor.
7213         (Read_relocs_data::~Read_relocs_data) New destructor.
7214         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7215         pointers to NULL after deleting.
7216
7217 2010-04-07  Doug Kwan  <dougkwan@google.com>
7218
7219         * arm.cc: Replace "endianity" with "endianness" in comments.
7220         (Arm_exidx_cantunwind): Ditto.
7221         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7222         (Arm_relobj::merge_flags_and_attributes): New method.
7223         (Arm_relobj::merge_flags_and_attributes_): New data member.
7224         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7225         (Arm_relobj::scan_sections_for_stubs): Ditto.
7226         (Arm_relobj::do_read_symbols): Check to see if we really want to
7227         merge processor-specific flags and attributes.  Exit early if
7228         an object is empty except for section names and the undefined symbol.
7229         (Target_arm::do_finalize_sections): Move check for ELF format to
7230         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7231         attributes from a regular object only when we have determined that
7232         it is aapropriate.  Do not create an .ARM.attributes section in
7233         output if there is no regular input object.
7234         (Target_arm::merge_processor_specific_flags): Check
7235         --warn-mismatch before printing any error.
7236         (Target_arm::merge_object_attributes): Ditto.
7237         * gold.cc (queue_middle_tasks): Handle the case in which there is
7238         no regular object in input.
7239         * options.cc (General_options::parse_EB): New method.
7240         (General_options::parse_EL): Same.
7241         (General_options::General_options): Initialize endianness_.
7242         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7243         New options.
7244         (General_options::Endianness): New enum.
7245         (General_options::endianness): New method.
7246         (General_options::endianness_): New data member.
7247         * parameters.cc (Parameters::set_options): Check target endianness.
7248         (Parameters::set_target_once): Ditto.
7249         (Parameters::check_target_endianness): New method.
7250         (parameters_force_valid_target): If either -EL or -EB is specified,
7251         use it to define endianness of default target.
7252         * parameters.h (Parameters::check_target_endianness): New method
7253         declaration.
7254         * target.h (class Target): Change "endianity" to "endianness"
7255         in comments.
7256
7257 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7258
7259         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7260         * configure: Regenerate.
7261         * Makefile.in: Regenerate.
7262         * testsuite/Makefile.in: Regenerate.
7263
7264 2010-04-06  Cary Coutant  <ccoutant@google.com>
7265
7266         gcc PR lto/42757
7267         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7268         prevailing definitions of common symbols.
7269         * testsuite/plugin_test_6.sh: New test case.
7270         * testsuite/plugin_common_test_1.c: New test case.
7271         * testsuite/plugin_common_test_2.c: New test case.
7272         * testsuite/Makefile.am (plugin_test_6): New test case.
7273         * testsuite/Makefile.in: Regenerate.
7274
7275 2010-04-06  Nick Clifton  <nickc@redhat.com>
7276
7277         * po/vi.po: New Vietnamese translation.
7278
7279 2010-03-30  Doug Kwan  <dougkwan@google.com>
7280
7281         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7282
7283 2010-03-25  Doug Kwan  <dougkwan@google.com>
7284
7285         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7286         to avoid a conversion warning on a 32-bit host.
7287
7288 2010-03-24  Ian Lance Taylor  <iant@google.com>
7289
7290         * testsuite/script_test_3.t: Add a TLS segment.
7291         * testsuite/Makefile.am (check_PROGRAMS): Add
7292         tls_phdrs_script_test.
7293         (tls_phdrs_script_test_SOURCES): Define.
7294         (tls_phdrs_script_test_DEPENDENCIES): Define.
7295         (tls_phdrs_script_test_LDFLAGS): Define.
7296         (tls_phdrs_script_test_LDADD): Define.
7297         * testsuite/Makefile.in: Rebuild.
7298
7299 2010-03-23  Cary Coutant  <ccoutant@google.com>
7300
7301         * fileread.cc (find_or_make_view): Fix comment.
7302
7303 2010-03-23  Ian Lance Taylor  <iant@google.com>
7304
7305         * script-sections.cc (class Orphan_section_placement): Define
7306         PLACE_TLS and PLACE_TLS_BSS.
7307         (Orphan_section_placement::Orphan_section_placement): Initialize
7308         new places.
7309         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7310         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7311         (tls_script_test_SOURCES): Define.
7312         (tls_script_test_DEPENDENCIES): Define.
7313         (tls_script_test_LDFLAGS): Define.
7314         (tls_script_test_LDADD): Define.
7315         * testsuite/Makefile.in: Rebuild.
7316
7317 2010-03-22  Doug Kwan  <dougkwan@google.com>
7318
7319         * arm.cc (Arm_relocate_functions::abs8,
7320         Arm_relocate_functions::abs16): Use correct check for overflow
7321         specified in the ARM ELF specs.
7322         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7323         target of a BLX instruction specially.
7324         (Reloc_stub::stub_type_for_reloc): Ditto.
7325         (Relocate::relocate): Use symbolic names instead of numeric relocation
7326         codes to report error.
7327         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7328         workaround.
7329         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7330         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7331         thumb2_blx_out_of_range.stdout
7332         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7333         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7334         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7335         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7336         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7337         thumb2_blx_in_range, thumb2_blx_in_range.o,
7338         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7339         thumb2_blx_out_of_range.o): New rules.
7340         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7341         thumb2_blx_in_range and thumb2_blx_out_of_range.
7342         * testsuite/Makefile.in: Regenerate.
7343         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7344         * testsuite/thumb_blx_in_range.s: New file.
7345         * testsuite/thumb_blx_out_of_range.s: New file.
7346
7347 2010-03-22  Rafael Espindola  <espindola@google.com>
7348
7349         * archive.cc (Should_include): Move to archive.h.
7350         (should_include_member): Make it a member of Archive.
7351         (Lib_group): New.
7352         (Add_lib_group_symbols): New.
7353         * archive.h: Include options.h.
7354         (Archive_member): Moved from Archive.
7355         (Should_include): Moved from archive.cc.
7356         (Lib_group): New.
7357         (Add_lib_group_symbols): New.
7358         * dynobj.cc (do_should_include_member): New.
7359         * dynobj.h (do_should_include_member): New.
7360         * gold.cc (queue_initial_tasks): Update call to queue.
7361         * main.cc (main): Print lib group stats.
7362         * object.cc (do_should_include_member): New.
7363         * object.h: Include archive.h.
7364         (Object::should_include_member): New.
7365         (Object::do_should_include_member): New.
7366         (Sized_relobj::do_should_include_member): New.
7367         * options.cc (General_options::parse_start_lib): New.
7368         (General_options::parse_end_lib): New.
7369         (Input_arguments::add_file): Handle lib groups.
7370         (Input_arguments::start_group): Check we are not in a lib.
7371         (Input_arguments::start_lib): New.
7372         (Input_arguments::end_lib): New.
7373         * options.h (General_options): Add start_lib and end_lib.
7374         (Input_argument::lib_): New.
7375         (Input_argument::lib): New.
7376         (Input_argument::is_lib): New.
7377         (Input_file_lib): New.
7378         (Input_arguments::in_lib_): New.
7379         (Input_arguments::in_lib): New.
7380         (Input_arguments::start_lib): New.
7381         (Input_arguments::end_lib_): New.
7382         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7383         in unused members as preempted.
7384         (Sized_pluginobj::do_should_include_member): New.
7385         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7386         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7387         return the blocker.
7388         (Read_symbols::do_whole_lib_group): New.
7389         (Read_symbols::do_lib_group): New.
7390         (Read_symbols::do_read_symbols): Handle lib groups.
7391         (Read_symbols::get_name): Handle lib groups.
7392         * readsyms.h (Read_symbols): Add an archive member pointer.
7393         (Read_symbols::do_whole_lib_group): New.
7394         (Read_symbols::do_lib_group): New.
7395         (Read_symbols::member_): New.
7396         * script.cc (read_input_script): Update call to queue_soon.
7397
7398 2010-03-19  Doug Kwan  <dougkwan@google.com>
7399
7400         * arm.cc (Stub_table::Stub_table): Initialize new data members
7401         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7402         (Stub_table::add_reloc_stub): Assign stub offset and update
7403         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7404         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7405         New data members.
7406         (Stub_table::update_data_size_and_addralign): Use
7407         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7408         instead of going over all reloc stubs.
7409         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7410         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7411         Stringpool_template::offset_ to size of Stringpool_char.
7412         (Stringpool_template::new_key_offset): Remove code to initialize
7413         Stringpool_template::offset_.
7414         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7415         Stringpool_template::offset_ to zero.
7416
7417 2010-03-15  Doug Kwan  <dougkwan@google.com>
7418
7419         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7420         offset_.
7421         (Stringpool_template::new_key_offset): New method.
7422         (Stringpool_template::add_string): Assign offsets when adding new
7423         strings.
7424         (Stringpool_template::set_string_offsets): Do not set string offsets
7425         when not optimizing.
7426         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7427         member size_.
7428         (Chunked_vector::clear): Clear size_.
7429         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7430         (Chunked_vector::size): Return size_.
7431         (Chunked_vector::push_back): Use size_ to find insert position.
7432         (Chunked_vector::size_): New data member.
7433         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7434         (Stringpool_template::new_key_offset): New method declaration.
7435         (Stringpool_template::offset_): New data member.
7436
7437 2010-03-15   Rafael Espindola  <espindola@google.com>
7438
7439         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7440         Add_symbols' constructor.
7441         * readsyms.h (Add_symbols): Remove the input_group member.
7442
7443 2010-03-10  Ian Lance Taylor  <iant@google.com>
7444
7445         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7446         target to ask whether a reference to a symbol requires a stack
7447         split.
7448         * target.h (Target::is_call_to_non_split): New function.
7449         (Target::do_is_call_to_non_split): Declare virtual function.
7450         * target.cc: Include "symtab.h".
7451         (Target::do_is_call_to_non_split): New function.
7452         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7453
7454 2010-03-10  Cary Coutant  <ccoutant@google.com>
7455
7456         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7457         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7458         (File_read::open[2]): Add whole_file_view_ to list of views.
7459         (File_read::make_view): Remove test of whole_file_view_.
7460         (File_read::find_or_make_view): Create whole_file_view_ if
7461         necessary.
7462         (File_read::clear_views): Replace bool parameter with enum;
7463         adjust all callers.  Don't delete views with permanent data;
7464         do delete cached views and views from archives if
7465         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7466         if clearing the corresponding view.
7467         * fileread.h (File_read::Clear_views_mode): New enum.
7468         (File_read::View::is_permanent_view): New method.
7469         (File_read::clear_views): Replace bool parameter
7470         with enum; adjust all callers.
7471         * options.h (General_options): Change keep_files_mapped option;
7472         add map_whole_files.
7473         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7474         releasing the file.
7475         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7476         the file.
7477
7478 2010-03-10  David S. Miller  <davem@davemloft.net>
7479
7480         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7481
7482 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7483
7484         * icf.cc (get_section_contents): Add '@' marker after processing the
7485         merge reloc.
7486
7487 2010-03-08  Doug Kwan  <dougkwan@google.com>
7488
7489         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7490         due to a conversion warning.
7491         (Arm_relobj::update_output_local_symbol_count): Check for local
7492         symbol with unset output index.
7493
7494 2010-03-05  Ian Lance Taylor  <iant@google.com>
7495
7496         * options.h (class General_options): Add --spare-dynamic-tags.
7497         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7498         --spare-dynamic-tags.
7499
7500 2010-03-05  Ian Lance Taylor  <iant@google.com>
7501
7502         * incremental.cc: Include "libiberty.h".
7503
7504 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7505
7506         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7507         function, is_info_ member.
7508         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7509         (Versions::Versions): Update caller.
7510         (Versions::define_base_version): Likewise.
7511         (Versions::add_def): Likewise.
7512
7513 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7514
7515         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7516         (Scan::possible_function_pointer_reloc): New function.
7517         (Scan::local_reloc_may_be_function_pointer): Change to call
7518         possible_function_pointer_reloc.
7519         (Scan::global_reloc_may_be_function_pointer): Ditto.
7520         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7521         relocations in ".data.rel.ro._ZTV" section.
7522         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7523         * testsuite/icf_safe_so_test.cc: Ditto.
7524         * testsuite/icf_safe_test.cc: Ditto.
7525         * testsuite/icf_safe_test.sh: Ditto.
7526
7527 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7528             Ian Lance Taylor  <iant@google.com>
7529
7530         * target-reloc.h (relocate_section): Check the symbol table index
7531         for -1U before setting the local symbol index.
7532         (scan_relocatable_relocs): If copying the relocation, record that
7533         the local symbol is required.
7534         * object.h (Symbol_value::is_output_symtab_index_set): New
7535         function.
7536         (Symbol_value::may_be_discarded_from_output_symtab): New
7537         function.
7538         (Symbol_value::has_output_symtab_entry): New function.
7539         (Symbol_value::needs_output_symtab_entry): Remove.
7540         (Symbol_value::output_symtab_index): Make sure the symbol index is
7541         set.
7542         (Symbol_value::set_output_symtab_index): Make sure the symbol
7543         index is not set.  Make sure the new index is valid.
7544         (Symbol_value::set_must_have_output_symtab_entry): New function.
7545         (Symbol_value::has_output_dynsym_entry): New function.
7546         (Symbol_value::set_output_dynsym_index): Make sure the new index
7547         is valid.
7548         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7549         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7550         local symbol if permitted.
7551         (Sized_relobj::do_finalize_local_symbols): Call
7552         is_output_symtab_index_set rather than needs_output_symtab_entry.
7553         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7554         rather than needs_output_symtab_entry.  Call
7555         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7556         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7557         is_output_symtab_index_set rather than needs_output_symtab_entry.
7558         * testsuite/discard_locals_relocatable_test.c: New file.
7559         * testsuite/discard_locals_test.sh: Test -r.
7560         * testsuite/Makefile.am (check_DATA): Add
7561         discard_locals_relocatable_test1.syms,
7562         discard_local_relocatable_test2.syms.
7563         (MOSTLYCLEANFILES): Likewise.  Also add
7564         discard_locals_relocatable_test1.lout and
7565         discard_locals_relocatable_test2.out.
7566         (discard_locals_relocatable_test1.syms): New target.
7567         (discard_locals_relocatable_test.o): New target.
7568         (discard_locals_relocatable_test1.out): New target.
7569         (discard_locals_relocatable_test2.syms): New target.
7570         (discard_locals_relocatable_test2.out): New target.
7571         (various): Add missing ../ld-new dependencies.
7572         * testsuite/Makefile.in: Rebuild.
7573
7574 2010-03-03  Nick Clifton  <nickc@redhat.com>
7575
7576         * po/fi.po: New Finnish translation.
7577
7578 2010-03-01  Doug Kwan  <dougkwan@google.com>
7579
7580         * layout.cc (Layout::Layout): Force section types of .init_array*,
7581         .preinit_array* and .fini_array* sections.
7582         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7583         Fix check of return value of std::string::find.().
7584         (Output_section::Input_section_sort_compare::operator()): Remove
7585         comment about .init_array.
7586         (Output_section::Input_section_sort_init_fini_compare::operator()):
7587         New method.
7588         (Output_section::sort_attached_input_sections): Handle .init_array
7589         and .fini_array specially.
7590         * output.h (Output_section::Inut_section_sort_compare): Update
7591         comment.
7592         (Output_section::Input_section_sort_init_fini_compare): New struct.
7593
7594 2010-02-26  Doug Kwan  <dougkwan@google.com>
7595
7596         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7597         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7598         * testsuite/debug_msg.sh: Avoid matching source line number for
7599         use of global variable undef_int.
7600
7601 2010-02-26  Doug Kwan  <dougkwan@google.com>
7602
7603         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7604         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7605         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7606         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7607         * options.cc (General_options::General_options): Initialize member
7608         fix_v4bx_.
7609         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7610         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7611         and rm_no_fix_v4bx.stdout
7612         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7613         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7614         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7615         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7616         and arm_no_fix_v4bx.
7617         * Makefile.in: Regenerate.
7618         * testsuite/arm_fix_v4bx.s: New file.
7619         * testsuite/arm_fix_v4bx.sh: Ditto.
7620
7621 2010-02-24  Doug Kwan  <dougkwan@google.com>
7622
7623         * arm.cc (Target_arm::got_section): Make the .got section the first
7624         non RELRO section in the data segment.
7625         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7626         suffixes of section names.
7627
7628 2010-02-24  Doug Kwan  <dougkwan@google.com>
7629
7630         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7631         flags and attributes merging if an input file is a binary file.
7632         * fileread.cc (Input_file::open): Record format of original file.
7633         * fileread.h (Input_file::Format): New enum type.
7634         (Input_file::Input_file): Initialize data member format_.
7635         (Input_file::format): New method definition.
7636         (Input_file::format_):: New data member.
7637
7638 2010-02-24  Doug Kwan  <dougkwan@google.com>
7639
7640         * arm.cc (Arm_output_data_got): New class.
7641         (ARM_TCB_SIZE): New constant
7642         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7643         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7644         If user uses a script with a SECTIONS clause, issue only a warning
7645         for a misplaced EXIDX input section.  Otherwise, issue an error.
7646         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7647         garbage collection.
7648         (Target_arm::got_mode_index_entry): Handle static linking.
7649         (Target_arm::Scan::local): Ditto.
7650         (Target_arm::Scan::global): Ditto.
7651         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7652         all incorrectly implemented relocations.
7653         (Target_arm::fix_exidx_coverage): Pass layout to
7654         Arm_output_section::fix_exidx_coverage.
7655         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7656         from ".ARM.exidx." and ".ARM.extab.".
7657
7658 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7659
7660         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7661         section if it does not already exist.
7662         * attributes.cc (Attributes_section_data::Attributes_section_data):
7663         Don't crash if size is zero.
7664
7665 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7666             Ian Lance Taylor  <iant@google.com>
7667
7668         * gold.cc (queue_middle_tasks): If no input files were opened,
7669         exit.
7670         * workqueue.h (Task_function::Task_function): Assert that there is
7671         a blocker.
7672
7673 2010-02-22  Doug Kwan  <dougkwan@google.com>
7674
7675         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7676         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7677         types to avoid warnings due to different uint64_t implementations
7678         on different hosts.
7679
7680 2010-02-21  Doug Kwan  <dougkwan@google.com>
7681
7682         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7683         handling of the maximum backward branch offset.
7684         (Arm_relocate_functions::thumb_branch_common): Ditto.
7685         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7686         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7687         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7688         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7689         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7690         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7691         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7692         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7693         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7694         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7695         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7696         thumb2_bl_out_of_range.o): New rules.
7697         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7698         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7699         thumb2_bl_out_of_range
7700         * testsuite/Makefile.in: Regenerate.
7701         * testsuite/arm_bl_in_range.s: New file.
7702         * testsuite/arm_bl_out_of_range.s: Ditto.
7703         * testsuite/arm_branch_in_range.sh: Ditto.
7704         * testsuite/arm_branch_range.t: Ditto.
7705         * testsuite/thumb2_branch_range.t: Ditto.
7706         * testsuite/thumb_bl_in_range.s: Ditto.
7707         * testsuite/thumb_bl_out_of_range.s: Ditto.
7708         * testsuite/thumb_branch_range.t: Ditto.
7709
7710 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7711
7712         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7713         Add reloc offset information.
7714         * icf.cc (get_section_contents): Change iterators to point to the new
7715         vectors. Add reloc offset information to the contents.
7716         * icf.h (Icf::Sections_reachable_info): New typedef.
7717         (Icf::Sections_reachable_list): New typedef.
7718         (Icf::Offset_info): New typedef.
7719         (Icf::Reloc_info): New struct typedef.
7720         (Icf::Reloc_info_list): New typedef.
7721         (Icf::symbol_reloc_list): Delete method.
7722         (Icf::addend_reloc_list): Delete method.
7723         (Icf::section_reloc_list): Delete method.
7724         (Icf::reloc_info_list): New method.
7725         (Icf::reloc_info_list_): New member.
7726
7727 2010-02-19  Doug Kwan  <dougkwan@google.com>
7728
7729         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7730         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7731         * arm.cc (Arm_relocation_functions): New forward declaration.
7732         (Target_arm::Target_arm): Initialize new data members
7733         got_mod_index_offset_ and tls_base_symbol_defined_.
7734         (Target_arm::Relocate::relocate_tls): New method.
7735         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7736          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7737         New methods.
7738         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7739         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7740         (Target_arm::got_mod_index_offset_,
7741         Target_arm::tls_base_symbol_defined_): New data members.
7742         (Target_arm::Scan::local, Target::Scan::global,
7743         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7744         relocations.
7745
7746 2010-02-18  Doug Kwan  <dougkwan@google.com>
7747
7748         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7749         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7750         text section as a parameter becuase some broken tools may not set
7751         the link in section header.
7752         (Target_arm::has_got_section): New method.
7753         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7754         without any mapping symbol as data only.  Remove warning.
7755         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7756         link in its section header, try to discover the link by inspecting the
7757         REL31 relocation at the beginning of the section.
7758         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7759         in error message.
7760         (Target_arm::Scan::global): Treat any reference to the symbol
7761         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7762
7763 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7764
7765         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7766         (Scan::global_reloc_may_be_function_pointer): New function.
7767         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7768         (Scan::global_reloc_may_be_function_pointer): New function.
7769         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7770         (Scan::global_reloc_may_be_function_pointer): New function.
7771         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7772         (Scan::global_reloc_may_be_function_pointer): New function.
7773         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7774         (Scan::global_reloc_may_be_function_pointer): New function.
7775         (Scan::possible_function_pointer_reloc): New function.
7776         (Target_x86_64::can_check_for_function_pointers): New function.
7777         * gc.h (gc_process_relocs): Scan relocation types to determine if
7778         function pointers were taken for targets that support it.
7779         * icf.cc (Icf::find_identical_sections): Include functions for
7780         folding in safe ICF whose pointer is not taken.
7781         * icf.h (Secn_fptr_taken_set): New typedef.
7782         (fptr_section_id_): New member.
7783         (section_has_function_pointers): New function.
7784         (set_section_has_function_pointers): New function.
7785         (check_section_for_function_pointers): New function.
7786         * options.h: Fix comment for safe ICF option.
7787         * target.h (can_check_for_function_pointers): New function.
7788         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7789         Modify icf_safe_test for X86-64.
7790         * testsuite/Makefile.in: Regenerate.
7791         * testsuite/icf_safe_so_test.cc: New file.
7792         * testsuite/icf_safe_so_test.sh: New file.
7793         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7794         (main): Change to take pointer to function kept_func_3.
7795         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7796         folding is done correctly for X86-64.
7797
7798 2010-02-12  David S. Miller  <davem@davemloft.net>
7799
7800         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7801         is_symbolless parameter.
7802         (Output_reloc<SHT_REL>::is_symbolless): New.
7803         (Output_reloc<SHT_REL>::is_symbolless_): New.
7804         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7805         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7806         (Output_reloc<SHT_RELA>::is_symbolless): New.
7807         (Output_data_reloc::add_global): Handle is_symbolless.
7808         (Output_data_reloc::add_global_relative): Likewise.
7809         (Output_data_reloc::add_local): Likewise.
7810         (Output_data_reloc::add_local_relative): Likewise.
7811         (Output_data_reloc::add_symbolless_global_addend): New.
7812         (Output_data_reloc::add_symbolless_local_addend): New.
7813         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7814         is_symbolless.
7815         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7816         instead of ->is_relative_
7817         (Output_reloc::write): Likewise.
7818         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7819         (Output_reloc::write_rel): Simplify.
7820
7821         * sparc.cc (Target_sparc::Scan::local): Use
7822         ->add_symbolless_local_addend as needed.
7823         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7824         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7825         based upon relocation offset.
7826
7827 2010-02-11  Doug Kwan  <dougkwan@google.com>
7828
7829         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7830         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7831         beginning of function.
7832         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7833         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7834         parameter is_32bit in calls to should_apply_static_reloc.
7835         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7836         (check_DATA): Add arm_abs_global.stdout.
7837         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7838         arm_abs_global.stdout): New rules.
7839         (MOSTLLYCLEANFILES): Add arm_abs_global
7840         * Makefile.in: Regenerate.
7841         * testsuite/arm_abs_global.s: New file.
7842         * testsuite/arm_abs_global.sh: Ditto.
7843         * testsuite/arm_abs_lib.s: Ditto.
7844
7845 2010-02-11  Ian Lance Taylor  <iant@google.com>
7846
7847         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7848         Read_relocs task.
7849         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7850         Allocate_commons_task first.
7851         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7852         task, rather than symtab_lock_.
7853         (Gc_process_relocs::~Gc_process_relocs): New function.
7854         (Gc_process_relocs::is_runnable): Check this_blocker_.
7855         (Gc_process_relocs::locks): Use next_blocker_ rather than
7856         blocker_.
7857         (Scan_relocs::~Scan_relocs): New function.
7858         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7859         symtab_lock_.
7860         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7861         next_blocker_.
7862         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7863         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7864         constructor accordingly.
7865         (class Gc_process_relocs): Likewise.
7866         (class Scan_relocs): Likewise.
7867         * common.h (class Allocate_commons_task): Remove symtab_lock_
7868         field, and corresponding constructor parameter.
7869         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7870         symtab_lock_.
7871         (Allocate_commons_task::locks): Likewise.
7872
7873 2010-02-11  Ian Lance Taylor  <iant@google.com>
7874
7875         * gold-threads.h (class Once): Define.
7876         (class Initialize_lock): Rewrite as child of Once.
7877         * gold-threads.cc (class Once_initialize): Define.
7878         (once_pointer_control): New static variable.
7879         (once_pointer, once_arg): New static variables.
7880         (c_run_once): New static function.
7881         (Once::Once, Once::run_once, Once::internal_run): New functions.
7882         (class Initialize_lock_once): Remove.
7883         (initialize_lock_control): Remove.
7884         (initialize_lock_pointer): Remove.
7885         (initialize_lock_once): Remove.
7886         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7887         (Initialize_lock::initialize): Rewrite.
7888         (Initialize_lock::do_run_once): New function.
7889         * archive.cc (Archive::interpret_header): Only clear name if it is
7890         not already empty.
7891         * fileread.cc: Include "gold-threads.h"
7892         (file_counts_lock): New static variable.
7893         (file_counts_initialize_lock): Likewise.
7894         (File_read::release): Only increment counts when using --stats.
7895         Use a lock around the increment.
7896         * parameters.cc (class Set_parameters_target_once): Define.
7897         (set_parameters_target_once): New static variable.
7898         (Parameters::Parameters): Move here from parameters.h.
7899         (Parameters::set_target): Rewrite.
7900         (Parameters::set_target_once): New function.
7901         (Parameters::clear_target): Move here and rewrite.
7902         * parameters.h (class Parameters): Update declarations.  Add
7903         set_parameters_target_once_ field.
7904         (Parameters::Parameters): Move to parameters.cc.
7905         (Parameters::clear_target): Likewise.
7906         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7907         task.
7908         (Start_group::~Start_group): New function.
7909         (Start_group::is_runnable): New function.
7910         (Start_group::locks, Start_group::run): New functions.
7911         (Finish_group::run): Change saw_undefined to size_t.
7912         * readsyms.h (class Start_group): Define.
7913         (class Finish_group): Change saw_undefined_ field to size_t.
7914         (Finish_group::Finish_group): Remove saw_undefined and
7915         this_blocker parameters.  Change all callers.
7916         (Finish_group::set_saw_undefined): New function.
7917         (Finish_group::set_blocker): New function.
7918         * symtab.h (class Symbol_table): Change saw_undefined to return
7919         size_t.  Change saw_undefined_ field to size_t.
7920         * target-select.cc (Set_target_once::do_run_once): New function.
7921         (Target_selector::Target_selector): Initialize set_target_once_
7922         field.  Don't initialize lock_ and initialize_lock_ fields.
7923         (Target_selector::instantiate_target): Rewrite.
7924         (Target_selector::set_target): New function.
7925         * target-select.h (class Set_target_once): Define.
7926         (class Target_selector): Update declarations.  Make
7927         Set_target_once a friend.  Remove lock_ and initialize_lock_
7928         fields.  Add set_target_once_ field.
7929
7930 2010-02-10  Ian Lance Taylor  <iant@google.com>
7931
7932         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7933         queueing any tasks.
7934         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7935         (queue_middle_tasks): Add all blockers before queueing any tasks.
7936         (queue_final_tasks): Likewise.
7937         * token.h (Task_token::add_blockers): New function.
7938         * object.h (Input_objects::number_of_relobjs): New function.
7939
7940 2010-02-10  Ian Lance Taylor  <iant@google.com>
7941
7942         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7943         shared, not if not position independent.
7944         * x86_64.cc (Relocate::relocate_tls): Likewise.
7945         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7946         (tls_pie_pic_test): New target.
7947         * testsuite/Makefile.in: Rebuild.
7948
7949         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7950         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7951         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7952         * testsuite/Makefile.in: Rebuild.
7953
7954 2010-02-09  David S. Miller  <davem@davemloft.net>
7955
7956         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7957         R_SPARC_RELATIVE using ->add_local_relative().
7958         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7959
7960         * output.h (Output_data_dynamic::add_section_size): New method
7961         that takes two Output_data objects.
7962         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7963         entry param.  Handle it in initializers.
7964         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7965         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7966         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7967         arg.
7968         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7969         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7970         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7971         for dynrel_includes_plt.
7972         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7973         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7974         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7975         before .rela.plt
7976         (Target_sparc::do_finalize_sections): Update to pass true for
7977         dynrel_includes_plt.
7978         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7979         output before .rela.plt
7980         (Target_powerpc::do_finalize_sections): Update to pass true for
7981         dynrel_includes_plt when 32-bit.
7982
7983 2010-02-08  Doug Kwan  <dougkwan@google.com>
7984
7985         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7986         method.
7987         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7988         Arm_relobj::scan_section_for_cortex_a8_stubs,
7989         Arm_relobj::do_relocation_section): Instead of calling
7990         Output_section::output_address, use faster
7991         Arm_relobj::simple_input_section_output_address.
7992
7993 2010-02-08  David S. Miller  <davem@davemloft.net>
7994
7995         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7996         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7997         relocation helper function.
7998
7999         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8000         just like R_SPARC_GOT{10,13,22}.
8001         (Target_sparc::Scan::local): Likewise.
8002         (Target_sparc::Relocate:relocate): Likewise.
8003
8004 2010-02-06  Ian Lance Taylor  <iant@google.com>
8005
8006         * configure.ac: Rewrite targetobjs duplicate removal code to use
8007         only shell constructs.
8008         * configure: Rebuild.
8009
8010 2010-02-05  Doug Kwan  <dougkwan@google.com>
8011
8012         PR 11247
8013         * arm.cc (Arm_relobj::section_is_scannable): New method.
8014         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8015         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8016
8017 2010-02-04  Doug Kwan  <dougkwan@google.com>
8018
8019         PR 11247
8020         * arm-reloc-property.cc (cstdio): Include.
8021         * configure.ac (targetobjs): Remove duplicates.
8022         * configure: Regenerate.
8023         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8024         big and little endian version for a given address size.
8025
8026 2010-02-03  Doug Kwan  <dougkwan@google.com>
8027
8028         * arm-reloc-property.cc
8029         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8030         definition.
8031         * arm-reloc-property.h
8032         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8033         New method definition.
8034         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8035         declaration.
8036         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8037         overflow to N.
8038         (GOT_PREL): Change implemented to Y.
8039         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8040         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8041         (Arm_relocate_functions::movw_abs_nc): Remove method.
8042         (Arm_relocate_functions::movt_abs): Ditto.
8043         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8044         (Arm_relocate_functions::thm_movt_abs): Ditto.
8045         (Arm_relocate_functions::movw_rel_nc): Ditto.
8046         (Arm_relocate_functions::movw_rel): Ditto.
8047         (Arm_relocate_functions::movt_rel): Ditto.
8048         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8049         (Arm_relocate_functions:thm_movw_rel): Ditto.
8050         (Arm_relocate_functions:thm_movt_rel): Ditto.
8051         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8052         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8053         New method definitions.
8054         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8055         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8056         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8057         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8058         (Target_arm::Relocate::relocate): Check for non-static or
8059         unimplemented relocation code and exit early.  Change calls to
8060         Target_arm::reloc_uses_thumb_bit and
8061         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8062         instead.  Refactor code to handle similar relocations to increase
8063         code sharing.  Remove check for unsupported relocation code in switch
8064         statement.
8065         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8066         relocation property table to find out size.  Change error message to
8067         print out the name of a relocation code instead of the numeric value.
8068         (Target_arm::scan_reloc_for_stub): Use relocation property table
8069         instead of calling Target_arm::reloc_uses_thumb_bit().
8070
8071 2010-02-02  Doug Kwan  <dougkwan@google.com>
8072
8073         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8074         types of relaxed input section.
8075
8076 2010-02-02  Doug Kwan  <dougkwan@google.com>
8077
8078         * Makefile.am (HFILES): Add arm-reloc-property.h.
8079         (DEFFILES): New.
8080         (TARGETSOURCES): Add arm-reloc-property.cc
8081         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8082         (libgold_a_SOURCES): $(DEFFILES)
8083         * Makefile.in: Regenerate.
8084         * arm-reloc-property.cc: New file.
8085         * arm-reloc-property.h: New file.
8086         * arm-reloc.def: New file.
8087         * arm.cc: Update comments.
8088         (arm-reloc-property.h): New included header.
8089         (arm_reloc_property_table): New global variable.
8090         (Target_arm::do_select_as_default_target): New method definition.
8091         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8092         arm-reloc-property to targ_extra_obj.
8093         * parameters.cc (set_parameters_target): Call
8094         Target::select_as_default_target().
8095         * target.h (Target::select_as_default_target): New method definition.
8096         (Target::do_select_as_default_target): Same.
8097
8098 2010-02-01  Doug Kwan  <dougkwan@google.com>
8099
8100         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8101         first_output_text_section_.
8102         (Arm_exidx_fixup::first_output_text_section): New method definition.
8103         (Arm_exidx_fixup::first_output_text_section_): New data member.
8104         (Arm_exidx_fixup::process_exidx_section): Record the first text
8105         output section seen.
8106         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8107         and entsize in output section header.
8108
8109 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8110
8111         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8112         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8113         (Arm_relocate_functions::thm_alu11): New Method.
8114         (Arm_relocate_functions::thm_pc8): New Method.
8115         (Arm_relocate_functions::thm_pc12): New Method.
8116         (Target_arm::Scan::local): Handle the relocations.
8117         (Target_arm::Scan::global): Likewise.
8118         (Target_arm::Relocate::relocate): Likewise.
8119         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8120
8121 2010-01-29  Doug Kwan  <dougkwan@google.com>
8122
8123         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8124         of relocation types as ld.
8125
8126 2010-01-29  Doug Kwan  <dougkwan@google.com>
8127
8128         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8129         to public.
8130         (Arm_relocate_functions::thumb_branch_common): Ditto.
8131         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8132         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8133         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8134         Arm_relocate_functions::jump24): Remove.
8135         (Target_arm::Relocate::relocate): Adjust code to call
8136         Arm_relocation_functions::arm_branch_common and
8137         Arm_relocation_functions::thumb_branch_common instead of their removed
8138         wrappers.  Merge switch-cases together to reduce source code size.
8139
8140 2010-01-29  Doug Kwan  <dougkwan@google.com>
8141
8142         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8143         output_local_symbol_count_needs_update_.
8144         (Arm_relobj::output_local_symbol_count_needs_update,
8145          Arm_relobj::set_output_local_symbol_count_needs_update,
8146          Arm_relobj::update_output_local_symbol_count): New methods.
8147         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8148         member.
8149         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8150         of pointed function as in a R_ARM_PREL31 relocation.
8151         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8152         for output local symbol count updating.
8153         (Target_arm::do_relax): Update output local symbol counts in objects
8154         if necessary.
8155         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8156
8157 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8158
8159         * arm.cc: Added support for the ARM relocations:
8160         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8161         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8162         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8163         movw_prel_nc).
8164         (Arm_relocate_functions::movw_rel): New method.
8165         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8166         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8167         thm_movw_prel_nc).
8168         (Arm_relocate_functions::thm_movw_rel): New method.
8169         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8170         thm_movt_prel).
8171         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8172         relocations.
8173         (Target_arm::Scan::global): Likewise.
8174         (Target_arm::Relocate::relocate): Likewise.
8175         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8176         Likewise.
8177
8178 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8179
8180         * arm.cc: Added support for ARM group relocations.
8181         (Target_arm::reloc_needs_sym_origin): New method.
8182         (Arm_relocate_functions::calc_grp_kn): New method.
8183         (Arm_relocate_functions::calc_grp_residual): New method.
8184         (Arm_relocate_functions::calc_grp_gn): New method.
8185         (Arm_relocate_functions::arm_grp_alu): New Method.
8186         (Arm_relocate_functions::arm_grp_ldr): New Method.
8187         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8188         (Arm_relocate_functions::arm_grp_ldc): New Method.
8189         (Target_arm::Scan::local): Handle the ARM group relocations.
8190         (Target_arm::Scan::global): Likewise.
8191         (Target_arm::Relocate::relocate): Likewise.
8192         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8193         Likewise.
8194
8195 2010-01-26  Doug Kwan  <dougkwan@google.com>
8196
8197         * arm.cc (set): Include.
8198         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8199         pointer type.
8200         (Arm_output_section::Text_section_list): New type.
8201         (Arm_output_section::append_text_sections_to_list): New method.
8202         (Arm_output_section::fix_exidx_coverage): Ditto.
8203         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8204         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8205         Relobj::set_section_offset() instead of
8206         Sized_relobj::invalidate_section_offset().
8207         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8208         parameter for section headers. Ignore relocation sections for
8209         unallocated sections and EXIDX sections.
8210         (Target_arm::fix_exidx_coverage): New method.
8211         (Target_arm::output_section_address_less_than): New type.
8212         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8213         linked text section instead of the EXIDX section.
8214         (Arm_output_section::create_stub_group): Add an assertion to check
8215         that this is not an EXIDX output section.
8216         (Arm_output_section::append_text_sections_to_list): New method.
8217         (Arm_output_section::fix_exidx_coverage): Ditto.
8218         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8219         Arm_relobj::section_needs_reloc_stub_scanning.
8220         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8221         first pass.
8222         (Target_arm::fix_exidx_coverage): New method.
8223         * object.h (Relobj::set_output_section): New method.
8224         (Sized_relobj::invalidate_section_offset): Remove method.
8225         (Sized_relobj::do_invalidate_section_offset): Remove method.
8226         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8227
8228 2010-01-25  Doug Kwan  <dougkwan@google.com>
8229
8230         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8231         Fix warning due to signed and unsigned comparison on a 32-bit host.
8232
8233 2010-01-22  Doug Kwan  <dougkwan@google.com>
8234
8235         * arm.cc (Target_arm::do_relax): Record an output section for section
8236         offset adjustment it contains any stub table that has changed.
8237         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8238         offsets in an output section if necessary.
8239         * output.cc (Output_section::Output_section): Initialize
8240         section_offsets_need_adjustments_.
8241         (Output_section::add_input_section_for_script): Renamed to
8242         Output_section::add_simple_input_section.
8243         (Output_section::save_states): Add a comment.
8244         (Output_section::discard_states): New method defintion.
8245         (Output_section::adjust_section_offsets): Same.
8246         * output.h (Output_section::add_input_section_for_script): Renamed to
8247         Output_section::add_simple_input_section.
8248         (Output_section::discard_states): New method declaration.
8249         (Output_section::adjust_section_offsets): Same.
8250         (Output_section::section_offsets_need_adjustment,
8251         Output_section::set_section_offsets_need_adjustment): New method
8252         definitions.
8253         (Output_section::section_offsets_need_adjustment_): New data member.
8254         * script-sections.cc
8255         (Output_section_element_input::set_section_address): Adjust code for
8256         renaming of Output_section::add_input_section_for_script.
8257         (Orphan_output_section::set_section_address): Same.
8258
8259 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8260
8261         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8262         Fix_v4bx enum values .
8263         * gold/options.h (General_options): New option definitions.
8264         (General_options::fix_v4bx): New method.
8265         (General_options::Fix_v4bx): New enum.
8266         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8267         (General_options::parse_fix_v4bx_interworking): New method.
8268
8269 2010-01-22  Doug Kwan  <dougkwan@google.com>
8270
8271         * arm.cc (Arm_exidx_fixup): New class.
8272
8273 2010-01-21  Doug Kwan  <dougkwan@google.com>
8274
8275         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8276         classes.
8277         (Arm_exidx_section_offset_map): New type.
8278
8279 2010-01-21  Doug Kwan  <dougkwan@google.com>
8280
8281         * arm.cc (Arm_exidx_input_section): New class.
8282         (Arm_relobj::exidx_input_section_by_link,
8283         Arm_relobj::exidx_input_section_by_shndx,
8284         Arm_relobj::make_exidx_input_section): New methods.
8285         (read_arm_attributes_section): Remove.
8286         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8287         information about them.
8288         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8289         to here.
8290
8291 2010-01-20  Doug Kwan  <dougkwan@google.com>
8292
8293         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8294         Input_section_specifier to Section_id.
8295         (Target_arm::new_arm_input_section: Adjust code for change of key
8296         type.
8297         (Target_arm::find_arm_input_section): Ditto.
8298         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8299         (Section_id): Remove.
8300         (Garbage_collection::Section_id_hash): Remove.
8301         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8302         (Section_id): Remove.
8303         (Icf::Section_id_hash): Remove.
8304         * object.h (Section_id, Const_section_id, Section_id_hash,
8305         Const_section_id_hash): New type definitions.
8306         * output.cc (Output_section::add_relaxed_input_section): Change to
8307         use Const_section_id instead of Input_section_specifier as key type.
8308         (Output_section::add_merge_input_section): Ditto.
8309         (Output_section::build_relaxation_map): Change to use Section_id
8310         instead of Input_section_specifier as key type.
8311         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8312         Ditto.
8313         (Output_section::convert_input_sections_to_relaxed_sections): Change
8314         to use Const_section_id instead of Input_section_specifier as key type.
8315         (Output_section::find_merge_section): Ditto.
8316         (Output_section::find_relaxed_input_section): Ditto.
8317         * output.h (Input_section_specifier): Remove class.
8318         (Output_section::Output_section_data_by_input_section_map): Change
8319         key type to Const_section_id.
8320         (Output_section::Output_relaxed_input_section_by_input_section_map):
8321         Ditto.
8322         (Output_section::Relaxation_map): Change key type to Section_id.
8323
8324 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8325
8326         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8327         (class Arm_v4bx_stub): New class.
8328         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8329         (Stub_factory::make_arm_v4bx_stub): New method.
8330         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8331         (Stub_table::empty): Handle v4bx stubs.
8332         (Stub_table::add_arm_v4bx_stub): New method.
8333         (Stub_table::find_arm_v4bx_stub): New method.
8334         (Arm_relocate_functions::v4bx): New method.
8335         (Target_arm::fix_v4bx): New method.
8336         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8337         (Stub_table::relocate_stubs): Likewise.
8338         (Stub_table::do_write): Likewise.
8339         (Stub_table::update_data_size_and_addralign): Likewise.
8340         (Stub_table::finalize_stubs):  Likewise.
8341         (Target_arm::Scan::local): Likewise.
8342         (Target_arm::Scan::global): Likewise.
8343         (Target_arm::do_finalize_sections): Likewise.
8344         (Target_arm::Relocate::relocate): Likewise.
8345         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8346         Likewise.
8347         (Target_arm::scan_reloc_for_stub): Likewise.
8348         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8349
8350 2010-01-19  Ian Lance Taylor  <iant@google.com>
8351
8352         * output.cc (Output_section_headers::do_sized_write): Write large
8353         segment count to sh_info field.
8354         (Output_file_header::do_sized_write): For large segment count,
8355         write PN_XNUM to e_phnum field.
8356
8357 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8358
8359         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8360         (Arm_relocate_functions::thm_jump8): New function.
8361         (Arm_relocate_functions::thm_jump11): New function.
8362         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8363         R_ARM_THM_JUMP11.
8364         (Target_arm::Scan::global): Likewise.
8365         (Target_arm::Relocate::relocate): Likewise.
8366         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8367         Likewise.
8368
8369 2010-01-14  Doug Kwan  <dougkwan@google.com>
8370
8371         * arm.cc (map, utility): Include headers.
8372         (Target_arm::apply_cortex_a8_workaround): New method.
8373         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8374         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8375         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8376         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8377         the --[no-]fix-cortex-a8 command line options.
8378         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8379         (Target_arm::relocate_stub): Use addend in instruction template.
8380         * options.h (DEFINE_bool): Set the user-set flag.
8381         (General_options): Add --[no-]-fix-cortex options.
8382         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8383         : Update fast look-up map after conversion.
8384
8385 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8386
8387         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8388         in the first pass of do_layout.
8389
8390 2010-01-13  Doug Kwan  <dougkwan@google.com>
8391
8392         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8393         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8394         apparent compiler problem of not folding static constant integral
8395         data members of elfcpp::Elf_sizes<32>.
8396
8397 2010-01-13  Doug Kwan  <dougkwan@google.com>
8398
8399         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8400         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8401         Arm_relobj::scan_section_for_cortex_a8_erratum,
8402         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8403         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8404         sections to scan for relocation stubs into a new method
8405         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8406         relocation and Cortex-A8 stub scanning.
8407         (Target_arm::do_relax): Force stubs to be after stubbed sections
8408         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8409         the beginning of a new relaxation pass.  Update a comment.
8410         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8411
8412 2010-01-12  Ian Lance Taylor  <iant@google.com>
8413
8414         * target-reloc.h (visibility_error): New inline function.
8415         (relocate_section): Call visibility_error.
8416         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8417         (MOSTLYCLEANFILES): Likewise.
8418         (protected_4_pic.o, protected_3.err): New targets.
8419         * testsuite/protected_4.cc: New file.
8420
8421 2010-01-12  Doug Kwan  <dougkwan@google.com>
8422
8423         * arm.cc (Cortex_a8_reloc): New class.
8424         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8425         and cortex_a8_relocs_info_.
8426         (Target_arm::fix_cortex_a8): New method definition.
8427         (Target_arm::Cortex_a8_relocs_info): New type.
8428         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8429         New data member declarations.
8430         (Target_arm::scan_reloc_for_stub): Record information about
8431         relocations for THUMB branches that might be exempted from the
8432         Cortex-A8 workaround.
8433         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8434         at the beginning of a relaxation pass.
8435
8436 2010-01-12  Doug Kwan  <dougkwan@google.com>
8437
8438         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8439         (Arm_relobj::Mapping_symbol_position,
8440          Arm_reloj::Mapping_symbol_position_less,
8441          Arm_relobj::Mapping_symbols_info): New types.
8442         (Target_arm::is_mapping_symbol_name): New method definition.
8443         (Arm_relobj::do_count_local_symbols): Save information about mapping
8444         symbols.
8445
8446 2010-01-11  Doug Kwan  <dougkwan@google.com>
8447
8448         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8449         Arm_relocate_functions::thumb32_branch_upper,
8450         Arm_relocate_functions::thumb32_branch_lower,
8451         Arm_relocate_functions::thumb32_cond_branch_offset,
8452         Arm_relocate_functions::thumb32_cond_branch_upper,
8453         Arm_relocate_functions::thumb32_cond_branch_lower,
8454         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8455         branch offset encoding.
8456         (Arm_relocate_functions::thumb_branch_common): Use new branch
8457         offset encoding methods to avoid code duplication.
8458         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8459         (Stub_addend_reader::operator()): Use new branch encoding method
8460         to avoid code duplication.
8461
8462 2010-01-11  Doug Kwan  <dougkwan@google.com>
8463
8464         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8465         (Target_arm::do_finalize_sections): Define special EXIDX section
8466         symbols only if referenced.
8467         * gc.h (Garbage_collection::add_reference): New method.
8468         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8469         code duplication.
8470
8471 2010-01-11  Ian Lance Taylor  <iant@google.com>
8472
8473         * script.cc (Version_script_info::build_expression_list_lookup):
8474         Change complaing about duplicate wildcard match from error to
8475         warning.
8476
8477         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8478         of 2009-12-30.
8479         (Version_script_info::Version_script_info): Initialize globs_,
8480         default_version_, default_is_global_, and exact_.  Don't
8481         initialize globals_ or locals_.
8482         (Version_script_info::build_lookup_tables): Build local symbols
8483         first.
8484         (Version_script_info::unquote): New function.
8485         (Version_script_info::add_exact_match): New function.
8486         (Version_script_info::build_expression_list_lookup): Remove lookup
8487         parameter.  Add is_global parameter.  Change all callers.  Handle
8488         wildcard pattern specially.  Unquote pattern.  Call
8489         add_exact_match.
8490         (Version_script_info::get_name_to_match): New function.
8491         (Version_script_info::get_symbol_version): New function.
8492         (Version_script_info::get_symbol_version_helper): Remove.
8493         (Version_script_info::check_unmatched_names): Call unquote.
8494         * script.h (class Version_script_info): Change get_symbol_version
8495         to be non-inline and add is_global parameter; change all callers.
8496         Rewrite symbol_is_local.  Update declarations.  Define struct
8497         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8498         Remove globals_ and locals_ members.  Add exact_, globs_,
8499         default_version_, is_global_.
8500         (Version_script_info::Glob): Remove pattern, add expression and
8501         is_global.  Update constructor.  Change all callers.
8502         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8503         default version.
8504         (Versions::symbol_section_contents): If a symbol is undefined, or
8505         defined in a dynamic object, set the version index to
8506         VER_NDX_LOCAL.
8507         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8508         symbol_is_local.
8509         (Symbol_table::add_from_pluginobj): Likewise.
8510         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8511
8512 2010-01-11  Doug Kwan  <dougkwan@google.com>
8513
8514         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8515         (incremental_dump_LDADD): Add linking option for libintl.
8516         * Makefile.in: Regenerate.
8517
8518 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8519
8520         PR gold/11144
8521         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8522         instead of -Ds.
8523         * testsuite/Makefile.in: Regenerated.
8524
8525 2010-01-10  Doug Kwan  <dougkwan@google.com>
8526
8527         * options.h (DEFINE_var): Use parentheses around argument varname__
8528         in macro body to avoid any unintended subsequent substitutions.
8529
8530 2010-01-10  Ian Lance Taylor  <iant@google.com>
8531
8532         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8533         candidates before doing symbol resolution.
8534
8535         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8536         ODR candidates if only one is weak.
8537
8538 2010-01-08  Ian Lance Taylor  <iant@google.com>
8539
8540         * script.cc (Version_script_info::build_expression_list_lookup):
8541         Don't warn about ambiguous version, just record the ambiguity.
8542         (Version_script_info::get_symbol_version_helper): Give error if
8543         version is ambiguous.
8544
8545 2010-01-08  Doug Kwan  <dougkwan@google.com>
8546
8547         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8548         prev_data_size_ and prev_addralign_.  Remove initializer for
8549         deleted data member has_been_changed_.
8550         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8551         to determine if the table is empty.
8552         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8553         Remove.
8554         (Stub_table::add_reloc_stub): Define method in class definition
8555         instead of just declaring it there.
8556         (Stub_table::add_cortex_a8_stub): New method definition.
8557         (Stub_table::update_data_size_and_addralign): Ditto.
8558         (Stub_table::finalize_stubs): Ditto.
8559         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8560         (Stub_table::do_addralign_): Return address alignment in the
8561         (Stub_table::do_reset_address_and_file_offset): Define method in
8562         class definition instead of declaring it there.  Set current data
8563         size to be the data size of the previous pass.
8564         (Stub_table::set_final_data_size): Use current data size as the
8565         final data size.
8566         (Stub_table::relocate_stub): Change parameter type of stub from
8567         Reloc_stub pointer to Stub pointer.
8568         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8569         (Stub_table::Cortex_a8_stub_list): New typedef.
8570         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8571          Stub_table::prev_addralign_): New data member.
8572         (Arm_relobj::Arm_relobj): Initialize data member
8573         section_has_cortex_a8_workaround_.
8574         (Arm_relobj::section_has_cortex_a8_workaround,
8575          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8576          definitions.
8577         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8578         declarations.
8579         (Target_arm::relocate_stub): Change parameter type of stub from
8580         Reloc_stub pointer to Stub pointer.
8581         (Insn_template::size, Insn_template::alignment): Handle
8582         THUMB16_SPECIAL_TYPE.
8583         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8584          Stub_table::update_data_size_and_addralign,
8585          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8586         definitions.
8587         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8588         (Stub_table::do_write): Ditto.
8589         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8590
8591 2010-01-08  Ian Lance Taylor  <iant@google.com>
8592
8593         PR 11108
8594         * symtab.h (class Symbol): Remove fields is_target_special_ and
8595         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8596         (Symbol::is_defined_in_discarded_section): New function.
8597         (Symbol::set_is_defined_in_discarded_section): New function.
8598         (Symbol::has_plt_offset): Rewrite.
8599         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8600         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8601         Don't initialize is_target_special_ or has_plt_offset_.
8602         Initialize is_defined_in_discarded_section_.
8603         (Symbol_table::add_from_relobj): If appropriate, set
8604         is_defined_in_discarded_section.
8605         * resolve.cc (Symbol::override_base_with_special): Don't test
8606         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8607         * target-reloc.h (relocate_section): Do special handling for
8608         symbols defined in discarded sections for global symbols as well
8609         as local symbols.
8610
8611 2010-01-08  Ian Lance Taylor  <iant@google.com>
8612
8613         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8614         the SHT_SYMTAB case.
8615
8616 2010-01-08  Ian Lance Taylor  <iant@google.com>
8617
8618         * object.cc (Sized_relobj::do_layout): Don't get confused if
8619         layout_eh_frame returns NULL.
8620
8621 2010-01-08  Ian Lance Taylor  <iant@google.com>
8622
8623         PR 11084
8624         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8625         dynamic symbol table, use the normal symbol table.
8626         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8627         symbol table.
8628
8629 2010-01-08  Ian Lance Taylor  <iant@google.com>
8630
8631         PR 11072
8632         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8633         sections.
8634
8635 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8636
8637         * version.cc (print_version): Change to "Copyright 2010".
8638
8639 2010-01-08  Ian Lance Taylor  <iant@google.com>
8640
8641         PR 10287
8642         PR 11063
8643         * i386.cc (class Target_i386): Change return type of plt_section
8644         to be non-const.
8645         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8646         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8647         tls_desc_rel_ field.
8648         (Output_data_plt_i386::rel_tls_desc): New function.
8649         (Target_i386::rel_tls_desc_section): New function.
8650         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8651         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8652         R_386_TLS_DESC reloc in rel_tls_desc_section.
8653         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8654         Define struct Tlsdesc_info.
8655         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8656         (Target_x86_64::do_reloc_symbol_index): New function.
8657         (Target_x86_64::add_tlsdesc_info): New function.
8658         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8659         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8660         tlsdesc_rel_ field.
8661         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8662         all callers.
8663         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8664         (Target_x86_64::rela_tlsdesc_section): New function.
8665         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8666         handling.
8667         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8668         (Target_x86_64::do_reloc_addend): New function.
8669         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8670         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8671         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8672         (Output_reloc::type): New function.
8673         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8674         (Output_reloc::is_target_specific): New function.
8675         (Output_reloc::target_arg): New function.
8676         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8677         absolute relocs and target specific relocs.
8678         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8679         add_target_specific.
8680         (class Output_data_reloc) [SHT_RELA]: Likewise.
8681         * output.cc (Output_reloc::Output_reloc): Add four new versions
8682         for absolute relocs and target specific relocs.
8683         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8684         (Output_reloc::get_symbol_index): Likewise.
8685         (Output_reloc::local_section_offset): Check that local_sym_index_
8686         is not TARGET_CODE or 0.
8687         (Output_reloc::symbol_value): Likewise.
8688         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8689         reloc.
8690         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8691         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8692         functions.
8693         * layout.cc (add_target_dynamic_tags): Use output section for
8694         DT_PLTRELSZ and DT_JMPREL.
8695
8696 2010-01-07  Ian Lance Taylor  <iant@google.com>
8697
8698         PR 11061
8699         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8700         function.
8701         (class Output_data_reloc_generic): Define.
8702         (class Output_data_reloc_base): Change base class to
8703         Output_data_reloc_generic.  Change add() method to call
8704         bump_relative_reloc_count for a relative reloc.  Remove
8705         sort_relocs_ field.
8706         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8707         to sort_relocs().
8708         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8709         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8710         appropriate.
8711         * layout.h (class Layout): Update declaration.
8712
8713 2010-01-07  Ian Lance Taylor  <iant@google.com>
8714
8715         * output.h (class Output_data): Add const version of
8716         output_section and do_output_section.
8717         (class Output_section_data): Add const version of
8718         do_output_section.
8719         (class Output_section): Likewise.
8720         * layout.cc (Layout::add_target_dynamic_tags): New function.
8721         * layout.h (class Layout): Update declarations.
8722         * arm.cc (Target_arm::do_finalize_sections): Use
8723         add_target_dynamic_tags.
8724         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8725         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8726         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8727         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8728
8729 2010-01-07  Ian Lance Taylor  <iant@google.com>
8730
8731         PR 11042
8732         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8733         object as needed.
8734
8735 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8736             Ian Lance Taylor  <iant@google.com>
8737
8738         PR 11019
8739         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8740         Xindex::read_symtab_xindex.
8741
8742 2010-01-07  Doug Kwan  <dougkwan@google.com>
8743
8744         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8745         (Insn_template::thumb16_bcond_insn): New method declaration.
8746         (Insn_template): Fix spelling.
8747         (Stub::thumb16_special): New method declaration.
8748         (Stub::do_write): Define virtual method which was previously pure
8749         virtual.
8750         (Stub::do_thumb16_special): New method declaration.
8751         (Stub::do_fixed_endian_write): New template member.
8752         (Reloc_stub::do_write): Remove.
8753         (Reloc_stub::do_fixed_endian_write): Remove.
8754         (Cortex_a8_stub): New class definition.
8755         (Stub_factory::make_cortex_a8_stub): New method definition.
8756         (Stub_factory::Stub_factory): Add missing static storage class
8757         qualifier for elf32_arm_stub_a8_veneer_blx.
8758
8759 2010-01-07  Ian Lance Taylor  <iant@google.com>
8760
8761         PR 10980
8762         * options.h (class General_options): Add --warn-unresolved-symbols
8763         and --error-unresolved-symbols.
8764         * errors.cc (Errors::undefined_symbol): Implement
8765         --warn-unresolved-symbols.
8766
8767         * options.h (class General_options): Add -z text and -z textoff.
8768         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8769
8770 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8771
8772         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8773         (Garbage_collection::cident_sections): New function.
8774         (Garbage_collection::add_cident_section): New function.
8775         (Garbage_collection::cident_sections_): New member.
8776         (gc_process_relocs): Add references to sections whose names are C
8777         identifiers.
8778         * gold.h (cident_section_start_prefix): New constant.
8779         (cident_section_stop_prefix): New constant.
8780         (is_cident): New function.
8781         * layout.cc (Layout::define_section_symbols): Replace string constants
8782         with the newly defined constants.
8783         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8784         C identifiers.
8785         * testsuite/Makefile.am: Add gc_orphan_section_test.
8786         * testsuite/Makefile.in: Regenerate.
8787         * testsuite/gc_orphan_section_test.cc: New file.
8788         * testsuite/gc_orphan_section_test.sh: New file.
8789
8790 2010-01-06  Ian Lance Taylor  <iant@google.com>
8791
8792         PR 10980
8793         * options.h (class General_options): Add --warn-shared-textrel.
8794         * layout.cc (Layout::finish_dynamic_section): Implement
8795         --warn-shared-textrel.
8796
8797         PR 10980
8798         * options.h (class General_options): Add --warn-multiple-gp.
8799
8800 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8801
8802         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8803         $(THREADSLIB) and $(LIBDL).
8804         * Makefile.in: Rebuild.
8805
8806 2010-01-06  Ian Lance Taylor  <iant@google.com>
8807
8808         PR 10980
8809         * options.cc (General_options::parse_section_start): New function.
8810         (General_options::section_start): New function.
8811         (General_options::General_options): Initialize all members.
8812         * options.h: Include <map>
8813         (class General_options): Add --section-start.  Add section_starts_
8814         member.
8815         * layout.cc (Layout::attach_allocated_section_to_segment): If
8816         --section-start was used, set the address of the segment.  Remove
8817         local sort_sections.
8818         (Layout::relaxation_loop_body): If the address of the load segment
8819         has been set by --section-start, don't use it.
8820         * output.h (Output_segment::update_flags_for_output_section): New
8821         function.
8822         * output.cc (Output_segment::add_output_section): Call
8823         update_flags_for_output_section.
8824
8825 2010-01-05  Ian Lance Taylor  <iant@google.com>
8826
8827         PR 10980
8828         * options.h (class General_options): Add --undefined-version.
8829         * script.cc (struct Version_expression): Add was_matched_by_symbol
8830         field.
8831         (Version_script_info::matched_symbol): New function.
8832         (Version_script_info::get_symbol_version_helper): Call
8833         matched_symbol.
8834         (Version_script_info::check_unmatched_names): New function.
8835         * script.h (class Version_script_info): Update declarations.
8836         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8837
8838         * options.h (class General_options): Use DEFINE_bool_alias for
8839         allow_multiple_definition.
8840         * resolve.cc (Symbol_table::should_override): Don't test
8841         allow_multiple_definition.
8842
8843         PR 10980
8844         * options.h (class General_options): Add --cref.
8845         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8846         until after printing cref table.
8847         * cref.cc: Include "symtab.h".
8848         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8849         (Cref_table_compare::operator()): New function.
8850         (Cref_inputs::gather_cref): New function.
8851         (filecol): New static const.
8852         (Cref_inputs::print_cref): New function.
8853         (Cref::print_cref): New function.
8854         * cref.h: Include <cstdio>.
8855         (class Cref): Update declarations.
8856         * mapfile.h (Mapfile::file): New function.
8857         * object.h (class Object): Define Symbols.  Declare virtual
8858         do_get_global_symbols.
8859         (Object::get_global_symbols): New function.
8860         * object.cc (Input_objects::add_object): Pass object to cref_ if
8861         --cref.
8862         (Input_objects::archive_start): Likewise.
8863         (Input_objects::archive_stop): Likewise.
8864         (Input_objects::print_cref): New function.
8865         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8866         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8867         --cref.
8868         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8869         function.
8870         * plugin.h (class Sized_pluginobj): Update declarations.
8871
8872 2010-01-05  Ian Lance Taylor  <iant@google.com>
8873
8874         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8875         to is_default_version.  Rename insdef to insdefault.
8876         (Symbol_table::add_from_relobj): Rename def to is_default_version
8877         and local to is_forced_local.
8878         (Symbol_table::add_from_pluginobj): Likewise.
8879         (Symbol_table::add_from_dynobj): Likewise.
8880         (Symbol_table::define_special_symbol): Rename insdef to
8881         insdefault.
8882
8883 2010-01-04  Ian Lance Taylor  <iant@google.com>
8884
8885         PR 10980
8886         * options.h (class General_options): Add
8887         --allow-multiple-definition and -z muldefs.
8888         * resolve.cc (Symbol_table::should_override): Don't warn about a
8889         multiple symbol definition if --allow-multiple-definition or -z
8890         muldefs.
8891
8892         PR 10980
8893         * options.h (class General_options): Add --add-needed and
8894         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8895         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8896         error if --copy-dt-needed-entries aka --add-needed is used and
8897         would cause a change in behaviour.
8898
8899         PR 10980
8900         * options.h (class General_options): Add -G as a short version of
8901         --shared.  Add no-op options -assert, -g, and -i.
8902
8903 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8904
8905         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8906         check for .text or .gnu.linkonce.t sections.
8907         * icf.cc (Icf::find_identical_sections): Ditto.
8908         Change the detection for mangled function name within the section
8909         name.
8910         * icf.h (is_section_foldable_candidate): New function.
8911
8912 2009-12-30  Ian Lance Taylor  <iant@google.com>
8913
8914         PR 10980
8915         * options.h (class General_options): Permit two dashes with
8916         --retain-symbols-file.
8917
8918 2009-12-30  Ian Lance Taylor  <iant@google.com>
8919
8920         PR 10979
8921         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8922         don't put the file header and segment headers in the text
8923         segment.
8924
8925         PR 10979
8926         * common.cc (Sort_commons::operator()): Stabilize sort when both
8927         entries are NULL.
8928         (Symbol_table::do_allocate_commons_list): When allocating common
8929         symbols, skip a symbol which is no longer common.
8930         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8931         an object before checking its type.
8932         * testsuite/common_test_2.c: New file.
8933         * testsuite/common_test_3.c: New file.
8934         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8935         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8936         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8937         (common_test_2_pic.o, common_test_2.so): New targets.
8938         (common_test_3_pic.o, common_test_3.so): New targets.
8939         * testsuite/Makefile.in: Rebuild.
8940
8941         PR 10979
8942         * script.cc (read_input_script): If we see a new SECTIONS clause,
8943         and we have added an input section, give an error.
8944         * layout.h (class Layout): Add have_added_input_section function.
8945         Add have_added_input_section_ field.
8946         * layout.cc (Layout::Layout): Initialize
8947         have_added_input_section_.
8948         (Layout::layout): Set have_added_input_section_.
8949         (Layout::layout_eh_frame): Likewise.
8950
8951 2009-12-30  Ian Lance Taylor  <iant@google.com>
8952
8953         PR 10931
8954         * options.h (class General_options): Add --sort-common option.
8955         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8956         * common.cc (Sort_common): Add sort_order parameter to
8957         constructor.  Add sort_order_ field.
8958         (Sort_commons::operator): Check sort_order_.
8959         (Symbol_table::allocate_commons): Determine the sort order.
8960         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8961         Change all callers.
8962         (Symbol_table::do_allocate_commons_list): Likewise.
8963
8964 2009-12-30  Ian Lance Taylor  <iant@google.com>
8965
8966         PR 10916
8967         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8968         symbols from this object, don't change the visibility of an
8969         undefined symbol.
8970         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8971
8972 2009-12-30  Ian Lance Taylor  <iant@google.com>
8973
8974         PR 10861
8975         * script.h (class Version_script_info): Define Language enum.
8976         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8977         new fields globals_, locals_, and is_finalized_.
8978         * script.cc: Various formatting fixes.
8979         (class Parser_closure): Change language_stack_ from a vector of
8980         std::string to one of Version_script_info::Language.  Adjust all
8981         uses accordingly.
8982         (class Lazy_demangler): Remove.
8983         (struct Version_expression): Change language from std::string to
8984         Version_script_info::Language.
8985         (Version_script_info::Version_script_info): New function.
8986         (Version_script_info::~Version_script_info): Don't call clear.
8987         (Version_script_info::finalize): New function.
8988         (Version_script_info::build_lookup_tables): New function.
8989         (Version_script_info::build_expression_list_lookup): New
8990         function.
8991         (Version_script_info::get_symbol_version_helper): Rewrite to use
8992         lookup tables.
8993         (Version_script_info::print_expression_list): Adjust to use
8994         Version_script_info::Language.
8995         (script_push_lex_into_version_mode): Check that the version script
8996         has not been finalized.
8997         (version_script_push_lang): Change language string to
8998         Version_script_info::Language.
8999         * options.cc (Command_line::version_script): New function.
9000         * options.h (class General_options): Add finalize_dynamic_list
9001         function.  Change version_script from declaration to definition.
9002         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9003         * testsuite/version_script.map: Remove duplicate def of foo.
9004         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9005         version_script.map.
9006         * testsuite/Makefile.in: Rebuild.
9007
9008 2009-12-30  Ian Lance Taylor  <iant@google.com>
9009
9010         PR 10843
9011         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9012         if the input symbol index is 0, make the output symbol index 0.
9013
9014 2009-12-30  Ian Lance Taylor  <iant@google.com>
9015
9016         PR 10670
9017         * options.h (class General_options): Add -x/--discard-all.
9018         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9019         --discard-all.  If the local symbol needs a dynamic entry, check
9020         that before handling --discard-locals.
9021
9022 2009-12-30  Ian Lance Taylor  <iant@google.com>
9023
9024         PR 10450
9025         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9026         flags to PF_R.
9027         (Output_segment::add_output_section): Don't change the flags if
9028         the type is PT_TLS.
9029
9030         PR 10450
9031         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9032         GNU hash table if they need a dynamic value.  Otherwise, don't add
9033         them if they are defined in a dynamic object or are forced local.
9034
9035 2009-12-29  Ian Lance Taylor  <iant@google.com>
9036
9037         PR 10450
9038         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9039         .gnu.hash table for a 32-bit target.
9040
9041         PR 10450
9042         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9043         regular and a dynamic object only needs a dynamic symbol table
9044         entry if it is externally visible.
9045
9046         PR 10450
9047         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9048         constructor.  Add global_offset_table_ field.
9049         (Target_i386::got_section): Set global_offset_table_.
9050         (Target_i386::do_finalize_sections): Set global_offset_table_
9051         size.
9052         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9053         in constructor.  Add global_offset_table_ field.
9054         (Target_x86_64::got_section): Set global_offset_table_.
9055         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9056         size.
9057
9058         * layout.cc (Layout::Layout): Initialize increase_relro_.
9059         (Layout::get_output_section): Add is_relro, is_last_relro, and
9060         is_first_non_relro parameters.  Change all callers.
9061         (Layout::choose_output_section): Likewise.
9062         (Layout::add_output_section_data): Likewise.
9063         (Layout::make_output_section): Likewise.
9064         (Layout::set_segment_offsets): Clear increase_relro when using a
9065         linker script.
9066         * layout.h (class Layout): Add increase_relro method.  Add
9067         increase_relro_ field.  Update declarations.
9068         * output.cc (Output_section::Output_section): Initialize
9069         is_last_relro_ and is_first_non_relro_.
9070         (Output_segment::add_output_section): Group relro sections is
9071         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9072         (Output_segment::maximum_alignment): Remove relro handling.
9073         (Output_segment::set_section_addresses): Add increase_relro
9074         parameter.  Change all callers.  Add initial alignment to align
9075         relro sections on separate page.  Remove old relro handling.
9076         (Output_segment::set_section_list_addresses): Remove in_relro
9077         parameter.  Change all callers.
9078         (Output_segment::set_offset): Add increase parameter.  Change all
9079         callers.  Remove old relro handling.
9080         * output.h (class Output_section): Add new methods: is_last_relro,
9081         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9082         Add is_last_relro_ and is_first_non_relro_ fields.
9083         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9084         Create separate .got.plt section.  Call increase_relro.
9085         * x86_64.cc (Target_x86_64::got_section): Likewise.
9086         * testsuite/relro_script_test.t: Add .got.plt.
9087
9088         PR 10450
9089         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9090         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9091         (Layout::finalize): Call set_dynamic_symbol_size.
9092         (Layout::set_dynamic_symbol_size): New function.
9093         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9094         set_dynamic_symbol_size.
9095
9096         PR 10450
9097         * output.h (class Output_section): Add is_entsize_zero_ field.
9098         * output.cc (Output_section::Output_section): Initialize
9099         is_entsize_zero_.
9100         (Output_section::set_entsize): If two different entsizes are
9101         requested, force it to zero.
9102         (Output_section::add_input_section): Set flags for .debug_str
9103         before updating section flags.  Set entsize.
9104         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9105         and SHF_STRING if all input sections have those flags.
9106
9107 2009-12-29   Rafael Espindola  <espindola@google.com>
9108
9109         * main.cc (main): Fix the sys time reporting.
9110         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9111         reporting.
9112
9113 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9114
9115         * options.cc (General_options::parse_version): Allow -v to exit
9116         without an error if there is nothing to link.
9117
9118 2009-12-29  Ian Lance Taylor  <iant@google.com>
9119
9120         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9121         using a version of gcc before 4.1.
9122         * configure: Rebuild.
9123
9124 2009-12-28  Chris Demetriou  <cgd@google.com>
9125
9126         * attributes.cc (Output_attributes_section_data::do_write): Use
9127         std::vector::front rather than std::vector::data.
9128
9129 2009-12-28  Ian Lance Taylor  <iant@google.com>
9130
9131         * symtab.h (class Symbol_table): Add enum Defined.
9132         * resolve.cc (Symbol_table::should_override): Add defined
9133         parameter.  Change all callers.  Test whether object is NULL
9134         before calling a method on it.
9135         (Symbol_table::report_resolve_problem): Add defined parameter.
9136         Change all callers.
9137         (Symbol_table::should_override_with_special): Likewise.
9138         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9139         parameter.  Change all callers.
9140         (Symbol_table::do_define_in_output_data): Likewise.
9141         (Symbol_table::define_in_output_segment): Likewise.
9142         (Symbol_table::do_define_in_output_segment): Likewise.
9143         (Symbol_table::define_as_constant): Likewise.
9144         (Symbol_table::do_define_as_constant): Likewise.
9145         * script.h (class Symbol_assignment): Add is_defsym parameter to
9146         constructor; change all callers.
9147         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9148         parameter.  Change all callers.  Add is_defsym_ field.
9149         (class Parser_closure): Add parsing_defsym parameter to
9150         constructor; change all callers.  Add parsing_defsym accessor
9151         function.  Add parsing_defsym_ field.
9152
9153 2009-12-28  Ian Lance Taylor  <iant@google.com>
9154
9155         * gold.cc (queue_middle_tasks): Fix formatting.
9156         * object.cc (Relobj::is_section_name_included): Likewise.
9157
9158 2009-12-23  Ian Lance Taylor  <iant@google.com>
9159
9160         * i386.cc (Target_i386::do_calls_non_split): Recognize
9161         -fsplit-stack prologue for a function with a static chain.
9162         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9163         -fsplit-stack prologue when using %r11.
9164
9165 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9166
9167         * options.cc (General_options::parse_version): Make -v continue and do
9168         the link like GNU ld does.
9169
9170 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9171
9172         * Makefile.am (CCFILES): Add timer.cc.
9173         (HFILES): Add timer.h.
9174         * configure.ac: Check for sysconf and times.
9175         * main.cc: include timer.h.
9176         (main): Use Timer instead of get_run_time.
9177         * timer.cc: New.
9178         * timer.h: New.
9179         * workqueue.cc: include timer.h.
9180         (Workqueue::find_and_run_task):
9181         Report user, sys and wall time.
9182         * Makefile.in: Regenerate.
9183         * config.in: Regenerate.
9184         * configure: Regenerate.
9185
9186 2009-12-16  Doug Kwan  <dougkwan@google.com>
9187
9188         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9189         sections.
9190         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9191         relaxed input sections.
9192         * output.cc (Output_section::find_relaxed_input_section): Change
9193         return type to Output_relaxed_input_section pointer.  Adjust code
9194         for new type of relaxed_input_section_map_.
9195         * output.h (Output_section::find_relaxed_input_section): Change
9196         return type to Output_relaxed_input_section pointer.
9197         (Output_section::Output_relaxed_input_section_by_input_section_map):
9198         New type.
9199         (Output_section::relaxed_input_section_map_): Change type to
9200         Output_section::Output_relaxed_input_section_by_input_section_map.
9201         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9202         input section.
9203
9204 2009-12-15  Ian Lance Taylor  <iant@google.com>
9205
9206         * layout.cc (Layout::create_shstrtab): Only write out after input
9207         sections if we are compressing debug sections.
9208
9209 2009-12-15  Ian Lance Taylor  <iant@google.com>
9210
9211         * archive.cc (Archive::add_symbols): Only look up a symbol without
9212         a version if there is, in fact, a version.
9213
9214 2009-12-14  Ian Lance Taylor  <iant@google.com>
9215
9216         Revert -Wshadow changes, all changes from:
9217         2009-12-11  Doug Kwan  <dougkwan@google.com>
9218         2009-12-11  Nick Clifton  <nickc@redhat.com>
9219         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9220
9221 2009-12-11  Doug Kwan  <dougkwan@google.com>
9222
9223         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9224         due to -Wshadow.
9225         * attributes.cc (Object_attribute::size): Ditto.
9226         (Attributes_section_data::size): Ditto.
9227         (Attributes_section_data::Attributes_section_data): Ditto.
9228         (Output_attributes_section_data::do_write): Ditto.
9229         * attributes.h (Object_attribute::set_type): Ditto.
9230         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9231
9232 2009-12-11  Nick Clifton  <nickc@redhat.com>
9233
9234         * archive.cc: Fix shadowed variable warnings.
9235         * arm.cc: Likewise.
9236         * compressed_output.cc: Likewise.
9237         * compressed_output.h: Likewise.
9238         * configure: Likewise.
9239         * dwarf_reader.cc: Likewise.
9240         * dynobj.cc: Likewise.
9241         * dynobj.h: Likewise.
9242         * ehframe.cc: Likewise.
9243         * ehframe.h: Likewise.
9244         * errors.cc: Likewise.
9245         * expression.cc: Likewise.
9246         * fileread.cc: Likewise.
9247         * fileread.h: Likewise.
9248         * freebsd.h: Likewise.
9249         * i386.cc: Likewise.
9250         * icf.cc: Likewise.
9251         * incremental.h: Likewise.
9252         * layout.cc: Likewise.
9253         * layout.h: Likewise.
9254         * mapfile.cc: Likewise.
9255         * merge.cc: Likewise.
9256         * merge.h: Likewise.
9257         * object.cc: Likewise.
9258         * object.h: Likewise.
9259         * options.h: Likewise.
9260         * output.cc: Likewise.
9261         * output.h: Likewise.
9262         * parameters.cc: Likewise.
9263         * plugin.cc: Likewise.
9264         * powerpc.cc: Likewise.
9265         * reduced_debug_output.cc: Likewise.
9266         * reduced_debug_output.h: Likewise.
9267         * reloc.cc: Likewise.
9268         * reloc.h: Likewise.
9269         * resolve.cc: Likewise.
9270         * script-sections.cc: Likewise.
9271         * script.cc: Likewise.
9272         * script.h: Likewise.
9273         * sparc.cc: Likewise.
9274         * symtab.cc: Likewise.
9275         * symtab.h: Likewise.
9276         * target-select.cc: Likewise.
9277         * target-select.h: Likewise.
9278         * token.h: Likewise.
9279         * workqueue.cc: Likewise.
9280         * workqueue.h: Likewise.
9281         * x86_64.cc: Likewise.
9282
9283 2009-12-10  Doug Kwan  <dougkwan@google.com>
9284
9285         * arm.cc (attributes.h): New include.
9286         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9287         (Arm_relobj::~Arm_relobj): Delete object pointed by
9288         attributes_section_data_.
9289         (Arm_relobj::attributes_section_data): New method definition.
9290         (Arm_relobj::attributes_section_data_): New data member declaration.
9291         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9292         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9293         attributes_section_data_.
9294         (Arm_dynobj::attributes_section_data): New method definition.
9295         (Arm_dynobj::attributes_section_data_): New data member declaration.
9296         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9297         initialization value of may_use_blx_ to false.
9298         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9299         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9300         object attributes to compute results instead of hard-coding.
9301         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9302         Target_arm::get_secondary_compatible_arch,
9303         Target_arm::set_secondary_compatible_arch
9304         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9305         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9306         New method declarations.
9307         (Target_arm::get_aeabi_object_attribute): New method definition.
9308         (Target_arm::attributes_section_data_): New data member declaration.
9309         (read_arm_attributes_section): New template definition.
9310         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9311         (Arm_dynobj::do_read_symbols): Ditto.
9312         (Target_arm::do_finalize_sections): Merge attributes sections from
9313         input.  Check for BLX use after attributes section merging.
9314         Fix __exidx_start and __exidx_end visibility.  Create an
9315         .ARM.attributes section if necessary.
9316         (Target_arm::get_secondary_compatible_arch,
9317         Target_arm::set_secondary_compatible_arch,
9318         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9319         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9320         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9321         New method definitions.
9322
9323 2009-12-09  Ian Lance Taylor  <iant@google.com>
9324
9325         * plugin.cc (Plugin::load): Don't cast from void* to a function
9326         pointer.
9327
9328 2009-12-09  Ian Lance Taylor  <iant@google.com>
9329
9330         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9331         information fields.
9332
9333 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9334
9335         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9336         Replace two_file_shared_1.so with two_file_shared_2.so.
9337         * testsuite/Makefile.in: Regenerated.
9338
9339 2009-12-08  Doug Kwan  <dougkwan@google.com>
9340
9341         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9342         (HFILES): Add attributes.h and int_encoding.h.
9343         * Makefile.in: Regenerate.
9344         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9345         function definitions to int_encoding.cc
9346         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9347         prototypes to int_encoding.h
9348         * reduced_debug_output.cc (int_encoding.h): New include.
9349         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9350         function definitions to int_encoding.cc
9351         (insert_into_vector, read_from_pointer): Move template definitions to
9352         int_encoding.h
9353         * attributes.cc: New file.
9354         * attributes.h: New file.
9355         * int_encoding.cc: New file.
9356         * int_encoding.h: New file.
9357
9358 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9359
9360         PR gold/11055
9361         * incremental-dump.cc (dump_incremental_inputs): New.
9362         (main): Use dump_incremental_inputs.
9363
9364 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9365
9366         PR gold/10893
9367         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9368         checking elfcpp::STT_FUNC.
9369         (Target_i386::Relocate::relocate): Likewise.
9370         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9371
9372         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9373         symbols from shared libraries into normal FUNC symbols.
9374
9375         * symtab.h (Symbol): Add is_func and use it.
9376
9377 2009-12-05  Doug Kwan  <dougkwan@google.com>
9378
9379         * arm.cc (Target_arm::arm_info): Initialize new fields
9380         attributes_section and attributes_vendor.
9381         * i386.cc (Target_i386::i386_info): Same.
9382         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9383         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9384         fields attributes_section and attributes_vendor.
9385         * sparc.cc (Target_sparc::sparc_info): Same.
9386         * target.h (Target::attributes_section, Target::attributes_vendor,
9387         Target::is_attributes_section, Target::attribute_arg_type,
9388         Target::attributes_order): New method definitions.
9389         (Target::Target_info::attributes_section,
9390         Target::Target_info::attributes_vendor): New fields.
9391         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9392         virtual method definitions.
9393         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9394         attributes_section and attributes_vendor.
9395         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9396
9397 2009-12-05  Doug Kwan  <dougkwan@google.com>
9398
9399         * arm.cc: Update comments about interworking and stub generation.
9400         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9401         considered as non-PIC.
9402         (Arm_relocate_functions::base_abs): Fix formatting.
9403         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9404         of function to use GOT entry address instead of offset.
9405         (Target_arm::Scan::global): Issue an error if a symbol would need a
9406         PLT does not get one because it is untyped.  Remove code to create
9407         dynamic symbols for relative branches.
9408         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9409         takes unsigned integer instead of boolean.
9410
9411 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9412
9413         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9414         (two_file_test_LDADD): Likewise.
9415         (common_test_1_LDADD): Likewise.
9416         (exception_test_LDADD) Likewise.
9417         (weak_test_LDADD): Likewise.
9418         (many_sections_test_LDADD): Likewise.
9419         (initpri1_LDADD): Likewise.
9420         (script_test_1_LDADD): Likewise.
9421         (script_test_2_LDADD): Likewise.
9422         (justsyms_LDADD): Likewise.
9423         (binary_test_LDADD): Likewise.
9424         (large_LDADD): Likewise.
9425         * testsuite/Makefile.in: Regenerated.
9426
9427 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9428
9429         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9430         (Symbol_table::override_with_special): Likewise.
9431         (Symbol_table::add_from_object): Likewise.
9432
9433 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9434
9435         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9436         Don't set the data_offset twice.
9437
9438 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9439
9440         * testsuite/Makefile.in: Regenerate.
9441
9442 2009-12-03  Doug Kwan  <dougkwan@google.com>
9443
9444         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9445         (Target_arm::do_finalize_sections): Add parameter for symbol table
9446         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9447         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9448         parameter for symbol table pointer.
9449         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9450         an additional parameter for a pointer to symbol table.
9451         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9452         parameter for a symbol table pointer.
9453         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9454         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9455         Ditto.
9456         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9457         parameter for a symbol table pointer.
9458
9459 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9460
9461         * incremental.cc (Incremental_inputs_header)
9462         (Incremental_inputs_header_write, Incremental_inputs_entry)
9463         (Incremental_inputs_entry_write): Move ...
9464         * incremental.h (Incremental_inputs_header)
9465         (Incremental_inputs_header_write, Incremental_inputs_entry)
9466         (Incremental_inputs_entry_write): here.
9467
9468 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9469
9470         * incremental.cc (make_sized_incremental_binary): Set the target.
9471         Error if it is incompatible.
9472         * output.h (Output_file): Add filename method.
9473
9474 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9475
9476         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9477         from the get_* methods.
9478
9479 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9480
9481         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9482         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9483         Write 0 for the data_offset of scripts.
9484
9485 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9486
9487         * testsuite/Makefile.am: Add the incremental_test.sh test.
9488         * testsuite/incremental_test.sh: New.
9489         * testsuite/incremental_test_1.c: New.
9490         * testsuite/incremental_test_2.c: New.
9491
9492 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9493
9494         * incremental-dump.cc (main): Fix typos.
9495
9496 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9497
9498         PR gold/11025
9499         * incremental-dump.cc (main): Use llu to print 64 bit values.
9500
9501 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9502             H.J. Lu  <hongjiu.lu@intel.com>
9503
9504         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9505         $(LIBDL).
9506         (incremental_dump_LDADD): Likewise.
9507         * Makefile.in: Regenerated.
9508
9509 2009-11-25  Doug Kwan  <dougkwan@google.com>
9510
9511         Revert:
9512
9513         2009-11-25  Doug Kwan  <dougkwan@google.com>
9514
9515                 * arm.cc (Target_arm::Target_arm): Move method definition
9516                 outside of class definition.  Add code to handle
9517                 --target1-rel, --target1-abs and --target2= options.
9518                 (Target_arm::get_reloc_reloc_type): Change method to be
9519                 non-static and const.
9520                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9521                 New data member declaration.
9522                 (Target_arm::Scan::local, Target_arm::Scan::global,
9523                 Target_arm::Relocate::relocate,
9524                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9525                 Adjust call to Target_arm::get_real_reloc_type.
9526                 (Target_arm::get_real_reloc_type): Use command line options
9527                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9528                 * options.h (--target1-rel, --target1-abs, --target2): New
9529                 ARM-only options.
9530
9531 2009-11-25  Doug Kwan  <dougkwan@google.com>
9532
9533         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9534         class definition.  Add code to handle --target1-rel, --target1-abs
9535         and --target2= options.
9536         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9537         and const.
9538         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9539         member declaration.
9540         (Target_arm::Scan::local, Target_arm::Scan::global,
9541         Target_arm::Relocate::relocate,
9542         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9543         call to Target_arm::get_real_reloc_type.
9544         (Target_arm::get_real_reloc_type): Use command line options to
9545         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9546         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9547         options.
9548
9549 2009-11-25  Doug Kwan  <dougkwan@google.com>
9550
9551         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9552         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9553         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9554         formatting.
9555         (Arm_relocate_functions::thm_call): Replace body with a call to
9556         Arm_relocate_functions::thumb_branch_common.
9557         (Arm_relocate_functions::thm_jump24,
9558         Arm_relocate_functions::thm_xpc22): New method definitions.
9559         (Arm_relocate_functions::thumb_branch_common): New method definition.
9560         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9561         operator.
9562         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9563         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9564
9565 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9566
9567         * Makefile.am: Build incremental-dump
9568         * Makefile.in: Regenerate.
9569         * incremental-dump.cc: New.
9570         * incremental.cc (Incremental_inputs_header_data,
9571         Incremental_inputs_entry_data): Move to incremental.h
9572         * incremental.h: (Incremental_inputs_header_data,
9573         Incremental_inputs_entry_data): Move from incremental.cc
9574
9575 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9576
9577         * incremental.cc (Incremental_inputs_header,
9578         Incremental_inputs_header_write, Incremental_inputs_entry,
9579         Incremental_inputs_entry_write): Add a typedef with the data type.
9580
9581 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9582
9583         * incremental.cc (Incremental_inputs_header,
9584         Incremental_inputs_header_write, Incremental_inputs_entry,
9585         Incremental_inputs_entry_write): Update comment about which
9586         type has the filed descriptions.
9587
9588 2009-11-15  Doug Kwan  <dougkwan@google.com>
9589
9590         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9591         (Arm_relocate_functions::arm_branch_common): Change method defintion
9592         in class definition to a method declaration and update list of formal
9593         parameters.
9594         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9595         Arm_relocation_functions::jump24): Adjust call to
9596         Arm_relocate_functions::arm_branch_common.  Update list of formal
9597         parameters.
9598         (Arm_relocate_functions::xpc25): New method definition.
9599         (Arm_relocate_functions::arm_branch_common): Move method defintion
9600         out from class definition.  Use stubs for mode-switching and extending
9601         branch ranges.
9602         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9603         specially.  Change code to enable use of stubs in ARM branches.
9604
9605 2009-11-10  Doug Kwan  <dougkwan@google.com>
9606
9607         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9608         in method declaration.
9609         (Target_arm::relocate_stub): New method declaration.
9610         (Target_arm::default_target): Change to return a pointer instead of
9611         a const reference.
9612         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9613         Target_arm::default_target.
9614         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9615         method definition.
9616         (Target_arm::relocate_section): Adjust view.
9617         (Target_arm::relocate_stub): New method definition.
9618
9619 2009-11-10  Doug Kwan  <dougkwan@google.com>
9620
9621         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9622         a format warning.
9623         * incremental.cc (open_incremental_binary): Initialized local
9624         variables to avoid warnings.
9625         * object.cc (make_elf_object): Ditto.
9626         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9627         a format warning.
9628
9629 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9630
9631         PR gold/10930
9632         * testsuite/plugin_test.c: Include "config.h".
9633
9634 2009-11-09  Doug Kwan  <dougkwan@google.com>
9635
9636         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9637         (arm_symbol_value): Remove.
9638         (Arm_relocate_functions::arm_branch_common,
9639         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9640         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9641         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9642         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9643         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9644         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9645         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9646         Arm_relocate_functions::thm_mobw_abs_nc,
9647         Arm_relocate_functions::thm_mov_abs,
9648         Arm_relocate_functions::movw_prel_nc,
9649         Arm_relocate_functions::thm_movt_abs,
9650         Arm_relocate_functions::movt_prel,
9651         Arm_relocate_functions::thm_movw_prel_nc,
9652         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9653         (Target_arm::Relocate::relocate): Only decompose address into two
9654         parts if relocation type uses the thumb-bit and pass the actual
9655         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9656         calls to methods in Arm_relocate_functions for this change.
9657
9658 2009-11-08  Ian Lance Taylor  <iant@google.com>
9659
9660         PR 10925
9661         * reloc.cc: Instantiate
9662         Sized_relobj::initialize_input_to_output_maps and
9663         Sized_relobj:free_input_to_output_maps.
9664
9665 2009-11-06  Ian Lance Taylor  <iant@google.com>
9666
9667         PR 10876
9668         * defstd.cc (in_segment): Set only_if_ref true for "end".
9669
9670 2009-11-06  Doug Kwan  <dougkwan@google.com>
9671
9672         * arm.cc (class Reloc_stub): Correct a comment.
9673         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9674         (Target_arm::scan_section_for_stubs): New method declaration.
9675         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9676         Change methods from private to protected.
9677         (Target_arm::do_may_relax): New method definition.
9678         (Target_arm::do_relax, Target_arm::group_sections,
9679         Target_arm::scan_reloc_for_stub,
9680         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9681         (Target_arm::arm_input_section_map_): New data member declaration.
9682         (Target_arm::scan_reloc_for_stub,
9683         Target_arm::scan_reloc_section_for_stubs,
9684         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9685         Target_arm::do_relax): New method definitions.
9686
9687 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9688
9689         * configure.ac: Check for (struct stat)::st_mtim
9690         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9691         * config.in: Regenerate.
9692         * configure: Regenerate.
9693
9694 2009-11-05  Ian Lance Taylor  <iant@google.com>
9695
9696         PR 10910
9697         * output.cc (Output_segment::add_output_section): Add missing
9698         return statement.
9699
9700 2009-11-04  Ian Lance Taylor  <iant@google.com>
9701
9702         PR 10880
9703         * object.h (class Object): Add is_needed and set_is_needed
9704         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9705         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9706         defined in a dynamic object and referenced by a regular object,
9707         set is_needed for the dynamic object.
9708         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9709         if the file is marked with as_needed and it is not needed.
9710
9711 2009-11-04  Ian Lance Taylor  <iant@google.com>
9712
9713         PR 10887
9714         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9715         tags if data is discarded by linker script.
9716         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9717         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9718         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9719         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9720
9721 2009-11-04  Ian Lance Taylor  <iant@google.com>
9722
9723         * layout.cc (Layout::get_output_section): Add is_interp and
9724         is_dynamic_linker_section parameters.  Change all callers.
9725         (Layout::choose_output_section): Likewise.
9726         (Layout::make_output_section): Likewise.
9727         (Layout::add_output_section_data): Add is_dynamic_linker_section
9728         parameter.  Change all callers.
9729         * layout.h (class Layout): Update declarations.
9730         * output.h (class Output_section): Add is_interp, set_is_interp,
9731         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9732         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9733         generate_code_fills_at_write_ to a bitfield.
9734         * output.cc (Output_section::Output_sections): Initialize new
9735         fields.
9736         (Output_segment::add_output_section): Add do_sort parameter.
9737         Change all callers.
9738
9739 2009-11-03  Ian Lance Taylor  <iant@google.com>
9740
9741         PR 10860
9742         * options.h (class General_options): Add --warn-common.
9743         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9744         merging two common symbols.
9745         (Symbol_table::should_override): Handle --warn-common when merging
9746         a common symbol with a defined symbol.  Use report_resolve_problem
9747         for multiple definitions.
9748         (Symbol_table::report_resolve_problem): New function.
9749         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9750
9751 2009-11-03  Doug Kwan  <dougkwan@google.com>
9752
9753         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9754         stub_factory_.
9755         (Target_arm::stub_factory): New method definition.
9756         (Target_arm::new_arm_input_section,
9757         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9758         Target_arm::reloc_uses_thumb_bit): New method declarations.
9759         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9760         New type definitions.
9761         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9762         member declarations.
9763         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9764         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9765         New method definitions.
9766
9767 2009-11-03  Ian Lance Taylor  <iant@google.com>
9768
9769         * options.h (class General_options): Add --warn_constructors.
9770
9771 2009-11-03  Ian Lance Taylor  <iant@google.com>
9772
9773         PR 10893
9774         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9775         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9776
9777 2009-11-03  Ian Lance Taylor  <iant@google.com>
9778
9779         PR 10895
9780         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9781         --msgid-bugs-address.
9782         (install-pdf): New target.
9783         (install-data_yes): Look up one directory to find mkinstalldirs.
9784
9785 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9786
9787         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9788         tree.
9789
9790 2009-10-30  Doug Kwan  <dougkwan@google.com>
9791
9792         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9793
9794 2009-10-30  Doug Kwan  <dougkwan@google.com>
9795
9796         * arm.cc (Stub_addend_reader): New struct template definition
9797         and partial specializations.
9798         (Stub_addend_reader::operator()): New method definition for a
9799         partially specialized template.
9800
9801 2009-10-30  Doug Kwan  <dougkwan@google.com>
9802
9803         * arm.cc (Arm_relobj::processor_specific_flags): New method
9804         definition.
9805         (Arm_relobj::do_read_symbols): New method declaration.
9806         (Arm_relobj::processor_specific_flags_): New data member declaration.
9807         (Arm_dynobj): New class definition.
9808         (Target_arm::do_finalize_sections): Add input_objects parameter.
9809         (Target_arm::do_adjust_elf_header): New method declaration.
9810         (Target_arm::are_eabi_versions_compatible,
9811         (Target_arm::merge_processor_specific_flags): New method declaration.
9812         (Target_arm::do_make_elf_object): New overloaded method definitions
9813         and declaration.
9814         (Arm_relobj::do_read_symbols): New method definition.
9815         (Arm_dynobj::do_read_symbols): Ditto.
9816         (Target_arm::do_finalize_sections): Add input_objects parameters.
9817         Merge processor-specific flags from all input objects.
9818         (Target_arm::are_eabi_versions_compatible,
9819         Target_arm::merge_processor_specific_flags,
9820         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9821         New method definitions.
9822         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9823         Input_objects pointer type parameter.
9824         * layout.cc (Layout::finalize): Pass input objects to target's.
9825         finalize_sections function.
9826         * output.cc (Output_file_header::do_sized_write): Set ELF file
9827         header's processor-specific flags.
9828         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9829         Input_objects pointer type parameter.
9830         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9831         * target.h (Input_objects): New forward class declaration.
9832         (Target::processor_specific_flags,
9833         Target::are_processor_specific_flags_sect): New method definitions.
9834         (Target::finalize_sections): Add input_objects parameter.
9835         (Target::Target): Initialize processor_specific_flags_ and
9836         are_processor_specific_flags_set_.
9837         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9838         parameter.
9839         (Target::set_processor_specific_flags): New method definition.
9840         (Target::processor_specific_flags_,
9841         Target::are_processor_specific_flags_set_): New data member
9842         declarations.
9843         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9844         Input_objects pointer type parameter.
9845
9846 2009-10-30  Doug Kwan  <dougkwan@google.com>
9847
9848         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9849
9850 2009-10-28  Ian Lance Taylor  <iant@google.com>
9851
9852         * object.h (class Relobj): Drop options parameter from
9853         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9854         do_scan_relocs, do_relocate.  Change all callers.
9855         (class Sized_relobj): Drop options parameters from
9856         do_gc_process_relocs, do_scan_relocs, do_relocate,
9857         do_relocate_sections, relocate_sections, emit_relocs_scan,
9858         emit_relocs_scan_reltype.  Change all callers.
9859         (struct Relocate_info): Remove options field and all references to
9860         it.
9861         * reloc.h (class Read_relocs): Remove options constructor
9862         parameter and options_ field.  Change all callers.
9863         (class Gc_process_relocs, class Scan_relocs): Likewise.
9864         (class Relocate_task): Likewise.
9865         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9866         all callers.
9867         (scan_relocatable_relocs): Likewise.
9868         * target.h (class Sized_target): Remove options parameter from
9869         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9870         all callers.
9871         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9872         callers.
9873         * arm.cc: Update functions to remove options parameters.
9874         * i386.cc: Likewise.
9875         * powerpc.cc: Likewise.
9876         * sparc.cc: Likewise.
9877         * x86_64.cc: Likewise.
9878         * testsuite/testfile.cc: Likewise.
9879
9880 2009-10-28  Doug Kwan  <dougkwan@google.com>
9881
9882         * arm.cc (Arm_relobj): New class definition.
9883         (Arm_relobj::scan_sections_for_stubs,
9884         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9885         New method definitions.
9886
9887 2009-10-28  Cary Coutant  <ccoutant@google.com>
9888
9889         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9890         (Plugin::cleanup_done_): New member.
9891         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9892         (Plugin_manager::cleanup_done_): Remove.
9893         (Plugin_manager::add_input_file): Edit error message.
9894         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9895         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9896
9897 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9898
9899         * fileread.cc: (File_read::View::~View): Use the new
9900         data_ownership_ filed.
9901         (File_read::~File_read): Dispose the new whole_file_view_.
9902         (File_read::open): Mmap the whole file if needed.
9903         (File_read::open): Use whole_file_view_ instead of contents_.
9904         (File_read::find_view): Use whole_file_view_ if applicable.
9905         (File_read::do_read): Use whole_file_view_ instead of contents_.
9906         (File_read::make_view): Use whole_file_view_ instead of contents_,
9907         update File_read::View::View call.
9908         (File_read::find_or_make_view): Update File_read::View::View
9909         call.
9910         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9911         remove contents_
9912         (File_read::View::Data_ownership): New enum.
9913         (File_read::View::View): Replace bool mapped_ with Data_ownership
9914         argument.
9915         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9916         (File_read::View::data_ownership_): New field.
9917         (File_read::contents_): Remove (replaced by whole_file_view_).
9918         (File_read::whole_file_view_): New field.
9919         * options.h (class General_options): Add --keep-files-mapped.
9920
9921 2009-10-27  Cary Coutant  <ccoutant@google.com>
9922
9923         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9924         * testsuite/Makefile.am (plugin_test_5): New test case.
9925         * testsuite/Makefile.in: Regenerate.
9926
9927 2009-10-25  Doug Kwan  <dougkwan@google.com>
9928
9929         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9930         from private to protected to allow access by child class.
9931         (Sized_relobj::do_relocate_sections): New method declaration.
9932         (Sized_relobj::relocate_sections): Virtualize.
9933         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9934         Sized_relobj::relocate_sections.  Instantiate template explicitly
9935         for different target sizes and endianity.
9936
9937 2009-10-24  Doug Kwan  <dougkwan@google.com>
9938
9939         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9940         (Arm_input_section::as_arm_input_section): New method.
9941         (Arm_output_section): New class definition.
9942         (Arm_output_section::create_stub_group,
9943         Arm_output_section::group_sections): New method definitions.
9944
9945 2009-10-22  Doug Kwan  <dougkwan@google.com>
9946
9947         * arm.cc (Arm_input_section): New class definition.
9948         (Arm_input_section::init, Arm_input_section:do_write,
9949         Arm_input_section::set_final_data_size,
9950         Arm_input_section::do_reset_address_and_file_offset): New method
9951         definitions.
9952
9953 2009-10-21  Doug Kwan  <dougkwan@google.com>
9954
9955         * arm.cc (Stub_table, Arm_input_section): New forward class
9956         declarations.
9957         (Stub_table): New class defintion.
9958         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9959         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9960         New method definition.
9961
9962 2009-10-21  Doug Kwan  <dougkwan@google.com>
9963
9964         * arm.cc: Update copyright comments.
9965         (Target_arm): New forward class template declaration.
9966         (Arm_address): New type.
9967         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9968         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9969         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9970         constants.
9971         (Insn_template): Same.
9972         (DEF_STUBS): New macro.
9973         (Stub_type): New enum type.
9974         (Stub_template): New class definition.
9975         (Stub): Same.
9976         (Reloc_stub): Same.
9977         (Stub_factory): Same.
9978         (Target_arm::Target_arm): Initialize may_use_blx_ and
9979         should_force_pic_veneer_.
9980         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9981         Target_arm::should_force_pic_veneer,
9982         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9983         Target_arm::using_thumb_only, Target_arm:;default_target): New
9984         method defintions.
9985         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9986         New data member declarations.
9987         (Insn_template::size, Insn_template::alignment): New method defintions.
9988         (Stub_template::Stub_template): New method definition.
9989         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9990         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9991         (Stub_factory::Stub_factory): New method definition.
9992         * gold.h (string_hash): New template.
9993         * output.h (Input_section_specifier::hash_value): Use
9994         gold::string_hash.
9995         (Input_section_specifier::string_hash): Remove.
9996         * stringpool.cc (Stringpool_template::string_hash): Use
9997         gold::string_hash.
9998
9999 2009-10-20  Doug Kwan  <dougkwan@google.com>
10000
10001         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10002         symbols of relaxed input sections.
10003         * output.h (Output_section::find_relaxed_input_section): Make
10004         method public.
10005
10006 2009-10-16  Doug Kwan  <dougkwan@google.com>
10007
10008         * dynobj.cc (Versions::Versions): Initialize version_script_.
10009         Only insert base version symbol definition for a shared object
10010         if version script defines any version versions.
10011         (Versions::define_base_version): New method definition.
10012         (Versions::add_def): Check that base version is not needed.
10013         (Versions::add_need): Define base version lazily.
10014         * dynobj.h (Versions::define_base_version): New method declaration.
10015         (Versions::needs_base_version_): New data member declaration.
10016         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10017         (check_DATA): Add no_version_test.stdout.
10018         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10019         New make rules.
10020         * testsuite/Makefile.in: Regenerate.
10021         * testsuite/no_version_test.c: New file.
10022         * testsuite/no_version_test.sh: Ditto.
10023
10024 2009-10-16  Doug Kwan  <dougkwan@google.com>
10025
10026         * expression.cc (class Segment_start_expression): New class definition.
10027         (Segment_start_expression::value): New method definition.
10028         (script_exp_function_segment_start): Return a new
10029         Segment_start_expression.
10030         * gold/script-c.h (script_saw_segment_start_expression): New function
10031         prototype.
10032         * script-sections.cc (Script_sections::Script_sections): Initialize
10033         SAW_SEGMENT_START_EXPRESSION_ to false.
10034         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10035         and -Tbbs options to specify section addresses if given in
10036         command line and no SEGMENT_START expression is seen in a script.
10037         * script-sections.h (Script_sections::saw_segment_start_expression,
10038         Script_sections::set_saw_segment_start_expression): New method
10039         definition.
10040         (Script_sections::saw_segment_start_expression_): New data member
10041         declaration.
10042         * script.cc (script_saw_segment_start_expression): New function.
10043         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10044         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10045         script_test_7.sh and script_test_8.sh.
10046         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10047         script_test_8.stdout.
10048         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10049         (script_test_6, script_test_6.stdout, script_test_7,
10050         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10051         * Makefile.in: Regenerate.
10052         * testsuite/script_test_6.sh: New file.
10053         * testsuite/script_test_6.t: Same.
10054         * testsuite/script_test_7.sh: Same.
10055         * testsuite/script_test_7.t: Same.
10056         * testsuite/script_test_8.sh: Same.
10057
10058 2009-10-16  Doug Kwan  <dougkwan@google.com>
10059
10060         * output.cc (Output_segment::set_section_list_address): Cast
10061         expressions to unsigned long long type to avoid format warnings.
10062
10063 2009-10-15  Ian Lance Taylor  <iant@google.com>
10064
10065         * script.cc (Script_options::add_symbol_assignment): Always add a
10066         dot assignment to script_sections_.
10067         * script-sections.cc (Script_sections::add_dot_assignment):
10068         Initialize if necessary.
10069
10070         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10071         program headers with no load segment if there is a linker script.
10072
10073         * layout.cc (Layout::set_segment_offsets): Align the file offset
10074         to the segment aligment for -N or -n with no load segment.
10075         * output.cc (Output_segment::add_output_section): Don't crash if
10076         the first section is a TLS section.
10077         (Output_segment::set_section_list_addresses): Print an error
10078         message if the address moves backward in a linker script.
10079         * script-sections.cc
10080         (Output_section_element_input::set_section_addresses): Don't
10081         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10082         (Orphan_output_section::set_section_addresses): Likewise.
10083
10084 2009-10-15  Doug Kwan  <dougkwan@google.com>
10085
10086         * layout.cc (Layout::finish_dynamic_section): Generate tags
10087         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10088         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10089         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10090
10091 2009-10-14  Ian Lance Taylor  <iant@google.com>
10092
10093         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10094         fields.
10095         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10096         data_shdr fields of relinfo.
10097         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10098         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10099         R_386_TLS_LDO_32, adjust based on section flags.
10100         (Target_i386::Relocate::fix_up_ldo): Remove.
10101
10102 2009-10-13  Ian Lance Taylor  <iant@google.com>
10103
10104         Add support for -pie.
10105         * options.h (class General_options): Add -pie and
10106         --pic-executable.
10107         (General_options::output_is_position_independent): Test -pie.
10108         (General_options::output_is_executable): Return true if not shared
10109         and not relocatable.
10110         (General_options::output_is_pie): Remove.
10111         * options.cc (General_options::finalize): Reject incompatible uses
10112         of -pie.
10113         * gold.cc (queue_middle_tasks): A -pie link is not static.
10114         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10115         * symtab.cc (Symbol::final_value_is_known): Return false if
10116         output_is_position_independent.
10117         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10118         output_is_position_independent.
10119         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10120         output_is_position_independent.
10121         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10122         output_is_position_independent.
10123         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10124         two_file_pie_test.
10125         (basic_pie_test.o, basic_pie_test): New targets.
10126         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10127         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10128         (two_file_pie_test): New target.
10129         * testsuite/Makefile.in: Rebuild.
10130         * README: Remove note saying that -pie is not supported.
10131
10132 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10133
10134         * options.h (class General_options): Add -init and -fini.
10135         * layout.cc (Layout::finish_dynamic_section): Emit
10136         given init and fini functions.
10137
10138 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10139
10140         * gc.h (gc_process_relocs): Check if icf is enabled using new
10141         function.
10142         * gold.cc (queue_initial_tasks): Likewise.
10143         (queue_middle_tasks): Likewise.
10144         * object.cc (do_layout): Likewise.
10145         * symtab.cc (is_section_folded): Likewise.
10146         * main.cc (main): Likewise.
10147         * reloc.cc (Read_relocs::run): Likewise.
10148         (Sized_relobj::do_scan_relocs): Likewise.
10149         * icf.cc (is_function_ctor_or_dtor): New function.
10150         (Icf::find_identical_sections): Check if function is ctor or dtor when
10151         safe icf is chosen.
10152         * options.h (General_options::icf): Change option to be an enum.
10153         (Icf_status): New enum.
10154         (icf_enabled): New method.
10155         (icf_safe_folding): New method.
10156         (set_icf_status): New method.
10157         (icf_status_): New variable.
10158         * (options.cc) (General_options::finalize): Set icf_status_.
10159         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10160         icf_test and icf_keep_unique_test to use the --icf enum flag.
10161         * testsuite/icf_safe_test.sh: New file.
10162         * testsuite/icf_safe_test.cc: New file.
10163
10164 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10165
10166         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10167         includes to gc.h and icf.h.
10168         * arm.cc: Include gc.h.
10169         * gold.cc: Likewise.
10170         * i386.cc: Likewise.
10171         * powerpc.cc: Likewise.
10172         * sparc.cc: Likewise.
10173         * x86_64.cc: Likewise.
10174         * gc.h: Include icf.h.
10175
10176 2009-10-11  Ian Lance Taylor  <iant@google.com>
10177
10178         * plugin.cc: Include "gold.h" before other header files.
10179
10180 2009-10-10  Chris Demetriou  <cgd@google.com>
10181
10182         * options.h (Input_file_argument::Input_file_type): New enum.
10183         (Input_file_argument::is_lib_): Replace with...
10184         (Input_file_argument::type_): New member.
10185         (Input_file_argument::Input_file_argument): Take Input_file_type
10186         'type' rather than boolean 'is_lib' as second argument.
10187         (Input_file_argument::is_lib): Use type_.
10188         (Input_file_argument::is_searched_file): New function.
10189         (Input_file_argument::may_need_search): Handle is_searched_file.
10190         * options.cc (General_options::parse_library): Support -l:filename.
10191         (General_options::parse_just_symbols): Update for Input_file_argument
10192         changes.
10193         (Command_line::process): Likewise.
10194         * archive.cc (Archive::get_file_and_offset): Likewise.
10195         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10196         * script.cc (read_script_file, script_add_file): Likewise.
10197         * fileread.cc (Input_file::Input_file): Likewise.
10198         (Input_file::will_search_for): Handle is_searched_file.
10199         (Input_file::open): Likewise.
10200         * readsyms.cc (Read_symbols::get_name): Likewise.
10201         * testsuite/Makefile.am (searched_file_test): New test.
10202         * testsuite/Makefile.in: Regenerate.
10203         * testsuite/searched_file_test.cc: New file.
10204         * testsuite/searched_file_test_lib.cc: New file.
10205
10206 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10207             Ian Lance Taylor  <iant@google.com>
10208
10209         * descriptor.cc: Include <cstdio> and "binary-io.h".
10210         (Descriptors::open): Open the files in binary mode always.
10211         * script.cc (Lex::get_token): Treat \r as whitespace.
10212
10213 2009-10-09  Ian Lance Taylor  <iant@google.com>
10214
10215         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10216
10217 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10218             Ian Lance Taylor  <iant@google.com>
10219
10220         * configure.ac: Check for readv function also.
10221         * fileread.cc (readv): Define if not HAVE_READV.
10222         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10223         does not exist.
10224         * config.in: Regenerate.
10225         * configure: Regenerate.
10226
10227 2009-10-09  Doug Kwan  <dougkwan@google.com>
10228
10229         * layout.cc (Layout::make_output_section): Call target hook to make
10230         ordinary output section.
10231         (Layout::finalize): Adjust parameter list of call the
10232         Target::may_relax().
10233         * layout.h (class Layout::section_list): New method.
10234         * merge.h (Output_merge_base::entsize): Change visibility to public.
10235         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10236         New methods.
10237         (Output_merge_string::do_is_string): New method.
10238         * object.cc (Sized_relobj::do_setup): renamed from
10239         Sized_relobj::set_up.
10240         * object.h (Sized_relobj::adjust_shndx,
10241         Sized_relobj::initializ_input_to_output_maps,
10242         Sized_relobj::free_input_to_output_maps): Change visibilities to
10243         protected.
10244         (Sized_relobj::setup): Virtualize.
10245         (Sized_relobj::do_setup): New method declaration.
10246         (Sized_relobj::invalidate_section_offset,
10247         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10248         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10249         * options.cc (parse_int): New function.
10250         * options.h (parse_int): New declaration.
10251         (DEFINE_int): New macro.
10252         (stub_group_size): New option.
10253         * output.cc (Output_section::Output_section): Initialize memebers
10254         merge_section_map_, merge_section_by_properties_map_,
10255         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10256         (Output_section::add_input_section): Handled deferred code-fill
10257         generation and remove an old comment.
10258         (Output_section::add_relaxed_input_section): New method definition.
10259         (Output_section::add_merge_input_section): Use merge section by
10260         properties map to speed to search.  Update merge section maps
10261         as appropriate.
10262         (Output_section::build_relaxation_map): New method definition.
10263         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10264         Same.
10265         (Output_section::relax_input_section): Renamed to
10266         Output_section::convert_input_sections_to_relaxed_sections and change
10267         interface to take a vector of pointers to relaxed sections.
10268         (Output_section::find_merge_section,
10269         Output_section::find_relaxed_input_section): New method definitions.
10270         (Output_section::is_input_address_mapped,
10271         Output_section::output_offset, Output_section::output_address):
10272         Use output section data maps to speed up searching.
10273         (Output_section::find_starting_output_address): Add comments.
10274         (Output_section::do_write,
10275         Output_section::write_to_postprocessing_buffer): Do code-fill
10276         generation as appropriate.
10277         (Output_section::get_input_sections): Invalidate relaxed input section
10278         map.
10279         (Output_section::restore_states): Adjust type of checkpoint .
10280         Invalidate relaxed input section map.
10281         * output.h (Output_merge_base): New class declaration.
10282         (Input_section_specifier): New class defintion.
10283         (class Output_relaxed_input_section) Change base class to
10284         Output_section_data_build.
10285         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10286         base class initializer.
10287         (Output_section::add_relaxed_input_section): New method declaration.
10288         (Output_section::Input_section): Change visibility to protected.
10289         (Output_section::Input_section::relobj,
10290         Output_section::Input_section::shndx): Handle relaxed input sections.
10291         Output_section::input_sections) Change visibility to protected.  Also
10292         define overload to return a non-const pointer.
10293         (Output_section::Merge_section_properties): New class defintion.
10294         (Output_section::Merge_section_by_properties_map,
10295         Output_section::Output_section_data_by_input_section_map,
10296         Output_section::Relaxation_map): New types.
10297         (Output_section::relax_input_section): Rename method to
10298         Output_section::convert_input_sections_to_relaxed_sections and change
10299         interface to take a vector of relaxed section pointers.
10300         (Output_section::find_merge_section,
10301         Output_section::find_relaxed_input_section,
10302         Output_section::build_relaxation_map,
10303         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10304         New method declarations.
10305         (Output_section::merge_section_map_
10306         Output_section::merge_section_by_properties_map_,
10307         Output_section::relaxed_input_section_map_,
10308         Output_section::is_relaxed_input_section_map_valid_,
10309         Output_section::generate_code_fills_at_write_): New data members.
10310         * script-sections.cc
10311         (Output_section_element_input::set_section_addresses): Call
10312         current_data_size and addralign methods of relaxed input sections.
10313         (Orphan_output_section::set_section_addresses): Call current_data_size
10314         and addralign methods of relaxed input sections.
10315         * symtab.cc (Symbol_table::compute_final_value): Extract template
10316         from the body of Symbol_table::sized_finalize_symbol.
10317         (Symbol_table::sized_finalized_symbol): Call
10318         Symbol_table::compute_final_value.
10319         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10320         (Symbol_table::compute_final_value): New templated method declaration.
10321         * target.cc (Target::do_make_output_section): New method defintion.
10322         * target.h (Target::make_output_section): New method declaration.
10323         (Target::relax): Add more parameters for input objects, symbol table
10324         and layout.  Adjust call to do_relax.
10325         (Target::do_make_output_section): New method declaration.
10326         (Target::do_relax): Add parameters for input objects, symbol table
10327         and layout.
10328
10329 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10330
10331         * pread.c: Include stdio.h.
10332
10333 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10334
10335         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10336         defined.
10337
10338 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10339
10340         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10341         Change read_shndx type to unsigned int.
10342         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10343         int.
10344         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10345         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10346         Change read_shndx type to unsigned int.
10347         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10348         int.
10349         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10350         * layout.cc (Layout::create_symtab_sections): Cast the result of
10351         local_symcount * symsize to off_t in the gold_assert.
10352
10353 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10354
10355         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10356         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10357         R_ARM_BASE_ABS.
10358         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10359         (Arm_relocate_functions::thm_abs5): New function.
10360         (Arm_relocate_functions::abs12): New function.
10361         (Arm_relocate_functions::abs16): New function.
10362         (Arm_relocate_functions::base_abs): New function.
10363         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10364         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10365         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10366         R_ARM_BASE_ABS.
10367         (Scan::global): Likewise.
10368         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10369         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10370         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10371         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10372         R_ARM_BASE_ABS.
10373
10374 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10375
10376         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10377         (Arm_relocate_functions::movt_prel): New function.
10378         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10379         (Arm_relocate_functions::thm_movt_prel): New function.
10380         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10381         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10382         (Scan::global, Relocate::relocate): Likewise.
10383         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10384
10385 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10386
10387         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10388         Incremental_checker.
10389         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10390         unsigned int.
10391         (class Incremental_inputs_header): New class.
10392         (Incremental_inputs_header_writer): Edit comment.
10393         (Incremental_inputs_entry): New class.
10394         (Incremental_inputs_entry_writer): Edit comment.
10395         (Sized_incremental_binary::do_find_incremental_inputs_section):
10396         Add *strtab_shndx parameter, fill it.
10397         (Sized_incremental_binary::do_check_inputs): New method.
10398         (Incremental_checker::can_incrementally_link_output_file): Use
10399         Sized_incremental_binary::check_inputs.
10400         (Incremental_inputs::report_command_line): Save command line in
10401         command_line_.
10402         * incremental.h:
10403         (Incremental_binary::find_incremental_inputs_section): New
10404         method.
10405         (Incremental_binary::do_find_incremental_inputs_section): Add
10406         strtab_shndx parameter.
10407         (Incremental_binary::do_check_inputs): New pure virtual method.
10408         (Sized_incremental_binary::do_check_inputs): Declare.
10409         (Incremental_checker::Incremental_checker): Add incremental_inputs
10410         parameter, use it to initialize incremental_inputs_.
10411         (Incremental_checker::incremental_inputs_): New field.
10412         (Incremental_checker::command_line): New method.
10413         (Incremental_checker::inputs): New method.
10414         (Incremental_checker::command_line_): New field.
10415
10416 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10417
10418         * incremental.cc: Include <cstdarg> and "target-select.h".
10419         (vexplain_no_incremental): New function.
10420         (explain_no_incremental): New function.
10421         (Incremental_binary::error): New method.
10422         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10423         method.
10424         (make_sized_incremental_binary): New function.
10425         (open_incremental_binary): New function.
10426         (can_incrementally_link_file): Add checks if output is ELF and has
10427         inputs section.
10428         * incremental.h: Include "elfcpp_file.h" and "output.h".
10429         (Incremental_binary): New class.
10430         (Sized_incremental_binary): New class.
10431         (open_incremental_binary): Declare.
10432         * object.cc (is_elf_object): Use
10433         elfcpp::Elf_recognizer::is_elf_file.
10434         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10435         * output.h (Output_file::filesize): New method.
10436
10437 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10438
10439         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10440         New function.
10441         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10442         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10443         function.
10444         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10445         function.
10446         (Arm_relocate_functions::movw_abs_nc): New function.
10447         (Arm_relocate_functions::movt_abs): New function.
10448         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10449         (Arm_relocate_functions::thm_movt_abs): New function.
10450         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10451         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10452         (Scan::global): Likewise.
10453         (Relocate::relocate): Likewise.
10454         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10455
10456 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10457
10458         * arm.cc (Arm_relocate_functions::got_prel) New function.
10459         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10460         (Relocate::relocate): Likewise.
10461         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10462
10463 2009-10-06  Ian Lance Taylor  <iant@google.com>
10464
10465         * options.h (class General_options): Define
10466         split_stack_adjust_size parameter.
10467         * object.h (class Object): Add uses_split_stack_ and
10468         has_no_split_stack_ fields.  Add uses_split_stack and
10469         has_no_split_stack accessor functions.  Declare
10470         handle_split_stack_section.
10471         (class Reloc_symbol_changes): Define.
10472         (class Sized_relobj): Define Function_offsets.  Declare
10473         split_stack_adjust, split_stack_adjust_reltype, and
10474         find_functions.
10475         * object.cc (Object::handle_split_stack_section): New function.
10476         (Sized_relobj::do_layout): Call handle_split_stack_section.
10477         * dynobj.cc (Sized_dynobj::do_layout): Call
10478         handle_split_stack_section.
10479         * reloc.cc (Sized_relobj::relocate_sections): Call
10480         split_stack_adjust for executable sections in split_stack
10481         objects.  Pass reloc_map to relocate_section.
10482         (Sized_relobj::split_stack_adjust): New function.
10483         (Sized_relobj::split_stack_adjust_reltype): New function.
10484         (Sized_relobj::find_functions): New function.
10485         * target-reloc.h: Include "object.h".
10486         (relocate_section): Add reloc_symbol_changes parameter.  Change
10487         all callers.
10488         * target.h (class Target): Add calls_non_split method.  Declare
10489         do_calls_non_split virtual method.  Declare match_view and
10490         set_view_to_nop.
10491         * target.cc: Include "elfcpp.h".
10492         (Target::do_calls_non_split): New function.
10493         (Target::match_view): New function.
10494         (Target::set_view_to_nop): New function.
10495         * gold.cc (queue_middle_tasks): Give an error if mixing
10496         split-stack and non-split-stack objects with -r.
10497         * i386.cc (Target_i386::relocate_section): Add
10498         reloc_symbol_changes parameter.
10499         (Target_i386::do_calls_non_split): New function.
10500         * x86_64.cc (Target_x86_64::relocate_section): Add
10501         reloc_symbol_changes parameter.
10502         (Target_x86_64::do_calls_non_split): New function.
10503         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10504         parameter.
10505         * powerpc.cc (Target_powerpc::relocate_section): Add
10506         reloc_symbol_changes parameter.
10507         * sparc.cc (Target_sparc::relocate_section): Add
10508         reloc_symbol_changes parameter.
10509         * configure.ac: Call AM_CONDITIONAL for the default target.
10510         * configure: Rebuild.
10511         * testsuite/Makefile.am (TEST_AS): New variable.
10512         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10513         (check_DATA): Add split_i386 and split_x86_64 files.
10514         (SPLIT_DEFSYMS): Define.
10515         (split_i386_[1234n].o): New targets.
10516         (split_i386_[124]): New targets.
10517         (split_i386_[1234r].stdout): New targets.
10518         (split_x86_64_[1234n].o): New targets.
10519         (split_x86_64_[124]): New targets.
10520         (split_x86_64_[1234r].stdout): New targets.
10521         (MOSTLYCLEANFILES): Add new executables.
10522         * testsuite/split_i386.sh: New file.
10523         * testsuite/split_x86_64.sh: New file.
10524         * testsuite/split_i386_1.s: New file.
10525         * testsuite/split_i386_2.s: New file.
10526         * testsuite/split_i386_3.s: New file.
10527         * testsuite/split_i386_4.s: New file.
10528         * testsuite/split_i386_n.s: New file.
10529         * testsuite/split_x86_64_1.s: New file.
10530         * testsuite/split_x86_64_2.s: New file.
10531         * testsuite/split_x86_64_3.s: New file.
10532         * testsuite/split_x86_64_4.s: New file.
10533         * testsuite/split_x86_64_n.s: New file.
10534         * testsuite/testfile.cc (Target_test): Update relocation_section
10535         function.
10536         * testsuite/Makefile.in: Rebuild.
10537
10538 2009-10-06  Ian Lance Taylor  <iant@google.com>
10539
10540         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10541         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10542         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10543         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10544         the address on ldo_addrs_.
10545         (Target_i386::Relocate::fix_up_ldo): New function.
10546
10547 2009-10-06   Rafael Espindola  <espindola@google.com>
10548
10549         * plugin.cc (add_input_library): New.
10550         (Plugin::load): Add add_input_library to tv.
10551         (Plugin_manager::add_input_file): Add the is_lib argument.
10552         (add_input_file): Update call to Plugin_manager::add_input_file.
10553         (add_input_library): New.
10554         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10555
10556 2009-09-30  Doug Kwan  <dougkwan@google.com>
10557
10558         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10559         symbol and call Symbol::may_need_copy_reloc to determine if
10560         a copy reloc is needed.
10561         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10562         nocopyreloc is given in command line.
10563         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10564         given in command line.
10565         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10566         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10567         of the removed Target_i386::may_need_copy_reloc.
10568         * options.h (copyreloc): New option with default value false.
10569         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10570         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10571         instead of the removed Target_powerpc::may_need_copy_reloc.
10572         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10573         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10574         instead of the removed Target_sparc::may_need_copy_reloc.
10575         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10576         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10577         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10578         instead of the removed Target_x86_64::may_need_copy_reloc.
10579
10580 2009-09-30  Ian Lance Taylor  <iant@google.com>
10581
10582         * object.h (class Object): Remove target_ field, and target,
10583         sized_target, and set_target methods.
10584         (Object::sized_target): Remove.
10585         (class Sized_relobj): Update declarations.  Remove sized_target.
10586         * object.cc (Sized_relobj::setup): Remove target parameter.
10587         Change all callers.
10588         (Input_objects::add_object): Don't do anything with the target.
10589         (make_elf_sized_object): Add punconfigured parameter.  Change all
10590         callers.  Set or test parameter target.
10591         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10592         Change all callers.
10593         * parameters.cc (Parameters::set_target): Change parameter type to
10594         be non-const.
10595         (Parameters::default_target): Remove.
10596         (set_parameters_target): Change parameter type to be non-const.
10597         (parameters_force_valid_target): New function.
10598         (parameters_clear_target): New function.
10599         * parameters.h (class Parameters): Update declarations.  Remove
10600         default_target method.  Add sized_target and clear_target
10601         methods.  Change target_ to be non-const.
10602         (set_parameters_target): Update declaration.
10603         (parameters_force_valid_target): Declare.
10604         (parameters_clear_target): Declare.
10605         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10606         as NULL if we aren't searching.
10607         (Add_symbols::run): Don't check for compatible target.
10608         * fileread.cc (Input_file::open_binary): Call
10609         parameters_force_valid_target.
10610         * gold.cc (queue_middle_tasks): Likewise.
10611         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10612         set_target on object.
10613         * dynobj.h (class Sized_dynobj): Update declarations.
10614         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10615         make_elf_object returns NULL.
10616         (Archive::include_member): Don't check whether object target is
10617         compatible.
10618         * output.cc (Output_section::add_input_section): Get target from
10619         parameters.
10620         (Output_section::relax_input_section): Likewise.
10621         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10622         parameters.
10623         (Sized_relobj::do_scan_relocs): Likewise.
10624         (Sized_relobj::relocate_sections): Likewise.
10625         * resolve.cc (Symbol_table::resolve): Likewise.
10626         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10627         parameter.  Change all callers.
10628         (Symbol_table::add_from_object): Get target from parameters.
10629         (Symbol_table::add_from_relobj): Don't check object target.
10630         (Symbol_table::add_from_dynobj): Likewise.
10631         (Symbol_table::define_special_symbol): Get target from
10632         parameters.
10633         * symtab.h (class Symbol_table): Update declaration.
10634         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10635         parameter.  Change all callers.  Clear parameter target.
10636         (Binary_test): Test target here.
10637         * testsuite/object_unittest.cc (gold_testsuite): Remove
10638         target_test_pointer parameter.  Change all callers.
10639         (Object_test): Test target here.
10640
10641 2009-09-26  Ian Lance Taylor  <iant@google.com>
10642
10643         * testsuite/initpri1.c: Don't try to use constructor priorities if
10644         compiling with gcc before 4.3.
10645
10646 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10647
10648         * testsuite/retain_symbols_file_test.sh (check_present): Change
10649         output file name to retain_symbols_file_test.stdout.
10650         (check_absent): Likewise.
10651
10652 2009-09-18  Craig Silverstein  <csilvers@google.com>
10653
10654         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10655         * options.cc: Include <cerrno> and <fstream>.
10656         (General_options::finalize): Parse -retain-symbols-file tag.
10657         * options.h: New flag.
10658         (General_options): New method should_retain_symbol, new
10659         variable symbols_to_retain.
10660         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10661         should_retain_symbol map.
10662         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10663         * testsuite/Makefile.in: Regenerate.
10664         * testsuite/retain_symbols_file_test.sh: New file.
10665
10666 2009-09-18  Nick Clifton  <nickc@redhat.com>
10667
10668         * po/es.po: Updated Spanish translation.
10669
10670 2009-09-17  Doug Kwan  <dougkwan@google.com>
10671
10672         * debug.h (DEBUG_RELAXATION): New constant.
10673         (DEBUG_ALL): Add DEBUG_RELAXATION.
10674         (debug_string_to_enum): Add relaxation debug option.
10675         * layout.cc
10676         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10677         Layout::Relaxation_debug_check::read_sections,
10678         Layout::Relaxation_debug_check::read_sections): New method definitions.
10679         (Layout::Layout): Initialize data members
10680         record_output_section_data_from_scrips_,
10681         script_output_section_data_list_ and relaxation_debug_check_.
10682         (Layout::save_segments, Layout::restore_segments,
10683         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10684         Layout::relaxation_loop_body): New method definitions.
10685         (Layout::finalize): Support relaxation.  Move section layout code to
10686         Layout::relaxation_loop_body.
10687         (Layout::set_asection_address_from_script): Move code for orphan
10688         section placement out.
10689         (Layout::place_orphan_sections_in_script): New method definition.
10690         * layout.h (Output_segment_headers, Output_file_header):
10691         New forward class declarations.
10692         (Layout::~Layout): Define.
10693         (Layout::new_output_section_data_from_script): New method definition.
10694         (Layout::place_orphan_sections_in_script): New method declaration.
10695         (Layout::Segment_states): New type declaration.
10696         (Layout::save_segments, Layout::restore_segments,
10697         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10698         Layout::relaxation_loop_body): New method declarations.
10699         (Layout::Output_section_data_list): New type declaration.
10700         (Layout::Relaxation_debug_check): New class definition.
10701         (Layout::record_output_section_data_from_script_,
10702         Layout::script_output_section_data_list_, Layout::segment_states_,
10703         Layout::relaxation_debug_check_): New data members.
10704         * output.cc: (Output_section_headers::do_size): New method definition.
10705         (Output_section_headers::Output_section_headers): Move size
10706         computation to Output_section_headers::do_size.
10707         (Output_segment_headers::do_size): New method definition.
10708         (Output_file_header::Output_file_header): Move size computation to
10709         Output_file_header::do_size and call it.
10710         (Output_file_header::do_size): New method definition.
10711         (Output_data_group::Output_data_group): Adjust call to
10712         Output_section_data.
10713         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10714         (Output_symtab_xindex::do_write): Add array bound check.
10715         (Output_section::Input_section::print_to_mapfile): Handle
10716         RELAXED_INPUT_SECTION_CODE.
10717         (Output_section::Output_section): Initialize data member checkpoint_.
10718         (Output_section::~Output_section): Delete checkpoint object pointed
10719         by checkpoint_.
10720         (Output_section::add_input_section): Always add an Input_section if
10721         relaxing.
10722         (Output_section::add_merge_input_section): Add assert.
10723         (Output_section::relax_input_section): New method definition.
10724         (Output_section::set_final_data_size): Set load address to zero for
10725         an unallocated section.
10726         (Output_section::do_address_and_file_offset_have_reset_values):
10727         New method definition.
10728         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10729         Handle relaxed input section.
10730         (Output_section::sort_attached_input_sections): Checkpoint input
10731         section list lazily.
10732         (Output_section::get_input_sections): Change type of input_sections to
10733         list of Simple_input_section pointers.  Checkpoint input section list
10734         lazily.  Also handle relaxed input sections.
10735         (Output_section::add_input_section_for_script): Take a reference to
10736         a Simple_input_section object instead of Relobj pointer and section
10737         index as parameter.  Handle relaxed input sections.
10738         (Output_section::save_states, Output_section::restore_states): New
10739         method definitions.
10740         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10741         (Output_data::is_data_size_fixed): New method definition.
10742         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10743         if it is fixed.
10744         (Output_data::address_and_file_offset_have_reset_values): New method
10745         definition.
10746         (Output_data::do_address_and_file_offset_have_reset_values): New method
10747         definition.
10748         (Output_data::set_data_size): Check that data size is not fixed.
10749         (Output_data::fix_data_size): New method definition.
10750         (Output_data::is_data_size_fixed_): New data member.
10751         (Output_section_headers::set_final_data_size): New method definition.
10752         (Output_section_headers::do_size): New method declaration.
10753         (Output_segment_headers::set_final_data_size): New method definition.
10754         (Output_segment_headers::do_size): New method declaration.
10755         (Output_file_header::set_final_data_size)::New method definition.
10756         (Output_file_header::do_size)::New method declaration.
10757         (Output_section_data::Output_section_data): Add new parameter
10758         is_data_size_fixed and use it to fix data size.
10759         (Output_data_const::Output_data_const): Adjust call to base class
10760         constructor and fix data size.
10761         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10762         base class constructor and fix data size.
10763         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10764         base class constructor and fix data size.
10765         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10766         class constructor and fix data size.
10767         (Output_data_group::set_final_data_size): New method definition.
10768         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10769         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10770         class constructor and fix data size.
10771         (Output_relaxed_input_section): New class definition.
10772         (Output_section::Simple_input_section): New class definition.
10773         (Output_section::get_input_sections): Adjust parameter list.
10774         (Output_section::add_input_section_for_script): Same.
10775         (Output_section::save_states, Output_section::restore_states,
10776         Output_section::do_address_and_file_offset_have_reset_values,
10777         (Output_section::Input_section::Input_section): Handle
10778         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10779         Output_relaxed_input_section.
10780         (Output_section::Input_section::is_input_section,
10781         Output_section::Input_section::set_output_section): Handle relaxed
10782         input section.
10783         (Output_section::Input_section::is_relaxed_input_section,
10784         Output_section::Input_section::output_section_data,
10785         Output_section::Input_section::relaxed_input_section): New method
10786         definitions.
10787         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10788         value.
10789         (Output_section::Input_section::u1_): Update comments.
10790         (Output_section::Input_section::u2_): Add new union member poris.
10791         (Output_section::Checkpoint_output_section): New classs definition.
10792         (Output_section::relax_input_section): New method declaration.
10793         (Output_section::checkpoint_): New data member.
10794         (Output_segment): Update comments.
10795         (Output_segment::Output_segment): Un-privatize copy constructor.
10796         (Output_segment::operator=): Un-privatize.
10797         * script-sections.cc (Output_section_element::Input_section_list):
10798         Change element type to Output_section::Simple_input_section.
10799         (Output_section_element_dot_assignment::set_section_addresses):
10800         Register output section data for relaxation clean up.
10801         (Output_data_exression::Output_data_expression): Adjust call to base
10802         constructor to fix data size.
10803         (Output_section_element_data::set_section_addresses): Register
10804         Output_data_expression object for relaxation clean up.
10805         (struct Input_section_info): Replace Relobj pointer and section index
10806         pair with Output_section::Simple_input_section and Convert struct to a
10807         class.
10808         (Input_section_sorter::operator()): Adjust access to
10809         Input_section_info data member to use accessors.
10810         (Output_section_element_input::set_section_addresses): Use layout
10811         parameter.  Adjust code to use Output_section::Simple_input_section
10812         and Input_secction_info classes.  Register filler for relaxation
10813         clean up.
10814         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10815         and section index pair with Output_section::Simple_input_section
10816         class.  Adjust code accordingly.
10817         (Phdrs_element::release_segment): New method definition.
10818         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10819         segment list.
10820         (Script_sections::release_segments): New method definition.
10821         * gold/script-sections.h (Script_sections::release_segments): New
10822         method declaration.
10823         * gold/target.h (Target::may_relax, Target::relax,
10824         Target::do_may_relax, Target::do_relax): New method definitions.
10825
10826 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10827
10828         * arm.cc (has_signed_unsigned_overflow): New function.
10829         (Arm_relocate_functions::abs8): New function.
10830         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10831         (Target_arm::Scan::global): Likewise.
10832         (Target_arm::relocate::relocate): Likewise.
10833         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10834         Likewise.
10835
10836 2009-09-16  Cary Coutant  <ccoutant@google.com>
10837
10838         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10839         * testsuite/Makefile.in: Regenerate.
10840
10841 2009-09-11  Nick Clifton  <nickc@redhat.com>
10842
10843         * po/gold.pot: Updated by the Translation project.
10844
10845 2009-09-08  Cary Coutant  <ccoutant@google.com>
10846
10847         * output.cc (Output_file::open): Add execute permission to empty file.
10848         * testsuite/Makefile.am (permission_test): New test.
10849         * testsuite/Makefile.in: Regenerate.
10850
10851 2009-09-02  Ian Lance Taylor  <iant@google.com>
10852
10853         * output.cc (Output_file::resize): Call map_no_anonymous rather
10854         than map.
10855
10856 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10857
10858         * gold.cc: Include "incremental.h".
10859         (queue_initial_tasks): Call Incremental_checker methods.
10860         * incremental.cc: Include "output.h".
10861         (Incremental_checker::can_incrementally_link_output_file): New
10862         method.
10863         * incremental.h (Incremental_checker): New class.
10864
10865         * output.cc (Output_file::open_for_modification): New method.
10866         (Output_file::map_anonymous): Changed return type to bool.  Record
10867         map in base_ field.
10868         (Output_file::map_no_anonymous): New method, broken out of map.
10869         (Output_file::map): Use map_no_anonymous and map_anonymous.
10870         * output.h (class Output_file): Update declarations.
10871
10872 2009-08-24  Cary Coutant  <ccoutant@google.com>
10873
10874         * options.h (Command_line::Pre_options): New class.
10875         (Command_line::pre_options): New member.
10876         * options.cc (gold::options::ready_to_register): New variable.
10877         (One_option::register_option): Do nothing if not registering options.
10878         Assert if same short option registered twice.
10879         (General_options::General_options): Turn off option registration when
10880         done constructing.
10881         (Command_line::Pre_options::Pre_options): New constructor.
10882
10883 2009-08-24  Cary Coutant  <ccoutant@google.com>
10884
10885         * options.h (General_options::no_keep_memory): Remove incorrect
10886         short option.
10887
10888 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10889
10890         * Makefile.am (am__skiplex, am__skipyacc): New.
10891         * Makefile.in: Regenerate.
10892
10893 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10894
10895         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10896         (INCLUDES): ... this.
10897         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10898         (AM_CPPFLAGS): Renamed from ...
10899         (INCLUDE): ... this.
10900         * Makefile.in, testsuite/Makefile.in: Regenerate.
10901
10902         * Makefile.in: Regenerate.
10903         * aclocal.m4: Likewise.
10904         * config.in: Likewise.
10905         * configure: Likewise.
10906         * testsuite/Makefile.in: Likewise.
10907
10908         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10909         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10910         * Makefile.in: Regenerate.
10911         * testsuite/Makefile.in: Regenerate.
10912
10913 2009-08-19  Cary Coutant  <ccoutant@google.com>
10914
10915         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10916         symbols in shared libraries overridden by hidden or internal symbols
10917         in the main program.
10918
10919 2009-08-19  Chris Demetriou  <cgd@google.com>
10920
10921         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10922         checking source file names in error messages.
10923
10924 2009-08-18  Doug Kwan  <dougkwan@google.com>
10925
10926         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10927         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10928         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10929         an elfcpp::Ehdr as parameter.
10930         * object.cc (Object::set_target): Remove the version that looks up
10931         a target and sets it.
10932         (Sized_relobj::setup): Take a Target object instead of
10933         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10934         (make_elf_sized_object): Find target and ask target to
10935         make an ELF object.
10936         * object.h: (Object::set_target): Remove the version that looks up
10937         a target and sets it.
10938         (Sized_relobj::setup): Take a Target object instead of
10939         an elfcpp:Ehdr as parameter.
10940         * target.cc: Include dynobj.h.
10941         (Target::do_make_elf_object_implementation): New.
10942         (Target::do_make_elf_object): New.
10943         * target.h (Target::make_elf_object): New template declaration.
10944         (Target::do_make_elf_object): New method declarations.
10945         (Target::do_make_elf_object_implementation): New template declaration.
10946
10947 2009-08-14  Ian Lance Taylor  <iant@google.com>
10948
10949         * gold.h (FUNCTION_NAME): Define.
10950         (gold_unreachable): Use FUNCTION_NAME.
10951
10952 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10953
10954         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10955         symbol in the --keep-unique list is not found.
10956
10957 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10958
10959         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10960         been maked as --keep-unique.
10961         (Icf::unfold_section): New function.
10962         * icf.h (Icf::unfold_section): New function.
10963         * options.h (General_options::keep_unique): New option.
10964         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10965         * testsuite/Makefile.in: Regenerate.
10966         * testsuite/icf_keep_unique_test.sh: New file.
10967         * testsuite/icf_keep_unique_test.cc: New file.
10968
10969 2009-08-12  Cary Coutant  <ccoutant@google.com>
10970
10971         PR 10471
10972         * resolve.cc (Symbol_table::resolve): Check for references from
10973         dynamic objects to hidden and internal symbols.
10974         * testsuite/Makefile.am (hidden_test.sh): New test.
10975         * testsuite/Makefile.in: Regenerate.
10976         * testsuite/hidden_test.sh: New script.
10977         * testsuite/hidden_test_1.c: New test source.
10978         * testsuite/hidden_test_main.c: New test source.
10979
10980 2009-08-11  Doug Kwan  <dougkwan@google.com>
10981
10982         * arm.cc: Update comments.
10983         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10984         segment to locate the .ARM.exidx section if present.
10985
10986 2009-08-09  Doug Kwan  <dougkwan@google.com>
10987
10988         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10989         patch.
10990
10991 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10992         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10993         compiler warnings.
10994
10995 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10996
10997         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10998         valid tls_segment only for non-debug-section relocations.
10999         * testsuite/Makefile.am: Add gc_tls_test.
11000         * testsuite/Makefile.in: Regenerate.
11001         * testsuite/gc_tls_test.cc: New file.
11002         * testsuite/gc_tls_test.sh: New file.
11003
11004 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11005
11006         * icf.cc: New file.
11007         * icf.h: New file.
11008         * Makefile.am (CCFILES): Add icf.cc.
11009         (HFILES): Add icf.h
11010         * Makefile.in: Regenerate.
11011         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11012         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11013         section, symbol and addend information for the relocs.
11014         * gold.cc (queue_middle_tasks): Call identical code folding.
11015         * gold.h: Add defines for multimap.
11016         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11017         to the call of finalize_local_symbols.
11018         * main.cc (main): Create object of class Icf.
11019         * object.cc (Sized_relobj::do_layout): Allow this function to be
11020         called twice during icf.
11021         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11022         to sections marked as identical by icf.
11023         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11024         when available.
11025         (Sized_relobj::do_section_entsize): New function.
11026         * object.h (Object::section_entsize): New function.
11027         (Object::do_section_entsize): New pure virtual function.
11028         (Relobj::finalize_local_symbols): Add new parameter.
11029         (Relobj::do_section_entsize): New function.
11030         * options.h (General_options::icf): New option.
11031         (General_options::icf_iterations): New option.
11032         (General_options::print_icf_sections): New option.
11033         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11034         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11035         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11036         icf.
11037         * symtab.cc (Symbol_table::is_section_folded): New function.
11038         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11039         to sections marked as identical by icf.
11040         * symtab.h (Symbol_table::set_icf): New function.
11041         (Symbol_table::icf): New function.
11042         (Symbol_table::is_section_folded): New function.
11043         (Symbol_table::icf_): New data member.
11044         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11045         * testsuite/Makefile.am: Add commands to build icf_test.
11046         * testsuite/Makefile.in: Regenerate.
11047         * testsuite/icf_test.sh: New file.
11048         * testsuite/icf_test.cc: New file.
11049
11050 2009-07-24  Chris Demetriou  <cgd@google.com>
11051
11052         * layout.cc (is_compressible_debug_section): Fix incorrect
11053         comment about compressed section names.
11054
11055 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11056
11057         PR 10419
11058         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11059
11060 2009-07-16  Ian Lance Taylor  <iant@google.com>
11061
11062         PR 10400
11063         * layout.h: #include <map>.
11064         (class Kept_section): Change from struct to class.  Add accessors
11065         and setters.  Add section size to Comdat_group mapping.  Change
11066         Comdat_group to std::map.  Add is_comdat_ field.  Add
11067         linkonce_size field in union.
11068         (class Layout): Update declaration of find_or_add_kept_section.
11069         Don't declare find_kept_object.
11070         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11071         parameter.  Add object, shndx, is_comdat, and is_group_name
11072         parameters.  Change all callers.  Adjust for new Kept_section.
11073         (Layout::find_kept_object): Remove.
11074         * object.cc (Sized_relobj::include_section_group): Update use of
11075         Kept_section.  Rename secnum to shndx.  Only record
11076         Kept_comdat_section if sections are the same size.
11077         (Sized_relobj::include_linkonce_section): Update use of
11078         Kept_section.  Only record Kept_comdat_section if sections are the
11079         same size.  Set size of linkonce section.
11080         (Sized_relobj::map_to_kept_section): Update call to
11081         get_kept_comdat_section.
11082         * object.h (class Sized_relobj): Rename fields in
11083         Kept_comdat_section to drop trailing underscores; change object
11084         field to Relobj*.  Change Kept_comdat_section_table to store
11085         struct rather than pointer.
11086         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11087         Add kept_object and kept_shndx parameters.  Change all callers.
11088         (Sized_relobj::get_kept_comdat_section): Change return type to
11089         bool.  Add kept_object and kept_shndx parameters.  Change all
11090         callers.
11091         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11092         Layout::find_or_add_kept_section.
11093
11094 2009-07-09  Ian Lance Taylor  <iant@google.com>
11095
11096         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11097         Reserve space in the hash table.
11098
11099 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11100
11101         * fileread.cc (File_read::get_mtime): New method.
11102         * fileread.h (Timespec): New structure.
11103         (File_read::get_mtime): New method.
11104         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11105         Renamed from timestamp_nsec.
11106         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11107         Elf_Xword.
11108         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11109         timestamp_nsec.
11110         (Incremental_inputs::report_archive): Save mtime; style fix.
11111         (Incremental_inputs::report_obejct): Save mtime; style fix.
11112         (Incremental_inputs::report_script): Save mtime; style fix.
11113         (Incremental_inputs::finalize_inputs): Style fix.
11114         (Incremental_inputs::finalize): Style fix.
11115         (Incremental_inputs::create_input_section_data): Store inputs
11116         mtime.
11117         * incremental.h (Incremental_inputs::report_script): Add mtime
11118         argument.
11119         (Incremental_inputs::Input_info::Input_info): Intialize only one
11120         union member.
11121         (Incremental_inputs::Input_info::archive): Move to nameless
11122         union.
11123         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11124         (Incremental_inputs::Input_info::script): Move to nameless union.
11125         (Incremental_inputs::mtime): New field.
11126         * script.cc (read_input_script): Pass file mtime to
11127         Incremental_input.
11128         * script.h (Script_info::inputs): Style fix.
11129
11130 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11131
11132         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11133         instead of 32.
11134
11135 2009-06-24  Ian Lance Taylor  <iant@google.com>
11136
11137         PR 10156
11138         * layout.cc (Layout::choose_output_section): If we find an
11139         existing section, update the flags.
11140         (Layout::create_notes): New function, broken out of
11141         Layout::finalize.
11142         (Layout::finalize): Don't create note sections.
11143         (Layout::create_note): Don't crash if linker script discards
11144         section.
11145         (Layout::create_gold_note): Likewise.
11146         (Layout::create_build_id): Likewise.  Don't set
11147         after_input_sections on the section.
11148         (Layout::create_executable_stack_info): Remove target parameter.
11149         Change caller.
11150         * layout.h (class Layout): Declare create_notes.  Update
11151         declaration of create_executable_stack_info.
11152         * gold.cc (queue_middle_tasks): Call create_notes.
11153         * output.cc (Output_section::update_flags_for_input_section): Move
11154         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11155         invalid.
11156         * output.h (Output_data::mark_address_invalid): New function.
11157         (class Output_section): Only declare, not define,
11158         update_flags_for_input_section.  Remove set_flags.
11159
11160 2009-06-24  Ian Lance Taylor  <iant@google.com>
11161
11162         * script-sections.cc (Output_section_definition::
11163         set_section_addresses): Rename shadowing local load_address to
11164         laddr.
11165
11166 2009-06-24  Ian Lance Taylor  <iant@google.com>
11167
11168         PR 10244
11169         * reloc.cc (relocate_sections): Skip empty relocation sections.
11170
11171 2009-06-23  Ian Lance Taylor  <iant@google.com>
11172
11173         PR 10156
11174         * layout.cc (Layout::create_note): Use choose_output_section
11175         rather than make_output_section.
11176
11177 2009-06-23  Ian Lance Taylor  <iant@google.com>
11178
11179         PR 10237
11180         * options.cc (General_options::parse_V): Set printed_version_.
11181         (General_options::General_options): Initialize printed_version_.
11182         * options.h (class General_options): Add printed_version_ field.
11183         * gold.cc (queue_initial_tasks): If there are no input files,
11184         don't give a fatal error if we printed the version information.
11185         (queue_middle_tasks): If using -r with a shared object, give a
11186         fatal error rather than an ordinary error.
11187
11188 2009-06-23  Ian Lance Taylor  <iant@google.com>
11189
11190         PR 10219
11191         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11192         (Layout::make_output_section): Set have_stabstr_section_ if we see
11193         a .stab*str section.
11194         (Layout::finalize): Call link_stabs_sections.
11195         (Layout::link_stabs_sections): New file.
11196         * layout.h (class Layout): Add have_stabstr_section_ field.
11197         Declare link_stabs_sections.
11198
11199 2009-06-23  Doug Kwan  <dougkwan@google.com>
11200
11201         * Makefile.am (libgold_a_LIBADD): New.
11202         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11203         * Makefile.in: Regenerate.
11204         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11205         * configure: Regenerate.
11206         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11207         * fileread.cc: Include sys/state.h
11208         * gold.h: Declare memmem and strndup if found missing.
11209         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11210
11211 2009-06-23  Ian Lance Taylor  <iant@google.com>
11212
11213         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11214         * configure: Rebuild.
11215
11216 2009-06-23  Ian Lance Taylor  <iant@google.com>
11217
11218         PR 10147
11219         * object.cc (Object::section_contents): Don't try to get a view if
11220         the section has length zero.
11221         (Object::handle_gnu_warning_section): If the section is empty, use
11222         the name of the section as the warning.
11223
11224 2009-06-23  Ian Lance Taylor  <iant@google.com>
11225
11226         PR 10133
11227         * stringpool.h (class Stringpool_template): Add optimize_ field.
11228         (Stringpool_template::set_optimize): New function.
11229         * stringpool.cc (Stringpool_template::Stringpool_template):
11230         Initialize optimize_ field.
11231         (Stringpool_template::set_string_offsets): Test local optimize
11232         fild rather than parameter.
11233         * layout.cc (Layout::Layout): Call set_optimize on the section
11234         name stringpool.
11235
11236 2009-06-22  Ian Lance Taylor  <iant@google.com>
11237
11238         PR 10030
11239         * yyscript.y: Parse TARGET.
11240         * script.cc (script_set_target): New function.
11241         * script-c.h (script_set_target): Declare.
11242         * options.cc (General_options::string_to_object_format): Rename
11243         from string_to_object_format in anonymous namespace.  Change
11244         callers.
11245         * options.h (class General_options): Declare
11246         string_to_object_format.
11247
11248 2009-06-22  Ian Lance Taylor  <iant@google.com>
11249
11250         * script-sections.cc (Script_sections::create_segments): Don't put
11251         program headers in a PT_LOAD segment if -n or -N.
11252
11253 2009-06-22  Ian Lance Taylor  <iant@google.com>
11254
11255         PR 10141
11256         * options.h (class General_options): Add -z lazy and -z now.  Sort
11257         -z options into alphabetical order.
11258         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11259
11260 2009-06-21  Ian Lance Taylor  <iant@google.com>
11261
11262         * layout.cc (Layout::make_output_section): Call
11263         Target::new_output_section.
11264         (Layout::attach_allocated_section_to_segment): Put large section
11265         sections in a separate load segment with the large segment flag
11266         set.
11267         (Layout::segment_precedes): Sort large data segments after other
11268         load segments.
11269         (align_file_offset): New static function.
11270         (Layout::set_segment_offsets): Use align_file_offset.
11271         * output.h (class Output_section): Add is_small_section_ and
11272         is_large_section_ fields.
11273         (Output_section::is_small_section): New function.
11274         (Output_section::set_is_small_section):  New function.
11275         (Output_section::is_large_section): New function.
11276         (Output_section::set_is_large_section): New function.
11277         (Output_section::is_large_data_section): New function.
11278         (class Output_segment): Add is_large_data_segment_ field.
11279         (Output_segment::is_large_data_segment): New function.
11280         (Output_segment::set_is_large_data_segment): New function.
11281         * output.cc (Output_section::Output_section): Initialize new
11282         fields.
11283         (Output_segment::Output_segment): Likewise.
11284         (Output_segment::add_output_section): Add assertion that large
11285         data sections always go in large data segments.  Force small data
11286         sections to the end of the list of data sections.  Force small BSS
11287         sections to the start of the list of BSS sections.  For large BSS
11288         sections to the end of the list of BSS sections.
11289         * symtab.h (class Symbol): Declare is_common_shndx.
11290         (Symbol::is_defined): Check Symbol::is_common_shndx.
11291         (Symbol::is_common): Likewise.
11292         (class Symbol_table): Define enum Commons_section_type.  Update
11293         declarations.  Add small_commons_ and large_commons_ fields.
11294         * symtab.cc (Symbol::is_common_shndx): New function.
11295         (Symbol_table::Symbol_table): Initialize new fields.
11296         (Symbol_table::add_from_object): Put small and large common
11297         symbols in the right list.
11298         (Symbol_table::sized_finalized_symbol): Check
11299         Symbol::is_common_shndx.
11300         (Symbol_table::sized_write_globals): Likewise.
11301         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11302         common symbol lists.  Don't call do_allocate_commons_list if the
11303         list is empty.
11304         (Symbol_table::do_allocate_commons_list): Remove is_tls
11305         parameter.  Add comons_section_type parameter.  Change all
11306         callers.  Handle small and large common symbols.
11307         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11308         Symbol::is_common_shndx.
11309         * resolve.cc (symbol_to_bits): Likewise.
11310         * target.h (Target::small_common_shndx): New function.
11311         (Target::small_common_section_flags): New function.
11312         (Target::large_common_shndx): New function.
11313         (Target::large_common_section_flags): New function.
11314         (Target::new_output_section): New function.
11315         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11316         small_common_section_flags, and large_common_section_flags
11317         fields.
11318         (Target::do_new_output_section): New virtual function.
11319         * arm.cc (Target_arm::arm_info): Initialize new fields.
11320         * i386.cc (Target_i386::i386_info): Likewise.
11321         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11322         Likewise.
11323         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11324         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11325         (Target_x86_64::do_new_output_section): New function.
11326         * configure.ac: Define conditional MCMODEL_MEDIUM.
11327         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11328         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11329         (large_LDFLAGS): Define.
11330         * testsuite/large.c: New file.
11331         * testsuite/testfile.cc (Target_test::test_target_info):
11332         Initialize new fields.
11333         * configure, testsuite/Makefile.in: Rebuild.
11334
11335 2009-06-05  Doug Kwan  <dougkwan@google.com>
11336
11337         * Makefile.am (CCFILES): Add target.cc.
11338         * Makefile.in: Regenerate.
11339         * i386.cc (class Target_i386): Define new virtual method to
11340         override do_is_local_label_name in parent.
11341         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11342         local symbols if --discard-locals or -X is given.
11343         * options.h (class General_options): Declare new options
11344         '--discard-locals' and '-X' for discarding locals.
11345         * target.h (class Target): Define new methods is_local_label_name.
11346         Declare new virtual method do_is_local_label_name.
11347         * target.cc: New file.
11348         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11349         (check_SCRIPTS): Add discard_locals_test.sh.
11350         (check_DATA): Add discard_local_tests.syms.
11351         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11352         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11353         * testsuite/Makefile.in: Regenerate.
11354         * testsuite/discard_locals_test.c: New file.
11355         * testsuite/discard_locals_test.sh: Same.
11356
11357 2009-06-05  Doug Kwan  <dougkwan@google.com>
11358
11359         * object.cc (Sized_relobj::Sized_relobj): Initialize
11360         discarded_eh_frame_shndx_ to -1U.
11361         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11362         section.
11363         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11364         a discarded .eh_frame section.
11365         (Sized_relobj::do_finalize_local_symbols): Ditto.
11366         * object.h (class Sized_relobj): Declare new member
11367         discarded_eh_frame_shndx_.
11368         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11369         (local_labels_test.o, local_labels_test): New rules.
11370         * testsuite/Makefile.in: Regenerate.
11371
11372 2009-06-04  Doug Kwan  <dougkwan@google.com>
11373
11374         * layout.cc (Layout::section_name_mapping): Add mapping for
11375         special ARM sections.
11376
11377 2009-06-03  Doug Kwan  <dougkwan@google.com>
11378
11379         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11380         (utils::has_overflow): Same.
11381
11382 2009-06-03  Ian Lance Taylor  <iant@google.com>
11383
11384         * layout.cc (Layout::section_name_mapping): New array, replacing
11385         Layout::linkonce_mapping.
11386         (Layout::section_name_mapping_count): New variable, replacing
11387         Layout::linkonce_mapping_count.
11388         (Layout::linkonce_output_name): Remove.
11389         (Layout::output_section_name): Rewrite.
11390         * layout.h (class Layout): Rename Linkonce_mapping to
11391         Section_name_mapping, linkonce_mapping to section_name_mapping,
11392         linkonce_mapping_count to section_name_mapping_count.  Don't
11393         declare linkonce_output_name.
11394
11395 2009-06-03  Doug Kwan  <dougkwan@google.com>
11396
11397         * gold/arm.cc (namespace utils): New.
11398         (Target_arm::reloc_is_non_pic): Define new method.
11399         (class Arm_relocate_functions): New.
11400         (Target_arm::Relocate::relocate): Handle relocation types used by
11401         Android.
11402
11403 2009-06-03  Ian Lance Taylor  <iant@google.com>
11404
11405         * arm.cc (Target_arm::scan::global): Use || instead of |.
11406
11407 2009-06-02  Doug Kwan  <dougkwan@google.com>
11408
11409         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11410         issued_non_pic_error_.
11411         (class Target_arm::Scan): Declare new method check_non_pic.
11412         Define new method symbol_needs_plt_entry.
11413         Declare new data member issued_non_pic_error_.
11414         (class Target_arm::Relocate): Declare new method
11415         should_apply_static_reloc.
11416         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11417         (Target_arm::Scan::check_non_pic): Define new method.
11418         (Target_arm::Scan::local): Handle a small subset of reloc types used
11419         by Android.
11420         (Target_arm::Scan::local): Same.
11421         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11422
11423 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11424
11425         * incremental.cc (Incremental_inputs::report_command_line): Filter
11426         out --incremental-* options.
11427
11428 2009-05-29  Doug Kwan  <dougkwan@google.com>
11429
11430         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11431         template class.
11432         (class Target_arm): Update comment.
11433         (Target_arm::Target_arm): Initialize new data members GOT_,
11434         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11435         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11436         and Target_arm::rel_dyn_section.
11437         Declare new_enum Target_arm::Got_type.
11438         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11439         and DYNBSS_.
11440         Update commments for member do_dynsym_value.
11441         (Target_arm::got_size, Target_arm::plt_section,
11442         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11443         new methods inside class defintion.
11444         (Target_arm::got_section): Define new method.
11445         (Target_arm::rel_dyn_section): Same.
11446         (Output_data_plt_arm): New template class.
11447         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11448         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11449         (Output_data_plt_arm::add_entry): Same.
11450         (Output_data_plt_arm::first_plt_entry): Define new
11451         static data member for PLT instruction template.
11452         (Output_data_plt_arm::plt_entry): Same.
11453         (Output_data_plt_arm::do_write): Define new method.
11454         (Target_arm::make_plt_entry): Same.
11455         (Target_arm::do_finalize_sections): Same.
11456         (Target_arm::do_dynsym_value): Same.
11457
11458 2009-05-28  Doug Kwan  <dougkwan@google.com>
11459
11460         * Makefile.am (TARGETSOURCES): Add arm.cc.
11461         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11462         * Makefile.in: Regenerate.
11463         * arm.cc: New file.
11464         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11465
11466 2009-05-26  Doug Kwan  <dougkwan@google.com>
11467
11468         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11469         (General_options::check_excluded_libs): Strip off directories in
11470         archive name before matching like GNU ld does.
11471         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11472         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11473         (exclude_libs_test_LDFLAGS): Add linker option
11474         -Wl,--exclude-libs,libexclude_libs_test_3
11475         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11476         an explicit archive without using -l.
11477         (alt/libexclude_libs_test_3.a): New make rule.
11478         * testsuite/Makefile.in: Regenerate.
11479         * testsuite/exclude_libs_test.c : Declare lib3_default().
11480         (main): Call it.
11481         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11482         * exclude_libs_test_3.c: New file.
11483
11484 2009-05-26  Nick Clifton  <nickc@redhat.com>
11485
11486         * po/id.po: New Indonesian translation.
11487         * po/gold.pot: Updated template file.
11488
11489 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11490
11491         * testsuite/Makefile.am: Add -ffunction-sections to compile
11492         gc_comdat_test files.  Add -Wl,--gc-sections to build
11493         gc_comdat_test.
11494         * testsuite/Makefile.in: Regenerate.
11495         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11496
11497 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11498
11499         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11500         kept comdat section was garbage collected.
11501         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11502         * testsuite/Makefile.in: Regenerate.
11503         * testsuite/gc_comdat_test.sh: New file.
11504         * testsuite/gc_comdat_test_1.cc: New file.
11505         * testsuite/gc_comdat_test_2.cc: New file.
11506
11507 2009-05-19  Doug Kwan  <dougkwan@google.com>
11508
11509         * archive.cc (Archive::Archive): Move constructor from archive.h
11510         to here.  Initialize no_export_.
11511         (Archive::get_elf_object_for_member): Set no_export flag of object.
11512         * archive.h (Archive::Archive): Move constructor body to
11513         archive.cc.
11514         (Archive::no_export): New method.
11515         (Archive::no_export_): New field.
11516         * object.h (Object::Object): Initialize no_export_ to false.
11517         (Object::no_export, Object::set_no_export): New methods.
11518         (Object::no_export_): New field.
11519         * options.cc (General_options::parse_exclude_libs): New method.
11520         (General_options::check_excluded_libs) Same.
11521         * options.h (exclude_libs): New option.
11522         (General_options::check_excluded_libs): New method declaration.
11523         (General_options::excluded_libs_): New field.
11524         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11525         default or protected visibility if an object has no-export flag set.
11526         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11527         (check_SCRIPTS): Add exclude_libs_test.sh.
11528         (check_DATA): Add exclude_libs_test.syms.
11529         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11530         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11531         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11532         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11533         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11534         libexclude_libs_test_2.a): New rules.
11535         * testsuite/Makefile.in: Regenerate.
11536         * testsuite/exclude_libs_test.c: New file.
11537         * testsuite/exclude_libs_test.sh: Ditto.
11538         * testsuite/exclude_libs_test_1.c: Ditto.
11539         * testsuite/exclude_libs_test_2.c: Ditto.
11540
11541 2009-05-15  Ian Lance Taylor  <iant@google.com>
11542
11543         * configure.ac: Check for declarations for cases where libiberty.h
11544         checks HAVE_DECL_xxx.
11545         * configure, config.in: Rebuild.
11546
11547 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11548
11549         * gold.h (Incremental_argument_list): Remove (invalid) forward
11550         declaration.
11551         * incremental.cc (Incremental_inputs::report_achive): New method.
11552         (Incremental_inputs::report_object): New method.
11553         (Incremental_inputs::report_script): New method.
11554         (Incremental_inputs::finalize_inputs): New method.
11555         (Incremental_inputs::finalize): Call finalize_inputs().
11556         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11557         Create inputs entries.
11558         * incremental.h (Incremental_input_type): New enum.
11559         (Incremental_inputs::Incremental_input): Initialize new fields.
11560         (Incremental_inputs::report_inputs): New method.
11561         (Incremental_inputs::report_achive): New method.
11562         (Incremental_inputs::report_object): New method.
11563         (Incremental_inputs::report_script): New method.
11564         (Incremental_inputs::finalize_inputs): New method.
11565         (Incremental_inputs::Input_info): New struct.
11566         (Incremental_inputs::Input_info_map): New typedef.
11567         (Incremental_inputs::lock_): New field.
11568         (Incremental_inputs::Inputs_): New field.
11569         (Incremental_inputs::Inputs_map): New field.
11570         * main.cc (main): Call Incremental_input::report_inputs.
11571         * options.h (Input_argument_list): Typedef moved from
11572         Input_arguments.
11573         (Input_file_group::Files): Remove, use ::Input_argument_list.
11574         (Input_file_group::Input_argument_list): Remove, use
11575         ::Input_argument_list.
11576         * plugin.cc (Plugin_manager::add_input_file): Add error in
11577         incremental build.
11578         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11579         functions.
11580         * script.cc (read_input_script): Call
11581         Incremental_input::report_script.
11582         * script.h (Script_info): New class.
11583
11584 2009-04-27  Ian Lance Taylor  <iant@google.com>
11585
11586         * x86_64.cc (do_adjust_output_section): Set entsize to
11587         plt_entry_size.
11588
11589 2009-04-23  Elliott Hughes  <enh@google.com>
11590
11591         * output.cc (Output_file::close): After short writes, continue
11592         writing from the correct offset in the buffer being written.
11593
11594 2009-04-23  Chris Demetriou  <cgd@google.com>
11595
11596         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11597         * configure: Regenerate.
11598         * config.in: Regenerate.
11599         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11600         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11601
11602 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11603
11604         * incremental.cc (Incremental_inputs_header_data): Renamed from
11605         Incremental_input_header_data.
11606         (Incremental_inputs_header_data::data_size): New field.
11607         (Incremental_inputs_header_data::put_input_file_count): Renamed
11608         from input_file_count.
11609         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11610         from command_line_offset.
11611         (Incremental_inputs_header_data::put_reserved): Renamed from
11612         put_reserved.
11613         (Incremental_inputs_entry_data): Renamed from
11614         Incremental_input_entry_data.
11615         (Incremental_inputs_entry_data::data_size): New field.
11616         (Incremental_inputs::report_command_line): New method.
11617         (Incremental_inputs::finalize): New method.
11618         (Incremental_inputs::create_incremental_inputs_data): New method.
11619         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11620         * incremental.h: New file.
11621         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11622         (Layout::finalize): Create incremental inputs section in
11623         incremental builds.
11624         (Layout::create_incremental_info_sections): New method.
11625         * layout.h (Layout::incremental_inputs): New method.
11626         (Layout::create_incremental_info_sections): New method.
11627         (Layout::incremental_inputs_): New field.
11628         * main.cc (main): Notify Incremental_input of the command line.
11629
11630 2009-04-01  Ian Lance Taylor  <iant@google.com>
11631             Mikolaj Zalewski  <mikolajz@google.com>
11632
11633         * gold.h (reserve_unordered_map): Define, three versions, one for
11634         each version of Unordered_map.
11635         * layout.cc (Layout::Layout): Remove options parameter.  Add
11636         number_of_input_files parameter.  Don't initialize options_.
11637         Initialize number_of_input_files_ and resized_signatures_.  Move
11638         sections_are_attached_.
11639         (Layout::layout_group): Reserve space for group_signatures_.
11640         (Layout::find_or_add_kept_section): Change name parameter to be a
11641         reference.  Resize signatures_ map when it gets large enough.
11642         (Layout::layout_eh_frame): Use parameters->options() instead of
11643         this->options_.
11644         (Layout::make_output_section): Likewise.
11645         (Layout::attach_allocated_section_to_segment): Likewise.
11646         (Layout::finalize, Layout::create_executable_stack): Likewise.
11647         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11648         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11649         * layout.h (class Layout): Update declarations.  Remove options_
11650         field.  Add number_of_input_files_ and resized_signatures_
11651         fields.  Move sections_are_attached_ field.
11652         * main.cc (main): Pass number of input files to Layout
11653         constructor.  Don't pass options.
11654
11655 2009-03-30  Ian Lance Taylor  <iant@google.com>
11656
11657         * ffsll.c (ffsll): Correct implementation.
11658
11659 2009-03-27  Ian Lance Taylor  <iant@google.com>
11660
11661         * ffsll.c: New file.
11662         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11663         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11664         * ftruncate.c (ftruncate): Declare before definition.
11665         * mremap.c (mremap): Likewise.
11666         * pread.c (pread): Likewise.
11667         * configure, Makefile.in, config.in: Rebuild.
11668
11669         * mremap.c: New file.
11670         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11671         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11672         (mremap): Declare if HAVE_MREMAP is not defined.
11673         * configure, Makefile.in, config.in: Rebuild.
11674
11675 2009-03-27  Cary Coutant  <ccoutant@google.com>
11676
11677         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11678         position independent.
11679         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11680         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11681
11682 2009-03-24  Cary Coutant  <ccoutant@google.com>
11683
11684         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11685         an executable.
11686         (needs_dynamic_reloc): Likewise.
11687
11688 2009-03-24  Ian Lance Taylor  <iant@google.com>
11689
11690         * yyscript.y (file_cmd): Recognize EXTERN.
11691         (extern_name_list, extern_name_list_body): New nonterminals.
11692         * script.cc (script_add_extern): Define.
11693         * script-c.h (script_add_extern): Declare.
11694
11695 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11696
11697         * object.cc (is_elf_object): Define.
11698         * object.h (is_elf_object): Declare.
11699         * archive.cc (Archive::get_elf_object_for_member): Call
11700         is_elf_object.
11701         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11702
11703 2009-03-24  Elliott Hughes  <enh@google.com>
11704
11705         * output.cc (Output_file::map_anonymous): Define.
11706         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11707         try an anonymous one.  Report the size if the mmap fails.
11708         * output.h (class Output_file): Declare map_anonymous.
11709
11710 2009-03-24  Ian Lance Taylor  <iant@google.com>
11711
11712         * target-select.cc (instantiate_target): Don't acquire the lock if
11713         the instantiated_target_ field has already been set.
11714
11715 2009-03-23  Ian Lance Taylor  <iant@google.com>
11716
11717         * gold-threads.h (class Initialize_lock): Define.
11718         * gold-threads.cc (class Initialize_lock_once): Define.
11719         (initialize_lock_control): New static variable.
11720         (initialize_lock_pointer): New static variable.
11721         (initialize_lock_once): New static function.
11722         (Initialize_lock::Initialize_lock): Define.
11723         (Initialize_lock::initialize): Define.
11724         * target-select.h: Include "gold-threads.h".
11725         (class Target_selector): Add lock_ and initialize_lock_ fields.
11726         Don't define instantiate_target, just declare it.
11727         * target-select.cc (Target_selector::Target_selector): Initialize
11728         new fields.
11729         (Target_selector::instantiate_target): Define.
11730         * descriptors.h: Include "gold-threads.h".
11731         (class Descriptors): Add initialize_lock_ field.
11732         * descriptors.cc (Descriptors::Descriptors): Initialize new
11733         field.
11734         (Descriptors::open): Use initialize_lock_ field
11735         * errors.h (class Errors): Add initialize_lock_ field.
11736         * errors.cc (Errors::Errors): Initialize new field.
11737         (Errors::initialize_lock): Use initialize_lock_ field.
11738         * powerpc.cc (class Target_selector_powerpc): Remove
11739         instantiated_target_ field.  In do_recognize call
11740         instantiate_target rather than do_instantiate_target.  In
11741         do_instantiate_target just allocate a new target.
11742         * sparc.cc (class Target_selector_sparc): Likewise.
11743
11744         * freebsd.h: New file.
11745         * i386.cc: Include "freebsd.h".
11746         (Target_i386): Derive from Target_freebsd rather than
11747         Sized_target.
11748         (Target_selector_i386): Derive from Target_selector_freebsd rather
11749         than Target_selector.
11750         * x86_64.cc: Include "freebsd.h".
11751         (Target_x86_64): Derive from Target_freebsd rather than
11752         Sized_target.
11753         (Target_selector_x86_64): Derive from Target_selector_freebsd
11754         rather than Target_selector.
11755         * target.h (class Target): Add adjust_elf_header and
11756         do_adjust_elf_header.
11757         * output.cc (Output_file_header:: do_sized_write): Call target
11758         adjust_elf_header routine.
11759         * configure.tgt: Set targ_osabi.
11760         * configure.ac: Define GOLD_DEFAULT_OSABI.
11761         * parameters.cc (Parameters::default_target): Pass
11762         GOLD_DEFAULT_OSABI to select_target.
11763         * target-select.h (class Target_selector): Make instantiate_target
11764         protected rather than private.
11765         * Makefile.am (HFILES): Add freebsd.h.
11766         * configure, Makefile.in, config.in: Rebuild.
11767
11768         * merge.cc (do_add_input_section): Correct pend value.  Change
11769         message about last entry not being null terminated from error to
11770         warning.
11771
11772 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11773
11774         * incremental.cc: New file.
11775         * Makefile.am (CCFILES): Add incremental.cc.
11776         * Makefile.in: Rebuild.
11777
11778 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11779
11780         * layout.cc (Layout::output_section_name): Preserve names
11781         of '.note.' sections.
11782
11783 2009-03-19  Ian Lance Taylor  <iant@google.com>
11784
11785         * descriptors.cc (Descriptors::open): Check that the options are
11786         valid before using them.
11787
11788 2009-03-18  Ian Lance Taylor  <iant@google.com>
11789
11790         * script-sections.h: Include <list>.
11791         (class Script_sections): Change Sections_elements from std::vector
11792         to std::list.  Typedef public Elements_iterator.  Add
11793         orphan_section_placement_, data_segment_align_start_, and
11794         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11795         field.
11796         * script-sections.cc (class Orphan_section_placement): New class.
11797         (class Sections_element): Add virtual functions is_relro and
11798         orphan_section_init.  Remove virtual function place_orphan_here.
11799         (class Output_section_definition): Add is_relro and
11800         orphan_section_init.  Remove place_orphan_here.
11801         (class Orphan_output_section): Likewise.
11802         (Script_sections::Script_sections): Update for field changes.
11803         (Script_sections::data_segment_align): Set saw_data_segment_align_
11804         and data_segment_align_start_, not data_segment_align_index.
11805         (Script_sections::data_segment_relro_end): Check
11806         saw_data_segment_align_.  Use data_segment_align_start_ rather
11807         than data_segment_align_index_.
11808         (Script_sections::place_orphan): Rewrite to use
11809         Orphan_section_placement.
11810
11811 2009-03-17  Ian Lance Taylor  <iant@google.com>
11812
11813         * archive.cc (Archive::add_symbols): Check for a version attached
11814         to the symbol name in the archive map.
11815         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11816         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11817         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11818         (ver_test_11.a): New target.
11819         * testsuite/Makefile.in: Rebuild.
11820
11821         * configure.ac: Check for chsize and posix_fallocate.  Replace
11822         ftruncate.
11823         * ftruncate.c: New file, from gnulib.
11824         * output.cc (posix_fallocate): Define dummy version if not
11825         HAVE_POSIX_FALLOCATE.
11826         (Output_file::map): Call posix_fallocate rather than lseek and
11827         write.
11828         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11829         * configure, Makefile.in, config.in: Rebuild.
11830
11831 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11832
11833         * layout.h (Layout::create_note): Add section_name parameter.
11834         * layout.cc (Layout::create_note): Likewise.
11835         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11836
11837 2009-03-17  Ian Lance Taylor  <iant@google.com>
11838
11839         * descriptors.cc: Include "options.h".
11840         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11841         (Descriptors::open): Always use O_CLOEXEC when opening a new
11842         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11843         then set FD_CLOEXEC.
11844
11845         * sparc.cc (class Target_sparc): Add has_got_section.
11846         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11847         make sure we have a GOT section.
11848
11849         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11850         (Target_sparc::Scan::local): Likewise.
11851         (Target_sparc::Scan::global): Likewise.
11852         (Target_sparc::Relocate::relocate): Likewise.
11853         (Target_sparc::Relocate::relocate_tls): Likewise.
11854
11855         * symtab.cc (Symbol_table::define_default_version): New function,
11856         broken out of add_from_object.
11857         (Symbol_table::add_from_object): Call define_default_version.
11858         (Symbol_table::define_special_symbol): Add resolve_oldsym
11859         parameter.  Change all callers.  If the version for a symbol comes
11860         from a version script, resolve it with the symbol with the same
11861         name with no version.  Also add the symbol without a version if
11862         appropriate.
11863         (do_define_in_output_data): If resolving with oldsym, don't delete
11864         sym.
11865         (do_define_in_output_segment): Likewise.
11866         (do_define_as_constant): Likewise.
11867         * symtab.h (class Symbol_table): Update declarations.
11868
11869 2009-03-13  Ian Lance Taylor  <iant@google.com>
11870
11871         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11872         (Read_symbols::requeue): New function.
11873         (Read_symbols::do_read_symbols): If make_elf_object fails because
11874         the target type is not configured, and the file was searched for,
11875         issue a warning and retry with the next directory.
11876         (Add_symbols::run): If the file has an incompatible format, and
11877         it was searched for, requeue the Read_symbols task.  On error,
11878         release the object.
11879         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11880         dirindex parameter to constructor.  Change all callers.  Declare
11881         incompatible_warning and requeue.
11882         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11883         input_argument_ and input_group_ fields.  Add them to
11884         constructor.  Change all callers.
11885         (class Read_script): Add dirindex_ field.  Add it to constructor.
11886         Change all callers.
11887         * archive.cc (Archive::setup): Remove input_objects parameter.
11888         Change all callers.
11889         (Archive::get_file_and_offset): Likewise.
11890         (Archive::read_all_symbols): Likewise.
11891         (Archive::read_symbols): Likewise.
11892         (Archive::get_elf_object_for_member): Remove input_objects
11893         parameter.  Add punconfigured parameter.  Change all callers.
11894         (Archive::add_symbols): Change return type to bool.  Check return
11895         value of include_member.
11896         (Archive::include_all_members): Likewise.
11897         (Archive::include_member): Change return type to bool.  Return
11898         false if first included object has incompatible target.  Set
11899         included_member_ field.
11900         (Add_archive_symbols::run): If add_symbols returns false, requeue
11901         Read_symbols task.
11902         * archive.h (class Archive): Add included_member_ field.
11903         Initialize it in constructor.  Add input_file and searched_for
11904         methods.  Update declarations.
11905         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11906         input_argument_ fields.  Add them to constructor.  Change all
11907         callers.
11908         * script.cc: Include "target-select.h".
11909         (class Parser_closure): Add skip_on_incompatible_target_ and
11910         found_incompatible_target_ fields.  Add
11911         skip_on_incompatible_target parameter to constructor.  Change all
11912         callers.  Add methods skip_on_incompatible_target,
11913         clear_skip_on_incompatible_target, found_incompatible_target, and
11914         set_found_incompatible_target.
11915         (read_input_script): Add dirindex parameter.  Change all callers.
11916         If parser finds an incompatible target, requeue Read_symbols
11917         task.
11918         (script_set_symbol): Clear skip_on_incompatible_target in
11919         closure.
11920         (script_add_assertion, script_parse_option): Likewise.
11921         (script_start_sections, script_add_phdr): Likewise.
11922         (script_check_output_format): New function.
11923         * script.h (read_input_script): Update declaration.
11924         * script-c.h (script_check_output_format): Declare.
11925         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11926         (ignore_cmd): Remove OUTPUT_FORMAT.
11927         * fileread.cc (Input_file::Input_file): Add explicit this.
11928         (Input_file::will_search_for): New function.
11929         (Input_file::open): Add pindex parameter.  Change all callers.
11930         * fileread.h (class Input_file): Add input_file_argument method.
11931         Declare will_search_for.  Update declarations.
11932         * object.cc (make_elf_object): Add punconfigured parameter.
11933         Change all callers.
11934         * object.h (class Object): Make input_file public.  Add
11935         searched_for method.
11936         (make_elf_object): Update declaration.
11937         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11938         restart search.
11939         * dirsearch.h (class Dirsearch): Update declaration.
11940         * options.h (class General_options): Add --warn-search-mismatch.
11941         * parameters.cc (Parameters::is_compatible_target): New function.
11942         * parameters.h (class Parameters): Declare is_compatible_target.
11943         * workqueue.cc (Workqueue::add_blocker): New function.
11944         * workqueue.h (class Workqueue): Declare add_blocker.
11945
11946         * fileread.cc (Input_file::open): Remove options parameter.
11947         Change all callers.
11948         (Input_file::open_binary): Likewise.
11949         * script.cc (read_input_script): Likewise.
11950         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11951         options parameter from constructor.  Change all callers.
11952         (class Read_script): Likewise.
11953         * fileread.h (class Input_file): Update declarations.
11954         * script.h (read_input_script): Update declaration.
11955
11956 2009-03-10  Nick Clifton  <nickc@redhat.com>
11957
11958         * po/es.po: New Spanish translation.
11959
11960 2009-03-06  Cary Coutant  <ccoutant@google.com>
11961
11962         * options.cc (parse_short_option): Keep dash_z from registering itself.
11963
11964 2009-03-03  Ian Lance Taylor  <iant@google.com>
11965
11966         PR 9918
11967         * target-reloc.h (relocate_section): Pass output_section to
11968         relocate.
11969         * i386.cc (Target_i386::should_apply_static_reloc): Add
11970         output_section parameter.  Change all callers.
11971         (Target_i386::Relocate::relocate): Add output_section parameter.
11972         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11973         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11974         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11975         * testsuite/two_file_shared.sh: New script.
11976         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11977         (check_DATA): Add two_file_shared.dbg.
11978         (two_file_shared.dbg): New target.
11979         * testsuite/Makefile.in: Rebuild.
11980
11981 2009-03-01  Ian Lance Taylor  <iant@google.com>
11982
11983         * configure.ac: Check for byteswap.h.
11984         * configure: Rebuild.
11985         * config.in: Rebuild.
11986
11987 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11988
11989         * layout.cc (Layout::find_or_add_kept_section): New function.
11990         (Layout::add_comdat): Removed.
11991         * layout.h (struct Kept_section): Move out of class Layout.
11992         Remove trailing underscores from field names.  Add group_sections
11993         field.  Rename group_ field to is_group.  Change all uses.
11994         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11995         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11996         comdat_groups_ field.
11997         (Sized_relobj::include_section_group): Use
11998         find_or_add_kept_section and Kept_section::group_sections.
11999         (Sized_relobj::include_linkonce_section): Likewise.
12000         * object.cc (class Sized_relobj): Don't define Comdat_group or
12001         Comdat_group_table.  Remove find_comdat_group and
12002         add_comdat_group.  Remove comdat_groups_ field.
12003         * plugin.cc (include_comdat_group): Use
12004         Layout::find_or_add_kept_section.
12005
12006 2009-02-28  Ian Lance Taylor  <iant@google.com>
12007
12008         * README: --gc-sections and map files are now supported.  Document
12009         some build requirements.
12010
12011         PR 6992
12012         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12013         relocatable link set the value of the section symbol to zero.
12014         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12015         relocatable link don't include the section address in the local
12016         symbol value.
12017
12018 2009-02-27  Ian Lance Taylor  <iant@google.com>
12019
12020         PR 6811
12021         * options.h (class Search_directory): Add is_system_directory.
12022         (class General_options): Declare is_in_system_directory.
12023         * options.cc (get_relative_sysroot): Make static.
12024         (get_default_sysroot): Make static.
12025         (General_optoins::is_in_system_directory): New function.
12026         * fileread.cc (Input_file::is_in_system_directory): New function.
12027         * fileread.h (class Input_file): Declare is_in_system_directory.
12028         * object.h (class Object): Add is_in_system_directory.
12029         (class Input_objects): Remove system_library_directory_ field.
12030         * object.cc (Input_objects::add_object): Don't set
12031         system_library_directory_.
12032         (input_objects::found_in_system_library_directory): Remove.
12033         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12034         parameter.  Change all callers.
12035         (Symbol_table::sized_write_globals): Likewise.
12036         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12037         Call Object::is_in_system_directory.
12038         * symtab.h (class Symbol_table): Update declarations.
12039
12040         PR 5990
12041         * descriptors.h (Open_descriptor): Add is_on_stack field.
12042         * descriptors.cc (Descriptors::open): If the descriptor is on the
12043         top of the stack, remove it.  Initialize is_on_stack field.
12044         (Descriptors::release): Only add pod to stack if it is not on the
12045         stack already.
12046         (Descriptors::close_some_descriptor): Clear stack_next and
12047         is_on_stack fields.
12048
12049         PR 7091
12050         * output.cc (Output_section::find_starting_output_address): Rename
12051         from starting_output_address; add PADDR parameter; change return
12052         type.
12053         * output.h (class Output_section): Declare
12054         find_starting_output_address instead of starting_output_address.
12055         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12056         section symbol for which we can't find a merge section.
12057
12058         PR 9836
12059         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12060         hidden or internal, force the symbol to be local.
12061         * resolve.cc (Symbol::override_visibility): Define.
12062         (Symbol::override_base): Use override_visibility.
12063         (Symbol_table::resolve): Likewise.
12064         (Symbol::override_base_with_special): Likewise.
12065         (Symbol_table::override_with_special): If the visibility is hidden
12066         or internal, force the symbol to be local.
12067         * symtab.h (class Symbol): Add set_visibility and
12068         override_visibility.
12069         * testsuite/ver_test_1.sh: New file.
12070         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12071         (check_DATA): Add ver_test_1.syms.
12072         (ver_test_1.syms): New target.
12073         * testsuite/Makefile.in: Rebuild.
12074
12075 2009-02-25  Cary Coutant  <ccoutant@google.com>
12076
12077         * layout.cc (Layout::choose_output_section): Don't rename sections
12078         when using a linker script that has a SECTIONS clause.
12079         * Makefile.in: Regenerate.
12080
12081         * testsuite/Makefile.am (script_test_5.sh): New test case.
12082         * testsuite/Makefile.in: Regenerate.
12083         * testsuite/script_test_5.cc: New file.
12084         * testsuite/script_test_5.sh: New file.
12085         * testsuite/script_test_5.t: New file.
12086
12087 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12088
12089         * archive.cc (Archive::include_member): Update calls to add_symbols.
12090         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12091         the Layout argument.
12092         * dynobj.h (do_add_symbols): Add the Layout argument.
12093         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12094         Layout argument.
12095         * object.h (Object::add_symbols): Add the Layout argument.
12096         (Object::do_add_symbols): Add the Layout argument.
12097         (Sized_relobj::do_add_symbols): Add the Layout argument.
12098         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12099         Unify the two versions.
12100         (Add_plugin_symbols): Remove.
12101         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12102         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12103         (Add_plugin_symbols): Remove.
12104         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12105         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12106         (Add_symbols::run): Make it work with Pulginobj.
12107
12108 2009-02-06  Ian Lance Taylor  <iant@google.com>
12109
12110         * object.cc (Sized_relobj::do_layout): Make info message start
12111         with lower case letter.
12112
12113 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12114
12115         * binary.cc: Fix file comment.
12116
12117         * options.h (enum Incremental_disposition): Define.
12118         (class General_options): Add new options: --incremental,
12119         --incremental_changed, --incremental_unchanged,
12120         --incremental_unknown.  Add incremental_disposition_ and
12121         implicit_incremental_ fields.
12122         (General_options::incremental_disposition): New function.
12123         (class Position_dependent_options): Add incremental_disposition
12124         option.
12125         (Position_dependent_options::copy_from_options): Set incremental
12126         dispositions.
12127         * options.cc (General_options::parse_incremental_changed): New
12128         function.
12129         (General_options::parse_incremental_unchanged): New function.
12130         (General_options::parse_incremental_unknown): New function.
12131         (General_options::General_options): Initialize new fields
12132         incremental_disposition_ and implicit_incremental_.
12133         (General_options::finalize): Check for uasge of --incremental-*
12134         without --incremental.
12135
12136 2009-02-06  Chris Demetriou  <cgd@google.com>
12137
12138         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12139         pointer and to report location as the file name associated with
12140         the symbol.
12141         (gold_undefined_symbol_at_location): New function to replace the
12142         old gold_undefined_symbol functionality.
12143         * target-reloc.h (relocate_section): Update to use
12144         gold_undefined_symbol_at_location.
12145         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12146         Call gold_undefined_symbol function rather than gold_error.
12147         * errors.h (Errors::undefined_symbol): Take location as a
12148         string, rather than calculating it from a relocation.
12149         * errors.cc (Errors::fatal): Print "fatal error:" before the
12150         formatted message.
12151         (Errors::error, Errors::error_at_location): Print "error: "
12152         before the formatted message.
12153         (Errors::undefined_symbol): Take location as a string, rather
12154         than calculating it from a relocation.
12155         (gold_undefined_symbol_at_location): New function akin to
12156         old gold_undefined_symbol, calculates location from relocation.
12157         (gold_undefined_symbol): Change to take only a Symbol pointer
12158         and to report location as the file name associated with the symbol.
12159         * testsuite/debug_msg.sh: Update for changed error messages.
12160         * testsuite/undef_symbol.sh: Likewise.
12161
12162 2009-02-04  Duncan Sands  <baldrick@free.fr>
12163
12164         PR 9812
12165         * reduced_debug_output.h
12166         (Output_reduced_debug_abbrev_section::failed): Use format for
12167         gold_warning.
12168         (Output_reduced_debug_info_section::faild): Likewise.
12169
12170 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12171
12172         * script.cc (Lazy_demangler): New class.
12173         (Version_script_info::get_symbol_version_helper): Demangle a
12174         symbol only once.
12175
12176 2009-01-29  Cary Coutant  <ccoutant@google.com>
12177
12178         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12179         to __tls_get_addr.
12180         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12181
12182 2009-01-28  Ian Lance Taylor  <iant@google.com>
12183
12184         * version.cc (version_string): Bump to 1.9.
12185
12186         * gold.h: Include <cstring> and <stdint.h>.
12187         * version.cc: Include <cstdio>.
12188         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12189         warning.
12190         * reduced_debug_output.cc (insert_into_vector): Rename from
12191         Insert_into_vector; change all callers.  Use Swap_unaligned to
12192         avoid aliasing issue; remove union since it is unnecessary.
12193
12194 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12195
12196         * Makefile.am (CCFILES): Add gc.cc.
12197         (HFILES): Add gc.h.
12198         * Makefile.in: Regenerate.
12199         * gold.cc (Gc_runner): New class.
12200         (queue_initial_tasks): Call garbage collection related tasks
12201         when corresponding options are invoked.
12202         (queue_middle_gc_tasks): New function.
12203         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12204         processed early before laying out sections during garbage collection.
12205         * gold.h (queue_middle_gc_tasks): New function.
12206         (is_prefix_of): Move from "layout.cc".
12207         * i386.cc (Target_i386::gc_process_relocs): New function.
12208         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12209         * main.cc (main): Create object of class "Garbage_collection".
12210         * object.cc (Relobj::copy_symbols_data): New function.
12211         (Relobj::is_section_name_included): New function.
12212         (Sized_relobj::do_layout): Allow this function to be called twice
12213         during garbage collection and defer layout of section during the
12214         first call.
12215         * object.h (Relobj::get_symbols_data): New function.
12216         (Relobj::is_section_name_included): New function.
12217         (Relobj::copy_symbols_data): New function.
12218         (Relobj::set_symbols_data): New function.
12219         (Relobj::get_relocs_data): New function.
12220         (Relobj::set_relocs_data): New function.
12221         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12222         (Relobj::gc_process_relocs): New function.
12223         (Relobj::do_gc_process_relocs): New pure virtual function.
12224         (Relobj::sd_): New data member.
12225         (Sized_relobj::is_output_section_offset_invalid): New function.
12226         (Sized_relobj::do_gc_process_relocs): New function.
12227         * options.h (General_options::gc_sections): Modify to not be a no-op.
12228         (General_options::print_gc_sections): New option.
12229         * plugin.cc (Plugin_finish::run): Remove function call to
12230         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12231         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12232         * reloc.cc (Read_relocs::run): Add task to process relocs and
12233         determine unreferenced sections when doing garbage collection.
12234         (Gc_process_relocs): New class.
12235         (Sized_relobj::do_gc_process_relocs): New function.
12236         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12237         sections that are garbage collected.
12238         * reloc.h (Gc_process_relocs): New class.
12239         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12240         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12241         symbols whose corresponding sections are garbage collected.
12242         (Symbol_table::Symbol_table): Add new parameter for the garbage
12243         collection object.
12244         (Symbol_table::gc_mark_undef_symbols): New function.
12245         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12246         (Symbol_table::gc_mark_dyn_syms): New function.
12247         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12248         as garbage.
12249         (Symbol_table::add_from_object): Likewise.
12250         (Symbol_table::add_from_relobj): When building shared objects, do not
12251         treat externally visible symbols as garbage.
12252         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12253         table information for static and relocatable links.
12254         * symtab.h (Symbol_table::set_gc): New function.
12255         (Symbol_table::gc): New function.
12256         (Symbol_table::gc_mark_undef_symbols): New function.
12257         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12258         (Symbol_table::gc_mark_dyn_syms): New function.
12259         (Symbol_table::gc_): New data member.
12260         * target.h (Sized_target::gc_process_relocs): New pure virtual
12261         function.
12262         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12263         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12264
12265 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12266
12267         * options.h (General_options::gc_sections): Define as a no-op for now.
12268         (General_options::no_keep_memory): Ditto.
12269         (General_options::Bshareable): Define.
12270         * options.cc (General_options::finalize): Honor -Bshareable.
12271
12272 2009-01-20  Andreas Schwab  <schwab@suse.de>
12273
12274         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12275         read the value in the contents, since we don't use it.  Use the
12276         template endianness when writing.
12277         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12278
12279 2009-01-19  Andreas Schwab  <schwab@suse.de>
12280
12281         * configure.tgt (powerpc64-*): Fix targ_obj.
12282
12283 2009-01-15  Ian Lance Taylor  <iant@google.com>
12284
12285         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12286         local symbols when stripping all symbols.
12287
12288 2009-01-14  Cary Coutant  <ccoutant@google.com>
12289
12290         * output.cc (Output_reloc): Add explicit instantiations.
12291
12292 2009-01-14  Cary Coutant  <ccoutant@google.com>
12293
12294         * archive.cc (Archive::get_elf_object_for_member): Remove call
12295         to File_read::claim_for_plugin.
12296         * descriptors.cc (Descriptors::open): Remove reference to
12297         is_claimed.
12298         (Descriptors::claim_for_plugin): Remove.
12299         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12300         (Descriptors::is_claimed): Remove.
12301         (claim_descriptor_for_plugin): Remove.
12302         * fileread.cc (File_read::claim_for_plugin): Remove.
12303         * fileread.h (File_read::claim_for_plugin): Remove.
12304         (File_read::descriptor): Reopen descriptor if necessary.
12305         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12306         (Plugin_manager::all_symbols_read): Add task parameter. Change
12307         all callers.
12308         (Plugin_manager::get_input_file): New function.
12309         (Plugin_manager::release_input_file): New function.
12310         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12311         corresponding data member.
12312         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12313         and pass to base constructor. Change all callers.
12314         (get_input_file, release_input_file): New functions.
12315         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12316         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12317         (Plugin_manager::all_symbols_read): Add task parameter.
12318         (Plugin_manager::get_input_file): New function.
12319         (Plugin_manager::release_input_file): New function.
12320         (Plugin_manager::task_): New data member.
12321         (Pluginobj::Pluginobj): Add filesize parameter.
12322         (Pluginobj::filename): New function.
12323         (Pluginobj::descriptor): New function.
12324         (Pluginobj::filesize): New function.
12325         (Pluginobj::filesize_): New data member.
12326         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12327         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12328         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12329
12330         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12331         with archive libraries.
12332         * testsuite/Makefile.in: Regenerate.
12333         * testsuite/plugin_test.c (struct sym_info): New type.
12334         (get_input_file, release_input_file): New static variables.
12335         (onload): Capture new transfer vector entries.
12336         (claim_file_hook): Stop reading at end of file according to filesize.
12337         Factor out parsing of readelf output into separate function.
12338         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12339         APIs and get the source file name from the symbol table.  Convert
12340         source file name to corresponding object file name.  Print info
12341         message when adding new input files.
12342         (parse_readelf_line): New function.
12343         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12344         * testsuite/plugin_test_2.sh: Likewise.
12345         * testsuite/plugin_test_3.sh: Likewise.
12346         * testsuite/plugin_test_4.sh: New test case.
12347
12348 2009-01-07  Ian Lance Taylor  <iant@google.com>
12349
12350         * version.cc (version_string): Bump to 1.8.
12351
12352 2008-12-23  Cary Coutant  <ccoutant@google.com>
12353
12354         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12355         * plugin.cc (Plugin_manager::finish): Rename as
12356         layout_deferred_objects.  Move cleanup to separate function.
12357         (Plugin_manager::cleanup): New function.
12358         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12359         separately.
12360         * plugin.h (Plugin_manager::finish): Rename as
12361         layout_deferred_objects.
12362         (Plugin_manager::cleanup): New function.
12363         (Plugin_manager::cleanup_done): New field.
12364
12365 2008-12-23  Cary Coutant  <ccoutant@google.com>
12366
12367         * plugin.cc (is_visible_from_outside): New function.
12368         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12369         so we don't return "IR only" status for exported symbols or -r links.
12370
12371         * testsuite/Makefile.am (plugin_test_3): New test case.
12372         * testsuite/Makefile.in: Regenerate.
12373         * testsuite/plugin_test_3.sh: New file.
12374
12375 2008-12-22  Cary Coutant  <ccoutant@google.com>
12376
12377         * object.cc (Sized_relobj::layout_section): New function.
12378         (Sized_relobj::do_layout): Defer layout of input sections until after
12379         plugin has provided replacement files.
12380         (Sized_relobj::do_layout_deferred_sections): New function.
12381         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12382         (Relobj::layout_deferred_sections): New function.
12383         (Relobj::do_layout_deferred_sections): New function.
12384         (Sized_relobj::do_layout_deferred_sections): New function.
12385         (Sized_relobj::layout_section): New function.
12386         (Sized_relobj::Deferred_layout): New structure.
12387         (Sized_relobj::deferred_layout_): New field.
12388         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12389         Change all callers.  Layout deferred sections.
12390         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12391         references.
12392         (Plugin_hook::run): Move code from do_plugin_hook inline.
12393         (Plugin_hook::do_plugin_hook): Remove.
12394         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12395         (Plugin_manager::finish): Renamed, was cleanup.
12396         (Plugin_manager::should_defer_layout): New function.
12397         (Plugin_manager::add_deferred_layout_object): New function.
12398         (Plugin_manager::Deferred_layout_list): New type.
12399         (Plugin_manager::deferred_layout_objects_): New field.
12400         (Plugin_hook::do_plugin_hook): Remove.
12401
12402 2008-12-17  Ian Lance Taylor  <iant@google.com>
12403
12404         * options.h (class General_options): Add --no case for
12405         --export-dynamic.
12406
12407 2008-12-16  Cary Coutant  <ccoutant@google.com>
12408
12409         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12410         vector.
12411         (Plugin_manager::claim_file): Create plugin object even if
12412         plugin did not call the add_symbols callback.
12413         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12414         asking for more symbols than were added.
12415         * testsuite/Makefile.am (plugin_test_1): Add test case with
12416         no global symbols.
12417         (empty.syms): New target.
12418         * testsuite/Makefile.in: Regenerate.
12419         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12420         message. Don't call add_symbols if no globals.
12421         (all_symbols_read_hook): Don't provide replacement for empty
12422         claimed file.
12423
12424 2008-12-12  Ian Lance Taylor  <iant@google.com>
12425
12426         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12427         r_type == 0 for a local symbol with r_sym == 0.
12428         (scan_relocatable_relocs): Pass r_sym to
12429         local_non_section_strategy.
12430         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12431         r_sym parameter.
12432
12433         * configure.ac: Update test for TLS descriptors: they are
12434         supported as of glibc 2.9.
12435         * configure: Rebuild.
12436
12437 2008-12-11  Ian Lance Taylor  <iant@google.com>
12438
12439         PR 7091
12440         * target-reloc.h (Default_scan_relocatable_relocs): For each
12441         function, map r_type == 0 to RELOC_DISCARD.
12442
12443 2008-12-10  Cary Coutant  <ccoutant@google.com>
12444
12445         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12446         object to override a kept COMDAT group from a plugin object.
12447
12448 2008-12-09  Ian Lance Taylor  <iant@google.com>
12449
12450         PR 7088
12451         * yyscript.y (file_cmd): Handle INPUT.
12452
12453         * testsuite/initpri1.c: Change all declarations to be full
12454         prototypes by adding void, to avoid compiler warnings.
12455
12456 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12457
12458         * options.cc (General_options::parse_plugin_opt): New.
12459         (General_options::add_plugin): The argument now is just the filename.
12460         (General_options::add_plugin_option): New.
12461         * options.h (plugin_opt): New.
12462         (add_plugin): Change argument name.
12463         (add_plugin_option): New.
12464         * plugin.cc (Plugin::load): Don't parse the plugin option.
12465         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12466         (Plugin::add_option): New.
12467         (Plugin::args_): Change type.
12468         (Plugin::filename_): New.
12469         (Plugin_manager::add_plugin_option): New.
12470         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12471         * testsuite/Makefile.in: Regenerate.
12472
12473 2008-12-05  Cary Coutant  <ccoutant@google.com>
12474
12475         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12476         Handle --strip-lto-sections option.
12477         * options.h (strip_lto_sections): New option.
12478
12479 2008-12-01  Cary Coutant  <ccoutant@google.com>
12480
12481         * plugin.cc (ld_plugin_message): Change format parameter to const.
12482         Fix mismatch between new[] and delete.
12483
12484 2008-11-14  Cary Coutant  <ccoutant@google.com>
12485
12486         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12487         instead of -1U.
12488
12489 2008-11-05  Craig Silverstein  <csilvers@google.com>
12490
12491         * options.cc (General_options::parse_dynamic_list): New function.
12492         * options.h (General_options): New flags dynamic_list,
12493         dynamic_list_data, dynamic_list_cpp_new, and
12494         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12495         (General_options::in_dynamic_list): New function.
12496         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12497         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12498         (Lex::can_continue_name): Likewise.
12499         (yylex): Likewise.
12500         (read_script_file): New parameter script_options.
12501         (read_dynamic_list): New function.
12502         (Script_options::define_dynamic_list): New function.
12503         (dynamic_list_keyword_parsecodes): New variable.
12504         (dynamic_list_keywords): New variable.
12505         * script.h (Script_options::define_dynamic_list): New function
12506         prototype.
12507         (read_dynamic_list): New function prototype.
12508         * symtab.cc (strprefix): New macro.
12509         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12510         dynamic_list_data, dynamic_list_cpp_new, and
12511         dynamic_list_cpp_typeinfo.
12512         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12513         (dynamic_list_expr): New rule.
12514         (dynamic_list_nodes): Likewise.
12515         (dynamic_list_node): Likewise.
12516         * testsuite/Makefile.am (dynamic_list): New test.
12517         * testsuite/Makefile.in: Regenerated.
12518         * testsuite/dynamic_list.t: New file.
12519         * testsuite/dynamic_list.sh: New file.
12520
12521 2008-11-05  Craig Silverstein  <csilvers@google.com>
12522
12523         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12524         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12525         (t11_last): Likewise.
12526         * testsuite/ver_test_6.c (main): Likewise.
12527
12528 2008-10-07  Cary Coutant  <ccoutant@google.com>
12529
12530         * options.c (General_options::finalize): Add check for -static and
12531         -shared.
12532         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12533         is not empty.
12534
12535 2008-10-02  Cary Coutant  <ccoutant@google.com>
12536
12537         * plugin.cc (make_sized_plugin_object): Fix conditional
12538         compilation to work when not all targets are enabled.
12539
12540 2008-09-29  Cary Coutant  <ccoutant@google.com>
12541
12542         * archive.cc (Archive::get_file_and_offset): Use filename instead
12543         of name to get library path.
12544         (Archive::include_member): Unlock external member of a thin archive.
12545
12546         * testsuite/Makefile.am (TEST_AR): New variable.
12547         (thin_archive_test_1): New test.
12548         (thin_archive_test_2): New test.
12549         * testsuite/Makefile.in: Regenerate.
12550         * testsuite/thin_archive_main.cc: New file.
12551         * testsuite/thin_archive_test_1.cc: New file.
12552         * testsuite/thin_archive_test_2.cc: New file.
12553         * testsuite/thin_archive_test_3.cc: New file.
12554         * testsuite/thin_archive_test_4.cc: New file.
12555
12556 2008-09-29  Cary Coutant  <ccoutant@google.com>
12557
12558         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12559         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12560         instead of -1U.
12561         (Sized_relobj::do_finalize_local_symbols): Likewise.
12562         (Sized_relobj::map_to_kept_section): Likewise.
12563         * object.h (Sized_relobj::invalid_address): New constant.
12564         (Sized_relobj::do_output_section_offset): Check for invalid_address
12565         and return -1ULL.
12566         * output.cc (Output_reloc::local_section_offset): Use constant
12567         invalid_address instead of -1U.
12568         (Output_reloc::get_address): Likewise.
12569         (Output_section::output_address): Change -1U to -1ULL.
12570         * output.h (Output_reloc::invalid_address): New constant.
12571         * reloc.cc (Sized_relobj::write_sections): Use constant
12572         invalid_address instead of -1U.
12573         (Sized_relobj::relocate_sections): Likewise.
12574         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12575         values for merge sections.
12576         * target-reloc.h (relocate_for_relocatable): Use constant
12577         invalid_address instead of -1U.
12578
12579 2008-09-19  Cary Coutant  <ccoutant@google.com>
12580
12581         Add plugin functionality for link-time optimization (LTO).
12582         * configure.ac (plugins): Add --enable-plugins option.
12583         * configure: Regenerate.
12584         * config.in: Regenerate.
12585         * Makefile.am (LIBDL): New variable.
12586         (CCFILES): Add plugin.cc.
12587         (HFILES): Add plugin.h.
12588         (ldadd_var): Add LIBDL.
12589         * Makefile.in: Regenerate.
12590
12591         * archive.cc: Include "plugin.h".
12592         (Archive::setup): Don't preread archive symbols when using a plugin.
12593         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12594         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12595         files.
12596         (Archive::include_member): Add symbols from plugin objects.
12597         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12598         * descriptors.cc (Descriptors::open): Check for file descriptors
12599         abandoned by plugins.
12600         (Descriptors::claim_for_plugin): New function.
12601         * descriptors.h (Descriptors::claim_for_plugin): New function.
12602         (Open_descriptor::is_claimed): New field.
12603         (claim_descriptor_for_plugin): New function.
12604         * fileread.cc (File_read::claim_for_plugin): New function.
12605         * fileread.h (File_read::claim_for_plugin): New function.
12606         (File_read::descriptor): New function.
12607         * gold.cc: Include "plugin.h".
12608         (queue_initial_tasks): Add task to call plugin hooks for generating
12609         new object files.
12610         * main.cc: Include "plugin.h".
12611         (main): Load plugin libraries.
12612         * object.h (Pluginobj): Declare.
12613         (Object::pluginobj): New function.
12614         (Object::do_pluginobj): New function.
12615         (Object::set_target): New function.
12616         * options.cc: Include "plugin.h".
12617         (General_options::parse_plugin): New function.
12618         (General_options::General_options): Initialize plugins_ field.
12619         (General_options::add_plugin): New function.
12620         * options.h (Plugin_manager): Declare.
12621         (General_options): Add --plugin option.
12622         (General_options::has_plugins): New function.
12623         (General_options::plugins): New function.
12624         (General_options::add_plugin): New function.
12625         (General_options::plugins_): New field.
12626         * plugin.cc: New file.
12627         * plugin.h: New file.
12628         * readsyms.cc: Include "plugin.h".
12629         (Read_symbols::do_read_symbols): Check for archive before checking
12630         for ELF file.  Call plugin hooks to claim files.
12631         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12632         from a real object file; force override when processing replacement
12633         files.
12634         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12635         (Symbol::init_base_object): Likewise.
12636         (Symbol::init_base_output_data): Likewise.
12637         (Symbol::init_base_output_segment): Likewise.
12638         (Symbol::init_base_constant): Likewise.
12639         (Symbol::init_base_undefined): Likewise.
12640         (Symbol::output_section): Assert that object is not a plugin.
12641         (Symbol_table::add_from_pluginobj): New function.
12642         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12643         undefined.
12644         (Symbol_table::sized_write_globals): Likewise.
12645         (Symbol_table::add_from_pluginobj): Instantiate template.
12646         * symtab.h (Sized_pluginobj): Declare.
12647         (Symbol::in_real_elf): New function.
12648         (Symbol::set_in_real_elf): New function.
12649         (Symbol::in_real_elf_): New field.
12650         (Symbol_table::add_from_pluginobj): New function.
12651
12652         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12653         (LIBDL): New variable.
12654         (LDADD): Add LIBDL.
12655         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12656         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12657         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12658         (MOSTLYCLEANFILES): Likewise.
12659         * testsuite/Makefile.in: Regenerate.
12660         * testsuite/plugin_test.c: New file.
12661         * testsuite/plugin_test_1.sh: New file.
12662         * testsuite/plugin_test_2.sh: New file.
12663
12664 2008-09-16  Ian Lance Taylor  <iant@google.com>
12665
12666         * target-reloc.h (relocate_section): Check whether a symbol is
12667         defined by the ABI before reporting an undefined symbol error.
12668         * target.h (Target::is_defined_by_abi): Make parameter const.
12669         (Target::do_is_defined_by_abi): Likewise.
12670         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12671         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12672         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12673         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12674         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12675         * testsuite/Makefile.in: Rebuild.
12676
12677         * fileread.cc (make_view): Add casts to avoid warning.
12678
12679 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12680
12681         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12682         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12683
12684 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12685
12686         * options.h (General_options::output_is_executable): New.
12687         (General_options::output_is_pie): New.
12688         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12689         for shared libraries.
12690         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12691
12692 2008-09-11  Chris Demetriou  <cgd@google.com>
12693
12694         * options.h (origin): New -z option.
12695         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12696         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12697         in DT_FLAGS_1.
12698
12699 2008-09-05  Cary Coutant  <ccoutant@google.com>
12700
12701         * fileread.cc (File_read::make_view): Add check for attempt to map
12702         beyond end of file.
12703
12704 2008-09-05  Cary Coutant  <ccoutant@google.com>
12705
12706         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12707         explicit instantiations.
12708
12709 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12710
12711         PR gold/6858
12712         * options.cc (General_options::finalize): Allow undefined symbols
12713         in shlibs if linking -shared.
12714
12715         PR gold/6859
12716         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12717         symbols as not needing a dynsym entry.
12718
12719 2008-08-20  Craig Silverstein  <csilvers@google.com>
12720
12721         * fileread.cc (File_read::open): Do not lock the file unless it
12722         was successfully opened.
12723
12724 2008-08-14  Cary Coutant  <ccoutant@google.com>
12725
12726         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12727         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12728         * testsuite/tls_test.cc (struct int128): 128-bit struct
12729         for testing TLS relocs with non-zero addend.
12730         (v12): New TLS variable.
12731         (t12): New test.
12732         (t_last): Add check for v12.
12733         * testsuite/tls_test.h (t12): New function.
12734         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12735
12736 2008-08-13  Ian Lance Taylor  <iant@google.com>
12737
12738         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12739         set tls_segment_ or relro_segment_.
12740         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12741         when appropriate.
12742         * output.h (Output_section::clear_is_relro): New function.
12743         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12744         sections specially even when output_data_ is empty.
12745         (Output_segment::maximum_alignment): When first section is relro,
12746         only force alignment for PT_LOAD segments.
12747         * script.cc (script_data_segment_align): New function.
12748         (script_data_segment_relro_end): New function.
12749         * script-c.h (script_data_segment_align): Declare.
12750         (script_data_segment_relro_end): Declare.
12751         * script-sections.h (class Script_sections): Declare
12752         data_segment_align and data_segment_relro_end.  Add fields
12753         segment_align_index_ and saw_relro_end_.
12754         * script-sections.cc (class Sections_element): Add set_is_relro
12755         virtual function.  Add new bool* parameter to place_orphan_here.
12756         Add get_output_section virtual function.
12757         (class Output_section_definition): Add set_is_relro.  Add new
12758         bool* parameter to place_orphan_here.  Add get_output_section.
12759         Add is_relro_ field.
12760         (Output_section_definition::Output_section_definition): Initialize
12761         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12762         and is_relro_ fields.
12763         (Output_section_definition::place_orphan_here): Add is_relro
12764         parameter.
12765         (Output_section_definition::set_section_addresses): Set relro for
12766         output section.
12767         (Output_section_definition::alternate_constraint): Likewise.
12768         (class Orphan_output_section): Add new bool* parameter to
12769         place_orphan_here.  Add get_output_section.
12770         (Orphan_output_section::place_orphan_here): Add is_relro
12771         parameter.
12772         (Script_sections::Script_sections): Initialize
12773         data_segment_align_index_ and saw_relro_end_.
12774         (Script_sections::data_segment_align): New function.
12775         (Script_sections::data_segment_relro_end): New function.
12776         (Script_sections::place_orphan): Set or clear is_relro.
12777         (Script_sections::set_section_addresses): Force alignment of first
12778         TLS section.
12779         * yyscript.y (exp): Call script_data_segment_align and
12780         script_data_segment_relro_end.
12781         * testsuite/relro_script_test.t: New file.
12782         * testsuite/relro_test.cc (using_script): Declare.
12783         (t1, t2): Test using_script.
12784         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12785         (relro_script_test_SOURCES): Define.
12786         (relro_script_test_DEPENDENCIES): Define.
12787         (relro_script_test_LDFLAGS): Define.
12788         (relro_script_test_LDADD): Define.
12789         (relro_script_test.so): New target.
12790         * testsuite/Makefile.in: Rebuild.
12791
12792 2008-08-06  Cary Coutant <ccoutant@google.com>
12793
12794         * archive.cc (Archive::total_archives, Archive::total_members)
12795         (Archive::total_members_loaded): New variables.
12796         (Archive::setup): Add parameter.  Add option to preread
12797         archive symbols.
12798         (Archive::read_armap): Add counter.
12799         (Archive::get_file_and_offset): New function.
12800         (Archive::get_elf_object_for_member): New function.
12801         (Archive::read_all_symbols): New function.
12802         (Archive::read_symbols): New function.
12803         (Archive::add_symbols): Add counters.
12804         (Archive::include_all_members): Use armap to find members if it's
12805         already built.
12806         (Archive::include_member): Skip reading symbols if already read.
12807         Factored code into Archive::get_file_and_offset and
12808         Archive::get_elf_object_for_member.  Changed call to
12809         Mapfile::report_include_archive_member.
12810         (Archive::print_stats): New function.
12811         * archive.h: Declare Object and Read_symbols_data classes.
12812         (Archive::Archive): Add initializers for new members.
12813         (Archive::setup): Add parameter.
12814         (Archive::print_stats): New function.
12815         (Archive::total_archives, Archive::total_members)
12816         (Archive::total_members_loaded): New variables.
12817         (Archive::get_file_and_offset): New function.
12818         (Archive::get_elf_object_for_member): New function.
12819         (Archive::read_all_symbols): New function.
12820         (Archive::read_symbols): New function.
12821         (Archive::Archive_member): New class.
12822         (Archive::members_): New member.
12823         (Archive::num_members_): New member.
12824         * main.cc: Include archive.h.
12825         (main): Call Archive::print_stats.
12826         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12827         archive parameter; member_name is now the fully-decorated name.
12828         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12829         * options.h: (General_options): Add --preread-archive-symbols option.
12830         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12831         Archive::setup.
12832
12833 2008-08-04  Ian Lance Taylor  <iant@google.com>
12834
12835         * symtab.h (Symbol::use_plt_offset): New function.
12836         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12837         * powerpc.cc (Relocate::relocate): Likewise.
12838         * sparc.cc (Relocate::relocate): Likewise.
12839         * x86_64.cc (Relocate::relocate): Likewise.
12840         * testsuite/weak_plt.sh: New test.
12841         * testsuite/weak_plt_main.cc: New test.
12842         * testsuite/weak_plt_shared.cc: New test.
12843         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12844         (check_PROGRAMS): Add weak_plt.
12845         (check_DATA): Add weak_plt_shared.so.
12846         (weak_plt_main_pic.o, weak_plt): New targets.
12847         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12848         * testsuite/Makefile.in: Rebuild.
12849
12850         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12851         gcctestdir/ld.
12852         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12853         * testsuite/Makefile.in: Rebuild.
12854
12855 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12856
12857         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12858         * Makefile.in: Regenerate.
12859         * po/POTFILES.in: Regenerate.
12860
12861 2008-07-29  Ian Lance Taylor  <iant@google.com>
12862
12863         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12864         symbols before other symbols.
12865         * testsuite/script_test_2.cc (test_addr): Declare.
12866         (test_addr_alias): Declare.
12867         (main): Check that test_addr and test_addr_alias have the right
12868         values.
12869         * testsuite/script_test_2.t: Define test_addr_alias and
12870         test_addr.
12871
12872 2008-07-24  Ian Lance Taylor  <iant@google.com>
12873
12874         PR 5990
12875         * descriptors.cc: New file.
12876         * descriptors.h: New file.
12877         * gold-threads.h (class Hold_optional_lock): New class.
12878         * fileread.cc: Include "descriptors.h".
12879         (File_read::~File_read): Release descriptor rather than closing
12880         it.
12881         (File_read::open) [file]: Call open_descriptor rather than open.
12882         Set is_descriptor_opened_.
12883         (File_read::open) [memory]: Assert that descriptor is not open.
12884         (File_read::reopen_descriptor): New function.
12885         (File_read::release): Release descriptor.
12886         (File_read::do_read): Make non-const.  Reopen descriptor.
12887         (File_read::read): Make non-const.
12888         (File_read::make_view): Reopen descriptor.
12889         (File_read::do_readv): Likewise.
12890         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12891         Update declarations.
12892         * layout.cc: Include "descriptors.h".
12893         (Layout::create_build_id): Use open_descriptor rather than open.
12894         * output.cc: Include "descriptors.h".
12895         (Output_file::open): Use open_descriptor rather than open.
12896         * archive.cc (Archive::const_iterator): Change Archive to be
12897         non-const.
12898         (Archive::begin, Archive::end): Make non-const.
12899         (Archive::count_members): Likewise.
12900         * archive.h (class Archive): Update declarations.
12901         * object.h (Object::read): Make non-const.
12902         * Makefile.am (CCFILES): Add descriptors.cc.
12903         (HFILES): Add descriptors.h.
12904         * Makefile.in: Rebuild.
12905
12906         PR 6716
12907         * gold.h: Always include <clocale>.  Add Solaris workarounds
12908         following code in binutils/sysdep.h.
12909
12910         PR 6048
12911         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12912         this->eh_frame_hdr_ is NULL before using it.
12913
12914         * dynobj.cc (Versions::Versions): Update comment.
12915
12916         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12917         the base version name.
12918
12919         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12920         array size plus one.
12921         (Stringpool_template::set_string_offsets): Subtract one from key
12922         before using it as an array index.
12923         (Stringpool_template::get_offset_with_length): Likewise.
12924         (Stringpool_template::write_to_buffer): Likewise.
12925         * stringpool.h (Stringpool_template::get_offset_from_key):
12926         Likewise.
12927
12928 2008-07-23  Ian Lance Taylor  <iant@google.com>
12929
12930         PR 6658
12931         * object.h (Merged_symbol_value::value): Do our best to handle a
12932         negative addend.
12933
12934         PR 6647
12935         * script.cc (Version_script_info::get_versions): Don't add empty
12936         version tag to return value.
12937         (Version_script_info::get_symbol_version_helper): Change return
12938         type to bool.  Add pversion parameter.  Change all callers.
12939         (script_register_vers_node): Don't require a non-NULL tag.
12940         * script.h (class Version_script_info): Update declarations.
12941         (Version_script_info::get_symbol_version): Change return type to
12942         bool.  Add version parameter.  Change all callers.
12943         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12944         handling.  Handle an empty version from a version script.
12945         (Symbol_table::define_special_symbol): Likewise.
12946         * testsuite/ver_test_10.script: New file.
12947         * testsuite/ver_test_10.sh: New file.
12948         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12949         (check_DATA): Add ver_test_10.syms.
12950         (ver_test_10.syms, ver_test_10.so): New target.
12951         * testsuite/Makefile.in: Rebuild.
12952
12953 2008-07-23  Simon Baldwin  <simonb@google.com>
12954
12955         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12956         to zero for undefined symbols from dynamic libraries.
12957
12958 2008-07-23  Ian Lance Taylor  <iant@google.com>
12959
12960         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12961         Change all callers.
12962         * symtab.h (class Symbol_table): Update declaration.
12963         * testsuite/ver_test_9.cc: New file.
12964         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12965         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12966         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12967         (ver_test_9.so, ver_test_9.o): New targets.
12968         * testsuite/Makefile.in: Rebuild.
12969
12970 2008-07-22  Ian Lance Taylor  <iant@google.com>
12971
12972         * options.h (class General_options): Define --check-sections.
12973         * layout.cc (Layout::set_segment_offsets): Handle
12974         --check-sections.
12975
12976         * options.h (class General_options): Define -n/--nmagic and
12977         -N/--omagic.
12978         * options.cc (General_options::finalize): For -n/--nmagic or
12979         -N/--omagic, set -static.
12980         * layout.cc (Layout::attach_allocated_section_to_segment): If
12981         -N/--omagic, don't put read-only and read-write sections in
12982         different segments.
12983         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12984         finding a read-only segment.
12985         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12986         don't set the minimum segment alignment to the common page size,
12987         and don't set the file offset to the address modulo the page size.
12988         * script-sections.cc (Script_sections::create_segments): If
12989         -n/--omagic, don't put read-only and read-write sections in
12990         different segments.
12991
12992         * cref.cc: New file.
12993         * cref.h: New file.
12994         * options.h (class General_options): Add --print-symbol-counts.
12995         * main.cc (main): Issue defined symbol report if requested.
12996         * archive.cc (Archive::interpret_header): Make into a const member
12997         function.
12998         (Archive::add_symbols): Call Input_objects::archive_start and
12999         archive_stop.
13000         (Archive::const_iterator): Define new class.
13001         (Archive::begin, Archive::end): New functions.
13002         (Archive::include_all_members): Rewrite to use iterator.
13003         (Archive::count_members): New function.
13004         * archive.h (class Archive): Update declarations.
13005         (Archive::filename): New function.
13006         * object.cc: Include "cref.h".
13007         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13008         (Sized_relobj::do_get_global_symbol_counts): New function.
13009         (Input_objects::add_object): Add object to cross-referencer.
13010         (Input_objects::archive_start): New function.
13011         (Input_objects::archive_stop): New function.
13012         (Input_objects::print_symbol_counts): New function.
13013         * object.h: Declare Cref and Archive.
13014         (Object::get_global_symbol_counts): New function.
13015         (Object::do_get_global_symbol_counts): New pure virtual function.
13016         (class Sized_relobj): Add defined_count_ field.  Update
13017         declarations.
13018         (class Input_objects): Add cref_ field.  Update constructor.
13019         Update declarations.
13020         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13021         defined_count_.
13022         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13023         symbol counts.
13024         (Sized_dynobj::do_get_global_symbol_counts): New function.
13025         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13026         defined_count_.  Update declarations.  Define Symbols typedef.
13027         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13028         parameter.  Change all callers.
13029         (Symbol_table::add_from_dynobj): Add sympointers and defined
13030         parameters.  Change all callers.
13031         * symtab.h (class Symbol_table): Update declarations.
13032         * Makefile.am (CCFILES): Add cref.cc.
13033         (HFILES): Add cref.h.
13034         * Makefile.in: Rebuild.
13035
13036 2008-07-22  Simon Baldwin  <simonb@google.com>
13037
13038         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13039         to zero when writing undefined symbols.
13040
13041 2008-07-22  Ian Lance Taylor  <iant@google.com>
13042
13043         * output.cc (Output_section::add_input_section): Don't try to
13044         merge empty merge sections.
13045
13046 2008-07-21  Craig Silverstein  <csilvers@google.com>
13047
13048         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13049         Include symbol version in error message.
13050
13051 2008-07-20  Chris Demetriou  <cgd@google.com>
13052
13053         * configure.ac (gold_cv_c_random_seed): New configured variable.
13054         (RANDOM_SEED_CFLAGS): New substituted variable.
13055         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13056         * configure: Rebuild.
13057         * Makefile.in: Likewise.
13058         * testsuite/Makefile.in: Likewise.
13059
13060 2008-07-18  Ian Lance Taylor  <iant@google.com>
13061
13062         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13063         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13064         * testsuite/ver_test_main.cc (main): Call t4.
13065         (t4, t4_2a): Define.
13066         * testsuite/ver_test_2.cc (t4_2): Define.
13067         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13068         * testsuite/ver_test_4.cc (t4_2a): Define.
13069         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13070         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13071
13072 2008-07-17  Ian Lance Taylor  <iant@google.com>
13073
13074         * dynobj.cc (Versions::add_def): If we give an error about a
13075         missing version, go ahead and create the version anyhow.
13076
13077 2008-07-10  Ian Lance Taylor  <iant@google.com>
13078
13079         Handle output sections with more than 0x7fffffff bytes.
13080         * object.h (class Relobj): Change map_to_output_ to
13081         output_sections_, and just keep a section pointer.  Change all
13082         uses.  Move comdat group support to Sized_relobj.
13083         (Relobj::is_section_specially_mapped): Remove.
13084         (Relobj::output_section): Remove poff parameter.  Change all
13085         callers.
13086         (Relobj::output_section_offset): New function.
13087         (Relobj::set_section_offset): Rewrite.
13088         (Relobj::map_to_output): Remove.
13089         (Relobj::output_sections): New function.
13090         (Relobj::do_output_section_offset): New pure virtual function.
13091         (Relobj::do_set_section_offset): Likewise.
13092         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13093         group support from Relobj.  Update declarations.
13094         (Sized_relobj::get_output_section_offset): New function.
13095         (Sized_relobj::do_output_section_offset): New function.
13096         (Sized_relobj::do_set_section_offset): New function.
13097         * object.cc (Relobj::output_section_address): Remove.
13098         (Sized_relobj::Sized_relobj): Initialize new fields.
13099         (Sized_relobj::include_section_group): Cast find_kept_object to
13100         Sized_relobj.
13101         (Sized_relobj::include_linkonce_section): Likewise.
13102         (Sized_relobj::do_layout): Use separate arrays for output section
13103         and output offset.
13104         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13105         output_sections.
13106         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13107         output_sections and section_offsets.
13108         (Sized_relobj::write_local_symbols): Likewise.
13109         (map_to_kept_section): Compute output address directly.
13110         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13111         output_sections and section_offsets.
13112         (Sized_relobj::write_sections): Likewise.
13113         (Sized_relobj::relocate_sections): Likewise.
13114         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13115         * output.h (class Output_reloc): Update declarations.  Change
13116         u2_.relobj to Sized_relobj*.
13117         (class Output_data_reloc): Change add functions to use
13118         Sized_relobj*.
13119         * output.cc (Output_reloc::Output_reloc): Change relobj to
13120         Sized_relobj*.
13121         (Output_reloc::local_section_offset): Change return type to
13122         Elf_Addr.  Use get_output_section_offset.
13123         (Output_reloc::get_address): Likewise.
13124         (Output_section::is_input_address_mapped): Don't call
13125         is_section_specially_mapped.
13126         (Output_section::output_offset): Likewise.
13127         (Output_section::output_address): Likewise.
13128         (Output_section::starting_output_address): Likewise.
13129         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13130         parameter to Sized_relobj*.
13131         (Copy_relocs::need_copy_reloc): Likewise.
13132         (Copy_relocs::save): Likewise.
13133         * copy-relocs.h (class Copy_relocs): Update declarations.
13134         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13135         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13136         * target-reloc.h (relocate_for_relocatable): Change
13137         offset_in_output_section type to Elf_Addr.  Change code that uses
13138         it as well.
13139         * layout.cc (Layout::layout): Always set *off.
13140         * mapfile.cc (Mapfile::print_input_section): Use
13141         output_section_offset.
13142         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13143         Sized_relobj*.
13144         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13145         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13146         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13147
13148 2008-07-03  Ian Lance Taylor  <iant@google.com>
13149
13150         * layout.cc (Layout::include_section): Do not discard unrecognized
13151         SHT_STRTAB sections.
13152
13153 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13154
13155         * script.cc (Lex::can_continue_name): Make '?' allowable in
13156         version-script names.
13157         * testsuite/version_script.map: Change glob pattern to use '?'
13158
13159 2008-06-30  Manish Singh  <yosh@gimp.org>
13160
13161         PR 6585
13162         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13163         Correct typo.
13164
13165 2008-06-30  Ian Lance Taylor  <iant@google.com>
13166
13167         PR 6660
13168         PR 6682
13169         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13170         versions]: Don't try to read the value in the contents, since we
13171         don't use it.  Use the template endianness when writing.
13172
13173 2008-06-25  Cary Coutant  <ccoutant@google.com>
13174
13175         * fileread.cc (File_read::make_view): Assert on zero-length view.
13176         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13177         symbol table when there are no symbols to read.
13178
13179 2008-06-23  Craig Silverstein  <csilvers@google.com>
13180
13181         * version.cc (version_string): Bump to 1.7
13182
13183 2008-06-18  Craig Silverstein  <csilvers@google.com>
13184
13185         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13186         constant 0xFFFF to type Valtype.
13187         (Powerpc_relocate_functions::rel16_ha): Likewise.
13188
13189 2008-06-17  Ian Lance Taylor  <iant@google.com>
13190
13191         * output.h (Output_section::Input_section): Initialize p2align_ to
13192         zero for Output_section_data constructors.
13193         (Output_section::Input_section::addralign): If not an input
13194         section, return the alignment of the Output_section_data.
13195         * testsuite/copy_test.cc: New file.
13196         * testsuite/copy_test_1.cc: New file.
13197         * testsuite/copy_test_2.cc: New file.
13198         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13199         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13200         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13201         (copy_test_1_pic.o, copy_test_1.so): New targets.
13202         (copy_test_2_pic.o, copy_test_2.so): New targets.
13203         * testsuite/Makefile.in: Rebuild.
13204
13205         * script-sections.cc (Script_sections::place_orphan): Initialize
13206         local variable exact.
13207
13208 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13209
13210         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13211
13212 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13213             David S. Miller  <davem@davemloft.net>
13214
13215         * powerpc.cc: New file.
13216         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13217         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13218         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13219         * Makefile.in: Rebuild.
13220
13221 2008-06-09  Ian Lance Taylor  <iant@google.com>
13222
13223         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13224         <exception>.
13225         (throwing, orig_terminate): New static variables.
13226         (terminate_handler): New static function.
13227         (t2): Set terminate handler.
13228
13229 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13230
13231         PR 6584
13232         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13233         alignment.
13234
13235 2008-05-30  Cary Coutant  <ccoutant@google.com>
13236
13237         * archive.cc (Archive::include_all_members) Correct to step
13238         over symbol table and extended name table in thin archives.
13239
13240 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13241
13242         PR 6407
13243         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13244         calculation.
13245
13246 2008-05-28  Caleb Howe  <cshowe@google.com>
13247
13248         * reduced_debug_output.cc: New file.
13249         * reduced_debug_output.h: New file.
13250         * options.h (class General_options): Add --strip-debug-non-line.
13251         * options.cc (General_options::finalize): Add strip_debug_non_line
13252         to the strip heirarchy.
13253         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13254         fields.
13255         * layout.cc: Include "reduced_debug_output.h".
13256         (Layout::Layout): Initialize new fields.
13257         (line_only_debug_sections): New static array.
13258         (is_lines_only_debug_sections): New static inline function.
13259         (Layout::include_section): Handle --strip-debug-non-line.
13260         (Layout::make_output_section): If --strip-debug-non-line, build
13261         new output sections for .debug_abbrev and .debug_info.
13262         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13263         gold.  Warn about possible overflow.
13264         (read_signed_LEB_128): Likewise.
13265         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13266         (read_signed_LEB_128): Declare.
13267         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13268         (HFILES): Add reduced_debug_output.h.
13269         * Makefile.in: Rebuild.
13270
13271 2008-05-21  Ian Lance Taylor  <iant@google.com>
13272
13273         * mapfile.cc: New file.
13274         * mapfile.h: New file.
13275         * options.h (class General_options): Add -M/--print-map and -Map.
13276         * options.cc (General_options::finalize): Make -M equivalent to
13277         -Map -.
13278         * main.cc: Include <cstdio> and "mapfile.h".
13279         (main): Open mapfile if requested.
13280         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13281         constructor.  Change caller.
13282         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13283         (queue_middle_tasks): Likewise.
13284         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13285         declarations.
13286         * archive.cc: Include "mapfile.h".
13287         (Archive::add_symbols): Add mapfile parameter.  Change all
13288         callers.  Pass mapfile, symbol, and reason to include_member.
13289         (Archive::include_all_members): Add mapfile parameter.  Change all
13290         callers.
13291         (Archive::include_member): Add mapfile, sym, and why parameters.
13292         Change all callers.  Report inclusion to map file.
13293         * archive.h: Include "fileread.h".
13294         (class Archive): Update declarations.
13295         (Archive::file): New const method.
13296         (class Add_archive_symbols): Add mapfile_ field.  Update
13297         constructor.  Change all callers.
13298         * readsyms.h (class Read_symbols): Likewise.
13299         (class Finish_group): Likewise.
13300         (class Read_script): Likewise.
13301         * common.cc: Include "mapfile.h".
13302         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13303         all callers.
13304         (Symbol_table::do_allocate_commons): Likewise.
13305         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13306         symbol allocation to mapfile.
13307         * common.h (class Allocate_commons_task): Add mapfile_ field.
13308         Update constructor.  Change all callers.
13309         * symtab.h (class Symbol_table): Update declarations.
13310         * layout.cc: Include "mapfile.h".
13311         (Layout_task_runner::run): Print information to mapfile.
13312         (Layout::create_gold_note): Change Output_data_fixed_space to
13313         Output_data_zero_fill.
13314         (Layout::create_build_id): Likewise.
13315         (Layout::print_to_mapfile): New function.
13316         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13317         constructor.  Change caller.
13318         (class Layout): Declare print_to_mapfile.
13319         * output.cc (Output_section::Input_section::print_to_mapfile): New
13320         function.
13321         (Output_section::add_input_section): If producing a map, always
13322         add to input_sections_ list.
13323         (Output_section::do_print_to_mapfile): New function.
13324         (Output_segment::print_sections_to_mapfile): New function.
13325         (Output_segment::print_section_list_to_mapfile): New function.
13326         * output.h: Include "mapfile.h".
13327         (Output_data::print_to_mapfile): New function.
13328         (Output_data::do_print_to_mapfile): New virtual function.
13329         (Output_segment_headers::do_print_to_mapfile): New function.
13330         (Output_file_header::do_print_to_mapfile): New function.
13331         (Output_data_const::do_print_to_mapfile): New function.
13332         (class Output_data_const_buffer): Add map_name_ field.  Update
13333         constructor.  Change all callers.  Add do_print_to_mapfile
13334         function.
13335         (class Output_data_fixed_space): Likewise.
13336         (class Output_data_space): Likewise.
13337         (class Output_data_zero_fill): New class.
13338         (Output_data_strtab::do_print_to_mapfile): New function.
13339         (Output_data_reloc_base::do_print_to_mapfile): New function.
13340         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13341         (Output_data_group::do_print_to_mapfile): New function.
13342         (Output_data_got::do_print_to_mapfile): New function.
13343         (Output_data_dynamic::do_print_to_mapfile): New function.
13344         (Output_symtab_xindex::do_print_to_mapfile): New function.
13345         (class Output_section): Declare do_print_to_mapflie.  Declare
13346         print_to_mapfile in Input_section.
13347         (class Output_segment): Declare new functions.
13348         * object.h (Sized_relobj::symbol_count): New function.
13349         * script-sections.cc
13350         (Output_section_element_dot_assignment::set_section_addresses):
13351         Change Output_data_fixed_space to Output_data_zero_fill.
13352         (Output_data_expression::do_print_to_mapfile): New function.
13353         * script.cc (read_input_script): Add mapfile parameter.  Change
13354         all callers.
13355         * script.h (read_input_script): Update declaration.
13356         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13357         (Eh_frame::do_print_to_mapfile): New function.
13358         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13359         (Output_merge_string::do_print_to_mapfile): New function.
13360         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13361         function.
13362         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13363         function.
13364         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13365         function.
13366         * Makefile.am (CCFILES): Add mapfile.cc.
13367         (HFILES): Add mapfile.h.
13368         * Makefile.in: Rebuild.
13369
13370 2008-05-19  Ian Lance Taylor  <iant@google.com>
13371
13372         * options.h (class General_options): Add -z relro.
13373         * layout.cc (Layout::Layout): Initialize relro_segment_.
13374         (Layout::add_output_section_data): Return the output section.
13375         (Layout::make_output_section): Rcognize relro sections and mark
13376         them appropriately.
13377         (Layout::attach_allocated_section_to_segment): Put relro sections
13378         in a PT_GNU_RELRO segment.
13379         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13380         section as relro.
13381         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13382         PT_TLS segments.
13383         (Layout::linkonce_mapping): Map d.rel.ro.local to
13384         .data.rel.ro.local.
13385         (Layout::output_section_name): Us .data.rel.ro.local for any
13386         section which begins with that.
13387         * layout.h (class Layout): Update add_output_section_data
13388         declaration.  Add relro_segment_ field.
13389         * output.cc (Output_section::Output_section): Initialize is_relro_
13390         and is_relro_local_ fields.
13391         (Output_segment::add_output_section): Group relro sections.
13392         (Output_segment::is_first_section_relro): New function.
13393         (Output_segment::maximum_alignment): If there is a relro section,
13394         align the segment to the common page size.
13395         (Output_segment::set_section_addresses): Track whether we are
13396         looking at relro sections.  If the last section is a relro
13397         section, align to the common page size.
13398         (Output_segment::set_section_list_addresses): Add in_relro
13399         parameter.  Change all callers.  Align to the page size when
13400         moving from relro to non-relro section.
13401         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13402         segment.
13403         * output.h (class Output_section): Add is_relro_ and
13404         is_relro_local_ fields.
13405         (Output_section::is_relro): New function.
13406         (Output_section::set_is_relro): New function.
13407         (Output_section::is_relro_local): New function.
13408         (Output_section::set_is_relro_local): New function.
13409         (class Output_segment): Update declarations.
13410         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13411         * sparc.cc (Target_sparc::got_section): Likewise.
13412         * x86_64.cc (Target_x86_64::got_section): Likewise.
13413         * testsuite/relro_test_main.cc: New file.
13414         * testsuite/relro_test.cc: New file.
13415         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13416         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13417         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13418         (relro_test.so, relro_test_pic.o): New targets.
13419         * testsuite/Makefile.in: Rebuild.
13420
13421 2008-05-16  Ian Lance Taylor  <iant@google.com>
13422
13423         * output.cc (Output_segment::add_output_section): Remove front
13424         parameter.
13425         * output.h (class Output_segment): Remove
13426         add_initial_output_section and overloaded add_output_section.
13427         Update declaration of remaining add_output_section.
13428         * layout.cc (Layout::create_interp): Call add_output_section
13429         rather than add_initial_output_section.
13430         (Layout::finish_dynamic_section): Likewise.
13431
13432         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13433         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13434         know the dynamic type.
13435         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13436         field.  Initialize it in constructor.
13437         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13438         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13439         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13440         reloc.
13441
13442         * output.cc (Output_reloc::get_address): Change return type to
13443         Elf_Addr.
13444         * output.h (class Output_reloc): Update get_address declaration.
13445         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13446         for section addresses.
13447
13448 2008-05-09  Ian Lance Taylor  <iant@google.com>
13449
13450         PR 6493
13451         * gold.cc (gold_nomem): Use return value of write.
13452
13453 2008-05-08  Ian Lance Taylor  <iant@google.com>
13454
13455         * symtab.c (Symbol::init_base_output_data): Add version
13456         parameter.  Change all callers.
13457         (Symbol::init_base_output_segment): Likewise.
13458         (Symbol::init_base_constant): Likewise.
13459         (Symbol::init_base_undefined): Likewise.
13460         (Sized_symbol::init_output_data): Likewise.
13461         (Sized_symbol::init_output_segment): Likewise.
13462         (Sized_symbol::init_constant): Likewise.
13463         (Sized_symbol::init_undefined): Likewise.
13464         (Symbol_table::do_define_in_output_data): If the new symbol has a
13465         version, mark it as the default.
13466         (Symbol_table::do_define_in_output_segment): Likewise.
13467         (Symbol_table::do_define_as_constant): Likewise.
13468         * symtab.h (class Symbol): Update declarations.
13469         (class Sized_symbol): Likewise.
13470         * resolve.cc (Symbol::override_version): New function.
13471         (Symbol::override_base): Call override_version.
13472         (Symbol::override_base_with_special): Likewise.
13473         * testsuite/ver_script_8.script: New file.
13474         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13475         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13476         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13477         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13478
13479 2008-05-06  Ian Lance Taylor  <iant@google.com>
13480
13481         PR 6049
13482         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13483         functions.
13484         (class General_options): Remove existing --undefined, and add
13485         --no-undefined instead.  Add new --undefined as synonym for -u.
13486         * archive.cc (Archive::add_symbols): Check whether symbol was
13487         named with -u.
13488         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13489         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13490         all uses.  Add IS_UNDEFINED.  Update declarations to split
13491         different versions of init_base.  Declare init_base_undefined.
13492         (Symbol::is_defined): Handle IS_UNDEFINED.
13493         (Symbol::is_undefined): Likewise.
13494         (Symbol::is_weak_undefined): Call is_undefined.
13495         (Symbol::is_absolute): Handle IS_CONSTANT.
13496         (class Sized_symbol): Update declarations to split different
13497         versions of init.  Declare init_undefined.
13498         (class Symbol_table): Declare new functions.
13499         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13500         Change all callers.
13501         (Symbol::init_base_output_data): Likewise.
13502         (Symbol::init_base_output_segment): Likewise.
13503         (Symbol::init_base_constant): Likewise.
13504         (Symbol::init_base_undefined): New function.
13505         (Sized_symbol::init_object): Rename from init.  Change all
13506         callers.
13507         (Sized_symbol::init_output_data): Likewise.
13508         (Sized_symbol::init_output_segment): Likewise.
13509         (Sized_symbol::init_constant): Likewise.
13510         (Sized_symbol::init_undefined): New function.
13511         (Symbol_table::add_undefined_symbols_from_command_line): New
13512         function.
13513         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13514         function.
13515         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13516         (Symbol::output_section): Likewise.
13517         (Symbol::set_output_section): Likewise.
13518         (Symbol_table::sized_finalize_symbol): Likewise.
13519         (Symbol_table::sized_write_globals): Likewise.
13520         * resolve.cc (Symbol_table::should_override): Likewise.
13521         (Symbol::override_base_with_special): Likewise.
13522
13523         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13524         symbol, change it to have default visibility.
13525         * testsuite/protected_1.cc: New file.
13526         * testsuite/protected_2.cc: New file.
13527         * testsuite/protected_3.cc: New file.
13528         * testsuite/protected_main_1.cc: New file.
13529         * testsuite/protected_main_2.cc: New file.
13530         * testsuite/protected_main_3.cc: New file.
13531         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13532         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13533         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13534         (protected_1.so): New target.
13535         (protected_1_pic.o, protected_2_pic.o): New targets.
13536         (protected_3_pic.o): New target.
13537         (check_PROGRAMS): Add protected_2.
13538         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13539         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13540         * testsuite/Makefile.in: Rebuild.
13541
13542         * options.h (DEFINE_var): Add set_user_set_##varname__.
13543         (DEFINE_bool_alias): New macro.
13544         (class General_options): Define -Bstatic using DEFINE_bool_alias
13545         rather than DEFINE_special.  Add --undefined as an alias for -z
13546         defs.
13547         * options.cc (General_options::parse_Bstatic): Remove.
13548
13549         * options.h (class General_options): Add --fatal-warnings.
13550         * main.cc (main): Implement --fatal-warnings.
13551         * errors.h (Errors::warning_count): New function.
13552
13553         * options.h (class General_options): Add -Bsymbolic-functions.
13554         * symtab.h (Symbol::is_preemptible): Check for
13555         -Bsymbolic-functions.
13556
13557 2008-05-05  Ian Lance Taylor  <iant@google.com>
13558
13559         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13560         as noVARNAME rather than no-VARNAME.
13561         (class General_options): Add option -z combreloc.
13562         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13563         get_address.
13564         (Output_reloc::sort_before) [SHT_REL]: New function.
13565         (Output_reloc::sort_before) [SHT_RELA]: New function.
13566         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13567         Sort_relocs_comparison.
13568         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13569         parameter.  Change all callers.
13570         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13571         sort_relocs parameter.  Change all callers.
13572         * output.cc (Output_reloc::get_address): New function, broken out
13573         of write_rel.
13574         (Output_reloc::write_rel): Call it.
13575         (Output_reloc::compare): New function.
13576         (Output_data_reloc_base::do_write): Optionally sort relocs.
13577
13578         * configure.ac: If targ_extra_obj is set, link it in.
13579         * configure.tgt: Initialize all variables.
13580         (x86_64*): Set targ_extra_obj and targ_extra_size.
13581         * configure: Rebuild.
13582
13583         * object.cc (Sized_relobj::include_section_group): Adjust section
13584         indexes read from group data.  Build vector to pass to
13585         layout_group.
13586         * layout.cc (Layout::layout_group): Add flags and shndxes
13587         parameters.  Remove contents parameter.  Change caller.  Update
13588         explicit instantiations.
13589         * layout.h (class Layout): Update layout_group declaration.
13590         * output.cc (Output_data_group::Output_data_group): Add flags and
13591         input_shndxes parameters.  Remove contents parameter.  Change
13592         caller.
13593         (Output_data_group::do_write): Change input_sections_ to
13594         input_shndxes_.
13595         * output.h (class Output_data_group): Update constructor
13596         declaration.  Rename input_sections_ to input_shndxes_.
13597         * testsuite/many_sections_test.cc: Add template.
13598
13599 2008-04-30  Cary Coutant  <ccoutant@google.com>
13600
13601         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13602
13603         * layout.cc (Layout::include_section): Refactored check for debug
13604         info section.
13605         (Layout::add_comdat): Add new parameters.  Change type
13606         of signature parameter.  Add object and shndx to signatures table.
13607         (Layout::find_kept_object): New function.
13608         * layout.h: Include <cstring>.
13609         (Layout::is_debug_info_section): New function.
13610         (Layout::add_comdat): Add new parameters.
13611         (Layout::find_kept_object): New function.
13612         (Layout::Kept_section): New struct.
13613         (Layout::Signatures): Change type of map range.
13614         * object.cc (Relobj::output_section_address): New function.
13615         (Sized_relobj::include_section_group): Add new parameters.  Change
13616         calls to Layout::add_comdat.  Change to build table of kept comdat
13617         groups and table mapping discarded sections to kept sections.
13618         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13619         (Sized_relobj::do_layout): Change calls to include_section_group and
13620         include_linkonce_section.
13621         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13622         value to zero when section is discarded.
13623         (Sized_relobj::map_to_kept_section): New function.
13624         * object.h (Relobj::output_section_address): New function.
13625         (Relobj::Comdat_group): New type.
13626         (Relobj::find_comdat_group): New function.
13627         (Relobj::Comdat_group_table): New type.
13628         (Relobj::Kept_comdat_section): New type.
13629         (Relobj::Kept_comdat_section_table): New type.
13630         (Relobj::add_comdat_group): New function.
13631         (Relobj::set_kept_comdat_section): New function.
13632         (Relobj::get_kept_comdat_section): New function.
13633         (Relobj::comdat_groups_): New field.
13634         (Relobj::kept_comdat_sections_): New field.
13635         (Symbol_value::input_value): Update comment.
13636         (Sized_relobj::map_to_kept_section) New function.
13637         (Sized_relobj::include_linkonce_section): Add new parameter.
13638         * target-reloc.h (Comdat_behavior): New type.
13639         (get_comdat_behavior): New function.
13640         (relocate_section): Add code to map a discarded section to the
13641         corresponding kept section when applying a relocation.
13642
13643 2008-04-30  Craig Silverstein  <csilvers@google.com>
13644
13645         * dwarf_reader.cc (next_generation_count): New static var.
13646         (Addr2line_cache_entry): New struct.
13647         (addr2line_cache): New static var.
13648         (Dwarf_line_info::one_addr2line): Added caching.
13649         (Dwarf_line_info::clear_addr2line_cache): New function.
13650         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13651         cache-size parameter.
13652         (Dwarf_line_info::one_addr2line_cache): New function.
13653         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13654         new cache-size argument to one_addr2line(), and clear cache.
13655
13656 2008-04-28  Cary Coutant  <ccoutant@google.com>
13657
13658         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13659         R_386_PC8 relocations.
13660
13661 2008-04-23  Ian Lance Taylor  <iant@google.com>
13662
13663         * object.cc (Sized_relobj::include_section_group): Check for
13664         invalid section group.
13665
13666         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13667         header size.
13668
13669         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13670         than read for file header.
13671         * archive.cc (Archive::include_member): Likewise.
13672
13673 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13674
13675         * aclocal.m4: Regenerate.
13676         * configure: Regenerate.
13677
13678 2008-04-19  Ian Lance Taylor  <iant@google.com>
13679
13680         * version.cc (version_string): Bump to 1.6.
13681
13682         * testsuite/Makefile.am (many_sections_r_test): New target.
13683         (many_sections_r_test_SOURCES): Remove.
13684         (many_sections_r_test_DEPENDENCIES): Remove.
13685         (many_sections_r_test_LDFLAGS): Remove.
13686         (many_sections_r_test_LDADD): Remove.
13687
13688         * object.cc (Sized_relobj::do_add_symbols): Always pass
13689         local_symbol_count_ to add_from_relobj.
13690
13691         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13692         every thousand variables.
13693         * testsuite/Makefile.in: Rebuild.
13694
13695         * object.cc (Xindex::initialize_symtab_xindex): New function.
13696         (Xindex::read_symtab_xindex): New function.
13697         (Xindex::sym_xindex_to_shndx): New function.
13698         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13699         available.
13700         (Sized_relobj::do_initialize_xindex): New function.
13701         (Sized_relobj::do_read_symbols): Adjust section links.
13702         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13703         parameter.  Change all callers.
13704         (Sized_relobj::include_section_group): Adjust section links and
13705         symbol section indexes.
13706         (Sized_relobj::do_layout): Adjust section links.
13707         (Sized_relobj::do_count_local_symbols): Adjust section links and
13708         symbol section indexes.
13709         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13710         ordinary and special symbols.
13711         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13712         dynsym_xindex parameters.  Change all callers.  Adjust section
13713         links.  Use SHN_XINDEX when needed.
13714         (Sized_relobj::get_symbol_location_info): Adjust section links.
13715         Don't get fooled by special symbols.
13716         * object.h (class Xindex): Define.
13717         (class Object): Add xindex_ parameter.  Declare virtual functoin
13718         do_initialize_xindex.
13719         (Object::adjust_sym_shndx): New function.
13720         (Object::set_xindex): New protected function.
13721         (class Symbol_value): Add is_ordinary_shndx_ field.
13722         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13723         (Symbol_value::value): Assert ordinary section.
13724         (Symbol_value::initialize_input_to_output_map): Likewise.
13725         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13726         Change all callers.
13727         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13728         all callers.
13729         (class Sized_relobj): Update declarations.
13730         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13731         parameter.  Change all callers.
13732         (Sized_relobj::adjust_shndx): New function.
13733         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13734         field.
13735         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13736         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13737         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13738         (Sized_dynobj::read_dynsym_section): Adjust section links.
13739         (Sized_dynobj::read_dynamic): Likewise.
13740         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13741         section links.
13742         (Sized_dynobj::do_initialize_xindex): New function.
13743         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13744         do_initialize_xindex.
13745         (Sized_dynobj::adjust_shndx): New function.
13746         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13747         dynsym_xindex_ fields.
13748         (Layout::finalize): Add a call to set_section_indexes before
13749         creating the symtab sections.
13750         (Layout::set_section_indexes): Don't do anything if the section
13751         already has a section index.
13752         (Layout::create_symtab_sections): Add shnum parameter.  Change
13753         caller.  Create .symtab_shndx section if needed.
13754         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13755         caller.
13756         (Layout::allocated_output_section_count): New function.
13757         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13758         needed.
13759         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13760         fields.  Update declarations.
13761         (Layout::symtab_xindex): New function.
13762         (Layout::dynsym_xindex): New function.
13763         (class Write_symbols_task): Add layout_ field.
13764         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13765         Change caller.
13766         * output.cc (Output_section_headers::Output_section_headers): Add
13767         shstrtab_section parameter.  Change all callers.
13768         (Output_section_headers::do_sized_write): Store overflow values
13769         for section count and section string table section index in
13770         section header zero.
13771         (Output_file_header::do_sized_write): Check for overflow of
13772         section count and section string table section index.
13773         (Output_symtab_xindex::do_write): New function.
13774         (Output_symtab_xindex::endian_do_write): New function.
13775         * output.h (class Output_section_headers): Add shstrtab_section_.
13776         Update declarations.
13777         (class Output_symtab_xindex): Define.
13778         (Output_section::has_out_shndx): New function.
13779         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13780         field.
13781         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13782         Change all callers.
13783         (Sized_symbol::init): Likewise.
13784         (Symbol::output_section): Check for ordinary symbol.
13785         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13786         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13787         callers.
13788         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13789         Change all callers.  Simplify handling of symbols from sections
13790         not included in the link.
13791         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13792         distinction.
13793         (Weak_alias_sorter::operator()): Assert that symbols are
13794         ordinary.
13795         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13796         distinction.
13797         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13798         parameters.  Change all callers.
13799         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13800         symbol distinction.  Use SHN_XINDEX when needed.
13801         (Symbol_table::write_section_symbol): Add symtab_xindex
13802         parameter.  Change all callers.
13803         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13804         SHN_XINDEX when needed.
13805         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13806         declarations.
13807         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13808         (Symbol::is_defined): Check is_ordinary.
13809         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13810         (Symbol::is_absolute, Symbol::is_common): Likewise.
13811         (class Sized_symbol): Update declarations.
13812         (class Symbol_table): Update declarations.
13813         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13814         parameters.  Change all callers.
13815         (Sized_symbol::override): Likewise.
13816         (Symbol_table::override): Likewise.
13817         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13818         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13819         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13820         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13821         to be in an ordinary section.
13822         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13823         object and is_ordinary parameters.  Change all callers.
13824         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13825         Change all callers.  Don't add undefined or non-ordinary symbols
13826         to reloc_map_.
13827         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13828         Change all callers.
13829         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13830         declarations.
13831         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13832         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13833         (Sized_relobj::relocate_sections): Likewise.
13834         * target-reloc.h (scan_relocs): Adjust section symbol index.
13835         (scan_relocatable_relocs): Likewise.
13836         * i386.cc (Scan::local): Check for ordinary symbols.
13837         * sparc.cc (Scan::local): Likewise.
13838         * x86_64.cc (Scan::local): Likewise.
13839         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13840         to symbol_section_and_value.
13841         * testsuite/many_sections_test.cc: New file.
13842         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13843         (check_PROGRAMS): Add many_sections_test.
13844         (many_sections_test_SOURCES): Define.
13845         (many_sections_test_DEPENDENCIES): Define.
13846         (many_sections_test_LDFLAGS): Define.
13847         (BUILT_SOURCES): Add many_sections_define.h.
13848         (many_sections_define.h): New target.
13849         (BUILT_SOURCES): Add many_sections_check.h.
13850         (many_sections_check.h): New target.
13851         (check_PROGRAMS): Add many_sections_r_test.
13852         (many_sections_r_test_SOURCES): Define.
13853         (many_sections_r_test_DEPENDENCIES): Define.
13854         (many_sections_r_test_LDFLAGS): Define.
13855         (many_sections_r_test_LDADD): Define.
13856         (many_sections_r_test.o): New target.
13857         * testsuite/Makefile.in: Rebuild.
13858
13859 2008-04-17  Cary Coutant  <ccoutant@google.com>
13860
13861         * errors.cc (Errors::info): New function.
13862         (gold_info): New function.
13863         * errors.h (Errors::info): New function.
13864         * gold.h (gold_info): New function.
13865         * object.cc (Input_objects::add_object): Print trace output.
13866         * options.cc (options::parse_set): New function.
13867         (General_options::parse_wrap): Deleted.
13868         (General_options::General_options): Deleted initializer.
13869         * options.h (options::String_set): New typedef.
13870         (options::parse_set): New function.
13871         (DEFINE_set): New macro.
13872         (General_options::wrap): Changed to use DEFINE_set. Changed
13873         callers of any_wrap_symbols and is_wrap_symbol.
13874         (General_options::trace, General_options::trace_symbol):
13875         New options.
13876         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13877         (General_options::wrap_symbols_): Deleted.
13878         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13879
13880 2008-04-17  David S. Miller  <davem@davemloft.net>
13881
13882         * options.cc (General_options::parse_V): New function.
13883         * options.h: Add entries for -V and -Qy.
13884
13885 2008-04-17  Ian Lance Taylor  <iant@google.com>
13886
13887         * common.cc (Symbol_table::allocate_commons): Remove options
13888         parameter.  Change caller.
13889         (Symbol_table::do_allocate_commons): Remove options parameter.
13890         Change caller.  Just call do_allocate_commons_list twice.
13891         (Symbol_table::do_allocate_commons_list): New function, broken out
13892         of do_allocate_commons.
13893         * common.h (class Allocate_commons_task): Remove options_ field.
13894         Update constructor.
13895         * symtab.cc (Symbol_table::Symbol_table): Initialize
13896         tls_commons_.
13897         (Symbol_table::add_from_object): Put TLS common symbols on
13898         tls_commons_ list.
13899         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13900         which are IN_OUTPUT_DATA.
13901         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13902         allocate_commons and do_allocate_commons declarations.  Declare
13903         do_allocate_commons_list.
13904         * gold.cc (queue_middle_tasks): Update creation of
13905         Allocate_commons_task to not pass options.
13906         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13907         (TLS_TEST_C_FLAGS): New variable.
13908         (tls_test_c_pic.o): New target.
13909         (tls_test_shared.so): Link in tls_test_c_pic.o.
13910         (tls_test_c_pic_ie.o): New target.
13911         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13912         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13913         (tls_test_c.o): New target.
13914         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13915         (tls_pic_test_LDADD): Likewise.
13916         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13917         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13918         (tls_test_c_gnu2.o): New target.
13919         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13920         tls_test_c_gnu2.o.
13921         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13922         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13923         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13924         * testsuite/tls_test.cc: Include "config.h".
13925         (t_last): Call t11_last.
13926         * testsuite/tls_test.h (t11, t11_last): Declare.
13927         * testsuite/tls_test_c.c: New file.
13928         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13929         * configure.ac: Check for OpenMP support.
13930         * configure, config.in, Makefile.in: Rebuild.
13931         * testsuite/Makefile.in: Rebuild.
13932
13933 2008-04-16  Cary Coutant  <ccoutant@google.com>
13934
13935         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13936         (Target_i386::tls_base_symbol_defined_): New field.
13937         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13938         (Target_i386::Scan::global): Likewise.
13939         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13940         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13941         (Target_x86_64::tls_base_symbol_defined_): New field.
13942         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13943         (Target_x86_64::Scan::global): Likewise.
13944
13945 2008-04-16  Cary Coutant  <ccoutant@google.com>
13946
13947         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13948         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13949         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13950         building shared libraries.
13951         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13952         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13953         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13954         * testsuite/Makefile.in: Rebuild.
13955         * testsuite/weak_undef.h: New file.
13956         * testsuite/weak_undef_file1.cc: Add extra test cases.
13957         * testsuite/weak_undef_file2.cc: Likewise.
13958         * testsuite/weak_undef_test.cc: Likewise.
13959
13960 2008-04-16  David S. Miller  <davem@davemloft.net>
13961
13962         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13963         Add issued_non_pic_error_ field.  Declare check_non_pic.
13964         (Target_sparc::Scan::check_non_pic): New function.
13965         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13966         (Target_sparc::Scan::global): Likewise.
13967
13968         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13969         * configure: Rebuild.
13970
13971         * options.h (DEFINE_enable): New macro.
13972         (new_dtags): New enable option.
13973         (initfirst, interpose, loadfltr, nodefaultlib,
13974         nodelete, nodlopen, nodump): New -z options.
13975         * layout.cc (Layout:finish_dynamic_section): If new
13976         dtags enabled, emit DT_RUNPATH.  Also, emit a
13977         DT_FLAGS_1 containing any specified -z flags.
13978
13979 2008-04-16  Ian Lance Taylor  <iant@google.com>
13980
13981         * copy-relocs.cc: New file.
13982         * copy-relocs.h: New file.
13983         * reloc.cc: Remove Copy_relocs code.
13984         * reloc.h: Likewise.
13985         * reloc-types.h (struct Reloc_types) [both versions]: Add
13986         get_reloc_addend_noerror.
13987         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13988         variants of add_global which take an addend which must be zero.
13989         * i386.cc: Include "copy-relocs.h".
13990         (class Target_i386): Change type of copy_relocs_ to variable,
13991         update initializer.
13992         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13993         Change all callers.
13994         (Target_i386::do_finalize_sections): Change handling of
13995         copy_relocs_.
13996         * sparc.cc: Include "copy-relocs.h".
13997         (class Target_sparc): Change type of copy_relocs_ to variable,
13998         update initializer.
13999         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14000         Change all callers.
14001         (Target_sparc::do_finalize_sections): Change handling of
14002         copy_relocs_.
14003         * x86_64.cc: Include "copy-relocs.h".
14004         (class Target_x86_64): Change type of copy_relocs_ to variable,
14005         update initializer.
14006         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14007         class.  Change all callers.
14008         (Target_x86_64::do_finalize_sections): Change handling of
14009         copy_relocs_.
14010         * Makefile.am (CCFILES): Add copy-relocs.cc.
14011         (HFILES): Add copy-relocs.h.
14012
14013         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14014
14015         * testsuite/script_test_4.sh: Permit leading zeroes.
14016
14017 2008-04-15  Ian Lance Taylor  <iant@google.com>
14018
14019         * script-sections.cc (Script_sections::create_segments): Use
14020         header_size_adjustment even when there is enough room for the
14021         headers.
14022         * testsuite/script_test_4.sh: New file.
14023         * testsuite/script_test_4.t: New file.
14024         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14025         (check_DATA): Add script_test_4.stdout.
14026         (MOSTLYCLEANFILES): Likewise.
14027         (script_test_4): New target.
14028         (script_test_4.stdout): New target.
14029         * testsuite/Makefile.in: Rebuild.
14030
14031         * sparc.cc: Add definitions for Output_data_plt_sparc class
14032         constants.
14033
14034 2008-04-14  David S. Miller  <davem@davemloft.net>
14035
14036         * sparc.cc: New file.
14037         * Makefile.am (TARGETSOURCES): Add sparc.cc
14038         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14039         * configure.tgt: Document targ_extra_size and
14040         targ_extra_big_endian.  Add entries for sparc-* and
14041         sparc64-*.
14042         * configure.ac: Handle targ_extra_size and
14043         targ_extra_big_endian.
14044         * Makefile.in: Rebuild.
14045         * configure: Likewise.
14046         * po/POTFILES.in: Likewise.
14047         * po/gold.pot: Likewise.
14048
14049 2008-04-14  Ian Lance Taylor  <iant@google.com>
14050
14051         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14052         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14053         in the name/type/flags to section mapping.  Don't call
14054         allocate_output_section.
14055         (Layout::choose_output_section): Change parameter from adjust_name
14056         to is_input_section.  Don't permit input sections after sections
14057         are attached to segments.  Don't call allocate_output_section.
14058         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14059         not write_enable_output_section.
14060         (Layout::make_output_section): Don't push to
14061         unattached_section_list_ nor call attach_to_segment.  Call
14062         attach_section_to_segment if sections are attached.
14063         (Layout::attach_sections_to_segments): New function.
14064         (Layout::attach_section_to_segment): New function.
14065         (Layout::attach_allocated_section_to_segment): Rename from
14066         attach_to_segment.  Remove flags parameter.
14067         (Layout::allocate_output_section): Remove function.
14068         (Layout::write_enable_output_section): Remove function.
14069         * layout.h (class Layout): Update for above changes.  Add new
14070         field sections_are_attached_.
14071         * output.h (Output_section::update_flags_for_input_section): New
14072         function.
14073         * output.cc (Output_section::add_input_section): Call
14074         update_flags_for_input_section.
14075         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14076
14077 2008-04-11  Cary Coutant  <ccoutant@google.com>
14078
14079         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14080         thought unnecessary.
14081         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14082
14083 2008-04-11  Ian Lance Taylor  <iant@google.com>
14084
14085         * output.h (class Output_section_data): Remove inline definition
14086         of set_addralign.
14087         * output.cc (Output_section_data::set_addralign): New function.
14088
14089 2008-04-11  Cary Coutant  <ccoutant@google.com>
14090
14091         Add support for TLS descriptors for i386 and x86_64.
14092         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14093         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14094         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14095         GOT_TYPE_TLS_DESC.
14096         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14097         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14098         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14099         relocations.
14100         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14101         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14102         Fix problem with initial-exec relocations.
14103         (Target_i386::Relocate::relocate_tls): Likewise.
14104         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14105         relaxation.
14106         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14107         support for section-plus-offset dynamic table entries.
14108         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14109         (Output_data_dynamic::Dynamic_entry): Add support for
14110         section-plus-offset dynamic table entries.
14111         (Output_data_dynamic::Classification): Likewise.
14112         (Output_data_dynamic::classification_): Renamed offset_.
14113         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14114         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14115         (Target_x86_64::make_plt_section): New function.
14116         (Target_x86_64::reserve_tlsdesc_entries): New function.
14117         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14118         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14119         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14120         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14121         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14122         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14123         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14124         add extra PLT entry for TLS descriptors.
14125         (Output_data_plt_x86_64::got_): New field.
14126         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14127         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14128         fields.
14129         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14130         descriptors.
14131         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14132         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14133         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14134         R_386_TLS_DESC_CALL relocations.
14135         (Target_x86_64::Scan::global): Likewise.
14136         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14137         for TLS descriptors.
14138         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14139         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14140         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14141         GD-to-IE relaxation.
14142         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14143         and TLS_DESCRIPTORS.
14144         * Makefile.in: Rebuild.
14145         * configure: Rebuild.
14146         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14147         (tls_test_shared2.so): New target.
14148         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14149         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14150         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14151         (tls_shared_gd_to_ie_test_LDADD): New variable.
14152         (tls_shared_gnu2_gd_to_ie_test): New target.
14153         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14154         New targets.
14155         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14156         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14157         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14158         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14159         (tls_shared_gnu2_test): New target.
14160         (tls_test_gnu2_shared.so): New target.
14161         (tls_shared_gnu2_test_SOURCES): New variable.
14162         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14163         (tls_shared_gnu2_test_LDFLAGS): New variable.
14164         (tls_shared_gnu2_test_LDADD): New variable.
14165         * testsuite/Makefile.in: Rebuild.
14166         * testsuite/Makefile.
14167
14168 2008-04-11  Ian Lance Taylor  <iant@google.com>
14169
14170         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14171         justsyms.t.
14172         * testsuite/Makefile.in: Rebuild.
14173
14174         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14175         long.
14176         * testsuite/script_test_2.cc (main): Adjust test.
14177
14178 2008-04-11  David S. Miller  <davem@davemloft.net>
14179             Ian Lance Taylor  <iant@google.com>
14180
14181         * options.h (General_options): Add entries for '-Y' and
14182         '-relax'.
14183         * options.cc (General_options:finalize): If -Y was used, add those
14184         entries to the library path instead of the default "/lib" and
14185         "/usr/lib".
14186
14187 2008-04-11  David S. Miller  <davem@davemloft.net>
14188
14189         * testsuite/justsyms.t: Start at 0x100.
14190         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14191         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14192         long.
14193         * testsuite/script_test_2.cc: Adjust string and section length
14194         checks.
14195
14196 2008-04-09  Ian Lance Taylor  <iant@google.com>
14197
14198         PR gold/5996
14199         * script-sections.cc (Sections_element::allocate_to_segment): Add
14200         orphan parameter.
14201         (Output_section_definition::allocate_to_segment): Likewise.
14202         (Orphan_output_section::allocate_to_segment): Likewise.
14203         (Script_sections::attach_sections_using_phdrs_clause): Don't
14204         propagate non-PT_LOAD segments to orphan sections.
14205         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14206         readelf rather than objdump.
14207         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14208         .interp section and PT_INTERP segment are the same size.
14209         * testsuite/Makefile.in: Rebuild.
14210
14211         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14212         aliases for symbols defined in the same object.
14213         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14214         (weak_alias_test_SOURCES): New variable.
14215         (weak_alias_test_DEPENDENCIES): New variable.
14216         (weak_alias_test_LDFLAGS): New variable.
14217         (weak_alias_test_LDADD): New variable.
14218         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14219         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14220         (weak_alias_test_3.o): New target.
14221         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14222         * testsuite/weak_alias_test_main.cc: New file.
14223         * testsuite/weak_alias_test_1.cc: New file.
14224         * testsuite/weak_alias_test_2.cc: New file.
14225         * testsuite/weak_alias_test_3.cc: New file.
14226
14227 2008-04-08  Ian Lance Taylor  <iant@google.com>
14228
14229         * options.h (class General_options): Add --noinhibit-exec option.
14230         * main.cc (main): Check --noinhibit-exec.
14231
14232         * options.h (class General_options): Define --wrap as a special
14233         option.  Add wrap_symbols_ field.
14234         (General_options::any_wrap_symbols): New function.
14235         (General_options::is_wrap_symbol): New function.
14236         * options.cc (General_options::parse_wrap): New function.
14237         (General_options::General_options): Initialize wrap_symbols_.
14238         * symtab.cc (Symbol_table::wrap_symbol): New function.
14239         (Symbol_table::add_from_object): Handle --wrap.
14240         * symtab.h (class Symbol_table): Declare wrap_symbol.
14241         * target.h (Target::wrap_char): New function.
14242         (Target::Target_info): Add wrap_char field.
14243         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14244         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14245         * testsuite/testfile.cc (Target_test::test_target_info):
14246         Likewise.
14247
14248         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14249         there is one.
14250
14251         * layout.h (class Layout): Add added_eh_frame_data_ field.
14252         * layout.cc (Layout::Layout): Initialize new field.
14253         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14254         output section until we find a section we merged successfully.
14255         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14256         that the size be non-zero.
14257
14258         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14259         qualifier.
14260
14261 2008-04-08  Craig Silverstein  <csilvers@google.com>
14262
14263         * configure.ac: Export new conditional variable HAVE_ZLIB.
14264         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14265         on HAVE_ZLIB.
14266         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14267         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14268
14269 2008-04-07  Ian Lance Taylor  <iant@google.com>
14270
14271         * version.cc (version_string): Set to "1.5".
14272
14273         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14274         Add issued_non_pic_error_ field.  Declare check_non_pic.
14275         (Target_x86_64::Scan::check_non_pic): New function.
14276         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14277         (Target_x86_64::Scan::global): Likewise.
14278
14279         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14280         addend parameter.  Change caller.  Handle merge sections.
14281         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14282         Address to Addend.  Don't add in the result of
14283         local_section_offset, pass down the addend and use the returned
14284         value.
14285         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14286         Update declarations of local_section_offset and symbol_value.
14287         * testsuite/two_file_test_1.cc (t18): New function.
14288         * testsuite/two_file_test_2.cc (f18): New function.
14289         * testsuite/two_file_test_main.cc (main): Call t18.
14290         * testsuite/two_file_test.h (t18, f18): Declare.
14291
14292         * configure.ac: Don't test for objdump, c++filt, or readelf.
14293         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14294         conditionals.
14295         (TEST_READELF): New variable.
14296         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14297         (check_PROGRAMS): Add two_file_strip_test.
14298         (two_file_strip_test): New target.
14299         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14300         (two_file_same_shared_strip_test_SOURCES): New variable.
14301         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14302         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14303         (two_file_same_shared_strip_test_LDADD): New variable.
14304         (two_file_shared_strip.so): New target.
14305         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14306         (ver_test_5.syms, ver_test_7.syms): Likewise.
14307         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14308         (strip_test_3.stdout): Use TEST_OBJDUMP.
14309         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14310
14311 2008-04-04  Cary Coutant  <ccoutant@google.com>
14312
14313         * symtab.h (Symbol::is_weak_undefined): New function.
14314         (Symbol::is_strong_undefined): New function.
14315         (Symbol::is_absolute): New function.
14316         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14317         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14318         absolute symbols.
14319         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14320         (weak_undef_test): New target.
14321         * testsuite/Makefile.in: Rebuild.
14322         * testsuite/weak_undef_file1.cc: New file.
14323         * testsuite/weak_undef_file2.cc: New file.
14324         * testsuite/weak_undef_test.cc: New file.
14325
14326 2008-04-03  Craig Silverstein  <csilvers@google.com>
14327
14328         * compressed_output.h (class Output_compressed_section): Use
14329         unsigned buffer.
14330         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14331         add zlib header.
14332         (zlib_compressed_suffix): Removed.
14333         (Output_compressed_section::set_final_data_size): Use unsigned
14334         buffers.
14335         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14336         Fix linker invocation.
14337         (flagstest_o_specialfile_and_compress_debug_sections):
14338         Likewise.
14339         * testsuite/Makefile.in: Regenerated.
14340
14341 2008-04-02  David S. Miller  <davem@davemloft.net>
14342
14343         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14344         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14345
14346 2008-04-02  Craig Silverstein  <csilvers@google.com>
14347
14348         * TODO: New file.
14349
14350 2008-04-02  Ian Lance Taylor  <iant@google.com>
14351
14352         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14353         parameters.  Update for new key type to views_.  Change all
14354         callers.
14355         (File_read::read): Adjust for byteshift in returned view.
14356         (File_read::add_view): New function, broken out of
14357         find_and_make_view.
14358         (File_read::make_view): New function, broken out of
14359         find_and_make_view.
14360         (File_read::find_or_make_view): Add offset and aligned
14361         parameters.  Rewrite accordingly.  Change all callers.
14362         (File_read::get_view): Add offset and aligned parameters.  Adjust
14363         for byteshift in return value.
14364         (File_read::get_lasting_view): Likewise.
14365         * fileread.h (class File_read): Update declarations.
14366         (class File_read::View): Add byteshift_ field.  Add byteshift to
14367         constructor.  Add byteshift method.
14368         * archive.h (Archive::clear_uncached_views): New function.
14369         (Archive::get_view): Add aligned parameter.  Change all callers.
14370         * object.h (Object::get_view): Add aligned parameter.  Change all
14371         callers.
14372         (Object::get_lasting_view): Likewise.
14373
14374         * fileread.cc (File_read::release): Don't call clear_views if
14375         there are multiple objects.
14376         * fileread.h (File_read::clear_uncached_views): New function.
14377         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14378         on the archive.
14379
14380 2008-03-31  Cary Coutant  <ccoutant@google.com>
14381
14382         Add thin archive support.
14383         * archive.cc (Archive::armagt): New const.
14384         (Archive::setup): Remove task parameter and calls to unlock.
14385         (Archive::unlock_nested_archives): New function.
14386         (Archive::read_header): Add nested_off parameter. Change
14387         all callers.
14388         (Archive::interpret_header): Likewise.
14389         (Archive::include_all_members): Change to handle thin
14390         archives.
14391         (Archive::include_member): Likewise.
14392         * archive.h (Archive::Archive): Add new parameters and
14393         initializers.
14394         (Archive::armagt): New const.
14395         (Archive::setup): Remove task parameter.
14396         (Archive::unlock_nested_archives): New function.
14397         (Archive::read_header): Add nested_off parameter.
14398         (Archive::interpret_header): Likewise.
14399         (Archive::Nested_archive_table): New typedef.
14400         (Archive::is_thin_archive_): New field.
14401         (Archive::nested_archives_): New field.
14402         (Archive::options_): New field.
14403         (Archive::dirpath_): New field.
14404         (Archive::task_): New field.
14405         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14406         for thin archives.  Pass additional parameters to
14407         Archive::Archive.  Unlock the archive file after calling
14408         Archive::setup.
14409
14410 2008-03-29  Ian Lance Taylor  <iant@google.com>
14411
14412         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14413         version symbol to be local.
14414         * testsuite/ver_test_4.sh: New file.
14415         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14416         (check_DATA): Add ver_test_4.syms.
14417         (ver_test_4.syms): New target.
14418         * testsuite/Makefile.in: Rebuild.
14419
14420         * output.cc
14421         (Output_section::Input_section_sort_entry::has_priority): New
14422         function.
14423         (Output_section::Input_section_sort_entry::match_file_name): New
14424         function.
14425         (Output_section::Input_section_sort_entry::match_section_name):
14426         Remove.
14427         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14428         Remove.
14429         (Output_section::Input_section_sort_entry::match_section_file):
14430         Remove.
14431         (Output_section::Input_section_sort_compare::operator()): Rewrite
14432         using new Input_section_sort_entry functions.  Sort crtbegin and
14433         crtend first.  Sort sections with no priority before sections with
14434         a priority.
14435         * testsuite/initpri1.c (d3): Check j != 4.
14436         (cd5): New constructor/destructor function.
14437         (main): Check j != 2.
14438
14439         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14440         new symbol when resolving, don't call set_is_default.
14441         * testsuite/ver_test_7.cc: New file.
14442         * testsuite/ver_test_7.sh: New file.
14443         * testsuite/Makefile.am (ver_test_7.so): New target.
14444         (ver_test_7.o): New target.
14445         (check_SCRIPTS): Add ver_test_7.sh.
14446         (check_DATA): Add ver_test_7.syms.
14447         (ver_test_7.syms): New target.
14448
14449 2008-03-28  Ian Lance Taylor  <iant@google.com>
14450
14451         * layout.cc (Layout::layout): If we see an input section with a
14452         name that needs sorting, set the must_sort flag for the output
14453         section.
14454         (Layout::make_output_section): If the name of the output section
14455         indicates that it might require sorting, set the may_sort flag.
14456         * output.h (Output_section::may_sort_attached_input_sections): New
14457         function.
14458         (Output_section::set_may_sort_attached_input_sections): New
14459         function.
14460         (Output_section::must_sort_attached_input_sections): New
14461         function.
14462         (Output_section::set_must_sort_attached_input_sections): New
14463         function.
14464         (class Output_section): Declare Input_section_sort_entry.  Define
14465         Input_section_sort_compare.  Declare
14466         sort_attached_input_sections.  Add new fields:
14467         may_sort_attached_input_sections_,
14468         must_sort_attached_input_sections_,
14469         attached_input_sections_are_sorted_.
14470         * output.cc (Output_section::Output_section): Initialize new
14471         fields.
14472         (Output_section::add_input_section): Add an entry to
14473         input_sections_ if may_sort or must_sort are true.
14474         (Output_section::set_final_data_size): Call
14475         sort_attached_input_sections if necessary.
14476         (Output_section::Input_section_sort_entry): Define new class.
14477         (Output_section::Input_section_sort_compare::operator()): New
14478         function.
14479         (Output_section::sort_attached_input_sections): New function.
14480         * configure.ac: Check whether the compiler supports constructor
14481         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14482         * testsuite/initpri1.c: New file.
14483         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14484         CONSTRUCTOR_PRIORITY.
14485         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14486         (initpri1_LDFLAGS): New variable.
14487         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14488
14489 2008-03-27  Ian Lance Taylor  <iant@google.com>
14490
14491         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14492         * testsuite/common_test_1.c: New file.
14493         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14494         (common_test_1_SOURCES): New variable.
14495         (common_test_1_DEPENDENCIES): New variable.
14496         (common_test_1_LDFLAGS): New variable.
14497
14498         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14499         and commons_ correctly when NAME/VERSION does not override
14500         NAME/NULL.
14501         * testsuite/ver_test_6.c: New file.
14502         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14503         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14504         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14505
14506 2008-03-26  Ian Lance Taylor  <iant@google.com>
14507
14508         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14509         of an undefined symbol from a version script.
14510         * testsuite/Makefile.am (ver_test_5.so): New target.
14511         (ver_test_5.o): New target.
14512         (check_SCRIPTS): Add ver_test_5.sh.
14513         (check_DATA): Add ver_test_5.syms.
14514         (ver_test_5.syms): New target.
14515         * testsuite/ver_test_5.cc: New file.
14516         * testsuite/ver_test_5.script: New file.
14517         * testsuite/ver_test_5.sh: New file.
14518         * Makefile.in, testsuite/Makefile.in: Rebuild.
14519
14520         PR gold/5986
14521         Fix problems building gold with gcc 4.3.0.
14522         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14523         (gold_error_at_location, gold_warning_at_location): Use it.
14524         * configure.ac: Check whether we can compile and use a template
14525         function with a printf attribute.
14526         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14527         when jumping over bytes.
14528         * object.cc: Instantiate Object::read_section_data.
14529         * debug.h: Include <cstring>
14530         * dwarf_reader.cc: Include <algorithm>
14531         * main.cc: Include <cstring>.
14532         * options.cc: Include <cstring>.
14533         * output.cc: Include <cstring>.
14534         * script.cc: Include <cstring>.
14535         * script.h: Include <string>.
14536         * symtab.cc: Include <cstring> and <algorithm>.
14537         * target-select.cc: Include <cstring>.
14538         * version.cc: Include <string>.
14539         * testsuite/testmain.cc: Include <cstdlib>.
14540         * configure, config.in: Rebuild.
14541
14542 2008-03-25  Ian Lance Taylor  <iant@google.com>
14543
14544         * options.cc: Include "../bfd/bfdver.h".
14545         (options::help): Print bug reporting address.
14546
14547         * version.cc (print_version): Adjust output for current value of
14548         BFD_VERSION_STRING.
14549
14550         * NEWS: New file.
14551
14552         * options.cc (options::help): Print list of supported targets.
14553         * target-select.h: Include <vector>.
14554         (class Target_selector): Make machine_, size_, and is_big_endian_
14555         fields const.  Add bfd_name_ and instantiated_target_ fields.
14556         (Target_selector::Target_selector): Add bfd_name parameter.
14557         (Target_selector::recognize): Make non-virtual, call
14558         do_recognize.
14559         (Target_selector::recognize_by_name): Make non-virtual, call
14560         do_recognize_by_name.
14561         (Target_selector::supported_names): New function.
14562         (Target_selector::bfd_name): New function.
14563         (Target_selector::do_instantiate_target): New pure virtual
14564         function.
14565         (Target_selector::do_recognize): New virtual function.
14566         (Target_selector::do_recognize_by_name): New virtual function.
14567         (Target_selector::instantiate_target): New private function.
14568         (supported_target_names): Declare.
14569         * target-select.cc (Target_selector::Target_selector): Update for
14570         new parameter and fields.
14571         (select_target_by_name): Check that the name matches before
14572         calling recognize_by_name.
14573         (supported_target_names): New function.
14574         * i386.cc (class Target_selector_i386): Update Target_selector
14575         constructor call.  Remove recognize and recognize_by_name.  Add
14576         do_instantiate_target.
14577         * x86_64.cc (class Target_selector_x86_64): Likewise.
14578         * testsuite/testfile.cc (class Target_selector_test): Update for
14579         changes to Target_selector.
14580
14581         * README: Rewrite, with some notes on unsupported features.
14582
14583 2008-03-24  Cary Coutant  <ccoutant@google.com>
14584
14585         * i386.cc (Target_i386::Got_type): New enum declaration.
14586         (Target_i386::Scan::local): Updated callers of Output_data_got
14587         member functions.
14588         (Target_i386::Scan::global): Likewise.
14589         (Target_i386::Relocate::relocate): Likewise.
14590         (Target_i386::Relocate::relocate_tls): Likewise.
14591         * object.h (Got_offset_list): New class.
14592         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14593         (Sized_relobj::local_got_offset): Likewise.
14594         (Sized_relobj::set_local_got_offset): Likewise.
14595         (Sized_relobj::local_has_tls_got_offset): Removed.
14596         (Sized_relobj::local_tls_got_offset): Removed.
14597         (Sized_relobj::set_local_tls_got_offset): Removed.
14598         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14599         * output.cc (Output_data_got::add_global): Added got_type parameter.
14600         (Output_data_got::add_global_with_rel): Likewise.
14601         (Output_data_got::add_global_with_rela): Likewise.
14602         (Output_data_got::add_global_pair_with_rel): New function.
14603         (Output_data_got::add_global_pair_with_rela): New function.
14604         (Output_data_got::add_local): Added got_type parameter.
14605         (Output_data_got::add_local_with_rel): Likewise.
14606         (Output_data_got::add_local_with_rela): Likewise.
14607         (Output_data_got::add_local_pair_with_rel): New function.
14608         (Output_data_got::add_local_pair_with_rela): New function.
14609         (Output_data_got::add_global_tls): Removed.
14610         (Output_data_got::add_global_tls_with_rel): Removed.
14611         (Output_data_got::add_global_tls_with_rela): Removed.
14612         (Output_data_got::add_local_tls): Removed.
14613         (Output_data_got::add_local_tls_with_rel): Removed.
14614         (Output_data_got::add_local_tls_with_rela): Removed.
14615         * output.h (Output_data_got::add_global): Added got_type parameter.
14616         (Output_data_got::add_global_with_rel): Likewise.
14617         (Output_data_got::add_global_with_rela): Likewise.
14618         (Output_data_got::add_global_pair_with_rel): New function.
14619         (Output_data_got::add_global_pair_with_rela): New function.
14620         (Output_data_got::add_local): Added got_type parameter.
14621         (Output_data_got::add_local_with_rel): Likewise.
14622         (Output_data_got::add_local_with_rela): Likewise.
14623         (Output_data_got::add_local_pair_with_rel): New function.
14624         (Output_data_got::add_local_pair_with_rela): New function.
14625         (Output_data_got::add_global_tls): Removed.
14626         (Output_data_got::add_global_tls_with_rel): Removed.
14627         (Output_data_got::add_global_tls_with_rela): Removed.
14628         (Output_data_got::add_local_tls): Removed.
14629         (Output_data_got::add_local_tls_with_rel): Removed.
14630         (Output_data_got::add_local_tls_with_rela): Removed.
14631         * resolve.cc (Symbol::override_base_with_special): Removed
14632         reference to has_got_offset_ field.
14633         * symtab.cc (Symbol::init_fields): Replaced initialization
14634         of got_offset_ with got_offsets_.  Removed initialization
14635         of has_got_offset_
14636         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14637         (Symbol::got_offset): Likewise.
14638         (Symbol::set_got_offset): Likewise.
14639         (Symbol::has_tls_got_offset): Removed.
14640         (Symbol::tls_got_offset): Removed.
14641         (Symbol::set_tls_got_offset): Removed.
14642         (Symbol::got_offset_): Removed.
14643         (Symbol::tls_mod_got_offset_): Removed.
14644         (Symbol::tls_pair_got_offset_): Removed.
14645         (Symbol::got_offsets_): New field.
14646         (Symbol::has_got_offset): Removed.
14647         (Symbol::has_tls_mod_got_offset): Removed.
14648         (Symbol::has_tls_pair_got_offset): Removed.
14649         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14650         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14651         member functions.
14652         (Target_x86_64::Scan::global): Likewise.
14653         (Target_x86_64::Relocate::relocate): Likewise.
14654         (Target_x86_64::Relocate::relocate_tls): Likewise.
14655
14656 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14657
14658         * yyscript.y: Fix spelling error in comment.
14659
14660 2008-03-24  Ian Lance Taylor  <iant@google.com>
14661
14662         * options.h (class General_options): Define build_id option.
14663         * layout.h (class Layout): Declare write_build_id, create_note,
14664         create_build_id.  Add build_id_note_ member.
14665         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14666         "libiberty.h", "md5.h", "sha1.h".
14667         (Layout::Layout): Initialize eh_frame_data_,
14668         eh_frame_hdr_section_, and build_id_note_.
14669         (Layout::finalize): Call create_build_id.
14670         (Layout::create_note): New function, broken out of
14671         Layout::create_gold_note.
14672         (Layout::create_gold_note): Call create_note.
14673         (Layout::create_build_id): New function.
14674         (Layout::write_build_id): New function.
14675         (Close_task_runner::run): Call write_build_id.
14676
14677         * x86_64.cc: Correct license to GPLv3.
14678
14679 2008-03-23  Ian Lance Taylor  <iant@google.com>
14680
14681         * options.cc: Include "demangle.h".
14682         (parse_optional_string): New function.
14683         (parse_long_option): Handle takes_optional_argument.
14684         (parse_short_option): Update dash_z initializer.  Handle
14685         takes_optional_argument.
14686         (General_options::General_options): Initialize do_demangle_.
14687         (General_options::finalize): Set do_demangle_.  Handle demangling
14688         style.
14689         * options.h (parse_optional_string): Declare.
14690         (struct One_option): Add optional_arg field.  Update constructor.
14691         Update call constructor calls.  Add takes_optional_argument
14692         function.
14693         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14694         (DEFINE_optional_string): Define.
14695         (General_options::demangle): Change from DEFINE_bool to
14696         DEFINE_optional_string.
14697         (General_options::no_demangle): New function.
14698         (General_options::do_demangle): New function.
14699         (General_options::set_do_demangle): New function.
14700         (General_options::execstack_status_): Move definition to end of
14701         class definition.
14702         (General_options::static_): Likewise.
14703         (General_options::do_demangle_): New field.
14704         * object.cc (big_endian>::get_symbol_location_info): Call
14705         Options::do_demangle, not Options::demangle.
14706         * symtab.cc (demangle): Likewise.
14707
14708 2008-03-22  Ian Lance Taylor  <iant@google.com>
14709
14710         * gold.h: Include <cstddef> and <sys/types.h>
14711         * options.h: Include <cstring>.
14712
14713 2008-03-21  Ian Lance Taylor  <iant@google.com>
14714
14715         * Added source code to GNU binutils.
14716 \f
14717 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14718
14719 Copying and distribution of this file, with or without modification,
14720 are permitted in any medium without royalty provided the copyright
14721 notice and this notice are preserved.
14722
14723 Local Variables:
14724 mode: change-log
14725 left-margin: 8
14726 fill-column: 74
14727 version-control: never
14728 End: