PR gold/15355
[external/binutils.git] / gold / ChangeLog
1 2013-04-22  Alan Modra  <amodra@gmail.com>
2
3         PR gold/15355
4         * layout.cc (Layout::segment_precedes): Allow more than one
5         segment with the same type and flags.
6
7 2013-04-15  Cary Coutant  <ccoutant@google.com>
8
9         * layout.cc (Layout::set_relocatable_section_offsets): Don't
10         allocate space in file for BSS sections.
11
12 2013-04-15  Cary Coutant  <ccoutant@google.com>
13
14         * script-sections.cc (Orphan_output_section): Reset address
15         to zero after each orphaned section for relocatable links.
16
17 2013-04-15  Cary Coutant  <ccoutant@google.com>
18
19         * symtab.cc (Symbol_table::sized_write_globals): Subtract
20         section starting address for relocatable link.
21         * testsuite/Makefile.am (script_test_11): New test.
22         * testsuite/Makefile.in: Regenerate.
23         * testsuite/script_test_11.c: New source file.
24         * testsuite/script_test_11.t: New linker script.
25
26 2013-04-13  Alan Modra  <amodra@gmail.com>
27
28         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
29         owner when sections are not adjacent and exceed group size.
30         (Target_powerpc::group_sections): Handle corner case.
31         (Target_powerpc::Branch_info::make_stub): Handle case where
32         stub table doesn't exist due to branches in non-exec sections.
33         (Target_powerpc::Relocate::relocate): Likewise.
34
35 2013-04-11  Alan Modra  <amodra@gmail.com>
36
37         PR gold/15354
38         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
39         .branch_lt to match bfd ld.  Adjust comments throughout file.
40
41 2013-04-04  Ian Lance Taylor  <iant@google.com>
42
43         GCC PR c++/56840
44         * object.cc (do_layout_deferred_sections): Handle .eh_frame
45         sections before checking whether they are included in the link.
46
47 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
48
49         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
50         object before calling the plugin claim_file handler.  Pass the elf
51         object of the archive to the plugin. Delete the elf object if the
52         plugin claims the file.
53
54 2013-03-21  Alan Modra  <amodra@gmail.com>
55
56         * layout.cc (Layout::set_segment_offsets): Accept writable .text
57         segment when omagic.
58
59 2013-03-21  Alan Modra  <amodra@gmail.com>
60
61         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
62         comparison warning.
63         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
64         uninitialized" warning.
65
66 2013-03-20  Alan Modra  <amodra@gmail.com>
67
68         * symtab.h (Symbol::clear_version): New function.
69         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
70         is_needed by weak references.  Clear version for symbols defined
71         in as-needed objects that are not needed.
72
73 2013-03-15  Alan Modra  <amodra@gmail.com>
74
75         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
76         static and public.  Add report_err param.  Return false for data refs.
77         (Target_powerpc::rela_dyn_section): New overloaded function.
78         (Target_powerpc::plt_, iplt_): Elucidate.
79         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
80         (Output_data_plt_powerpc::do_write): Don't write .iplt.
81         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
82         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
83         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
84         push_branch and make_plt_entry for ifunc syms when
85         reloc_needs_plt_for_ifunc.
86         (Target_powerpc::Relocate::relocate): Don't use plt entry value
87         for ifunc unless reloc_needs_plt_for_ifunc.
88
89 2013-03-15  Alan Modra  <amodra@gmail.com>
90
91         * gc.h (gc_process_relocs): Don't look through function descriptors.
92         * icf.cc (get_section_contents): Do so here instead.
93
94 2013-03-13  Alan Modra  <amodra@gmail.com>
95
96         * powerpc.cc (is_branch_reloc): Forward declare.
97         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
98         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
99         false for 64-bit, true for 32-bit non-branch relocs.
100         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
101         * testsuite/Makefile.am (icf_test): Use linker map file instead of
102         nm output.
103         (icf_safe_test): Generate linker map file as well as nm output.
104         (icf_safe_so_test): Likewise.
105         * testsuite/Makefile.in: Regenerate.
106         * testsuite/icf_test.sh: Parse linker map file to determine
107         section folding.
108         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
109         * testsuite/icf_safe_so_test.sh: Likewise.
110         (X86_32_or_ARM_specific_safe_fold): Merge into..
111         (arch_specific_safe_fold): ..this.
112         (X86_64_specific_safe_fold): Delete unused function.
113
114 2013-03-12  Alan Modra  <amodra@gmail.com>
115
116         * gc.h (gc_process_relocs): Look through function descriptors
117         to determine shndx, symvalue and addend used by ICF.  Tidy
118         variable duplication.
119
120 2013-03-11  Alan Modra  <amodra@gmail.com>
121
122         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
123         * layout.cc (Layout_task_runner::run): ..to here.
124         * symtab.h (struct Symbol_location): Extract from..
125         (class Symbol_table): ..here.
126         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
127         * target.h (class Target): Add function_location and
128         do_function_location functions.
129         (class Sized_target): Add do_function_location.
130         * object.h (class Sized_relobj_file): Move find_shdr..
131         (class Object): ..to here.
132         * object.cc: Likewise.  Update to suit.  Instantiate.
133         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
134         * powerpc.cc (class Powerpc_dynobj): New.
135         (Target_powerpc::do_function_location): New function.
136         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
137         (Powerpc_dynobj::do_read_symbols): New function.
138         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
139
140 2013-03-08  Ian Lance Taylor  <iant@google.com>
141
142         * options.cc (General_options::string_to_object_format): Accept
143         "default".
144
145 2013-03-08  Alan Modra  <amodra@gmail.com>
146
147         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
148         pointer to Post_fde.
149         (struct Post_fde): Move definition to here..
150         * ehframe.cc (struct Post_fde): ..from here.
151         (Cie::write): Don't alloc Post_fde.
152         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
153
154 2013-03-07  Alan Modra  <amodra@gmail.com>
155
156         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
157         relocation referencing .LC0.
158         * testsuite/discard_locals_test.sh: Remove FIXMEs.
159
160 2013-03-07  Alan Modra  <amodra@gmail.com>
161
162         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
163         always_inline.  Add assembly for powerpc to avoid GOT.
164
165 2013-03-07  Alan Modra  <amodra@gmail.com>
166
167         * testsuite/script_test_10.sh: Don't test .bss section
168         header number.
169
170 2013-03-06  Alan Modra  <amodra@gmail.com>
171
172         * powerpc.cc (class Powerpc_relobj): Move some member functions.
173         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
174         all callers.  Handle folded sections.
175         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
176         to Powerpc_relobj.
177         (Global_symbol_visitor_opd::operator()): Likewise.
178
179 2013-03-04  Alan Modra  <amodra@gmail.com>
180
181         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
182         * testsuite/Makefile.in: Regenerate.
183
184 2013-03-01  Cary Coutant  <ccoutant@google.com>
185
186         Add dwp support for v2 DWARF package file format.
187         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
188         tu_length parameter.  Adjust all callers.
189         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
190         * dwp.cc: Include dwarf.h.
191         (Section_bounds): New struct type.
192         (Unit_set): New struct type.
193         (Dwo_file::Dwo_file): Initialize new data member.
194         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
195         Combine and rename to...
196         (Dwo_file::read_unit_index): ...this.
197         (Dwo_file::sized_read_compunit_index)
198         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
199         (Dwo_file::sized_read_unit_index): ...this.
200         (Dwo_file::copy_section): Remove section_name, is_str_offsets
201         parameters; add section_id parameter.
202         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
203         (Dwo_file::add_unit_set): ...this.
204         (Dwo_file::shndx_map_): Remove.
205         (Dwo_file::sect_offsets_): New data member.
206         (Dwp_output_file::Dwp_output_file): Initialize new data members.
207         (Dwp_output_file::add_section): Rename to...
208         (Dwp_output_file::add_contribution): ...this.
209         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
210         (Dwp_output_file::add_tu_set): Likewise.
211         (Dwp_output_file::Contribution): New type.
212         (Dwp_output_file::Section::contributions): New data member.
213         (Dwp_output_file::Cu_or_tu_set): Remove.
214         (Dwp_output_file::Section::Section): New ctor.
215         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
216         (Dwp_output_file::Dwp_index::Section_table): New type.
217         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
218         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
219         parameter.
220         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
221         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
222         (Dwp_output_file::Dwp_index::section_table): New member function.
223         (Dwp_output_file::Dwp_index::section_table_end): New member function.
224         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
225         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
226         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
227         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
228         (Dwp_output_file::Dwp_index::section_table_): New data member.
229         (Dwp_output_file::Dwp_index::section_mask_): New data member.
230         (Dwp_output_file::add_output_section): New member function.
231         (Dwp_output_file::write_new_section): New member function.
232         (Dwp_output_file::write_contributions): New member function.
233         (Dwp_output_file::section_id_map_): New data member.
234         (class Dwo_id_info_reader): Remove.
235         (class Unit_reader): New class.
236         (get_dwarf_section_name): New function.
237         (Dwo_file::read_executable): Adjust initializations of class data.
238         (Dwo_file::read): Add support for v2 package file format.
239         (Dwo_file::read_unit_index): Likewise.
240         (Dwo_file::sized_read_unit_index): Likewise.
241         (Dwo_file::copy_section): Likewise.
242         (Dwo_file::add_unit_set): Likewise.
243         (Dwp_output_file::add_output_section): Likewise.
244         (Dwp_output_file::add_contribution): Likewise.
245         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
246         for empty slot.
247         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
248         file format.
249         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
250         slot.
251         (Dwp_output_file::initialize): Remove unused function.
252         (Dwp_output_file::finalize): Add support for v2 package file format.
253         (Dwp_output_file::write_index): Likewise.
254         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
255         function prototype.
256
257 2013-03-01  Cary Coutant  <ccoutant@google.com>
258
259         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
260         function into class definition in header file.
261         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
262         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
263         New function.
264         (Dwarf_info_reader::check_buffer): Move here from .cc file.
265
266 2013-02-28  Alan Modra  <amodra@gmail.com>
267
268         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
269         * target.cc (Target::do_plt_fde_location): New function.
270         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
271         accessor function, and constructor param.
272         (struct Post_fde, Post_fdes): Declare.
273         (Cie::write): Add post_fdes param.
274         * ehframe.cc (Fde::write): Use plt_fde_location.
275         (struct Post_fde): Define.
276         (Cie::write): Stash FDEs added post merge mapping.
277         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
278         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
279         (Eh_frame::do_sized_write): Arrange to write post map FDES after
280         other FDEs.
281         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
282         (Target_powerpc::has_glink): New function.
283         (Target_powerpc::do_relax): Add eh_frame info for stubs.
284         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
285         glink_eh_frame_fde_32, default_fde): New data.
286         (Stub_table::eh_frame_added_): New var.
287         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
288         Make const.
289         (Stub_table::add_eh_frame): New function.
290         (Output_data_glink::add_eh_frame): New function.
291         (Target_powerpc::make_glink_section): Call add_eh_frame.
292
293 2013-02-15  Ian Lance Taylor  <iant@google.com>
294
295         * options.h (DEFINE_uint64_alias): Define.
296         (class General_options): Add -Ttext-segment as an alias for
297         -Ttext.
298
299 2013-02-15  Alan Modra  <amodra@gmail.com>
300
301         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
302         (Stub_table::do_write): ..here, two places.
303         (Stub_table::plt_call_size): Use it here too.
304
305 2013-02-11  Ian Lance Taylor  <iant@google.com>
306
307         * descriptors.cc (Descriptors::close_all): New function.
308         * descriptors.h (class Descriptors): Declare close_all.
309         (close_all_descriptors): New inline function.
310         * plugin.cc: Include "descriptors.h".
311         (Plugin_manager::cleanup): Call close_all_descriptors.
312
313 2013-02-06  Alan Modra  <amodra@gmail.com>
314
315         * README: Update coding style link.
316
317 2013-01-28  Cary Coutant  <ccoutant@google.com>
318
319         * dwp.cc (File_list): New typedef.
320         (Dwo_name_info_reader): New class.
321         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
322         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
323         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
324         (Dwo_file::read_executable): New function.
325         (Dwo_file::read): Move common setup code to ...
326         (Dwo_file::make_object): ... here.
327         (dwp_options): Add --exec/-e.
328         (usage): Likewise.
329         (main): Likewise.
330
331 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
332
333         * layout.cc (Layout::layout): Check for option text_reorder.
334         (Layout::make_output_section): Ditto.
335         * options.h (text_reorder): New option.
336         * output.cc (Input_section_sort_compare): Remove special ordering
337         of section names.
338         (Output_section::
339          Input_section_sort_section_name_special_ordering_compare::
340          operator()): New function.
341         (Output_section::sort_attached_input_sections): Use new sort function
342         for .text.
343         * output.h (Input_section_sort_section_name_special_ordering_compare):
344         New struct.
345         * testsuite/Makefile.am (text_section_grouping): Test option
346         --no-text-reorder
347         * testsuite/Makefile.in: Regenerate.
348         * testsuite/text_section_grouping.sh: Check order of functions without
349         default text reordering.
350
351 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
352
353         * options.h (General_options): Change default to true for new_dtags.
354
355 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
356
357         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
358         when enable_new_dtags is false.  Only add DT_RUNPATH when
359         enable_new_dtags is true.
360
361 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
362
363         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
364         used in declaration and definition consistent.
365         (Target_powerpc::symval_for_branch): Ditto.
366
367 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
368
369         * testsuite/plugin_final_layout.cc: Fix comment.
370
371 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
372
373         * layout.cc (Layout::layout): Do not do default sorting for
374         text sections when section ordering is specified.
375         (make_output_section): Ditto.
376         * testsuite/plugin_final_layout.cc: Name the function sections
377         to catch reordering issues.
378
379 2013-01-15  Alan Modra  <amodra@gmail.com>
380
381         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
382         plt-thread-safe.
383
384 2013-01-15  Alan Modra  <amodra@gmail.com>
385
386         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
387         * testsuite/Makefile.in: Regenerate.
388
389 2013-01-14  Alan Modra  <amodra@gmail.com>
390
391         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
392         * testsuite/Makefile.in: Regenerate.
393
394 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
395
396         PR bfd/14430
397         Fix mingw gold build with plugins enabled
398         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
399         * configure.ac: Export DLOPEN_LIBS and add headers check.
400         * plugin.cc: Handle non-dlfcn case.
401         * Makefile.in: Regenerate.
402         * config.in: Regenerate.
403         * configure: Regenerate.
404         * testsuite/Makefile.in: Regenerate.
405
406 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
407
408         * output.h (sort_attached_input_sections): Change to be public.
409         * script-sections.cc
410         (Output_section_definition::set_section_addresses): Sort
411         attached input sections according to section order before linker
412         script assigns section addresses.
413         (Orphan_output_section::set_section_addresses): Sort
414         attached input sections according to section order before linker
415         script assigns section addresses.
416         * Makefile.am (final_layout.sh): Use a simple linker script to
417         check if section ordering still works.
418         * Makefile.in: Regenerate.
419
420 2013-01-09  Ben Cheng  <bccheng@google.com>
421
422         * arm.cc (Target_arm::attributes_accept_div): New function.
423         (Target_arm::attributes_forbid_div): New function.
424         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
425         attribute using the same new functions as what bfd/elf32_arm.c
426         does.
427
428 2013-01-07  Cary Coutant  <ccoutant@google.com>
429
430         PR gold/14993
431         * output.cc (Output_section::add_input_section): For incremental
432         updates, don't track input sections that are allocated from patch
433         space.
434
435 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
436             Ian Lance Taylor  <iant@google.com>
437
438         PR gold/14897
439         * configure.ac (--enable-ld): Removed.
440         (install_as_default): Set to yes only for --enable-gold=default
441         or --disable-ld.
442         * configure: Regenerated.
443
444 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
445
446         * options.h (General_options): Add -fuse-ld= for GCC linker
447         option compatibility.
448
449 2013-01-04  Cary Coutant  <ccoutant@google.com>
450
451         * configure.ac: Fix typo restoring CXXFLAGS.
452         * configure: Regenerate.
453
454 2013-01-04  Cary Coutant  <ccoutant@google.com>
455
456         * testsuite/Makefile.am (CXXLINK_S): New macro.
457         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
458         * testsuite/Makefile.in: Regenerate.
459
460 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
461
462         * version.cc (print_version): Update copyright year to 2013.
463
464 2012-12-20  Ian Lance Taylor  <iant@google.com>
465
466         * layout.cc (Layout::special_ordering_of_input_section): New
467         function.
468         (Layout::layout): If input section requires special ordering, must
469         sort input sections.
470         (Layout::make_output_section): May sort .text input sections.
471         (Layout::is_section_name_prefix_grouped): Remove.
472         * layout.h (class Layout): Declare
473         special_ordering_of_input_section.  Don't declare
474         is_section_name_prefix_grouped.
475         * output.cc (Output_section::add_input_section): Revert last
476         change.
477         (Output_section::Input_section_sort::match_file_name): Don't crash
478         if called on output section data.
479         (Output_section::Input_section_sort_compare): Sort based on
480         special ordering.
481         (Output_section::Input_section_sort_section_order_index_compare):
482         Revert last patch.
483         (Output_section::sort_attached_input_sections): Likewise.
484
485 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
486
487         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
488         * layout.h (Layout::is_section_name_prefix_grouped): New function.
489         * output.cc (Output_section::add_input_section): Check if section
490         name contains special prefix.  Keep input sections to sort such
491         sections.
492         (Output_section::Input_section_sort_section_order_index_compare
493          ::operator()): Group sections according to prefixes.
494         (Output_section::sort_attached_input_sections): Add condition to
495         Input_section_entry constructor call.
496         * testsuite/Makefile.am (text_section_grouping): New test.
497         * testsuite/Makefile.in: Regenerate.
498         * testsuite/text_section_grouping.cc: New file.
499         * testsuite/text_section_grouping.sh: New file.
500
501 2012-12-17  Nick Clifton  <nickc@redhat.com>
502
503         * Makefile.am: Add copyright notice.
504         * NEWS: Likewise.
505         * README: Likewise.
506         * configure.ac: Likewise.
507         * ftruncate.c: Likewise.
508         * Makefile.in: Regenerate.
509
510 2012-12-14  Cary Coutant  <ccoutant@google.com>
511
512         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
513         --no-as-needed flag.
514         (exception_separate_shared_12_test): Likewise.
515         (incremental_copy_test): Likewise.
516         * testsuite/Makefile.in: Regenerate.
517
518 2012-12-14  Cary Coutant  <ccoutant@google.com>
519
520         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
521         (Dwp_output_file::Dwp_index::enter_set): Add assert.
522
523 2012-12-12  Alan Modra  <amodra@gmail.com>
524
525         * powerpc.cc (class Track_tls): New.
526         (class Relocate, class Scan): Inherit Track_tls.
527         (Target_powerpc::Scan::local, global): Track tls optimization
528         and avoid creating plt entry for __tls_get_addr if all uses
529         are optimized away.
530         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
531
532 2012-12-12  Alan Modra  <amodra@gmail.com>
533
534         * options.h (General_options): Add --toc-sort/--no-toc-sort.
535         Replace no_toc_optimize with toc_optimize.
536         * output.h (Output_section::input_sections): Provide non-const variant.
537         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
538         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
539         accessors.
540         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
541         (class Sort_toc_sections): New.
542         (Target_powerpc::do_finalize_sections): Sort toc sections.
543         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
544
545 2012-12-10  Roland McGrath  <mcgrathr@google.com>
546
547         * testsuite/binary_unittest.cc (read_all): New function.
548         (Sized_binary_test): Use it instead of ::read.
549         * fileread.cc (do_read): Don't assume pread always reads the whole
550         amount in a single call.
551
552 2012-12-10  Alan Modra  <amodra@gmail.com>
553
554         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
555         Set EM_PPC64 or EM_PPC here.
556         (Target_selector_powerpc::do_recognize): Delete.
557
558 2012-12-10  Alan Modra  <amodra@gmail.com>
559
560         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
561         stub_table_.
562         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
563
564 2012-12-07  Roland McGrath  <mcgrathr@google.com>
565
566         * testsuite/binary_unittest.cc (Sized_binary_test):
567         Use open_descriptor rather than ::open.
568
569 2012-12-07  Alan Modra  <amodra@gmail.com>
570
571         * powerpc.cc (Stub_table::do_write): Delete redundant Address
572         typedef and invalid_address constant.
573         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
574         instantiate constants.
575
576 2012-12-06  Roland McGrath  <mcgrathr@google.com>
577
578         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
579         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
580         * aclocal.m4: Regenerate.
581         * configure: Regenerate.
582         * Makefile.in: Regenerate.
583         * testsuite/Makefile.in: Regenerate.
584
585 2012-12-07  Alan Modra  <amodra@gmail.com>
586
587         * options.h (General_options): Add no_toc_optimize.
588         * powerpc.cc (ok_lo_toc_insn): New function.
589         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
590
591 2012-12-06  Alan Modra  <amodra@gmail.com>
592
593         * options.h (General_options): Add plt_align, plt_static_chain,
594         plt_thread_safe.  Update stub_group_size help text.
595         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
596         for new plt_thread_safe_ var.
597         (use_plt_offset): Correct comments.
598         (Target_powerpc::do_relax): Look for thread creation symbols to
599         determine default plt_thread_safe value.  Clear plt call stubs
600         as well as branch stubs each iteration.
601         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
602         insn constants.
603         (l, hi, ha, write_insn): Move earlier.
604         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
605         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
606         plt stubs too.
607         (Stub_table::update_size): Adjust.
608         (Stub_table::prev_size, set_prev_size): Delete.
609         (Stub_table::stub_align): Let --plt-align affect result.
610         (Stub_table::plt_call_size): Calculate sizes for various stubs.
611         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
612         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
613         (Stub_table::do_write): Support more stub variants.
614
615 2012-12-04  Alan Modra  <amodra@gmail.com>
616
617         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
618         (Target_powerpc::do_define_standard_symbols): New function.
619
620 2012-12-03  Alan Modra  <amodra@gmail.com>
621
622         * output.h: Formatting, whitespace.
623
624 2012-12-03  Alan Modra  <amodra@gmail.com>
625
626         * layout.h (Layout::get_executable_sections): Declare.
627         * layout.cc (Layout::get_executable_sections): New function.
628         * arm.cc (Target_arm::group_sections): Use it.
629         (Arm_output_section::group_sections): Delete now redundant test.
630         * output.cc (Output_reloc::Output_reloc): Add is_relative.
631         param to handle relative relocs.
632         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
633         (Output_data_reloc::add_absolute): Adjust.
634         (Output_data_reloc::add_relative): New function.
635         (Output_data::reset_data_size): New function.
636         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
637         (Output_section::set_addralign): New function.
638         (Output_section::checkpoint_set_addralign): New function.
639         (Output_section::clear_section_offsets_need_adjustment): New function.
640         (Output_section::input_sections): Make public.
641         * powerpc.cc (class Output_data_brlt_powerpc): New.
642         (class Stub_table, class Stub_control): New.
643         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
644         stub_table_, set_stub_table, stub_table): New vectors and accessor
645         functions.
646         (Target_powerpc::do_may_relax, do_relax, push_branch,
647         new_stub_table, stub_tables, brlt_section, group_sections,
648         add_branch_lookup_table, find_branch_lookup_table,
649         write_branch_lookup_table, make_brlt_section): New functions.
650         (Target_powerpc::struct Sort_sections, class Branch_info): New.
651         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
652         branch_info_): New vars.
653         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
654         make call stubs here.
655         (Output_data_glink): Remove all call stub handling from this class.
656         (Target_powerpc::Scan::local, global): Save interesting branch
657         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
658         (Target_powerpc::do_finalize_sections): Only make reg save/restore
659         functions on final link.
660         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
661         Handle long branch destinations too.
662         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
663         do_plt_address_for_local): Adjust lookup of plt call stubs.
664
665 2012-11-30  Alan Modra  <amodra@gmail.com>
666
667         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
668         relocs against protected symbols when building 32-bit shared libs.
669
670 2012-11-30  Alan Modra  <amodra@gmail.com>
671
672         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
673         param.  Call got_section() to make .got.  Update all callers
674         and their callers and so on.
675
676 2012-11-30  Alan Modra  <amodra@gmail.com>
677
678         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
679         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
680         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
681         value if it already exists.
682
683 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
684
685         PR gold/14858
686         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
687
688 2012-11-14  Roland McGrath  <mcgrathr@google.com>
689
690         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
691         than bfc instruction for data sandboxing.
692
693 2012-11-08  Alan Modra  <amodra@gmail.com>
694
695         * po/POTFILES.in: Regenerate.
696
697 2012-11-05  Alan Modra  <amodra@gmail.com>
698
699         * configure.ac: Apply 2012-09-10 change to config.in here.
700         * configure: Regenerate.
701
702 2012-11-05  Alan Modra  <amodra@gmail.com>
703
704         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
705         (struct Opd_ent): Use "Address" rather than "Offset".
706         (Output_data_got_powerpc::got_base_offset): Return Valtype.
707         (Target_powerpc::got_section): Make public.
708         (Target_powerpc::scan_relocs): Move code setting symbols..
709         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
710         Create _SDA_BASE_ only when referenced.
711
712 2012-11-02  Roland McGrath  <mcgrathr@google.com>
713
714         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
715         from last change.
716
717 2012-11-01  Roland McGrath  <mcgrathr@google.com>
718
719         * target.h (Sized_target::relocate_relocs): Use Elf_Off
720         for offset_in_output_section parameter.
721         (Sized_target::relocate_special_relocatable): Likewise.
722         * arm.cc (Target_arm::relocate_relocs): Likewise.
723         (Target_arm::relocate_special_relocatable): Likewise.
724         * i386.cc (Target_i386::relocate_relocs): Likewise.
725         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
726         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
727         * target-reloc.h (relocate_relocs): Likewise.
728         * testsuite/testfile.cc (Target_test): Likewise.
729         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
730         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
731
732         * system.h: Move inclusion of <clocale> to after <libintl.h> in
733         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
734
735         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
736         parameter, which is unused in the [!F_SETFD] case.
737
738         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
739         SYMNDX to off_t before comparing it to this->data_size().
740         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
741         * incremental.cc (Output_section_incremental_inputs::do_write):
742         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
743
744         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
745
746 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
747
748         * gold.cc (Target_arm::do_adjust_elf_header): Add the
749         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
750         in EABI_VER5.
751
752 2012-10-29  Cary Coutant  <ccoutant@google.com>
753
754         * dwp.cc (usage): Add file and exit status parameters;
755         add --help and --version options.
756         (print_version): New function.
757         (main): Add --help and --version options.
758
759 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
760
761         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
762         final_layout_sequence.txt.
763         * testsuite/Makefile.in: Regenerated.
764
765 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
766
767         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
768         COMPILE generated by automake.
769         (LINK1): Likewise.
770         (CXXCOMPILE1): Likewise.
771         (CXXLINK1): Likewise.
772         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
773         (LINK): Likewise.
774         (CXXCOMPILE): Likewise.
775         (CXXLINK): Likewise.
776         * testsuite/Makefile.in: Regenerated.
777
778 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
779
780         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
781         on bad fwrite return.
782
783 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
784
785         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
786         on val.
787
788 2012-10-23  Cary Coutant  <ccoutant@google.com>
789
790         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
791         * testsuite/Makefile.in: Regenerate.
792         * testsuite/dwp_test.h: New source file.
793         * testsuite/dwp_test_1.cc: New source file.
794         * testsuite/dwp_test_1.s: New source file.
795         * testsuite/dwp_test_1.sh: New source file.
796         * testsuite/dwp_test_1b.cc: New source file.
797         * testsuite/dwp_test_1b.s: New source file.
798         * testsuite/dwp_test_2.cc: New source file.
799         * testsuite/dwp_test_2.s: New source file.
800         * testsuite/dwp_test_2.sh: New source file.
801         * testsuite/dwp_test_main.cc: New source file.
802         * testsuite/dwp_test_main.s: New source file.
803
804 2012-10-23  Cary Coutant  <ccoutant@google.com>
805
806         * dwp.h: New header file.
807         * dwp.cc: New source file.
808         * gold.h: Move shared declarations to system.h.
809         * system.h: New header file.
810         * Makefile.am: Add dwp.
811         * Makefile.in: Regenerate.
812
813 2012-10-23  Cary Coutant  <ccoutant@google.com>
814
815         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
816         Dwarf_info_reader::read_from_pointer.
817         (Dwarf_pubnames_table::read_header): Likewise.
818         (Dwarf_pubnames_table::next_name): Likewise.
819         (Dwarf_die::read_attributes): Likewise.
820         (Dwarf_die::skip_attributes): Likewise.
821         (Dwarf_info_reader::read_from_pointer): New function template.
822         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
823         (Dwarf_pubnames_table): Likewise.
824         (Dwarf_info_reader::read_from_pointer): New function template.
825         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
826         Dwarf_pubnames_table ctor.
827
828 2012-10-23  Cary Coutant  <ccoutant@google.com>
829
830         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
831         abbrev_shndx.
832         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
833         abbrev_shndx_.
834         (Dwarf_info_reader::set_abbrev_shndx): New method.
835         (Dwarf_info_reader::abbrev_shndx_): New data member.
836
837 2012-10-23  Cary Coutant  <ccoutant@google.com>
838
839         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
840         from object, not parameters.
841         (Dwarf_info_reader::parse): Likewise.
842         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
843         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
844         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
845         methods.
846
847 2012-10-23  Cary Coutant  <ccoutant@google.com>
848
849         * fileread.cc (Input_file::Input_file): New constructor.
850         * fileread.h (class Input_file): Add new constructor.
851
852 2012-10-18  Alan Modra  <amodra@gmail.com>
853
854         PR gold/14727
855         * object.cc (Relobj::is_section_name_included): Also match
856         .sdata personality section.
857
858 2012-10-18  Alan Modra  <amodra@gmail.com>
859
860         * target-reloc.h (class Default_comdat_behavior): New, package up..
861         (get_comdat_behaviour): ..this.
862         (relocate_section): Add Relocate_comdat_behavior template arg,
863         adjust code to suit.
864         * arm.cc (Target_arm::relocate_section): Adjust to suit.
865         (Target_arm::scan_reloc_section): Likewise.
866         * i386.cc (Target_i386::relocate_section): Likewise.
867         * sparc.cc (Target_sparc::relocate_section): Likewise.
868         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
869         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
870         * powerpc.cc (class Relocate_comdat_behavior): New.
871         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
872         gold::relocate_section with new template arg.
873
874 2012-10-18  Alan Modra  <amodra@gmail.com>
875
876         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
877         dynamic relocs for GOT_TPREL got entries, without symbol if
878         resolving locally.
879         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
880         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
881         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
882
883 2012-10-17  Alan Modra  <amodra@gmail.com>
884
885         PR gold/14726
886         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
887
888 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
889
890         * layout.cc (Layout::include_section): Keep sections marked
891         SHF_EXCLUDE when doing relocatable links.
892
893 2012-10-16  Alan Modra  <amodra@gmail.com>
894
895         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
896         (Target_powerpc::do_finalize_sections): Call it.
897         (Output_data_save_res): New class and supporting functions.
898         (Target_powerpc::symval_for_branch): Only look up .opd entry for
899         normal symbols defined in object files.
900
901 2012-10-12  Alan Modra  <amodra@gmail.com>
902
903         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
904         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
905         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
906         section if scan_opd_relocs not yet called.
907         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
908
909 2012-10-12  Alan Modra  <amodra@gmail.com>
910
911         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
912         add_local_ifunc_entry): Revert last change.
913         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
914
915 2012-10-05  Alan Modra  <amodra@gmail.com>
916
917         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
918         do_plt_address_for_global): New functions.
919         (Output_data_got_powerpc::do_write): Don't segfault when linking
920         statically.
921         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
922         add_local_ifunc_entry): Return true on adding entry..
923         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
924         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
925         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
926         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
927         set up symbols here.
928         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
929         syms here.  Do so even when no .iplt.  Don't segfault when linking
930         statically.
931         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
932         new variants without reloc param.
933         (Glink_sym_ent::Glink_sym_ent): Likewise.
934         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
935         reloc when refs will resolve to plt call stub.
936         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
937         R_PPC_PLTREL24 to resolve locally.
938         (Target_powerpc::Scan::global): Correct ifunc handling.
939         (Target_powerpc::Relocate::relocate): Correct local sym glink
940         lookup.  Don't destroy "value" when we have a plt call stub,
941         and when checking plt call validity.
942         (Target_powerpc::do_dynsym_value): Simplify.
943
944 2012-10-05  Alan Modra  <amodra@gmail.com>
945
946         * i386.cc (Output_data_plt_i386::address_for_global,
947         address_for_local): Add plt offset to returned value.  Adjust uses.
948         * sparc.cc (Output_data_plt_sparc::address_for_global,
949         address_for_local): Likewise.
950         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
951         address_for_local): Likewise.
952         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
953         address_for_local): Likewise.
954         * target.h (Target::plt_address_for_global, plt_address_for_local):
955         Update comment.
956         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
957         (Output_data_got::Got_entry::write): Nor here.
958         * output.h: Comment fix.
959
960 2012-10-02  Jiong Wang  <jiwang@tilera.com>
961
962         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
963         global_offset_table_ value for larget got.
964         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
965
966 2012-09-29  Alan Modra  <amodra@gmail.com>
967
968         * powerpc.cc (Target_powerpc::iplt_): New output section.
969         (Target_powerpc::iplt_section, make_iplt_section,
970         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
971         (Target_powerpc::make_plt_entry): Handle ifunc syms.
972         Target_powerpc::plt_entry_count): Count iplt entries too.
973         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
974         reloc section in constructor.  New params.
975         (Target_powerpc::make_plt_section): Create reloc section here instead.
976         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
977         functions.
978         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
979         (Output_data_glink::add_entry, find_entry): New functions to
980         deal with local syms.
981         (Glink_sym_ent): Add support for local syms.
982         (Output_data_glink::do_write): Handle ifunc plt entries.
983         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
984         (Target_powerpc::Scan::local, global): Handle ifunc syms.
985         (Target_powerpc::Relocate::relocate): Likewise.
986         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
987
988 2012-09-25  Alan Modra  <amodra@gmail.com>
989
990         * object.h (Sized_relobj_file::adjust_local_symbol,
991         do_adjust_local_symbol): New functions.
992         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
993         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
994         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
995         and irregular opd entry spacing.
996         (Powerpc_relobj::do_read_relocs): Add opd size checks.
997         (Global_symbol_visitor_opd): New functor.
998         (Target_powerpc::do_finalize_sections): Omit global symbols defined
999         on deleted opd entries.
1000
1001 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1002
1003         * tilegx.cc: New file.
1004         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1005         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1006         * configure.tgt: Add entries for tilegx*.
1007         * configure.ac: Likewise.
1008         * Makefile.in: Rebuild.
1009         * configure: Likewise.
1010         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1011         tilegx.
1012
1013 2012-09-13  Alan Modra  <amodra@gmail.com>
1014
1015         * target-reloc.h (scan_relocs): Call scan.local for relocs
1016         against symbols in discarded sections.  Pass is_discarded
1017         param.
1018         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1019         Add is_discarded param.
1020         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1021         is_discarded to flag opd entry as discarded.  Don't emit dyn
1022         relocs on such entries.
1023         (Target_powerpc::Scan::global): Similarly detect and handle
1024         such opd entries.
1025         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1026         opd_ent_.  Update all uses.
1027         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1028         (Target_powerpc::relocate_section): Zero out discarded opd
1029         entry relocs.
1030
1031 2012-09-12  Ian Lance Taylor  <iant@google.com>
1032
1033         PR gold/14570
1034         * output.cc: Rename Output_data_got template parameter from size
1035         to got_size for all functions.  Compile all variants of
1036         Output_data_got.
1037         (Output_data_got::Got_entry::write): Correct use of size for
1038         symbol value.  Use local_is_tls rather than casting to
1039         Sized_relobj_file.
1040         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1041         (class Sized_relobj_file): Add do_local_is_tls.
1042         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1043
1044 2012-09-11  Alan Modra  <amodra@gmail.com>
1045
1046         PR gold/14566
1047         * layout.cc (Layout::set_segment_offsets): When using
1048         common-page-size alignment, ensure we are on a new max-page-size
1049         page.
1050         * output.cc (Output_segment::set_section_addresses): Use
1051         abi_pagesize, not common_pagesize for relro boundary.
1052         (Output_segment::set_offset): Likewise.
1053
1054 2012-09-11  Alan Modra  <amodra@gmail.com>
1055
1056         * output.h (Output_data_got::add_global_tls, add_local_tls,
1057         add_local_tls_pair): New functions.
1058         (Output_data_got::add_local_pair_with_rel): Remove second
1059         reloc param.  Expand comment.
1060         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1061         use_plt_or_tls_offset_, similarly for constructor param.
1062         (Output_data_got::Got_entry::write): Add got_index param.
1063         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1064         add_local_tls_pair): New functions.
1065         (Output_data_got::Got_entry::write): Handle tls symbols
1066         with use_plt_or_tls_offset_ set specially.
1067         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1068         (Output_data_got::do_write): Replace iterator with index, pass
1069         index to entry write function.
1070         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1071         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1072         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1073         call.
1074         * i386.cc (Target_i386::Scan::local): Likewise.
1075         * sparc.cc (Target_sparc::Scan::local): Likewise.
1076         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1077         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1078         do_tls_offset_for_global): New functions.
1079         (Target_powerpc::Scan::local): Correct TLS relocations and got
1080         entry values.
1081         (Target_powerpc::Scan::global): Don't emit unnecessary
1082         dynamic relocations on TLS GOT entries.
1083
1084 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1085
1086         * config.in: Disable sanity check for kfreebsd.
1087
1088 2012-09-10  Sterling Augustine  <saugustine@google.com>
1089
1090         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1091         (Gdb_index::pubtypes_read): New parameter.
1092         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1093         to calls.
1094         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1095         pubtypes_object_.
1096
1097 2012-09-09  Alan Modra  <amodra@gmail.com>
1098
1099         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1100         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1101         * gc.h (gc_process_relocs): Call target gc_add_reference.
1102         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1103         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1104         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1105         unnecessary cast.
1106         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1107         to cater for when we don't need code offset.  Update use.
1108         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1109         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1110         set_opd_valid): New functions.
1111         (Target_powerpc::do_gc_add_reference): New function.
1112         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1113         stashed refs.
1114         (Target_powerpc::do_gc_mark_symbol): New function.
1115
1116 2012-09-06  Cary Coutant  <ccoutant@google.com>
1117
1118         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1119         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1120         (Dwarf_die::skip_attributes): Likewise.
1121         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1122         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1123         (main): Call it.
1124         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1125
1126 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1127
1128         * testsuite/script_test_3.t: Add .got.plt output section
1129         statement.
1130         * testsuite/script_test_4.t: Likewise.
1131
1132 2012-09-05  Alan Modra  <amodra@gmail.com>
1133
1134         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1135         update all uses and lose "enum" when using type.
1136
1137 2012-09-05  Alan Modra  <amodra@gmail.com>
1138
1139         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1140         * configure: Regenerate.
1141         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1142         (plugin_final_layout.stdout): Likewise.
1143         (memory_test): Set page sizes to 0x1000.
1144         * testsuite/Makefile.in: Regenerate.
1145         * testsuite/discard_locals_test.sh: Add FIXME comment.
1146         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1147         * testsuite/pr14265.t: Add .got output section statement.
1148         * testsuite/script_test_2.t: Likewise.
1149         * testsuite/script_test_3.t: Likewise.
1150         * testsuite/script_test_4.t: Likewise.
1151         * testsuite/script_test_5.t: Likewise.
1152         * testsuite/script_test_6.t: Likewise.
1153         * testsuite/script_test_7.t: Likewise.
1154         * testsuite/script_test_9.t: Likewise.
1155
1156 2012-09-05  Alan Modra  <amodra@gmail.com>
1157
1158         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1159         (Powerpc_relocate_functions::Status): New typedef.
1160         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1161         (Target_powerpc::Scan::local): Handle REL64.
1162         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1163         for REL32 and REL64.
1164         (Target_powerpc::symval_for_branch): New function, extracted from..
1165         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1166         checks.  Report overflow errors.
1167
1168 2012-09-05  Alan Modra  <amodra@gmail.com>
1169
1170         * object.h (Sized_relobj_file::emit_relocs): Delete.
1171         (Sized_relobj_file::emit_relocs_reltype): Delete.
1172         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1173         relocate_relocs for --emit-relocs.
1174         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1175         * output.h: Update comment.
1176         (Output_segment::first_section): New function.
1177         (Output_segment::first_section_load_address): Use first_section.
1178         * output.cc (Output_segment::first_section): New function extracted..
1179         (Output_segment::first_section_load_address): ..from here.  Delete.
1180         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1181         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1182         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1183         adjust call to target.h function.
1184         * i386.cc (Target_i386): Likewise.
1185         * sparc.cc (Target_sparc): Likewise.
1186         * x86_64.cc (Target_x86_64): Likewise.
1187         * powerpc.cc (Target_powerpc): Likewise.
1188         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1189         first tls section has section symbol for optimised local dynamic
1190         output relocs.
1191         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1192         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1193         optimised tls code.
1194         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1195         Rename to relocate_relocs.  Update error message.
1196
1197 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1198
1199         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1200         --just-symbols.
1201
1202 2012-08-31  Alan Modra  <amodra@gmail.com>
1203
1204         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1205         (Powerpc_relobj::toc_base_offset): New stub function.
1206         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1207         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1208         (Target_powerpc::Relocate::enum skip_tls): New.
1209         (Target_powerpc::call_tls_get_addr_): New var.
1210         (Target_powerpc::is_branch_reloc): Move to file scope.
1211         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1212         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1213         New functions.
1214         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1215         (powerpc_info): Correct common_pagesize for ppc64.
1216         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1217         (Powerpc_relocate_functions): Add overflow check enums and functions.
1218         Add non-shift version of rela, rela_ua.  Delete all rel public
1219         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1220         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1221         addr16_ha3, addr14 functions.
1222         (Output_data_got_powerpc::add_constant_pair): New function.
1223         (Output_data_got_powerpc::got_base_offset): Likewise.
1224         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1225         (instruction constants): Sort, add some more.
1226         (Output_data_glink::do_write): Add and use Address typedef.  Use
1227         object->toc_base_offset() stub for 64-bit.
1228         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1229         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1230         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1231         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1232         Always treat .opd relocs as against locally defined symbol.
1233         Correct condition for RELATIVE relocs.
1234         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1235         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1236         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1237         calculations.  Handle TLS relocs, and more.  Add overflow
1238         checking and adjust for Powerpc_relocate_functions changes.
1239         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1240         Reinstate --emit-relocs code with FIXME.
1241
1242 2012-08-30  Alan Modra  <amodra@gmail.com>
1243
1244         * layout.cc (Layout::set_segment_offsets): Set p_align to
1245         abi_pagesize, not common_pagesize.
1246         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1247         to determine whether file header can go in segment.
1248
1249 2012-08-30  Alan Modra  <amodra@gmail.com>
1250
1251         * output.h (Output_reloc::Output_reloc <output section>): Add
1252         is_relative param.  Adjust calls.
1253         (Output_reloc::add_output_section_relative): New functions.
1254         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1255         is_relative.
1256         (Output_reloc::symbol_value): Handle SECTION_CODE.
1257
1258 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1259
1260         * gold.cc (queue_middle_tasks): Call layout again when unique
1261         segments for sections is desired.
1262         * layout.cc (Layout::Layout): Initialize new members.
1263         (Layout::get_output_section_flags): New function.
1264         (Layout::choose_output_section): Call get_output_section_flags.
1265         (Layout::layout): Make output section for mapping to a unique segment.
1266         (Layout::insert_section_segment_map): New function.
1267         (Layout::attach_allocated_section_to_segment): Make unique segment for
1268         output sections marked so.
1269         (Layout::segment_precedes): Check for unique segments when sorting.
1270         * layout.h (Layout::Unique_segment_info): New struct.
1271         (Layout::Section_segment_map): New typedef.
1272         (Layout::insert_section_segment_map): New function.
1273         (Layout::get_output_section_flags): New function.
1274         (Layout::is_unique_segment_for_sections_specified): New function.
1275         (Layout::set_unique_segment_for_sections_specified): New function.
1276         (Layout::unique_segment_for_sections_specified_): New member.
1277         (Layout::section_segment_map_): New member.
1278         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1279         Rename is_gc_pass_one to is_pass_one.
1280         Rename is_gc_pass_two to is_pass_two.
1281         Rename is_gc_or_icf to is_two_pass.
1282         Check for which pass based on whether symbols data is present.
1283         Make it two pass when unique segments for sections is desired.
1284         * output.cc (Output_section::Output_section): Initialize new
1285         members.
1286         * output.h (Output_section::is_unique_segment): New function.
1287         (Output_section::set_is_unique_segment): New function.
1288         (Output_section::is_unique_segment_): New member.
1289         (Output_section::extra_segment_flags): New function.
1290         (Output_section::set_extra_segment_flags): New function.
1291         (Output_section::extra_segment_flags_): New member.
1292         (Output_section::segment_alignment): New function.
1293         (Output_section::set_segment_alignment): New function.
1294         (Output_section::segment_alignment_): New member.
1295         (Output_segment::Output_segment): Initialize is_unique_segment_.
1296         (Output_segment::is_unique_segment): New function.
1297         (Output_segment::set_is_unique_segment): New function.
1298         (Output_segment::is_unique_segment_): New member.
1299         * plugin.cc (allow_unique_segment_for_sections): New function.
1300         (unique_segment_for_sections): New function.
1301         (Plugin::load): Add new functions to transfer vector.
1302         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1303         * Makefile.in: Regenerate.
1304         * testsuite/plugin_final_layout.sh: Check if unique segment
1305         functionality works.
1306         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1307         are available.
1308         (allow_unique_segment_for_sections): New global.
1309         (unique_segment_for_sections): New global.
1310         (claim_file_hook): Call allow_unique_segment_for_sections.
1311         (all_symbols_read_hook): Call unique_segment_for_sections.
1312
1313 2012-08-22  Cary Coutant  <ccoutant@google.com>
1314
1315         * layout.cc (Layout::include_section): Don't assert on GROUP
1316         sections with --emit-relocs.
1317
1318 2012-08-21  Cary Coutant  <ccoutant@google.com>
1319
1320         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1321         if --export-dynamic-symbol names an undef symbol.
1322
1323 2012-08-18  Alan Modra  <amodra@gmail.com>
1324
1325         * powerpc.cc: Formatting and white space.
1326         (Powerpc_relobj): Rename got2_section_ to special_.
1327         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1328         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1329         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1330         (Target_powerpc): Add Address typedef and invalid_address.  Use
1331         throughout.
1332         (Target_powerpc::is_branch_reloc): New function.
1333         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1334         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1335         for dst_mask, value and addend.
1336         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1337         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1338         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1339         uint16_t for 24-bit offset.  Use get_output_section_offset and
1340         check return.
1341         (Target_powerpc::Scan::local): Handle more relocs.
1342         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1343         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1344         Plug in toc restoring insn after plt calls.  Translate branches
1345         to function descriptor symbols to corresponding entry point.
1346         (Target_powerpc::relocate_for_relocatable): Check return from
1347         get_output_section_offset.
1348         * symtab.h: Comment typo.
1349
1350 2012-08-14  Ian Lance Taylor  <iant@google.com>
1351
1352         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1353         unsupported_relocal_local to call unsupported_reloc_global.
1354
1355 2012-08-14  Nick Clifton  <nickc@redhat.com>
1356
1357         PR ld/14265
1358         * script-sections.cc (Sections_element::output_section_name): Add
1359         keep return parameter.
1360         (Output_section_element::match_name): Add keep return parameter.
1361         Return the value of the keep_ member.
1362         * script-sections.h (class Output_section): Update
1363         output_section_name prototype.
1364         * layout.cc (Layout::keep_input_section): New public member
1365         function.
1366         (Layout::choose_output_section): Pass keep parameter to
1367         output_section_name.
1368         * layout.h (class Layout): Add keep_input_section.
1369         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1370         sections.
1371         * testsuite/Makefile.am: Add a test.
1372         * testsuite/Makefile.in: Regenerate.
1373         * testsuite/pr14265.c: Source file for the test.
1374         * testsuite/pr14265.t: Linker script for the test.
1375         * testsuite/pr14265.sh: Shell script for the test.
1376
1377 2012-08-14  Alan Modra  <amodra@gmail.com>
1378
1379         * target.h (Target::output_section_name): New function.
1380         (Target::do_output_section_name): New function.
1381         * layout.cc (Layout::choose_output_section): Call the above.
1382         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1383
1384 2012-08-14  Alan Modra  <amodra@gmail.com>
1385
1386         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1387         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1388         for replace_constant call.
1389         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1390         (Output_data_glink::do_print_to_mapfile): New function.
1391         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1392         (Target_powerpc::Relocate::relocate): Likewise.
1393
1394 2012-08-14  Alan Modra  <amodra@gmail.com>
1395
1396         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1397         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1398         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1399         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1400         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1401         here.
1402         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1403         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1404         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1405         here.
1406         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1407         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1408
1409 2012-08-12  Alan Modra  <amodra@gmail.com>
1410
1411         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1412         (glink insn constants): Use uint32_t.
1413         (Output_data_glink::add_entry): Use insert, not [] operator.
1414
1415 2012-08-11  Alan Modra  <amodra@gmail.com>
1416
1417         * object.h (Sized_relobj_file::find_shdr): New function.
1418         (Sized_relobj_file::find_special_sections): New function.
1419         * object.cc (Sized_relobj_file::find_shdr): New function.
1420         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1421         (Sized_relobj_file::find_special_sections): New function, split out..
1422         (Sized_relobj_file::do_read_symbols): ..from here.
1423         * output.h (Output_data_got::replace_constant): New function.
1424         (Output_data_got::num_entries): New function.
1425         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1426         (Output_data_got::got_offset): Protected rather than private.
1427         (Output_data_got::replace_got_entry): New function.
1428         * output.cc (Output_data_got::replace_got_entry): New function.
1429         * powerpc.cc (class Powerpc_relobj): New.
1430         (class Powerpc_relocate_functions): Delete all psymval variants or
1431         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1432         Implement _ha functions using corresponding _hi function.
1433         (Powerpc_relobj::find_special_sections): New function.
1434         (Target_powerpc::do_make_elf_object): New function.
1435         (class Output_data_got_powerpc): New.
1436         (class Output_data_glink): New.
1437         (class Powerpc_scan_relocatable_reloc): New.
1438         Many more changes througout file.
1439
1440 2012-08-09  Nick Clifton  <nickc@redhat.com>
1441
1442         * po/vi.po: Updated Vietnamese translation.
1443
1444 2012-08-07  Ian Lance Taylor  <iant@google.com>
1445
1446         * layout.cc (Layout::add_target_dynamic_tags): If
1447         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1448         plt_rel.
1449
1450 2012-07-30  Nick Clifton  <nickc@redhat.com>
1451
1452         * po/gold.pot: Updated template.
1453         * po/es.po: Updated Spanish translation.
1454
1455 2012-07-18  Cary Coutant  <ccoutant@google.com>
1456
1457         PR gold/14344
1458         * configure.ac: Add check for -gpubnames support.
1459         * configure: Regenerate.
1460         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1461         support; force -gno-pubnames.
1462         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1463         support.
1464         (gdb_index_test_4): New test.
1465         * testsuite/Makefile.in: Regenerate.
1466         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1467         * testsuite/gdb_index_test_2.sh: Likewise.
1468         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1469         * testsuite/gdb_index_test_4.sh: New script.
1470         * testsuite/gdb_index_test_comm.sh: New script with common code;
1471         don't look for space after colon.
1472
1473 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1474
1475         * gold.cc (queue_middle_tasks): Update function order only after
1476         deferred objects due to plugins are processed.
1477
1478 2012-07-11  Ian Lance Taylor  <iant@google.com>
1479
1480         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1481         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1482         (Target_arm::scan_reloc_for_stub): Likewise.
1483         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1484         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1485         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1486         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1487         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1488
1489 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1490             Ian Lance Taylor  <iant@google.com>
1491
1492         PR gold/14309
1493         * configure.ac: Test whether std::tr1::hash<off_t> works.
1494         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1495         needed.
1496         * output.h (class Output_fill): Add virtual destructor.
1497         * configure, config.in: Rebuild.
1498
1499 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1500
1501         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1502
1503 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1504
1505         * plugin.cc (Plugin::load): Handle position independent executables.
1506
1507 2012-06-06  Cary Coutant  <ccoutant@google.com>
1508
1509         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1510         add .debug_macro.
1511         (lines_only_debug_sections): Likewise.
1512         (gdb_fast_lookup_sections): New static array.
1513         (is_gdb_debug_section): Rename formal parameter.
1514         (is_lines_only_debug_section): Likewise.
1515         (is_gdb_fast_lookup_section): New function.
1516         (Layout::include_section): Check for ".zdebug_" prefix; pass
1517         section name suffix to is_gdb_debug_section, et al.; check for
1518         fast-lookup sections when building .gdb_index.
1519         * options.h (--strip-debug-gdb): Update GDB version number.
1520
1521 2012-06-06  Cary Coutant  <ccoutant@google.com>
1522
1523         * configure.ac: Add check for fallocate.
1524         * configure: Regenerate.
1525         * config.in: Regenerate.
1526
1527         * options.h (class General_options): Add --mmap-output-file and
1528         --posix-fallocate options.
1529         * output.cc: (posix_fallocate): Remove; replace with...
1530         (gold_fallocate): New function.
1531         (Output_file::map_no_anonymous): Call gold_fallocate.
1532         (Output_file::map): Check --mmap-output-file option.
1533
1534 2012-06-05  Jing Yu  <jingyu@google.com>
1535
1536         * gold.h (textdomain): Add do {} to empty while(0).
1537         (bindtextdomain): Likewise.
1538
1539 2012-06-04  Cary Coutant  <ccoutant@google.com>
1540
1541         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1542         has_dynsym_index.
1543
1544 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1545
1546         * symtab.cc (Symbol_table::define_special_symbol):
1547         Initialize *poldsym to prevent uninitialized variable errors.
1548
1549 2012-05-23  Cary Coutant  <ccoutant@google.com>
1550
1551         * layout.cc (Layout::section_name_mapping): Add rules to handle
1552         exact match on .data.rel.ro.local or .data.rel.ro.
1553         (Layout::output_section_name): Check for exact matches.
1554
1555 2012-05-23  Cary Coutant  <ccoutant@google.com>
1556
1557         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1558         more carefully.
1559
1560 2012-05-22  Cary Coutant  <ccoutant@google.com>
1561
1562         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1563         object before exporting symbol.
1564
1565 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1566
1567         * testsuite/tls_test.cc: Include "config.h" first.
1568         * testsuite/tls_test_c.c: Likewise.
1569
1570 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1571             Nick Clifton  <nickc@redhat.com>
1572
1573         PR 14072
1574         * configure.in: Add check that sysdep.h has been included before
1575         any system header files.
1576         * configure: Regenerate.
1577         * config.in: Regenerate.
1578
1579 2012-05-14  Cary Coutant  <ccoutant@google.com>
1580
1581         * layout.cc (Layout::make_output_section): Mark .tdata section
1582         as RELRO.
1583         * testsuite/relro_test.cc: Add a TLS variable.
1584
1585 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1586
1587         PR gold/14091
1588         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1589         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1590         R_X86_64_64.
1591
1592 2012-05-08  Cary Coutant  <ccoutant@google.com>
1593
1594         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1595         (lines_only_debug_sections): Likewise.
1596
1597 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1598
1599         * nacl.cc: New file.
1600         * nacl.h: New file.
1601         * Makefile.am (CCFILES, HFILES): Add them.
1602         * Makefile.in: Regenerate.
1603         * i386.cc (Output_data_plt_i386_nacl): New class.
1604         (Output_data_plt_i386_nacl_exec): New class.
1605         (Output_data_plt_i386_nacl_dyn): New class.
1606         (Target_i386_nacl): New class.
1607         (Target_selector_i386_nacl): New class.
1608         (target_selector_i386): Use it instead of Target_selector_i386.
1609         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1610         (Target_x86_64_nacl): New class.
1611         (Target_selector_x86_64_nacl): New class.
1612         (target_selector_x86_64, target_selector_x32): Use it instead of
1613         Target_selector_x86_64.
1614         * arm.cc (Output_data_plt_arm_nacl): New class.
1615         (Target_arm_nacl): New class.
1616         (Target_selector_arm_nacl): New class.
1617         (target_selector_arm, target_selector_armbe): Use it instead of
1618         Target_selector_arm.
1619
1620         * target-select.cc (select_target): Take new Input_file* and off_t
1621         arguments, pass them on to recognize method of selector.
1622         * object.cc (make_elf_sized_object): Update caller.
1623         * parameters.cc (parameters_force_valid_target): Likewise.
1624         * incremental.cc (make_sized_incremental_binary): Likewise.
1625         * target-select.h: Update decl.
1626         (Target_selector::recognize): Take new Input_file* argument,
1627         pass it on to do_recognize.
1628         (Target_selector::do_recognize): Take new Input_file* argument.
1629         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1630         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1631         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1632         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1633
1634         * target.h (Target::Target_info): New members isolate_execinstr
1635         and rosegment_gap.
1636         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1637         * arm.cc (Target_arm::arm_info): Update initializer.
1638         * i386.cc (Target_i386::i386_info): Likewise.
1639         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1640         * sparc.cc (Target_sparc::sparc_info): Likewise.
1641         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1642         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1643         * layout.cc (Layout::attach_allocated_section_to_segment):
1644         Take new const Target* argument.  If target->isolate_execinstr(), act
1645         like --rosegment.
1646         (Layout::find_first_load_seg): Take new const Target* argument;
1647         if target->isolate_execinstr(), reject PF_X segments.
1648         (Layout::relaxation_loop_body): Update caller.
1649         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1650         reset file offset to zero when we hit LOAD_SEG, and then do a second
1651         loop over the segments before LOAD_SEG to reassign offsets after
1652         addresses have been determined.  Handle target->rosegment_gap().
1653         (Layout::attach_section_to_segment): Take new const Target* argument;
1654         pass it to attach_allocated_section_to_segment.
1655         (Layout::make_output_section): Update caller.
1656         (Layout::attach_sections_to_segments): Take new const Target* argument;
1657         pass it to attach_section_to_segment.
1658         * gold.cc (queue_middle_tasks): Update caller.
1659         * layout.h (Layout): Update method decls with new arguments.
1660
1661         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1662         Target_info pointer to use.
1663         (Target_arm::do_make_data_plt): New virtual method.
1664         (Target_arm::make_data_plt): New method that calls it.
1665         (Target_arm::make_plt_entry): Use it.
1666         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1667         for the section alignment.
1668         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1669         method.
1670         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1671         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1672         method.
1673         (Output_data_plt_arm::get_plt_entry_size): Call it.
1674         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1675         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1676         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1677         method.
1678         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1679         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1680         method instead of sizeof(plt_entry).
1681         (Output_data_plt_arm::add_entry): Likewise.
1682         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1683         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1684         than static method.
1685         (Target_arm::plt_entry_size): Likewise.
1686         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1687         Move to ...
1688         (Output_data_plt_arm_standard): ... here, new class.
1689         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1690         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1691         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1692
1693         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1694         Take additional argument for the PLT entry size.
1695         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1696         Use get_plt_entry_size method rather than plt_entry_size variable.
1697         (Output_data_plt_x86_64::reserve_slot): Likewise.
1698         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1699         (Output_data_plt_x86_64::add_entry): Likewise.
1700         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1701         (Output_data_plt_x86_64::address_for_global): Likewise.
1702         (Output_data_plt_x86_64::address_for_local): Likewise.
1703         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1704         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1705         Make method non-static.
1706         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1707         method.
1708         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1709         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1710         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1711         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1712         virtual method.
1713         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1714         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1715         virtual method.
1716         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1717         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1718         virtual method.
1719         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1720         (Output_data_plt_x86_64::plt_entry_size)
1721         (Output_data_plt_x86_64::first_plt_entry)
1722         (Output_data_plt_x86_64::plt_entry)
1723         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1724         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1725         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1726         (Output_data_plt_x86_64_standard): ... here, new class.
1727         (Target_x86_64::Target_x86_64): Take optional argument for the
1728         Target_info pointer to use.
1729         (Target_x86_64::do_make_data_plt): New virtual method.
1730         (Target_x86_64::make_data_plt): New method to call it.
1731         (Target_x86_64::init_got_plt_for_update): Use that.
1732         Call this->plt_->add_eh_frame method here.
1733         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1734         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1735         rather than static method.
1736         (Target_x86_64::plt_entry_size): Likewise.
1737         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1738         rather than plt_entry_size variable.  Move guts of PLT filling to...
1739         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1740         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1741         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1742
1743         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1744         additional argument for the section alignment.
1745         Don't do add_eh_frame_for_plt here.
1746         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1747         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1748         variable.
1749         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1750         method.
1751         (Output_data_plt_i386::get_plt_entry_size): Call it.
1752         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1753         (Output_data_plt_i386::add_eh_frame): New method to call it.
1754         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1755         method.
1756         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1757         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1758         method.
1759         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1760         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1761         method instead of plt_entry_size.
1762         (Output_data_plt_i386::plt_entry_size)
1763         (Output_data_plt_i386::plt_eh_frame_fde_size)
1764         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1765         (Output_data_plt_i386_standard): ... here, new class.
1766         (Output_data_plt_i386_exec): New class.
1767         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1768         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1769         (Output_data_plt_i386::exec_plt_entry): Move to ...
1770         (Output_data_plt_i386_exec::plt_entry): ... here.
1771         (Output_data_plt_i386_dyn): New class.
1772         (Output_data_plt_i386::first_plt_entry): Move to ...
1773         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1774         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1775         (Output_data_plt_i386_dyn::plt_entry): ... here.
1776         (Target_i386::Target_i386): Take optional argument for the Target_info
1777         pointer to use.
1778         (Target_i386::do_make_data_plt): New virtual method.
1779         (Target_i386::make_data_plt): New method to call it.
1780         (Target_i386::make_plt_section): Use that.
1781         Call this->plt_->add_eh_frame method here.
1782         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1783         rather than plt_entry_size variable.
1784         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1785         (Output_data_plt_i386::address_for_local): Likewise.
1786         (Output_data_plt_i386::do_write): Likewise.
1787         Move guts of PLT filling to...
1788         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1789         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1790         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1791         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1792
1793 2012-05-01  Cary Coutant  <ccoutant@google.com>
1794
1795         * dwarf_reader.cc (Dwarf_die::read_attributes)
1796         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1797         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1798         * reduced_debug_output.cc
1799         (Output_reduced_debug_info_section::get_die_end): Remove
1800         DW_FORM_GNU_ref_index.  Add default case.
1801
1802 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1803
1804         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1805         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1806         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1807         DW_AT_high_pc as offset from DW_AT_low_pc.
1808
1809         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1810         * testsuite/Makefile.in: Regenerate.
1811         * testsuite/gdb_index_test_3.c: New test source file.
1812         * testsuite/gdb_index_test_3.sh: New test source file.
1813
1814 2012-04-25  Ian Lance Taylor  <iant@google.com>
1815
1816         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1817         pointer.
1818         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1819         as a class, not a struct.
1820         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1821         (Target_arm::apply_cortex_a8_workaround): Likewise.
1822         * gc.h: Declare Reloc_types as a struct, not a class.
1823         * object.h: Declare Symbols_data as a struct.
1824         * reloc.h: Declare Read_relocs_data as a struct.
1825         * target.h: Declare Relocate_info as a struct.
1826
1827 2012-04-24  David S. Miller  <davem@davemloft.net>
1828
1829         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1830         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1831         and R_SPARC_WPLT30.
1832
1833 2012-04-24  Cary Coutant  <ccoutant@google.com>
1834
1835         * incremental-dump.cc (find_input_containing_global): Replace
1836         magic number with symbolic constant.
1837         (dump_incremental_inputs): Update version number.
1838         * incremental.cc (Output_section_incremental_inputs): Update version
1839         number; import symbolic constants from Incremental_inputs_reader.
1840         (Incremental_inputs::create_data_sections): Align relocations
1841         section correctly for 64-bit targets.
1842         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1843         constants; add padding.
1844         (Output_section_incremental_inputs::write_header): Add assert for
1845         header_size.
1846         (Output_section_incremental_inputs::write_input_files): Add assert
1847         for input_entry_size.
1848         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1849         add assert for object_info_size, input_section_entry_size,
1850         global_sym_entry_size.
1851         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1852         for data structure sizes; use them.
1853         (Incremental_input_entry_reader): Import symbolic constants from
1854         Incremental_inputs_reader; use them.
1855
1856 2012-04-23  David S. Miller  <davem@davemloft.net>
1857
1858         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1859         and elf_flags_set_.
1860         (Target_sparc::Target_sparc): Initialize new fields.
1861         (Target_sparc::do_make_elf_object): New function.
1862         (Target_sparc::do_adjust_elf_header): New function.
1863
1864 2012-04-23  Cary Coutant  <ccoutant@google.com>
1865
1866         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1867         CU range table of gdb index.
1868
1869 2012-04-20  David S. Miller  <davem@davemloft.net>
1870
1871         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1872         instead of false.
1873
1874 2012-04-16  David S. Miller  <davem@davemloft.net>
1875
1876         * sparc.cc (Target_sparc::got_address): New function.
1877         (Sparc_relocate_functions::gdop_hix22): New function.
1878         (Sparc_relocate_functions::gdop_lox10): New function.
1879         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1880         relocs.
1881         (Target_sparc::Scan::local): Likewise if the global symbol is not
1882         preemptible and is not IFUNC.
1883         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1884         transformations for local and non-preemptible non-IFUNC global
1885         symbols.
1886
1887         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1888         writing out 64-bit part of ranges.
1889
1890         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1891         -fpic and -fpie respectively.
1892         * Makefile.in: Regenerate.
1893
1894         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1895         (Target_sparc::Target_sparc): Initialize new field.
1896         (Target_sparc::do_plt_section_for_global): New function.
1897         (Target_sparc::do_plt_section_for_local): New function.
1898         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1899         (Target_sparc::make_plt_section): New function, broken out of
1900         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1901         (Target_sparc::make_plt_entry): Call make_plt_section.
1902         (Target_sparc::make_local_ifunc_plt_entry): New function.
1903         (Target_sparc::rela_ifunc_section): New function.
1904         (Target_sparc::plt_section): Remove const.
1905         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1906         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1907         and ifunc_count_ fields.
1908         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1909         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1910         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1911         (Output_data_plt_sparc::rela_ifunc): New function.
1912         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1913         (Output_data_plt_sparc::has_ifunc_section): New function.
1914         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1915         (Output_data_plt_sparc::address_for_global): New function.
1916         (Output_data_plt_sparc::address_for_local): New function.
1917         (Output_data_plt_sparc::plt_index_to_offset): New function.
1918         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1919         and entry_count.
1920         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1921         entry_count.
1922         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1923         R_SPARC_JMP_IREL to switch.
1924         (Target_sparc::Scan::check_non_pic): Likewise.
1925         (Target_sparc::Scan::local): Handle IFUNC symbols.
1926         (Target_sparc::Scan::local): Likewise.
1927         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1928         and plt_address_for_local.
1929         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1930         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1931
1932         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1933         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1934         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1935         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1936         global relocs too.
1937         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1938         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1939         calls.
1940         * sparc.cc (Target_sparc::Scan::global): Likewise.
1941         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1942
1943 2012-04-16  Cary Coutant  <ccoutant@google.com>
1944
1945         * archive.cc (Library_base::should_include_member): Check for
1946         --export-dynamic-symbol.
1947         * options.h (class General_options): Add --export-dynamic-symbol.
1948         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1949         --export-dynamic-symbol.
1950         (Symbol_table::gc_mark_undef_symbols): Likewise.
1951         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1952
1953 2012-04-12  David S. Miller  <davem@davemloft.net>
1954
1955         * sparc.cc (Reloc::wdisp10): New relocation method.
1956         (Reloc::h34): Likewise.
1957         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1958         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1959         R_SPARC_WDISP10.
1960         (Target_sparc::Scan::local): Likewise.
1961         (Target_sparc::Scan::global): Likewise.
1962         (Target_sparc::Relocate::relocate): Likewise.
1963
1964 2012-04-09  Cary Coutant  <ccoutant@google.com>
1965
1966         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1967         low_pc == 0.
1968
1969 2012-04-06  Ian Lance Taylor  <iant@google.com>
1970
1971         * timer.cc: #include <unistd.h>.
1972
1973 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1974
1975         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1976         * config.in: Regenerate.
1977         * configure: Regenerate.
1978
1979 2012-04-05  Nick Clifton  <nickc@redhat.com>
1980
1981         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1982         (AM_LC_MESSAGES): Add.
1983         * aclocal.m4: Regenerate.
1984         * config.in: Regenerate.
1985         * configure: Regenerate.
1986
1987 2012-03-21  Cary Coutant  <ccoutant@google.com>
1988
1989         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1990         * Makefile.in: Regenerate.
1991         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1992         (Sized_elf_reloc_mapper::symbol_section): New function.
1993         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1994         (make_elf_reloc_mapper): New function.
1995         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1996         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1997         (Dwarf_abbrev_table::do_get_abbrev): New function.
1998         (Dwarf_ranges_table::read_ranges_table): New function.
1999         (Dwarf_ranges_table::read_range_list): New function.
2000         (Dwarf_pubnames_table::read_section): New function.
2001         (Dwarf_pubnames_table::read_header): New function.
2002         (Dwarf_pubnames_table::next_name): New function.
2003         (Dwarf_die::Dwarf_die): New function.
2004         (Dwarf_die::read_attributes): New function.
2005         (Dwarf_die::skip_attributes): New function.
2006         (Dwarf_die::set_name): New function.
2007         (Dwarf_die::set_linkage_name): New function.
2008         (Dwarf_die::attribute): New function.
2009         (Dwarf_die::string_attribute): New function.
2010         (Dwarf_die::int_attribute): New function.
2011         (Dwarf_die::uint_attribute): New function.
2012         (Dwarf_die::ref_attribute): New function.
2013         (Dwarf_die::child_offset): New function.
2014         (Dwarf_die::sibling_offset): New function.
2015         (Dwarf_info_reader::check_buffer): New function.
2016         (Dwarf_info_reader::parse): New function.
2017         (Dwarf_info_reader::do_parse): New function.
2018         (Dwarf_info_reader::do_read_string_table): New function.
2019         (Dwarf_info_reader::lookup_reloc): New function.
2020         (Dwarf_info_reader::get_string): New function.
2021         (Dwarf_info_reader::visit_compilation_unit): New function.
2022         (Dwarf_info_reader::visit_type_unit): New function.
2023         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2024         Sized_elf_reloc_mapper.
2025         (Sized_dwarf_line_info::symbol_section): Remove function.
2026         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2027         (Sized_dwarf_line_info::read_line_mappings): Remove object
2028         parameter, adjust callers.
2029         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2030         * dwarf_reader.h: Include <sys/types.h>.
2031         (class Track_relocs): Remove forward declaration.
2032         (class Elf_reloc_mapper): New class.
2033         (class Sized_elf_reloc_mapper): New class.
2034         (class Dwarf_abbrev_table): New class.
2035         (class Dwarf_range_list): New class.
2036         (class Dwarf_ranges_table): New class.
2037         (class Dwarf_pubnames_table): New class.
2038         (class Dwarf_die): New class.
2039         (class Dwarf_info_reader): New class.
2040         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2041         (Sized_dwarf_line_info::symbol_section): Remove member function.
2042         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2043         base class.
2044         * gdb-index.cc: New source file.
2045         * gdb-index.h: New source file.
2046         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2047         and .debug_types sections, call Layout::add_to_gdb_index.
2048         (Sized_relobj_incr::do_section_name): Implement.
2049         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2050         return type; Implement.
2051         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2052         return type.
2053         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2054         parameter list and return type.
2055         (Sized_incr_dynobj::do_section_contents): Likewise.
2056         * layout.cc: Include gdb-index.h.
2057         (Layout::Layout): Initialize gdb_index_data_.
2058         (Layout::init_fixed_output_section): Check for .gdb_index section.
2059         (Layout::add_to_gdb_index): New function. Instantiate.
2060         * layout.h: Add forward declaration for class Gdb_index.
2061         (Layout::add_to_gdb_index): New member function.
2062         (Layout::gdb_index_data_): New data member.
2063         * main.cc: Include gdb-index.h.
2064         (main): Print statistics for gdb index.
2065         * object.cc (Object::section_contents): Move code into
2066         do_section_contents.
2067         (need_decompressed_section): Check for sections needed when building
2068         gdb index.
2069         (build_compressed_section_map): Likewise.
2070         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2071         gdb index.
2072         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2073         sections; call Layout::add_to_gdb_index.
2074         (Sized_relobj_file::do_decompressed_section_contents): Call
2075         do_section_contents directly.
2076         * object.h (Object::do_section_contents): Adjust parameter list and
2077         return type.
2078         (Object::do_decompressed_section_contents): Call do_section_contents
2079         directly.
2080         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2081         return type.
2082         * options.h (class General_options): Add --gdb-index option.
2083         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2084         list and return type.
2085         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2086         * reloc.h (Track_relocs::checkpoint): New function.
2087         (Track_relocs::reset): New function.
2088
2089         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2090         New test cases.
2091         * testsuite/Makefile.in: Regenerate.
2092         * testsuite/gdb_index_test.cc: New test source file.
2093         * testsuite/gdb_index_test_1.sh: New test source file.
2094         * testsuite/gdb_index_test_2.sh: New test source file.
2095
2096 2012-03-19  Doug Kwan  <dougkwan@google.com>
2097
2098         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2099         (Target_arm::do_finalize_sections): Remove code which defines
2100         __exidx_start and __exidx_end.  Make symbol table parameter
2101         anonymous as it is not used.
2102         * gold.cc (queue_middle_tasks): Call target hook to define any
2103         target-specific symbols.
2104         * target.h (Target::define_standard_symbols): New method.
2105         (Target::do_define_standard_symbols): Same.
2106         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2107         * testsuite/Makefile.in: Regenerate.
2108         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2109         and __exidx_end.
2110         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2111         relocations are generated for __exidx_start and __exidx_end.
2112
2113 2012-03-16  Doug Kwan  <dougkwan@google.com>
2114
2115         * testsuite/Makefile.am: Disable test initpri3b.
2116         * testsuite/Makefile.in: Regenerate.
2117
2118 2012-03-15  Doug Kwan  <dougkwan@google.com>
2119
2120         * arm.cc (Target_arm::got_section): Make .got section read-only
2121         if -z now is given.
2122
2123 2012-03-15  Ian Lance Taylor  <iant@google.com>
2124
2125         PR gold/13850
2126         * layout.cc (Layout::make_output_section): Correctly mark
2127         SHT_INIT_ARRAY, et. al., as relro.
2128
2129 2012-03-14  Doug Kwan  <dougkwan@google.com>
2130
2131         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2132         dynamic relocations for protected symbols in shared objects.
2133
2134 2012-03-13  Ian Lance Taylor  <iant@google.com>
2135
2136         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2137         keep the larger alignment.
2138
2139 2012-03-12  Cary Coutant  <ccoutant@google.com>
2140
2141         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2142         handling of DW_LNE_define_file.
2143
2144 2012-03-12  Cary Coutant  <ccoutant@google.com>
2145
2146         * reduced_debug_output.cc
2147         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2148         codes to switch.
2149
2150 2012-02-29  Cary Coutant  <ccoutant@google.com>
2151
2152         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2153
2154 2012-02-29  Cary Coutant  <ccoutant@google.com>
2155
2156         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2157         Call Object::decompressed_section_contents.
2158         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2159         New dtor.
2160         (Sized_dwarf_line_info::buffer_start_): New data member.
2161         * merge.cc (Output_merge_data::do_add_input_section): Call
2162         Object::decompressed_section_contents.
2163         (Output_merge_string::do_add_input_section): Likewise.
2164         * object.cc (need_decompressed_section): New function.
2165         (build_compressed_section_map): Decompress sections needed later.
2166         (Sized_relobj_file::do_decompressed_section_contents): New function.
2167         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2168         * object.h (Object::decompressed_section_contents): New function.
2169         (Object::discard_decompressed_sections): New function.
2170         (Object::do_decompressed_section_contents): New function.
2171         (Object::do_discard_decompressed_sections): New function.
2172         (Compressed_section_info): New type.
2173         (Compressed_section_map): Include decompressed section contents.
2174         (Sized_relobj_file::do_decompressed_section_contents): New function.
2175         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2176
2177 2012-02-16  Cary Coutant  <ccoutant@google.com>
2178
2179         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2180         * testsuite/Makefile.in: Regenerate.
2181
2182 2012-02-14  Cary Coutant  <ccoutant@google.com>
2183
2184         * options.cc (General_options::finalize): Disallow -pie and -static.
2185
2186 2012-02-03  Doug Kwan  <dougkwan@google.com>
2187
2188         * arm.cc (Arm_relocate_functions::abs8,
2189         Arm_relocate_functions::abs16): Use
2190         Bits::has_signed_unsigned_overflow32.
2191         (Arm_relocate_functions::thm_abs8): Correct range of
2192         overflow check.
2193         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2194         in assertions.
2195
2196 2012-02-02  Doug Kwan  <dougkwan@google.com>
2197
2198         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2199         position independent outputs, not just shared objects.
2200
2201 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2202
2203         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2204         * configure: Regenerated.
2205
2206 2012-01-27  Ian Lance Taylor  <iant@google.com>
2207
2208         * reloc.h (Bits): New class with static functions, copied from
2209         namespace utils in arm.cc.
2210         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2211         instead.
2212
2213 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2214
2215         * incremental.cc (write_info_blocks): Correct relocation offset.
2216
2217 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2218
2219         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2220         (Relocate::tls_gd_to_le): Likewise.
2221
2222 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2223
2224         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2225
2226 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2227
2228         * configure.ac: Check if -mcmodel=medium works.
2229         * configure: Regenerated.
2230
2231 2012-01-24  Cary Coutant  <ccoutant@google.com>
2232
2233         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2234         definition and ...
2235         (read_unsigned_LEB_128_x): ... this new function.
2236         (read_signed_LEB_128): Replaced with inline definition and ...
2237         (read_signed_LEB_128_x): ... this new function.
2238         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2239         (read_unsigned_LEB_128): Add inline definition.
2240         (read_signed_LEB_128_x): New function.
2241         (read_signed_LEB_128): Add inline definition.
2242         * testsuite/Makefile.am (leb128_unittest): New unit test.
2243         * testsuite/Makefile.in: Regenerate.
2244         * testsuite/leb128_unittest.cc: New unit test.
2245
2246 2012-01-23  Ian Lance Taylor  <iant@google.com>
2247
2248         PR gold/13617
2249         * i386.cc (Target_i386::do_code_fill): When using a jmp
2250         instruction, pad with nop instructions.
2251         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2252
2253 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2254
2255         * x86_64.cc (gc_process_relocs): Add typename on types used in
2256         template.
2257         (scan_relocs): Likewise.
2258         (relocate_section): Likewise.
2259         (apply_relocation): Likewise.
2260
2261 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2262
2263         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2264         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2265         under x32.
2266
2267 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2268
2269         * x86_64.cc: Initial support for x32.
2270
2271 2012-01-03  Cary Coutant  <ccoutant@google.com>
2272
2273         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2274         Use abstract base class for GOT.
2275         * gold/output.h (class Output_data_got_base): New abstract base class.
2276         (class Output_data_got): Derive from new base class, adjust ctors.
2277         (Output_data_got::reserve_slot): Make virtual; rename to
2278         do_reserve_slot; Adjust callers.
2279         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2280         pointer to abstract base class.
2281         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2282
2283 2011-12-18  Ian Lance Taylor  <iant@google.com>
2284
2285         * object.h (Relobj::local_symbol_value): New function.
2286         (Relobj::local_plt_offset): New function.
2287         (Relobj::local_has_got_offset): New function.
2288         (Relobj::local_got_offset): New function.
2289         (Relobj::set_local_got_offset): New function.
2290         (Relobj::do_local_symbol_value): New pure virtual function.
2291         (Relobj::do_local_plt_offset): Likewise.
2292         (Relobj::do_local_has_got_offset): Likewise.
2293         (Relobj::do_local_got_offset): Likewise.
2294         (Relobj::do_set_local_got_offset): Likewise.
2295         (Sized_relobj::do_local_has_got_offset): Rename from
2296         local_has_got_offset.
2297         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2298         (Sized_relobj::do_set_local_got_offset): Rename from
2299         set_local_got_offset.
2300         (Sized_relobj_file::do_local_plt_offset): Rename from
2301         local_plt_offset.
2302         (Sized_relobj_file::do_local_symbol_value): New function.
2303         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2304         local_plt_offset.
2305         * output.cc (Output_data_got::Got_entry::write): Change object to
2306         Relobj.  Use local_symbol_value.
2307         (Output_data_got::add_global_with_rel): Change rel_dyn to
2308         Output_data_reloc_generic*.  Use add_global_generic.
2309         (Output_data_got::add_global_with_rela): Remove.  Change all
2310         callers to use add_global_with_rel.
2311         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2312         Output_data_reloc_generic*.  Use add_global_generic.
2313         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2314         callers to use add_global_pair_with_rel.
2315         (Output_data_got::add_local): Change object to Relobj*.
2316         (Output_data_got::add_local_plt): Likewise.
2317         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2318         change rel_dyn to Output_data_reloc_generic*.  Use
2319         add_local_generic.
2320         (Output_data_got::add_local_with_rela): Remove.  Change all
2321         callers to use all_local_with_rel.
2322         (Output_data_got::add_local_pair_with_rel): Change object to
2323         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2324         add_output_section_generic.
2325         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2326         callers to use add_local_pair_with_rel.
2327         (Output_data_got::reserve_local): Change object to Relobj*.
2328         * output.h: (class Output_data_reloc_generic): Add pure virtual
2329         declarations for add_global_generic, add_local_generic,
2330         add_output_section_generic.
2331         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2332         functions for Output_data_reloc_generic.  Update declarations for
2333         changes listed in output.cc.
2334         (class Output_data_got): Change template parameter to got_size.
2335         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2336         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2337         function.
2338         (Sized_relobj_incr::do_local_plt_offset): New function.
2339         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2340         add_global_generic.
2341
2342 2011-12-17  Cary Coutant  <ccoutant@google.com>
2343
2344         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2345         * resolve.cc (Symbol_table::resolve): Likewise.
2346         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2347         arrays.
2348         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2349
2350 2011-12-16  Ian Lance Taylor  <iant@google.com>
2351
2352         * output.h (Output_data_reloc_generic::add): Only call
2353         add_dynamic_reloc if this is a dynamic reloc section.
2354
2355 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2356
2357         PR gold/13505
2358         * target-reloc.h (apply_relocation): Replace <64, false> with
2359         <size, big_endian>.
2360
2361 2011-11-25  Nick Clifton  <nickc@redhat.com>
2362
2363         * po/it.po: New Italian translation.
2364
2365 2011-11-17  Sterling Augustine  <saugustine@google.com>
2366
2367         * script.cc (script_include_directive): Implement.
2368         (read_script_file): New local variables name and search_path. Update
2369         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2370         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2371         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2372
2373 2011-11-11  Sterling Augustine  <saugustine@google.com>
2374
2375         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2376         (file_or_sections_cmd): Likewise.
2377
2378 2011-11-11  Doug Kwan  <dougkwan@google.com>
2379
2380         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2381         if --just-symbols is given.
2382
2383 2011-11-10  Doug Kwan  <dougkwan@google.com>
2384
2385         PR gold/13362
2386         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2387         when processing data relocs.
2388         * reloc.h (Relocate_functions::rel_unaligned): New method.
2389         (Relocate_functions::pcrel_unaligned): Ditto.
2390         (Relocate_functions::rel32_unaligned): Ditto.
2391         (Relocate_functions::pcrel32_unaligned): Ditto.
2392
2393 2011-11-09  Doug Kwan  <dougkwan@google.com>
2394
2395         PR gold/13362
2396         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2397         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2398         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2399         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2400         (Relocate_functions::rel_unaligned): New.
2401         (Relocate_functions::rel32_unaligned): New.
2402         * target-reloc.h (relocate_for_relocatable): Add code to handle
2403         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2404         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2405         arm_unaligned_reloc_r): New targets.
2406         * testsuite/Makefile.in: Regenerate.
2407         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2408         linking.
2409
2410 2011-11-02  Ian Lance Taylor  <iant@google.com>
2411
2412         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2413         NATIVE_LINKER.
2414         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2415         * options.cc (General_options::finalize): Use library search path
2416         from configure script if specified.  If not native and no sysroot,
2417         only search TOOLLIBDIR.
2418         * options.h (Search_directory::Search_directory): Change name to
2419         const std::string&.
2420         (General_options::add_to_library_path_with_sysroot): Change arg to
2421         const std::string&.
2422         * configure, Makefile.in, config.in: Rebuild.
2423
2424 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2425
2426         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2427         we are working around the ARM1176 Erratum.
2428         * options.h (General_options::fix_arm1176): Add option.
2429         * testsuite/Makefile.am: Add testcases, and keep current ones
2430         working.
2431         * testsuite/Makefile.in: Regenerate.
2432         * testsuite/arm_fix_1176.s: New file.
2433         * testsuite/arm_fix_1176.sh: Likewise.
2434
2435 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2436
2437         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2438         may_use_blx_.
2439         (Target_arm::may_use_blx): Remove method.
2440         (Target_arm::set_may_use_blx): Likewise.
2441         (Target_arm::may_use_v4t_interworking): New method.
2442         (Target_arm::may_use_v5t_interworking): Likewise.
2443         (Target_arm::may_use_blx_): Remove member variable.
2444         (Arm_relocate_functions::arm_branch_common): Check for v5T
2445         interworking.
2446         (Arm_relocate_functions::thumb_branch_common): Likewise.
2447         (Reloc_stub::stub_type_for_reloc): Likewise.
2448         (Target_arm::do_finalize_sections): Correct interworking checks.
2449         * testsuite/Makefile.am: Add new tests.
2450         * testsuite/Makefile.in: Regenerate.
2451         * testsuite/arm_farcall_arm_arm.s: New test.
2452         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2453         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2454         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2455         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2456         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2457         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2458         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2459
2460 2011-10-31  Cary Coutant  <ccoutant@google.com>
2461
2462         PR gold/13023
2463         * expression.cc (Expression::eval_with_dot): Add
2464         is_section_dot_assignment parameter.
2465         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2466         absolute and assigning to dot within a section.
2467         * script-sections.cc
2468         (Output_section_element_assignment::set_section_addresses): Pass
2469         dot_section to set_if_absolute.
2470         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2471         as is_section_dot_assignment flag to eval_with_dot.
2472         (Output_section_element_dot_assignment::set_section_addresses):
2473         Likewise.
2474         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2475         parameter.  Also set value if relative to dot_section; set the
2476         symbol's output_section.
2477         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2478         parameter.  Adjust all callers.
2479         (Expression::eval_maybe_dot): Likewise.
2480         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2481         Adjust all callers.
2482         * testsuite/script_test_2.t: Test assignment of an absolute value
2483         to dot within an output section element.
2484
2485 2011-10-31  Cary Coutant  <ccoutant@google.com>
2486
2487         * options.h (class General_options): Add --[no-]gnu-unique options.
2488         * symtab.cc (Symbol_table::sized_write_globals): Convert
2489         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2490
2491 2011-10-31  Cary Coutant  <ccoutant@google.com>
2492
2493         PR gold/13359
2494         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2495         unnecessary assertion.
2496         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2497
2498 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2499
2500         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2501         gc_mark_symbol.
2502         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2503         gc_mark_symbol.
2504         Change to just keep the section associated with symbol.
2505         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2506         they are externally visible and --export-dynamic is turned on.
2507         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2508
2509 2011-10-19  Ian Lance Taylor  <iant@google.com>
2510
2511         PR gold/13163
2512         * script-sections.cc
2513         (Output_section_element_dot_assignment::needs_output_section): New
2514         function.
2515
2516 2011-10-19  Ian Lance Taylor  <iant@google.com>
2517
2518         PR gold/13204
2519         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2520         --section-start option was seen.
2521         * options.h (General_options::any_section_start): New function.
2522
2523 2011-10-18  David S. Miller  <davem@davemloft.net>
2524
2525         PR binutils/13301
2526         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2527         member to track relocation locations that have moved during TLS
2528         reloc optimizations.
2529         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2530         (Target_sparc::Relocate::relocate): Adjust view down by 4
2531         bytes if it matches reloc_adjust_addr_.
2532         (Target_sparc::Relocate::relocate_tls): Always move the
2533         __tls_get_addr call delay slot instruction forward 4 bytes when
2534         performing relaxation.
2535
2536 2011-10-18  Cary Coutant  <ccoutant@google.com>
2537
2538         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2539         (Output_file::map_no_anonymous): Check for non-zero
2540         return code from posix_fallocate.
2541
2542 2011-10-17  Cary Coutant  <ccoutant@google.com>
2543
2544         PR gold/13245
2545         * plugin.cc (is_visible_from_outside): Check for symbols
2546         referenced from dynamic objects.
2547         * resolve.cc (Symbol_table::resolve): Don't count references
2548         from dynamic objects as references from real ELF files.
2549         * testsuite/plugin_test_2.sh: Adjust expected result.
2550
2551 2011-10-17  Cary Coutant  <ccoutant@google.com>
2552
2553         * gold.cc: Include timer.h.
2554         (queue_middle_tasks): Stamp time.
2555         (queue_final_tasks): Likewise.
2556         * main.cc (main): Store timer in parameters.  Print timers
2557         for each pass.
2558         * parameters.cc (Parameters::Parameters): Initialize timer_.
2559         (Parameters::set_timer): New function.
2560         (set_parameters_timer): New function.
2561         * parameters.h (Parameters::set_timer): New function.
2562         (Parameters::timer): New function.
2563         (Parameters::timer_): New data member.
2564         (set_parameters_timer): New function.
2565         * timer.cc (Timer::stamp): New function.
2566         (Timer::get_pass_time): New function.
2567         * timer.h (Timer::stamp): New function.
2568         (Timer::get_pass_time): New function.
2569         (Timer::pass_times_): New data member.
2570
2571 2011-10-17  Cary Coutant  <ccoutant@google.com>
2572
2573         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2574         task for members of lib groups.
2575
2576 2011-10-17  Cary Coutant  <ccoutant@google.com>
2577
2578         PR gold/13288
2579         * fileread.cc (File_read::find_view): Add assert.
2580         (File_read::make_view): Move bounds check (replace with assert)...
2581         (File_read::find_or_make_view): ... to here.
2582
2583 2011-10-12  Cary Coutant  <ccoutant@google.com>
2584
2585         * output.cc (Output_file::open_base_file): Handle case where
2586         ::read returns less than requested size.
2587
2588 2011-10-10  Cary Coutant  <ccoutant@google.com>
2589
2590         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2591         Initialize defined_count_.
2592         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2593         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2594         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2595         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2596         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2597         * incremental.h (Sized_relobj_incr::defined_count_): New data
2598         member.
2599         (Sized_incr_dynobj::defined_count_): New data member.
2600         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2601         Return zeroes instead of internal error.
2602
2603 2011-10-10  Cary Coutant  <ccoutant@google.com>
2604
2605         PR gold/13249
2606         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2607         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2608         * output.h (class Output_reloc): Add use_plt_offset flag.
2609         (Output_reloc::type_): Adjust size of bit field.
2610         (Output_reloc::use_plt_offset_): New bit field.
2611         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2612         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2613         flag.  Adjust all callers.
2614         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2615         creating RELATIVE relocations.
2616
2617 2011-10-10  Nick Clifton  <nickc@redhat.com>
2618
2619         * po/es.po: Updated Spanish translation.
2620         * po/fi.po: Updated Finnish translation.
2621
2622 2011-10-03   Diego Novillo  <dnovillo@google.com>
2623
2624         * options.cc (parse_uint): Fix dereference of RETVAL.
2625
2626 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2627
2628         * layout.h (section_order_map_): New member.
2629         (get_section_order_map): New member function.
2630         * output.cc (Output_section::add_input_section): Check for patterns
2631         only when --section-ordering-file is specified.
2632         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2633         output_sections have been formed.
2634         * layout.cc (Layout_Layout): Initialize section_order_map_.
2635         * plugin.cc (update_section_order): Store order in order_map. Do not
2636         update the order.
2637         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2638         * testsuite/Makefile.in: Regenerate.
2639         * testsuite/plugin_section_order.c: New file.
2640         * testsuite/plugin_final_layout.cc: New file.
2641         * testsuite/plugin_final_layout.sh: New file.
2642
2643 2011-09-29  Cary Coutant  <ccoutant@google.com>
2644
2645         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2646         Check for NULL.
2647         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2648         symbols during incremental update.
2649         (Symbol_table::add_from_dynobj): Likewise.
2650
2651 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2652             Ian Lance Taylor  <iant@google.com>
2653
2654         * symtab.cc (Symbol_table::define_special_symbol): Always
2655         canonicalize version string.
2656
2657 2011-09-26  Cary Coutant  <ccoutant@google.com>
2658
2659         * gold.cc (queue_initial_tasks): Move option checks ...
2660         * options.cc (General_options::finalize): ... to here. Disable
2661         some options; make others fatal.
2662
2663 2011-09-26  Cary Coutant  <ccoutant@google.com>
2664
2665         gcc PR lto/47247
2666         * plugin.cc (get_symbols_v2): New function.
2667         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2668         (is_referenced_from_outside): New function.
2669         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2670         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2671         (get_symbols): Pass version parameter.
2672         (get_symbols_v2): New function.
2673         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2674         parameter.
2675         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2676         (onload): Add LDPT_GET_SYMBOLS_V2.
2677         (all_symbols_read_hook): Use get_symbols_v2; check for
2678         LDPR_PREVAILING_DEF_IRONLY_EXP.
2679         * testsuite/plugin_test_3.sh: Update expected results.
2680
2681 2011-09-23  Simon Baldwin  <simonb@google.com>
2682
2683         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2684         configuration options.
2685         * configure: Regenerate.
2686         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2687         * Makefile.in: Regenerate.
2688         * testsuite/Makefile.in: Regenerate.
2689
2690 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2691
2692         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2693
2694 2011-09-19  Cary Coutant  <ccoutant@google.com>
2695
2696         * incremental.cc (can_incremental_update): Fix typo in comment.
2697         * incremental.h (can_incremental_update): Likewise.
2698
2699 2011-09-18  Cary Coutant  <ccoutant@google.com>
2700
2701         * incremental.cc (can_incremental_update): New function.
2702         * incremental.h (can_incremental_update): New function.
2703         * layout.cc (Layout::init_fixed_output_section): Call it.
2704         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2705         * object.cc (Sized_relobj_file::do_layout): Call
2706         can_incremental_update.
2707
2708 2011-09-13  Cary Coutant  <ccoutant@google.com>
2709
2710         * configure.ac: Check for glibc support for gnu_indirect_function
2711         support with static linking, setting automake conditional
2712         IFUNC_STATIC.
2713         * Makefile.in: Regenerate.
2714         * configure: Regenerate.
2715
2716         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2717         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2718         for IFUNC_STATIC.
2719         * testsuite/Makefile.in: Regenerate.
2720
2721 2011-09-13  Cary Coutant  <ccoutant@google.com>
2722
2723         * incremental.cc (Sized_relobj_incr::do_layout): Call
2724         report_comdat_group for kept comdat sections.
2725         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2726         * testsuite/Makefile.in: Regenerate.
2727         * testsuite/incr_comdat_test_1.cc: New source file.
2728         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2729         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2730         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2731
2732 2011-09-13  Ian Lance Taylor  <iant@google.com>
2733
2734         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2735         variable external_symbols_offset.
2736
2737 2011-09-12  Ian Lance Taylor  <iant@google.com>
2738
2739         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2740         triggered if object has no symbols.
2741
2742 2011-09-09  David S. Miller  <davem@davemloft.net>
2743
2744         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2745         (Output_fill_debug_line::do_write): Likewise.
2746
2747 2011-08-29  Cary Coutant  <ccoutant@google.com>
2748
2749         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2750         casts to match formatting specs.
2751         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2752
2753 2011-08-26  Cary Coutant  <ccoutant@google.com>
2754
2755         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2756         remaining hole size when allocating.
2757         (Layout::make_output_section): Set fill methods for debug sections.
2758         * layout.h (Free_list::Free_list_node): Move from private to
2759         public.
2760         (Free_list::set_min_hole_size): New function.
2761         (Free_list::begin, Free_list::end): New functions.
2762         (Free_list::min_hole_): New data member.
2763         * output.cc: Include dwarf.h.
2764         (Output_fill_debug_info::do_minimum_hole_size): New function.
2765         (Output_fill_debug_info::do_write): New function.
2766         (Output_fill_debug_line::do_minimum_hole_size): New function.
2767         (Output_fill_debug_line::do_write): New function.
2768         (Output_section::Output_section): Initialize new data member.
2769         (Output_section::set_final_data_size): Ensure patch space is larger
2770         than minimum hole size.
2771         (Output_section::do_write): Fill holes in debug sections.
2772         * output.h (Output_fill): New class.
2773         (Output_fill_debug_info): New class.
2774         (Output_fill_debug_line): New class.
2775         (Output_section::set_free_space_fill): New function.
2776         (Output_section::free_space_fill_): New data member.
2777         * testsuite/Makefile.am (incremental_test_3): Add
2778         --incremental-patch option.
2779         (incremental_test_4): Likewise.
2780         (incremental_test_5): Likewise.
2781         (incremental_test_6): Likewise.
2782         (incremental_copy_test): Likewise.
2783         (incremental_common_test_1): Likewise.
2784         * testsuite/Makefile.in: Regenerate.
2785
2786 2011-08-26  Nick Clifton  <nickc@redhat.com>
2787
2788         * po/es.po: Updated Spanish translation.
2789
2790 2011-08-01  Cary Coutant  <ccoutant@google.com>
2791
2792         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2793         * gold/testsuite/Makefile.in: Regenerate.
2794         * gold/testsuite/justsyms_exec.c: New source file.
2795         * gold/testsuite/justsyms_lib.c: New source file.
2796
2797 2011-08-01  Cary Coutant  <ccoutant@google.com>
2798
2799         * layout.cc (Layout::set_segment_offsets): Don't realign text
2800         segment if -Ttext was specified.
2801         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2802         file type.
2803         * object.h (Sized_relobj_file::e_type): New function.
2804         (Sized_relobj_file::e_type_): New data member.
2805         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2806         base address for ET_EXEC files.
2807         * target.cc (Target::do_make_elf_object_implementation): Allow
2808         ET_EXEC files with --just-symbols option.
2809
2810 2011-07-28  Cary Coutant  <ccoutant@google.com>
2811
2812         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2813         Add thread_number parameter.
2814         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2815         * workqueue-threads.cc
2816         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2817         current thread if its thread number is greater than desired thread
2818         count.
2819         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2820         Add thread_number parameter.
2821         (Workqueue::should_cancel_thread): Likewise.
2822         (Workqueue::find_runnable_or_wait): Pass thread_number to
2823         should_cancel_thread.
2824         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2825         parameter.
2826
2827 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2828
2829         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2830         only after checking if it cannot be forced local.
2831         * symtab.h (is_externally_visible): Check if the symbol is not forced
2832         local.
2833
2834 2011-07-15  Ian Lance Taylor  <iant@google.com>
2835
2836         * options.h (class General_options): Add --print-output-format.
2837         Move -EL next to -EB, for  better --help output.
2838         * target-select.cc: Include <cstdio>, "options.h", and
2839         "parameters.h".
2840         (Target_selector::do_target_bfd_name): New function.
2841         (print_output_format): New function.
2842         * target-select.h (class Target_selector): Update declarations.
2843         (Target_selector::target_bfd_name): New function.
2844         (print_output_format): Declare.
2845         * main.cc: Include "target-select.h".
2846         (main): Handle --print-output-format.
2847         * gold.cc: Include "target-select.h".
2848         (queue_initial_tasks): Handle --print-output-format when there are
2849         no input files.
2850         * parameters.cc (parameters_force_valid_target): Give a better
2851         error message if -EB/-EL does not match target.
2852         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2853         function.
2854
2855 2011-07-15  Ian Lance Taylor  <iant@google.com>
2856
2857         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2858         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2859         (Output_data_plt_i386::do_write): Write address of .dynamic
2860         section to first entry in .got.plt section.
2861         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2862         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2863         Initialize layout_.
2864         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2865         section to first entry in .got.plt section.
2866         * layout.h (Layout::dynamic_section): New function.
2867
2868 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2869
2870         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2871         to claim_file call.
2872         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2873         input_section_position_, and input_section_glob_.
2874         (read_layout_from_file): Call function section_ordering_specified.
2875         * layout.h (is_section_ordering_specified): New function.
2876         (section_ordering_specified): New function.
2877         (section_ordering_specified_): New boolean member.
2878         * main.cc(main): Call load_plugins after layout object is defined.
2879         * output.cc (Output_section::add_input_section): Use
2880         function section_ordering_specified to check if section ordering is
2881         needed.
2882         * output.cc (Output_section::add_relaxed_input_section): Use
2883         function section_ordering_specified to check if section ordering is
2884         needed.
2885         (Output_section::update_section_layout): New function.
2886         (Output_section::sort_attached_input_sections): Check if input section
2887         must be reordered.
2888         * output.h (Output_section::update_section_layout): New function.
2889         * plugin.cc (get_section_count): New function.
2890         (get_section_type): New function.
2891         (get_section_name): New function.
2892         (get_section_contents): New function.
2893         (update_section_order): New function.
2894         (allow_section_ordering): New function.
2895         (Plugin::load): Add the new interfaces to the transfer vector.
2896         (Plugin_manager::load_plugins): New parameter.
2897         (Plugin_manager::all_symbols_read): New parameter.
2898         (Plugin_manager::claim_file): New parameter. Save the elf object for
2899         unclaimed objects.
2900         (Plugin_manager::get_elf_object): New function.
2901         (Plugin_manager::get_view): Change to directly use the bool to check
2902         if get_view is called from claim_file_hook.
2903         * plugin.h (input_objects): New function
2904         (Plugin__manager::load_plugins): New parameter.
2905         (Plugin_manager::claim_file): New parameter.
2906         (Plugin_manager::get_elf_object): New function.
2907         (Plugin_manager::in_claim_file_handler): New function.
2908         (Plugin_manager::in_claim_file_handler_): New member.
2909         (layout): New function.
2910         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2911         handler with an extra parameter. Make the elf object before calling
2912         claim_file handler.
2913         * testsuite/plugin_test.c (get_section_count): New function pointer.
2914         (get_section_type): New function pointer.
2915         (get_section_name): New function pointer.
2916         (get_section_contents): New function pointer.
2917         (update_section_order): New function pointer.
2918         (allow_section_ordering): New function pointer.
2919         (onload): Check if the new interfaces exist.
2920
2921 2011-07-13  Ian Lance Taylor  <iant@google.com>
2922
2923         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2924         relro section.
2925         * x86_64.cc (Target_x86_64::got_section): Likewise.
2926         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2927         (relro_now_test_SOURCES): New variable.
2928         (relro_now_test_DEPENDENCIES): New variable.
2929         (relro_now_test_LDFLAGS): New variable.
2930         (relro_now_test_LDADD): New variable.
2931         (relro_now_test.so): New target.
2932         * testsuite/Makefile.in: Rebuild.
2933
2934 2011-07-12  Ian Lance Taylor  <iant@google.com>
2935
2936         PR gold/12980
2937         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2938         GLOB_DAT relocation rather than a RELATIVE relocation for a
2939         protected symbol when creating a shared library.
2940         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2941         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2942         * testsuite/protected_main_1.cc (main): Test that protected
2943         function has same address.
2944
2945 2011-07-11  Ian Lance Taylor  <iant@google.com>
2946
2947         PR gold/12979
2948         * options.h (class General_options): Add -Bgroup.
2949         * options.cc (General_options::finalize): If -Bgroup is set,
2950         default to --unresolved-symbols=report-all.
2951         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2952         * target-reloc.h (issue_undefined_symbol_error): Handle
2953         --unresolved-symbols=report-all.
2954
2955 2011-07-08  Ian Lance Taylor  <iant@google.com>
2956
2957         PR gold/11985
2958         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2959         if linker script discards key sections.
2960         (Layout::create_dynamic_symtab): Likewise.
2961         (Layout::assign_local_dynsym_offsets): Likewise.
2962         (Layout::sized_create_version_sections): Likewise.
2963         (Layout::create_interp): Likewise.
2964         (Layout::finish_dynamic_section): Likewise.
2965         (Layout::set_dynamic_symbol_size): Likewise.
2966
2967 2011-07-08  Ian Lance Taylor  <iant@google.com>
2968
2969         PR gold/12386
2970         * options.h (class General_options): Add --unresolved-symbols.
2971         * target-reloc.h (issue_undefined_symbol_error): Check
2972         --unresolved-symbols.  Add comments.
2973
2974 2011-07-08  Ian Lance Taylor  <iant@google.com>
2975
2976         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2977         expression more complex.
2978
2979 2011-07-08  Ian Lance Taylor  <iant@google.com>
2980
2981         PR gold/11317
2982         * target-reloc.h (issue_undefined_symbol_error): New inline
2983         function, broken out of relocate_section.
2984         (relocate_section): Call issue_undefined_symbol_error.
2985         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2986         there is no TLS segment if we are about to issue an undefined
2987         symbol error.
2988         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2989
2990 2011-07-08  Ian Lance Taylor  <iant@google.com>
2991
2992         PR gold/12279
2993         * resolve.cc (Symbol_table::should_override): Add fromtype
2994         parameter.  Change all callers.  Give error when linking together
2995         TLS and non-TLS symbol.
2996         (Symbol_table::should_override_with_special): Add fromtype
2997         parameter.  Change all callers.
2998         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2999         there is no TLS segment if we have reported some errors.
3000         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3001
3002 2011-07-08  Ian Lance Taylor  <iant@google.com>
3003
3004         PR gold/12372
3005         * target.h (Target::plt_address_for_global): New function.
3006         (Target::plt_address_for_local): New function.
3007         (Target::plt_section_for_global): Remove.
3008         (Target::plt_section_for_local): Remove.
3009         (Target::do_plt_address_for_global): New virtual function.
3010         (Target::do_plt_address_for_local): New virtual function.
3011         (Target::do_plt_section_for_global): Remove.
3012         (Target::do_plt_section_for_local): Remove.
3013         (Target::register_global_plt_entry): Add Symbol_table and Layout
3014         parameters.
3015         * output.cc (Output_data_got::Got_entry::write): Use
3016         plt_address_for_global and plt_address_for_local.
3017         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3018         address of output section.
3019         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3020         got_irelative_, and irelative_count_ fields.  Update
3021         declarations.
3022         (Output_data_plt_i386::has_irelative_section): New function.
3023         (Output_data_plt_i386::entry_count): Add irelative_count_.
3024         (Output_data_plt_i386::set_final_data_size): Likewise.
3025         (class Target_i386): Add got_irelative_ and rel_irelative_
3026         fields.  Update declarations.
3027         (Target_i386::Target_i386): Initialize new fields.
3028         (Target_i386::do_plt_address_for_global): New function replacing
3029         do_plt_section_for_global.
3030         (Target_i386::do_plt_address_for_local): New function replacing
3031         do_plt_section_for_local.
3032         (Target_i386::got_section): Create got_irelative_.
3033         (Target_i386::rel_irelative_section): New function.
3034         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3035         fields.  Don't define __rel_iplt_{start,end}.
3036         (Output_data_plt_i386::add_entry): Add symtab and layout
3037         parameters.  Change all callers.  Use different PLT and GOT for
3038         IFUNC symbols.
3039         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3040         layout parameters.  Change all callers.  Use different PLT and
3041         GOT.
3042         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3043         (Output_data_plt_i386::rel_irelative): New function.
3044         (Output_data_plt_i386::address_for_global): New function.
3045         (Output_data_plt_i386::address_for_local): New function.
3046         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3047         IRELATIVE GOT when changing IFUNC GOT entries.
3048         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3049         reloc.
3050         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3051         if we didn't create an IRELATIVE GOT.
3052         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3053         plt_address_for_local.
3054         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3055         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3056         got_irelative_, and irelative_count_ fields.  Update
3057         declarations.
3058         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3059         Initialize new fields.  Remove symtab parameter.  Change all
3060         callers.
3061         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3062         irelative_count_.
3063         (Output_data_plt_x86_64::has_irelative_section): New function.
3064         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3065         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3066         fields.  Update declarations.
3067         (Target_x86_64::Target_x86_64): Initialize new fields.
3068         (Target_x86_64::do_plt_address_for_global): New function replacing
3069         do_plt_section_for_global.
3070         (Target_x86_64::do_plt_address_for_local): New function replacing
3071         do_plt_section_for_local.
3072         (Target_x86_64::got_section): Create got_irelative_.
3073         (Target_x86_64::rela_irelative_section): New function.
3074         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3075         all callers.  Don't create __rel_iplt_{start,end}.
3076         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3077         parameters.  Change all callers.  Use different PLT and GOT for
3078         IFUNC symbols.
3079         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3080         layout parameters.  Change all callers.  Use different PLT and
3081         GOT.
3082         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3083         parameters.  Change all callers.  Use different PLT and GOT for
3084         IFUNC symbols.
3085         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3086         (Output_data_plt_x86_64::rela_irelative): New function.
3087         (Output_data_plt_x86_64::address_for_global): New function.
3088         (Output_data_plt_x86_64::address_for_local): New function.
3089         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3090         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3091         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3092         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3093         parameters.
3094         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3095         reloc.
3096         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3097         symbols if we didn't create an IRELATIVE GOT.
3098         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3099         plt_address_for_local.
3100         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3101         * testsuite/ifuncvar1.c: New test file.
3102         * testsuite/ifuncvar2.c: New test file.
3103         * testsuite/ifuncvar3.c: New test file.
3104         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3105         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3106         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3107         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3108         * testsuite/Makefile.in: Rebuild.
3109
3110 2011-07-07  Cary Coutant  <ccoutant@google.com>
3111
3112         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3113         (two_file_test_1_ndebug.o): Likewise.
3114         (two_file_test_1b_ndebug.o): Likewise.
3115         (two_file_test_2_ndebug.o): Likewise.
3116         (two_file_test_main_ndebug.o): Likewise.
3117         (incremental_test_2): Link with no-debug versions.
3118
3119 2011-07-06  Cary Coutant  <ccoutant@google.com>
3120
3121         * gold/incremental.cc
3122         (Output_section_incremental_inputs::write_info_blocks): Check for
3123         hidden and internal symbols.
3124
3125 2011-07-06  Cary Coutant  <ccoutant@google.com>
3126
3127         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3128         Check disposition for startup file.
3129         (Incremental_inputs::report_command_line): Ignore
3130         --incremental-startup-unchanged option.
3131         * options.cc (General_options::parse_incremental_startup_unchanged):
3132         New function.
3133         (General_options::General_options): Initialize new data member.
3134         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3135         (General_options): Add --incremental-startup-unchanged option.
3136         (General_options::incremental_startup_disposition): New function.
3137         (General_options::incremental_startup_disposition_): New data member.
3138
3139 2011-07-06  Cary Coutant  <ccoutant@google.com>
3140
3141         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3142         input file index to Script_info ctor.
3143         (Sized_incremental_binary::do_file_has_changed): Find the
3144         command-line argument for files named in scripts.
3145         * incremental.h (Script_info::Script_info): New ctor
3146         with input file index.
3147         (Script_info::input_file_index): New function.
3148         (Script_info::input_file_index_): New data member.
3149         (Incremental_binary::get_library): Add const.
3150         (Incremental_binary::get_script_info): Add const.
3151         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3152         * testsuite/Makefile.am (incremental_test_5): New test case.
3153         (incremental_test_6): New test case.
3154         * testsuite/Makefile.in: Regenerate.
3155
3156 2011-07-06  Cary Coutant  <ccoutant@google.com>
3157
3158         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3159         debug output when command lines differ.
3160
3161 2011-07-06  Cary Coutant  <ccoutant@google.com>
3162
3163         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3164         --incremental-patch option.
3165         * layout.cc (Free_list::allocate): Extend allocation beyond original
3166         end if enabled.
3167         (Layout::make_output_section): Mark sections that should get
3168         patch space.
3169         * options.cc (parse_percent): New function.
3170         * options.h (parse_percent): New function.
3171         (DEFINE_percent): New macro.
3172         (General_options): Add --incremental-patch option.
3173         * output.cc (Output_section::Output_section): Initialize new data
3174         members.
3175         (Output_section::add_input_section): Print section name when out
3176         of patch space.
3177         (Output_section::add_output_section_data): Likewise.
3178         (Output_section::set_final_data_size): Add patch space when
3179         doing --incremental-full.
3180         (Output_section::do_reset_address_and_file_offset): Remove patch
3181         space.
3182         (Output_segment::set_section_list_addresses): Print debug output
3183         only if --incremental-update.
3184         * output.h (Output_section::set_is_patch_space_allowed): New function.
3185         (Output_section::is_patch_space_allowed_): New data member.
3186         (Output_section::patch_space_): New data member.
3187         * parameters.cc (Parameters::incremental_full): New function.
3188         * parameters.h (Parameters::incremental_full): New function
3189         * testsuite/Makefile.am (incremental_test_2): Add test for
3190         --incremental-patch option.
3191         * testsuite/Makefile.in: Regenerate.
3192         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3193         (t18): Remove function body.
3194
3195 2011-07-05  Doug Kwan  <dougkwan@google.com>
3196
3197         PR gold/12771
3198         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3199         Arm_Address type for relocation result.
3200         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3201         overflow check.
3202         (Arm_relocate_functions::abs32): Use unaligned access.
3203         (Arm_relocate_functions::rel32): Ditto.
3204         (Arm_relocate_functions::prel31): Ditto.
3205         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3206         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3207         static data relocations.
3208         * testsuite/Makefile.in: Regnerate.
3209         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3210
3211 2011-07-05  Ian Lance Taylor  <iant@google.com>
3212
3213         PR gold/12392
3214         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3215         symbols if necessary.
3216         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3217
3218 2011-07-05  Ian Lance Taylor  <iant@google.com>
3219
3220         PR gold/12952
3221         * resolve.cc (Symbol::override_base_with_special): Simply override
3222         version with special symbol version, ignoring previous version.
3223
3224 2011-07-05  Ian Lance Taylor  <iant@google.com>
3225
3226         * object.cc (Sized_relobj_file::include_section_group): Add
3227         information to comment about signature location.
3228
3229 2011-07-02  Ian Lance Taylor  <iant@google.com>
3230
3231         PR gold/12957
3232         * options.h (class General_options): Add -f and -F.
3233         * options.cc (General_options::finalize): Fatal error if -f/-F
3234         are used without -shared.
3235         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3236
3237 2011-07-02  Ian Lance Taylor  <iant@google.com>
3238
3239         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3240
3241 2011-07-01  Ian Lance Taylor  <iant@google.com>
3242
3243         PR gold/12525
3244         PR gold/12952
3245         * resolve.cc (Symbol::override_base_with_special): Don't override
3246         the version if the overriding symbol has a different name.
3247         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3248         all callers.  If we give an error about an undefined version,
3249         define the base version if necessary.
3250         * dynobj.h (class Versions): Update declaration.
3251         * testsuite/weak_alias_test_5.cc: New file.
3252         * testsuite/weak_alias_test.script: New file.
3253         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3254         and versioned_alias have the right value, and call t2.
3255         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3256         weak_alias_test_5.so.
3257         (weak_alias_test_LDADD): Likewise.
3258         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3259         * testsuite/Makefile.in: Rebuild.
3260
3261 2011-07-01  Ian Lance Taylor  <iant@google.com>
3262
3263         PR gold/12525
3264         * options.h (class General_options): Support -z notext.
3265         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3266         -Wl,-z,notext.
3267         (two_file_shared_nonpic.so): Likewise.
3268         (two_file_shared_mixed.so): Likewise.
3269         (two_file_shared_mixed_1.so): Likewise.
3270         (weak_undef_lib_nonpic.so): Likewise.
3271         (alt/weak_undef_lib_nonpic.so): Likewise.
3272         (tls_test_shared_nonpic.so): Likewise.
3273         * testsuite/Makefile.in: Rebuild.
3274
3275 2011-07-01  Ian Lance Taylor  <iant@google.com>
3276
3277         PR gold/12525
3278         * configure.ac: Test whether static linking works, setting
3279         the automake conditional HAVE_STATIC.
3280         * testsuite/Makefile.am: Disable tests using -static if
3281         HAVE_STATIC is not true.
3282         * configure, testsuite/Makefile.in: Rebuild.
3283
3284 2011-07-01  Ian Lance Taylor  <iant@google.com>
3285
3286         PR gold/12525
3287         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3288         Assert if we see DW_EH_PE_indirect.
3289         * target.h (Target::ehframe_datarel_base): New function.
3290         (Target::do_ehframe_datarel_base): New target function.
3291         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3292         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3293         function.
3294
3295 2011-07-01  Ian Lance Taylor  <iant@google.com>
3296
3297         PR gold/12571
3298         * options.h (class General_options): Add
3299         --ld-generated-unwind-info.
3300         * ehframe.cc (Fde::write): Add address parameter.  Change all
3301         callers.  If associated with PLT, fill in address and size.
3302         (Cie::set_output_offset): Only add merge mapping if there is an
3303         object.
3304         (Cie::write): Add address parameter.  Change all callers.
3305         (Eh_frame::add_ehframe_for_plt): New function.
3306         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3307         input_offset_ fields into union u_, with new plt field.
3308         (Fde::Fde): Adjust for new union field.
3309         (Fde::Fde) [Output_data version]: New constructor.
3310         (Fde::add_mapping): Only add merge mapping if there is an object.
3311         (class Cie): Update declarations.
3312         (class Eh_frame): Declare add_ehframe_for_plt.
3313         * layout.cc (Layout::layout_eh_frame): Break out code into
3314         make_eh_frame_section, and call it.
3315         (Layout::make_eh_frame_section): New function.
3316         (Layout::add_eh_frame_for_plt): New function.
3317         * layout.h (class Layout): Update declarations.
3318         * merge.cc (Merge_map::add_mapping): Add assertion.
3319         * i386.cc: Include "dwarf.h".
3320         (class Output_data_plt_i386): Make first_plt_entry,
3321         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3322         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3323         and plt_eh_frame_fde.
3324         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3325         boundary.  Call add_eh_frame_for_plt if appropriate.
3326         * x86_64.cc: Include "dwarf.h".
3327         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3328         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3329         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3330         and plt_eh_frame_fde.
3331         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3332         appropriate.
3333
3334 2011-06-29  Ian Lance Taylor  <iant@google.com>
3335
3336         PR gold/12629
3337         * object.cc (Sized_relobj_file::layout_section): Change shdr
3338         parameter to be const.
3339         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3340         out of do_layout.
3341         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3342         appropriate.  Call layout_eh_frame_section.
3343         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3344         sections.
3345         * object.h (class Sized_relobj_file): Update declarations.
3346
3347 2011-06-29  Ian Lance Taylor  <iant@google.com>
3348
3349         PR gold/12652
3350         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3351         modifier.
3352         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3353
3354 2011-06-29  Ian Lance Taylor  <iant@google.com>
3355
3356         PR gold/12675
3357         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3358         SHT_X86_64_UNWIND.
3359         * layout.cc (Layout::layout_eh_frame): Likewise.
3360
3361 2011-06-29  Ian Lance Taylor  <iant@google.com>
3362
3363         PR gold/12695
3364         * layout.cc (Layout::symtab_section_shndx): New function.
3365         * layout.h (class Layout): Declare symtab_section_shndx.
3366         * output.cc (Output_section::write_header): Call it.
3367
3368 2011-06-29  Ian Lance Taylor  <iant@google.com>
3369
3370         PR gold/12818
3371         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3372         symbols which are not used in a relocation.
3373
3374 2011-06-28  Ian Lance Taylor  <iant@google.com>
3375
3376         PR gold/12898
3377         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3378         script create indistinguishable segments.
3379         (Layout::set_segment_offsets): Use stable_sort when sorting
3380         segments.  Pass this to Compare_segments constructor.
3381         * layout.h (class Layout): Make segment_precedes non-static.
3382         (class Compare_segments): Change from struct to class.  Add
3383         layout_ field.  Add constructor.
3384         * script-sections.cc
3385         (Script_sections::attach_sections_using_phdrs_clause): Rename
3386         local orphan to is_orphan.  Don't report failure to put empty
3387         section in segment.  On attachment failure, report name of
3388         section, and attach to first PT_LOAD segment.
3389
3390 2011-06-28  Ian Lance Taylor  <iant@google.com>
3391
3392         PR gold/12934
3393         * target-select.cc (Target_selector::Target_selector): Add
3394         emulation parameter.  Change all callers.
3395         (select_target_by_bfd_name): Rename from select_target_by_name.
3396         Change all callers.
3397         (select_target_by_emulation): New function.
3398         (supported_emulation_names): New function.
3399         * target-select.h (class Target_selector): Add emulation_ field.
3400         Update declarations.
3401         (Target_selector::recognize_by_bfd_name): Rename from
3402         recognize_by_name.  Change all callers.
3403         (Target_selector::supported_bfd_names): Rename from
3404         supported_names.  Change all callers.
3405         (Target_selector::recognize_by_emulation): New function.
3406         (Target_selector::supported_emulations): New function.
3407         (Target_selector::emulation): New function.
3408         (Target_selector::do_recognize_by_bfd_name): Rename from
3409         do_recognize_by_name.  Change all callers.
3410         (Target_selector::do_supported_bfd_names): Rename from
3411         do_supported_names.  Change all callers.
3412         (Target_selector::do_recognize_by_emulation): New function.
3413         (Target_selector::do_supported_emulations): New function.
3414         (select_target_by_bfd_name): Change name in declaration.
3415         (select_target_by_emulation): Declare.
3416         (supported_emulation_names): Declare.
3417         * parameters.cc (parameters_force_valid_target): Try to find
3418         target based on emulation from -m option.
3419         * options.h (class General_options): Change doc string for -m.
3420         * options.cc (help): Print emulations.
3421         (General_options::parse_V): Likewise.
3422         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3423         Add emulation parameter.  Change all callers.
3424
3425 2011-06-28  Ian Lance Taylor  <iant@google.com>
3426
3427         * target.h (class Target): Add osabi_ field.
3428         (Target::osabi): New function.
3429         (Target::set_osabi): New function.
3430         (Target::Target): Initialize osabi_.
3431         (Target::do_adjust_elf_header): Make pure virtual.
3432         (Sized_target::do_adjust_elf_header): Declare.
3433         * target.cc (Sized_target::do_adjust_elf_header): New function.
3434         (class Sized_target): Instantiate all versions.
3435         * freebsd.h (class Target_freebsd): Remove.
3436         (Target_selector_freebsd::do_recognize): Call set_osabi on
3437         Target.
3438         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3439         (Target_selector_freebsd::set_osabi): Remove.
3440         * i386.cc (class Target_i386): Inherit from Sized_target rather
3441         than Target_freebsd.
3442         * x86_64.cc (class Target_x86_64): Likewise.
3443
3444 2011-06-28  Ian Lance Taylor  <iant@google.com>
3445
3446         * target.h (Target::can_check_for_function_pointers): Rewrite.
3447         Make non-virtual.
3448         (Target::can_icf_inline_merge_sections): Likewise.
3449         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3450         (Target::Target_info): Add can_icf_inline_merge_sections field.
3451         (Target::do_can_check_for_function_pointers): New virtual
3452         function.
3453         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3454         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3455         from can_check_for_function_pointers, move in file.
3456         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3457         section_may_have_icf_unsafe_poineters, move in file.
3458         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3459         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3460         Rename from can_check_for_function_pointers, move in file.
3461         (Target_i386::can_icf_inline_merge_sections): Remove.
3462         (Target_i386::i386_info): Initialize
3463         can_icf_inline_merge_sections.
3464         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3465         Initialize can_icf_inline_merge_sections.
3466         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3467         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3468         Rename from can_check_for_function_pointers, move in file.
3469         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3470         (Target_x86_64::x86_64_info): Initialize
3471         can_icf_inline_merge_sections.
3472         * testsuite/testfile.cc (Target_test::test_target_info):
3473         Likewise.
3474         * icf.cc (get_section_contents): Correct formatting.
3475
3476 2011-06-27  Ian Lance Taylor  <iant@google.com>
3477
3478         * symtab.cc (Symbol::versioned_name): New function.
3479         (Symbol_table::add_to_final_symtab): Use versioned_name when
3480         appropriate.
3481         (Symbol_table::sized_write_symbol): Likewise.
3482         * symtab.h (class Symbol): Declare versioned_name.
3483         * stringpool.h (class Stringpool_template): Add variant of add
3484         which takes a std::basic_string.
3485         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3486         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3487         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3488         (ver_test_12.o): New target.
3489         * testsuite/Makefile.in: Rebuild.
3490
3491 2011-06-27  Doug Kwan  <dougkwan@google.com>
3492
3493         * arm.cc (Arm_relocate_functions::thm_jump8,
3494         Arm_relocate_functions::thm_jump11): Use a wider signed
3495         type to compute offset.
3496         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3497         arm_thm_jump8.
3498         * testsuite/Makefile.in: Regenerate.
3499         * testsuite/arm_branch_in_range.sh: Check test results of
3500         arm_thm_jump11 and arm_thm_jump8.
3501         * testsuite/arm_thm_jump11.s: New test source file.
3502         * testsuite/arm_thm_jump11.t: New linker script.
3503         * testsuite/arm_thm_jump8.s: New test source file.
3504         * testsuite/arm_thm_jump8.t: New linker script.
3505
3506 2011-06-24  Ian Lance Taylor  <iant@google.com>
3507
3508         * layout.cc: Include "object.h".
3509         (ctors_sections_in_init_array): New static variable.
3510         (Layout::is_ctors_in_init_array): New function.
3511         (Layout::layout): Add entry to ctors_sections_in_init_array if
3512         appropriate.
3513         * layout.h (class Layout): Declare is_ctors_in_init_array.
3514         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3515         is_ctors_reverse_view is set.
3516         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3517         all callers.  Set is_ctors_reverse_view field of View_size.
3518         (Sized_relobj_file::reverse_words): New function.
3519         * object.h (Sized_relobj_file::View_size): Add
3520         is_ctors_reverse_view field.
3521         (class Sized_relobj_file): Update declarations.
3522         * testsuite/initpri3.c: New test.
3523         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3524         initpri3b.
3525         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3526         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3527         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3528         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3529         * testsuite/Makefile.in: Rebuild.
3530
3531 2011-06-24  Cary Coutant  <ccoutant@google.com>
3532
3533         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3534         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3535         (debug_msg_cdebug.err): New targets.
3536         * testsuite/Makefile.in: Regenerate.
3537         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3538         Fix checks for link with shared library.
3539
3540 2011-06-24  Doug Kwan  <dougkwan@google.com>
3541
3542         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3543         skip empty text sections.
3544         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3545
3546 2011-06-22  Ian Lance Taylor  <iant@google.com>
3547
3548         PR gold/12910
3549         * options.h (class General_options): Add --ctors-in-init-array.
3550         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3551         friends as SHT_PROGBITS for merging sections.
3552         (Layout::layout): Remove special handling of .init_array and
3553         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3554         and .dtors if ctors_in_init_array.
3555         (Layout::make_output_section): Force correct section types for
3556         .init_array and friends.  Don't sort if doing relocatable link,
3557         Don't sort .ctors and .dtors if ctors_in_init_array.
3558         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3559         (Layout::output_section_name): Add relobj parameter.  Change all
3560         callers.  Handle .ctors. and .dtors. in code rather than table.
3561         Handle .ctors and .dtors if ctors_in_init_array.
3562         (Layout::match_file_name): New function, moved from output.cc.
3563         * layout.h (class Layout): Update declarations.
3564         * output.cc: Include "layout.h".
3565         (Input_section_sort_entry::get_priority): New function.
3566         (Input_section_sort_entry::match_file_name): Just call
3567         Layout::match_file_name.
3568         (Output_section::Input_section_sort_init_fini_compare::operator()):
3569         Handle .ctors and .dtors.  Sort by explicit priority rather than
3570         by name.
3571         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3572         * testsuite/initpri2.c: New test.
3573         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3574         (check_PROGRAMS): Add initpri2.
3575         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3576         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3577         * configure, testsuite/Makefile.in: Rebuild.
3578
3579 2011-06-19  Ian Lance Taylor  <iant@google.com>
3580
3581         PR gold/12880
3582         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3583         .interp section to a PT_INTERP segment even if we have seen a
3584         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3585         clause in a linker script.
3586         (Layout::finalize): Don't create a .interp section if we've
3587         already create a PT_INTERP segment.
3588         (Layout::create_interp): Always call choose_output_section (revert
3589         patch of 2011-06-17).  Don't create PT_INTERP segment.
3590         * script-sections.cc
3591         (Script_sections::create_note_and_tls_segments): Add a .interp
3592         section to a PT_INTERP segment even if we have seen a
3593         --dynamic-linker option.
3594
3595 2011-06-18  Ian Lance Taylor  <iant@google.com>
3596
3597         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3598         merely because a non-PT_LOAD segment has a dynamic reloc.
3599
3600 2011-06-18  Ian Lance Taylor  <iant@google.com>
3601
3602         * layout.cc (Layout::finish_dynamic_section): Don't create
3603         DT_FLAGS entry if not needed.
3604
3605 2011-06-18  Ian Lance Taylor  <iant@google.com>
3606
3607         PR gold/12745
3608         * layout.cc (Layout::layout_eh_frame): Correct handling of
3609         writable .eh_frame section.
3610
3611 2011-06-17  Ian Lance Taylor  <iant@google.com>
3612
3613         PR gold/12893
3614         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3615         symbol is redefined with the exact same object and value.
3616
3617 2011-06-17  Ian Lance Taylor  <iant@google.com>
3618
3619         PR gold/12880
3620         * layout.h (class Layout): Add interp_segment_ field.
3621         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3622         (Layout::attach_allocated_section_to_segment): If making shared
3623         library, put .interp section in PT_INTERP segment.
3624         (Layout::finalize): Also call create_interp if -dynamic-linker
3625         option was used.
3626         (Layout::create_interp): Assert that there is no PT_INTERP
3627         segment.  If not using a SECTIONS clause, use make_output_section.
3628         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3629         * script-sections.cc
3630         (Script_sections::create_note_and_tls_segments): If making shared
3631         library, put .interp section in PT_INTERP segment.
3632
3633 2011-06-17  Ian Lance Taylor  <iant@google.com>
3634
3635         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3636         when making a shared library.
3637
3638 2011-06-17  Ian Lance Taylor  <iant@google.com>
3639
3640         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3641         parameter.  Change all callers.  Don't issue warning about PC32
3642         against locally defined symbol.
3643
3644 2011-06-16  Ian Lance Taylor  <iant@google.com>
3645
3646         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3647         occurs in same object.
3648
3649 2011-06-14  Alan Modra  <amodra@gmail.com>
3650
3651         * po/POTFILES.in: Regenerate.
3652
3653 2011-06-09  Ian Lance Taylor  <iant@google.com>
3654
3655         * script-sections.cc
3656         (Orphan_output_section::set_section_addresses): For a relocatable
3657         link set address to 0.
3658
3659 2011-06-09  Cary Coutant  <ccoutant@google.com>
3660
3661         PR gold/12804
3662         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3663         used with --compress-debug-sections.
3664         * gold/object.cc (Sized_relobj_file::do_layout): Report
3665         uncompressed size of compressed input sections.
3666
3667 2011-06-08  Cary Coutant  <ccoutant@google.com>
3668
3669         PR gold/12804
3670         * testsuite/two_file_test_2_v1.cc: Change initialization of
3671         v2 to keep it in .data.
3672
3673 2011-06-07  Cary Coutant  <ccoutant@google.com>
3674
3675         * common.cc (Symbol_table::do_allocate_commons_list): Call
3676         gold_fallback.
3677         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3678         (Errors::fallback): New function.
3679         (gold_fallback): New function.
3680         * errors.h (Errors::fallback): New function.
3681         * gold.cc (gold_exit): Change status parameter to enum; adjust
3682         all callers.
3683         (queue_initial_tasks): Call gold_fallback.
3684         * gold.h: Include cstdlib.
3685         (Exit_status): New enum type.
3686         (gold_exit): Change status parameter to enum.
3687         (gold_fallback): New function.
3688         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3689         (Layout::create_symtab_sections): Likewise.
3690         (Layout::create_shdrs): Likewise.
3691         * main.cc (main): Adjust call to gold_exit.
3692         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3693         (Output_data_got::add_got_entry_pair): Likewise.
3694         (Output_section::add_input_section): Likewise.
3695         (Output_section::add_output_section_data): Likewise.
3696         (Output_segment::set_section_list_addresses): Likewise.
3697         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3698
3699 2011-06-07  Cary Coutant  <ccoutant@google.com>
3700
3701         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3702         for incremental links.
3703         * output.cc (Output_segment::set_section_list_addresses): Remove
3704         FIXME and test for TLS or BSS.
3705
3706 2011-06-07  Cary Coutant  <ccoutant@google.com>
3707
3708         * testsuite/Makefile.am: Add incremental_copy_test,
3709         incremental_common_test_1.
3710         * testsuite/Makefile.in: Regenerate.
3711         * testsuite/common_test_1_v1.c: New source file.
3712         * testsuite/common_test_1_v2.c: New source file.
3713         * testsuite/copy_test_v1.cc: New source file.
3714
3715 2011-06-07  Cary Coutant  <ccoutant@google.com>
3716
3717         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3718         update, allocate common from bss section's free list.
3719         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3720         linker-defined symbols.
3721         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3722         Skip GOT and PLT entries that are no longer referenced.
3723         (Output_section_incremental_inputs::write_info_blocks): Mark
3724         linker-defined symbols.
3725         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3726         * output.cc (Output_section::allocate): New function.
3727         * output.h (Output_section::allocate): New function.
3728         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3729         linker-defined symbols.
3730         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3731         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3732         (Symbol::init_base_output_data): Likewise.
3733         (Symbol::init_base_output_segment): Likewise.
3734         (Symbol::init_base_constant): Likewise.
3735         (Sized_symbol::init_output_data): Likewise.
3736         (Sized_symbol::init_output_segment): Likewise.
3737         (Sized_symbol::init_constant): Likewise.
3738         (Symbol_table::do_define_in_output_data): Likewise.
3739         (Symbol_table::do_define_in_output_segment): Likewise.
3740         (Symbol_table::do_define_as_constant): Likewise.
3741         * symtab.h (Symbol::is_predefined): New function.
3742         (Symbol::init_base_output_data): Add is_predefined parameter.
3743         (Symbol::init_base_output_segment): Likewise.
3744         (Symbol::init_base_constant): Likewise.
3745         (Symbol::is_predefined_): New data member.
3746         (Sized_symbol::init_output_data): Add is_predefined parameter.
3747         (Sized_symbol::init_output_segment): Likewise.
3748         (Sized_symbol::init_constant): Likewise.
3749         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3750
3751 2011-06-07  Cary Coutant  <ccoutant@google.com>
3752
3753         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3754         instead of emit_copy_reloc.
3755         (Copy_relocs::emit_copy_reloc): Refactor.
3756         (Copy_relocs::make_copy_reloc): New function.
3757         (Copy_relocs::add_copy_reloc): Remove.
3758         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3759         section.
3760         (Copy_relocs::make_copy_reloc): New function.
3761         (Copy_relocs::add_copy_reloc): Remove.
3762         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3763         unchanged input files.
3764         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3765         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3766         Reserve BSS space for COPY relocations.
3767         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3768         (Output_section_incremental_inputs::write_info_blocks): Record
3769         whether a symbol is copied from a shared object.
3770         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3771         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3772         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3773         (Incremental_input_entry_reader::get_output_symbol_index): Add
3774         is_copy parameter.
3775         (Incremental_binary::emit_copy_relocs): New function.
3776         (Incremental_binary::do_emit_copy_relocs): New function.
3777         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3778         new data member.
3779         (Sized_incremental_binary::add_copy_reloc): New function.
3780         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3781         (Sized_incremental_binary::Copy_reloc): New struct.
3782         (Sized_incremental_binary::Copy_relocs): New typedef.
3783         (Sized_incremental_binary::copy_relocs_): New data member.
3784         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3785         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3786         * target.h (Sized_target::emit_copy_reloc): New function.
3787         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3788
3789 2011-06-02  Cary Coutant  <ccoutant@google.com>
3790
3791         PR gold/12163
3792         * gold/archive.cc (Archive::Archive): Initialize new data member.
3793         (Archive::include_all_members): Return if archive has already been
3794         included.
3795         * gold/archive.h (Archive::include_all_members_): New data member.
3796
3797 2011-06-02  Nick Clifton  <nickc@redhat.com>
3798
3799         * dynobj.h: Fix spelling mistake in comment.
3800         * output.cc: Likewise.
3801
3802 2011-05-31  Doug Kwan  <dougkwan@google.com>
3803             Asier Llano
3804
3805         PR gold/12826
3806         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3807         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3808         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3809         redundant arm_exidx_test.so.
3810         * testsuite/Makefile.in: Regenerate.
3811         (check_SCRIPTS): Add pr12826.sh
3812         (check_DATA): Add pr12826.stdout
3813         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3814         * testsuite/pr12826.sh: New file.
3815         * testsuite/pr12826_1.s: Ditto.
3816         * testsuite/pr12826_1.s: Ditto.
3817
3818 2011-05-30  Ian Lance Taylor  <iant@google.com>
3819
3820         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3821         sections.
3822
3823 2011-05-29  Ian Lance Taylor  <iant@google.com>
3824
3825         PR gold/12804
3826         * testsuite/Makefile.am: Use different file name for two_file_test
3827         temporary file for each incremental test.
3828         * testsuite/Makefile.in: Rebuild.
3829
3830 2011-05-29  Ian Lance Taylor  <iant@google.com>
3831
3832         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3833         binary input file is empty.
3834
3835 2011-05-27  Ian Lance Taylor  <iant@google.com>
3836
3837         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3838         (ver_test_9.so): Likewise.
3839         * testsuite/Makefile.in: Rebuild.
3840
3841 2011-05-26 Cary Coutant  <ccoutant@google.com>
3842
3843         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3844         * incremental.cc (Incremental_inputs::report_input_section): Fix
3845         comment, indentation.
3846         (Incremental_inputs::report_comdat_group): New function.
3847         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3848         of data for incremental input file entry.
3849         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3850         group count, COMDAT group signatures.
3851         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3852         an unchanged input file.
3853         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3854         Initialize new data member.
3855         (Incremental_object_entry::add_comdat_group): New function.
3856         (Incremental_object_entry::get_comdat_group_count): New function.
3857         (Incremental_object_entry::get_comdat_signature_key): New function.
3858         (Incremental_object_entry::groups_): New data member.
3859         (Incremental_inputs::report_comdat_group): New function.
3860         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3861         data for incremental input file entry.
3862         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3863         (Incremental_input_entry_reader::get_input_section): Adjust size of
3864         data for incremental input file entry.
3865         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3866         (Incremental_input_entry_reader::get_comdat_group_signature): New
3867         function.
3868         * object.cc (Sized_relobj::include_section_group): Report kept
3869         COMDAT groups for incremental links.
3870
3871 2011-05-24  David Meyer  <pdox@google.com>
3872
3873         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3874         with name parameter.  Add found_name parameter.
3875         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3876         * dirsearch.h (class Dirsearch): Update declaration.
3877
3878 2011-05-24  Ian Lance Taylor  <iant@google.com>
3879
3880         * archive.cc (Library_base::should_include_member): Pull in object
3881         from archive if it defines the entry symbol.
3882         * parameters.cc (Parameters::entry): New function.
3883         * parameters.h (class Parameters): Declare entry.
3884         * output.h (class Output_file_header): Remove entry_ field.
3885         * output.cc (Output_file_header::Output_file_header): Remove entry
3886         parameter.  Change all callers.
3887         (Output_file_header::entry): Use parameters->entry.
3888         * gold.cc (queue_middle_tasks): Likewise.
3889         * plugin.cc (Plugin_hook::run): Likewise.
3890
3891 2011-05-24 Cary Coutant  <ccoutant@google.com>
3892
3893         * gold.cc (queue_initial_tasks): Pass incremental base filename
3894         to Output_file::open_base_file; don't print error message.
3895         * incremental-dump.cc (main): Adjust call to
3896         Output_file::open_for_modification.
3897         * incremental-dump.cc (main): Likewise.
3898         * incremental.cc (Incremental_inputs::report_command_line):
3899         Ignore --incremental-base option when comparing command lines.
3900         Ignore parameter when given as separate argument.
3901         * options.h (class General_options): Add --incremental-base.
3902         * output.cc (Output_file::Output_file):
3903         (Output_file::open_base_file): Add base_name and writable parameters;
3904         read base file into new file; print error message here.
3905         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3906         callers.
3907         * output.h (Output_file::open_for_modification): Rename to...
3908         (Output_file::open_base_file): ...this; add base_name and
3909         writable parameters; adjust all callers.
3910         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3911         callers.
3912         * testsuite/Makefile.am (incremental_test_4): Test
3913         --incremental-base.
3914         * testsuite/Makefile.in: Regenerate.
3915
3916 2011-05-24 Cary Coutant  <ccoutant@google.com>
3917
3918         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3919         incremental_test_4.
3920         * testsuite/Makefile.in: Regenerate.
3921         * testsuite/two_file_test_1_v1.cc: New test source file.
3922         * testsuite/two_file_test_1b_v1.cc: New test source file.
3923         * testsuite/two_file_test_2_v1.cc: New test source file.
3924
3925 2011-05-24 Cary Coutant  <ccoutant@google.com>
3926
3927         * dynobj.h (Dynobj::do_dynobj): New function.
3928         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3929         flag and soname for shared objects.
3930         * incremental.cc (Incremental_inputs::report_object): Make
3931         either Incremental_object_entry or Incremental_dynobj_entry; add
3932         soname to string table.
3933         (Incremental_inputs::report_input_section): Add assertion.
3934         (Output_section_incremental_inputs::set_final_data_size): Adjust
3935         type of input file entry for shared libraries; adjust size of
3936         shared library info entry.
3937         (Output_section_incremental_inputs::write_input_files): Write
3938         as_needed flag for shared libraries.
3939         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3940         of input file entry for shared libraries; write soname.
3941         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3942         soname from incremental info.
3943         * incremental.h (enum Incremental_input_flags): Add
3944         INCREMENTAL_INPUT_AS_NEEDED.
3945         (Incremental_input_entry::Incremental_input_entry): Initialize new
3946         data member.
3947         (Incremental_input_entry::set_as_needed): New function.
3948         (Incremental_input_entry::as_needed): New function.
3949         (Incremental_input_entry::do_dynobj_entry): New function.
3950         (Incremental_input_entry::as_needed_): New data member.
3951         (Incremental_object_entry::Incremental_object_entry): Don't check
3952         for shared library.
3953         (Incremental_object_entry::do_type): Likewise.
3954         (class Incremental_dynobj_entry): New class.
3955         (Incremental_input_entry_reader::as_needed): New function.
3956         (Incremental_input_entry_reader::get_soname): New function.
3957         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3958         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3959         size of shared library info entry.
3960         * layout.cc (Layout::finish_dynamic_section): Don't test for
3961         incremental link when adding DT_NEEDED entries.
3962         * object.h (Object::Object): Initialize new data member.
3963         (Object::dynobj): New function.
3964         (Object::set_as_needed): New function.
3965         (Object::as_needed): New function.
3966         (Object::do_dynobj): New function.
3967         (Object::as_needed_): New data member.
3968
3969 2011-05-24 Cary Coutant  <ccoutant@google.com>
3970
3971         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3972         info; adjust display of GOT entries.
3973         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3974         vector of input objects; remove file_status_.
3975         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3976         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3977         got_plt reader; call target hooks to reserve GOT entries.
3978         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3979         of input file info header and GOT info entry.
3980         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3981         relocation info.
3982         (Got_plt_view_info::got_descriptor): Remove.
3983         (Got_plt_view_info::sym_index): New data member.
3984         (Got_plt_view_info::input_index): New data member.
3985         (Local_got_offset_visitor::visit): Write input file index.
3986         (Global_got_offset_visitor::visit): Write 0 for input file index.
3987         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3988         with sym_index and input_index.
3989         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3990         incremental info GOT entry; replace got_descriptor with input_index.
3991         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3992         map from input file index to object.
3993         (Sized_relobj_incr::do_layout): Replace direct data member reference
3994         with accessor function.
3995         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3996         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3997         Adjust size of input file info header.
3998         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3999         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4000         (Incremental_input_entry_reader::get_input_section): Adjust size of
4001         input file info header.
4002         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4003         of incremental info GOT entry.
4004         (Incremental_got_plt_reader::get_got_desc): Remove.
4005         (Incremental_got_plt_reader::get_got_symndx): New function.
4006         (Incremental_got_plt_reader::get_got_input_index): New function.
4007         (Sized_incremental_binary::Sized_incremental_binary): Remove
4008         file_status_; add input_objects_.
4009         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4010         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4011         (Sized_incremental_binary::file_is_unchanged): Remove.
4012         (Sized_incremental_binary::set_input_object): New function.
4013         (Sized_incremental_binary::input_object): New function.
4014         (Sized_incremental_binary::file_status_): Remove.
4015         (Sized_incremental_binary::input_objects_): New data member.
4016         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4017         references.
4018         (Sized_relobj_incr::invalid_address): Move to base class.
4019         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4020         class.
4021         (Sized_relobj_incr::do_output_section_offset): Likewise.
4022         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4023         (Sized_relobj_incr::section_offsets_): Likewise.
4024         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4025         function.
4026         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4027         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4028         with accessor function.
4029         (Sized_relobj_file::do_layout): Likewise.
4030         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4031         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4032         (Sized_relobj_file::compute_final_local_value): Replace refs to
4033         section_offsets_ with accessor function.
4034         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4035         * object.h (Relobj::Relobj): Initialize new data members.
4036         (Relobj::add_dyn_reloc): New function.
4037         (Relobj::first_dyn_reloc): New function.
4038         (Relobj::dyn_reloc_count): New function.
4039         (Relobj::first_dyn_reloc_): New data member.
4040         (Relobj::dyn_reloc_count_): New data member.
4041         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4042         references.
4043         (Sized_relobj::Address): New typedef.
4044         (Sized_relobj::invalid_address): Move here from child class.
4045         (Sized_relobj::Sized_relobj): Initialize new data members.
4046         (Sized_relobj::sized_relobj): New function.
4047         (Sized_relobj::is_output_section_offset_invalid): Move here from
4048         child class.
4049         (Sized_relobj::get_output_section_offset): Likewise.
4050         (Sized_relobj::local_has_got_offset): Likewise.
4051         (Sized_relobj::local_got_offset): Likewise.
4052         (Sized_relobj::set_local_got_offset): Likewise.
4053         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4054         (Sized_relobj::clear_got_offsets): New function.
4055         (Sized_relobj::section_offsets): Move here from child class.
4056         (Sized_relobj::do_output_section_offset): Likewise.
4057         (Sized_relobj::do_set_section_offset): Likewise.
4058         (Sized_relobj::Local_got_offsets): Likewise.
4059         (Sized_relobj::local_got_offsets_): Likewise.
4060         (Sized_relobj::section_offsets_): Likewise.
4061         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4062         references.
4063         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4064         class.
4065         (Sized_relobj_file::sized_relobj): New function
4066         (Sized_relobj_file::local_has_got_offset): Move to base class.
4067         (Sized_relobj_file::local_got_offset): Likewise.
4068         (Sized_relobj_file::set_local_got_offset): Likewise.
4069         (Sized_relobj_file::get_output_section_offset): Likewise.
4070         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4071         (Sized_relobj_file::do_output_section_offset): Likewise.
4072         (Sized_relobj_file::do_set_section_offset): Likewise.
4073         (Sized_relobj_file::Local_got_offsets): Likewise.
4074         (Sized_relobj_file::local_got_offsets_): Likewise.
4075         (Sized_relobj_file::section_offsets_): Likewise.
4076         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4077         (all constructors).
4078         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4079         (Output_reloc::get_symbol_index): Likewise.
4080         (Output_reloc::local_section_offset): Likewise.
4081         (Output_reloc::get_address): Likewise.
4082         (Output_reloc::symbol_value): Likewise.
4083         (Output_data_got::reserve_slot): Move to class definition.
4084         (Output_data_got::reserve_local): New function.
4085         (Output_data_got::reserve_slot_for_global): Remove.
4086         (Output_data_got::reserve_global): New function.
4087         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4088         (all constructors, two instantiations).
4089         (Output_reloc::get_relobj): New function (two instantiations).
4090         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4091         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4092         (Output_data_reloc::add_global): Adjust type of relobj.
4093         (Output_data_reloc::add_global_relative): Likewise.
4094         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4095         (Output_data_reloc::add_local): Likewise.
4096         (Output_data_reloc::add_local_relative): Likewise.
4097         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4098         (Output_data_reloc::add_local_section): Likewise.
4099         (Output_data_reloc::add_output_section): Likewise.
4100         (Output_data_reloc::add_absolute): Likewise.
4101         (Output_data_reloc::add_target_specific): Likewise.
4102         (Output_data_got::reserve_slot): Move definition here.
4103         (Output_data_got::reserve_local): New function.
4104         (Output_data_got::reserve_global): New function.
4105         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4106         section_offsets_ with accessor function.
4107         (Sized_relobj_file::write_sections): Likewise.
4108         (Sized_relobj_file::do_relocate_sections): Likewise.
4109         * target.h (Sized_target::reserve_local_got_entry): New function.
4110         (Sized_target::reserve_global_got_entry): New function.
4111         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4112         (Target_x86_64::reserve_global_got_entry): New function.
4113         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4114
4115 2011-05-23 Cary Coutant  <ccoutant@google.com>
4116
4117         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4118         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4119         bit when checking got_type.
4120         * incremental.cc (Sized_incremental_binary::setup_readers):
4121         Store symbol table and string table locations; initialize bit vector
4122         of file status flags.
4123         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4124         unchanged files.
4125         (Sized_incremental_binary::do_process_got_plt): New function.
4126         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4127         (Output_section_incremental_inputs::set_final_data_size): Record
4128         file index for each input file.
4129         (Output_section_incremental_inputs::write_got_plt): Store file index
4130         instead of input entry offset for each GOT entry.
4131         * incremental.h
4132         (Incremental_input_entry::Incremental_input_entry): Initialize new
4133         data member.
4134         (Incremental_input_entry::set_offset): Store file index.
4135         (Incremental_input_entry::get_file_index): New function.
4136         (Incremental_input_entry::file_index_): New data member.
4137         (Incremental_binary::process_got_plt): New function.
4138         (Incremental_binary::do_process_got_plt): New function.
4139         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4140         data members.
4141         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4142         (Sized_incremental_binary::set_file_is_unchanged): New function.
4143         (Sized_incremental_binary::file_is_unchanged): New function.
4144         (Sized_incremental_binary::do_process_got_plt): New function.
4145         (Sized_incremental_binary::file_status_): New data member.
4146         (Sized_incremental_binary::main_symtab_loc_): New data member.
4147         (Sized_incremental_binary::main_strtab_loc_): New data member.
4148         * output.cc (Output_data_got::Got_entry::write): Add case
4149         RESERVED_CODE.
4150         (Output_data_got::add_global): Call add_got_entry.
4151         (Output_data_got::add_global_plt): Likewise.
4152         (Output_data_got::add_global_with_rel): Likewise.
4153         (Output_data_got::add_global_with_rela): Likewise.
4154         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4155         (Output_data_got::add_global_pair_with_rela): Likewise.
4156         (Output_data_got::add_local): Call add_got_entry.
4157         (Output_data_got::add_local_plt): Likewise.
4158         (Output_data_got::add_local_with_rel): Likewise.
4159         (Output_data_got::add_local_with_rela): Likewise.
4160         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4161         (Output_data_got::add_local_pair_with_rela): Likewise.
4162         (Output_data_got::reserve_slot): New function.
4163         (Output_data_got::reserve_slot_for_global): New function.
4164         (Output_data_got::add_got_entry): New function.
4165         (Output_data_got::add_got_entry_pair): New function.
4166         (Output_section::add_output_section_data): Edit FIXME.
4167         * output.h
4168         (Output_section_data_build::Output_section_data_build): New
4169         constructor with size parameter.
4170         (Output_data_space::Output_data_space): Likewise.
4171         (Output_data_got::Output_data_got): Initialize new data member; new
4172         constructor with size parameter.
4173         (Output_data_got::add_constant): Call add_got_entry.
4174         (Output_data_got::reserve_slot): New function.
4175         (Output_data_got::reserve_slot_for_global): New function.
4176         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4177         (Output_data_got::add_got_entry): New function.
4178         (Output_data_got::add_got_entry_pair): New function.
4179         (Output_data_got::free_list_): New data member.
4180         * target.h (Sized_target::init_got_plt_for_update): New function.
4181         (Sized_target::register_global_plt_entry): New function.
4182         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4183         Initialize new data member; call init; add constructor with PLT count.
4184         (Output_data_plt_x86_64::init): New function.
4185         (Output_data_plt_x86_64::add_relocation): New function.
4186         (Output_data_plt_x86_64::reserve_slot): New function.
4187         (Output_data_plt_x86_64::free_list_): New data member.
4188         (Target_x86_64::init_got_plt_for_update): New function.
4189         (Target_x86_64::register_global_plt_entry): New function.
4190         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4191         incremental updates.
4192         (Output_data_plt_x86_64::add_relocation): New function.
4193         * testsuite/object_unittest.cc (Object_test): Set default options.
4194
4195 2011-05-16  Ian Lance Taylor  <iant@google.com>
4196
4197         * options.h (class General_options): Make -i a synonym for -r.
4198
4199 2011-05-16  Ian Lance Taylor  <iant@google.com>
4200
4201         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4202
4203 2011-05-10 Cary Coutant  <ccoutant@google.com>
4204
4205         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4206         strip_all (-s).
4207
4208 2011-05-06  Ian Lance Taylor  <iant@google.com>
4209
4210         * layout.cc (Layout::layout): If the output section flags change,
4211         update the ordering.
4212
4213 2011-04-25 Cary Coutant  <ccoutant@google.com>
4214
4215         * incremental-dump.cc (dump_incremental_inputs): Print local
4216         symbol info for each input file.
4217         * incremental.cc
4218         (Output_section_incremental_inputs::set_final_data_size): Add local
4219         symbol info to input file entries in incremental info.
4220         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4221         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4222         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4223         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4224         implementation.
4225         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4226         (Sized_incr_relobj::do_relocate): Write the local symbols.
4227         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4228         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4229         Adjust size of input file header.
4230         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4231         (Incremental_inputs_reader::get_local_symbol_count): New function.
4232         (Incremental_inputs_reader::get_input_section): Adjust size of input
4233         file header.
4234         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4235         (Sized_incr_relobj::This): New typedef.
4236         (Sized_incr_relobj::sym_size): New const data member.
4237         (Sized_incr_relobj::Local_symbol): New struct.
4238         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4239         (Sized_incr_relobj::do_local_symbol_offset): New function.
4240         (Sized_incr_relobj::local_symbol_count_): New data member.
4241         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4242         (Sized_incr_relobj::local_symbol_index_): New data member.
4243         (Sized_incr_relobj::local_symbol_offset_): New data member.
4244         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4245         (Sized_incr_relobj::local_symbols_): New data member.
4246         * object.h (Relobj::output_local_symbol_count): New function.
4247         (Relobj::local_symbol_offset): New function.
4248         (Relobj::do_output_local_symbol_count): New function.
4249         (Relobj::do_local_symbol_offset): New function.
4250         (Sized_relobj::do_output_local_symbol_count): New function.
4251         (Sized_relobj::do_local_symbol_offset): New function.
4252
4253 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4254
4255         * descriptors.cc (set_close_on_exec): New function.
4256         (Descriptors::open): Use set_close_on_exec.
4257         * output.cc (S_ISLNK): Define if not defined.
4258
4259 2011-04-22 Cary Coutant  <ccoutant@google.com>
4260
4261         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4262         global symbol map.
4263         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4264         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4265         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4266         relocations.
4267         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4268         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4269         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4270         * incremental.h
4271         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4272         function.
4273         (Incremental_binary::apply_incremental_relocs): New function.
4274         (Incremental_binary::do_apply_incremental_relocs): New function.
4275         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4276         data member.
4277         (Sized_incremental_binary::add_global_symbol): New function.
4278         (Sized_incremental_binary::global_symbol): New function.
4279         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4280         (Sized_incremental_binary::symbol_map_): New data member.
4281         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4282         * target.h (Sized_target::apply_relocation): New function.
4283         * target-reloc.h (apply_relocation): New function.
4284         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4285
4286 2011-04-22  Doug Kwan  <dougkwan@google.com>
4287
4288         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4289         flag of a SHT_ARM_EXIDX section.
4290         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4291         * testsuite/Makefile.in: Regenerate.
4292         * testsuite/arm_exidx_test.s: New file.
4293         * testsuite/arm_exidx_test.sh: Same.
4294
4295 2011-04-20 Cary Coutant  <ccoutant@google.com>
4296
4297         PR gold/12689
4298         * archive.h (Incremental_archive_entry::Archive_member):
4299         Initialize arg_serial_ (second constructor).
4300
4301 2011-04-17  Ian Lance Taylor  <iant@google.com>
4302
4303         * object.cc (Relocate_info::location): Simplify location string.
4304         * errors.cc (Errors::error_at_location): Don't print program
4305         name.
4306         (Errors::warning_at_location): Likewise.
4307         (Errors::undefined_symbol): Likewise.
4308         * testsuite/debug_msg.sh: Update accordingly.
4309
4310 2011-04-14 Cary Coutant  <ccoutant@google.com>
4311
4312         * gold/layout.cc (Layout::symtab_section_offset): New function.
4313         * gold/layout.h (Layout::symtab_section_offset): New function.
4314         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4315
4316 2011-04-12  Ian Lance Taylor  <iant@google.com>
4317
4318         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4319         with MREMAP_MAYMOVE.
4320         * output.h (class Output_file): Add map_is_allocated_ field.
4321         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4322         not available, provide stubs.  If mremap is not available, #define
4323         it to gold_mremap.
4324         (MREMAP_MAYMOVE): Define if not defined.
4325         (Output_file::Output_file): Initialize map_is_allocated_.
4326         (Output_file::resize): Check map_is_allocated_.
4327         (Output_file::map_anonymous): If mmap fails, use malloc.
4328         (Output_file::unmap): Don't do anything for an anonymous map.
4329         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4330         is not available, provide stubs.
4331         (File_read::View::~View): Use free rather than delete[].
4332         (File_read::make_view): Use malloc rather than new[].  If mmap
4333         fails, use malloc.
4334         (File_read::find_or_make_view): Use malloc rather than new[].
4335         * gold.h: Remove HAVE_REMAP code.
4336         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4337         exists.  Rename mremap to gold_mremap.  If mmap is not available
4338         don't do anything.
4339         * configure, config.in: Rebuild.
4340
4341 2011-04-11  Ian Lance Taylor  <iant@google.com>
4342
4343         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4344         initialize local variable v.
4345
4346 2011-04-11  Cary Coutant  <ccoutant@google.com>
4347
4348         * archive.cc (Archive::include_member): Adjust call to
4349         report_object.
4350         (Add_archive_symbols::run): Track argument serial numbers.
4351         (Lib_group::include_member): Likewise.
4352         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4353         * archive.h (Incremental_archive_entry::Archive_member):
4354         Initialize arg_serial_.
4355         (Archive_member::arg_serial_): New data member.
4356         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4357         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4358         incremental link.
4359         (Sized_dynobj::do_for_all_local_got_entries): New function.
4360         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4361         function.
4362         * fileread.cc (get_mtime): New function.
4363         * fileread.h (get_mtime): New function.
4364         * gold.cc (queue_initial_tasks): Check for incremental update.
4365         (process_incremental_input): New function.
4366         (queue_middle_tasks): Don't force valid target for incremental
4367         update.
4368         * incremental-dump.cc (find_input_containing_global): Adjust
4369         size of symbol info entry.
4370         (dump_incremental_inputs): Dump argument serial number and
4371         in_system_directory flag; bias shndx by 1; print symbol names
4372         when dumping per-file symbol lists; use new symbol info readers.
4373         * incremental.cc
4374         (Output_section_incremental_inputs:update_data_size): New function.
4375         (Sized_incremental_binary::setup_readers): Setup input readers
4376         for each input file; build maps for files added from libraries
4377         and scripts.
4378         (Sized_incremental_binary::check_input_args): New function.
4379         (Sized_incremental_binary::do_check_inputs): Build map of argument
4380         serial numbers to input arguments.
4381         (Sized_incremental_binary::do_file_has_changed): Rename
4382         do_file_is_unchanged to this; compare file modification times.
4383         (Sized_incremental_binary::do_init_layout): New function.
4384         (Sized_incremental_binary::do_reserve_layout): New function.
4385         (Sized_incremental_binary::do_get_input_reader): Remove.
4386         (Sized_incremental_binary::get_symtab_view): New function.
4387         (Incremental_checker::can_incrementally_link_output_file): Remove.
4388         (Incremental_inputs::report_command_line): Exclude --debug options.
4389         (Incremental_inputs::report_archive_begin): Add parameter; track
4390         argument serial numbers; don't put input file entry for archive
4391         before archive members.
4392         (Incremental_inputs::report_archive_end): Put input file entry
4393         for archive after archive members.
4394         (Incremental_inputs::report_object): Add parameter; track argument
4395         serial numbers and in_system_directory flag.
4396         (Incremental_inputs::report_script): Add parameter; track argument
4397         serial numbers.
4398         (Output_section_incremental_inputs::set_final_data_size): Adjust
4399         size of symbol info entry; check for forwarding symbols.
4400         (Output_section_incremental_inputs::write_input_files): Write
4401         in_system_directory flag and argument serial number.
4402         (Output_section_incremental_inputs::write_info_blocks): Map section
4403         indices between incremental info and original input file; store
4404         input section index for each symbol.
4405         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4406         change operator() to visit().
4407         (class Global_got_offset_visitor): Likewise.
4408         (class Global_symbol_visitor_got_plt):
4409         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4410         classes.
4411         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4412         (Sized_incr_relobj::do_read_symbols): New function.
4413         (Sized_incr_relobj::do_layout): New function.
4414         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4415         (Sized_incr_relobj::do_add_symbols): New function.
4416         (Sized_incr_relobj::do_should_include_member): New function.
4417         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4418         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4419         (Sized_incr_relobj::do_section_size): New function.
4420         (Sized_incr_relobj::do_section_name): New function.
4421         (Sized_incr_relobj::do_section_contents): New function.
4422         (Sized_incr_relobj::do_section_flags): New function.
4423         (Sized_incr_relobj::do_section_entsize): New function.
4424         (Sized_incr_relobj::do_section_address): New function.
4425         (Sized_incr_relobj::do_section_type): New function.
4426         (Sized_incr_relobj::do_section_link): New function.
4427         (Sized_incr_relobj::do_section_info): New function.
4428         (Sized_incr_relobj::do_section_addralign): New function.
4429         (Sized_incr_relobj::do_initialize_xindex): New function.
4430         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4431         (Sized_incr_relobj::do_read_relocs): New function.
4432         (Sized_incr_relobj::do_gc_process_relocs): New function.
4433         (Sized_incr_relobj::do_scan_relocs): New function.
4434         (Sized_incr_relobj::do_count_local_symbols): New function.
4435         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4436         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4437         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4438         (Sized_incr_relobj::do_relocate): New function.
4439         (Sized_incr_relobj::do_set_section_offset): New function.
4440         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4441         (Sized_incr_dynobj::do_read_symbols): New function.
4442         (Sized_incr_dynobj::do_layout): New function.
4443         (Sized_incr_dynobj::do_add_symbols): New function.
4444         (Sized_incr_dynobj::do_should_include_member): New function.
4445         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4446         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4447         (Sized_incr_dynobj::do_section_size): New function.
4448         (Sized_incr_dynobj::do_section_name): New function.
4449         (Sized_incr_dynobj::do_section_contents): New function.
4450         (Sized_incr_dynobj::do_section_flags): New function.
4451         (Sized_incr_dynobj::do_section_entsize): New function.
4452         (Sized_incr_dynobj::do_section_address): New function.
4453         (Sized_incr_dynobj::do_section_type): New function.
4454         (Sized_incr_dynobj::do_section_link): New function.
4455         (Sized_incr_dynobj::do_section_info): New function.
4456         (Sized_incr_dynobj::do_section_addralign): New function.
4457         (Sized_incr_dynobj::do_initialize_xindex): New function.
4458         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4459         (make_sized_incremental_object): New function.
4460         (Incremental_library::copy_unused_symbols): New function.
4461         (Incremental_library::do_for_all_unused_symbols): New function.
4462         * incremental.h (enum Incremental_input_flags): New type.
4463         (class Incremental_checker): Remove.
4464         (Incremental_input_entry::Incremental_input_entry): Add argument
4465         serial number.
4466         (Incremental_input_entry::arg_serial): New function.
4467         (Incremental_input_entry::set_is_in_system_directory): New function.
4468         (Incremental_input_entry::is_in_system_directory): New function.
4469         (Incremental_input_entry::arg_serial_): New data member.
4470         (Incremental_input_entry::is_in_system_directory_): New data member.
4471         (class Script_info): Move here from script.h.
4472         (Script_info::Script_info): Add filename parameter.
4473         (Script_info::filename): New function.
4474         (Script_info::filename_): New data member.
4475         (Incremental_script_entry::Incremental_script_entry): Add argument
4476         serial number.
4477         (Incremental_object_entry::Incremental_object_entry): Likewise.
4478         (Incremental_object_entry::add_input_section): Build list of input
4479         sections with map to original shndx.
4480         (Incremental_object_entry::get_input_section_index): New function.
4481         (Incremental_object_entry::shndx_): New data member.
4482         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4483         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4484         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4485         serial number.
4486         (Incremental_inputs::report_archive_begin): Likewise.
4487         (Incremental_inputs::report_object): Likewise.
4488         (Incremental_inputs::report_script): Likewise.
4489         (class Incremental_global_symbol_reader): New class.
4490         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4491         and store flags and input file type.
4492         (Incremental_input_entry_reader::arg_serial): New function.
4493         (Incremental_input_entry_reader::type): Extract type from flags.
4494         (Incremental_input_entry_reader::is_in_system_directory): New function.
4495         (Incremental_input_entry_reader::get_input_section_count): Call
4496         accessor function for type.
4497         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4498         function for type; adjust size of global symbol entry.
4499         (Incremental_input_entry_reader::get_global_symbol_count): Call
4500         accessor function for type.
4501         (Incremental_input_entry_reader::get_object_count): Likewise.
4502         (Incremental_input_entry_reader::get_object_offset): Likewise.
4503         (Incremental_input_entry_reader::get_member_count): Likewise.
4504         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4505         (Incremental_input_entry_reader::get_member_offset): Likewise.
4506         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4507         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4508         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4509         (Incremental_input_entry_reader::get_global_symbol_reader): New
4510         function.
4511         (Incremental_input_entry_reader::get_output_symbol_index): New
4512         function.
4513         (Incremental_input_entry_reader::type_): Remove.
4514         (Incremental_input_entry_reader::flags_): New data member.
4515         (Incremental_inputs_reader::input_file_offset): New function.
4516         (Incremental_inputs_reader::input_file_index): New function.
4517         (Incremental_inputs_reader::input_file): Call input_file_offset.
4518         (Incremental_inputs_reader::input_file_at_offset): New function.
4519         (Incremental_relocs_reader::get_r_type): Reformat.
4520         (Incremental_relocs_reader::get_r_shndx): Reformat.
4521         (Incremental_relocs_reader::get_r_offset): Reformat.
4522         (Incremental_relocs_reader::data): New function.
4523         (Incremental_binary::Incremental_binary): Initialize new data members.
4524         (Incremental_binary::check_inputs): Add cmdline parameter.
4525         (Incremental_binary::file_is_unchanged): Remove.
4526         (Input_reader::arg_serial): New function.
4527         (Input_reader::get_unused_symbol_count): New function.
4528         (Input_reader::get_unused_symbol): New function.
4529         (Input_reader::do_arg_serial): New function.
4530         (Input_reader::do_get_unused_symbol_count): New function.
4531         (Input_reader::do_get_unused_symbol): New function.
4532         (Incremental_binary::input_file_count): New function.
4533         (Incremental_binary::get_input_reader): Change signature to use
4534         index instead of filename.
4535         (Incremental_binary::file_has_changed): New function.
4536         (Incremental_binary::get_input_argument): New function.
4537         (Incremental_binary::get_library): New function.
4538         (Incremental_binary::get_script_info): New function.
4539         (Incremental_binary::init_layout): New function.
4540         (Incremental_binary::reserve_layout): New function.
4541         (Incremental_binary::output_file): New function.
4542         (Incremental_binary::do_check_inputs): New function.
4543         (Incremental_binary::do_file_is_unchanged): Remove.
4544         (Incremental_binary::do_file_has_changed): New function.
4545         (Incremental_binary::do_init_layout): New function.
4546         (Incremental_binary::do_reserve_layout): New function.
4547         (Incremental_binary::do_input_file_count): New function.
4548         (Incremental_binary::do_get_input_reader): Change signature.
4549         (Incremental_binary::input_args_map_): New data member.
4550         (Incremental_binary::library_map_): New data member.
4551         (Incremental_binary::script_map_): New data member.
4552         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4553         new data members.
4554         (Sized_incremental_binary::output_section): New function.
4555         (Sized_incremental_binary::inputs_reader): Add const.
4556         (Sized_incremental_binary::symtab_reader): Add const.
4557         (Sized_incremental_binary::relocs_reader): Add const.
4558         (Sized_incremental_binary::got_plt_reader): Add const.
4559         (Sized_incremental_binary::get_symtab_view): New function.
4560         (Sized_incremental_binary::Inputs_reader): New typedef.
4561         (Sized_incremental_binary::Input_entry_reader): New typedef.
4562         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4563         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4564         (Sized_incremental_binary::do_file_has_changed): New function.
4565         (Sized_incremental_binary::do_init_layout): New function.
4566         (Sized_incremental_binary::do_reserve_layout): New function.
4567         (Sized_input_reader::Inputs_reader): Remove.
4568         (Sized_input_reader::Input_entry_reader): Remove.
4569         (Sized_input_reader::do_arg_serial): New function.
4570         (Sized_input_reader::do_get_unused_symbol_count): New function.
4571         (Sized_input_reader::do_get_unused_symbol): New function.
4572         (Sized_incremental_binary::do_input_file_count): New function.
4573         (Sized_incremental_binary::do_get_input_reader): Change signature;
4574         use index instead of filename.
4575         (Sized_incremental_binary::section_map_): New data member.
4576         (Sized_incremental_binary::input_entry_readers_): New data member.
4577         (class Sized_incr_relobj): New class.
4578         (class Sized_incr_dynobj): New class.
4579         (make_sized_incremental_object): New function.
4580         (class Incremental_library): New class.
4581         * layout.cc (Free_list::num_lists): New static data member.
4582         (Free_list::num_nodes): New static data member.
4583         (Free_list::num_removes): New static data member.
4584         (Free_list::num_remove_visits): New static data member.
4585         (Free_list::num_allocates): New static data member.
4586         (Free_list::num_allocate_visits): New static data member.
4587         (Free_list::init): New function.
4588         (Free_list::remove): New function.
4589         (Free_list::allocate): New function.
4590         (Free_list::dump): New function.
4591         (Free_list::print_stats): New function.
4592         (Layout_task_runner::run): Resize output file for incremental updates.
4593         (Layout::Layout): Initialize new data members.
4594         (Layout::set_incremental_base): New function.
4595         (Layout::init_fixed_output_section): New function.
4596         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4597         incremental updates.
4598         (Layout::create_gold_note): Do not create gold note section for
4599         incremental updates.
4600         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4601         for incremental updates.
4602         (Layout::set_section_offsets): For incremental updates, allocate space
4603         from free list.
4604         (Layout::create_symtab_sections): Layout with offsets relative to
4605         start of section; for incremental updates, allocate space from free
4606         list.
4607         (Layout::create_shdrs): For incremental updates, allocate space from
4608         free list.
4609         (Layout::finish_dynamic_section): For incremental updates, do not
4610         check --as-needed (fixed in subsequent patch).
4611         * layout.h (class Free_list): New class.
4612         (Layout::set_incremental_base): New function.
4613         (Layout::incremental_base): New function.
4614         (Layout::init_fixed_output_section): New function.
4615         (Layout::allocate): New function.
4616         (Layout::incremental_base_): New data member.
4617         (Layout::free_list_): New data member.
4618         * main.cc (main): Print Free_list statistics.
4619         * object.cc (Relobj::finalize_incremental_relocs): Add
4620         clear_counts parameter; clear counts only when clear_counts is set.
4621         (Sized_relobj::Sized_relobj): Initialize new base class.
4622         (Sized_relobj::do_layout): Don't report special sections.
4623         (Sized_relobj::do_for_all_local_got_entries): New function.
4624         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4625         symtab_off to all symbol table offsets.
4626         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4627         * object.h (class Got_offset_list): Move to top of file.
4628         (Object::Object): Allow case where input_file == NULL.
4629         (Object::~Object): Likewise.
4630         (Object::input_file): Assert that input_file != NULL.
4631         (Object::lock): Allow case where input_file == NULL.
4632         (Object::unlock): Likewise.
4633         (Object::is_locked): Likewise.
4634         (Object::token): Likewise.
4635         (Object::release): Likewise.
4636         (Object::is_incremental): New function.
4637         (Object::get_mtime): New function.
4638         (Object::for_all_local_got_entries): New function.
4639         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4640         (Object::set_is_in_system_directory): New function.
4641         (Object::is_in_system_directory): New function.
4642         (Object::do_is_incremental): New function.
4643         (Object::do_get_mtime): New function.
4644         (Object::do_for_all_local_got_entries): New function.
4645         (Object::is_in_system_directory_): New data member.
4646         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4647         (class Sized_relobj_base): New class.
4648         (class Sized_relobj): Derive from Sized_relobj_base.
4649         (class Sized_relobj::Symbols): Redeclare from base class.
4650         (class Sized_relobj::local_got_offset_list): Remove.
4651         (class Sized_relobj::Output_sections): Redeclare from base class.
4652         (class Sized_relobj::do_for_all_local_got_entries): New function.
4653         (class Sized_relobj::write_local_symbols): Add offset parameter.
4654         (class Sized_relobj::local_symbol_offset_): Update comment.
4655         (class Sized_relobj::local_dynsym_offset_): Update comment.
4656         * options.cc (Input_arguments::add_file): Remove const.
4657         * options.h (Input_file_argument::Input_file_argument):
4658         Initialize arg_serial_ (all constructors).
4659         (Input_file_argument::set_arg_serial): New function.
4660         (Input_file_argument::arg_serial): New function.
4661         (Input_file_argument::arg_serial_): New data member.
4662         (Input_arguments::Input_arguments): Initialize file_count_.
4663         (Input_arguments::add_file): Remove const.
4664         (Input_arguments::number_of_input_files): New function.
4665         (Input_arguments::file_count_): New data member.
4666         (Command_line::number_of_input_files): Call
4667         Input_arguments::number_of_input_files.
4668         * output.cc (Output_segment_headers::Output_segment_headers):
4669         Set current size.
4670         (Output_section::Input_section::current_data_size): New function.
4671         (Output_section::Output_section): Initialize new data members.
4672         (Output_section::add_input_section): Don't do merge sections for
4673         an incremental link; allocate space from free list for an
4674         incremental update.
4675         (Output_section::add_output_section_data): Allocate space from
4676         free list for an incremental update.
4677         (Output_section::update_data_size): New function.
4678         (Output_section::set_fixed_layout): New function.
4679         (Output_section::reserve): New function.
4680         (Output_segment::set_section_addresses): Remove const.
4681         (Output_segment::set_section_list_addresses): Remove const; allocate
4682         space from free list for an incremental update.
4683         (Output_segment::set_offset): Adjust size of RELRO segment for an
4684         incremental update.
4685         * output.h (Output_data::current_data_size): Move here from
4686         child classes.
4687         (Output_data::pre_finalize_data_size): New function.
4688         (Output_data::update_data_size): New function.
4689         (Output_section_headers::update_data_size): new function.
4690         (Output_section_data_build::current_data_size): Move to Output_data.
4691         (Output_data_strtab::update_data_size): New function.
4692         (Output_section::current_data_size): Move to Output_data.
4693         (Output_section::set_fixed_layout): New function.
4694         (Output_section::has_fixed_layout): New function.
4695         (Output_section::reserve): New function.
4696         (Output_section::update_data_size): New function.
4697         (Output_section::has_fixed_layout_): New data member.
4698         (Output_section::free_list_): New data member.
4699         (Output_segment::set_section_addresses): Remove const.
4700         (Output_segment::set_section_list_addresses): Remove const.
4701         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4702         New function.
4703         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4704         New function.
4705         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4706         parameter when calling Add_symbols constructor; store argument
4707         serial number for members of a lib group.
4708         (Add_symbols::locks): Allow case where token == NULL.
4709         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4710         (Read_member::~Read_member): New function.
4711         (Read_member::is_runnable): New function.
4712         (Read_member::locks): New function.
4713         (Read_member::run): New function.
4714         (Check_script::~Check_script): New function.
4715         (Check_script::is_runnable): New function.
4716         (Check_script::locks): New function.
4717         (Check_script::run): New function.
4718         (Check_library::~Check_library): New function.
4719         (Check_library::is_runnable): New function.
4720         (Check_library::locks): New function.
4721         (Check_library::run): New function.
4722         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4723         (Add_symbols::library_): New data member.
4724         (class Read_member): New class.
4725         (class Check_script): New class.
4726         (class Check_library): New class.
4727         * reloc.cc (Read_relocs::is_runnable): Allow case where
4728         token == NULL.
4729         (Read_relocs::locks): Likewise.
4730         (Scan_relocs::locks): Likewise.
4731         (Relocate_task::locks): Likewise.
4732         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4733         to clear counters.
4734         (Sized_relobj::incremental_relocs_scan): Fix comment.
4735         (Sized_relobj::do_relocate): Pass output file offset to
4736         write_local_symbols.
4737         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4738         from class declaration.
4739         * script.cc (read_input_script): Allocate Script_info; pass
4740         argument serial number to report_script.
4741         * script.h (class Script_info): Move to incremental.h.
4742         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4743         * symtab.h (Symbol_table::add_from_incrobj): New function.
4744         (Symbol_table::set_file_offset): New function.
4745
4746 2011-04-05  Cary Coutant  <ccoutant@google.com>
4747
4748         * incremental-dump.cc (dump_incremental_inputs): Change signature
4749         to take a Sized_incremental_binary; change caller.  Use readers
4750         in Sized_incremental_binary.
4751         * incremental.cc
4752         (Sized_incremental_binary::find_incremental_inputs_sections):
4753         Rename do_find_incremental_inputs_sections to this.
4754         (Sized_incremental_binary::setup_readers): New function.
4755         (Sized_incremental_binary::do_check_inputs): Check
4756         has_incremental_info_ flag; move setup code to setup_readers;
4757         use input readers.
4758         (Sized_incremental_binary::do_file_is_unchanged): New function.
4759         (Sized_incremental_binary::do_get_input_reader): New function.
4760         * incremental.h (class Incremental_binary): Move to end of file.
4761         (Incremental_binary::file_is_unchanged): New function.
4762         (Incremental_binary::do_file_is_unchanged): New function.
4763         (Incremental_binary::Input_reader): New class.
4764         (Incremental_binary::get_input_reader): New function.
4765         (class Sized_incremental_binary): Move to end of file.
4766         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4767         input section reader classes.
4768         (Sized_incremental_binary::has_incremental_info): New function.
4769         (Sized_incremental_binary::inputs_reader): New function.
4770         (Sized_incremental_binary::symtab_reader): New function.
4771         (Sized_incremental_binary::relocs_reader): New function.
4772         (Sized_incremental_binary::got_plt_reader): New function.
4773         (Sized_incremental_binary::do_file_is_unchanged): New function.
4774         (Sized_incremental_binary::Sized_input_reader): New class.
4775         (Sized_incremental_binary::get_input_reader): New function.
4776         (Sized_incremental_binary::find_incremental_inputs_sections):
4777         Rename do_find_incremental_inputs_sections to this.
4778         (Sized_incremental_binary::setup_readers): New function.
4779         (Sized_incremental_binary::has_incremental_info_): New data member.
4780         (Sized_incremental_binary::inputs_reader_): New data member.
4781         (Sized_incremental_binary::symtab_reader_): New data member.
4782         (Sized_incremental_binary::relocs_reader_): New data member.
4783         (Sized_incremental_binary::got_plt_reader_): New data member.
4784         (Sized_incremental_binary::current_input_file_): New data member.
4785
4786 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4787
4788         PR gold/12640
4789         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4790         violation.
4791
4792 2011-03-30  Cary Coutant  <ccoutant@google.com>
4793
4794         * archive.cc (Archive::include_member): Adjust call to report_object.
4795         (Add_archive_symbols::run): Add script_info to call to
4796         report_archive_begin.
4797         (Lib_group::include_member): Adjust call to report_object.
4798         (Add_lib_group_symbols::run): Adjust call to report_object.
4799         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4800         blocks.  Add object count for script input files.
4801         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4802         script_info parameter; change all callers.
4803         (Incremental_inputs::report_object): Add script_info parameter;
4804         change all callers.
4805         (Incremental_inputs::report_script): Store backpointer to
4806         incremental info entry.
4807         (Output_section_incremental_inputs::set_final_data_size): Record
4808         additional information for scripts.
4809         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4810         * incremental.h (Incremental_script_entry::add_object): New function.
4811         (Incremental_script_entry::get_object_count): New function.
4812         (Incremental_script_entry::get_object): New function.
4813         (Incremental_script_entry::objects_): New data member; adjust
4814         constructor.
4815         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4816         (Incremental_inputs::report_object): Add script_info parameter.
4817         (Incremental_inputs_reader::get_object_count): New function.
4818         (Incremental_inputs_reader::get_object_offset): New function.
4819         * options.cc (Input_arguments::add_file): Return reference to
4820         new input argument.
4821         * options.h (Input_argument::set_script_info): New function.
4822         (Input_argument::script_info): New function.
4823         (Input_argument::script_info_): New data member; adjust all
4824         constructors.
4825         (Input_file_group::add_file): Return reference to new input argument.
4826         (Input_file_lib::add_file): Likewise.
4827         (Input_arguments::add_file): Likewise.
4828         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4829         * script.cc (Parser_closure::Parser_closure): Add script_info
4830         parameter; adjust all callers.
4831         (Parser_closure::script_info): New function.
4832         (Parser_closure::script_info_): New data member.
4833         (read_input_script): Report scripts earlier to incremental info.
4834         (script_add_file): Set script_info in Input_argument.
4835         (script_add_library): Likewise.
4836         * script.h (Script_options::Script_info): Rewrite class.
4837
4838 2011-03-29  Cary Coutant  <ccoutant@google.com>
4839
4840         * archive.cc (Library_base::should_include_member): Move
4841         method here from class Archive.
4842         (Archive::Archive): Initialize base class.
4843         (Archive::should_include_member): Move to base class.
4844         (Archive::do_for_all_unused_symbols): New function.
4845         (Add_archive_symbols::run): Remove redundant access to
4846         incremental_inputs.
4847         (Lib_group::Lib_group): Initialize base class.
4848         (Lib_group::do_filename): New function.
4849         (Lib_group::include_member): Pass pointer to Lib_group to
4850         report_object.
4851         (Lib_group::do_for_all_unused_symbols): New function.
4852         (Add_lib_group_symbols::run): Report archive information for
4853         incremental links.
4854         * archive.h (class Library_base): New base class.
4855         (class Archive): Derive from Library_base.
4856         (Archive::filename): Move to base class.
4857         (Archive::set_incremental_info): Likewise.
4858         (Archive::incremental_info): Likewise.
4859         (Archive::Should_include): Likewise.
4860         (Archive::should_include_member): Likewise.
4861         (Archive::Armap_entry): Remove.
4862         (Archive::Unused_symbol_iterator): Remove.
4863         (Archive::unused_symbols_begin): Remove.
4864         (Archive::unused_symbols_end): Remove.
4865         (Archive::do_filename): New function.
4866         (Archive::do_get_mtime): New function.
4867         (Archive::do_for_all_unused_symbols): New function.
4868         (Archive::task_): Move to base class.
4869         (Archive::incremental_info_): Likewise.
4870         (class Lib_group): Derive from Library_base.
4871         (Lib_group::do_filename): New function.
4872         (Lib_group::do_get_mtime): New function.
4873         (Lib_group::do_for_all_unused_symbols): New function.
4874         (Lib_group::task_): Move to base class.
4875         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4876         function.
4877         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4878         function.
4879         * incremental.cc (Incremental_inputs::report_archive_begin):
4880         Use Library_base; call library's get_mtime; add incremental inputs
4881         entry before members.
4882         (class Unused_symbol_visitor): New class.
4883         (Incremental_inputs::report_archive_end): Use Library_base; use
4884         visitor class to record unused symbols; don't add incremental inputs
4885         entry after members.
4886         (Incremental_inputs::report_object): Use Library_base.
4887         * incremental.h
4888         (Incremental_archive_entry::Incremental_archive_entry): Remove
4889         unused Archive parameter.
4890         (Incremental_inputs::report_archive_begin): Use Library_base.
4891         (Incremental_inputs::report_archive_end): Likewise.
4892         (Incremental_inputs::report_object): Likewise.
4893         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4894         function.
4895         * object.h (Object::for_all_global_symbols): New function.
4896         (Object::do_for_all_global_symbols): New function.
4897         (Sized_relobj::do_for_all_global_symbols): New function.
4898         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4899         function.
4900         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4901         function.
4902
4903 2011-03-27  Ian Lance Taylor  <iant@google.com>
4904
4905         * archive.cc (Archive::interpret_header): Return -1 if something
4906         goes wrong.  Change callers accordingly.
4907
4908 2011-03-25  Cary Coutant  <ccoutant@google.com>
4909
4910         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4911         * testsuite/Makefile.in: Regenerate.
4912
4913 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4914
4915         * plugin.cc (get_view): New.
4916         (Plugin::load): Pass get_view to the plugin.
4917         (Plugin_manager::get_view): New.
4918
4919 2011-03-21  Ian Lance Taylor  <iant@google.com>
4920
4921         * testsuite/final_layout.sh: Rewrite to not use dc.
4922         * testsuite/relro_test.sh: Fail if dc is not present.
4923
4924 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4925
4926         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4927         Change == to -eq.
4928         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4929         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4930         Change == to -eq.
4931         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4932         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4933
4934 2011-03-14  Ian Lance Taylor  <iant@google.com>
4935
4936         * script-sections.cc (Sort_output_sections::script_compare):
4937         Rename from is_before, change return type.
4938         (Sort_output_sections::operator()): Adjust accordingly.
4939
4940 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4941
4942         PR gold/12572
4943         * testsuite/odr_violation2.cc: Add comment to make all error line
4944         numbers double digits.
4945         * testsuite/debug_msg.sh: Adjust expected errors.
4946
4947 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4948
4949         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4950         but mark earlier ones as non-canonical
4951         (offset_to_iterator): Update search target and example
4952         (do_addr2line): Return extra lines in a vector*
4953         (format_file_lineno): Extract from do_addr2line
4954         (one_addr2line): Add vector* out-param
4955         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4956         when a lineno entry appeared last for its instruction
4957         (Dwarf_line_info): Add vector* out-param
4958         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4959         * symtab.cc (Odr_violation_compare): Include the lineno in the
4960         comparison again.
4961         (linenos_from_loc): New. Combine the canonical line for an
4962         address with its other lines.
4963         (True_if_intersect): New. Helper functor to make
4964         std::set_intersection a query.
4965         (detect_odr_violations): Compare sets of lines instead of just
4966         one line for each function. This became less deterministic, but
4967         has fewer false positives.
4968         * symtab.h: Declarations.
4969         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4970         mix an optimized and non-optimized object in the same binary
4971         (odr_violation2.so): Same.
4972         * testsuite/Makefile.in: Regenerate from Makefile.am.
4973         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4974         * testsuite/debug_msg.sh: Update line numbers and add
4975         assertions.
4976         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4977         non-optimized context.
4978         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4979         isn't inlined, and use OdrDerived in an optimized context.
4980         * testsuite/odr_header1.h: Defines OdrDerived, where
4981         optimization will change the
4982         first-instruction-in-the-destructor's file and line number.
4983         * testsuite/odr_header2.h: Defines OdrBase.
4984
4985 2011-03-09  Ian Lance Taylor  <iant@google.com>
4986
4987         * fileread.cc (File_read::clear_views): Don't delete the whole
4988         file view.
4989
4990 2011-03-08  Ian Lance Taylor  <iant@google.com>
4991
4992         PR gold/12525
4993         * fileread.cc: #include <climits>.
4994         (GOLD_IOV_MAX): Define.
4995         (File_read::read_multiple): Limit number of entries by iov_max.
4996         * fileread.h (class File_read): Always set max_readv_entries to
4997         128.
4998
4999 2011-03-07  Ian Lance Taylor  <iant@google.com>
5000
5001         PR gold/12525
5002         * options.h (class General_options): Add -dy and -dn.
5003
5004 2011-03-02  Cary Coutant  <ccoutant@google.com>
5005
5006         * testsuite/script_test_9.t: Add TLS segment.
5007
5008 2011-03-02  Simon Baldwin  <simonb@google.com>
5009
5010         * configure.ac: Add check for gnu_indirect_function support in
5011         the toolchain building binutils.
5012         * configure: Rebuild.
5013
5014 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5015
5016         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5017         plugin only symbols.
5018         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5019         in plugin files as not needed in the symbol table.
5020
5021 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5022
5023         * output.cc (Output_section::add_input_section): Delay fill
5024         generation for section ordering.
5025
5026 2011-02-09  Ian Lance Taylor  <iant@google.com>
5027
5028         PR gold/12316
5029         * object.h (class Sized_relobj): Remove clear_local_symbols.
5030         * reloc.cc (Sized_relobj::do_relocate): Don't call
5031         clear_local_symbols.
5032
5033 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5034
5035         * plugin.cc (is_visible_from_outside): Return true for symbols
5036         in the -u option.
5037
5038 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5039
5040         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5041         filename.
5042
5043 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5044
5045         * icf.h (is_section_foldable_candidate): Change type of parameter
5046         to std::string.
5047         * icf.cc (Icf::find_identical_sections): Change type of local variable
5048         section_name to be std::string.
5049         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5050
5051 2011-01-25  Ian Lance Taylor  <iant@google.com>
5052
5053         * script.cc (script_add_extern): Rewrite to use
5054         add_symbol_reference.
5055
5056 2011-01-25  Doug Kwan  <dougkwan@google.com>
5057
5058         * icf.cc (get_section_contents): Always lock section's object.
5059
5060 2011-01-24  Ian Lance Taylor  <iant@google.com>
5061
5062         * options.h (class General_options): Accept
5063         --no-detect-odr-violations.
5064
5065 2011-01-24  Ian Lance Taylor  <iant@google.com>
5066
5067         * version.cc (version_string): Bump to 1.11.
5068
5069 2011-01-24  Ian Lance Taylor  <iant@google.com>
5070
5071         * plugin.cc (class Plugin_rescan): Define new class.
5072         (Plugin_manager::claim_file): Set any_claimed_.
5073         (Plugin_manager::save_archive): New function.
5074         (Plugin_manager::save_input_group): New function.
5075         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5076         necessary.
5077         (Plugin_manager::new_undefined_symbol): New function.
5078         (Plugin_manager::rescan): New function.
5079         (Plugin_manager::rescannable_defines): New function.
5080         (Plugin_manager::add_input_file): Set any_added_.
5081         * plugin.h (class Plugin_manager): define new fields rescannable_,
5082         undefined_symbols_, any_claimed_, and any_added_.  Declare
5083         Plugin_rescan as friend.  Declare new functions.
5084         (Plugin_manager::Rescannable): Define type.
5085         (Plugin_manager::Rescannable_list): Define type.
5086         (Plugin_manager::Undefined_symbol_list): Define type.
5087         (Plugin_manager::Plugin_manager): Initialize new fields.
5088         * archive.cc (Archive::defines_symbol): New function.
5089         (Add_archive_symbols::run): Pass archive to plugins if any.
5090         * archive.h (class Archive): Declare defines_symbol.
5091         * readsyms.cc (Input_group::~Input_group): New function.
5092         (Finish_group::run): Pass input_group to plugins if any.
5093         * readsyms.h (class Input_group): Declare destructor.
5094         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5095         any.
5096
5097 2011-01-10  Ian Lance Taylor  <iant@google.com>
5098
5099         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5100         section as relro.
5101         (Layout::set_segment_offsets): Reset increase_relro before calling
5102         set_section_addresses a second time.
5103
5104 2011-01-04  Cary Coutant  <ccoutant@google.com>
5105
5106         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5107         sections before NOBITS sections.
5108
5109 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5110
5111         * version.cc (print_version): Update copyright to 2011.
5112
5113 2010-12-23  Cary Coutant  <ccoutant@google.com>
5114
5115         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5116         of OS to this->add.  Add OD parameter to second form of the function.
5117
5118 2010-12-20  Ian Lance Taylor  <iant@google.com>
5119
5120         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5121         second of two consecutive entries with same offset.
5122
5123 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5124
5125         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5126         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5127         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5128         to avoid unneeded links against $(LDADD).
5129         * testsuite/Makefile.in: Regenerate.
5130
5131 2010-12-15  Ian Lance Taylor  <iant@google.com>
5132
5133         PR gold/12324
5134         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5135         for R_X86_64_32 and R_X86_64_PC32.
5136         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5137         ver_matching_def_pic.o.
5138         (ver_matching_def_pic.o): New target.
5139
5140 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5141
5142         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5143         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5144         Move definition before File_read::View member definitions.
5145         (File_read::View::~View): Initialize and hold lock before
5146         updating current_mapped_bytes.
5147
5148 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5149
5150         * dwarf_reader.cc: Remove outdated comment.
5151         * gold-threads.cc: Fix typo in error message.
5152         * archive.cc: Fix typos in comments.
5153         * archive.h: Likewise.
5154         * arm-reloc-property.cc: Likewise.
5155         * arm-reloc-property.h: Likewise.
5156         * arm-reloc.def: Likewise.
5157         * arm.cc: Likewise.
5158         * attributes.h: Likewise.
5159         * cref.cc: Likewise.
5160         * ehframe.cc: Likewise.
5161         * fileread.h: Likewise.
5162         * gold.h: Likewise.
5163         * i386.cc: Likewise.
5164         * icf.cc: Likewise.
5165         * incremental.h: Likewise.
5166         * int_encoding.cc: Likewise.
5167         * layout.h: Likewise.
5168         * main.cc: Likewise.
5169         * merge.h: Likewise.
5170         * object.cc: Likewise.
5171         * object.h: Likewise.
5172         * options.cc: Likewise.
5173         * readsyms.cc: Likewise.
5174         * reduced_debug_output.cc: Likewise.
5175         * reloc.cc: Likewise.
5176         * script-sections.cc: Likewise.
5177         * sparc.cc: Likewise.
5178         * symtab.h: Likewise.
5179         * target-reloc.h: Likewise.
5180         * target.cc: Likewise.
5181         * target.h: Likewise.
5182         * timer.cc: Likewise.
5183         * timer.h: Likewise.
5184         * x86_64.cc: Likewise.
5185
5186 2010-12-09  Cary Coutant  <ccoutant@google.com>
5187
5188         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5189         stack.
5190         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5191         parameter; change all callers.
5192         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5193         * options.h (warn_execstack): New option.
5194
5195 2010-12-07  Doug Kwan  <dougkwan@google.com>
5196
5197         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5198         like function call relocations.
5199
5200 2010-12-07  Ian Lance Taylor  <iant@google.com>
5201
5202         * archive.cc (Archive::get_elf_object_for_member): Permit
5203         punconfigured to be NULL.
5204         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5205         (Archive::include_member): Pass NULL to get_elf_object_for_member
5206         if we searched for the archive and this is the first included
5207         object.
5208
5209 2010-12-01  Ian Lance Taylor  <iant@google.com>
5210
5211         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5212         track_relocs_type_ field.
5213         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5214         Set track_relocs_type_.
5215         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5216         contents when using RELA relocs.
5217         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5218         reloc_map_.
5219         * reloc.cc (Track_relocs::next_addend): New function.
5220         * reloc.h (class Track_relocs): Declare next_addend.
5221
5222 2010-12-01  Ian Lance Taylor  <iant@google.com>
5223
5224         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5225         virtual destructor.
5226
5227 2010-12-01  Ian Lance Taylor  <iant@google.com>
5228
5229         * README: Update compilers known to work and fail.
5230
5231 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5232
5233         * configure.in: For --enable-gold, handle value `default' instead of
5234         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5235         not the default.
5236         * configure: Regenerate.
5237
5238 2010-11-18  Doug Kwan  <dougkwan@google.com>
5239
5240         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5241         and right_alignment to be zero.  Store result alignment only if it is
5242         greater than existing alignment.
5243
5244 2010-11-16  Cary Coutant  <ccoutant@google.com>
5245
5246         PR gold/12220
5247         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5248         Check for ".zdebug_line".
5249
5250 2010-11-16  Doug Kwan  <dougkwan@google.com>
5251             Cary Coutant  <ccoutant@google.com>
5252
5253         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5254         by reference; adjust all callers.
5255         * output.cc (Output_segment::set_section_addresses): Adjust references
5256         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5257         list is empty.
5258         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5259         end at page boundary.
5260
5261 2010-11-16  Cary Coutant  <ccoutant@google.com>
5262
5263         PR gold/12220
5264         * layout.cc (Layout::choose_output_section): Transform names of
5265         compressed sections even when using a script with a SECTIONS clause.
5266         (Layout::output_section_name): Remove code to transform
5267         compressed debug section names.
5268         * output.cc (Output_section::add_input_section): Use uncompressed
5269         section size when tracking input sections.
5270
5271 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5272
5273         * symtab.h (Symbol::NON_PIC_REF): Remove.
5274         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5275         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5276         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5277         (Symbol::use_plt_offset): Take a flags argument and pass it
5278         directly to needs_dynamic_reloc.  Restrict check for undefined
5279         weak symbols to function calls.
5280         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5281         (Target_arm::Scan::global): Use it.
5282         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5283         (Target_arm::Relocate::relocate): Likewise.
5284         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5285         parameter with an r_type parameter.  Use get_reference_flags
5286         to get the flags.
5287         (Target_arm::Relocate::relocate): Update accordingly.
5288         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5289         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5290         (Target_i386::Scan::global): Likewise.
5291         (Target_i386::Relocate::relocate): Likewise.
5292         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5293         parameter with an r_type parameter.  Use get_reference_flags
5294         to get the flags.
5295         (Target_i386::Relocate::relocate): Update accordingly.
5296         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5297         (Target_powerpc::Scan::global): Use it.
5298         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5299         (Target_powerpc::Relocate::relocate): Likewise.
5300         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5301         (Target_sparc::Scan::global): Use it.
5302         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5303         (Target_sparc::Relocate::relocate): Likewise.
5304         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5305         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5306         (Target_x86_64::Scan::global): Likewise.
5307         (Target_x86_64::Relocate::relocate): Likewise.
5308
5309 2010-11-08  Doug Kwan  <dougkwan@google.com>
5310             Cary Coutant  <ccoutant@google.com>
5311
5312         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5313         (Arm_exidx_merge_section::section_contents_): New data member.
5314         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5315         (Arm_input_section::~Arm_input_section): De-allocate memory.
5316         (Arm_input_section::original_contents_): New data member.
5317         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5318         in parameters instead of calling Object::section_contents without
5319         locking.
5320         (Arm_output_section::group_section): New parameter TASK.  Pass it
5321         to callees that need locking objects.
5322         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5323         to lock EXIDX input sections.  Fix a formatting issue.  Call
5324         Arm_exidx_merged_section::build_contents to create merged section
5325         contents.
5326         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5327         to lock object of stub table owner.
5328         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5329         TEXT_SIZE to initialize data member TEXT_SIZE_.
5330         (Arm_exidx_input_section::addralign): Fix typo in comment.
5331         (Arm_exidx_input_section::text_size): New method.
5332         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5333         that require locking objects.  Lock objects before scanning for stubs
5334         and updating local symbols.
5335         (Arm_input_section<big_endian>::init): Copy contents of original
5336         input section.
5337         (Arm_input_section<big_endian>::do_write): Use saved contents of
5338         original input section instead of calling Object::section_contents
5339         without locking.
5340         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5341         size without calling Object::section_size().
5342         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5343         for size.  Allocate a buffer for merged EXIDX entries.
5344         (Arm_exidx_merged_section::build_contents): New method.
5345         (Arm_exidx_merged_section::do_write): Move merge section contents
5346         building code to Arm_exidx_merged_section::build_contetns.  Write
5347         out contetns in buffer instead of building it on the fly.
5348         (Arm_relobj::make_exidx_input_section): Also pass text section size
5349         to Arm_exidx_input_section constructor.
5350         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5351         (Arm_dynobj::do_read_symbols): Fix memory leak.
5352         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5353         * target.h: (class Task): Add forward declaration.
5354         (Target::relax): Add new parameter TASK and pass it to
5355         Target::do_relax().
5356         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5357
5358 2010-11-05  Cary Coutant  <ccoutant@google.com>
5359
5360         PR gold/10708
5361         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5362         object when reading from the file.
5363         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5364         second layout pass.
5365         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5366         when reading section contents.
5367         (get_section_contents): Likewise.
5368         (icf::find_identical_sections): Likewise.
5369         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5370         object when reading from the file.
5371         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5372         the object when doing deferred section layout.
5373
5374 2010-11-03  Nick Clifton  <nickc@redhat.com>
5375
5376         PR gold/12001
5377         * script.h (class Symbol_assignment: name): New member.  Returns
5378         the name of the symbol.
5379         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5380         Returns true if the given symbol name is on the list of
5381         assignments wating to be processed.
5382         * archive.cc (should_incldue_member): If the symbol is undefined,
5383         check to see if it is on the list of symbols pending assignment.
5384
5385 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5386
5387         * script-sections.cc (Script_sections::find_memory_region): Check
5388         for a NULL output section pointer.
5389
5390 2010-10-29  Doug Kwan  <dougkwan@google.com>
5391
5392         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5393         Output_section::add_relaxed_input_section.
5394         * output.cc (Output_section::add_relaxed_input_section): Add new
5395         arguments LAYOUT and NAME.  Set section order index.
5396         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5397         Copy section order index.
5398         * output.h (Output_section::add_relaxed_input_section): Add new
5399         arguments LAYOUT and NAME.
5400
5401 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5402
5403         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5404         NATIVE_OR_CROSS_LINKER.
5405         * testsuite/Makefile.in: Regenerate.
5406
5407 2010-10-20  Doug Kwan  <dougkwan@google.com>
5408
5409         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5410         without SHF_LINK_ORDER flags.
5411         * layout.cc (Layout::choose_output_section): Do not filter
5412         SHF_LINK_ORDER flag in a relocatable link.
5413
5414 2010-10-17  Cary Coutant  <ccoutant@google.com>
5415
5416         * output.h (Output_segment::set_section_addresses): Change function
5417         signature.  Update all callers.
5418         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5419         sections.
5420         (Output_segment::set_section_addresses): Align after last TLS
5421         section.  Add padding before last relro section instead of after.
5422
5423 2010-10-17  Doug Kwan  <dougkwan@google.com>
5424
5425         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5426         GOT output section to be writable.
5427
5428 2010-10-14  Cary Coutant  <ccoutant@google.com>
5429
5430         * debug.h (DEBUG_INCREMENTAL): New flag.
5431         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5432         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5433         mode.
5434         * incremental.cc (report_command_line): Ignore all forms of
5435         --incremental.
5436         * layout.cc (Layout::Layout): Check parameters for incremental link
5437         mode.
5438         * options.cc (General_options::parse_incremental): New function.
5439         (General_options::parse_no_incremental): New function.
5440         (General_options::parse_incremental_full): New function.
5441         (General_options::parse_incremental_update): New function.
5442         (General_options::incremental_mode_): New data member.
5443         (General_options::finalize): Check incremental_mode_.
5444         * options.h (General_options): Update help text for --incremental.
5445         Add --no-incremental, --incremental-full, --incremental-update.
5446         (General_options::Incremental_mode): New enum type.
5447         (General_options::incremental_mode): New function.
5448         (General_options::incremental_mode_): New data member.
5449         * parameters.cc (Parameters::incremental_mode_): New data member.
5450         (Parameters::set_options): Set incremental_mode_.
5451         (Parameters::set_incremental_full): New function.
5452         (Parameters::incremental): New function.
5453         (Parameters::incremental_update): New function.
5454         (set_parameters_incremental_full): New function.
5455         * parameters.h (Parameters::set_incremental_full): New function.
5456         (Parameters::incremental): New function.
5457         (Parameters::incremental_update): New function.
5458         (Parameters::incremental_mode_): New data member.
5459         (set_parameters_incremental_full): New function.
5460         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5461         incremental link mode.
5462         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5463         (Sized_relobj::do_relocate_sections): Likewise.
5464         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5465         option.
5466         * testsuite/Makefile.in: Regenerate.
5467         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5468
5469 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5470
5471         * script-sections.h (class Script_sections): Make
5472         Sections_elements typedef public.
5473         * script-sections.cc (class Sort_output_sections): Add elements_
5474         field.  Add constructor which sets it; change all callers.
5475         (Sort_output_sections::is_before): New function.
5476         (Sort_output_sections::operator()): Call is_before.
5477         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5478         conditional.
5479         * testsuite/script_test_10.sh: New test. Test script section
5480         order.
5481         * testsuite/script_test_10.t: Likewise.
5482         * testsuite/script_test_10.s: Likewise.
5483         * testsuite/Makefile.am: Wrap the cross linker tests and the
5484         common tests into NATIVE_OR_CROSS_LINKER.
5485         (check_SCRIPTS): Add script_test_10.sh.
5486         (check_DATA): Add script_test_10.stdout.
5487         (script_test_10.o, script_test_10): New targets.
5488         (script_test_10.stdout): New target.
5489         * configure, testsuite/Makefile.in: Regenerate.
5490
5491 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5492
5493         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5494         error for the deprecated relocations.
5495         (Target_arm::Scan::global): Likewise.
5496         (Target_arm::Relocate::relocate): Likewise.
5497
5498 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5499
5500         * fileread.cc (Input_file::find_file): Initialize *found_name
5501         and *namep when using the fallback search for case 4.
5502
5503 2010-10-11  Cary Coutant  <ccoutant@google.com>
5504
5505         * options.h (class General_options): Redefine -z lazy as an alias for
5506         the negation of -z now.
5507
5508 2010-10-11  Ian Lance Taylor  <iant@google.com>
5509
5510         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5511         binding.
5512
5513 2010-10-06  Nick Clifton  <nickc@redhat.com>
5514
5515         * script-sections.cc(class Memory_region): Remove
5516         current_lma_offset_ field.  Rename current_vma_offset_ to
5517         current_offset_.  Add last_section_ field.
5518         (Memory_region::get_current_vma_address): Rename to
5519         get_current_address.
5520         (Memory_region::get_current_lma_address): Delete.
5521         (Memory_region::increment_vma_offset): Rename to
5522         increment_offset.
5523         (Memory_region::increment_lma_offset): Delete.
5524         (Memory_region::attributes_compatible): New method.  Returns
5525         true if the provided section is compatible with the region.
5526         (Memory_region::get_last_section): New method.  Returns the last
5527         section to use the region.
5528         (Memory_region::set_last_section): New method.  Stores the last
5529         section to use the region.
5530         (Script_sections::block_in_region): New method.  Returns true if
5531         a block of memory is contained within a region.
5532         (Script_sections::find_memory_region): New method.  Locates a
5533         memory region to be used to set a VMA or LMA address.
5534         (Output_section_definition::set_section_addresses): Add code to
5535         check for addresses set by memory regions.
5536         (Output_segment::set_section_addresses): Remove memory region
5537         walking code.
5538         (Script_sections::create_segment): Add a warning if a header
5539         segment is created outside of any region.
5540         * script-sections.h (class Script_sections): Add prototypes for
5541         find_memory_region and block_in_region methods.
5542         * testsuite/memory_test.s: Use .long instead of .word.
5543         * testsuite/memory_test.t: Add some more output sections.
5544         * testsuite/memory_test.sh: Update expected output.
5545
5546 2010-10-02  Doug Kwan  <dougkwan@google.com>
5547
5548         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5549         defintion to symtab.h
5550         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5551         declaration to defintion.
5552
5553 2010-10-01  Nick Clifton  <nickc@redhat.com>
5554
5555         * expression.cc (eval): Replace dummy argument with NULL.
5556         (eval_maybe_dot): Check for a NULL result section pointer.
5557         (Symbol_expression::value): Likewise.
5558         (Dot_expression::value): Likewise.
5559         (BINARY_EXPRESSION): Likewise.
5560         (Max_expression::value): Likewise.
5561         (Min_expression::value): Likewise.
5562         (Absolute_expression::value): Likewise.
5563         (Addr_expression::value_from_output_section): Likewise.
5564         (Loaddddr_expression::value_from_output_section): Likewise.
5565         (Segment_start_expression::value): Likewise.
5566         * script-sections.cc
5567         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5568         argument with NULL.
5569         (Sections_elememt_dot_assignment::set_section_addresses):
5570         Likewise.
5571         (Output_data_expression::do_write_to_buffer): Likewise.
5572         (Output_section_definition::finalize_symbols): Likewise.
5573         (Output_section_definition::set_section_addresses): Likewise.
5574
5575 2010-09-30  Doug Kwan  <dougkwan@google.com>
5576
5577         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5578
5579 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5580
5581         * target.h (Target::can_icf_inline_merge_sections): New virtual
5582         function.
5583         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5584         virtual function.
5585         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5586         virtual function.
5587         * icf.cc (get_section_contents): Inline merge sections only when
5588         target allows it.
5589
5590 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5591
5592         * configure: Regenerate.
5593
5594 2010-09-17  Ian Lance Taylor  <iant@google.com>
5595
5596         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5597         * testsuite/Makefile.am (memory_test.o): New target.
5598         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5599         memory_test.t.
5600         * testsuite/Makefile.in: Rebuild.
5601
5602 2010-09-17  Doug Kwan  <dougkwan@google.com>
5603
5604         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5605         defintion if relocation uses GOT entries of the symbol.
5606         * testsuite/icf_safe_test.sh: Fix test.
5607         * testsuite/icf_safe_so_test.sh: Fix test.
5608
5609 2010-09-16  Cary Coutant  <ccoutant@google.com>
5610
5611         * script_sections.cc (class Memory_region): Remove "NULL" from
5612         vector initializations.
5613
5614 2010-09-15  Cary Coutant  <ccoutant@google.com>
5615
5616         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5617         Resolve forwarding symbols.
5618
5619 2010-09-15  Doug Kwan  <dougkwan@google.com>
5620
5621         * gold/testsuite/script_test_3.t: Add ARM special sections.
5622         * gold/testsuite/script_test_4.t: Same.
5623         * gold/testsuite/script_test_5.t: Same.
5624         * gold/testsuite/script_test_6.t: Same.
5625         * gold/testsuite/script_test_7.t: Same.
5626         * gold/testsuite/script_test_7.t: Same.
5627         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5628
5629 2010-09-14  Cary Coutant  <ccoutant@google.com>
5630
5631         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5632         (Target_x86_64::Relocate::relocate_tls): Replace check for
5633         saw_tls_block_reloc_ with test for executable section.
5634
5635 2010-09-12  Cary Coutant  <ccoutant@google.com>
5636
5637         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5638         position-independent executables to shared libraries need dynamic
5639         relocations.
5640         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5641         position-independent executables.
5642         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5643         * testsuite/Makefile.in: Regenerate.
5644
5645 2010-09-10  Nick Clifton  <nickc@redhat.com>
5646
5647         PR gold/11997
5648         * testsuite/memory_test.t: Discard any sections that are not
5649         needed.
5650
5651 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5652
5653         PR gold/11996
5654         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5655         "This::" to work around a bug in gcc 4.2.
5656
5657         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5658
5659 2010-09-09  Rafael Espindola  <espindola@google.com>
5660
5661         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5662         sections with different PF_X flags in the same segment.
5663         (Layout::find_first_load_seg): Search all segments to find the first
5664         one.
5665         * options.h (rosegment): New.
5666
5667 2010-09-08  Rafael Espindola  <espindola@google.com>
5668
5669         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5670
5671 2010-09-08  Doug Kwan  <dougkwan@google.com>
5672
5673         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5674         (Arm_relobj::do_relocate_sections): Add new parameter for output
5675         file to match the parent.
5676         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5677         of local symbols instead of input values.  Update code to track
5678         changes in gold::relocate_section.
5679         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5680         (Sized_relobj::compute_final_local_value_internal): New methods.
5681         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5682         body into private version of Sized_relobj::compute_final_local_value.
5683         Call the inline method.
5684         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5685         merged symbol value if there is one.
5686         (Symbol_value::has_output_value): New method defintiion.
5687         (Sized_relobj::Compute_final_local_value_status): New enum type.
5688         (Sized_relobj::compute_final_local_value): New methods.
5689         (Sized_relobj::compute_final_local_value_internal): New methods.
5690         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5691         and arm_cortex_a8.sh.
5692         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5693         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5694         New tests.
5695         * Makefile.in: Regenerate.
5696         * testsuite/arm_bl_out_of_range.s: Update test.
5697         * testsuite/thumb_bl_out_of_range.s: Ditto.
5698         * testsuite/thumb_blx_out_of_range.s: Ditto.
5699         * testsuite/arm_branch_out_of_range.sh: New file.
5700         * testsuite/arm_cortex_a8.sh: Ditto.
5701         * testsuite/arm_cortex_a8_b.s: Ditto.
5702         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5703         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5704         * testsuite/arm_cortex_a8_bl.s: Ditto.
5705         * testsuite/arm_cortex_a8_blx.s: Ditto.
5706         * testsuite/arm_cortex_a8_local.s: Ditto.
5707         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5708         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5709
5710 2010-09-08  Rafael Espindola  <espindola@google.com>
5711
5712         * Makefile.am (memory_test.stdout): Run readelf with -W.
5713         * Makefile.in: Regenerate.
5714         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5715         64 bit output.
5716
5717 2010-09-08  Rafael Espindola  <espindola@google.com>
5718
5719         * script-sections.cc (Script_sections::add_memory_region): Convert
5720         field precision to int.
5721         * script.cc (script_set_section_region, script_set_section_region):
5722         Convert field precision to int.
5723
5724 2010-09-08  Rafael Espindola  <espindola@google.com>
5725
5726         * arm.cc (do_finalize_sections): Create the __exidx_start and
5727         __exdix_end symbols even when the section is missing.
5728
5729 2010-09-08  Nick Clifton  <nickc@redhat.com>
5730
5731         * README: Remove claim that MEMORY is not supported.
5732         * expression.cc (script_exp_function_origin)
5733         (script_exp_function_length): Move from here to ...
5734         * script.cc: ... here.
5735         (script_set_section_region, script_add_memory)
5736         (script_parse_memory_attr, script_include_directive): New
5737         functions.
5738         * script-sections.cc
5739         (class Memory_region): New class.
5740         (class Output_section_definition): Add set_memory_region,
5741         set_section_vma, set_section_lma and get_section_name methods.
5742         (class Script_Sections): Add add_memory_region,
5743         find_memory_region, find_memory_region_origin,
5744         find_memory_region_length and set_memory_region methods.
5745         Have set_section_addresses method walk the list of set memory
5746         regions.
5747         Extend the print methos to display memory regions.
5748         * script-sections.h: Add prototypes for new methods.
5749         Add enum for MEMORY region attributes.
5750         * yyscript.y: Add support for parsing MEMORY regions.
5751         * script-c.h: Add prototypes for new functions.
5752         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5753         * testsuite/Makefile.in: Regenerate.
5754         * testsuite/memory_test.sh: New script.
5755         * testsuite/memory_test.s: New assembler source file.
5756         * testsuite/memory_test.t: New linker script.
5757
5758 2010-08-27  Doug Kwan  <dougkwan@google.com>
5759
5760         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5761         reference override an existing dynamic weak reference.
5762         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5763         * testsuite/Makefile.in: Regenerate.
5764         * testsuite/dyn_weak_ref.sh: New file.
5765         * testsuite/dyn_weak_ref_1.c: Ditto.
5766         * testsuite/dyn_weak_ref_2.c: Ditto.
5767
5768 2010-08-27  Ian Lance Taylor  <iant@google.com>
5769
5770         * incremental.h (class Incremental_input_entry): Add virtual
5771         destructor.
5772
5773 2010-08-27  Ian Lance Taylor  <iant@google.com>
5774
5775         * testsuite/start_lib_test_3.c: Mark t3 as used.
5776
5777 2010-08-27  Nick Clifton  <nickc@redhat.com>
5778
5779         * options.cc (version_script): Fix small typo in previous
5780         whitespace tidyup.
5781
5782 2010-08-25  Nick Clifton  <nickc@redhat.com>
5783
5784         * archive.cc: Formatting fixes: Remove whitespace between
5785         typename and following asterisk.  Remove whitespace between
5786         function name and opening parenthesis.
5787         * archive.h: Likewise.
5788         * arm.cc: Likewise.
5789         * attributes.cc: Likewise.
5790         * attributes.h: Likewise.
5791         * common.cc: Likewise.
5792         * copy-relocs.cc: Likewise.
5793         * dirsearch.h: Likewise.
5794         * dynobj.cc: Likewise.
5795         * ehframe.cc: Likewise.
5796         * ehframe.h: Likewise.
5797         * expression.cc: Likewise.
5798         * fileread.cc: Likewise.
5799         * fileread.h: Likewise.
5800         * gc.h: Likewise.
5801         * gold-threads.cc: Likewise.
5802         * gold.cc: Likewise.
5803         * i386.cc: Likewise.
5804         * icf.h: Likewise.
5805         * incremental-dump.cc: Likewise.
5806         * incremental.cc: Likewise.
5807         * layout.cc: Likewise.
5808         * layout.h: Likewise.
5809         * main.cc: Likewise.
5810         * merge.cc: Likewise.
5811         * merge.h: Likewise.
5812         * object.cc: Likewise.
5813         * object.h: Likewise.
5814         * options.cc: Likewise.
5815         * options.h: Likewise.
5816         * output.cc: Likewise.
5817         * output.h: Likewise.
5818         * plugin.cc: Likewise.
5819         * plugin.h: Likewise.
5820         * powerpc.cc: Likewise.
5821         * reloc.cc: Likewise.
5822         * script-c.h: Likewise.
5823         * script-sections.cc: Likewise.
5824         * script.cc: Likewise.
5825         * stringpool.cc: Likewise.
5826         * symtab.cc: Likewise.
5827         * symtab.h: Likewise.
5828         * target.cc: Likewise.
5829         * timer.cc: Likewise.
5830         * timer.h: Likewise.
5831         * version.cc: Likewise.
5832         * x86_64.cc: Likewise.
5833
5834 2010-08-24  Nick Clifton  <nickc@redhat.com>
5835
5836         PR 11899
5837         * layout.cc (segment_precedes): Sort segments by their physical
5838         addresses, if they have been set.
5839
5840 2010-08-23  Cary Coutant  <ccoutant@google.com>
5841
5842         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5843         symbols data.
5844         (Lib_group::include_member): Unlock object after deleting its
5845         symbols data.
5846         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5847         the bug fixed here.
5848
5849 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5850             Cary Coutant  <ccoutant@google.com>
5851
5852         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5853         constructor, and set_blocker.
5854         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5855         readsyms_blocker_.
5856         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5857         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5858         * testsuite/Makefile.am (start_lib_test): New test case.
5859         * testsuite/Makefile.in: Regenerate.
5860         * testsuite/start_lib_test_main.c: New file.
5861         * testsuite/start_lib_test_1.c: New file.
5862         * testsuite/start_lib_test_2.c: New file.
5863         * testsuite/start_lib_test_3.c: New file.
5864
5865 2010-08-19  Ian Lance Taylor  <iant@google.com>
5866
5867         * Makefile.in: Rebuild with automake 1.11.1.
5868         * aclocal.m4: Likewise.
5869         * testsuite/Makefile.in: Likewise.
5870
5871 2010-08-19  Ian Lance Taylor  <iant@google.com>
5872
5873         PR 10893
5874         * i386.cc (class Output_data_plt_i386): Update declarations.
5875         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5876         local_ifuncs_ fields.
5877         (Target_i386::do_plt_section_for_global): New function.
5878         (Target_i386::do_plt_section_for_local): New function.
5879         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5880         parameter; change all callers.  Initialize global_ifuncs_ and
5881         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5882         __rel_iplt_end.
5883         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5884         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5885         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5886         symbols.
5887         (Target_i386::make_plt_section): New function, broken out of
5888         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5889         (Target_i386::make_plt_entry): Call make_plt_section.
5890         (Target_i386::make_local_ifunc_plt_entry): New function.
5891         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5892         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5893         R_386_IRELATIVE to switch.
5894         (Target_i386::Scan::global): Likewise.
5895         (Target_i386::Relocate::relocate): Likewise.
5896         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5897         switch.
5898         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5899         (Target_x86_64::do_plt_section_for_global): New function.
5900         (Target_x86_64::do_plt_section_for_local): New function.
5901         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5902         parameter; change all callers.  If doing a static link define
5903         __rela_iplt_start and __rela_iplt_end.
5904         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5905         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5906         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5907         to point to .plt.
5908         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5909         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5910         switch.
5911         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5912         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5913         R_X86_64_IRELATIVE to switch.
5914         (Target_x86_64::Scan::global): Likewise.
5915         (Target_x86_64::Relocate::relocate): Likewise.
5916         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5917         switch.
5918         * target.h (class Target): Add plt_section_for_global and
5919         plt_section_for_local functions.  Add do_plt_section_for_global
5920         and do_plt_section_for_local virtual functions.
5921         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5922         clarifying comments.
5923         (Symbol::use_plt_offset): Handle IFUNC symbol.
5924         * object.cc (Sized_relobj::Sized_relobj): Initialize
5925         local_plt_offsets_.
5926         (Sized_relobj::local_has_plt_offset): New function.
5927         (Sized_relobj::local_plt_offset): New function.
5928         (Sized_relobj::set_local_plt_offset): New function.
5929         (Sized_relobj::do_count): Handle IFUNC symbol.
5930         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5931         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5932         is_ifunc_symbol functions.
5933         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5934         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5935         local_plt_offsets_ field.
5936         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5937         * output.h (class Output_section_data): Add non-const
5938         output_section function.
5939         (class Output_data_got): Update declarations.
5940         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5941         Add use_plt_offset parameter to global and local constructors.
5942         Change all callers.  Change local_sym_index_ field to 31 bits.
5943         Change GSYM_CODE and CONSTANT_CODE accordingly.
5944         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5945         doing a static link don't set sh_link field.
5946         (Output_data_got::Got_entry::write): Use PLT offset if
5947         appropriate.
5948         (Output_data_got::add_global_plt): New function.
5949         (Output_data_got::add_local_plt): New function.
5950         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5951         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5952         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5953         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5954         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5955         IFUNC conditional.
5956         * testsuite/ifunc-sel.h: New file.
5957         * testsuite/ifuncmain1.c: New file.
5958         * testsuite/ifuncmain1vis.c: New file.
5959         * testsuite/ifuncmod1.c: New file.
5960         * testsuite/ifuncdep2.c: New file.
5961         * testsuite/ifuncmain2.c: New file.
5962         * testsuite/ifuncmain3.c: New file.
5963         * testsuite/ifuncmod3.c: New file.
5964         * testsuite/ifuncmain4.c: New file.
5965         * testsuite/ifuncmain5.c: New file.
5966         * testsuite/ifuncmod5.c: New file.
5967         * testsuite/ifuncmain6pie.c: New file.
5968         * testsuite/ifuncmod6.c: New file.
5969         * testsuite/ifuncmain7.c: New file.
5970         * configure, testsuite/Makefile.in: Rebuild.
5971
5972 2010-08-18  Ian Lance Taylor  <iant@google.com>
5973
5974         * incremental.cc
5975         (Output_section_incremental_inputs::write_input_files): Add cast
5976         to avoid signed/unsigned comparison warning.
5977         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5978
5979 2010-08-12  Cary Coutant  <ccoutant@google.com>
5980
5981         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5982
5983 2010-08-13  Ian Lance Taylor  <iant@google.com>
5984
5985         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5986
5987 2010-08-12  Cary Coutant  <ccoutant@google.com>
5988             Doug Kwan  <dougkwan@google.com>
5989
5990         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5991         defintion overrides non-weak undef, remember that the original undef
5992         is not weak.
5993         * symtab.cc (Symbol_table::sized_write_global): For undef without
5994         an original weak binding, set binding to global in output.
5995         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5996         * testsuite/Makefile.in: Regenerate.
5997         * testsuite/strong_ref_weak_def.sh: New file.
5998         * testsuite/strong_ref_weak_def_1.c: Ditto.
5999         * testsuite/strong_ref_weak_def_2.c: Ditto.
6000
6001 2010-08-12  Cary Coutant  <ccoutant@google.com>
6002
6003         * testsuite/incremental_test.sh: Rewrite.
6004         * testsuite/incremental_test_1.c: Rewrite.
6005         * testsuite/incremental_test_2.c: Rewrite.
6006
6007 2010-08-12  Cary Coutant  <ccoutant@google.com>
6008
6009         * arm.cc (Target_arm::got_size): Add const.
6010         (Target_arm::got_entry_count): New function.
6011         (Target_arm::plt_entry_count): New function.
6012         (Target_arm::first_plt_entry_offset): New function.
6013         (Target_arm::plt_entry_size): New function.
6014         (Output_data_plt_arm::entry_count): New function.
6015         (Output_data_plt_arm::first_plt_entry_offset): New function.
6016         (Output_data_plt_arm::get_plt_entry_size): New function.
6017         * i386.cc (Target_i386::got_size): Add const.
6018         (Target_i386::got_entry_count): New function.
6019         (Target_i386::plt_entry_count): New function.
6020         (Target_i386::first_plt_entry_offset): New function.
6021         (Target_i386::plt_entry_size): New function.
6022         (Output_data_plt_i386::entry_count): New function.
6023         (Output_data_plt_i386::first_plt_entry_offset): New function.
6024         (Output_data_plt_i386::get_plt_entry_size): New function.
6025         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6026         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6027         * incremental.cc: Include target.h.
6028         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6029         parameter.  Adjust all callers.  Find incremental_got_plt section.
6030         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6031         section.
6032         (Output_section_incremental_inputs::set_final_data_size): Calculate
6033         size of incremental_got_plt section.
6034         (Output_section_incremental_inputs::do_write): Write the
6035         incremental_got_plt section.
6036         (Got_plt_view_info): New struct.
6037         (Local_got_offset_visitor): New class.
6038         (Global_got_offset_visitor): New class.
6039         (Global_symbol_visitor_got_plt): New class.
6040         (Output_section_incremental_inputs::write_got_plt): New function.
6041         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6042         Add parameter.  Adjust all callers.
6043         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6044         (Incremental_inputs::got_plt_section): New function.
6045         (Incremental_inputs::got_plt_section_): New data member.
6046         (Incremental_got_plt_reader): New class.
6047         * layout.cc (Layout::create_incremental_info_sections): Add the
6048         incremental_got_plt section.
6049         * object.h (Got_offset_list::get_list): New function.
6050         (Got offset_list::for_all_got_offsets): New function.
6051         (Sized_relobj::local_got_offset_list): New function.
6052         * powerpc.cc (Target_powerpc::got_size): Add const.
6053         (Target_powerpc::got_entry_count): New function.
6054         (Target_powerpc::plt_entry_count): New function.
6055         (Target_powerpc::first_plt_entry_offset): New function.
6056         (Target_powerpc::plt_entry_size): New function.
6057         (Output_data_plt_powerpc::entry_count): New function.
6058         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6059         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6060         * sparc.cc (Target_sparc::got_size): Add const.
6061         (Target_sparc::got_entry_count): New function.
6062         (Target_sparc::plt_entry_count): New function.
6063         (Target_sparc::first_plt_entry_offset): New function.
6064         (Target_sparc::plt_entry_size): New function.
6065         (Output_data_plt_sparc::entry_count): New function.
6066         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6067         (Output_data_plt_sparc::get_plt_entry_size): New function.
6068         * symtab.h (Symbol::got_offset_list): New function.
6069         (Symbol_table::for_all_symbols): New function.
6070         * target.h (Sized_target::got_entry_count): New function.
6071         (Sized_target::plt_entry_count): New function.
6072         (Sized_target::plt_entry_size): New function.
6073         * x86_64.cc (Target_x86_64::got_size): Add const.
6074         (Target_x86_64::got_entry_count): New function.
6075         (Target_x86_64::plt_entry_count): New function.
6076         (Target_x86_64::first_plt_entry_offset): New function.
6077         (Target_x86_64::plt_entry_size): New function.
6078         (Output_data_plt_x86_64::entry_count): New function.
6079         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6080         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6081
6082 2010-08-12  Cary Coutant  <ccoutant@google.com>
6083
6084         * archive.cc: Include incremental.h.
6085         (Archive::Archive): Initialize incremental_info_.
6086         (Archive::include_member): Record archive members in incremental info.
6087         (Add_archive_symbols::run): Record begin and end of an archive in
6088         incremental info.
6089         (Lib_group::include_member): Record objects in incremental info.
6090         * archive.h (Incremental_archive_entry): Forward declaration.
6091         (Archive::set_incremental_info): New member function.
6092         (Archive::incremental_info): New member function.
6093         (Archive::Unused_symbol_iterator): New class.
6094         (Archive::unused_symbols_begin): New member function.
6095         (Archive::unused_symbols_end): New member function.
6096         (Archive::incremental_info_): New data member.
6097         * incremental-dump.cc (find_input_containing_global): New function.
6098         (dump_incremental_inputs): Dump new incremental info sections.
6099         * incremental.cc: Include symtab.h.
6100         (Output_section_incremental_inputs): New class.
6101         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6102         new incremental info sections.
6103         (Sized_incremental_binary::do_check_inputs): Likewise.
6104         (Incremental_inputs::report_archive): Remove.
6105         (Incremental_inputs::report_archive_begin): New function.
6106         (Incremental_inputs::report_archive_end): New function.
6107         (Incremental_inputs::report_object): New function.
6108         (Incremental_inputs::finalize_inputs): Remove.
6109         (Incremental_inputs::report_input_section): New function.
6110         (Incremental_inputs::report_script): Rewrite.
6111         (Incremental_inputs::finalize): Do nothing but finalize string table.
6112         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6113         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6114         (Incremental_inputs::create_data_sections): New function.
6115         (Incremental_inputs::relocs_entsize): New function.
6116         (Output_section_incremental_inputs::set_final_data_size): New function.
6117         (Output_section_incremental_inputs::do_write): New function.
6118         (Output_section_incremental_inputs::write_header): New function.
6119         (Output_section_incremental_inputs::write_input_files): New function.
6120         (Output_section_incremental_inputs::write_info_blocks): New function.
6121         (Output_section_incremental_inputs::write_symtab): New function.
6122         * incremental.h (Incremental_script_entry): Forward declaration.
6123         (Incremental_object_entry): Forward declaration.
6124         (Incremental_archive_entry): Forward declaration.
6125         (Incremental_inputs): Forward declaration.
6126         (Incremental_inputs_header_data): Remove.
6127         (Incremental_inputs_header): Remove.
6128         (Incremental_inputs_header_write): Remove.
6129         (Incremental_inputs_entry_data): Remove.
6130         (Incremental_inputs_entry): Remove.
6131         (Incremental_inputs_entry_write): Remove.
6132         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6133         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6134         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6135         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6136         Likewise.
6137         (Incremental_input_entry): New class.
6138         (Incremental_script_entry): New class.
6139         (Incremental_object_entry): New class.
6140         (Incremental_archive_entry): New class.
6141         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6142         (Incremental_inputs::report_inputs): Remove.
6143         (Incremental_inputs::report_archive): Remove.
6144         (Incremental_inputs::report_archive_begin): New function.
6145         (Incremental_inputs::report_archive_end): New function.
6146         (Incremental_inputs::report_object): Change prototype.
6147         (Incremental_inputs::report_input_section): New function.
6148         (Incremental_inputs::report_script): Change prototype.
6149         (Incremental_inputs::get_reloc_count): New function.
6150         (Incremental_inputs::set_reloc_count): New function.
6151         (Incremental_inputs::create_data_sections): New function.
6152         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6153         (Incremental_inputs::inputs_section): New function.
6154         (Incremental_inputs::symtab_section): New function.
6155         (Incremental_inputs::relocs_section): New function.
6156         (Incremental_inputs::get_stringpool): Add const.
6157         (Incremental_inputs::command_line): Add const.
6158         (Incremental_inputs::inputs): Remove.
6159         (Incremental_inputs::command_line_key): New function.
6160         (Incremental_inputs::input_file_count): New function.
6161         (Incremental_inputs::input_files): New function.
6162         (Incremental_inputs::relocs_entsize): New function.
6163         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6164         (Incremental_inputs::finalize_inputs): Remove.
6165         (Incremental_inputs::Input_info): Remove.
6166         (Incremental_inputs::lock_): Remove.
6167         (Incremental_inputs::inputs_): Change type.
6168         (Incremental_inputs::inputs_map_): Remove.
6169         (Incremental_inputs::current_object_entry_): New data member.
6170         (Incremental_inputs::inputs_section_): New data member.
6171         (Incremental_inputs::symtab_section_): New data member.
6172         (Incremental_inputs::relocs_section_): New data member.
6173         (Incremental_inputs::reloc_count_): New data member.
6174         (Incremental_inputs_reader): New class.
6175         (Incremental_symtab_reader): New class.
6176         (Incremental_relocs_reader): New class.
6177         * layout.cc (Layout::finalize): Move finalization of incremental info
6178         and creation of incremental info sections to follow finalization of
6179         symbol table.  Set offsets for postprocessing sections.
6180         (Layout::create_incremental_info_sections): Call
6181         Incremental_inputs::create_data_sections.  Add incremental symtab
6182         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6183         sections to layout after input sections.
6184         * layout.h (struct Timespec): Forward declaration.
6185         (Layout::incremental_inputs): Add const.
6186         (Layout::create_incremental_info_sections): Add parameter.
6187         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6188         * object.cc: Include incremental.h.
6189         (Relobj::finalize_incremental_relocs): New function.
6190         (Sized_relobj::do_layout): Record input sections in incremental info.
6191         * object.h (Object::output_section): New function.
6192         (Object::output_section_offset): Moved from Relobj.
6193         (Object::get_incremental_reloc_base): New function.
6194         (Object::get_incremental_reloc_count): New function.
6195         (Object::do_output_section): New function.
6196         (Object::do_output_section_offset): Moved from Relobj.
6197         (Object::do_get_incremental_reloc_base): New function.
6198         (Object::do_get_incremental_reloc_count): New function.
6199         (Object::Object): Initialize new data members.
6200         (Relobj::output_section): Renamed do_output_section and moved to
6201         protected.
6202         (Relobj::output_section_offset): Moved to Object.
6203         (Relobj::do_get_incremental_reloc_base): New function.
6204         (Relobj::do_get_incremental_reloc_count): New function.
6205         (Relobj::allocate_incremental_reloc_counts): New function.
6206         (Relobj::count_incremental_reloc): New function.
6207         (Relobj::finalize_incremental_relocs): New function.
6208         (Relobj::next_incremental_reloc_index): New function.
6209         (Relobj::reloc_counts_): New data member.
6210         (Relobj::reloc_bases_): New data member.
6211         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6212         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6213         (Sized_relobj::incremental_relocs_scan): New function.
6214         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6215         (Sized_relobj::incremental_relocs_write): New function.
6216         (Sized_relobj::incremental_relocs_write_reltype): New function.
6217         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6218         incremental link.
6219         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6220         archives and object files elsewhere.
6221         (Add_symbols::run): Report object files here.
6222         (Finish_group::run): Report end of archive at end of group.
6223         * reloc.cc: Include layout.h, incremental.h.
6224         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6225         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6226         (Sized_relobj::incremental_relocs_scan): New function.
6227         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6228         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6229         (Sized_relobj::incremental_relocs_write): New function.
6230         (Sized_relobj::incremental_relocs_write_reltype): New function.
6231         * script.cc (read_input_script): Rewrite test for incremental link.
6232         Change call to Incremental_inputs::report_script.
6233         * symtab.h (Symbol_table::first_global_index): New function.
6234         (Symbol_table::output_count): New function.
6235
6236 2010-08-12  Doug Kwan  <dougkwan@google.com>
6237
6238         * arm.cc (Target_arm::merge_object_attributes): Check command line
6239         options --no-wchar-size-warning and --no-enum-size-warning.
6240         * options.h (General_options): Add ld-compatible options
6241         --no-enum-size-warning and --no-wchar-size-warning.
6242
6243 2010-08-04  Ian Lance Taylor  <iant@google.com>
6244
6245         * x86_64.cc (Target_x86_64::Scan::local): Use
6246         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6247         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6248         (Target_x86_64::Scan::global): Likewise.
6249         (Target_x86_64::Relocate::relocate): Likewise.
6250         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6251         Likewise.
6252
6253 2010-08-03  Cary Coutant  <ccoutant@google.com>
6254
6255         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6256         to reserve space in merged_strings vector. Keep total input size
6257         for stats.
6258         (Output_merge_string::do_print_merge_stats): Print total input size.
6259         * merge.h (Output_merge_string): Add input_size_ field.
6260         * stringpool.cc (Stringpool_template::string_length): Move
6261         implementations out of Stringpool_template class and place in
6262         stringpool.h.
6263         * stringpool.h (string_length): Move out of Stringpool_template.
6264
6265 2010-08-03  Ian Lance Taylor  <iant@google.com>
6266
6267         PR 11712
6268         * layout.cc (relaxation_loop_body): If address of load segment is
6269         set, adjust address to include headers if possible.
6270
6271 2010-08-03  Ian Lance Taylor  <iant@google.com>
6272
6273         * version.cc (version_string): Bump to 1.10.
6274
6275 2010-08-03  Ian Lance Taylor  <iant@google.com>
6276
6277         PR 11805
6278         * layout.h (enum Output_section_order): Define.
6279         (class Layout): Update declarations.
6280         * layout.cc (Layout::get_output_section): Add order parameter.
6281         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6282         is_first_non_relro parameters.  Change all callers.
6283         (Layout::choose_output_section): Likewise.
6284         (Layout::add_output_section_data): Likewise.
6285         (Layout::make_output_section): Likewise.  Set order.
6286         (Layout::default_section_order): New function.
6287         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6288         * output.cc (Output_section::Output_section): Initialize order_.
6289         Don't initialize deleted fields.
6290         (Output_segment::Output_segment): Don't initialize deleted
6291         fields.
6292         (Output_segment::add_output_section_to_load): New function
6293         replacing add_output_section.  Change all callers to call this or
6294         add_output_section_to_nonload.
6295         (Output_segment::add_output_section_to_nonload): New function.
6296         (Output_segment::remove_output_section): Rewrite.
6297         (Output_segment::add_initial_output_data): Likewise.
6298         (Output_segment::has_any_data_sections): Likewise.
6299         (Output_segment::is_first_section_relro): Likewise.
6300         (Output_segment::maximum_alignment): Likewise.
6301         (Output_segment::has_dynamic_reloc): New function replacing
6302         dynamic_reloc_count.  Change all callers.
6303         (Output_segment::has_dynamic_reloc_list): New function replacing
6304         dynamic_reloc_count_list.  Change all callers.
6305         (Output_segment::set_section_addresses): Rewrite.
6306         (Output_segment::set_offset): Rewrite.
6307         (Output_segment::find_first_and_last_list): Remove.
6308         (Output_segment::set_tls_offsets): Rewrite.
6309         (Output_segment::first_section_load_address): Likewise.
6310         (Output_segment::output_section_count): Likewise.
6311         (Output_segment::section_with_lowest_load_address): Likewise.
6312         (Output_segment::write_section_headers): Likewise.
6313         (Output_segment::print_sections_to_map): Likewise.
6314         * output.h (class Output_data): Remove dynamic_reloc_count_
6315         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6316         (Output_data::add_dynamic_reloc): Rewrite.
6317         (Output_data::has_dynamic_reloc): New function.
6318         (Output_data::dynamic_reloc_count): Remove.
6319         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6320         is_last_relro_, is_first_non_relro_, is_interp_,
6321         is_dynamic_linker_section_ fields.  Add order and set_order
6322         functions.  Remove is_relro_local, set_is_relro_local,
6323         is_last_relro, set_is_last_relro, is_first_non_relro,
6324         set_is_first_non_relro functions, is_interp, set_is_interp,
6325         is_dynamic_linker_section, and set_is_dynamic_linker_section
6326         functions.
6327         (class Output_segment): Change Output_data_list from std::list to
6328         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6329         output_bss_ fields.  Update declarations.
6330
6331 2010-08-02  Ian Lance Taylor  <iant@google.com>
6332
6333         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6334         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6335         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6336
6337 2010-08-02  Ian Lance Taylor  <iant@google.com>
6338
6339         PR 11855
6340         * script.cc (Script_options::Script_options): Initialize
6341         symbol_definitions_ and symbol_references_.
6342         (Script_options::add_symbol_assignment): Update
6343         symbol_definitions_ and symbol_references_.
6344         (Script_options::add_symbol_reference): New function.
6345         (script_symbol): New function.
6346         * script.h (class Script_options): Add symbol_definitions_ and
6347         symbol_references_ fields.
6348         (Script_options::referenced_const_iterator): New type.
6349         (Script_options::referenced_begin): New function.
6350         (Script_options::referenced_end): New function.
6351         (Script_options::is_referenced): New function.
6352         (Script_options::any_unreferenced): New function.
6353         * script-c.h (script_symbol): Declare.
6354         * yyscript.y (exp): Call script_symbol.
6355         * symtab.cc: Include "script.h".
6356         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6357         Change all callers.  Check symbols referenced by scripts.
6358         (Symbol_table::add_undefined_symbols_from_command_line): Add
6359         layout parameter.  Change all callers.
6360         (Symbol_table::do_add_undefined_symbols_from_command_line):
6361         Likewise.  Break out loop body.  Check symbols referenced by
6362         scripts.
6363         (Symbol_table::add_undefined_symbol_from_command_line): New
6364         function broken out of
6365         do_add_undefined_symbols_from_command_line.
6366         * symtab.h (class Symbol_table): Update declarations.
6367         * archive.cc: Include "layout.h".
6368         (Archive::should_include_member): Add layout parameter.  Change
6369         all callers.  Check for symbol mentioned in expression.
6370         * archive.h (class Archive): Update declaration.
6371         * object.cc (Sized_relobj::do_should_include_member): Add layout
6372         parameter.
6373         * object.h (Object::should_include_member): Add layout parameter.
6374         Change all callers.
6375         (Object::do_should_include_member): Add layout parameter.
6376         (class Sized_relobj): Update declaration.
6377         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6378         parameter.
6379         * dynobj.h (class Sized_dynobj): Update declaration.
6380         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6381         layout parameter.
6382         * plugin.h (class Sized_pluginobj): Update declaration.
6383
6384 2010-08-02  Ian Lance Taylor  <iant@google.com>
6385
6386         PR 11866
6387         * output.cc (Output_segment::set_offset): Search for the first and
6388         last sections rather than assuming that the list is in order.
6389         (Output_segment::find_first_and_last_list): New function.
6390         * output.h (class Output_segment): Update declarations.
6391         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6392         (relro_strip_test_SOURCES): New variable.
6393         (relro_strip_test_DEPENDENCIES): New variable.
6394         (relro_strip_test_LDFLAGS): New variable.
6395         (relro_strip_test_LDADD): New variable.
6396         (relro_strip_test.so): New target.
6397
6398 2010-08-02  Ian Lance Taylor  <iant@google.com>
6399
6400         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6401         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6402         (Target_i386::got_tlsdesc_section): New function.
6403         (Target_i386::got_section): Create space for GOT entries for
6404         TLSDESC relocations.
6405         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6406         R_386_TLS_GOTDESC.
6407         (Target_i386::Scan::global): Likewise.
6408         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6409         using TLSDESC GOT.
6410         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6411         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6412         (Target_x86_64::got_tlsdesc_section): New function.
6413         (Target_x86_64::got_section): Create space for GOT entries for
6414         TLSDESC relocations.
6415         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6416         R_386_TLS_GOTDESC.
6417         (Target_x86_64::Scan::global): Likewise.
6418         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6419         using TLSDESC GOT.
6420
6421 2010-08-02  Ian Lance Taylor  <iant@google.com>
6422
6423         * testsuite/final_layout.sh: Use dc to convert from hex to
6424         decimal.
6425
6426 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6427
6428         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6429         paramter to the call to gold::gc_process_relocs.
6430         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6431         paramter to the call to gold::gc_process_relocs.
6432         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6433         parameter to the call to gold::gc_process_relocs.
6434         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6435         template parameter to the call to gold::gc_process_relocs.
6436         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6437         paramter to the call to gold::gc_process_relocs.
6438         * gc.h (get_embedded_addend_size): New function.
6439         (gc_process_relocs): Save the size of the reloc for use by ICF.
6440         * icf.cc (get_section_contents): Get the addend from the text section
6441         for SHT_REL relocation sections.
6442         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6443         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6444         * int_encoding.h (read_from_pointer): New overloaded function.
6445         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6446         * testsuite/icf_sht_rel_addend_test.sh: New file.
6447         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6448         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6449
6450 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6451
6452         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6453         * Makefile.in: Regenerate.
6454         * testsuite/Makefile.in: Regenerate.
6455
6456 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6457
6458         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6459         * gold/testsuite/debug_msg.cc: Likewise.
6460         * gold/testsuite/odr_violation1.cc
6461         * gold/testsuite/odr_violation2.cc
6462
6463 2010-07-21  Cary Coutant  <ccoutant@google.com>
6464
6465         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6466         string, and length fields.
6467         (Output_merge_string::Merged_strings_list): New type.
6468         (Output_merge_string::Merged_strings_lists): New typedef.
6469         (Output_merge_string): Replace merged_strings_ with
6470         merged_strings_lists_.
6471         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6472         Merged_strings_list per input object and section.  Don't store pointer
6473         to the string.  Don't store length with each merged string entry.
6474         (Output_merge_string::finalize_merged_data): Loop over list of merged
6475         strings lists.  Recompute length of each merged string.
6476
6477 2010-07-15  Cary Coutant  <ccoutant@google.com>
6478
6479         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6480         here.
6481
6482 2010-07-14  Ian Lance Taylor  <iant@google.com>
6483
6484         * descriptors.cc (Descriptors::open): Report correct name in error
6485         message.
6486
6487 2010-07-13  Doug Kwan  <dougkwan@google.com>
6488
6489         * arm.cc (Arm_input_section::Arm_input_section): For a
6490         SHT_ARM_EXIDX section, always keeps the input sections.
6491         (Arm_input_section::set_exidx_section_link): New method.
6492         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6493         has_errors_ to false.
6494         (Arm_exidx_input_section::has_errors,
6495         Arm_exidx_input_section::set_has_errors): New methods.
6496         (Arm_exidx_input_section::has_errors_): New data member.
6497         (Arm_relobj::get_exidx_shndx_list): New method.
6498         (Arm_output_section::append_text_sections_to_list): Do not skip
6499         section without SHF_EXECINSTR.
6500         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6501         errors.
6502         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6503         section header.  Make error messages more verbose.  Check for
6504         a non-executable section linked to an EXIDX section.
6505         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6506         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6507         check that there is no deferred EXIDX section if we exit early.
6508         Instead of not making an EXIDX section in case of an error, make one
6509         and set the has_errors flag of it.
6510         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6511         in a relocatable link.
6512         (Target_arm::do_relax): Look for the EXIDX output section instead of
6513         assuming that it is called .ARM.exidx.
6514         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6515         section list.  Do not check for SHF_EXECINSTR section flags but
6516         skip any input section with errors.
6517         * output.cc (Output_section::Output_section): Initialize
6518         always_keeps_input_sections_ to false.
6519         (Output_section::add_input_section): Check for
6520         always_keeps_input_sections_.
6521         *  output.h (Output_section::always_keeps_input_sections,
6522         Output_section::set_always_keeps_input_sections): New methods.
6523         (Output_section::always_keeps_input_sections): New data member.
6524
6525 2010-07-13  Rafael Espindola  <espindola@google.com>
6526
6527         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6528         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6529
6530 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6531             Ian Lance Taylor  <iant@google.com>
6532
6533         * output.h (Output_section_lookup_maps::add_merge_section):
6534         Correct check of whether value was inserted.
6535         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6536         (Output_section_lookup_maps::add_relaxed_input_section):
6537         Likewise.
6538         * arm.cc (Target_arm::got_section): Remove used local os.
6539         * i386.cc (Target_i386::got_section): Likewise.
6540         * x86_64.cc (Target_x86_64::got_section): Likewise.
6541         * sparc.cc (Target_sparc::got_section): Likewise.
6542         (Target_sparc::relocate): Remove unused local have_got_offset.
6543         * powerpc.cc (Target_powerpc::relocate): Likewise.
6544
6545 2010-07-13  Ian Lance Taylor  <iant@google.com>
6546
6547         * compressed_output.cc (zlib_decompress): Fix signature in
6548         !HAVE_ZLIB_H case.
6549
6550         * archive.cc (Archive::include_member): Unlock an external member
6551         of a thin archive.  Don't bother to delete an object we know is
6552         NULL.
6553
6554 2010-07-12  Cary Coutant  <ccoutant@google.com>
6555
6556         * compressed_output.cc (zlib_decompress): New function.
6557         (get_uncompressed_size): New function.
6558         (decompress_input_section): New function.
6559         * compressed_output.h (get_uncompressed_size): New function.
6560         (decompress_input_section): New function.
6561         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6562         Handle compressed debug sections.
6563         * layout.cc (is_compressed_debug_section): New function.
6564         (Layout::output_section_name): Map compressed section names to
6565         canonical names.
6566         * layout.h (is_compressed_debug_section): New function.
6567         (is_debug_info_section): Recognize compressed debug sections.
6568         * merge.cc: Include compressed_output.h.
6569         (Output_merge_data::do_add_input_section): Handle compressed
6570         debug sections.
6571         (Output_merge_string::do_add_input_section): Handle compressed
6572         debug sections.
6573         * object.cc: Include compressed_output.h.
6574         (Sized_relobj::Sized_relobj): Initialize new data members.
6575         (build_compressed_section_map): New function.
6576         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6577         * object.h (Object::section_is_compressed): New method.
6578         (Object::do_section_is_compressed): New method.
6579         (Sized_relobj::Compressed_section_map): New type.
6580         (Sized_relobj::do_section_is_compressed): New method.
6581         (Sized_relobj::compressed_sections_): New data member.
6582         * output.cc (Output_section::add_input_section): Handle compressed
6583         debug sections.
6584         * reloc.cc: Include compressed_output.h.
6585         (Sized_relobj::write_sections): Handle compressed debug sections.
6586
6587 2010-07-08  Cary Coutant  <ccoutant@google.com>
6588
6589         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6590         weak when resolving to a dynamic def.
6591         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6592         for weak undef/dynamic def cases. Adjust callers.
6593         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6594         undef_binding_weak_.
6595         (Symbol_table::sized_write_globals): Adjust symbol binding.
6596         (Symbol_table::sized_write_symbol): Add binding parameter.
6597         * symtab.h (Symbol::set_undef_binding): New method.
6598         (Symbol::is_undef_binding_weak): New method.
6599         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6600         (Symbol_table::should_override): Add new parameter.
6601         (Symbol_table::sized_write_symbol): Add new parameter.
6602
6603         * testsuite/weak_undef_file1.cc: Add new test case.
6604         * testsuite/weak_undef_file2.cc: Fix header comment.
6605         * testsuite/weak_undef_test.cc: Add new test case.
6606
6607 2010-06-29  Doug Kwan  <dougkwan@google.com>
6608
6609         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6610         Initialize USE_SYMBOL_.
6611         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6612         definition.
6613         (Arm_reloc_property::uses_symbol_): New data member declaration.
6614         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6615         uses symbol value and symbol is undefined but not weakly undefined.
6616
6617 2010-06-28  Rafael Espindola  <espindola@google.com>
6618
6619         * plugin.cc (Plugin::load): Use dlerror.
6620
6621 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6622
6623         * symtab.cc (detect_odr_violations): When reporting an ODR
6624         violation, report an object where the symbol is defined.
6625
6626 2010-06-25  Doug Kwan  <dougkwan@google.com>
6627
6628         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6629         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6630         definition.
6631         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6632         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6633         target hook to detect function points.
6634         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6635         * icf.h (Icf::check_section_for_function_pointers): Change type of
6636         parameter SECTION_NAME to const reference to std::string.  Use
6637         target hook to determine if section may have unsafe pointers.
6638         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6639         method definition.
6640
6641 2010-06-21  Rafael Espindola  <espindola@google.com>
6642
6643         * fileread.cc (Input_file::find_fie): New
6644         (Input_file::open): Use Input_file::find_fie.
6645         * fileread.h (Input_file::find_fie): New
6646         * plugin.cc (set_extra_library_path): New.
6647         (Plugin::load): Add set_extra_library_path to the transfer vector.
6648         (Plugin_manager::set_extra_library_path): New.
6649         (Plugin_manager::add_input_file): Use the extra search path if set.
6650         (set_extra_library_path(): New.
6651         * plugin.h (Plugin_manager): Add set_extra_library_path and
6652         extra_search_path_.
6653
6654 2010-06-19  Cary Coutant  <ccoutant@google.com>
6655
6656         * layout.cc (gdb_sections): Add .debug_types.
6657         (lines_only_debug_sections): Likewise.
6658
6659 2010-06-18  Rafael Espindola  <espindola@google.com>
6660
6661         * plugin.cc (add_input_file,add_input_library)
6662         (Plugin_manager::add_input_file): Make filename arguments const.
6663         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6664         const.
6665
6666 2010-06-16  Doug Kwan  <dougkwan@google.com>
6667
6668         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6669         .ARM.attributes section if we have not merged any input
6670         attributes sections.
6671
6672 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6673
6674         * arm.cc: Allow combining objects with no EABI version
6675         information.
6676
6677 2010-06-15  Rafael Espindola  <espindola@google.com>
6678
6679         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6680
6681 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6682
6683         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6684         (struct iovec): Correct !HAVE_READV definition.
6685
6686 2010-06-10  Cary Coutant  <ccoutant@google.com>
6687
6688         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6689         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6690         reloc sections.
6691         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6692
6693         PR 11683
6694         * symtab.h (Symbol::is_placeholder): New member function.
6695         * target-reloc.h (relocate_section): Check for placeholder symbols.
6696
6697         * testsuite/Makefile.am (plugin_test_8): New test.
6698         (plugin_test_9): New test.
6699         * testsuite/Makefile.in: Regenerate.
6700
6701 2010-06-09  Nick Clifton  <nickc@redhat.com>
6702
6703         * yyscript.y (input_list_element): Allow strings prefixed with
6704         the '-' character.  Treat these as libraries.
6705         * script.cc (script_add_library): New function.  Adds a library
6706         specified by "-l<name>" found in an input script.
6707         * script-c.h: Add prototype for script_add_library.
6708
6709 2010-06-07  Doug Kwan  <dougkwan@google.com>
6710
6711         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6712         Restrict stub-group size to be within long conditional branch
6713         range when working around cortex-A8 erratum.
6714
6715 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6716
6717         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6718         #ifdef typo.
6719
6720 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6721
6722         PR gold/11658
6723         * output.cc
6724         (Output_section::Input_section_sort_entry::compare_section_ordering):
6725         Change to return non-zero correctly.
6726         (Output_section::Input_section_sort_section_order_index_compare
6727         ::operator()): Change to fix ambiguity in comparisons.
6728
6729 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6730
6731         * gold.h (is_wildcard_string): New function.
6732         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6733         (Layout::layout_eh_frame): Ditto.
6734         (Layout::find_section_order_index): New method.
6735         (Layout::read_layout_from_file): New method.
6736         * layout.h (Layout::find_section_order_index): New method.
6737         (Layout::read_layout_from_file): New method.
6738         (Layout::input_section_position_): New private member.
6739         (Layout::input_section_glob_): New private member.
6740         * main.cc (main): Call read_layout_from_file here.
6741         * options.h (--section-ordering-file): New option.
6742         * output.cc (Output_section::input_section_order_specified_): New
6743         member.
6744         (Output_section::Output_section): Initialize new member.
6745         (Output_section::add_input_section): Add new parameter.
6746         Keep input sections when --section-ordering-file is used.
6747         (Output_section::set_final_data_size): Sort input sections when
6748         section ordering file is specified.
6749         (Output_section::Input_section_sort_entry): Add new parameter.
6750         Check sorting type.
6751         (Output_section::Input_section_sort_entry::compare_section_ordering):
6752         New method.
6753         (Output_section::Input_section_sort_compare::operator()): Change to
6754         consider section_order_index.
6755         (Output_section::Input_section_sort_init_fini_compare::operator()):
6756         Change to consider section_order_index.
6757         (Output_section::Input_section_sort_section_order_index_compare
6758         ::operator()): New method.
6759         (Output_section::sort_attached_input_sections): Change to sort
6760         according to section order when specified.
6761         (Output_section::add_input_section<32, true>): Add new parameter.
6762         (Output_section::add_input_section<64, true>): Add new parameter.
6763         (Output_section::add_input_section<32, false>): Add new parameter.
6764         (Output_section::add_input_section<64, false>): Add new parameter.
6765         * output.h (Output_section::add_input_section): Add new parameter.
6766         (Output_section::input_section_order_specified): New
6767         method.
6768         (Output_section::set_input_section_order_specified): New method.
6769         (Input_section::Input_section): Initialize section_order_index_.
6770         (Input_section::section_order_index): New method.
6771         (Input_section::set_section_order_index): New method.
6772         (Input_section::section_order_index_): New member.
6773         (Input_section::Input_section_sort_section_order_index_compare): New
6774         struct.
6775         (Output_section::input_section_order_specified_): New member.
6776         * script-sections.cc (is_wildcard_string): Delete and move modified
6777         method to gold.h.
6778         (Output_section_element_input::Output_section_element_input): Modify
6779         call to is_wildcard_string.
6780         (Output_section_element_input::Input_section_pattern
6781         ::Input_section_pattern): Ditto.
6782         (Output_section_element_input::Output_section_element_input): Ditto.
6783         * testsuite/Makefile.am (final_layout): New test case.
6784         * testsuite/Makefile.in: Regenerate.
6785         * testsuite/final_layout.cc: New file.
6786         * testsuite/final_layout.sh: New file.
6787
6788 2010-06-01  Rafael Espindola  <espindola@google.com>
6789
6790         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6791
6792 2010-06-01  Rafael Espindola  <espindola@google.com>
6793
6794         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6795         visibility of symbols.
6796
6797 2010-05-27  Doug Kwan  <dougkwan@google.com>
6798
6799         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6800         from start of output section instead of address for a local symbol
6801         in a merged or relaxed section when doing a relocatable link.
6802
6803 2010-05-26  Rafael Espindola  <espindola@google.com>
6804
6805         PR 11604
6806         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6807         adding sections the garbage collector removed.
6808         * gold/testsuite/Makefile.am: Add test.
6809         * gold/testsuite/Makefile.in: Regenerate.
6810         * gold/testsuite/plugin_test_7.sh: New.
6811         * gold/testsuite/plugin_test_7_1.c: New.
6812         * gold/testsuite/plugin_test_7_2.c: New.
6813
6814 2010-05-26  Rafael Espindola  <espindola@google.com>
6815
6816         * script-sections.cc (Output_section_definition::set_section_addresses):
6817         Check for --section-start.
6818
6819 2010-05-26  Doug Kwan  <dougkwan@google.com>
6820
6821         * arm.cc (Arm_scan_relocatable_relocs): New class.
6822         (Target_arm::relocate_special_relocatable): New method.
6823         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6824         (Arm_relocate_functions::thumb_branch_common): Same.
6825         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6826         instead of Default_scan_relocatable_relocs.
6827         * target-reloc.h (relocate_for_relocatable): Let target handle
6828         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6829         * target.h (Sized_target::relocate_special_relocatable): New method.
6830
6831 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6832
6833         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6834
6835 2010-05-23  Doug Kwan  <dougkwan@google.com>
6836
6837         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6838         instead of a cast.
6839         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6840         with a direct branch, not a conditional branch, to a stub.
6841         * merge.cc (Output_merge_base::record_input_section): New method
6842         defintion.
6843         (Output_merge_data::do_add_input_section): Record input section if
6844         keeps-input-sections flag is set.
6845         (Output_merge_string::do_add_input_section): Ditto.
6846         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6847         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6848         INPUT_SECTIONS_.
6849         (Output_merge_base::keeps_input_sections,
6850         Output_merge_base::set_keeps_input_sections,
6851         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6852         method definitions.
6853         (Output_merge_base::Input_sections): New type declaration.
6854         (Output_merge_base::input_sections_begin,
6855         Output_merge_base::input_sections_end,
6856         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6857         (Output_merge_base::bool keeps_input_sections_,
6858         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6859         Output_merge_base::input_sections_): New data members.
6860         (Output_merge_data::do_set_keeps_input_sections): New method
6861         defintion.
6862         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6863         * output.cc (Output_section::Input_section::relobj): Move method
6864         defintion from class declaration to here and handle merge sections.
6865         (Output_section::Input_section::shndx): Ditto.
6866         (Output_section::Output_section): Remove initializations of removed
6867         data members and initialize new data member LOOKUP_MAPS_.
6868         (Output_section::add_input_section): Set keeps-input-sections flag
6869         for a newly created merge output section as appropriate.  Adjust code
6870         to use Output_section_lookup_maps class.
6871         (Output_section::add_relaxed_input_section): Adjst code for lookup
6872         maps code refactoring.
6873         (Output_section::add_merge_input_section): Add a new parameter
6874         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6875         class.  If adding input section to a newly created merge output
6876         section fails, remove the new merge section.
6877         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6878         Adjust code for use of the Output_section_lookup_maps class.
6879         (Output_section::find_merge_section): Ditto.
6880         (Output_section::build_lookup_maps): New method defintion.
6881         (Output_section::find_relaxed_input_section): Adjust code to use
6882         Output_section_lookup_maps class.
6883         (Output_section::get_input_sections): Export merge sections.  Adjust
6884         code to use Output_section_lookup_maps class.
6885         (Output_section:::add_script_input_section): Adjust code to use
6886         Output_section_lookup_maps class.  Update lookup maps for merge
6887         sections also.
6888         (Output_section::discard_states): Use Output_section_lookup_maps.
6889         (Output_section::restore_states): Same.
6890         * output.h (Merge_section_properties): Move class defintion out of
6891         Output_section.
6892         (Output_section_lookup_maps): New class.
6893         (Output_section::Input_section::is_merge_section): New method
6894         defintion.
6895         (Output_section::Input_section::relobj): Move defintion out of class
6896         defintion.  Declare method only.
6897         (Output_section::Input_section::shndx): Ditto.
6898         (Output_section::Input_section::output_merge_base): New method defintion.
6899         (Output_section::Input_section::u2_.pomb): New union field.
6900         (Output_section::Merge_section_by_properties_map,
6901         Output_section::Output_section_data_by_input_section_map,
6902         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6903         Remove types.
6904         (Output_section::add_merge_input_section): Add new parameter
6905         KEEPS_INPUT_SECTIONS.
6906         (Output_section::build_lookup_maps): New method declaration.
6907         (Output_section::merge_section_map_,
6908         Output_section::merge_section_by_properties_map_,
6909         Output_section::relaxed_input_section_map_,
6910         Output_section::is_relaxed_input_section_map_valid_): Remove data
6911         members.
6912         (Output_section::lookup_maps_): New data member.
6913
6914 2010-05-21  Doug Kwan  <dougkwan@google.com>
6915
6916         PR gold/11619
6917         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6918         avoid a compilation error.
6919
6920 2010-05-19  Rafael Espindola  <espindola@google.com>
6921
6922         * script-sections.cc (Output_section_definition::allocate_to_segment):
6923         Update the phdrs_list even when the output section is NULL.
6924         * testsuite/Makefile.am: Add test.
6925         * testsuite/Makefile.in: Regenerate.
6926         * testsuite/script_test_9.cc: New.
6927         * testsuite/script_test_9.sh: New.
6928         * testsuite/script_test_9.t: New.
6929
6930 2010-05-19  Doug Kwan  <dougkwan@google.com>
6931
6932         * arm.cc (Arm_input_section::original_size): New method.
6933         (Arm_input_section::do_addralign): Add a cast.
6934         (Arm_input_section::do_output_offset): Remove static cast.
6935         (Arm_input_section::original_addralign,
6936          Arm_input_section::original_size_): Change type to uint32_t.
6937         (Arm_input_section::init): Add safe casts for section alignment
6938         and size.
6939         (Arm_input_section::set_final_data_size): Do not set address and
6940         offset of stub table.
6941         (Arm_output_section::fix_exidx_coverage): Change use of of
6942         Output_section::Simple_input_section to that of
6943         Output_section::Input_section.
6944         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6945         except for the first pass.
6946         * output.cc (Output_section::get_input_sections): Change type of
6947         input_sections to std::list<Input_section>.
6948         (Output_section::add_script_input_section): Rename from
6949         Output_section::add_simple_input_section.  Change type of SIS
6950         parameter from Simple_input_section to Input_section.
6951         * output.h (Output_section::Simple_input_section): Remove class.
6952         (Output_section::Input_section): Change class visibility to public.
6953         (Output_section::Input_section::addralign): Use stored alignments
6954         for special input sections if set.
6955         (Output_section::Input_section::set_addralign): New method.
6956         (Output_section::get_input_sections): Change parameter type from
6957         list of Simple_input_section to list of Input_section.
6958         (Output_section::add_script_input_section): Rename from
6959         Output_section::add_simple_input_section. Change first parameter's
6960         type from Simple_input_section to Input_section and remove the
6961         second and third parameters.
6962         * script-sections.cc (Input_section::Input_section_list): Change
6963         type to list of Output_section::Input_section/
6964         (Input_section_info::Input_section_info): Change parameter type of
6965         INPUT_SECTION to Output_section::Input_section.
6966         (Input_section_info::input_section): Change return type.
6967         (Input_section_info::input_section_): Change type to
6968         Output_section::Input_section.
6969         (Output_section_element_input::set_section_addresses): Adjust code
6970         to use Output_section::Input_section instead of
6971         Output_section::Simple_input_section.  Adjust code for renaming
6972         of Output_section::add_simple_input_section.
6973         (Orphan_output_section::set_section_addresses): Ditto.
6974
6975 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6976
6977         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6978         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6979
6980 2010-05-18  Rafael Espindola  <espindola@google.com>
6981
6982         * options.cc (General_options::finalize): Handle -nostdlib.
6983         * options.h (nostdlib): New option.
6984         * script.cc (script_add_search_dir): Handle -nostdlib.
6985
6986 2010-05-12  Doug Kwan  <dougkwan@google.com>
6987
6988         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6989         attributes section only if there no attributes section after merging.
6990         (Target_arm::merge_object_attributes): Move value of
6991         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6992         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6993         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6994         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6995         and arm_attr_merge_7.stdout.
6996         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6997         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6998         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6999         arm_attr_merge_7b.o): New rules.
7000         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7001         arm_attr_merge_7
7002         * testsuite/Makefile.in: Regenerate.
7003         * testsuite/arm_attr_merge.sh: New file.
7004         * testsuite/arm_attr_merge_[67][ab].s: Same.
7005
7006 2010-05-05  Nick Clifton  <nickc@redhat.com>
7007
7008         * po/es.po: Updated Spanish translation.
7009
7010 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7011
7012         * Makefile.am (install-exec-local): Properly install gold as
7013         default cross linker.
7014         * Makefile.in: Regenerated.
7015
7016 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7017             Nick Clifton  <nickc@redhat.com>
7018
7019         * configure.ac (install_as_default): Define and set to false
7020         unless --enable-gold or --enable-gold=both/gold has been
7021         specified.
7022         * configure: Regenerate.
7023
7024         * Makefile.am (install-exec-local): Install the executable as
7025         'ld.gold'.  If install_as_default is true then also install it as
7026         'ld'.
7027         * Makefile.in: Regenerated.
7028
7029 2010-04-24  Ian Lance Taylor  <iant@google.com>
7030
7031         * layout.cc (Layout::layout_reloc): In relocatable link don't
7032         combine reloc sections for grouped sections.
7033
7034 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7035
7036         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7037         sections that are not ordinary to icf.
7038         * icf.cc (get_section_contents): Handle relocation pointing to section
7039         with no object or shndx information.
7040         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7041         * testsuite/Makefile.in: Regenerate.
7042         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7043         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7044
7045 2010-04-22  Ian Lance Taylor  <iant@google.com>
7046
7047         * expression.cc (Expression::Expression_eval_info): Add
7048         result_alignment_pointer field.
7049         (Expression::eval_with_dot): Add result_alignment_pointer
7050         parameter.  Change all callers.
7051         (Expression::eval_maybe_dot): Likewise.
7052         (class Binary_expression): Add alignment_pointer parameter to
7053         left_value and right_value.  Change all callers.
7054         (BINARY_EXPRESSION): Set result alignment.
7055         (class Trinary_expression): Add alignment_pointer parameter to
7056         arg2_value and arg3_value.  Change all callers.
7057         (Trinary_cond::value): Set result alignment.
7058         (Max_expression::value, Min_expression::value): Likewise.
7059         (Align_expression::value): Likewise.
7060         * script-sections.cc (class Sections_element): Add dot_alignment
7061         parameter to set_section_addresses virtual function.  Update
7062         instantiations.
7063         (class Output_section_element): Likewise.
7064         (Script_sections::create_segments): Add dot_alignment parameter.
7065         Change all callers.
7066         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7067         (Script_sections::set_phdrs_clause_addresses): Likewise.
7068         * script-sections.h: Update declarations.
7069         * script.h: Update declarations.
7070         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7071         min_p_align.
7072         * testsuite/script_test_3.t: Set large alignment.
7073         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7074         segment has expected alignment.
7075
7076 2010-04-22  Nick Clifton  <nickc@redhat.com>
7077
7078         * po/gold.pot: Updated by the Translation project.
7079         * po/vi.po: Updated Vietnamese translation.
7080
7081 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7082
7083         * testsuite/Makefile.am (check_PROGRAMS): Add
7084         icf_virtual_function_folding_test.
7085         * testsuite/Makefile.in: Regenerated.
7086
7087 2010-04-15  Andrew Haley  <aph@redhat.com>
7088
7089         * options.h (merge_exidx_entries): New option.
7090         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7091         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7092         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7093         (Target_arm::merge_exidx_entries): New function.
7094         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7095         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7096         to Arm_exidx_fixup constructor.
7097         Add new arg, merge_exidx_entries.
7098         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7099         Arm_output_section::fix_exidx_coverage.
7100
7101 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7102
7103         * icf.cc (get_section_contents): Check for preemptible functions.
7104         Ignore addend when appropriate.
7105         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7106         section folded.
7107         (add_from_relobj): Check for section folded.
7108         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7109         * symtab.h (should_add_dynsym_entry): Add new parameter.
7110         * target-reloc.h (scan_relocs): Check for section folded.
7111         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7112         Check reloc types for function pointers in shared objects.
7113         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7114         case.
7115         (icf_preemptible_functions_test): New test case.
7116         (icf_string_merge_test): New test case.
7117         * testsuite.Makefile.in: Regenerate.
7118         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7119         bar_glob.  Refactor code.
7120         * testsuite/icf_preemptible_functions_test.cc: New file.
7121         * testsuite/icf_preemptible_functions_test.sh: New file.
7122         * testsuite/icf_string_merge_test.cc: New file.
7123         * testsuite/icf_string_merge_test.sh: New file.
7124         * testsuite/icf_virtual_function_folding_test.cc: New file.
7125         * testsuite/icf_virtual_function_folding_test.sh: New file.
7126
7127 2010-04-14  Doug Kwan  <dougkwan@google.com>
7128
7129         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7130         for local symbol recounting if we remove a section due to ICF.
7131         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7132         there are no regular objects in input.
7133
7134 2010-04-13  Doug Kwan  <dougkwan@google.com>
7135
7136         * arm.cc (Arm_input_section::set_final_data_size): Compute
7137         accurate final data size instead of using current data size.
7138
7139 2010-04-09  Doug Kwan  <dougkwan@google.com>
7140
7141         * layout.cc (Layout::choose_output_section): Handle script section
7142         types.
7143         (Layout::make_output_section_for_script): Add section type parameter.
7144         Handle script section types.
7145         * layout.h (Layout::make_output_section_for_script): Add section
7146         type parameter.
7147         * output.cc (Output_section::Output_section): Initialize data member
7148         is_noload_.
7149         (Output_section::do_reset_address_and_file_offset): Do not set address
7150         to 0 if section is a NOLOAD section.
7151         * output.h (Output_section::is_noload): New method.
7152         (Output_section::set_is_noload): Ditto.
7153         (Output_section::is_noload_): New data member.
7154         * script-c.h (Script_section_type): New enum type.
7155         (struct Parser_output_section_header): Add new file section_type.
7156         * script-sections.cc (Sections_element::output_section_name): Add
7157         parameter for returning script section type.
7158         (Output_section_definition::output_section_name): Ditto.
7159         (Output_section_definition::section_type)P; New method.
7160         (Output_section_definiton::script_section_type_name): Ditto.
7161         (Output_section_definition::script_section_type_): New data member.
7162         (Output_section_definition::Output_section_definition): Initialize
7163         data member Output_section_definition::script_section_type_.
7164         (Output_section_definition::create_sections): Pass script section type
7165         to Layout::make_output_section_for_script.
7166         (Output_section_definition::output_section_name): Return script
7167         section type to caller.
7168         (Output_section_definition::set_section_address): Do not advance
7169         dot value and load address if section type is NOLOAD.  Set address
7170         of NOLOAD sections regardless of section flags.
7171         (Output_section_definition::print): Print section type if it is
7172         not SCRIPT_SECTION_TYPE_NONE.
7173         (Output_section_definition::section_type): New method.
7174         (Output_section_definition::script_section_type_name): Ditto.
7175         (Script_sections::output_section_name): Add new parameter
7176         PSECTION_TYPE for returning script section type.  Pass it to
7177         section elements.  Handle discard sections.
7178         (Sort_output_sections::operator()): Handle NOLOAD sections.
7179         * script-sections.h (Script_sections::Section_type): New enum type.
7180         (Script_sections::output_section_name): Add a new parameter for
7181         returning script section type.
7182         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7183         INFO and NOLOAD.
7184         * yyscript.y (union): Add new field SECTION_TYPE.
7185         (COPY, DSECT, INFO, NOLOAD): New tokens.
7186         (opt_address_and_section_type): Change type to output_section_header.
7187         (section_type): New non-terminal
7188         (section_header): Handle section type.
7189         (opt_address_and_section_type): Return section type value.
7190
7191 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7192
7193         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7194         * testsuite/plugin_common_test_2.c (foo): Likewise.
7195
7196 2010-04-08  Doug Kwan  <dougkwan@google.com>
7197
7198         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7199         Output_merge_data.
7200         * output.cc (Output_section::add_merge_input_section): Simplify
7201         code and return status of Output_merge_base::add_input_section.
7202         Update merge section map only if Output_merge_base::add_input_section
7203         returns true.
7204
7205 2010-04-07  Doug Kwan  <dougkwan@google.com>
7206
7207         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7208         if section is marked as containing instructions but has no mapping
7209         symbols.
7210         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7211         correct section index.
7212         (Arm_relobj::find_linked_text_section): Ditto.
7213
7214 2010-04-07  Cary Coutant  <ccoutant@google.com>
7215
7216         * archive.cc (include_member): Destroy Read_symbols_data object before
7217         releasing file.
7218         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7219         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7220         (Read_symbols_data::~Read_symbols_data) New destructor.
7221         (Section_relocs::Section_relocs) New constructor.
7222         (Section_relocs::~Section_relocs) New destructor.
7223         (Read_relocs_data::Read_relocs_data) New constructor.
7224         (Read_relocs_data::~Read_relocs_data) New destructor.
7225         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7226         pointers to NULL after deleting.
7227
7228 2010-04-07  Doug Kwan  <dougkwan@google.com>
7229
7230         * arm.cc: Replace "endianity" with "endianness" in comments.
7231         (Arm_exidx_cantunwind): Ditto.
7232         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7233         (Arm_relobj::merge_flags_and_attributes): New method.
7234         (Arm_relobj::merge_flags_and_attributes_): New data member.
7235         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7236         (Arm_relobj::scan_sections_for_stubs): Ditto.
7237         (Arm_relobj::do_read_symbols): Check to see if we really want to
7238         merge processor-specific flags and attributes.  Exit early if
7239         an object is empty except for section names and the undefined symbol.
7240         (Target_arm::do_finalize_sections): Move check for ELF format to
7241         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7242         attributes from a regular object only when we have determined that
7243         it is aapropriate.  Do not create an .ARM.attributes section in
7244         output if there is no regular input object.
7245         (Target_arm::merge_processor_specific_flags): Check
7246         --warn-mismatch before printing any error.
7247         (Target_arm::merge_object_attributes): Ditto.
7248         * gold.cc (queue_middle_tasks): Handle the case in which there is
7249         no regular object in input.
7250         * options.cc (General_options::parse_EB): New method.
7251         (General_options::parse_EL): Same.
7252         (General_options::General_options): Initialize endianness_.
7253         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7254         New options.
7255         (General_options::Endianness): New enum.
7256         (General_options::endianness): New method.
7257         (General_options::endianness_): New data member.
7258         * parameters.cc (Parameters::set_options): Check target endianness.
7259         (Parameters::set_target_once): Ditto.
7260         (Parameters::check_target_endianness): New method.
7261         (parameters_force_valid_target): If either -EL or -EB is specified,
7262         use it to define endianness of default target.
7263         * parameters.h (Parameters::check_target_endianness): New method
7264         declaration.
7265         * target.h (class Target): Change "endianity" to "endianness"
7266         in comments.
7267
7268 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7269
7270         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7271         * configure: Regenerate.
7272         * Makefile.in: Regenerate.
7273         * testsuite/Makefile.in: Regenerate.
7274
7275 2010-04-06  Cary Coutant  <ccoutant@google.com>
7276
7277         gcc PR lto/42757
7278         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7279         prevailing definitions of common symbols.
7280         * testsuite/plugin_test_6.sh: New test case.
7281         * testsuite/plugin_common_test_1.c: New test case.
7282         * testsuite/plugin_common_test_2.c: New test case.
7283         * testsuite/Makefile.am (plugin_test_6): New test case.
7284         * testsuite/Makefile.in: Regenerate.
7285
7286 2010-04-06  Nick Clifton  <nickc@redhat.com>
7287
7288         * po/vi.po: New Vietnamese translation.
7289
7290 2010-03-30  Doug Kwan  <dougkwan@google.com>
7291
7292         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7293
7294 2010-03-25  Doug Kwan  <dougkwan@google.com>
7295
7296         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7297         to avoid a conversion warning on a 32-bit host.
7298
7299 2010-03-24  Ian Lance Taylor  <iant@google.com>
7300
7301         * testsuite/script_test_3.t: Add a TLS segment.
7302         * testsuite/Makefile.am (check_PROGRAMS): Add
7303         tls_phdrs_script_test.
7304         (tls_phdrs_script_test_SOURCES): Define.
7305         (tls_phdrs_script_test_DEPENDENCIES): Define.
7306         (tls_phdrs_script_test_LDFLAGS): Define.
7307         (tls_phdrs_script_test_LDADD): Define.
7308         * testsuite/Makefile.in: Rebuild.
7309
7310 2010-03-23  Cary Coutant  <ccoutant@google.com>
7311
7312         * fileread.cc (find_or_make_view): Fix comment.
7313
7314 2010-03-23  Ian Lance Taylor  <iant@google.com>
7315
7316         * script-sections.cc (class Orphan_section_placement): Define
7317         PLACE_TLS and PLACE_TLS_BSS.
7318         (Orphan_section_placement::Orphan_section_placement): Initialize
7319         new places.
7320         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7321         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7322         (tls_script_test_SOURCES): Define.
7323         (tls_script_test_DEPENDENCIES): Define.
7324         (tls_script_test_LDFLAGS): Define.
7325         (tls_script_test_LDADD): Define.
7326         * testsuite/Makefile.in: Rebuild.
7327
7328 2010-03-22  Doug Kwan  <dougkwan@google.com>
7329
7330         * arm.cc (Arm_relocate_functions::abs8,
7331         Arm_relocate_functions::abs16): Use correct check for overflow
7332         specified in the ARM ELF specs.
7333         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7334         target of a BLX instruction specially.
7335         (Reloc_stub::stub_type_for_reloc): Ditto.
7336         (Relocate::relocate): Use symbolic names instead of numeric relocation
7337         codes to report error.
7338         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7339         workaround.
7340         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7341         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7342         thumb2_blx_out_of_range.stdout
7343         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7344         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7345         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7346         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7347         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7348         thumb2_blx_in_range, thumb2_blx_in_range.o,
7349         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7350         thumb2_blx_out_of_range.o): New rules.
7351         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7352         thumb2_blx_in_range and thumb2_blx_out_of_range.
7353         * testsuite/Makefile.in: Regenerate.
7354         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7355         * testsuite/thumb_blx_in_range.s: New file.
7356         * testsuite/thumb_blx_out_of_range.s: New file.
7357
7358 2010-03-22  Rafael Espindola  <espindola@google.com>
7359
7360         * archive.cc (Should_include): Move to archive.h.
7361         (should_include_member): Make it a member of Archive.
7362         (Lib_group): New.
7363         (Add_lib_group_symbols): New.
7364         * archive.h: Include options.h.
7365         (Archive_member): Moved from Archive.
7366         (Should_include): Moved from archive.cc.
7367         (Lib_group): New.
7368         (Add_lib_group_symbols): New.
7369         * dynobj.cc (do_should_include_member): New.
7370         * dynobj.h (do_should_include_member): New.
7371         * gold.cc (queue_initial_tasks): Update call to queue.
7372         * main.cc (main): Print lib group stats.
7373         * object.cc (do_should_include_member): New.
7374         * object.h: Include archive.h.
7375         (Object::should_include_member): New.
7376         (Object::do_should_include_member): New.
7377         (Sized_relobj::do_should_include_member): New.
7378         * options.cc (General_options::parse_start_lib): New.
7379         (General_options::parse_end_lib): New.
7380         (Input_arguments::add_file): Handle lib groups.
7381         (Input_arguments::start_group): Check we are not in a lib.
7382         (Input_arguments::start_lib): New.
7383         (Input_arguments::end_lib): New.
7384         * options.h (General_options): Add start_lib and end_lib.
7385         (Input_argument::lib_): New.
7386         (Input_argument::lib): New.
7387         (Input_argument::is_lib): New.
7388         (Input_file_lib): New.
7389         (Input_arguments::in_lib_): New.
7390         (Input_arguments::in_lib): New.
7391         (Input_arguments::start_lib): New.
7392         (Input_arguments::end_lib_): New.
7393         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7394         in unused members as preempted.
7395         (Sized_pluginobj::do_should_include_member): New.
7396         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7397         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7398         return the blocker.
7399         (Read_symbols::do_whole_lib_group): New.
7400         (Read_symbols::do_lib_group): New.
7401         (Read_symbols::do_read_symbols): Handle lib groups.
7402         (Read_symbols::get_name): Handle lib groups.
7403         * readsyms.h (Read_symbols): Add an archive member pointer.
7404         (Read_symbols::do_whole_lib_group): New.
7405         (Read_symbols::do_lib_group): New.
7406         (Read_symbols::member_): New.
7407         * script.cc (read_input_script): Update call to queue_soon.
7408
7409 2010-03-19  Doug Kwan  <dougkwan@google.com>
7410
7411         * arm.cc (Stub_table::Stub_table): Initialize new data members
7412         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7413         (Stub_table::add_reloc_stub): Assign stub offset and update
7414         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7415         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7416         New data members.
7417         (Stub_table::update_data_size_and_addralign): Use
7418         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7419         instead of going over all reloc stubs.
7420         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7421         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7422         Stringpool_template::offset_ to size of Stringpool_char.
7423         (Stringpool_template::new_key_offset): Remove code to initialize
7424         Stringpool_template::offset_.
7425         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7426         Stringpool_template::offset_ to zero.
7427
7428 2010-03-15  Doug Kwan  <dougkwan@google.com>
7429
7430         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7431         offset_.
7432         (Stringpool_template::new_key_offset): New method.
7433         (Stringpool_template::add_string): Assign offsets when adding new
7434         strings.
7435         (Stringpool_template::set_string_offsets): Do not set string offsets
7436         when not optimizing.
7437         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7438         member size_.
7439         (Chunked_vector::clear): Clear size_.
7440         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7441         (Chunked_vector::size): Return size_.
7442         (Chunked_vector::push_back): Use size_ to find insert position.
7443         (Chunked_vector::size_): New data member.
7444         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7445         (Stringpool_template::new_key_offset): New method declaration.
7446         (Stringpool_template::offset_): New data member.
7447
7448 2010-03-15   Rafael Espindola  <espindola@google.com>
7449
7450         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7451         Add_symbols' constructor.
7452         * readsyms.h (Add_symbols): Remove the input_group member.
7453
7454 2010-03-10  Ian Lance Taylor  <iant@google.com>
7455
7456         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7457         target to ask whether a reference to a symbol requires a stack
7458         split.
7459         * target.h (Target::is_call_to_non_split): New function.
7460         (Target::do_is_call_to_non_split): Declare virtual function.
7461         * target.cc: Include "symtab.h".
7462         (Target::do_is_call_to_non_split): New function.
7463         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7464
7465 2010-03-10  Cary Coutant  <ccoutant@google.com>
7466
7467         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7468         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7469         (File_read::open[2]): Add whole_file_view_ to list of views.
7470         (File_read::make_view): Remove test of whole_file_view_.
7471         (File_read::find_or_make_view): Create whole_file_view_ if
7472         necessary.
7473         (File_read::clear_views): Replace bool parameter with enum;
7474         adjust all callers.  Don't delete views with permanent data;
7475         do delete cached views and views from archives if
7476         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7477         if clearing the corresponding view.
7478         * fileread.h (File_read::Clear_views_mode): New enum.
7479         (File_read::View::is_permanent_view): New method.
7480         (File_read::clear_views): Replace bool parameter
7481         with enum; adjust all callers.
7482         * options.h (General_options): Change keep_files_mapped option;
7483         add map_whole_files.
7484         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7485         releasing the file.
7486         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7487         the file.
7488
7489 2010-03-10  David S. Miller  <davem@davemloft.net>
7490
7491         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7492
7493 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7494
7495         * icf.cc (get_section_contents): Add '@' marker after processing the
7496         merge reloc.
7497
7498 2010-03-08  Doug Kwan  <dougkwan@google.com>
7499
7500         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7501         due to a conversion warning.
7502         (Arm_relobj::update_output_local_symbol_count): Check for local
7503         symbol with unset output index.
7504
7505 2010-03-05  Ian Lance Taylor  <iant@google.com>
7506
7507         * options.h (class General_options): Add --spare-dynamic-tags.
7508         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7509         --spare-dynamic-tags.
7510
7511 2010-03-05  Ian Lance Taylor  <iant@google.com>
7512
7513         * incremental.cc: Include "libiberty.h".
7514
7515 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7516
7517         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7518         function, is_info_ member.
7519         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7520         (Versions::Versions): Update caller.
7521         (Versions::define_base_version): Likewise.
7522         (Versions::add_def): Likewise.
7523
7524 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7525
7526         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7527         (Scan::possible_function_pointer_reloc): New function.
7528         (Scan::local_reloc_may_be_function_pointer): Change to call
7529         possible_function_pointer_reloc.
7530         (Scan::global_reloc_may_be_function_pointer): Ditto.
7531         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7532         relocations in ".data.rel.ro._ZTV" section.
7533         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7534         * testsuite/icf_safe_so_test.cc: Ditto.
7535         * testsuite/icf_safe_test.cc: Ditto.
7536         * testsuite/icf_safe_test.sh: Ditto.
7537
7538 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7539             Ian Lance Taylor  <iant@google.com>
7540
7541         * target-reloc.h (relocate_section): Check the symbol table index
7542         for -1U before setting the local symbol index.
7543         (scan_relocatable_relocs): If copying the relocation, record that
7544         the local symbol is required.
7545         * object.h (Symbol_value::is_output_symtab_index_set): New
7546         function.
7547         (Symbol_value::may_be_discarded_from_output_symtab): New
7548         function.
7549         (Symbol_value::has_output_symtab_entry): New function.
7550         (Symbol_value::needs_output_symtab_entry): Remove.
7551         (Symbol_value::output_symtab_index): Make sure the symbol index is
7552         set.
7553         (Symbol_value::set_output_symtab_index): Make sure the symbol
7554         index is not set.  Make sure the new index is valid.
7555         (Symbol_value::set_must_have_output_symtab_entry): New function.
7556         (Symbol_value::has_output_dynsym_entry): New function.
7557         (Symbol_value::set_output_dynsym_index): Make sure the new index
7558         is valid.
7559         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7560         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7561         local symbol if permitted.
7562         (Sized_relobj::do_finalize_local_symbols): Call
7563         is_output_symtab_index_set rather than needs_output_symtab_entry.
7564         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7565         rather than needs_output_symtab_entry.  Call
7566         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7567         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7568         is_output_symtab_index_set rather than needs_output_symtab_entry.
7569         * testsuite/discard_locals_relocatable_test.c: New file.
7570         * testsuite/discard_locals_test.sh: Test -r.
7571         * testsuite/Makefile.am (check_DATA): Add
7572         discard_locals_relocatable_test1.syms,
7573         discard_local_relocatable_test2.syms.
7574         (MOSTLYCLEANFILES): Likewise.  Also add
7575         discard_locals_relocatable_test1.lout and
7576         discard_locals_relocatable_test2.out.
7577         (discard_locals_relocatable_test1.syms): New target.
7578         (discard_locals_relocatable_test.o): New target.
7579         (discard_locals_relocatable_test1.out): New target.
7580         (discard_locals_relocatable_test2.syms): New target.
7581         (discard_locals_relocatable_test2.out): New target.
7582         (various): Add missing ../ld-new dependencies.
7583         * testsuite/Makefile.in: Rebuild.
7584
7585 2010-03-03  Nick Clifton  <nickc@redhat.com>
7586
7587         * po/fi.po: New Finnish translation.
7588
7589 2010-03-01  Doug Kwan  <dougkwan@google.com>
7590
7591         * layout.cc (Layout::Layout): Force section types of .init_array*,
7592         .preinit_array* and .fini_array* sections.
7593         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7594         Fix check of return value of std::string::find.().
7595         (Output_section::Input_section_sort_compare::operator()): Remove
7596         comment about .init_array.
7597         (Output_section::Input_section_sort_init_fini_compare::operator()):
7598         New method.
7599         (Output_section::sort_attached_input_sections): Handle .init_array
7600         and .fini_array specially.
7601         * output.h (Output_section::Inut_section_sort_compare): Update
7602         comment.
7603         (Output_section::Input_section_sort_init_fini_compare): New struct.
7604
7605 2010-02-26  Doug Kwan  <dougkwan@google.com>
7606
7607         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7608         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7609         * testsuite/debug_msg.sh: Avoid matching source line number for
7610         use of global variable undef_int.
7611
7612 2010-02-26  Doug Kwan  <dougkwan@google.com>
7613
7614         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7615         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7616         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7617         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7618         * options.cc (General_options::General_options): Initialize member
7619         fix_v4bx_.
7620         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7621         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7622         and rm_no_fix_v4bx.stdout
7623         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7624         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7625         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7626         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7627         and arm_no_fix_v4bx.
7628         * Makefile.in: Regenerate.
7629         * testsuite/arm_fix_v4bx.s: New file.
7630         * testsuite/arm_fix_v4bx.sh: Ditto.
7631
7632 2010-02-24  Doug Kwan  <dougkwan@google.com>
7633
7634         * arm.cc (Target_arm::got_section): Make the .got section the first
7635         non RELRO section in the data segment.
7636         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7637         suffixes of section names.
7638
7639 2010-02-24  Doug Kwan  <dougkwan@google.com>
7640
7641         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7642         flags and attributes merging if an input file is a binary file.
7643         * fileread.cc (Input_file::open): Record format of original file.
7644         * fileread.h (Input_file::Format): New enum type.
7645         (Input_file::Input_file): Initialize data member format_.
7646         (Input_file::format): New method definition.
7647         (Input_file::format_):: New data member.
7648
7649 2010-02-24  Doug Kwan  <dougkwan@google.com>
7650
7651         * arm.cc (Arm_output_data_got): New class.
7652         (ARM_TCB_SIZE): New constant
7653         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7654         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7655         If user uses a script with a SECTIONS clause, issue only a warning
7656         for a misplaced EXIDX input section.  Otherwise, issue an error.
7657         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7658         garbage collection.
7659         (Target_arm::got_mode_index_entry): Handle static linking.
7660         (Target_arm::Scan::local): Ditto.
7661         (Target_arm::Scan::global): Ditto.
7662         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7663         all incorrectly implemented relocations.
7664         (Target_arm::fix_exidx_coverage): Pass layout to
7665         Arm_output_section::fix_exidx_coverage.
7666         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7667         from ".ARM.exidx." and ".ARM.extab.".
7668
7669 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7670
7671         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7672         section if it does not already exist.
7673         * attributes.cc (Attributes_section_data::Attributes_section_data):
7674         Don't crash if size is zero.
7675
7676 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7677             Ian Lance Taylor  <iant@google.com>
7678
7679         * gold.cc (queue_middle_tasks): If no input files were opened,
7680         exit.
7681         * workqueue.h (Task_function::Task_function): Assert that there is
7682         a blocker.
7683
7684 2010-02-22  Doug Kwan  <dougkwan@google.com>
7685
7686         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7687         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7688         types to avoid warnings due to different uint64_t implementations
7689         on different hosts.
7690
7691 2010-02-21  Doug Kwan  <dougkwan@google.com>
7692
7693         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7694         handling of the maximum backward branch offset.
7695         (Arm_relocate_functions::thumb_branch_common): Ditto.
7696         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7697         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7698         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7699         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7700         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7701         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7702         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7703         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7704         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7705         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7706         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7707         thumb2_bl_out_of_range.o): New rules.
7708         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7709         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7710         thumb2_bl_out_of_range
7711         * testsuite/Makefile.in: Regenerate.
7712         * testsuite/arm_bl_in_range.s: New file.
7713         * testsuite/arm_bl_out_of_range.s: Ditto.
7714         * testsuite/arm_branch_in_range.sh: Ditto.
7715         * testsuite/arm_branch_range.t: Ditto.
7716         * testsuite/thumb2_branch_range.t: Ditto.
7717         * testsuite/thumb_bl_in_range.s: Ditto.
7718         * testsuite/thumb_bl_out_of_range.s: Ditto.
7719         * testsuite/thumb_branch_range.t: Ditto.
7720
7721 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7722
7723         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7724         Add reloc offset information.
7725         * icf.cc (get_section_contents): Change iterators to point to the new
7726         vectors. Add reloc offset information to the contents.
7727         * icf.h (Icf::Sections_reachable_info): New typedef.
7728         (Icf::Sections_reachable_list): New typedef.
7729         (Icf::Offset_info): New typedef.
7730         (Icf::Reloc_info): New struct typedef.
7731         (Icf::Reloc_info_list): New typedef.
7732         (Icf::symbol_reloc_list): Delete method.
7733         (Icf::addend_reloc_list): Delete method.
7734         (Icf::section_reloc_list): Delete method.
7735         (Icf::reloc_info_list): New method.
7736         (Icf::reloc_info_list_): New member.
7737
7738 2010-02-19  Doug Kwan  <dougkwan@google.com>
7739
7740         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7741         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7742         * arm.cc (Arm_relocation_functions): New forward declaration.
7743         (Target_arm::Target_arm): Initialize new data members
7744         got_mod_index_offset_ and tls_base_symbol_defined_.
7745         (Target_arm::Relocate::relocate_tls): New method.
7746         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7747          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7748         New methods.
7749         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7750         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7751         (Target_arm::got_mod_index_offset_,
7752         Target_arm::tls_base_symbol_defined_): New data members.
7753         (Target_arm::Scan::local, Target::Scan::global,
7754         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7755         relocations.
7756
7757 2010-02-18  Doug Kwan  <dougkwan@google.com>
7758
7759         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7760         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7761         text section as a parameter becuase some broken tools may not set
7762         the link in section header.
7763         (Target_arm::has_got_section): New method.
7764         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7765         without any mapping symbol as data only.  Remove warning.
7766         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7767         link in its section header, try to discover the link by inspecting the
7768         REL31 relocation at the beginning of the section.
7769         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7770         in error message.
7771         (Target_arm::Scan::global): Treat any reference to the symbol
7772         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7773
7774 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7775
7776         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7777         (Scan::global_reloc_may_be_function_pointer): New function.
7778         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7779         (Scan::global_reloc_may_be_function_pointer): New function.
7780         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7781         (Scan::global_reloc_may_be_function_pointer): New function.
7782         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7783         (Scan::global_reloc_may_be_function_pointer): New function.
7784         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7785         (Scan::global_reloc_may_be_function_pointer): New function.
7786         (Scan::possible_function_pointer_reloc): New function.
7787         (Target_x86_64::can_check_for_function_pointers): New function.
7788         * gc.h (gc_process_relocs): Scan relocation types to determine if
7789         function pointers were taken for targets that support it.
7790         * icf.cc (Icf::find_identical_sections): Include functions for
7791         folding in safe ICF whose pointer is not taken.
7792         * icf.h (Secn_fptr_taken_set): New typedef.
7793         (fptr_section_id_): New member.
7794         (section_has_function_pointers): New function.
7795         (set_section_has_function_pointers): New function.
7796         (check_section_for_function_pointers): New function.
7797         * options.h: Fix comment for safe ICF option.
7798         * target.h (can_check_for_function_pointers): New function.
7799         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7800         Modify icf_safe_test for X86-64.
7801         * testsuite/Makefile.in: Regenerate.
7802         * testsuite/icf_safe_so_test.cc: New file.
7803         * testsuite/icf_safe_so_test.sh: New file.
7804         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7805         (main): Change to take pointer to function kept_func_3.
7806         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7807         folding is done correctly for X86-64.
7808
7809 2010-02-12  David S. Miller  <davem@davemloft.net>
7810
7811         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7812         is_symbolless parameter.
7813         (Output_reloc<SHT_REL>::is_symbolless): New.
7814         (Output_reloc<SHT_REL>::is_symbolless_): New.
7815         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7816         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7817         (Output_reloc<SHT_RELA>::is_symbolless): New.
7818         (Output_data_reloc::add_global): Handle is_symbolless.
7819         (Output_data_reloc::add_global_relative): Likewise.
7820         (Output_data_reloc::add_local): Likewise.
7821         (Output_data_reloc::add_local_relative): Likewise.
7822         (Output_data_reloc::add_symbolless_global_addend): New.
7823         (Output_data_reloc::add_symbolless_local_addend): New.
7824         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7825         is_symbolless.
7826         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7827         instead of ->is_relative_
7828         (Output_reloc::write): Likewise.
7829         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7830         (Output_reloc::write_rel): Simplify.
7831
7832         * sparc.cc (Target_sparc::Scan::local): Use
7833         ->add_symbolless_local_addend as needed.
7834         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7835         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7836         based upon relocation offset.
7837
7838 2010-02-11  Doug Kwan  <dougkwan@google.com>
7839
7840         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7841         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7842         beginning of function.
7843         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7844         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7845         parameter is_32bit in calls to should_apply_static_reloc.
7846         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7847         (check_DATA): Add arm_abs_global.stdout.
7848         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7849         arm_abs_global.stdout): New rules.
7850         (MOSTLLYCLEANFILES): Add arm_abs_global
7851         * Makefile.in: Regenerate.
7852         * testsuite/arm_abs_global.s: New file.
7853         * testsuite/arm_abs_global.sh: Ditto.
7854         * testsuite/arm_abs_lib.s: Ditto.
7855
7856 2010-02-11  Ian Lance Taylor  <iant@google.com>
7857
7858         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7859         Read_relocs task.
7860         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7861         Allocate_commons_task first.
7862         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7863         task, rather than symtab_lock_.
7864         (Gc_process_relocs::~Gc_process_relocs): New function.
7865         (Gc_process_relocs::is_runnable): Check this_blocker_.
7866         (Gc_process_relocs::locks): Use next_blocker_ rather than
7867         blocker_.
7868         (Scan_relocs::~Scan_relocs): New function.
7869         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7870         symtab_lock_.
7871         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7872         next_blocker_.
7873         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7874         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7875         constructor accordingly.
7876         (class Gc_process_relocs): Likewise.
7877         (class Scan_relocs): Likewise.
7878         * common.h (class Allocate_commons_task): Remove symtab_lock_
7879         field, and corresponding constructor parameter.
7880         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7881         symtab_lock_.
7882         (Allocate_commons_task::locks): Likewise.
7883
7884 2010-02-11  Ian Lance Taylor  <iant@google.com>
7885
7886         * gold-threads.h (class Once): Define.
7887         (class Initialize_lock): Rewrite as child of Once.
7888         * gold-threads.cc (class Once_initialize): Define.
7889         (once_pointer_control): New static variable.
7890         (once_pointer, once_arg): New static variables.
7891         (c_run_once): New static function.
7892         (Once::Once, Once::run_once, Once::internal_run): New functions.
7893         (class Initialize_lock_once): Remove.
7894         (initialize_lock_control): Remove.
7895         (initialize_lock_pointer): Remove.
7896         (initialize_lock_once): Remove.
7897         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7898         (Initialize_lock::initialize): Rewrite.
7899         (Initialize_lock::do_run_once): New function.
7900         * archive.cc (Archive::interpret_header): Only clear name if it is
7901         not already empty.
7902         * fileread.cc: Include "gold-threads.h"
7903         (file_counts_lock): New static variable.
7904         (file_counts_initialize_lock): Likewise.
7905         (File_read::release): Only increment counts when using --stats.
7906         Use a lock around the increment.
7907         * parameters.cc (class Set_parameters_target_once): Define.
7908         (set_parameters_target_once): New static variable.
7909         (Parameters::Parameters): Move here from parameters.h.
7910         (Parameters::set_target): Rewrite.
7911         (Parameters::set_target_once): New function.
7912         (Parameters::clear_target): Move here and rewrite.
7913         * parameters.h (class Parameters): Update declarations.  Add
7914         set_parameters_target_once_ field.
7915         (Parameters::Parameters): Move to parameters.cc.
7916         (Parameters::clear_target): Likewise.
7917         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7918         task.
7919         (Start_group::~Start_group): New function.
7920         (Start_group::is_runnable): New function.
7921         (Start_group::locks, Start_group::run): New functions.
7922         (Finish_group::run): Change saw_undefined to size_t.
7923         * readsyms.h (class Start_group): Define.
7924         (class Finish_group): Change saw_undefined_ field to size_t.
7925         (Finish_group::Finish_group): Remove saw_undefined and
7926         this_blocker parameters.  Change all callers.
7927         (Finish_group::set_saw_undefined): New function.
7928         (Finish_group::set_blocker): New function.
7929         * symtab.h (class Symbol_table): Change saw_undefined to return
7930         size_t.  Change saw_undefined_ field to size_t.
7931         * target-select.cc (Set_target_once::do_run_once): New function.
7932         (Target_selector::Target_selector): Initialize set_target_once_
7933         field.  Don't initialize lock_ and initialize_lock_ fields.
7934         (Target_selector::instantiate_target): Rewrite.
7935         (Target_selector::set_target): New function.
7936         * target-select.h (class Set_target_once): Define.
7937         (class Target_selector): Update declarations.  Make
7938         Set_target_once a friend.  Remove lock_ and initialize_lock_
7939         fields.  Add set_target_once_ field.
7940
7941 2010-02-10  Ian Lance Taylor  <iant@google.com>
7942
7943         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7944         queueing any tasks.
7945         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7946         (queue_middle_tasks): Add all blockers before queueing any tasks.
7947         (queue_final_tasks): Likewise.
7948         * token.h (Task_token::add_blockers): New function.
7949         * object.h (Input_objects::number_of_relobjs): New function.
7950
7951 2010-02-10  Ian Lance Taylor  <iant@google.com>
7952
7953         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7954         shared, not if not position independent.
7955         * x86_64.cc (Relocate::relocate_tls): Likewise.
7956         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7957         (tls_pie_pic_test): New target.
7958         * testsuite/Makefile.in: Rebuild.
7959
7960         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7961         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7962         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7963         * testsuite/Makefile.in: Rebuild.
7964
7965 2010-02-09  David S. Miller  <davem@davemloft.net>
7966
7967         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7968         R_SPARC_RELATIVE using ->add_local_relative().
7969         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7970
7971         * output.h (Output_data_dynamic::add_section_size): New method
7972         that takes two Output_data objects.
7973         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7974         entry param.  Handle it in initializers.
7975         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7976         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7977         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7978         arg.
7979         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7980         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7981         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7982         for dynrel_includes_plt.
7983         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7984         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7985         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7986         before .rela.plt
7987         (Target_sparc::do_finalize_sections): Update to pass true for
7988         dynrel_includes_plt.
7989         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7990         output before .rela.plt
7991         (Target_powerpc::do_finalize_sections): Update to pass true for
7992         dynrel_includes_plt when 32-bit.
7993
7994 2010-02-08  Doug Kwan  <dougkwan@google.com>
7995
7996         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7997         method.
7998         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7999         Arm_relobj::scan_section_for_cortex_a8_stubs,
8000         Arm_relobj::do_relocation_section): Instead of calling
8001         Output_section::output_address, use faster
8002         Arm_relobj::simple_input_section_output_address.
8003
8004 2010-02-08  David S. Miller  <davem@davemloft.net>
8005
8006         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8007         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8008         relocation helper function.
8009
8010         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8011         just like R_SPARC_GOT{10,13,22}.
8012         (Target_sparc::Scan::local): Likewise.
8013         (Target_sparc::Relocate:relocate): Likewise.
8014
8015 2010-02-06  Ian Lance Taylor  <iant@google.com>
8016
8017         * configure.ac: Rewrite targetobjs duplicate removal code to use
8018         only shell constructs.
8019         * configure: Rebuild.
8020
8021 2010-02-05  Doug Kwan  <dougkwan@google.com>
8022
8023         PR 11247
8024         * arm.cc (Arm_relobj::section_is_scannable): New method.
8025         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8026         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8027
8028 2010-02-04  Doug Kwan  <dougkwan@google.com>
8029
8030         PR 11247
8031         * arm-reloc-property.cc (cstdio): Include.
8032         * configure.ac (targetobjs): Remove duplicates.
8033         * configure: Regenerate.
8034         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8035         big and little endian version for a given address size.
8036
8037 2010-02-03  Doug Kwan  <dougkwan@google.com>
8038
8039         * arm-reloc-property.cc
8040         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8041         definition.
8042         * arm-reloc-property.h
8043         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8044         New method definition.
8045         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8046         declaration.
8047         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8048         overflow to N.
8049         (GOT_PREL): Change implemented to Y.
8050         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8051         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8052         (Arm_relocate_functions::movw_abs_nc): Remove method.
8053         (Arm_relocate_functions::movt_abs): Ditto.
8054         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8055         (Arm_relocate_functions::thm_movt_abs): Ditto.
8056         (Arm_relocate_functions::movw_rel_nc): Ditto.
8057         (Arm_relocate_functions::movw_rel): Ditto.
8058         (Arm_relocate_functions::movt_rel): Ditto.
8059         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8060         (Arm_relocate_functions:thm_movw_rel): Ditto.
8061         (Arm_relocate_functions:thm_movt_rel): Ditto.
8062         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8063         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8064         New method definitions.
8065         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8066         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8067         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8068         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8069         (Target_arm::Relocate::relocate): Check for non-static or
8070         unimplemented relocation code and exit early.  Change calls to
8071         Target_arm::reloc_uses_thumb_bit and
8072         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8073         instead.  Refactor code to handle similar relocations to increase
8074         code sharing.  Remove check for unsupported relocation code in switch
8075         statement.
8076         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8077         relocation property table to find out size.  Change error message to
8078         print out the name of a relocation code instead of the numeric value.
8079         (Target_arm::scan_reloc_for_stub): Use relocation property table
8080         instead of calling Target_arm::reloc_uses_thumb_bit().
8081
8082 2010-02-02  Doug Kwan  <dougkwan@google.com>
8083
8084         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8085         types of relaxed input section.
8086
8087 2010-02-02  Doug Kwan  <dougkwan@google.com>
8088
8089         * Makefile.am (HFILES): Add arm-reloc-property.h.
8090         (DEFFILES): New.
8091         (TARGETSOURCES): Add arm-reloc-property.cc
8092         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8093         (libgold_a_SOURCES): $(DEFFILES)
8094         * Makefile.in: Regenerate.
8095         * arm-reloc-property.cc: New file.
8096         * arm-reloc-property.h: New file.
8097         * arm-reloc.def: New file.
8098         * arm.cc: Update comments.
8099         (arm-reloc-property.h): New included header.
8100         (arm_reloc_property_table): New global variable.
8101         (Target_arm::do_select_as_default_target): New method definition.
8102         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8103         arm-reloc-property to targ_extra_obj.
8104         * parameters.cc (set_parameters_target): Call
8105         Target::select_as_default_target().
8106         * target.h (Target::select_as_default_target): New method definition.
8107         (Target::do_select_as_default_target): Same.
8108
8109 2010-02-01  Doug Kwan  <dougkwan@google.com>
8110
8111         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8112         first_output_text_section_.
8113         (Arm_exidx_fixup::first_output_text_section): New method definition.
8114         (Arm_exidx_fixup::first_output_text_section_): New data member.
8115         (Arm_exidx_fixup::process_exidx_section): Record the first text
8116         output section seen.
8117         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8118         and entsize in output section header.
8119
8120 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8121
8122         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8123         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8124         (Arm_relocate_functions::thm_alu11): New Method.
8125         (Arm_relocate_functions::thm_pc8): New Method.
8126         (Arm_relocate_functions::thm_pc12): New Method.
8127         (Target_arm::Scan::local): Handle the relocations.
8128         (Target_arm::Scan::global): Likewise.
8129         (Target_arm::Relocate::relocate): Likewise.
8130         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8131
8132 2010-01-29  Doug Kwan  <dougkwan@google.com>
8133
8134         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8135         of relocation types as ld.
8136
8137 2010-01-29  Doug Kwan  <dougkwan@google.com>
8138
8139         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8140         to public.
8141         (Arm_relocate_functions::thumb_branch_common): Ditto.
8142         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8143         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8144         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8145         Arm_relocate_functions::jump24): Remove.
8146         (Target_arm::Relocate::relocate): Adjust code to call
8147         Arm_relocation_functions::arm_branch_common and
8148         Arm_relocation_functions::thumb_branch_common instead of their removed
8149         wrappers.  Merge switch-cases together to reduce source code size.
8150
8151 2010-01-29  Doug Kwan  <dougkwan@google.com>
8152
8153         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8154         output_local_symbol_count_needs_update_.
8155         (Arm_relobj::output_local_symbol_count_needs_update,
8156          Arm_relobj::set_output_local_symbol_count_needs_update,
8157          Arm_relobj::update_output_local_symbol_count): New methods.
8158         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8159         member.
8160         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8161         of pointed function as in a R_ARM_PREL31 relocation.
8162         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8163         for output local symbol count updating.
8164         (Target_arm::do_relax): Update output local symbol counts in objects
8165         if necessary.
8166         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8167
8168 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8169
8170         * arm.cc: Added support for the ARM relocations:
8171         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8172         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8173         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8174         movw_prel_nc).
8175         (Arm_relocate_functions::movw_rel): New method.
8176         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8177         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8178         thm_movw_prel_nc).
8179         (Arm_relocate_functions::thm_movw_rel): New method.
8180         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8181         thm_movt_prel).
8182         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8183         relocations.
8184         (Target_arm::Scan::global): Likewise.
8185         (Target_arm::Relocate::relocate): Likewise.
8186         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8187         Likewise.
8188
8189 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8190
8191         * arm.cc: Added support for ARM group relocations.
8192         (Target_arm::reloc_needs_sym_origin): New method.
8193         (Arm_relocate_functions::calc_grp_kn): New method.
8194         (Arm_relocate_functions::calc_grp_residual): New method.
8195         (Arm_relocate_functions::calc_grp_gn): New method.
8196         (Arm_relocate_functions::arm_grp_alu): New Method.
8197         (Arm_relocate_functions::arm_grp_ldr): New Method.
8198         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8199         (Arm_relocate_functions::arm_grp_ldc): New Method.
8200         (Target_arm::Scan::local): Handle the ARM group relocations.
8201         (Target_arm::Scan::global): Likewise.
8202         (Target_arm::Relocate::relocate): Likewise.
8203         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8204         Likewise.
8205
8206 2010-01-26  Doug Kwan  <dougkwan@google.com>
8207
8208         * arm.cc (set): Include.
8209         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8210         pointer type.
8211         (Arm_output_section::Text_section_list): New type.
8212         (Arm_output_section::append_text_sections_to_list): New method.
8213         (Arm_output_section::fix_exidx_coverage): Ditto.
8214         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8215         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8216         Relobj::set_section_offset() instead of
8217         Sized_relobj::invalidate_section_offset().
8218         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8219         parameter for section headers. Ignore relocation sections for
8220         unallocated sections and EXIDX sections.
8221         (Target_arm::fix_exidx_coverage): New method.
8222         (Target_arm::output_section_address_less_than): New type.
8223         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8224         linked text section instead of the EXIDX section.
8225         (Arm_output_section::create_stub_group): Add an assertion to check
8226         that this is not an EXIDX output section.
8227         (Arm_output_section::append_text_sections_to_list): New method.
8228         (Arm_output_section::fix_exidx_coverage): Ditto.
8229         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8230         Arm_relobj::section_needs_reloc_stub_scanning.
8231         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8232         first pass.
8233         (Target_arm::fix_exidx_coverage): New method.
8234         * object.h (Relobj::set_output_section): New method.
8235         (Sized_relobj::invalidate_section_offset): Remove method.
8236         (Sized_relobj::do_invalidate_section_offset): Remove method.
8237         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8238
8239 2010-01-25  Doug Kwan  <dougkwan@google.com>
8240
8241         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8242         Fix warning due to signed and unsigned comparison on a 32-bit host.
8243
8244 2010-01-22  Doug Kwan  <dougkwan@google.com>
8245
8246         * arm.cc (Target_arm::do_relax): Record an output section for section
8247         offset adjustment it contains any stub table that has changed.
8248         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8249         offsets in an output section if necessary.
8250         * output.cc (Output_section::Output_section): Initialize
8251         section_offsets_need_adjustments_.
8252         (Output_section::add_input_section_for_script): Renamed to
8253         Output_section::add_simple_input_section.
8254         (Output_section::save_states): Add a comment.
8255         (Output_section::discard_states): New method defintion.
8256         (Output_section::adjust_section_offsets): Same.
8257         * output.h (Output_section::add_input_section_for_script): Renamed to
8258         Output_section::add_simple_input_section.
8259         (Output_section::discard_states): New method declaration.
8260         (Output_section::adjust_section_offsets): Same.
8261         (Output_section::section_offsets_need_adjustment,
8262         Output_section::set_section_offsets_need_adjustment): New method
8263         definitions.
8264         (Output_section::section_offsets_need_adjustment_): New data member.
8265         * script-sections.cc
8266         (Output_section_element_input::set_section_address): Adjust code for
8267         renaming of Output_section::add_input_section_for_script.
8268         (Orphan_output_section::set_section_address): Same.
8269
8270 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8271
8272         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8273         Fix_v4bx enum values .
8274         * gold/options.h (General_options): New option definitions.
8275         (General_options::fix_v4bx): New method.
8276         (General_options::Fix_v4bx): New enum.
8277         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8278         (General_options::parse_fix_v4bx_interworking): New method.
8279
8280 2010-01-22  Doug Kwan  <dougkwan@google.com>
8281
8282         * arm.cc (Arm_exidx_fixup): New class.
8283
8284 2010-01-21  Doug Kwan  <dougkwan@google.com>
8285
8286         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8287         classes.
8288         (Arm_exidx_section_offset_map): New type.
8289
8290 2010-01-21  Doug Kwan  <dougkwan@google.com>
8291
8292         * arm.cc (Arm_exidx_input_section): New class.
8293         (Arm_relobj::exidx_input_section_by_link,
8294         Arm_relobj::exidx_input_section_by_shndx,
8295         Arm_relobj::make_exidx_input_section): New methods.
8296         (read_arm_attributes_section): Remove.
8297         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8298         information about them.
8299         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8300         to here.
8301
8302 2010-01-20  Doug Kwan  <dougkwan@google.com>
8303
8304         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8305         Input_section_specifier to Section_id.
8306         (Target_arm::new_arm_input_section: Adjust code for change of key
8307         type.
8308         (Target_arm::find_arm_input_section): Ditto.
8309         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8310         (Section_id): Remove.
8311         (Garbage_collection::Section_id_hash): Remove.
8312         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8313         (Section_id): Remove.
8314         (Icf::Section_id_hash): Remove.
8315         * object.h (Section_id, Const_section_id, Section_id_hash,
8316         Const_section_id_hash): New type definitions.
8317         * output.cc (Output_section::add_relaxed_input_section): Change to
8318         use Const_section_id instead of Input_section_specifier as key type.
8319         (Output_section::add_merge_input_section): Ditto.
8320         (Output_section::build_relaxation_map): Change to use Section_id
8321         instead of Input_section_specifier as key type.
8322         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8323         Ditto.
8324         (Output_section::convert_input_sections_to_relaxed_sections): Change
8325         to use Const_section_id instead of Input_section_specifier as key type.
8326         (Output_section::find_merge_section): Ditto.
8327         (Output_section::find_relaxed_input_section): Ditto.
8328         * output.h (Input_section_specifier): Remove class.
8329         (Output_section::Output_section_data_by_input_section_map): Change
8330         key type to Const_section_id.
8331         (Output_section::Output_relaxed_input_section_by_input_section_map):
8332         Ditto.
8333         (Output_section::Relaxation_map): Change key type to Section_id.
8334
8335 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8336
8337         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8338         (class Arm_v4bx_stub): New class.
8339         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8340         (Stub_factory::make_arm_v4bx_stub): New method.
8341         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8342         (Stub_table::empty): Handle v4bx stubs.
8343         (Stub_table::add_arm_v4bx_stub): New method.
8344         (Stub_table::find_arm_v4bx_stub): New method.
8345         (Arm_relocate_functions::v4bx): New method.
8346         (Target_arm::fix_v4bx): New method.
8347         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8348         (Stub_table::relocate_stubs): Likewise.
8349         (Stub_table::do_write): Likewise.
8350         (Stub_table::update_data_size_and_addralign): Likewise.
8351         (Stub_table::finalize_stubs):  Likewise.
8352         (Target_arm::Scan::local): Likewise.
8353         (Target_arm::Scan::global): Likewise.
8354         (Target_arm::do_finalize_sections): Likewise.
8355         (Target_arm::Relocate::relocate): Likewise.
8356         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8357         Likewise.
8358         (Target_arm::scan_reloc_for_stub): Likewise.
8359         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8360
8361 2010-01-19  Ian Lance Taylor  <iant@google.com>
8362
8363         * output.cc (Output_section_headers::do_sized_write): Write large
8364         segment count to sh_info field.
8365         (Output_file_header::do_sized_write): For large segment count,
8366         write PN_XNUM to e_phnum field.
8367
8368 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8369
8370         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8371         (Arm_relocate_functions::thm_jump8): New function.
8372         (Arm_relocate_functions::thm_jump11): New function.
8373         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8374         R_ARM_THM_JUMP11.
8375         (Target_arm::Scan::global): Likewise.
8376         (Target_arm::Relocate::relocate): Likewise.
8377         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8378         Likewise.
8379
8380 2010-01-14  Doug Kwan  <dougkwan@google.com>
8381
8382         * arm.cc (map, utility): Include headers.
8383         (Target_arm::apply_cortex_a8_workaround): New method.
8384         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8385         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8386         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8387         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8388         the --[no-]fix-cortex-a8 command line options.
8389         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8390         (Target_arm::relocate_stub): Use addend in instruction template.
8391         * options.h (DEFINE_bool): Set the user-set flag.
8392         (General_options): Add --[no-]-fix-cortex options.
8393         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8394         : Update fast look-up map after conversion.
8395
8396 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8397
8398         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8399         in the first pass of do_layout.
8400
8401 2010-01-13  Doug Kwan  <dougkwan@google.com>
8402
8403         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8404         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8405         apparent compiler problem of not folding static constant integral
8406         data members of elfcpp::Elf_sizes<32>.
8407
8408 2010-01-13  Doug Kwan  <dougkwan@google.com>
8409
8410         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8411         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8412         Arm_relobj::scan_section_for_cortex_a8_erratum,
8413         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8414         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8415         sections to scan for relocation stubs into a new method
8416         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8417         relocation and Cortex-A8 stub scanning.
8418         (Target_arm::do_relax): Force stubs to be after stubbed sections
8419         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8420         the beginning of a new relaxation pass.  Update a comment.
8421         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8422
8423 2010-01-12  Ian Lance Taylor  <iant@google.com>
8424
8425         * target-reloc.h (visibility_error): New inline function.
8426         (relocate_section): Call visibility_error.
8427         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8428         (MOSTLYCLEANFILES): Likewise.
8429         (protected_4_pic.o, protected_3.err): New targets.
8430         * testsuite/protected_4.cc: New file.
8431
8432 2010-01-12  Doug Kwan  <dougkwan@google.com>
8433
8434         * arm.cc (Cortex_a8_reloc): New class.
8435         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8436         and cortex_a8_relocs_info_.
8437         (Target_arm::fix_cortex_a8): New method definition.
8438         (Target_arm::Cortex_a8_relocs_info): New type.
8439         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8440         New data member declarations.
8441         (Target_arm::scan_reloc_for_stub): Record information about
8442         relocations for THUMB branches that might be exempted from the
8443         Cortex-A8 workaround.
8444         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8445         at the beginning of a relaxation pass.
8446
8447 2010-01-12  Doug Kwan  <dougkwan@google.com>
8448
8449         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8450         (Arm_relobj::Mapping_symbol_position,
8451          Arm_reloj::Mapping_symbol_position_less,
8452          Arm_relobj::Mapping_symbols_info): New types.
8453         (Target_arm::is_mapping_symbol_name): New method definition.
8454         (Arm_relobj::do_count_local_symbols): Save information about mapping
8455         symbols.
8456
8457 2010-01-11  Doug Kwan  <dougkwan@google.com>
8458
8459         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8460         Arm_relocate_functions::thumb32_branch_upper,
8461         Arm_relocate_functions::thumb32_branch_lower,
8462         Arm_relocate_functions::thumb32_cond_branch_offset,
8463         Arm_relocate_functions::thumb32_cond_branch_upper,
8464         Arm_relocate_functions::thumb32_cond_branch_lower,
8465         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8466         branch offset encoding.
8467         (Arm_relocate_functions::thumb_branch_common): Use new branch
8468         offset encoding methods to avoid code duplication.
8469         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8470         (Stub_addend_reader::operator()): Use new branch encoding method
8471         to avoid code duplication.
8472
8473 2010-01-11  Doug Kwan  <dougkwan@google.com>
8474
8475         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8476         (Target_arm::do_finalize_sections): Define special EXIDX section
8477         symbols only if referenced.
8478         * gc.h (Garbage_collection::add_reference): New method.
8479         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8480         code duplication.
8481
8482 2010-01-11  Ian Lance Taylor  <iant@google.com>
8483
8484         * script.cc (Version_script_info::build_expression_list_lookup):
8485         Change complaing about duplicate wildcard match from error to
8486         warning.
8487
8488         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8489         of 2009-12-30.
8490         (Version_script_info::Version_script_info): Initialize globs_,
8491         default_version_, default_is_global_, and exact_.  Don't
8492         initialize globals_ or locals_.
8493         (Version_script_info::build_lookup_tables): Build local symbols
8494         first.
8495         (Version_script_info::unquote): New function.
8496         (Version_script_info::add_exact_match): New function.
8497         (Version_script_info::build_expression_list_lookup): Remove lookup
8498         parameter.  Add is_global parameter.  Change all callers.  Handle
8499         wildcard pattern specially.  Unquote pattern.  Call
8500         add_exact_match.
8501         (Version_script_info::get_name_to_match): New function.
8502         (Version_script_info::get_symbol_version): New function.
8503         (Version_script_info::get_symbol_version_helper): Remove.
8504         (Version_script_info::check_unmatched_names): Call unquote.
8505         * script.h (class Version_script_info): Change get_symbol_version
8506         to be non-inline and add is_global parameter; change all callers.
8507         Rewrite symbol_is_local.  Update declarations.  Define struct
8508         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8509         Remove globals_ and locals_ members.  Add exact_, globs_,
8510         default_version_, is_global_.
8511         (Version_script_info::Glob): Remove pattern, add expression and
8512         is_global.  Update constructor.  Change all callers.
8513         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8514         default version.
8515         (Versions::symbol_section_contents): If a symbol is undefined, or
8516         defined in a dynamic object, set the version index to
8517         VER_NDX_LOCAL.
8518         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8519         symbol_is_local.
8520         (Symbol_table::add_from_pluginobj): Likewise.
8521         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8522
8523 2010-01-11  Doug Kwan  <dougkwan@google.com>
8524
8525         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8526         (incremental_dump_LDADD): Add linking option for libintl.
8527         * Makefile.in: Regenerate.
8528
8529 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8530
8531         PR gold/11144
8532         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8533         instead of -Ds.
8534         * testsuite/Makefile.in: Regenerated.
8535
8536 2010-01-10  Doug Kwan  <dougkwan@google.com>
8537
8538         * options.h (DEFINE_var): Use parentheses around argument varname__
8539         in macro body to avoid any unintended subsequent substitutions.
8540
8541 2010-01-10  Ian Lance Taylor  <iant@google.com>
8542
8543         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8544         candidates before doing symbol resolution.
8545
8546         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8547         ODR candidates if only one is weak.
8548
8549 2010-01-08  Ian Lance Taylor  <iant@google.com>
8550
8551         * script.cc (Version_script_info::build_expression_list_lookup):
8552         Don't warn about ambiguous version, just record the ambiguity.
8553         (Version_script_info::get_symbol_version_helper): Give error if
8554         version is ambiguous.
8555
8556 2010-01-08  Doug Kwan  <dougkwan@google.com>
8557
8558         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8559         prev_data_size_ and prev_addralign_.  Remove initializer for
8560         deleted data member has_been_changed_.
8561         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8562         to determine if the table is empty.
8563         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8564         Remove.
8565         (Stub_table::add_reloc_stub): Define method in class definition
8566         instead of just declaring it there.
8567         (Stub_table::add_cortex_a8_stub): New method definition.
8568         (Stub_table::update_data_size_and_addralign): Ditto.
8569         (Stub_table::finalize_stubs): Ditto.
8570         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8571         (Stub_table::do_addralign_): Return address alignment in the
8572         (Stub_table::do_reset_address_and_file_offset): Define method in
8573         class definition instead of declaring it there.  Set current data
8574         size to be the data size of the previous pass.
8575         (Stub_table::set_final_data_size): Use current data size as the
8576         final data size.
8577         (Stub_table::relocate_stub): Change parameter type of stub from
8578         Reloc_stub pointer to Stub pointer.
8579         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8580         (Stub_table::Cortex_a8_stub_list): New typedef.
8581         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8582          Stub_table::prev_addralign_): New data member.
8583         (Arm_relobj::Arm_relobj): Initialize data member
8584         section_has_cortex_a8_workaround_.
8585         (Arm_relobj::section_has_cortex_a8_workaround,
8586          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8587          definitions.
8588         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8589         declarations.
8590         (Target_arm::relocate_stub): Change parameter type of stub from
8591         Reloc_stub pointer to Stub pointer.
8592         (Insn_template::size, Insn_template::alignment): Handle
8593         THUMB16_SPECIAL_TYPE.
8594         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8595          Stub_table::update_data_size_and_addralign,
8596          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8597         definitions.
8598         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8599         (Stub_table::do_write): Ditto.
8600         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8601
8602 2010-01-08  Ian Lance Taylor  <iant@google.com>
8603
8604         PR 11108
8605         * symtab.h (class Symbol): Remove fields is_target_special_ and
8606         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8607         (Symbol::is_defined_in_discarded_section): New function.
8608         (Symbol::set_is_defined_in_discarded_section): New function.
8609         (Symbol::has_plt_offset): Rewrite.
8610         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8611         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8612         Don't initialize is_target_special_ or has_plt_offset_.
8613         Initialize is_defined_in_discarded_section_.
8614         (Symbol_table::add_from_relobj): If appropriate, set
8615         is_defined_in_discarded_section.
8616         * resolve.cc (Symbol::override_base_with_special): Don't test
8617         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8618         * target-reloc.h (relocate_section): Do special handling for
8619         symbols defined in discarded sections for global symbols as well
8620         as local symbols.
8621
8622 2010-01-08  Ian Lance Taylor  <iant@google.com>
8623
8624         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8625         the SHT_SYMTAB case.
8626
8627 2010-01-08  Ian Lance Taylor  <iant@google.com>
8628
8629         * object.cc (Sized_relobj::do_layout): Don't get confused if
8630         layout_eh_frame returns NULL.
8631
8632 2010-01-08  Ian Lance Taylor  <iant@google.com>
8633
8634         PR 11084
8635         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8636         dynamic symbol table, use the normal symbol table.
8637         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8638         symbol table.
8639
8640 2010-01-08  Ian Lance Taylor  <iant@google.com>
8641
8642         PR 11072
8643         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8644         sections.
8645
8646 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8647
8648         * version.cc (print_version): Change to "Copyright 2010".
8649
8650 2010-01-08  Ian Lance Taylor  <iant@google.com>
8651
8652         PR 10287
8653         PR 11063
8654         * i386.cc (class Target_i386): Change return type of plt_section
8655         to be non-const.
8656         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8657         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8658         tls_desc_rel_ field.
8659         (Output_data_plt_i386::rel_tls_desc): New function.
8660         (Target_i386::rel_tls_desc_section): New function.
8661         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8662         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8663         R_386_TLS_DESC reloc in rel_tls_desc_section.
8664         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8665         Define struct Tlsdesc_info.
8666         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8667         (Target_x86_64::do_reloc_symbol_index): New function.
8668         (Target_x86_64::add_tlsdesc_info): New function.
8669         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8670         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8671         tlsdesc_rel_ field.
8672         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8673         all callers.
8674         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8675         (Target_x86_64::rela_tlsdesc_section): New function.
8676         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8677         handling.
8678         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8679         (Target_x86_64::do_reloc_addend): New function.
8680         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8681         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8682         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8683         (Output_reloc::type): New function.
8684         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8685         (Output_reloc::is_target_specific): New function.
8686         (Output_reloc::target_arg): New function.
8687         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8688         absolute relocs and target specific relocs.
8689         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8690         add_target_specific.
8691         (class Output_data_reloc) [SHT_RELA]: Likewise.
8692         * output.cc (Output_reloc::Output_reloc): Add four new versions
8693         for absolute relocs and target specific relocs.
8694         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8695         (Output_reloc::get_symbol_index): Likewise.
8696         (Output_reloc::local_section_offset): Check that local_sym_index_
8697         is not TARGET_CODE or 0.
8698         (Output_reloc::symbol_value): Likewise.
8699         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8700         reloc.
8701         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8702         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8703         functions.
8704         * layout.cc (add_target_dynamic_tags): Use output section for
8705         DT_PLTRELSZ and DT_JMPREL.
8706
8707 2010-01-07  Ian Lance Taylor  <iant@google.com>
8708
8709         PR 11061
8710         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8711         function.
8712         (class Output_data_reloc_generic): Define.
8713         (class Output_data_reloc_base): Change base class to
8714         Output_data_reloc_generic.  Change add() method to call
8715         bump_relative_reloc_count for a relative reloc.  Remove
8716         sort_relocs_ field.
8717         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8718         to sort_relocs().
8719         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8720         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8721         appropriate.
8722         * layout.h (class Layout): Update declaration.
8723
8724 2010-01-07  Ian Lance Taylor  <iant@google.com>
8725
8726         * output.h (class Output_data): Add const version of
8727         output_section and do_output_section.
8728         (class Output_section_data): Add const version of
8729         do_output_section.
8730         (class Output_section): Likewise.
8731         * layout.cc (Layout::add_target_dynamic_tags): New function.
8732         * layout.h (class Layout): Update declarations.
8733         * arm.cc (Target_arm::do_finalize_sections): Use
8734         add_target_dynamic_tags.
8735         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8736         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8737         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8738         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8739
8740 2010-01-07  Ian Lance Taylor  <iant@google.com>
8741
8742         PR 11042
8743         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8744         object as needed.
8745
8746 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8747             Ian Lance Taylor  <iant@google.com>
8748
8749         PR 11019
8750         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8751         Xindex::read_symtab_xindex.
8752
8753 2010-01-07  Doug Kwan  <dougkwan@google.com>
8754
8755         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8756         (Insn_template::thumb16_bcond_insn): New method declaration.
8757         (Insn_template): Fix spelling.
8758         (Stub::thumb16_special): New method declaration.
8759         (Stub::do_write): Define virtual method which was previously pure
8760         virtual.
8761         (Stub::do_thumb16_special): New method declaration.
8762         (Stub::do_fixed_endian_write): New template member.
8763         (Reloc_stub::do_write): Remove.
8764         (Reloc_stub::do_fixed_endian_write): Remove.
8765         (Cortex_a8_stub): New class definition.
8766         (Stub_factory::make_cortex_a8_stub): New method definition.
8767         (Stub_factory::Stub_factory): Add missing static storage class
8768         qualifier for elf32_arm_stub_a8_veneer_blx.
8769
8770 2010-01-07  Ian Lance Taylor  <iant@google.com>
8771
8772         PR 10980
8773         * options.h (class General_options): Add --warn-unresolved-symbols
8774         and --error-unresolved-symbols.
8775         * errors.cc (Errors::undefined_symbol): Implement
8776         --warn-unresolved-symbols.
8777
8778         * options.h (class General_options): Add -z text and -z textoff.
8779         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8780
8781 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8782
8783         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8784         (Garbage_collection::cident_sections): New function.
8785         (Garbage_collection::add_cident_section): New function.
8786         (Garbage_collection::cident_sections_): New member.
8787         (gc_process_relocs): Add references to sections whose names are C
8788         identifiers.
8789         * gold.h (cident_section_start_prefix): New constant.
8790         (cident_section_stop_prefix): New constant.
8791         (is_cident): New function.
8792         * layout.cc (Layout::define_section_symbols): Replace string constants
8793         with the newly defined constants.
8794         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8795         C identifiers.
8796         * testsuite/Makefile.am: Add gc_orphan_section_test.
8797         * testsuite/Makefile.in: Regenerate.
8798         * testsuite/gc_orphan_section_test.cc: New file.
8799         * testsuite/gc_orphan_section_test.sh: New file.
8800
8801 2010-01-06  Ian Lance Taylor  <iant@google.com>
8802
8803         PR 10980
8804         * options.h (class General_options): Add --warn-shared-textrel.
8805         * layout.cc (Layout::finish_dynamic_section): Implement
8806         --warn-shared-textrel.
8807
8808         PR 10980
8809         * options.h (class General_options): Add --warn-multiple-gp.
8810
8811 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8812
8813         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8814         $(THREADSLIB) and $(LIBDL).
8815         * Makefile.in: Rebuild.
8816
8817 2010-01-06  Ian Lance Taylor  <iant@google.com>
8818
8819         PR 10980
8820         * options.cc (General_options::parse_section_start): New function.
8821         (General_options::section_start): New function.
8822         (General_options::General_options): Initialize all members.
8823         * options.h: Include <map>
8824         (class General_options): Add --section-start.  Add section_starts_
8825         member.
8826         * layout.cc (Layout::attach_allocated_section_to_segment): If
8827         --section-start was used, set the address of the segment.  Remove
8828         local sort_sections.
8829         (Layout::relaxation_loop_body): If the address of the load segment
8830         has been set by --section-start, don't use it.
8831         * output.h (Output_segment::update_flags_for_output_section): New
8832         function.
8833         * output.cc (Output_segment::add_output_section): Call
8834         update_flags_for_output_section.
8835
8836 2010-01-05  Ian Lance Taylor  <iant@google.com>
8837
8838         PR 10980
8839         * options.h (class General_options): Add --undefined-version.
8840         * script.cc (struct Version_expression): Add was_matched_by_symbol
8841         field.
8842         (Version_script_info::matched_symbol): New function.
8843         (Version_script_info::get_symbol_version_helper): Call
8844         matched_symbol.
8845         (Version_script_info::check_unmatched_names): New function.
8846         * script.h (class Version_script_info): Update declarations.
8847         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8848
8849         * options.h (class General_options): Use DEFINE_bool_alias for
8850         allow_multiple_definition.
8851         * resolve.cc (Symbol_table::should_override): Don't test
8852         allow_multiple_definition.
8853
8854         PR 10980
8855         * options.h (class General_options): Add --cref.
8856         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8857         until after printing cref table.
8858         * cref.cc: Include "symtab.h".
8859         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8860         (Cref_table_compare::operator()): New function.
8861         (Cref_inputs::gather_cref): New function.
8862         (filecol): New static const.
8863         (Cref_inputs::print_cref): New function.
8864         (Cref::print_cref): New function.
8865         * cref.h: Include <cstdio>.
8866         (class Cref): Update declarations.
8867         * mapfile.h (Mapfile::file): New function.
8868         * object.h (class Object): Define Symbols.  Declare virtual
8869         do_get_global_symbols.
8870         (Object::get_global_symbols): New function.
8871         * object.cc (Input_objects::add_object): Pass object to cref_ if
8872         --cref.
8873         (Input_objects::archive_start): Likewise.
8874         (Input_objects::archive_stop): Likewise.
8875         (Input_objects::print_cref): New function.
8876         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8877         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8878         --cref.
8879         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8880         function.
8881         * plugin.h (class Sized_pluginobj): Update declarations.
8882
8883 2010-01-05  Ian Lance Taylor  <iant@google.com>
8884
8885         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8886         to is_default_version.  Rename insdef to insdefault.
8887         (Symbol_table::add_from_relobj): Rename def to is_default_version
8888         and local to is_forced_local.
8889         (Symbol_table::add_from_pluginobj): Likewise.
8890         (Symbol_table::add_from_dynobj): Likewise.
8891         (Symbol_table::define_special_symbol): Rename insdef to
8892         insdefault.
8893
8894 2010-01-04  Ian Lance Taylor  <iant@google.com>
8895
8896         PR 10980
8897         * options.h (class General_options): Add
8898         --allow-multiple-definition and -z muldefs.
8899         * resolve.cc (Symbol_table::should_override): Don't warn about a
8900         multiple symbol definition if --allow-multiple-definition or -z
8901         muldefs.
8902
8903         PR 10980
8904         * options.h (class General_options): Add --add-needed and
8905         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8906         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8907         error if --copy-dt-needed-entries aka --add-needed is used and
8908         would cause a change in behaviour.
8909
8910         PR 10980
8911         * options.h (class General_options): Add -G as a short version of
8912         --shared.  Add no-op options -assert, -g, and -i.
8913
8914 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8915
8916         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8917         check for .text or .gnu.linkonce.t sections.
8918         * icf.cc (Icf::find_identical_sections): Ditto.
8919         Change the detection for mangled function name within the section
8920         name.
8921         * icf.h (is_section_foldable_candidate): New function.
8922
8923 2009-12-30  Ian Lance Taylor  <iant@google.com>
8924
8925         PR 10980
8926         * options.h (class General_options): Permit two dashes with
8927         --retain-symbols-file.
8928
8929 2009-12-30  Ian Lance Taylor  <iant@google.com>
8930
8931         PR 10979
8932         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8933         don't put the file header and segment headers in the text
8934         segment.
8935
8936         PR 10979
8937         * common.cc (Sort_commons::operator()): Stabilize sort when both
8938         entries are NULL.
8939         (Symbol_table::do_allocate_commons_list): When allocating common
8940         symbols, skip a symbol which is no longer common.
8941         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8942         an object before checking its type.
8943         * testsuite/common_test_2.c: New file.
8944         * testsuite/common_test_3.c: New file.
8945         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8946         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8947         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8948         (common_test_2_pic.o, common_test_2.so): New targets.
8949         (common_test_3_pic.o, common_test_3.so): New targets.
8950         * testsuite/Makefile.in: Rebuild.
8951
8952         PR 10979
8953         * script.cc (read_input_script): If we see a new SECTIONS clause,
8954         and we have added an input section, give an error.
8955         * layout.h (class Layout): Add have_added_input_section function.
8956         Add have_added_input_section_ field.
8957         * layout.cc (Layout::Layout): Initialize
8958         have_added_input_section_.
8959         (Layout::layout): Set have_added_input_section_.
8960         (Layout::layout_eh_frame): Likewise.
8961
8962 2009-12-30  Ian Lance Taylor  <iant@google.com>
8963
8964         PR 10931
8965         * options.h (class General_options): Add --sort-common option.
8966         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8967         * common.cc (Sort_common): Add sort_order parameter to
8968         constructor.  Add sort_order_ field.
8969         (Sort_commons::operator): Check sort_order_.
8970         (Symbol_table::allocate_commons): Determine the sort order.
8971         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8972         Change all callers.
8973         (Symbol_table::do_allocate_commons_list): Likewise.
8974
8975 2009-12-30  Ian Lance Taylor  <iant@google.com>
8976
8977         PR 10916
8978         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8979         symbols from this object, don't change the visibility of an
8980         undefined symbol.
8981         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8982
8983 2009-12-30  Ian Lance Taylor  <iant@google.com>
8984
8985         PR 10861
8986         * script.h (class Version_script_info): Define Language enum.
8987         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8988         new fields globals_, locals_, and is_finalized_.
8989         * script.cc: Various formatting fixes.
8990         (class Parser_closure): Change language_stack_ from a vector of
8991         std::string to one of Version_script_info::Language.  Adjust all
8992         uses accordingly.
8993         (class Lazy_demangler): Remove.
8994         (struct Version_expression): Change language from std::string to
8995         Version_script_info::Language.
8996         (Version_script_info::Version_script_info): New function.
8997         (Version_script_info::~Version_script_info): Don't call clear.
8998         (Version_script_info::finalize): New function.
8999         (Version_script_info::build_lookup_tables): New function.
9000         (Version_script_info::build_expression_list_lookup): New
9001         function.
9002         (Version_script_info::get_symbol_version_helper): Rewrite to use
9003         lookup tables.
9004         (Version_script_info::print_expression_list): Adjust to use
9005         Version_script_info::Language.
9006         (script_push_lex_into_version_mode): Check that the version script
9007         has not been finalized.
9008         (version_script_push_lang): Change language string to
9009         Version_script_info::Language.
9010         * options.cc (Command_line::version_script): New function.
9011         * options.h (class General_options): Add finalize_dynamic_list
9012         function.  Change version_script from declaration to definition.
9013         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9014         * testsuite/version_script.map: Remove duplicate def of foo.
9015         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9016         version_script.map.
9017         * testsuite/Makefile.in: Rebuild.
9018
9019 2009-12-30  Ian Lance Taylor  <iant@google.com>
9020
9021         PR 10843
9022         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9023         if the input symbol index is 0, make the output symbol index 0.
9024
9025 2009-12-30  Ian Lance Taylor  <iant@google.com>
9026
9027         PR 10670
9028         * options.h (class General_options): Add -x/--discard-all.
9029         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9030         --discard-all.  If the local symbol needs a dynamic entry, check
9031         that before handling --discard-locals.
9032
9033 2009-12-30  Ian Lance Taylor  <iant@google.com>
9034
9035         PR 10450
9036         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9037         flags to PF_R.
9038         (Output_segment::add_output_section): Don't change the flags if
9039         the type is PT_TLS.
9040
9041         PR 10450
9042         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9043         GNU hash table if they need a dynamic value.  Otherwise, don't add
9044         them if they are defined in a dynamic object or are forced local.
9045
9046 2009-12-29  Ian Lance Taylor  <iant@google.com>
9047
9048         PR 10450
9049         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9050         .gnu.hash table for a 32-bit target.
9051
9052         PR 10450
9053         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9054         regular and a dynamic object only needs a dynamic symbol table
9055         entry if it is externally visible.
9056
9057         PR 10450
9058         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9059         constructor.  Add global_offset_table_ field.
9060         (Target_i386::got_section): Set global_offset_table_.
9061         (Target_i386::do_finalize_sections): Set global_offset_table_
9062         size.
9063         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9064         in constructor.  Add global_offset_table_ field.
9065         (Target_x86_64::got_section): Set global_offset_table_.
9066         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9067         size.
9068
9069         * layout.cc (Layout::Layout): Initialize increase_relro_.
9070         (Layout::get_output_section): Add is_relro, is_last_relro, and
9071         is_first_non_relro parameters.  Change all callers.
9072         (Layout::choose_output_section): Likewise.
9073         (Layout::add_output_section_data): Likewise.
9074         (Layout::make_output_section): Likewise.
9075         (Layout::set_segment_offsets): Clear increase_relro when using a
9076         linker script.
9077         * layout.h (class Layout): Add increase_relro method.  Add
9078         increase_relro_ field.  Update declarations.
9079         * output.cc (Output_section::Output_section): Initialize
9080         is_last_relro_ and is_first_non_relro_.
9081         (Output_segment::add_output_section): Group relro sections is
9082         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9083         (Output_segment::maximum_alignment): Remove relro handling.
9084         (Output_segment::set_section_addresses): Add increase_relro
9085         parameter.  Change all callers.  Add initial alignment to align
9086         relro sections on separate page.  Remove old relro handling.
9087         (Output_segment::set_section_list_addresses): Remove in_relro
9088         parameter.  Change all callers.
9089         (Output_segment::set_offset): Add increase parameter.  Change all
9090         callers.  Remove old relro handling.
9091         * output.h (class Output_section): Add new methods: is_last_relro,
9092         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9093         Add is_last_relro_ and is_first_non_relro_ fields.
9094         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9095         Create separate .got.plt section.  Call increase_relro.
9096         * x86_64.cc (Target_x86_64::got_section): Likewise.
9097         * testsuite/relro_script_test.t: Add .got.plt.
9098
9099         PR 10450
9100         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9101         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9102         (Layout::finalize): Call set_dynamic_symbol_size.
9103         (Layout::set_dynamic_symbol_size): New function.
9104         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9105         set_dynamic_symbol_size.
9106
9107         PR 10450
9108         * output.h (class Output_section): Add is_entsize_zero_ field.
9109         * output.cc (Output_section::Output_section): Initialize
9110         is_entsize_zero_.
9111         (Output_section::set_entsize): If two different entsizes are
9112         requested, force it to zero.
9113         (Output_section::add_input_section): Set flags for .debug_str
9114         before updating section flags.  Set entsize.
9115         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9116         and SHF_STRING if all input sections have those flags.
9117
9118 2009-12-29   Rafael Espindola  <espindola@google.com>
9119
9120         * main.cc (main): Fix the sys time reporting.
9121         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9122         reporting.
9123
9124 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9125
9126         * options.cc (General_options::parse_version): Allow -v to exit
9127         without an error if there is nothing to link.
9128
9129 2009-12-29  Ian Lance Taylor  <iant@google.com>
9130
9131         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9132         using a version of gcc before 4.1.
9133         * configure: Rebuild.
9134
9135 2009-12-28  Chris Demetriou  <cgd@google.com>
9136
9137         * attributes.cc (Output_attributes_section_data::do_write): Use
9138         std::vector::front rather than std::vector::data.
9139
9140 2009-12-28  Ian Lance Taylor  <iant@google.com>
9141
9142         * symtab.h (class Symbol_table): Add enum Defined.
9143         * resolve.cc (Symbol_table::should_override): Add defined
9144         parameter.  Change all callers.  Test whether object is NULL
9145         before calling a method on it.
9146         (Symbol_table::report_resolve_problem): Add defined parameter.
9147         Change all callers.
9148         (Symbol_table::should_override_with_special): Likewise.
9149         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9150         parameter.  Change all callers.
9151         (Symbol_table::do_define_in_output_data): Likewise.
9152         (Symbol_table::define_in_output_segment): Likewise.
9153         (Symbol_table::do_define_in_output_segment): Likewise.
9154         (Symbol_table::define_as_constant): Likewise.
9155         (Symbol_table::do_define_as_constant): Likewise.
9156         * script.h (class Symbol_assignment): Add is_defsym parameter to
9157         constructor; change all callers.
9158         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9159         parameter.  Change all callers.  Add is_defsym_ field.
9160         (class Parser_closure): Add parsing_defsym parameter to
9161         constructor; change all callers.  Add parsing_defsym accessor
9162         function.  Add parsing_defsym_ field.
9163
9164 2009-12-28  Ian Lance Taylor  <iant@google.com>
9165
9166         * gold.cc (queue_middle_tasks): Fix formatting.
9167         * object.cc (Relobj::is_section_name_included): Likewise.
9168
9169 2009-12-23  Ian Lance Taylor  <iant@google.com>
9170
9171         * i386.cc (Target_i386::do_calls_non_split): Recognize
9172         -fsplit-stack prologue for a function with a static chain.
9173         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9174         -fsplit-stack prologue when using %r11.
9175
9176 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9177
9178         * options.cc (General_options::parse_version): Make -v continue and do
9179         the link like GNU ld does.
9180
9181 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9182
9183         * Makefile.am (CCFILES): Add timer.cc.
9184         (HFILES): Add timer.h.
9185         * configure.ac: Check for sysconf and times.
9186         * main.cc: include timer.h.
9187         (main): Use Timer instead of get_run_time.
9188         * timer.cc: New.
9189         * timer.h: New.
9190         * workqueue.cc: include timer.h.
9191         (Workqueue::find_and_run_task):
9192         Report user, sys and wall time.
9193         * Makefile.in: Regenerate.
9194         * config.in: Regenerate.
9195         * configure: Regenerate.
9196
9197 2009-12-16  Doug Kwan  <dougkwan@google.com>
9198
9199         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9200         sections.
9201         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9202         relaxed input sections.
9203         * output.cc (Output_section::find_relaxed_input_section): Change
9204         return type to Output_relaxed_input_section pointer.  Adjust code
9205         for new type of relaxed_input_section_map_.
9206         * output.h (Output_section::find_relaxed_input_section): Change
9207         return type to Output_relaxed_input_section pointer.
9208         (Output_section::Output_relaxed_input_section_by_input_section_map):
9209         New type.
9210         (Output_section::relaxed_input_section_map_): Change type to
9211         Output_section::Output_relaxed_input_section_by_input_section_map.
9212         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9213         input section.
9214
9215 2009-12-15  Ian Lance Taylor  <iant@google.com>
9216
9217         * layout.cc (Layout::create_shstrtab): Only write out after input
9218         sections if we are compressing debug sections.
9219
9220 2009-12-15  Ian Lance Taylor  <iant@google.com>
9221
9222         * archive.cc (Archive::add_symbols): Only look up a symbol without
9223         a version if there is, in fact, a version.
9224
9225 2009-12-14  Ian Lance Taylor  <iant@google.com>
9226
9227         Revert -Wshadow changes, all changes from:
9228         2009-12-11  Doug Kwan  <dougkwan@google.com>
9229         2009-12-11  Nick Clifton  <nickc@redhat.com>
9230         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9231
9232 2009-12-11  Doug Kwan  <dougkwan@google.com>
9233
9234         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9235         due to -Wshadow.
9236         * attributes.cc (Object_attribute::size): Ditto.
9237         (Attributes_section_data::size): Ditto.
9238         (Attributes_section_data::Attributes_section_data): Ditto.
9239         (Output_attributes_section_data::do_write): Ditto.
9240         * attributes.h (Object_attribute::set_type): Ditto.
9241         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9242
9243 2009-12-11  Nick Clifton  <nickc@redhat.com>
9244
9245         * archive.cc: Fix shadowed variable warnings.
9246         * arm.cc: Likewise.
9247         * compressed_output.cc: Likewise.
9248         * compressed_output.h: Likewise.
9249         * configure: Likewise.
9250         * dwarf_reader.cc: Likewise.
9251         * dynobj.cc: Likewise.
9252         * dynobj.h: Likewise.
9253         * ehframe.cc: Likewise.
9254         * ehframe.h: Likewise.
9255         * errors.cc: Likewise.
9256         * expression.cc: Likewise.
9257         * fileread.cc: Likewise.
9258         * fileread.h: Likewise.
9259         * freebsd.h: Likewise.
9260         * i386.cc: Likewise.
9261         * icf.cc: Likewise.
9262         * incremental.h: Likewise.
9263         * layout.cc: Likewise.
9264         * layout.h: Likewise.
9265         * mapfile.cc: Likewise.
9266         * merge.cc: Likewise.
9267         * merge.h: Likewise.
9268         * object.cc: Likewise.
9269         * object.h: Likewise.
9270         * options.h: Likewise.
9271         * output.cc: Likewise.
9272         * output.h: Likewise.
9273         * parameters.cc: Likewise.
9274         * plugin.cc: Likewise.
9275         * powerpc.cc: Likewise.
9276         * reduced_debug_output.cc: Likewise.
9277         * reduced_debug_output.h: Likewise.
9278         * reloc.cc: Likewise.
9279         * reloc.h: Likewise.
9280         * resolve.cc: Likewise.
9281         * script-sections.cc: Likewise.
9282         * script.cc: Likewise.
9283         * script.h: Likewise.
9284         * sparc.cc: Likewise.
9285         * symtab.cc: Likewise.
9286         * symtab.h: Likewise.
9287         * target-select.cc: Likewise.
9288         * target-select.h: Likewise.
9289         * token.h: Likewise.
9290         * workqueue.cc: Likewise.
9291         * workqueue.h: Likewise.
9292         * x86_64.cc: Likewise.
9293
9294 2009-12-10  Doug Kwan  <dougkwan@google.com>
9295
9296         * arm.cc (attributes.h): New include.
9297         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9298         (Arm_relobj::~Arm_relobj): Delete object pointed by
9299         attributes_section_data_.
9300         (Arm_relobj::attributes_section_data): New method definition.
9301         (Arm_relobj::attributes_section_data_): New data member declaration.
9302         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9303         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9304         attributes_section_data_.
9305         (Arm_dynobj::attributes_section_data): New method definition.
9306         (Arm_dynobj::attributes_section_data_): New data member declaration.
9307         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9308         initialization value of may_use_blx_ to false.
9309         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9310         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9311         object attributes to compute results instead of hard-coding.
9312         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9313         Target_arm::get_secondary_compatible_arch,
9314         Target_arm::set_secondary_compatible_arch
9315         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9316         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9317         New method declarations.
9318         (Target_arm::get_aeabi_object_attribute): New method definition.
9319         (Target_arm::attributes_section_data_): New data member declaration.
9320         (read_arm_attributes_section): New template definition.
9321         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9322         (Arm_dynobj::do_read_symbols): Ditto.
9323         (Target_arm::do_finalize_sections): Merge attributes sections from
9324         input.  Check for BLX use after attributes section merging.
9325         Fix __exidx_start and __exidx_end visibility.  Create an
9326         .ARM.attributes section if necessary.
9327         (Target_arm::get_secondary_compatible_arch,
9328         Target_arm::set_secondary_compatible_arch,
9329         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9330         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9331         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9332         New method definitions.
9333
9334 2009-12-09  Ian Lance Taylor  <iant@google.com>
9335
9336         * plugin.cc (Plugin::load): Don't cast from void* to a function
9337         pointer.
9338
9339 2009-12-09  Ian Lance Taylor  <iant@google.com>
9340
9341         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9342         information fields.
9343
9344 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9345
9346         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9347         Replace two_file_shared_1.so with two_file_shared_2.so.
9348         * testsuite/Makefile.in: Regenerated.
9349
9350 2009-12-08  Doug Kwan  <dougkwan@google.com>
9351
9352         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9353         (HFILES): Add attributes.h and int_encoding.h.
9354         * Makefile.in: Regenerate.
9355         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9356         function definitions to int_encoding.cc
9357         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9358         prototypes to int_encoding.h
9359         * reduced_debug_output.cc (int_encoding.h): New include.
9360         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9361         function definitions to int_encoding.cc
9362         (insert_into_vector, read_from_pointer): Move template definitions to
9363         int_encoding.h
9364         * attributes.cc: New file.
9365         * attributes.h: New file.
9366         * int_encoding.cc: New file.
9367         * int_encoding.h: New file.
9368
9369 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9370
9371         PR gold/11055
9372         * incremental-dump.cc (dump_incremental_inputs): New.
9373         (main): Use dump_incremental_inputs.
9374
9375 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9376
9377         PR gold/10893
9378         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9379         checking elfcpp::STT_FUNC.
9380         (Target_i386::Relocate::relocate): Likewise.
9381         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9382
9383         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9384         symbols from shared libraries into normal FUNC symbols.
9385
9386         * symtab.h (Symbol): Add is_func and use it.
9387
9388 2009-12-05  Doug Kwan  <dougkwan@google.com>
9389
9390         * arm.cc (Target_arm::arm_info): Initialize new fields
9391         attributes_section and attributes_vendor.
9392         * i386.cc (Target_i386::i386_info): Same.
9393         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9394         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9395         fields attributes_section and attributes_vendor.
9396         * sparc.cc (Target_sparc::sparc_info): Same.
9397         * target.h (Target::attributes_section, Target::attributes_vendor,
9398         Target::is_attributes_section, Target::attribute_arg_type,
9399         Target::attributes_order): New method definitions.
9400         (Target::Target_info::attributes_section,
9401         Target::Target_info::attributes_vendor): New fields.
9402         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9403         virtual method definitions.
9404         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9405         attributes_section and attributes_vendor.
9406         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9407
9408 2009-12-05  Doug Kwan  <dougkwan@google.com>
9409
9410         * arm.cc: Update comments about interworking and stub generation.
9411         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9412         considered as non-PIC.
9413         (Arm_relocate_functions::base_abs): Fix formatting.
9414         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9415         of function to use GOT entry address instead of offset.
9416         (Target_arm::Scan::global): Issue an error if a symbol would need a
9417         PLT does not get one because it is untyped.  Remove code to create
9418         dynamic symbols for relative branches.
9419         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9420         takes unsigned integer instead of boolean.
9421
9422 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9423
9424         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9425         (two_file_test_LDADD): Likewise.
9426         (common_test_1_LDADD): Likewise.
9427         (exception_test_LDADD) Likewise.
9428         (weak_test_LDADD): Likewise.
9429         (many_sections_test_LDADD): Likewise.
9430         (initpri1_LDADD): Likewise.
9431         (script_test_1_LDADD): Likewise.
9432         (script_test_2_LDADD): Likewise.
9433         (justsyms_LDADD): Likewise.
9434         (binary_test_LDADD): Likewise.
9435         (large_LDADD): Likewise.
9436         * testsuite/Makefile.in: Regenerated.
9437
9438 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9439
9440         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9441         (Symbol_table::override_with_special): Likewise.
9442         (Symbol_table::add_from_object): Likewise.
9443
9444 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9445
9446         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9447         Don't set the data_offset twice.
9448
9449 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9450
9451         * testsuite/Makefile.in: Regenerate.
9452
9453 2009-12-03  Doug Kwan  <dougkwan@google.com>
9454
9455         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9456         (Target_arm::do_finalize_sections): Add parameter for symbol table
9457         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9458         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9459         parameter for symbol table pointer.
9460         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9461         an additional parameter for a pointer to symbol table.
9462         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9463         parameter for a symbol table pointer.
9464         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9465         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9466         Ditto.
9467         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9468         parameter for a symbol table pointer.
9469
9470 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9471
9472         * incremental.cc (Incremental_inputs_header)
9473         (Incremental_inputs_header_write, Incremental_inputs_entry)
9474         (Incremental_inputs_entry_write): Move ...
9475         * incremental.h (Incremental_inputs_header)
9476         (Incremental_inputs_header_write, Incremental_inputs_entry)
9477         (Incremental_inputs_entry_write): here.
9478
9479 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9480
9481         * incremental.cc (make_sized_incremental_binary): Set the target.
9482         Error if it is incompatible.
9483         * output.h (Output_file): Add filename method.
9484
9485 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9486
9487         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9488         from the get_* methods.
9489
9490 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9491
9492         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9493         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9494         Write 0 for the data_offset of scripts.
9495
9496 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9497
9498         * testsuite/Makefile.am: Add the incremental_test.sh test.
9499         * testsuite/incremental_test.sh: New.
9500         * testsuite/incremental_test_1.c: New.
9501         * testsuite/incremental_test_2.c: New.
9502
9503 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9504
9505         * incremental-dump.cc (main): Fix typos.
9506
9507 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9508
9509         PR gold/11025
9510         * incremental-dump.cc (main): Use llu to print 64 bit values.
9511
9512 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9513             H.J. Lu  <hongjiu.lu@intel.com>
9514
9515         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9516         $(LIBDL).
9517         (incremental_dump_LDADD): Likewise.
9518         * Makefile.in: Regenerated.
9519
9520 2009-11-25  Doug Kwan  <dougkwan@google.com>
9521
9522         Revert:
9523
9524         2009-11-25  Doug Kwan  <dougkwan@google.com>
9525
9526                 * arm.cc (Target_arm::Target_arm): Move method definition
9527                 outside of class definition.  Add code to handle
9528                 --target1-rel, --target1-abs and --target2= options.
9529                 (Target_arm::get_reloc_reloc_type): Change method to be
9530                 non-static and const.
9531                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9532                 New data member declaration.
9533                 (Target_arm::Scan::local, Target_arm::Scan::global,
9534                 Target_arm::Relocate::relocate,
9535                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9536                 Adjust call to Target_arm::get_real_reloc_type.
9537                 (Target_arm::get_real_reloc_type): Use command line options
9538                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9539                 * options.h (--target1-rel, --target1-abs, --target2): New
9540                 ARM-only options.
9541
9542 2009-11-25  Doug Kwan  <dougkwan@google.com>
9543
9544         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9545         class definition.  Add code to handle --target1-rel, --target1-abs
9546         and --target2= options.
9547         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9548         and const.
9549         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9550         member declaration.
9551         (Target_arm::Scan::local, Target_arm::Scan::global,
9552         Target_arm::Relocate::relocate,
9553         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9554         call to Target_arm::get_real_reloc_type.
9555         (Target_arm::get_real_reloc_type): Use command line options to
9556         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9557         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9558         options.
9559
9560 2009-11-25  Doug Kwan  <dougkwan@google.com>
9561
9562         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9563         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9564         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9565         formatting.
9566         (Arm_relocate_functions::thm_call): Replace body with a call to
9567         Arm_relocate_functions::thumb_branch_common.
9568         (Arm_relocate_functions::thm_jump24,
9569         Arm_relocate_functions::thm_xpc22): New method definitions.
9570         (Arm_relocate_functions::thumb_branch_common): New method definition.
9571         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9572         operator.
9573         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9574         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9575
9576 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9577
9578         * Makefile.am: Build incremental-dump
9579         * Makefile.in: Regenerate.
9580         * incremental-dump.cc: New.
9581         * incremental.cc (Incremental_inputs_header_data,
9582         Incremental_inputs_entry_data): Move to incremental.h
9583         * incremental.h: (Incremental_inputs_header_data,
9584         Incremental_inputs_entry_data): Move from incremental.cc
9585
9586 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9587
9588         * incremental.cc (Incremental_inputs_header,
9589         Incremental_inputs_header_write, Incremental_inputs_entry,
9590         Incremental_inputs_entry_write): Add a typedef with the data type.
9591
9592 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9593
9594         * incremental.cc (Incremental_inputs_header,
9595         Incremental_inputs_header_write, Incremental_inputs_entry,
9596         Incremental_inputs_entry_write): Update comment about which
9597         type has the filed descriptions.
9598
9599 2009-11-15  Doug Kwan  <dougkwan@google.com>
9600
9601         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9602         (Arm_relocate_functions::arm_branch_common): Change method defintion
9603         in class definition to a method declaration and update list of formal
9604         parameters.
9605         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9606         Arm_relocation_functions::jump24): Adjust call to
9607         Arm_relocate_functions::arm_branch_common.  Update list of formal
9608         parameters.
9609         (Arm_relocate_functions::xpc25): New method definition.
9610         (Arm_relocate_functions::arm_branch_common): Move method defintion
9611         out from class definition.  Use stubs for mode-switching and extending
9612         branch ranges.
9613         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9614         specially.  Change code to enable use of stubs in ARM branches.
9615
9616 2009-11-10  Doug Kwan  <dougkwan@google.com>
9617
9618         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9619         in method declaration.
9620         (Target_arm::relocate_stub): New method declaration.
9621         (Target_arm::default_target): Change to return a pointer instead of
9622         a const reference.
9623         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9624         Target_arm::default_target.
9625         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9626         method definition.
9627         (Target_arm::relocate_section): Adjust view.
9628         (Target_arm::relocate_stub): New method definition.
9629
9630 2009-11-10  Doug Kwan  <dougkwan@google.com>
9631
9632         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9633         a format warning.
9634         * incremental.cc (open_incremental_binary): Initialized local
9635         variables to avoid warnings.
9636         * object.cc (make_elf_object): Ditto.
9637         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9638         a format warning.
9639
9640 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9641
9642         PR gold/10930
9643         * testsuite/plugin_test.c: Include "config.h".
9644
9645 2009-11-09  Doug Kwan  <dougkwan@google.com>
9646
9647         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9648         (arm_symbol_value): Remove.
9649         (Arm_relocate_functions::arm_branch_common,
9650         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9651         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9652         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9653         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9654         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9655         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9656         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9657         Arm_relocate_functions::thm_mobw_abs_nc,
9658         Arm_relocate_functions::thm_mov_abs,
9659         Arm_relocate_functions::movw_prel_nc,
9660         Arm_relocate_functions::thm_movt_abs,
9661         Arm_relocate_functions::movt_prel,
9662         Arm_relocate_functions::thm_movw_prel_nc,
9663         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9664         (Target_arm::Relocate::relocate): Only decompose address into two
9665         parts if relocation type uses the thumb-bit and pass the actual
9666         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9667         calls to methods in Arm_relocate_functions for this change.
9668
9669 2009-11-08  Ian Lance Taylor  <iant@google.com>
9670
9671         PR 10925
9672         * reloc.cc: Instantiate
9673         Sized_relobj::initialize_input_to_output_maps and
9674         Sized_relobj:free_input_to_output_maps.
9675
9676 2009-11-06  Ian Lance Taylor  <iant@google.com>
9677
9678         PR 10876
9679         * defstd.cc (in_segment): Set only_if_ref true for "end".
9680
9681 2009-11-06  Doug Kwan  <dougkwan@google.com>
9682
9683         * arm.cc (class Reloc_stub): Correct a comment.
9684         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9685         (Target_arm::scan_section_for_stubs): New method declaration.
9686         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9687         Change methods from private to protected.
9688         (Target_arm::do_may_relax): New method definition.
9689         (Target_arm::do_relax, Target_arm::group_sections,
9690         Target_arm::scan_reloc_for_stub,
9691         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9692         (Target_arm::arm_input_section_map_): New data member declaration.
9693         (Target_arm::scan_reloc_for_stub,
9694         Target_arm::scan_reloc_section_for_stubs,
9695         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9696         Target_arm::do_relax): New method definitions.
9697
9698 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9699
9700         * configure.ac: Check for (struct stat)::st_mtim
9701         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9702         * config.in: Regenerate.
9703         * configure: Regenerate.
9704
9705 2009-11-05  Ian Lance Taylor  <iant@google.com>
9706
9707         PR 10910
9708         * output.cc (Output_segment::add_output_section): Add missing
9709         return statement.
9710
9711 2009-11-04  Ian Lance Taylor  <iant@google.com>
9712
9713         PR 10880
9714         * object.h (class Object): Add is_needed and set_is_needed
9715         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9716         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9717         defined in a dynamic object and referenced by a regular object,
9718         set is_needed for the dynamic object.
9719         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9720         if the file is marked with as_needed and it is not needed.
9721
9722 2009-11-04  Ian Lance Taylor  <iant@google.com>
9723
9724         PR 10887
9725         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9726         tags if data is discarded by linker script.
9727         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9728         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9729         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9730         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9731
9732 2009-11-04  Ian Lance Taylor  <iant@google.com>
9733
9734         * layout.cc (Layout::get_output_section): Add is_interp and
9735         is_dynamic_linker_section parameters.  Change all callers.
9736         (Layout::choose_output_section): Likewise.
9737         (Layout::make_output_section): Likewise.
9738         (Layout::add_output_section_data): Add is_dynamic_linker_section
9739         parameter.  Change all callers.
9740         * layout.h (class Layout): Update declarations.
9741         * output.h (class Output_section): Add is_interp, set_is_interp,
9742         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9743         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9744         generate_code_fills_at_write_ to a bitfield.
9745         * output.cc (Output_section::Output_sections): Initialize new
9746         fields.
9747         (Output_segment::add_output_section): Add do_sort parameter.
9748         Change all callers.
9749
9750 2009-11-03  Ian Lance Taylor  <iant@google.com>
9751
9752         PR 10860
9753         * options.h (class General_options): Add --warn-common.
9754         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9755         merging two common symbols.
9756         (Symbol_table::should_override): Handle --warn-common when merging
9757         a common symbol with a defined symbol.  Use report_resolve_problem
9758         for multiple definitions.
9759         (Symbol_table::report_resolve_problem): New function.
9760         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9761
9762 2009-11-03  Doug Kwan  <dougkwan@google.com>
9763
9764         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9765         stub_factory_.
9766         (Target_arm::stub_factory): New method definition.
9767         (Target_arm::new_arm_input_section,
9768         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9769         Target_arm::reloc_uses_thumb_bit): New method declarations.
9770         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9771         New type definitions.
9772         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9773         member declarations.
9774         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9775         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9776         New method definitions.
9777
9778 2009-11-03  Ian Lance Taylor  <iant@google.com>
9779
9780         * options.h (class General_options): Add --warn_constructors.
9781
9782 2009-11-03  Ian Lance Taylor  <iant@google.com>
9783
9784         PR 10893
9785         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9786         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9787
9788 2009-11-03  Ian Lance Taylor  <iant@google.com>
9789
9790         PR 10895
9791         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9792         --msgid-bugs-address.
9793         (install-pdf): New target.
9794         (install-data_yes): Look up one directory to find mkinstalldirs.
9795
9796 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9797
9798         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9799         tree.
9800
9801 2009-10-30  Doug Kwan  <dougkwan@google.com>
9802
9803         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9804
9805 2009-10-30  Doug Kwan  <dougkwan@google.com>
9806
9807         * arm.cc (Stub_addend_reader): New struct template definition
9808         and partial specializations.
9809         (Stub_addend_reader::operator()): New method definition for a
9810         partially specialized template.
9811
9812 2009-10-30  Doug Kwan  <dougkwan@google.com>
9813
9814         * arm.cc (Arm_relobj::processor_specific_flags): New method
9815         definition.
9816         (Arm_relobj::do_read_symbols): New method declaration.
9817         (Arm_relobj::processor_specific_flags_): New data member declaration.
9818         (Arm_dynobj): New class definition.
9819         (Target_arm::do_finalize_sections): Add input_objects parameter.
9820         (Target_arm::do_adjust_elf_header): New method declaration.
9821         (Target_arm::are_eabi_versions_compatible,
9822         (Target_arm::merge_processor_specific_flags): New method declaration.
9823         (Target_arm::do_make_elf_object): New overloaded method definitions
9824         and declaration.
9825         (Arm_relobj::do_read_symbols): New method definition.
9826         (Arm_dynobj::do_read_symbols): Ditto.
9827         (Target_arm::do_finalize_sections): Add input_objects parameters.
9828         Merge processor-specific flags from all input objects.
9829         (Target_arm::are_eabi_versions_compatible,
9830         Target_arm::merge_processor_specific_flags,
9831         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9832         New method definitions.
9833         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9834         Input_objects pointer type parameter.
9835         * layout.cc (Layout::finalize): Pass input objects to target's.
9836         finalize_sections function.
9837         * output.cc (Output_file_header::do_sized_write): Set ELF file
9838         header's processor-specific flags.
9839         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9840         Input_objects pointer type parameter.
9841         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9842         * target.h (Input_objects): New forward class declaration.
9843         (Target::processor_specific_flags,
9844         Target::are_processor_specific_flags_sect): New method definitions.
9845         (Target::finalize_sections): Add input_objects parameter.
9846         (Target::Target): Initialize processor_specific_flags_ and
9847         are_processor_specific_flags_set_.
9848         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9849         parameter.
9850         (Target::set_processor_specific_flags): New method definition.
9851         (Target::processor_specific_flags_,
9852         Target::are_processor_specific_flags_set_): New data member
9853         declarations.
9854         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9855         Input_objects pointer type parameter.
9856
9857 2009-10-30  Doug Kwan  <dougkwan@google.com>
9858
9859         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9860
9861 2009-10-28  Ian Lance Taylor  <iant@google.com>
9862
9863         * object.h (class Relobj): Drop options parameter from
9864         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9865         do_scan_relocs, do_relocate.  Change all callers.
9866         (class Sized_relobj): Drop options parameters from
9867         do_gc_process_relocs, do_scan_relocs, do_relocate,
9868         do_relocate_sections, relocate_sections, emit_relocs_scan,
9869         emit_relocs_scan_reltype.  Change all callers.
9870         (struct Relocate_info): Remove options field and all references to
9871         it.
9872         * reloc.h (class Read_relocs): Remove options constructor
9873         parameter and options_ field.  Change all callers.
9874         (class Gc_process_relocs, class Scan_relocs): Likewise.
9875         (class Relocate_task): Likewise.
9876         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9877         all callers.
9878         (scan_relocatable_relocs): Likewise.
9879         * target.h (class Sized_target): Remove options parameter from
9880         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9881         all callers.
9882         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9883         callers.
9884         * arm.cc: Update functions to remove options parameters.
9885         * i386.cc: Likewise.
9886         * powerpc.cc: Likewise.
9887         * sparc.cc: Likewise.
9888         * x86_64.cc: Likewise.
9889         * testsuite/testfile.cc: Likewise.
9890
9891 2009-10-28  Doug Kwan  <dougkwan@google.com>
9892
9893         * arm.cc (Arm_relobj): New class definition.
9894         (Arm_relobj::scan_sections_for_stubs,
9895         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9896         New method definitions.
9897
9898 2009-10-28  Cary Coutant  <ccoutant@google.com>
9899
9900         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9901         (Plugin::cleanup_done_): New member.
9902         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9903         (Plugin_manager::cleanup_done_): Remove.
9904         (Plugin_manager::add_input_file): Edit error message.
9905         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9906         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9907
9908 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9909
9910         * fileread.cc: (File_read::View::~View): Use the new
9911         data_ownership_ filed.
9912         (File_read::~File_read): Dispose the new whole_file_view_.
9913         (File_read::open): Mmap the whole file if needed.
9914         (File_read::open): Use whole_file_view_ instead of contents_.
9915         (File_read::find_view): Use whole_file_view_ if applicable.
9916         (File_read::do_read): Use whole_file_view_ instead of contents_.
9917         (File_read::make_view): Use whole_file_view_ instead of contents_,
9918         update File_read::View::View call.
9919         (File_read::find_or_make_view): Update File_read::View::View
9920         call.
9921         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9922         remove contents_
9923         (File_read::View::Data_ownership): New enum.
9924         (File_read::View::View): Replace bool mapped_ with Data_ownership
9925         argument.
9926         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9927         (File_read::View::data_ownership_): New field.
9928         (File_read::contents_): Remove (replaced by whole_file_view_).
9929         (File_read::whole_file_view_): New field.
9930         * options.h (class General_options): Add --keep-files-mapped.
9931
9932 2009-10-27  Cary Coutant  <ccoutant@google.com>
9933
9934         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9935         * testsuite/Makefile.am (plugin_test_5): New test case.
9936         * testsuite/Makefile.in: Regenerate.
9937
9938 2009-10-25  Doug Kwan  <dougkwan@google.com>
9939
9940         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9941         from private to protected to allow access by child class.
9942         (Sized_relobj::do_relocate_sections): New method declaration.
9943         (Sized_relobj::relocate_sections): Virtualize.
9944         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9945         Sized_relobj::relocate_sections.  Instantiate template explicitly
9946         for different target sizes and endianity.
9947
9948 2009-10-24  Doug Kwan  <dougkwan@google.com>
9949
9950         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9951         (Arm_input_section::as_arm_input_section): New method.
9952         (Arm_output_section): New class definition.
9953         (Arm_output_section::create_stub_group,
9954         Arm_output_section::group_sections): New method definitions.
9955
9956 2009-10-22  Doug Kwan  <dougkwan@google.com>
9957
9958         * arm.cc (Arm_input_section): New class definition.
9959         (Arm_input_section::init, Arm_input_section:do_write,
9960         Arm_input_section::set_final_data_size,
9961         Arm_input_section::do_reset_address_and_file_offset): New method
9962         definitions.
9963
9964 2009-10-21  Doug Kwan  <dougkwan@google.com>
9965
9966         * arm.cc (Stub_table, Arm_input_section): New forward class
9967         declarations.
9968         (Stub_table): New class defintion.
9969         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9970         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9971         New method definition.
9972
9973 2009-10-21  Doug Kwan  <dougkwan@google.com>
9974
9975         * arm.cc: Update copyright comments.
9976         (Target_arm): New forward class template declaration.
9977         (Arm_address): New type.
9978         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9979         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9980         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9981         constants.
9982         (Insn_template): Same.
9983         (DEF_STUBS): New macro.
9984         (Stub_type): New enum type.
9985         (Stub_template): New class definition.
9986         (Stub): Same.
9987         (Reloc_stub): Same.
9988         (Stub_factory): Same.
9989         (Target_arm::Target_arm): Initialize may_use_blx_ and
9990         should_force_pic_veneer_.
9991         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9992         Target_arm::should_force_pic_veneer,
9993         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9994         Target_arm::using_thumb_only, Target_arm:;default_target): New
9995         method defintions.
9996         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9997         New data member declarations.
9998         (Insn_template::size, Insn_template::alignment): New method defintions.
9999         (Stub_template::Stub_template): New method definition.
10000         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10001         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10002         (Stub_factory::Stub_factory): New method definition.
10003         * gold.h (string_hash): New template.
10004         * output.h (Input_section_specifier::hash_value): Use
10005         gold::string_hash.
10006         (Input_section_specifier::string_hash): Remove.
10007         * stringpool.cc (Stringpool_template::string_hash): Use
10008         gold::string_hash.
10009
10010 2009-10-20  Doug Kwan  <dougkwan@google.com>
10011
10012         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10013         symbols of relaxed input sections.
10014         * output.h (Output_section::find_relaxed_input_section): Make
10015         method public.
10016
10017 2009-10-16  Doug Kwan  <dougkwan@google.com>
10018
10019         * dynobj.cc (Versions::Versions): Initialize version_script_.
10020         Only insert base version symbol definition for a shared object
10021         if version script defines any version versions.
10022         (Versions::define_base_version): New method definition.
10023         (Versions::add_def): Check that base version is not needed.
10024         (Versions::add_need): Define base version lazily.
10025         * dynobj.h (Versions::define_base_version): New method declaration.
10026         (Versions::needs_base_version_): New data member declaration.
10027         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10028         (check_DATA): Add no_version_test.stdout.
10029         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10030         New make rules.
10031         * testsuite/Makefile.in: Regenerate.
10032         * testsuite/no_version_test.c: New file.
10033         * testsuite/no_version_test.sh: Ditto.
10034
10035 2009-10-16  Doug Kwan  <dougkwan@google.com>
10036
10037         * expression.cc (class Segment_start_expression): New class definition.
10038         (Segment_start_expression::value): New method definition.
10039         (script_exp_function_segment_start): Return a new
10040         Segment_start_expression.
10041         * gold/script-c.h (script_saw_segment_start_expression): New function
10042         prototype.
10043         * script-sections.cc (Script_sections::Script_sections): Initialize
10044         SAW_SEGMENT_START_EXPRESSION_ to false.
10045         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10046         and -Tbbs options to specify section addresses if given in
10047         command line and no SEGMENT_START expression is seen in a script.
10048         * script-sections.h (Script_sections::saw_segment_start_expression,
10049         Script_sections::set_saw_segment_start_expression): New method
10050         definition.
10051         (Script_sections::saw_segment_start_expression_): New data member
10052         declaration.
10053         * script.cc (script_saw_segment_start_expression): New function.
10054         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10055         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10056         script_test_7.sh and script_test_8.sh.
10057         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10058         script_test_8.stdout.
10059         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10060         (script_test_6, script_test_6.stdout, script_test_7,
10061         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10062         * Makefile.in: Regenerate.
10063         * testsuite/script_test_6.sh: New file.
10064         * testsuite/script_test_6.t: Same.
10065         * testsuite/script_test_7.sh: Same.
10066         * testsuite/script_test_7.t: Same.
10067         * testsuite/script_test_8.sh: Same.
10068
10069 2009-10-16  Doug Kwan  <dougkwan@google.com>
10070
10071         * output.cc (Output_segment::set_section_list_address): Cast
10072         expressions to unsigned long long type to avoid format warnings.
10073
10074 2009-10-15  Ian Lance Taylor  <iant@google.com>
10075
10076         * script.cc (Script_options::add_symbol_assignment): Always add a
10077         dot assignment to script_sections_.
10078         * script-sections.cc (Script_sections::add_dot_assignment):
10079         Initialize if necessary.
10080
10081         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10082         program headers with no load segment if there is a linker script.
10083
10084         * layout.cc (Layout::set_segment_offsets): Align the file offset
10085         to the segment aligment for -N or -n with no load segment.
10086         * output.cc (Output_segment::add_output_section): Don't crash if
10087         the first section is a TLS section.
10088         (Output_segment::set_section_list_addresses): Print an error
10089         message if the address moves backward in a linker script.
10090         * script-sections.cc
10091         (Output_section_element_input::set_section_addresses): Don't
10092         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10093         (Orphan_output_section::set_section_addresses): Likewise.
10094
10095 2009-10-15  Doug Kwan  <dougkwan@google.com>
10096
10097         * layout.cc (Layout::finish_dynamic_section): Generate tags
10098         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10099         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10100         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10101
10102 2009-10-14  Ian Lance Taylor  <iant@google.com>
10103
10104         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10105         fields.
10106         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10107         data_shdr fields of relinfo.
10108         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10109         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10110         R_386_TLS_LDO_32, adjust based on section flags.
10111         (Target_i386::Relocate::fix_up_ldo): Remove.
10112
10113 2009-10-13  Ian Lance Taylor  <iant@google.com>
10114
10115         Add support for -pie.
10116         * options.h (class General_options): Add -pie and
10117         --pic-executable.
10118         (General_options::output_is_position_independent): Test -pie.
10119         (General_options::output_is_executable): Return true if not shared
10120         and not relocatable.
10121         (General_options::output_is_pie): Remove.
10122         * options.cc (General_options::finalize): Reject incompatible uses
10123         of -pie.
10124         * gold.cc (queue_middle_tasks): A -pie link is not static.
10125         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10126         * symtab.cc (Symbol::final_value_is_known): Return false if
10127         output_is_position_independent.
10128         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10129         output_is_position_independent.
10130         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10131         output_is_position_independent.
10132         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10133         output_is_position_independent.
10134         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10135         two_file_pie_test.
10136         (basic_pie_test.o, basic_pie_test): New targets.
10137         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10138         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10139         (two_file_pie_test): New target.
10140         * testsuite/Makefile.in: Rebuild.
10141         * README: Remove note saying that -pie is not supported.
10142
10143 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10144
10145         * options.h (class General_options): Add -init and -fini.
10146         * layout.cc (Layout::finish_dynamic_section): Emit
10147         given init and fini functions.
10148
10149 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10150
10151         * gc.h (gc_process_relocs): Check if icf is enabled using new
10152         function.
10153         * gold.cc (queue_initial_tasks): Likewise.
10154         (queue_middle_tasks): Likewise.
10155         * object.cc (do_layout): Likewise.
10156         * symtab.cc (is_section_folded): Likewise.
10157         * main.cc (main): Likewise.
10158         * reloc.cc (Read_relocs::run): Likewise.
10159         (Sized_relobj::do_scan_relocs): Likewise.
10160         * icf.cc (is_function_ctor_or_dtor): New function.
10161         (Icf::find_identical_sections): Check if function is ctor or dtor when
10162         safe icf is chosen.
10163         * options.h (General_options::icf): Change option to be an enum.
10164         (Icf_status): New enum.
10165         (icf_enabled): New method.
10166         (icf_safe_folding): New method.
10167         (set_icf_status): New method.
10168         (icf_status_): New variable.
10169         * (options.cc) (General_options::finalize): Set icf_status_.
10170         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10171         icf_test and icf_keep_unique_test to use the --icf enum flag.
10172         * testsuite/icf_safe_test.sh: New file.
10173         * testsuite/icf_safe_test.cc: New file.
10174
10175 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10176
10177         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10178         includes to gc.h and icf.h.
10179         * arm.cc: Include gc.h.
10180         * gold.cc: Likewise.
10181         * i386.cc: Likewise.
10182         * powerpc.cc: Likewise.
10183         * sparc.cc: Likewise.
10184         * x86_64.cc: Likewise.
10185         * gc.h: Include icf.h.
10186
10187 2009-10-11  Ian Lance Taylor  <iant@google.com>
10188
10189         * plugin.cc: Include "gold.h" before other header files.
10190
10191 2009-10-10  Chris Demetriou  <cgd@google.com>
10192
10193         * options.h (Input_file_argument::Input_file_type): New enum.
10194         (Input_file_argument::is_lib_): Replace with...
10195         (Input_file_argument::type_): New member.
10196         (Input_file_argument::Input_file_argument): Take Input_file_type
10197         'type' rather than boolean 'is_lib' as second argument.
10198         (Input_file_argument::is_lib): Use type_.
10199         (Input_file_argument::is_searched_file): New function.
10200         (Input_file_argument::may_need_search): Handle is_searched_file.
10201         * options.cc (General_options::parse_library): Support -l:filename.
10202         (General_options::parse_just_symbols): Update for Input_file_argument
10203         changes.
10204         (Command_line::process): Likewise.
10205         * archive.cc (Archive::get_file_and_offset): Likewise.
10206         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10207         * script.cc (read_script_file, script_add_file): Likewise.
10208         * fileread.cc (Input_file::Input_file): Likewise.
10209         (Input_file::will_search_for): Handle is_searched_file.
10210         (Input_file::open): Likewise.
10211         * readsyms.cc (Read_symbols::get_name): Likewise.
10212         * testsuite/Makefile.am (searched_file_test): New test.
10213         * testsuite/Makefile.in: Regenerate.
10214         * testsuite/searched_file_test.cc: New file.
10215         * testsuite/searched_file_test_lib.cc: New file.
10216
10217 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10218             Ian Lance Taylor  <iant@google.com>
10219
10220         * descriptor.cc: Include <cstdio> and "binary-io.h".
10221         (Descriptors::open): Open the files in binary mode always.
10222         * script.cc (Lex::get_token): Treat \r as whitespace.
10223
10224 2009-10-09  Ian Lance Taylor  <iant@google.com>
10225
10226         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10227
10228 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10229             Ian Lance Taylor  <iant@google.com>
10230
10231         * configure.ac: Check for readv function also.
10232         * fileread.cc (readv): Define if not HAVE_READV.
10233         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10234         does not exist.
10235         * config.in: Regenerate.
10236         * configure: Regenerate.
10237
10238 2009-10-09  Doug Kwan  <dougkwan@google.com>
10239
10240         * layout.cc (Layout::make_output_section): Call target hook to make
10241         ordinary output section.
10242         (Layout::finalize): Adjust parameter list of call the
10243         Target::may_relax().
10244         * layout.h (class Layout::section_list): New method.
10245         * merge.h (Output_merge_base::entsize): Change visibility to public.
10246         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10247         New methods.
10248         (Output_merge_string::do_is_string): New method.
10249         * object.cc (Sized_relobj::do_setup): renamed from
10250         Sized_relobj::set_up.
10251         * object.h (Sized_relobj::adjust_shndx,
10252         Sized_relobj::initializ_input_to_output_maps,
10253         Sized_relobj::free_input_to_output_maps): Change visibilities to
10254         protected.
10255         (Sized_relobj::setup): Virtualize.
10256         (Sized_relobj::do_setup): New method declaration.
10257         (Sized_relobj::invalidate_section_offset,
10258         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10259         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10260         * options.cc (parse_int): New function.
10261         * options.h (parse_int): New declaration.
10262         (DEFINE_int): New macro.
10263         (stub_group_size): New option.
10264         * output.cc (Output_section::Output_section): Initialize memebers
10265         merge_section_map_, merge_section_by_properties_map_,
10266         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10267         (Output_section::add_input_section): Handled deferred code-fill
10268         generation and remove an old comment.
10269         (Output_section::add_relaxed_input_section): New method definition.
10270         (Output_section::add_merge_input_section): Use merge section by
10271         properties map to speed to search.  Update merge section maps
10272         as appropriate.
10273         (Output_section::build_relaxation_map): New method definition.
10274         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10275         Same.
10276         (Output_section::relax_input_section): Renamed to
10277         Output_section::convert_input_sections_to_relaxed_sections and change
10278         interface to take a vector of pointers to relaxed sections.
10279         (Output_section::find_merge_section,
10280         Output_section::find_relaxed_input_section): New method definitions.
10281         (Output_section::is_input_address_mapped,
10282         Output_section::output_offset, Output_section::output_address):
10283         Use output section data maps to speed up searching.
10284         (Output_section::find_starting_output_address): Add comments.
10285         (Output_section::do_write,
10286         Output_section::write_to_postprocessing_buffer): Do code-fill
10287         generation as appropriate.
10288         (Output_section::get_input_sections): Invalidate relaxed input section
10289         map.
10290         (Output_section::restore_states): Adjust type of checkpoint .
10291         Invalidate relaxed input section map.
10292         * output.h (Output_merge_base): New class declaration.
10293         (Input_section_specifier): New class defintion.
10294         (class Output_relaxed_input_section) Change base class to
10295         Output_section_data_build.
10296         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10297         base class initializer.
10298         (Output_section::add_relaxed_input_section): New method declaration.
10299         (Output_section::Input_section): Change visibility to protected.
10300         (Output_section::Input_section::relobj,
10301         Output_section::Input_section::shndx): Handle relaxed input sections.
10302         Output_section::input_sections) Change visibility to protected.  Also
10303         define overload to return a non-const pointer.
10304         (Output_section::Merge_section_properties): New class defintion.
10305         (Output_section::Merge_section_by_properties_map,
10306         Output_section::Output_section_data_by_input_section_map,
10307         Output_section::Relaxation_map): New types.
10308         (Output_section::relax_input_section): Rename method to
10309         Output_section::convert_input_sections_to_relaxed_sections and change
10310         interface to take a vector of relaxed section pointers.
10311         (Output_section::find_merge_section,
10312         Output_section::find_relaxed_input_section,
10313         Output_section::build_relaxation_map,
10314         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10315         New method declarations.
10316         (Output_section::merge_section_map_
10317         Output_section::merge_section_by_properties_map_,
10318         Output_section::relaxed_input_section_map_,
10319         Output_section::is_relaxed_input_section_map_valid_,
10320         Output_section::generate_code_fills_at_write_): New data members.
10321         * script-sections.cc
10322         (Output_section_element_input::set_section_addresses): Call
10323         current_data_size and addralign methods of relaxed input sections.
10324         (Orphan_output_section::set_section_addresses): Call current_data_size
10325         and addralign methods of relaxed input sections.
10326         * symtab.cc (Symbol_table::compute_final_value): Extract template
10327         from the body of Symbol_table::sized_finalize_symbol.
10328         (Symbol_table::sized_finalized_symbol): Call
10329         Symbol_table::compute_final_value.
10330         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10331         (Symbol_table::compute_final_value): New templated method declaration.
10332         * target.cc (Target::do_make_output_section): New method defintion.
10333         * target.h (Target::make_output_section): New method declaration.
10334         (Target::relax): Add more parameters for input objects, symbol table
10335         and layout.  Adjust call to do_relax.
10336         (Target::do_make_output_section): New method declaration.
10337         (Target::do_relax): Add parameters for input objects, symbol table
10338         and layout.
10339
10340 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10341
10342         * pread.c: Include stdio.h.
10343
10344 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10345
10346         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10347         defined.
10348
10349 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10350
10351         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10352         Change read_shndx type to unsigned int.
10353         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10354         int.
10355         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10356         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10357         Change read_shndx type to unsigned int.
10358         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10359         int.
10360         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10361         * layout.cc (Layout::create_symtab_sections): Cast the result of
10362         local_symcount * symsize to off_t in the gold_assert.
10363
10364 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10365
10366         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10367         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10368         R_ARM_BASE_ABS.
10369         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10370         (Arm_relocate_functions::thm_abs5): New function.
10371         (Arm_relocate_functions::abs12): New function.
10372         (Arm_relocate_functions::abs16): New function.
10373         (Arm_relocate_functions::base_abs): New function.
10374         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10375         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10376         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10377         R_ARM_BASE_ABS.
10378         (Scan::global): Likewise.
10379         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10380         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10381         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10382         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10383         R_ARM_BASE_ABS.
10384
10385 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10386
10387         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10388         (Arm_relocate_functions::movt_prel): New function.
10389         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10390         (Arm_relocate_functions::thm_movt_prel): New function.
10391         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10392         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10393         (Scan::global, Relocate::relocate): Likewise.
10394         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10395
10396 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10397
10398         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10399         Incremental_checker.
10400         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10401         unsigned int.
10402         (class Incremental_inputs_header): New class.
10403         (Incremental_inputs_header_writer): Edit comment.
10404         (Incremental_inputs_entry): New class.
10405         (Incremental_inputs_entry_writer): Edit comment.
10406         (Sized_incremental_binary::do_find_incremental_inputs_section):
10407         Add *strtab_shndx parameter, fill it.
10408         (Sized_incremental_binary::do_check_inputs): New method.
10409         (Incremental_checker::can_incrementally_link_output_file): Use
10410         Sized_incremental_binary::check_inputs.
10411         (Incremental_inputs::report_command_line): Save command line in
10412         command_line_.
10413         * incremental.h:
10414         (Incremental_binary::find_incremental_inputs_section): New
10415         method.
10416         (Incremental_binary::do_find_incremental_inputs_section): Add
10417         strtab_shndx parameter.
10418         (Incremental_binary::do_check_inputs): New pure virtual method.
10419         (Sized_incremental_binary::do_check_inputs): Declare.
10420         (Incremental_checker::Incremental_checker): Add incremental_inputs
10421         parameter, use it to initialize incremental_inputs_.
10422         (Incremental_checker::incremental_inputs_): New field.
10423         (Incremental_checker::command_line): New method.
10424         (Incremental_checker::inputs): New method.
10425         (Incremental_checker::command_line_): New field.
10426
10427 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10428
10429         * incremental.cc: Include <cstdarg> and "target-select.h".
10430         (vexplain_no_incremental): New function.
10431         (explain_no_incremental): New function.
10432         (Incremental_binary::error): New method.
10433         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10434         method.
10435         (make_sized_incremental_binary): New function.
10436         (open_incremental_binary): New function.
10437         (can_incrementally_link_file): Add checks if output is ELF and has
10438         inputs section.
10439         * incremental.h: Include "elfcpp_file.h" and "output.h".
10440         (Incremental_binary): New class.
10441         (Sized_incremental_binary): New class.
10442         (open_incremental_binary): Declare.
10443         * object.cc (is_elf_object): Use
10444         elfcpp::Elf_recognizer::is_elf_file.
10445         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10446         * output.h (Output_file::filesize): New method.
10447
10448 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10449
10450         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10451         New function.
10452         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10453         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10454         function.
10455         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10456         function.
10457         (Arm_relocate_functions::movw_abs_nc): New function.
10458         (Arm_relocate_functions::movt_abs): New function.
10459         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10460         (Arm_relocate_functions::thm_movt_abs): New function.
10461         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10462         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10463         (Scan::global): Likewise.
10464         (Relocate::relocate): Likewise.
10465         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10466
10467 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10468
10469         * arm.cc (Arm_relocate_functions::got_prel) New function.
10470         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10471         (Relocate::relocate): Likewise.
10472         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10473
10474 2009-10-06  Ian Lance Taylor  <iant@google.com>
10475
10476         * options.h (class General_options): Define
10477         split_stack_adjust_size parameter.
10478         * object.h (class Object): Add uses_split_stack_ and
10479         has_no_split_stack_ fields.  Add uses_split_stack and
10480         has_no_split_stack accessor functions.  Declare
10481         handle_split_stack_section.
10482         (class Reloc_symbol_changes): Define.
10483         (class Sized_relobj): Define Function_offsets.  Declare
10484         split_stack_adjust, split_stack_adjust_reltype, and
10485         find_functions.
10486         * object.cc (Object::handle_split_stack_section): New function.
10487         (Sized_relobj::do_layout): Call handle_split_stack_section.
10488         * dynobj.cc (Sized_dynobj::do_layout): Call
10489         handle_split_stack_section.
10490         * reloc.cc (Sized_relobj::relocate_sections): Call
10491         split_stack_adjust for executable sections in split_stack
10492         objects.  Pass reloc_map to relocate_section.
10493         (Sized_relobj::split_stack_adjust): New function.
10494         (Sized_relobj::split_stack_adjust_reltype): New function.
10495         (Sized_relobj::find_functions): New function.
10496         * target-reloc.h: Include "object.h".
10497         (relocate_section): Add reloc_symbol_changes parameter.  Change
10498         all callers.
10499         * target.h (class Target): Add calls_non_split method.  Declare
10500         do_calls_non_split virtual method.  Declare match_view and
10501         set_view_to_nop.
10502         * target.cc: Include "elfcpp.h".
10503         (Target::do_calls_non_split): New function.
10504         (Target::match_view): New function.
10505         (Target::set_view_to_nop): New function.
10506         * gold.cc (queue_middle_tasks): Give an error if mixing
10507         split-stack and non-split-stack objects with -r.
10508         * i386.cc (Target_i386::relocate_section): Add
10509         reloc_symbol_changes parameter.
10510         (Target_i386::do_calls_non_split): New function.
10511         * x86_64.cc (Target_x86_64::relocate_section): Add
10512         reloc_symbol_changes parameter.
10513         (Target_x86_64::do_calls_non_split): New function.
10514         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10515         parameter.
10516         * powerpc.cc (Target_powerpc::relocate_section): Add
10517         reloc_symbol_changes parameter.
10518         * sparc.cc (Target_sparc::relocate_section): Add
10519         reloc_symbol_changes parameter.
10520         * configure.ac: Call AM_CONDITIONAL for the default target.
10521         * configure: Rebuild.
10522         * testsuite/Makefile.am (TEST_AS): New variable.
10523         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10524         (check_DATA): Add split_i386 and split_x86_64 files.
10525         (SPLIT_DEFSYMS): Define.
10526         (split_i386_[1234n].o): New targets.
10527         (split_i386_[124]): New targets.
10528         (split_i386_[1234r].stdout): New targets.
10529         (split_x86_64_[1234n].o): New targets.
10530         (split_x86_64_[124]): New targets.
10531         (split_x86_64_[1234r].stdout): New targets.
10532         (MOSTLYCLEANFILES): Add new executables.
10533         * testsuite/split_i386.sh: New file.
10534         * testsuite/split_x86_64.sh: New file.
10535         * testsuite/split_i386_1.s: New file.
10536         * testsuite/split_i386_2.s: New file.
10537         * testsuite/split_i386_3.s: New file.
10538         * testsuite/split_i386_4.s: New file.
10539         * testsuite/split_i386_n.s: New file.
10540         * testsuite/split_x86_64_1.s: New file.
10541         * testsuite/split_x86_64_2.s: New file.
10542         * testsuite/split_x86_64_3.s: New file.
10543         * testsuite/split_x86_64_4.s: New file.
10544         * testsuite/split_x86_64_n.s: New file.
10545         * testsuite/testfile.cc (Target_test): Update relocation_section
10546         function.
10547         * testsuite/Makefile.in: Rebuild.
10548
10549 2009-10-06  Ian Lance Taylor  <iant@google.com>
10550
10551         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10552         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10553         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10554         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10555         the address on ldo_addrs_.
10556         (Target_i386::Relocate::fix_up_ldo): New function.
10557
10558 2009-10-06   Rafael Espindola  <espindola@google.com>
10559
10560         * plugin.cc (add_input_library): New.
10561         (Plugin::load): Add add_input_library to tv.
10562         (Plugin_manager::add_input_file): Add the is_lib argument.
10563         (add_input_file): Update call to Plugin_manager::add_input_file.
10564         (add_input_library): New.
10565         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10566
10567 2009-09-30  Doug Kwan  <dougkwan@google.com>
10568
10569         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10570         symbol and call Symbol::may_need_copy_reloc to determine if
10571         a copy reloc is needed.
10572         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10573         nocopyreloc is given in command line.
10574         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10575         given in command line.
10576         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10577         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10578         of the removed Target_i386::may_need_copy_reloc.
10579         * options.h (copyreloc): New option with default value false.
10580         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10581         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10582         instead of the removed Target_powerpc::may_need_copy_reloc.
10583         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10584         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10585         instead of the removed Target_sparc::may_need_copy_reloc.
10586         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10587         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10588         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10589         instead of the removed Target_x86_64::may_need_copy_reloc.
10590
10591 2009-09-30  Ian Lance Taylor  <iant@google.com>
10592
10593         * object.h (class Object): Remove target_ field, and target,
10594         sized_target, and set_target methods.
10595         (Object::sized_target): Remove.
10596         (class Sized_relobj): Update declarations.  Remove sized_target.
10597         * object.cc (Sized_relobj::setup): Remove target parameter.
10598         Change all callers.
10599         (Input_objects::add_object): Don't do anything with the target.
10600         (make_elf_sized_object): Add punconfigured parameter.  Change all
10601         callers.  Set or test parameter target.
10602         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10603         Change all callers.
10604         * parameters.cc (Parameters::set_target): Change parameter type to
10605         be non-const.
10606         (Parameters::default_target): Remove.
10607         (set_parameters_target): Change parameter type to be non-const.
10608         (parameters_force_valid_target): New function.
10609         (parameters_clear_target): New function.
10610         * parameters.h (class Parameters): Update declarations.  Remove
10611         default_target method.  Add sized_target and clear_target
10612         methods.  Change target_ to be non-const.
10613         (set_parameters_target): Update declaration.
10614         (parameters_force_valid_target): Declare.
10615         (parameters_clear_target): Declare.
10616         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10617         as NULL if we aren't searching.
10618         (Add_symbols::run): Don't check for compatible target.
10619         * fileread.cc (Input_file::open_binary): Call
10620         parameters_force_valid_target.
10621         * gold.cc (queue_middle_tasks): Likewise.
10622         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10623         set_target on object.
10624         * dynobj.h (class Sized_dynobj): Update declarations.
10625         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10626         make_elf_object returns NULL.
10627         (Archive::include_member): Don't check whether object target is
10628         compatible.
10629         * output.cc (Output_section::add_input_section): Get target from
10630         parameters.
10631         (Output_section::relax_input_section): Likewise.
10632         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10633         parameters.
10634         (Sized_relobj::do_scan_relocs): Likewise.
10635         (Sized_relobj::relocate_sections): Likewise.
10636         * resolve.cc (Symbol_table::resolve): Likewise.
10637         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10638         parameter.  Change all callers.
10639         (Symbol_table::add_from_object): Get target from parameters.
10640         (Symbol_table::add_from_relobj): Don't check object target.
10641         (Symbol_table::add_from_dynobj): Likewise.
10642         (Symbol_table::define_special_symbol): Get target from
10643         parameters.
10644         * symtab.h (class Symbol_table): Update declaration.
10645         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10646         parameter.  Change all callers.  Clear parameter target.
10647         (Binary_test): Test target here.
10648         * testsuite/object_unittest.cc (gold_testsuite): Remove
10649         target_test_pointer parameter.  Change all callers.
10650         (Object_test): Test target here.
10651
10652 2009-09-26  Ian Lance Taylor  <iant@google.com>
10653
10654         * testsuite/initpri1.c: Don't try to use constructor priorities if
10655         compiling with gcc before 4.3.
10656
10657 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10658
10659         * testsuite/retain_symbols_file_test.sh (check_present): Change
10660         output file name to retain_symbols_file_test.stdout.
10661         (check_absent): Likewise.
10662
10663 2009-09-18  Craig Silverstein  <csilvers@google.com>
10664
10665         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10666         * options.cc: Include <cerrno> and <fstream>.
10667         (General_options::finalize): Parse -retain-symbols-file tag.
10668         * options.h: New flag.
10669         (General_options): New method should_retain_symbol, new
10670         variable symbols_to_retain.
10671         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10672         should_retain_symbol map.
10673         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10674         * testsuite/Makefile.in: Regenerate.
10675         * testsuite/retain_symbols_file_test.sh: New file.
10676
10677 2009-09-18  Nick Clifton  <nickc@redhat.com>
10678
10679         * po/es.po: Updated Spanish translation.
10680
10681 2009-09-17  Doug Kwan  <dougkwan@google.com>
10682
10683         * debug.h (DEBUG_RELAXATION): New constant.
10684         (DEBUG_ALL): Add DEBUG_RELAXATION.
10685         (debug_string_to_enum): Add relaxation debug option.
10686         * layout.cc
10687         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10688         Layout::Relaxation_debug_check::read_sections,
10689         Layout::Relaxation_debug_check::read_sections): New method definitions.
10690         (Layout::Layout): Initialize data members
10691         record_output_section_data_from_scrips_,
10692         script_output_section_data_list_ and relaxation_debug_check_.
10693         (Layout::save_segments, Layout::restore_segments,
10694         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10695         Layout::relaxation_loop_body): New method definitions.
10696         (Layout::finalize): Support relaxation.  Move section layout code to
10697         Layout::relaxation_loop_body.
10698         (Layout::set_asection_address_from_script): Move code for orphan
10699         section placement out.
10700         (Layout::place_orphan_sections_in_script): New method definition.
10701         * layout.h (Output_segment_headers, Output_file_header):
10702         New forward class declarations.
10703         (Layout::~Layout): Define.
10704         (Layout::new_output_section_data_from_script): New method definition.
10705         (Layout::place_orphan_sections_in_script): New method declaration.
10706         (Layout::Segment_states): New type declaration.
10707         (Layout::save_segments, Layout::restore_segments,
10708         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10709         Layout::relaxation_loop_body): New method declarations.
10710         (Layout::Output_section_data_list): New type declaration.
10711         (Layout::Relaxation_debug_check): New class definition.
10712         (Layout::record_output_section_data_from_script_,
10713         Layout::script_output_section_data_list_, Layout::segment_states_,
10714         Layout::relaxation_debug_check_): New data members.
10715         * output.cc: (Output_section_headers::do_size): New method definition.
10716         (Output_section_headers::Output_section_headers): Move size
10717         computation to Output_section_headers::do_size.
10718         (Output_segment_headers::do_size): New method definition.
10719         (Output_file_header::Output_file_header): Move size computation to
10720         Output_file_header::do_size and call it.
10721         (Output_file_header::do_size): New method definition.
10722         (Output_data_group::Output_data_group): Adjust call to
10723         Output_section_data.
10724         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10725         (Output_symtab_xindex::do_write): Add array bound check.
10726         (Output_section::Input_section::print_to_mapfile): Handle
10727         RELAXED_INPUT_SECTION_CODE.
10728         (Output_section::Output_section): Initialize data member checkpoint_.
10729         (Output_section::~Output_section): Delete checkpoint object pointed
10730         by checkpoint_.
10731         (Output_section::add_input_section): Always add an Input_section if
10732         relaxing.
10733         (Output_section::add_merge_input_section): Add assert.
10734         (Output_section::relax_input_section): New method definition.
10735         (Output_section::set_final_data_size): Set load address to zero for
10736         an unallocated section.
10737         (Output_section::do_address_and_file_offset_have_reset_values):
10738         New method definition.
10739         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10740         Handle relaxed input section.
10741         (Output_section::sort_attached_input_sections): Checkpoint input
10742         section list lazily.
10743         (Output_section::get_input_sections): Change type of input_sections to
10744         list of Simple_input_section pointers.  Checkpoint input section list
10745         lazily.  Also handle relaxed input sections.
10746         (Output_section::add_input_section_for_script): Take a reference to
10747         a Simple_input_section object instead of Relobj pointer and section
10748         index as parameter.  Handle relaxed input sections.
10749         (Output_section::save_states, Output_section::restore_states): New
10750         method definitions.
10751         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10752         (Output_data::is_data_size_fixed): New method definition.
10753         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10754         if it is fixed.
10755         (Output_data::address_and_file_offset_have_reset_values): New method
10756         definition.
10757         (Output_data::do_address_and_file_offset_have_reset_values): New method
10758         definition.
10759         (Output_data::set_data_size): Check that data size is not fixed.
10760         (Output_data::fix_data_size): New method definition.
10761         (Output_data::is_data_size_fixed_): New data member.
10762         (Output_section_headers::set_final_data_size): New method definition.
10763         (Output_section_headers::do_size): New method declaration.
10764         (Output_segment_headers::set_final_data_size): New method definition.
10765         (Output_segment_headers::do_size): New method declaration.
10766         (Output_file_header::set_final_data_size)::New method definition.
10767         (Output_file_header::do_size)::New method declaration.
10768         (Output_section_data::Output_section_data): Add new parameter
10769         is_data_size_fixed and use it to fix data size.
10770         (Output_data_const::Output_data_const): Adjust call to base class
10771         constructor and fix data size.
10772         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10773         base class constructor and fix data size.
10774         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10775         base class constructor and fix data size.
10776         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10777         class constructor and fix data size.
10778         (Output_data_group::set_final_data_size): New method definition.
10779         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10780         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10781         class constructor and fix data size.
10782         (Output_relaxed_input_section): New class definition.
10783         (Output_section::Simple_input_section): New class definition.
10784         (Output_section::get_input_sections): Adjust parameter list.
10785         (Output_section::add_input_section_for_script): Same.
10786         (Output_section::save_states, Output_section::restore_states,
10787         Output_section::do_address_and_file_offset_have_reset_values,
10788         (Output_section::Input_section::Input_section): Handle
10789         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10790         Output_relaxed_input_section.
10791         (Output_section::Input_section::is_input_section,
10792         Output_section::Input_section::set_output_section): Handle relaxed
10793         input section.
10794         (Output_section::Input_section::is_relaxed_input_section,
10795         Output_section::Input_section::output_section_data,
10796         Output_section::Input_section::relaxed_input_section): New method
10797         definitions.
10798         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10799         value.
10800         (Output_section::Input_section::u1_): Update comments.
10801         (Output_section::Input_section::u2_): Add new union member poris.
10802         (Output_section::Checkpoint_output_section): New classs definition.
10803         (Output_section::relax_input_section): New method declaration.
10804         (Output_section::checkpoint_): New data member.
10805         (Output_segment): Update comments.
10806         (Output_segment::Output_segment): Un-privatize copy constructor.
10807         (Output_segment::operator=): Un-privatize.
10808         * script-sections.cc (Output_section_element::Input_section_list):
10809         Change element type to Output_section::Simple_input_section.
10810         (Output_section_element_dot_assignment::set_section_addresses):
10811         Register output section data for relaxation clean up.
10812         (Output_data_exression::Output_data_expression): Adjust call to base
10813         constructor to fix data size.
10814         (Output_section_element_data::set_section_addresses): Register
10815         Output_data_expression object for relaxation clean up.
10816         (struct Input_section_info): Replace Relobj pointer and section index
10817         pair with Output_section::Simple_input_section and Convert struct to a
10818         class.
10819         (Input_section_sorter::operator()): Adjust access to
10820         Input_section_info data member to use accessors.
10821         (Output_section_element_input::set_section_addresses): Use layout
10822         parameter.  Adjust code to use Output_section::Simple_input_section
10823         and Input_secction_info classes.  Register filler for relaxation
10824         clean up.
10825         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10826         and section index pair with Output_section::Simple_input_section
10827         class.  Adjust code accordingly.
10828         (Phdrs_element::release_segment): New method definition.
10829         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10830         segment list.
10831         (Script_sections::release_segments): New method definition.
10832         * gold/script-sections.h (Script_sections::release_segments): New
10833         method declaration.
10834         * gold/target.h (Target::may_relax, Target::relax,
10835         Target::do_may_relax, Target::do_relax): New method definitions.
10836
10837 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10838
10839         * arm.cc (has_signed_unsigned_overflow): New function.
10840         (Arm_relocate_functions::abs8): New function.
10841         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10842         (Target_arm::Scan::global): Likewise.
10843         (Target_arm::relocate::relocate): Likewise.
10844         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10845         Likewise.
10846
10847 2009-09-16  Cary Coutant  <ccoutant@google.com>
10848
10849         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10850         * testsuite/Makefile.in: Regenerate.
10851
10852 2009-09-11  Nick Clifton  <nickc@redhat.com>
10853
10854         * po/gold.pot: Updated by the Translation project.
10855
10856 2009-09-08  Cary Coutant  <ccoutant@google.com>
10857
10858         * output.cc (Output_file::open): Add execute permission to empty file.
10859         * testsuite/Makefile.am (permission_test): New test.
10860         * testsuite/Makefile.in: Regenerate.
10861
10862 2009-09-02  Ian Lance Taylor  <iant@google.com>
10863
10864         * output.cc (Output_file::resize): Call map_no_anonymous rather
10865         than map.
10866
10867 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10868
10869         * gold.cc: Include "incremental.h".
10870         (queue_initial_tasks): Call Incremental_checker methods.
10871         * incremental.cc: Include "output.h".
10872         (Incremental_checker::can_incrementally_link_output_file): New
10873         method.
10874         * incremental.h (Incremental_checker): New class.
10875
10876         * output.cc (Output_file::open_for_modification): New method.
10877         (Output_file::map_anonymous): Changed return type to bool.  Record
10878         map in base_ field.
10879         (Output_file::map_no_anonymous): New method, broken out of map.
10880         (Output_file::map): Use map_no_anonymous and map_anonymous.
10881         * output.h (class Output_file): Update declarations.
10882
10883 2009-08-24  Cary Coutant  <ccoutant@google.com>
10884
10885         * options.h (Command_line::Pre_options): New class.
10886         (Command_line::pre_options): New member.
10887         * options.cc (gold::options::ready_to_register): New variable.
10888         (One_option::register_option): Do nothing if not registering options.
10889         Assert if same short option registered twice.
10890         (General_options::General_options): Turn off option registration when
10891         done constructing.
10892         (Command_line::Pre_options::Pre_options): New constructor.
10893
10894 2009-08-24  Cary Coutant  <ccoutant@google.com>
10895
10896         * options.h (General_options::no_keep_memory): Remove incorrect
10897         short option.
10898
10899 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10900
10901         * Makefile.am (am__skiplex, am__skipyacc): New.
10902         * Makefile.in: Regenerate.
10903
10904 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10905
10906         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10907         (INCLUDES): ... this.
10908         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10909         (AM_CPPFLAGS): Renamed from ...
10910         (INCLUDE): ... this.
10911         * Makefile.in, testsuite/Makefile.in: Regenerate.
10912
10913         * Makefile.in: Regenerate.
10914         * aclocal.m4: Likewise.
10915         * config.in: Likewise.
10916         * configure: Likewise.
10917         * testsuite/Makefile.in: Likewise.
10918
10919         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10920         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10921         * Makefile.in: Regenerate.
10922         * testsuite/Makefile.in: Regenerate.
10923
10924 2009-08-19  Cary Coutant  <ccoutant@google.com>
10925
10926         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10927         symbols in shared libraries overridden by hidden or internal symbols
10928         in the main program.
10929
10930 2009-08-19  Chris Demetriou  <cgd@google.com>
10931
10932         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10933         checking source file names in error messages.
10934
10935 2009-08-18  Doug Kwan  <dougkwan@google.com>
10936
10937         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10938         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10939         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10940         an elfcpp::Ehdr as parameter.
10941         * object.cc (Object::set_target): Remove the version that looks up
10942         a target and sets it.
10943         (Sized_relobj::setup): Take a Target object instead of
10944         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10945         (make_elf_sized_object): Find target and ask target to
10946         make an ELF object.
10947         * object.h: (Object::set_target): Remove the version that looks up
10948         a target and sets it.
10949         (Sized_relobj::setup): Take a Target object instead of
10950         an elfcpp:Ehdr as parameter.
10951         * target.cc: Include dynobj.h.
10952         (Target::do_make_elf_object_implementation): New.
10953         (Target::do_make_elf_object): New.
10954         * target.h (Target::make_elf_object): New template declaration.
10955         (Target::do_make_elf_object): New method declarations.
10956         (Target::do_make_elf_object_implementation): New template declaration.
10957
10958 2009-08-14  Ian Lance Taylor  <iant@google.com>
10959
10960         * gold.h (FUNCTION_NAME): Define.
10961         (gold_unreachable): Use FUNCTION_NAME.
10962
10963 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10964
10965         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10966         symbol in the --keep-unique list is not found.
10967
10968 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10969
10970         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10971         been maked as --keep-unique.
10972         (Icf::unfold_section): New function.
10973         * icf.h (Icf::unfold_section): New function.
10974         * options.h (General_options::keep_unique): New option.
10975         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10976         * testsuite/Makefile.in: Regenerate.
10977         * testsuite/icf_keep_unique_test.sh: New file.
10978         * testsuite/icf_keep_unique_test.cc: New file.
10979
10980 2009-08-12  Cary Coutant  <ccoutant@google.com>
10981
10982         PR 10471
10983         * resolve.cc (Symbol_table::resolve): Check for references from
10984         dynamic objects to hidden and internal symbols.
10985         * testsuite/Makefile.am (hidden_test.sh): New test.
10986         * testsuite/Makefile.in: Regenerate.
10987         * testsuite/hidden_test.sh: New script.
10988         * testsuite/hidden_test_1.c: New test source.
10989         * testsuite/hidden_test_main.c: New test source.
10990
10991 2009-08-11  Doug Kwan  <dougkwan@google.com>
10992
10993         * arm.cc: Update comments.
10994         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10995         segment to locate the .ARM.exidx section if present.
10996
10997 2009-08-09  Doug Kwan  <dougkwan@google.com>
10998
10999         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11000         patch.
11001
11002 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11003         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11004         compiler warnings.
11005
11006 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11007
11008         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11009         valid tls_segment only for non-debug-section relocations.
11010         * testsuite/Makefile.am: Add gc_tls_test.
11011         * testsuite/Makefile.in: Regenerate.
11012         * testsuite/gc_tls_test.cc: New file.
11013         * testsuite/gc_tls_test.sh: New file.
11014
11015 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11016
11017         * icf.cc: New file.
11018         * icf.h: New file.
11019         * Makefile.am (CCFILES): Add icf.cc.
11020         (HFILES): Add icf.h
11021         * Makefile.in: Regenerate.
11022         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11023         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11024         section, symbol and addend information for the relocs.
11025         * gold.cc (queue_middle_tasks): Call identical code folding.
11026         * gold.h: Add defines for multimap.
11027         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11028         to the call of finalize_local_symbols.
11029         * main.cc (main): Create object of class Icf.
11030         * object.cc (Sized_relobj::do_layout): Allow this function to be
11031         called twice during icf.
11032         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11033         to sections marked as identical by icf.
11034         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11035         when available.
11036         (Sized_relobj::do_section_entsize): New function.
11037         * object.h (Object::section_entsize): New function.
11038         (Object::do_section_entsize): New pure virtual function.
11039         (Relobj::finalize_local_symbols): Add new parameter.
11040         (Relobj::do_section_entsize): New function.
11041         * options.h (General_options::icf): New option.
11042         (General_options::icf_iterations): New option.
11043         (General_options::print_icf_sections): New option.
11044         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11045         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11046         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11047         icf.
11048         * symtab.cc (Symbol_table::is_section_folded): New function.
11049         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11050         to sections marked as identical by icf.
11051         * symtab.h (Symbol_table::set_icf): New function.
11052         (Symbol_table::icf): New function.
11053         (Symbol_table::is_section_folded): New function.
11054         (Symbol_table::icf_): New data member.
11055         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11056         * testsuite/Makefile.am: Add commands to build icf_test.
11057         * testsuite/Makefile.in: Regenerate.
11058         * testsuite/icf_test.sh: New file.
11059         * testsuite/icf_test.cc: New file.
11060
11061 2009-07-24  Chris Demetriou  <cgd@google.com>
11062
11063         * layout.cc (is_compressible_debug_section): Fix incorrect
11064         comment about compressed section names.
11065
11066 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11067
11068         PR 10419
11069         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11070
11071 2009-07-16  Ian Lance Taylor  <iant@google.com>
11072
11073         PR 10400
11074         * layout.h: #include <map>.
11075         (class Kept_section): Change from struct to class.  Add accessors
11076         and setters.  Add section size to Comdat_group mapping.  Change
11077         Comdat_group to std::map.  Add is_comdat_ field.  Add
11078         linkonce_size field in union.
11079         (class Layout): Update declaration of find_or_add_kept_section.
11080         Don't declare find_kept_object.
11081         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11082         parameter.  Add object, shndx, is_comdat, and is_group_name
11083         parameters.  Change all callers.  Adjust for new Kept_section.
11084         (Layout::find_kept_object): Remove.
11085         * object.cc (Sized_relobj::include_section_group): Update use of
11086         Kept_section.  Rename secnum to shndx.  Only record
11087         Kept_comdat_section if sections are the same size.
11088         (Sized_relobj::include_linkonce_section): Update use of
11089         Kept_section.  Only record Kept_comdat_section if sections are the
11090         same size.  Set size of linkonce section.
11091         (Sized_relobj::map_to_kept_section): Update call to
11092         get_kept_comdat_section.
11093         * object.h (class Sized_relobj): Rename fields in
11094         Kept_comdat_section to drop trailing underscores; change object
11095         field to Relobj*.  Change Kept_comdat_section_table to store
11096         struct rather than pointer.
11097         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11098         Add kept_object and kept_shndx parameters.  Change all callers.
11099         (Sized_relobj::get_kept_comdat_section): Change return type to
11100         bool.  Add kept_object and kept_shndx parameters.  Change all
11101         callers.
11102         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11103         Layout::find_or_add_kept_section.
11104
11105 2009-07-09  Ian Lance Taylor  <iant@google.com>
11106
11107         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11108         Reserve space in the hash table.
11109
11110 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11111
11112         * fileread.cc (File_read::get_mtime): New method.
11113         * fileread.h (Timespec): New structure.
11114         (File_read::get_mtime): New method.
11115         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11116         Renamed from timestamp_nsec.
11117         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11118         Elf_Xword.
11119         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11120         timestamp_nsec.
11121         (Incremental_inputs::report_archive): Save mtime; style fix.
11122         (Incremental_inputs::report_obejct): Save mtime; style fix.
11123         (Incremental_inputs::report_script): Save mtime; style fix.
11124         (Incremental_inputs::finalize_inputs): Style fix.
11125         (Incremental_inputs::finalize): Style fix.
11126         (Incremental_inputs::create_input_section_data): Store inputs
11127         mtime.
11128         * incremental.h (Incremental_inputs::report_script): Add mtime
11129         argument.
11130         (Incremental_inputs::Input_info::Input_info): Intialize only one
11131         union member.
11132         (Incremental_inputs::Input_info::archive): Move to nameless
11133         union.
11134         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11135         (Incremental_inputs::Input_info::script): Move to nameless union.
11136         (Incremental_inputs::mtime): New field.
11137         * script.cc (read_input_script): Pass file mtime to
11138         Incremental_input.
11139         * script.h (Script_info::inputs): Style fix.
11140
11141 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11142
11143         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11144         instead of 32.
11145
11146 2009-06-24  Ian Lance Taylor  <iant@google.com>
11147
11148         PR 10156
11149         * layout.cc (Layout::choose_output_section): If we find an
11150         existing section, update the flags.
11151         (Layout::create_notes): New function, broken out of
11152         Layout::finalize.
11153         (Layout::finalize): Don't create note sections.
11154         (Layout::create_note): Don't crash if linker script discards
11155         section.
11156         (Layout::create_gold_note): Likewise.
11157         (Layout::create_build_id): Likewise.  Don't set
11158         after_input_sections on the section.
11159         (Layout::create_executable_stack_info): Remove target parameter.
11160         Change caller.
11161         * layout.h (class Layout): Declare create_notes.  Update
11162         declaration of create_executable_stack_info.
11163         * gold.cc (queue_middle_tasks): Call create_notes.
11164         * output.cc (Output_section::update_flags_for_input_section): Move
11165         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11166         invalid.
11167         * output.h (Output_data::mark_address_invalid): New function.
11168         (class Output_section): Only declare, not define,
11169         update_flags_for_input_section.  Remove set_flags.
11170
11171 2009-06-24  Ian Lance Taylor  <iant@google.com>
11172
11173         * script-sections.cc (Output_section_definition::
11174         set_section_addresses): Rename shadowing local load_address to
11175         laddr.
11176
11177 2009-06-24  Ian Lance Taylor  <iant@google.com>
11178
11179         PR 10244
11180         * reloc.cc (relocate_sections): Skip empty relocation sections.
11181
11182 2009-06-23  Ian Lance Taylor  <iant@google.com>
11183
11184         PR 10156
11185         * layout.cc (Layout::create_note): Use choose_output_section
11186         rather than make_output_section.
11187
11188 2009-06-23  Ian Lance Taylor  <iant@google.com>
11189
11190         PR 10237
11191         * options.cc (General_options::parse_V): Set printed_version_.
11192         (General_options::General_options): Initialize printed_version_.
11193         * options.h (class General_options): Add printed_version_ field.
11194         * gold.cc (queue_initial_tasks): If there are no input files,
11195         don't give a fatal error if we printed the version information.
11196         (queue_middle_tasks): If using -r with a shared object, give a
11197         fatal error rather than an ordinary error.
11198
11199 2009-06-23  Ian Lance Taylor  <iant@google.com>
11200
11201         PR 10219
11202         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11203         (Layout::make_output_section): Set have_stabstr_section_ if we see
11204         a .stab*str section.
11205         (Layout::finalize): Call link_stabs_sections.
11206         (Layout::link_stabs_sections): New file.
11207         * layout.h (class Layout): Add have_stabstr_section_ field.
11208         Declare link_stabs_sections.
11209
11210 2009-06-23  Doug Kwan  <dougkwan@google.com>
11211
11212         * Makefile.am (libgold_a_LIBADD): New.
11213         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11214         * Makefile.in: Regenerate.
11215         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11216         * configure: Regenerate.
11217         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11218         * fileread.cc: Include sys/state.h
11219         * gold.h: Declare memmem and strndup if found missing.
11220         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11221
11222 2009-06-23  Ian Lance Taylor  <iant@google.com>
11223
11224         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11225         * configure: Rebuild.
11226
11227 2009-06-23  Ian Lance Taylor  <iant@google.com>
11228
11229         PR 10147
11230         * object.cc (Object::section_contents): Don't try to get a view if
11231         the section has length zero.
11232         (Object::handle_gnu_warning_section): If the section is empty, use
11233         the name of the section as the warning.
11234
11235 2009-06-23  Ian Lance Taylor  <iant@google.com>
11236
11237         PR 10133
11238         * stringpool.h (class Stringpool_template): Add optimize_ field.
11239         (Stringpool_template::set_optimize): New function.
11240         * stringpool.cc (Stringpool_template::Stringpool_template):
11241         Initialize optimize_ field.
11242         (Stringpool_template::set_string_offsets): Test local optimize
11243         fild rather than parameter.
11244         * layout.cc (Layout::Layout): Call set_optimize on the section
11245         name stringpool.
11246
11247 2009-06-22  Ian Lance Taylor  <iant@google.com>
11248
11249         PR 10030
11250         * yyscript.y: Parse TARGET.
11251         * script.cc (script_set_target): New function.
11252         * script-c.h (script_set_target): Declare.
11253         * options.cc (General_options::string_to_object_format): Rename
11254         from string_to_object_format in anonymous namespace.  Change
11255         callers.
11256         * options.h (class General_options): Declare
11257         string_to_object_format.
11258
11259 2009-06-22  Ian Lance Taylor  <iant@google.com>
11260
11261         * script-sections.cc (Script_sections::create_segments): Don't put
11262         program headers in a PT_LOAD segment if -n or -N.
11263
11264 2009-06-22  Ian Lance Taylor  <iant@google.com>
11265
11266         PR 10141
11267         * options.h (class General_options): Add -z lazy and -z now.  Sort
11268         -z options into alphabetical order.
11269         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11270
11271 2009-06-21  Ian Lance Taylor  <iant@google.com>
11272
11273         * layout.cc (Layout::make_output_section): Call
11274         Target::new_output_section.
11275         (Layout::attach_allocated_section_to_segment): Put large section
11276         sections in a separate load segment with the large segment flag
11277         set.
11278         (Layout::segment_precedes): Sort large data segments after other
11279         load segments.
11280         (align_file_offset): New static function.
11281         (Layout::set_segment_offsets): Use align_file_offset.
11282         * output.h (class Output_section): Add is_small_section_ and
11283         is_large_section_ fields.
11284         (Output_section::is_small_section): New function.
11285         (Output_section::set_is_small_section):  New function.
11286         (Output_section::is_large_section): New function.
11287         (Output_section::set_is_large_section): New function.
11288         (Output_section::is_large_data_section): New function.
11289         (class Output_segment): Add is_large_data_segment_ field.
11290         (Output_segment::is_large_data_segment): New function.
11291         (Output_segment::set_is_large_data_segment): New function.
11292         * output.cc (Output_section::Output_section): Initialize new
11293         fields.
11294         (Output_segment::Output_segment): Likewise.
11295         (Output_segment::add_output_section): Add assertion that large
11296         data sections always go in large data segments.  Force small data
11297         sections to the end of the list of data sections.  Force small BSS
11298         sections to the start of the list of BSS sections.  For large BSS
11299         sections to the end of the list of BSS sections.
11300         * symtab.h (class Symbol): Declare is_common_shndx.
11301         (Symbol::is_defined): Check Symbol::is_common_shndx.
11302         (Symbol::is_common): Likewise.
11303         (class Symbol_table): Define enum Commons_section_type.  Update
11304         declarations.  Add small_commons_ and large_commons_ fields.
11305         * symtab.cc (Symbol::is_common_shndx): New function.
11306         (Symbol_table::Symbol_table): Initialize new fields.
11307         (Symbol_table::add_from_object): Put small and large common
11308         symbols in the right list.
11309         (Symbol_table::sized_finalized_symbol): Check
11310         Symbol::is_common_shndx.
11311         (Symbol_table::sized_write_globals): Likewise.
11312         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11313         common symbol lists.  Don't call do_allocate_commons_list if the
11314         list is empty.
11315         (Symbol_table::do_allocate_commons_list): Remove is_tls
11316         parameter.  Add comons_section_type parameter.  Change all
11317         callers.  Handle small and large common symbols.
11318         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11319         Symbol::is_common_shndx.
11320         * resolve.cc (symbol_to_bits): Likewise.
11321         * target.h (Target::small_common_shndx): New function.
11322         (Target::small_common_section_flags): New function.
11323         (Target::large_common_shndx): New function.
11324         (Target::large_common_section_flags): New function.
11325         (Target::new_output_section): New function.
11326         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11327         small_common_section_flags, and large_common_section_flags
11328         fields.
11329         (Target::do_new_output_section): New virtual function.
11330         * arm.cc (Target_arm::arm_info): Initialize new fields.
11331         * i386.cc (Target_i386::i386_info): Likewise.
11332         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11333         Likewise.
11334         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11335         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11336         (Target_x86_64::do_new_output_section): New function.
11337         * configure.ac: Define conditional MCMODEL_MEDIUM.
11338         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11339         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11340         (large_LDFLAGS): Define.
11341         * testsuite/large.c: New file.
11342         * testsuite/testfile.cc (Target_test::test_target_info):
11343         Initialize new fields.
11344         * configure, testsuite/Makefile.in: Rebuild.
11345
11346 2009-06-05  Doug Kwan  <dougkwan@google.com>
11347
11348         * Makefile.am (CCFILES): Add target.cc.
11349         * Makefile.in: Regenerate.
11350         * i386.cc (class Target_i386): Define new virtual method to
11351         override do_is_local_label_name in parent.
11352         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11353         local symbols if --discard-locals or -X is given.
11354         * options.h (class General_options): Declare new options
11355         '--discard-locals' and '-X' for discarding locals.
11356         * target.h (class Target): Define new methods is_local_label_name.
11357         Declare new virtual method do_is_local_label_name.
11358         * target.cc: New file.
11359         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11360         (check_SCRIPTS): Add discard_locals_test.sh.
11361         (check_DATA): Add discard_local_tests.syms.
11362         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11363         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11364         * testsuite/Makefile.in: Regenerate.
11365         * testsuite/discard_locals_test.c: New file.
11366         * testsuite/discard_locals_test.sh: Same.
11367
11368 2009-06-05  Doug Kwan  <dougkwan@google.com>
11369
11370         * object.cc (Sized_relobj::Sized_relobj): Initialize
11371         discarded_eh_frame_shndx_ to -1U.
11372         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11373         section.
11374         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11375         a discarded .eh_frame section.
11376         (Sized_relobj::do_finalize_local_symbols): Ditto.
11377         * object.h (class Sized_relobj): Declare new member
11378         discarded_eh_frame_shndx_.
11379         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11380         (local_labels_test.o, local_labels_test): New rules.
11381         * testsuite/Makefile.in: Regenerate.
11382
11383 2009-06-04  Doug Kwan  <dougkwan@google.com>
11384
11385         * layout.cc (Layout::section_name_mapping): Add mapping for
11386         special ARM sections.
11387
11388 2009-06-03  Doug Kwan  <dougkwan@google.com>
11389
11390         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11391         (utils::has_overflow): Same.
11392
11393 2009-06-03  Ian Lance Taylor  <iant@google.com>
11394
11395         * layout.cc (Layout::section_name_mapping): New array, replacing
11396         Layout::linkonce_mapping.
11397         (Layout::section_name_mapping_count): New variable, replacing
11398         Layout::linkonce_mapping_count.
11399         (Layout::linkonce_output_name): Remove.
11400         (Layout::output_section_name): Rewrite.
11401         * layout.h (class Layout): Rename Linkonce_mapping to
11402         Section_name_mapping, linkonce_mapping to section_name_mapping,
11403         linkonce_mapping_count to section_name_mapping_count.  Don't
11404         declare linkonce_output_name.
11405
11406 2009-06-03  Doug Kwan  <dougkwan@google.com>
11407
11408         * gold/arm.cc (namespace utils): New.
11409         (Target_arm::reloc_is_non_pic): Define new method.
11410         (class Arm_relocate_functions): New.
11411         (Target_arm::Relocate::relocate): Handle relocation types used by
11412         Android.
11413
11414 2009-06-03  Ian Lance Taylor  <iant@google.com>
11415
11416         * arm.cc (Target_arm::scan::global): Use || instead of |.
11417
11418 2009-06-02  Doug Kwan  <dougkwan@google.com>
11419
11420         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11421         issued_non_pic_error_.
11422         (class Target_arm::Scan): Declare new method check_non_pic.
11423         Define new method symbol_needs_plt_entry.
11424         Declare new data member issued_non_pic_error_.
11425         (class Target_arm::Relocate): Declare new method
11426         should_apply_static_reloc.
11427         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11428         (Target_arm::Scan::check_non_pic): Define new method.
11429         (Target_arm::Scan::local): Handle a small subset of reloc types used
11430         by Android.
11431         (Target_arm::Scan::local): Same.
11432         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11433
11434 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11435
11436         * incremental.cc (Incremental_inputs::report_command_line): Filter
11437         out --incremental-* options.
11438
11439 2009-05-29  Doug Kwan  <dougkwan@google.com>
11440
11441         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11442         template class.
11443         (class Target_arm): Update comment.
11444         (Target_arm::Target_arm): Initialize new data members GOT_,
11445         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11446         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11447         and Target_arm::rel_dyn_section.
11448         Declare new_enum Target_arm::Got_type.
11449         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11450         and DYNBSS_.
11451         Update commments for member do_dynsym_value.
11452         (Target_arm::got_size, Target_arm::plt_section,
11453         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11454         new methods inside class defintion.
11455         (Target_arm::got_section): Define new method.
11456         (Target_arm::rel_dyn_section): Same.
11457         (Output_data_plt_arm): New template class.
11458         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11459         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11460         (Output_data_plt_arm::add_entry): Same.
11461         (Output_data_plt_arm::first_plt_entry): Define new
11462         static data member for PLT instruction template.
11463         (Output_data_plt_arm::plt_entry): Same.
11464         (Output_data_plt_arm::do_write): Define new method.
11465         (Target_arm::make_plt_entry): Same.
11466         (Target_arm::do_finalize_sections): Same.
11467         (Target_arm::do_dynsym_value): Same.
11468
11469 2009-05-28  Doug Kwan  <dougkwan@google.com>
11470
11471         * Makefile.am (TARGETSOURCES): Add arm.cc.
11472         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11473         * Makefile.in: Regenerate.
11474         * arm.cc: New file.
11475         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11476
11477 2009-05-26  Doug Kwan  <dougkwan@google.com>
11478
11479         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11480         (General_options::check_excluded_libs): Strip off directories in
11481         archive name before matching like GNU ld does.
11482         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11483         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11484         (exclude_libs_test_LDFLAGS): Add linker option
11485         -Wl,--exclude-libs,libexclude_libs_test_3
11486         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11487         an explicit archive without using -l.
11488         (alt/libexclude_libs_test_3.a): New make rule.
11489         * testsuite/Makefile.in: Regenerate.
11490         * testsuite/exclude_libs_test.c : Declare lib3_default().
11491         (main): Call it.
11492         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11493         * exclude_libs_test_3.c: New file.
11494
11495 2009-05-26  Nick Clifton  <nickc@redhat.com>
11496
11497         * po/id.po: New Indonesian translation.
11498         * po/gold.pot: Updated template file.
11499
11500 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11501
11502         * testsuite/Makefile.am: Add -ffunction-sections to compile
11503         gc_comdat_test files.  Add -Wl,--gc-sections to build
11504         gc_comdat_test.
11505         * testsuite/Makefile.in: Regenerate.
11506         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11507
11508 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11509
11510         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11511         kept comdat section was garbage collected.
11512         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11513         * testsuite/Makefile.in: Regenerate.
11514         * testsuite/gc_comdat_test.sh: New file.
11515         * testsuite/gc_comdat_test_1.cc: New file.
11516         * testsuite/gc_comdat_test_2.cc: New file.
11517
11518 2009-05-19  Doug Kwan  <dougkwan@google.com>
11519
11520         * archive.cc (Archive::Archive): Move constructor from archive.h
11521         to here.  Initialize no_export_.
11522         (Archive::get_elf_object_for_member): Set no_export flag of object.
11523         * archive.h (Archive::Archive): Move constructor body to
11524         archive.cc.
11525         (Archive::no_export): New method.
11526         (Archive::no_export_): New field.
11527         * object.h (Object::Object): Initialize no_export_ to false.
11528         (Object::no_export, Object::set_no_export): New methods.
11529         (Object::no_export_): New field.
11530         * options.cc (General_options::parse_exclude_libs): New method.
11531         (General_options::check_excluded_libs) Same.
11532         * options.h (exclude_libs): New option.
11533         (General_options::check_excluded_libs): New method declaration.
11534         (General_options::excluded_libs_): New field.
11535         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11536         default or protected visibility if an object has no-export flag set.
11537         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11538         (check_SCRIPTS): Add exclude_libs_test.sh.
11539         (check_DATA): Add exclude_libs_test.syms.
11540         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11541         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11542         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11543         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11544         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11545         libexclude_libs_test_2.a): New rules.
11546         * testsuite/Makefile.in: Regenerate.
11547         * testsuite/exclude_libs_test.c: New file.
11548         * testsuite/exclude_libs_test.sh: Ditto.
11549         * testsuite/exclude_libs_test_1.c: Ditto.
11550         * testsuite/exclude_libs_test_2.c: Ditto.
11551
11552 2009-05-15  Ian Lance Taylor  <iant@google.com>
11553
11554         * configure.ac: Check for declarations for cases where libiberty.h
11555         checks HAVE_DECL_xxx.
11556         * configure, config.in: Rebuild.
11557
11558 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11559
11560         * gold.h (Incremental_argument_list): Remove (invalid) forward
11561         declaration.
11562         * incremental.cc (Incremental_inputs::report_achive): New method.
11563         (Incremental_inputs::report_object): New method.
11564         (Incremental_inputs::report_script): New method.
11565         (Incremental_inputs::finalize_inputs): New method.
11566         (Incremental_inputs::finalize): Call finalize_inputs().
11567         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11568         Create inputs entries.
11569         * incremental.h (Incremental_input_type): New enum.
11570         (Incremental_inputs::Incremental_input): Initialize new fields.
11571         (Incremental_inputs::report_inputs): New method.
11572         (Incremental_inputs::report_achive): New method.
11573         (Incremental_inputs::report_object): New method.
11574         (Incremental_inputs::report_script): New method.
11575         (Incremental_inputs::finalize_inputs): New method.
11576         (Incremental_inputs::Input_info): New struct.
11577         (Incremental_inputs::Input_info_map): New typedef.
11578         (Incremental_inputs::lock_): New field.
11579         (Incremental_inputs::Inputs_): New field.
11580         (Incremental_inputs::Inputs_map): New field.
11581         * main.cc (main): Call Incremental_input::report_inputs.
11582         * options.h (Input_argument_list): Typedef moved from
11583         Input_arguments.
11584         (Input_file_group::Files): Remove, use ::Input_argument_list.
11585         (Input_file_group::Input_argument_list): Remove, use
11586         ::Input_argument_list.
11587         * plugin.cc (Plugin_manager::add_input_file): Add error in
11588         incremental build.
11589         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11590         functions.
11591         * script.cc (read_input_script): Call
11592         Incremental_input::report_script.
11593         * script.h (Script_info): New class.
11594
11595 2009-04-27  Ian Lance Taylor  <iant@google.com>
11596
11597         * x86_64.cc (do_adjust_output_section): Set entsize to
11598         plt_entry_size.
11599
11600 2009-04-23  Elliott Hughes  <enh@google.com>
11601
11602         * output.cc (Output_file::close): After short writes, continue
11603         writing from the correct offset in the buffer being written.
11604
11605 2009-04-23  Chris Demetriou  <cgd@google.com>
11606
11607         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11608         * configure: Regenerate.
11609         * config.in: Regenerate.
11610         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11611         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11612
11613 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11614
11615         * incremental.cc (Incremental_inputs_header_data): Renamed from
11616         Incremental_input_header_data.
11617         (Incremental_inputs_header_data::data_size): New field.
11618         (Incremental_inputs_header_data::put_input_file_count): Renamed
11619         from input_file_count.
11620         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11621         from command_line_offset.
11622         (Incremental_inputs_header_data::put_reserved): Renamed from
11623         put_reserved.
11624         (Incremental_inputs_entry_data): Renamed from
11625         Incremental_input_entry_data.
11626         (Incremental_inputs_entry_data::data_size): New field.
11627         (Incremental_inputs::report_command_line): New method.
11628         (Incremental_inputs::finalize): New method.
11629         (Incremental_inputs::create_incremental_inputs_data): New method.
11630         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11631         * incremental.h: New file.
11632         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11633         (Layout::finalize): Create incremental inputs section in
11634         incremental builds.
11635         (Layout::create_incremental_info_sections): New method.
11636         * layout.h (Layout::incremental_inputs): New method.
11637         (Layout::create_incremental_info_sections): New method.
11638         (Layout::incremental_inputs_): New field.
11639         * main.cc (main): Notify Incremental_input of the command line.
11640
11641 2009-04-01  Ian Lance Taylor  <iant@google.com>
11642             Mikolaj Zalewski  <mikolajz@google.com>
11643
11644         * gold.h (reserve_unordered_map): Define, three versions, one for
11645         each version of Unordered_map.
11646         * layout.cc (Layout::Layout): Remove options parameter.  Add
11647         number_of_input_files parameter.  Don't initialize options_.
11648         Initialize number_of_input_files_ and resized_signatures_.  Move
11649         sections_are_attached_.
11650         (Layout::layout_group): Reserve space for group_signatures_.
11651         (Layout::find_or_add_kept_section): Change name parameter to be a
11652         reference.  Resize signatures_ map when it gets large enough.
11653         (Layout::layout_eh_frame): Use parameters->options() instead of
11654         this->options_.
11655         (Layout::make_output_section): Likewise.
11656         (Layout::attach_allocated_section_to_segment): Likewise.
11657         (Layout::finalize, Layout::create_executable_stack): Likewise.
11658         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11659         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11660         * layout.h (class Layout): Update declarations.  Remove options_
11661         field.  Add number_of_input_files_ and resized_signatures_
11662         fields.  Move sections_are_attached_ field.
11663         * main.cc (main): Pass number of input files to Layout
11664         constructor.  Don't pass options.
11665
11666 2009-03-30  Ian Lance Taylor  <iant@google.com>
11667
11668         * ffsll.c (ffsll): Correct implementation.
11669
11670 2009-03-27  Ian Lance Taylor  <iant@google.com>
11671
11672         * ffsll.c: New file.
11673         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11674         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11675         * ftruncate.c (ftruncate): Declare before definition.
11676         * mremap.c (mremap): Likewise.
11677         * pread.c (pread): Likewise.
11678         * configure, Makefile.in, config.in: Rebuild.
11679
11680         * mremap.c: New file.
11681         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11682         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11683         (mremap): Declare if HAVE_MREMAP is not defined.
11684         * configure, Makefile.in, config.in: Rebuild.
11685
11686 2009-03-27  Cary Coutant  <ccoutant@google.com>
11687
11688         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11689         position independent.
11690         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11691         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11692
11693 2009-03-24  Cary Coutant  <ccoutant@google.com>
11694
11695         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11696         an executable.
11697         (needs_dynamic_reloc): Likewise.
11698
11699 2009-03-24  Ian Lance Taylor  <iant@google.com>
11700
11701         * yyscript.y (file_cmd): Recognize EXTERN.
11702         (extern_name_list, extern_name_list_body): New nonterminals.
11703         * script.cc (script_add_extern): Define.
11704         * script-c.h (script_add_extern): Declare.
11705
11706 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11707
11708         * object.cc (is_elf_object): Define.
11709         * object.h (is_elf_object): Declare.
11710         * archive.cc (Archive::get_elf_object_for_member): Call
11711         is_elf_object.
11712         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11713
11714 2009-03-24  Elliott Hughes  <enh@google.com>
11715
11716         * output.cc (Output_file::map_anonymous): Define.
11717         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11718         try an anonymous one.  Report the size if the mmap fails.
11719         * output.h (class Output_file): Declare map_anonymous.
11720
11721 2009-03-24  Ian Lance Taylor  <iant@google.com>
11722
11723         * target-select.cc (instantiate_target): Don't acquire the lock if
11724         the instantiated_target_ field has already been set.
11725
11726 2009-03-23  Ian Lance Taylor  <iant@google.com>
11727
11728         * gold-threads.h (class Initialize_lock): Define.
11729         * gold-threads.cc (class Initialize_lock_once): Define.
11730         (initialize_lock_control): New static variable.
11731         (initialize_lock_pointer): New static variable.
11732         (initialize_lock_once): New static function.
11733         (Initialize_lock::Initialize_lock): Define.
11734         (Initialize_lock::initialize): Define.
11735         * target-select.h: Include "gold-threads.h".
11736         (class Target_selector): Add lock_ and initialize_lock_ fields.
11737         Don't define instantiate_target, just declare it.
11738         * target-select.cc (Target_selector::Target_selector): Initialize
11739         new fields.
11740         (Target_selector::instantiate_target): Define.
11741         * descriptors.h: Include "gold-threads.h".
11742         (class Descriptors): Add initialize_lock_ field.
11743         * descriptors.cc (Descriptors::Descriptors): Initialize new
11744         field.
11745         (Descriptors::open): Use initialize_lock_ field
11746         * errors.h (class Errors): Add initialize_lock_ field.
11747         * errors.cc (Errors::Errors): Initialize new field.
11748         (Errors::initialize_lock): Use initialize_lock_ field.
11749         * powerpc.cc (class Target_selector_powerpc): Remove
11750         instantiated_target_ field.  In do_recognize call
11751         instantiate_target rather than do_instantiate_target.  In
11752         do_instantiate_target just allocate a new target.
11753         * sparc.cc (class Target_selector_sparc): Likewise.
11754
11755         * freebsd.h: New file.
11756         * i386.cc: Include "freebsd.h".
11757         (Target_i386): Derive from Target_freebsd rather than
11758         Sized_target.
11759         (Target_selector_i386): Derive from Target_selector_freebsd rather
11760         than Target_selector.
11761         * x86_64.cc: Include "freebsd.h".
11762         (Target_x86_64): Derive from Target_freebsd rather than
11763         Sized_target.
11764         (Target_selector_x86_64): Derive from Target_selector_freebsd
11765         rather than Target_selector.
11766         * target.h (class Target): Add adjust_elf_header and
11767         do_adjust_elf_header.
11768         * output.cc (Output_file_header:: do_sized_write): Call target
11769         adjust_elf_header routine.
11770         * configure.tgt: Set targ_osabi.
11771         * configure.ac: Define GOLD_DEFAULT_OSABI.
11772         * parameters.cc (Parameters::default_target): Pass
11773         GOLD_DEFAULT_OSABI to select_target.
11774         * target-select.h (class Target_selector): Make instantiate_target
11775         protected rather than private.
11776         * Makefile.am (HFILES): Add freebsd.h.
11777         * configure, Makefile.in, config.in: Rebuild.
11778
11779         * merge.cc (do_add_input_section): Correct pend value.  Change
11780         message about last entry not being null terminated from error to
11781         warning.
11782
11783 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11784
11785         * incremental.cc: New file.
11786         * Makefile.am (CCFILES): Add incremental.cc.
11787         * Makefile.in: Rebuild.
11788
11789 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11790
11791         * layout.cc (Layout::output_section_name): Preserve names
11792         of '.note.' sections.
11793
11794 2009-03-19  Ian Lance Taylor  <iant@google.com>
11795
11796         * descriptors.cc (Descriptors::open): Check that the options are
11797         valid before using them.
11798
11799 2009-03-18  Ian Lance Taylor  <iant@google.com>
11800
11801         * script-sections.h: Include <list>.
11802         (class Script_sections): Change Sections_elements from std::vector
11803         to std::list.  Typedef public Elements_iterator.  Add
11804         orphan_section_placement_, data_segment_align_start_, and
11805         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11806         field.
11807         * script-sections.cc (class Orphan_section_placement): New class.
11808         (class Sections_element): Add virtual functions is_relro and
11809         orphan_section_init.  Remove virtual function place_orphan_here.
11810         (class Output_section_definition): Add is_relro and
11811         orphan_section_init.  Remove place_orphan_here.
11812         (class Orphan_output_section): Likewise.
11813         (Script_sections::Script_sections): Update for field changes.
11814         (Script_sections::data_segment_align): Set saw_data_segment_align_
11815         and data_segment_align_start_, not data_segment_align_index.
11816         (Script_sections::data_segment_relro_end): Check
11817         saw_data_segment_align_.  Use data_segment_align_start_ rather
11818         than data_segment_align_index_.
11819         (Script_sections::place_orphan): Rewrite to use
11820         Orphan_section_placement.
11821
11822 2009-03-17  Ian Lance Taylor  <iant@google.com>
11823
11824         * archive.cc (Archive::add_symbols): Check for a version attached
11825         to the symbol name in the archive map.
11826         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11827         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11828         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11829         (ver_test_11.a): New target.
11830         * testsuite/Makefile.in: Rebuild.
11831
11832         * configure.ac: Check for chsize and posix_fallocate.  Replace
11833         ftruncate.
11834         * ftruncate.c: New file, from gnulib.
11835         * output.cc (posix_fallocate): Define dummy version if not
11836         HAVE_POSIX_FALLOCATE.
11837         (Output_file::map): Call posix_fallocate rather than lseek and
11838         write.
11839         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11840         * configure, Makefile.in, config.in: Rebuild.
11841
11842 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11843
11844         * layout.h (Layout::create_note): Add section_name parameter.
11845         * layout.cc (Layout::create_note): Likewise.
11846         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11847
11848 2009-03-17  Ian Lance Taylor  <iant@google.com>
11849
11850         * descriptors.cc: Include "options.h".
11851         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11852         (Descriptors::open): Always use O_CLOEXEC when opening a new
11853         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11854         then set FD_CLOEXEC.
11855
11856         * sparc.cc (class Target_sparc): Add has_got_section.
11857         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11858         make sure we have a GOT section.
11859
11860         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11861         (Target_sparc::Scan::local): Likewise.
11862         (Target_sparc::Scan::global): Likewise.
11863         (Target_sparc::Relocate::relocate): Likewise.
11864         (Target_sparc::Relocate::relocate_tls): Likewise.
11865
11866         * symtab.cc (Symbol_table::define_default_version): New function,
11867         broken out of add_from_object.
11868         (Symbol_table::add_from_object): Call define_default_version.
11869         (Symbol_table::define_special_symbol): Add resolve_oldsym
11870         parameter.  Change all callers.  If the version for a symbol comes
11871         from a version script, resolve it with the symbol with the same
11872         name with no version.  Also add the symbol without a version if
11873         appropriate.
11874         (do_define_in_output_data): If resolving with oldsym, don't delete
11875         sym.
11876         (do_define_in_output_segment): Likewise.
11877         (do_define_as_constant): Likewise.
11878         * symtab.h (class Symbol_table): Update declarations.
11879
11880 2009-03-13  Ian Lance Taylor  <iant@google.com>
11881
11882         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11883         (Read_symbols::requeue): New function.
11884         (Read_symbols::do_read_symbols): If make_elf_object fails because
11885         the target type is not configured, and the file was searched for,
11886         issue a warning and retry with the next directory.
11887         (Add_symbols::run): If the file has an incompatible format, and
11888         it was searched for, requeue the Read_symbols task.  On error,
11889         release the object.
11890         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11891         dirindex parameter to constructor.  Change all callers.  Declare
11892         incompatible_warning and requeue.
11893         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11894         input_argument_ and input_group_ fields.  Add them to
11895         constructor.  Change all callers.
11896         (class Read_script): Add dirindex_ field.  Add it to constructor.
11897         Change all callers.
11898         * archive.cc (Archive::setup): Remove input_objects parameter.
11899         Change all callers.
11900         (Archive::get_file_and_offset): Likewise.
11901         (Archive::read_all_symbols): Likewise.
11902         (Archive::read_symbols): Likewise.
11903         (Archive::get_elf_object_for_member): Remove input_objects
11904         parameter.  Add punconfigured parameter.  Change all callers.
11905         (Archive::add_symbols): Change return type to bool.  Check return
11906         value of include_member.
11907         (Archive::include_all_members): Likewise.
11908         (Archive::include_member): Change return type to bool.  Return
11909         false if first included object has incompatible target.  Set
11910         included_member_ field.
11911         (Add_archive_symbols::run): If add_symbols returns false, requeue
11912         Read_symbols task.
11913         * archive.h (class Archive): Add included_member_ field.
11914         Initialize it in constructor.  Add input_file and searched_for
11915         methods.  Update declarations.
11916         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11917         input_argument_ fields.  Add them to constructor.  Change all
11918         callers.
11919         * script.cc: Include "target-select.h".
11920         (class Parser_closure): Add skip_on_incompatible_target_ and
11921         found_incompatible_target_ fields.  Add
11922         skip_on_incompatible_target parameter to constructor.  Change all
11923         callers.  Add methods skip_on_incompatible_target,
11924         clear_skip_on_incompatible_target, found_incompatible_target, and
11925         set_found_incompatible_target.
11926         (read_input_script): Add dirindex parameter.  Change all callers.
11927         If parser finds an incompatible target, requeue Read_symbols
11928         task.
11929         (script_set_symbol): Clear skip_on_incompatible_target in
11930         closure.
11931         (script_add_assertion, script_parse_option): Likewise.
11932         (script_start_sections, script_add_phdr): Likewise.
11933         (script_check_output_format): New function.
11934         * script.h (read_input_script): Update declaration.
11935         * script-c.h (script_check_output_format): Declare.
11936         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11937         (ignore_cmd): Remove OUTPUT_FORMAT.
11938         * fileread.cc (Input_file::Input_file): Add explicit this.
11939         (Input_file::will_search_for): New function.
11940         (Input_file::open): Add pindex parameter.  Change all callers.
11941         * fileread.h (class Input_file): Add input_file_argument method.
11942         Declare will_search_for.  Update declarations.
11943         * object.cc (make_elf_object): Add punconfigured parameter.
11944         Change all callers.
11945         * object.h (class Object): Make input_file public.  Add
11946         searched_for method.
11947         (make_elf_object): Update declaration.
11948         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11949         restart search.
11950         * dirsearch.h (class Dirsearch): Update declaration.
11951         * options.h (class General_options): Add --warn-search-mismatch.
11952         * parameters.cc (Parameters::is_compatible_target): New function.
11953         * parameters.h (class Parameters): Declare is_compatible_target.
11954         * workqueue.cc (Workqueue::add_blocker): New function.
11955         * workqueue.h (class Workqueue): Declare add_blocker.
11956
11957         * fileread.cc (Input_file::open): Remove options parameter.
11958         Change all callers.
11959         (Input_file::open_binary): Likewise.
11960         * script.cc (read_input_script): Likewise.
11961         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11962         options parameter from constructor.  Change all callers.
11963         (class Read_script): Likewise.
11964         * fileread.h (class Input_file): Update declarations.
11965         * script.h (read_input_script): Update declaration.
11966
11967 2009-03-10  Nick Clifton  <nickc@redhat.com>
11968
11969         * po/es.po: New Spanish translation.
11970
11971 2009-03-06  Cary Coutant  <ccoutant@google.com>
11972
11973         * options.cc (parse_short_option): Keep dash_z from registering itself.
11974
11975 2009-03-03  Ian Lance Taylor  <iant@google.com>
11976
11977         PR 9918
11978         * target-reloc.h (relocate_section): Pass output_section to
11979         relocate.
11980         * i386.cc (Target_i386::should_apply_static_reloc): Add
11981         output_section parameter.  Change all callers.
11982         (Target_i386::Relocate::relocate): Add output_section parameter.
11983         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11984         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11985         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11986         * testsuite/two_file_shared.sh: New script.
11987         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11988         (check_DATA): Add two_file_shared.dbg.
11989         (two_file_shared.dbg): New target.
11990         * testsuite/Makefile.in: Rebuild.
11991
11992 2009-03-01  Ian Lance Taylor  <iant@google.com>
11993
11994         * configure.ac: Check for byteswap.h.
11995         * configure: Rebuild.
11996         * config.in: Rebuild.
11997
11998 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11999
12000         * layout.cc (Layout::find_or_add_kept_section): New function.
12001         (Layout::add_comdat): Removed.
12002         * layout.h (struct Kept_section): Move out of class Layout.
12003         Remove trailing underscores from field names.  Add group_sections
12004         field.  Rename group_ field to is_group.  Change all uses.
12005         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12006         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12007         comdat_groups_ field.
12008         (Sized_relobj::include_section_group): Use
12009         find_or_add_kept_section and Kept_section::group_sections.
12010         (Sized_relobj::include_linkonce_section): Likewise.
12011         * object.cc (class Sized_relobj): Don't define Comdat_group or
12012         Comdat_group_table.  Remove find_comdat_group and
12013         add_comdat_group.  Remove comdat_groups_ field.
12014         * plugin.cc (include_comdat_group): Use
12015         Layout::find_or_add_kept_section.
12016
12017 2009-02-28  Ian Lance Taylor  <iant@google.com>
12018
12019         * README: --gc-sections and map files are now supported.  Document
12020         some build requirements.
12021
12022         PR 6992
12023         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12024         relocatable link set the value of the section symbol to zero.
12025         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12026         relocatable link don't include the section address in the local
12027         symbol value.
12028
12029 2009-02-27  Ian Lance Taylor  <iant@google.com>
12030
12031         PR 6811
12032         * options.h (class Search_directory): Add is_system_directory.
12033         (class General_options): Declare is_in_system_directory.
12034         * options.cc (get_relative_sysroot): Make static.
12035         (get_default_sysroot): Make static.
12036         (General_optoins::is_in_system_directory): New function.
12037         * fileread.cc (Input_file::is_in_system_directory): New function.
12038         * fileread.h (class Input_file): Declare is_in_system_directory.
12039         * object.h (class Object): Add is_in_system_directory.
12040         (class Input_objects): Remove system_library_directory_ field.
12041         * object.cc (Input_objects::add_object): Don't set
12042         system_library_directory_.
12043         (input_objects::found_in_system_library_directory): Remove.
12044         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12045         parameter.  Change all callers.
12046         (Symbol_table::sized_write_globals): Likewise.
12047         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12048         Call Object::is_in_system_directory.
12049         * symtab.h (class Symbol_table): Update declarations.
12050
12051         PR 5990
12052         * descriptors.h (Open_descriptor): Add is_on_stack field.
12053         * descriptors.cc (Descriptors::open): If the descriptor is on the
12054         top of the stack, remove it.  Initialize is_on_stack field.
12055         (Descriptors::release): Only add pod to stack if it is not on the
12056         stack already.
12057         (Descriptors::close_some_descriptor): Clear stack_next and
12058         is_on_stack fields.
12059
12060         PR 7091
12061         * output.cc (Output_section::find_starting_output_address): Rename
12062         from starting_output_address; add PADDR parameter; change return
12063         type.
12064         * output.h (class Output_section): Declare
12065         find_starting_output_address instead of starting_output_address.
12066         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12067         section symbol for which we can't find a merge section.
12068
12069         PR 9836
12070         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12071         hidden or internal, force the symbol to be local.
12072         * resolve.cc (Symbol::override_visibility): Define.
12073         (Symbol::override_base): Use override_visibility.
12074         (Symbol_table::resolve): Likewise.
12075         (Symbol::override_base_with_special): Likewise.
12076         (Symbol_table::override_with_special): If the visibility is hidden
12077         or internal, force the symbol to be local.
12078         * symtab.h (class Symbol): Add set_visibility and
12079         override_visibility.
12080         * testsuite/ver_test_1.sh: New file.
12081         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12082         (check_DATA): Add ver_test_1.syms.
12083         (ver_test_1.syms): New target.
12084         * testsuite/Makefile.in: Rebuild.
12085
12086 2009-02-25  Cary Coutant  <ccoutant@google.com>
12087
12088         * layout.cc (Layout::choose_output_section): Don't rename sections
12089         when using a linker script that has a SECTIONS clause.
12090         * Makefile.in: Regenerate.
12091
12092         * testsuite/Makefile.am (script_test_5.sh): New test case.
12093         * testsuite/Makefile.in: Regenerate.
12094         * testsuite/script_test_5.cc: New file.
12095         * testsuite/script_test_5.sh: New file.
12096         * testsuite/script_test_5.t: New file.
12097
12098 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12099
12100         * archive.cc (Archive::include_member): Update calls to add_symbols.
12101         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12102         the Layout argument.
12103         * dynobj.h (do_add_symbols): Add the Layout argument.
12104         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12105         Layout argument.
12106         * object.h (Object::add_symbols): Add the Layout argument.
12107         (Object::do_add_symbols): Add the Layout argument.
12108         (Sized_relobj::do_add_symbols): Add the Layout argument.
12109         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12110         Unify the two versions.
12111         (Add_plugin_symbols): Remove.
12112         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12113         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12114         (Add_plugin_symbols): Remove.
12115         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12116         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12117         (Add_symbols::run): Make it work with Pulginobj.
12118
12119 2009-02-06  Ian Lance Taylor  <iant@google.com>
12120
12121         * object.cc (Sized_relobj::do_layout): Make info message start
12122         with lower case letter.
12123
12124 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12125
12126         * binary.cc: Fix file comment.
12127
12128         * options.h (enum Incremental_disposition): Define.
12129         (class General_options): Add new options: --incremental,
12130         --incremental_changed, --incremental_unchanged,
12131         --incremental_unknown.  Add incremental_disposition_ and
12132         implicit_incremental_ fields.
12133         (General_options::incremental_disposition): New function.
12134         (class Position_dependent_options): Add incremental_disposition
12135         option.
12136         (Position_dependent_options::copy_from_options): Set incremental
12137         dispositions.
12138         * options.cc (General_options::parse_incremental_changed): New
12139         function.
12140         (General_options::parse_incremental_unchanged): New function.
12141         (General_options::parse_incremental_unknown): New function.
12142         (General_options::General_options): Initialize new fields
12143         incremental_disposition_ and implicit_incremental_.
12144         (General_options::finalize): Check for uasge of --incremental-*
12145         without --incremental.
12146
12147 2009-02-06  Chris Demetriou  <cgd@google.com>
12148
12149         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12150         pointer and to report location as the file name associated with
12151         the symbol.
12152         (gold_undefined_symbol_at_location): New function to replace the
12153         old gold_undefined_symbol functionality.
12154         * target-reloc.h (relocate_section): Update to use
12155         gold_undefined_symbol_at_location.
12156         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12157         Call gold_undefined_symbol function rather than gold_error.
12158         * errors.h (Errors::undefined_symbol): Take location as a
12159         string, rather than calculating it from a relocation.
12160         * errors.cc (Errors::fatal): Print "fatal error:" before the
12161         formatted message.
12162         (Errors::error, Errors::error_at_location): Print "error: "
12163         before the formatted message.
12164         (Errors::undefined_symbol): Take location as a string, rather
12165         than calculating it from a relocation.
12166         (gold_undefined_symbol_at_location): New function akin to
12167         old gold_undefined_symbol, calculates location from relocation.
12168         (gold_undefined_symbol): Change to take only a Symbol pointer
12169         and to report location as the file name associated with the symbol.
12170         * testsuite/debug_msg.sh: Update for changed error messages.
12171         * testsuite/undef_symbol.sh: Likewise.
12172
12173 2009-02-04  Duncan Sands  <baldrick@free.fr>
12174
12175         PR 9812
12176         * reduced_debug_output.h
12177         (Output_reduced_debug_abbrev_section::failed): Use format for
12178         gold_warning.
12179         (Output_reduced_debug_info_section::faild): Likewise.
12180
12181 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12182
12183         * script.cc (Lazy_demangler): New class.
12184         (Version_script_info::get_symbol_version_helper): Demangle a
12185         symbol only once.
12186
12187 2009-01-29  Cary Coutant  <ccoutant@google.com>
12188
12189         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12190         to __tls_get_addr.
12191         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12192
12193 2009-01-28  Ian Lance Taylor  <iant@google.com>
12194
12195         * version.cc (version_string): Bump to 1.9.
12196
12197         * gold.h: Include <cstring> and <stdint.h>.
12198         * version.cc: Include <cstdio>.
12199         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12200         warning.
12201         * reduced_debug_output.cc (insert_into_vector): Rename from
12202         Insert_into_vector; change all callers.  Use Swap_unaligned to
12203         avoid aliasing issue; remove union since it is unnecessary.
12204
12205 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12206
12207         * Makefile.am (CCFILES): Add gc.cc.
12208         (HFILES): Add gc.h.
12209         * Makefile.in: Regenerate.
12210         * gold.cc (Gc_runner): New class.
12211         (queue_initial_tasks): Call garbage collection related tasks
12212         when corresponding options are invoked.
12213         (queue_middle_gc_tasks): New function.
12214         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12215         processed early before laying out sections during garbage collection.
12216         * gold.h (queue_middle_gc_tasks): New function.
12217         (is_prefix_of): Move from "layout.cc".
12218         * i386.cc (Target_i386::gc_process_relocs): New function.
12219         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12220         * main.cc (main): Create object of class "Garbage_collection".
12221         * object.cc (Relobj::copy_symbols_data): New function.
12222         (Relobj::is_section_name_included): New function.
12223         (Sized_relobj::do_layout): Allow this function to be called twice
12224         during garbage collection and defer layout of section during the
12225         first call.
12226         * object.h (Relobj::get_symbols_data): New function.
12227         (Relobj::is_section_name_included): New function.
12228         (Relobj::copy_symbols_data): New function.
12229         (Relobj::set_symbols_data): New function.
12230         (Relobj::get_relocs_data): New function.
12231         (Relobj::set_relocs_data): New function.
12232         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12233         (Relobj::gc_process_relocs): New function.
12234         (Relobj::do_gc_process_relocs): New pure virtual function.
12235         (Relobj::sd_): New data member.
12236         (Sized_relobj::is_output_section_offset_invalid): New function.
12237         (Sized_relobj::do_gc_process_relocs): New function.
12238         * options.h (General_options::gc_sections): Modify to not be a no-op.
12239         (General_options::print_gc_sections): New option.
12240         * plugin.cc (Plugin_finish::run): Remove function call to
12241         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12242         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12243         * reloc.cc (Read_relocs::run): Add task to process relocs and
12244         determine unreferenced sections when doing garbage collection.
12245         (Gc_process_relocs): New class.
12246         (Sized_relobj::do_gc_process_relocs): New function.
12247         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12248         sections that are garbage collected.
12249         * reloc.h (Gc_process_relocs): New class.
12250         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12251         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12252         symbols whose corresponding sections are garbage collected.
12253         (Symbol_table::Symbol_table): Add new parameter for the garbage
12254         collection object.
12255         (Symbol_table::gc_mark_undef_symbols): New function.
12256         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12257         (Symbol_table::gc_mark_dyn_syms): New function.
12258         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12259         as garbage.
12260         (Symbol_table::add_from_object): Likewise.
12261         (Symbol_table::add_from_relobj): When building shared objects, do not
12262         treat externally visible symbols as garbage.
12263         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12264         table information for static and relocatable links.
12265         * symtab.h (Symbol_table::set_gc): New function.
12266         (Symbol_table::gc): New function.
12267         (Symbol_table::gc_mark_undef_symbols): New function.
12268         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12269         (Symbol_table::gc_mark_dyn_syms): New function.
12270         (Symbol_table::gc_): New data member.
12271         * target.h (Sized_target::gc_process_relocs): New pure virtual
12272         function.
12273         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12274         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12275
12276 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12277
12278         * options.h (General_options::gc_sections): Define as a no-op for now.
12279         (General_options::no_keep_memory): Ditto.
12280         (General_options::Bshareable): Define.
12281         * options.cc (General_options::finalize): Honor -Bshareable.
12282
12283 2009-01-20  Andreas Schwab  <schwab@suse.de>
12284
12285         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12286         read the value in the contents, since we don't use it.  Use the
12287         template endianness when writing.
12288         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12289
12290 2009-01-19  Andreas Schwab  <schwab@suse.de>
12291
12292         * configure.tgt (powerpc64-*): Fix targ_obj.
12293
12294 2009-01-15  Ian Lance Taylor  <iant@google.com>
12295
12296         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12297         local symbols when stripping all symbols.
12298
12299 2009-01-14  Cary Coutant  <ccoutant@google.com>
12300
12301         * output.cc (Output_reloc): Add explicit instantiations.
12302
12303 2009-01-14  Cary Coutant  <ccoutant@google.com>
12304
12305         * archive.cc (Archive::get_elf_object_for_member): Remove call
12306         to File_read::claim_for_plugin.
12307         * descriptors.cc (Descriptors::open): Remove reference to
12308         is_claimed.
12309         (Descriptors::claim_for_plugin): Remove.
12310         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12311         (Descriptors::is_claimed): Remove.
12312         (claim_descriptor_for_plugin): Remove.
12313         * fileread.cc (File_read::claim_for_plugin): Remove.
12314         * fileread.h (File_read::claim_for_plugin): Remove.
12315         (File_read::descriptor): Reopen descriptor if necessary.
12316         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12317         (Plugin_manager::all_symbols_read): Add task parameter. Change
12318         all callers.
12319         (Plugin_manager::get_input_file): New function.
12320         (Plugin_manager::release_input_file): New function.
12321         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12322         corresponding data member.
12323         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12324         and pass to base constructor. Change all callers.
12325         (get_input_file, release_input_file): New functions.
12326         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12327         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12328         (Plugin_manager::all_symbols_read): Add task parameter.
12329         (Plugin_manager::get_input_file): New function.
12330         (Plugin_manager::release_input_file): New function.
12331         (Plugin_manager::task_): New data member.
12332         (Pluginobj::Pluginobj): Add filesize parameter.
12333         (Pluginobj::filename): New function.
12334         (Pluginobj::descriptor): New function.
12335         (Pluginobj::filesize): New function.
12336         (Pluginobj::filesize_): New data member.
12337         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12338         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12339         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12340
12341         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12342         with archive libraries.
12343         * testsuite/Makefile.in: Regenerate.
12344         * testsuite/plugin_test.c (struct sym_info): New type.
12345         (get_input_file, release_input_file): New static variables.
12346         (onload): Capture new transfer vector entries.
12347         (claim_file_hook): Stop reading at end of file according to filesize.
12348         Factor out parsing of readelf output into separate function.
12349         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12350         APIs and get the source file name from the symbol table.  Convert
12351         source file name to corresponding object file name.  Print info
12352         message when adding new input files.
12353         (parse_readelf_line): New function.
12354         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12355         * testsuite/plugin_test_2.sh: Likewise.
12356         * testsuite/plugin_test_3.sh: Likewise.
12357         * testsuite/plugin_test_4.sh: New test case.
12358
12359 2009-01-07  Ian Lance Taylor  <iant@google.com>
12360
12361         * version.cc (version_string): Bump to 1.8.
12362
12363 2008-12-23  Cary Coutant  <ccoutant@google.com>
12364
12365         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12366         * plugin.cc (Plugin_manager::finish): Rename as
12367         layout_deferred_objects.  Move cleanup to separate function.
12368         (Plugin_manager::cleanup): New function.
12369         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12370         separately.
12371         * plugin.h (Plugin_manager::finish): Rename as
12372         layout_deferred_objects.
12373         (Plugin_manager::cleanup): New function.
12374         (Plugin_manager::cleanup_done): New field.
12375
12376 2008-12-23  Cary Coutant  <ccoutant@google.com>
12377
12378         * plugin.cc (is_visible_from_outside): New function.
12379         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12380         so we don't return "IR only" status for exported symbols or -r links.
12381
12382         * testsuite/Makefile.am (plugin_test_3): New test case.
12383         * testsuite/Makefile.in: Regenerate.
12384         * testsuite/plugin_test_3.sh: New file.
12385
12386 2008-12-22  Cary Coutant  <ccoutant@google.com>
12387
12388         * object.cc (Sized_relobj::layout_section): New function.
12389         (Sized_relobj::do_layout): Defer layout of input sections until after
12390         plugin has provided replacement files.
12391         (Sized_relobj::do_layout_deferred_sections): New function.
12392         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12393         (Relobj::layout_deferred_sections): New function.
12394         (Relobj::do_layout_deferred_sections): New function.
12395         (Sized_relobj::do_layout_deferred_sections): New function.
12396         (Sized_relobj::layout_section): New function.
12397         (Sized_relobj::Deferred_layout): New structure.
12398         (Sized_relobj::deferred_layout_): New field.
12399         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12400         Change all callers.  Layout deferred sections.
12401         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12402         references.
12403         (Plugin_hook::run): Move code from do_plugin_hook inline.
12404         (Plugin_hook::do_plugin_hook): Remove.
12405         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12406         (Plugin_manager::finish): Renamed, was cleanup.
12407         (Plugin_manager::should_defer_layout): New function.
12408         (Plugin_manager::add_deferred_layout_object): New function.
12409         (Plugin_manager::Deferred_layout_list): New type.
12410         (Plugin_manager::deferred_layout_objects_): New field.
12411         (Plugin_hook::do_plugin_hook): Remove.
12412
12413 2008-12-17  Ian Lance Taylor  <iant@google.com>
12414
12415         * options.h (class General_options): Add --no case for
12416         --export-dynamic.
12417
12418 2008-12-16  Cary Coutant  <ccoutant@google.com>
12419
12420         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12421         vector.
12422         (Plugin_manager::claim_file): Create plugin object even if
12423         plugin did not call the add_symbols callback.
12424         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12425         asking for more symbols than were added.
12426         * testsuite/Makefile.am (plugin_test_1): Add test case with
12427         no global symbols.
12428         (empty.syms): New target.
12429         * testsuite/Makefile.in: Regenerate.
12430         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12431         message. Don't call add_symbols if no globals.
12432         (all_symbols_read_hook): Don't provide replacement for empty
12433         claimed file.
12434
12435 2008-12-12  Ian Lance Taylor  <iant@google.com>
12436
12437         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12438         r_type == 0 for a local symbol with r_sym == 0.
12439         (scan_relocatable_relocs): Pass r_sym to
12440         local_non_section_strategy.
12441         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12442         r_sym parameter.
12443
12444         * configure.ac: Update test for TLS descriptors: they are
12445         supported as of glibc 2.9.
12446         * configure: Rebuild.
12447
12448 2008-12-11  Ian Lance Taylor  <iant@google.com>
12449
12450         PR 7091
12451         * target-reloc.h (Default_scan_relocatable_relocs): For each
12452         function, map r_type == 0 to RELOC_DISCARD.
12453
12454 2008-12-10  Cary Coutant  <ccoutant@google.com>
12455
12456         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12457         object to override a kept COMDAT group from a plugin object.
12458
12459 2008-12-09  Ian Lance Taylor  <iant@google.com>
12460
12461         PR 7088
12462         * yyscript.y (file_cmd): Handle INPUT.
12463
12464         * testsuite/initpri1.c: Change all declarations to be full
12465         prototypes by adding void, to avoid compiler warnings.
12466
12467 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12468
12469         * options.cc (General_options::parse_plugin_opt): New.
12470         (General_options::add_plugin): The argument now is just the filename.
12471         (General_options::add_plugin_option): New.
12472         * options.h (plugin_opt): New.
12473         (add_plugin): Change argument name.
12474         (add_plugin_option): New.
12475         * plugin.cc (Plugin::load): Don't parse the plugin option.
12476         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12477         (Plugin::add_option): New.
12478         (Plugin::args_): Change type.
12479         (Plugin::filename_): New.
12480         (Plugin_manager::add_plugin_option): New.
12481         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12482         * testsuite/Makefile.in: Regenerate.
12483
12484 2008-12-05  Cary Coutant  <ccoutant@google.com>
12485
12486         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12487         Handle --strip-lto-sections option.
12488         * options.h (strip_lto_sections): New option.
12489
12490 2008-12-01  Cary Coutant  <ccoutant@google.com>
12491
12492         * plugin.cc (ld_plugin_message): Change format parameter to const.
12493         Fix mismatch between new[] and delete.
12494
12495 2008-11-14  Cary Coutant  <ccoutant@google.com>
12496
12497         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12498         instead of -1U.
12499
12500 2008-11-05  Craig Silverstein  <csilvers@google.com>
12501
12502         * options.cc (General_options::parse_dynamic_list): New function.
12503         * options.h (General_options): New flags dynamic_list,
12504         dynamic_list_data, dynamic_list_cpp_new, and
12505         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12506         (General_options::in_dynamic_list): New function.
12507         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12508         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12509         (Lex::can_continue_name): Likewise.
12510         (yylex): Likewise.
12511         (read_script_file): New parameter script_options.
12512         (read_dynamic_list): New function.
12513         (Script_options::define_dynamic_list): New function.
12514         (dynamic_list_keyword_parsecodes): New variable.
12515         (dynamic_list_keywords): New variable.
12516         * script.h (Script_options::define_dynamic_list): New function
12517         prototype.
12518         (read_dynamic_list): New function prototype.
12519         * symtab.cc (strprefix): New macro.
12520         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12521         dynamic_list_data, dynamic_list_cpp_new, and
12522         dynamic_list_cpp_typeinfo.
12523         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12524         (dynamic_list_expr): New rule.
12525         (dynamic_list_nodes): Likewise.
12526         (dynamic_list_node): Likewise.
12527         * testsuite/Makefile.am (dynamic_list): New test.
12528         * testsuite/Makefile.in: Regenerated.
12529         * testsuite/dynamic_list.t: New file.
12530         * testsuite/dynamic_list.sh: New file.
12531
12532 2008-11-05  Craig Silverstein  <csilvers@google.com>
12533
12534         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12535         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12536         (t11_last): Likewise.
12537         * testsuite/ver_test_6.c (main): Likewise.
12538
12539 2008-10-07  Cary Coutant  <ccoutant@google.com>
12540
12541         * options.c (General_options::finalize): Add check for -static and
12542         -shared.
12543         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12544         is not empty.
12545
12546 2008-10-02  Cary Coutant  <ccoutant@google.com>
12547
12548         * plugin.cc (make_sized_plugin_object): Fix conditional
12549         compilation to work when not all targets are enabled.
12550
12551 2008-09-29  Cary Coutant  <ccoutant@google.com>
12552
12553         * archive.cc (Archive::get_file_and_offset): Use filename instead
12554         of name to get library path.
12555         (Archive::include_member): Unlock external member of a thin archive.
12556
12557         * testsuite/Makefile.am (TEST_AR): New variable.
12558         (thin_archive_test_1): New test.
12559         (thin_archive_test_2): New test.
12560         * testsuite/Makefile.in: Regenerate.
12561         * testsuite/thin_archive_main.cc: New file.
12562         * testsuite/thin_archive_test_1.cc: New file.
12563         * testsuite/thin_archive_test_2.cc: New file.
12564         * testsuite/thin_archive_test_3.cc: New file.
12565         * testsuite/thin_archive_test_4.cc: New file.
12566
12567 2008-09-29  Cary Coutant  <ccoutant@google.com>
12568
12569         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12570         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12571         instead of -1U.
12572         (Sized_relobj::do_finalize_local_symbols): Likewise.
12573         (Sized_relobj::map_to_kept_section): Likewise.
12574         * object.h (Sized_relobj::invalid_address): New constant.
12575         (Sized_relobj::do_output_section_offset): Check for invalid_address
12576         and return -1ULL.
12577         * output.cc (Output_reloc::local_section_offset): Use constant
12578         invalid_address instead of -1U.
12579         (Output_reloc::get_address): Likewise.
12580         (Output_section::output_address): Change -1U to -1ULL.
12581         * output.h (Output_reloc::invalid_address): New constant.
12582         * reloc.cc (Sized_relobj::write_sections): Use constant
12583         invalid_address instead of -1U.
12584         (Sized_relobj::relocate_sections): Likewise.
12585         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12586         values for merge sections.
12587         * target-reloc.h (relocate_for_relocatable): Use constant
12588         invalid_address instead of -1U.
12589
12590 2008-09-19  Cary Coutant  <ccoutant@google.com>
12591
12592         Add plugin functionality for link-time optimization (LTO).
12593         * configure.ac (plugins): Add --enable-plugins option.
12594         * configure: Regenerate.
12595         * config.in: Regenerate.
12596         * Makefile.am (LIBDL): New variable.
12597         (CCFILES): Add plugin.cc.
12598         (HFILES): Add plugin.h.
12599         (ldadd_var): Add LIBDL.
12600         * Makefile.in: Regenerate.
12601
12602         * archive.cc: Include "plugin.h".
12603         (Archive::setup): Don't preread archive symbols when using a plugin.
12604         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12605         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12606         files.
12607         (Archive::include_member): Add symbols from plugin objects.
12608         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12609         * descriptors.cc (Descriptors::open): Check for file descriptors
12610         abandoned by plugins.
12611         (Descriptors::claim_for_plugin): New function.
12612         * descriptors.h (Descriptors::claim_for_plugin): New function.
12613         (Open_descriptor::is_claimed): New field.
12614         (claim_descriptor_for_plugin): New function.
12615         * fileread.cc (File_read::claim_for_plugin): New function.
12616         * fileread.h (File_read::claim_for_plugin): New function.
12617         (File_read::descriptor): New function.
12618         * gold.cc: Include "plugin.h".
12619         (queue_initial_tasks): Add task to call plugin hooks for generating
12620         new object files.
12621         * main.cc: Include "plugin.h".
12622         (main): Load plugin libraries.
12623         * object.h (Pluginobj): Declare.
12624         (Object::pluginobj): New function.
12625         (Object::do_pluginobj): New function.
12626         (Object::set_target): New function.
12627         * options.cc: Include "plugin.h".
12628         (General_options::parse_plugin): New function.
12629         (General_options::General_options): Initialize plugins_ field.
12630         (General_options::add_plugin): New function.
12631         * options.h (Plugin_manager): Declare.
12632         (General_options): Add --plugin option.
12633         (General_options::has_plugins): New function.
12634         (General_options::plugins): New function.
12635         (General_options::add_plugin): New function.
12636         (General_options::plugins_): New field.
12637         * plugin.cc: New file.
12638         * plugin.h: New file.
12639         * readsyms.cc: Include "plugin.h".
12640         (Read_symbols::do_read_symbols): Check for archive before checking
12641         for ELF file.  Call plugin hooks to claim files.
12642         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12643         from a real object file; force override when processing replacement
12644         files.
12645         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12646         (Symbol::init_base_object): Likewise.
12647         (Symbol::init_base_output_data): Likewise.
12648         (Symbol::init_base_output_segment): Likewise.
12649         (Symbol::init_base_constant): Likewise.
12650         (Symbol::init_base_undefined): Likewise.
12651         (Symbol::output_section): Assert that object is not a plugin.
12652         (Symbol_table::add_from_pluginobj): New function.
12653         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12654         undefined.
12655         (Symbol_table::sized_write_globals): Likewise.
12656         (Symbol_table::add_from_pluginobj): Instantiate template.
12657         * symtab.h (Sized_pluginobj): Declare.
12658         (Symbol::in_real_elf): New function.
12659         (Symbol::set_in_real_elf): New function.
12660         (Symbol::in_real_elf_): New field.
12661         (Symbol_table::add_from_pluginobj): New function.
12662
12663         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12664         (LIBDL): New variable.
12665         (LDADD): Add LIBDL.
12666         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12667         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12668         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12669         (MOSTLYCLEANFILES): Likewise.
12670         * testsuite/Makefile.in: Regenerate.
12671         * testsuite/plugin_test.c: New file.
12672         * testsuite/plugin_test_1.sh: New file.
12673         * testsuite/plugin_test_2.sh: New file.
12674
12675 2008-09-16  Ian Lance Taylor  <iant@google.com>
12676
12677         * target-reloc.h (relocate_section): Check whether a symbol is
12678         defined by the ABI before reporting an undefined symbol error.
12679         * target.h (Target::is_defined_by_abi): Make parameter const.
12680         (Target::do_is_defined_by_abi): Likewise.
12681         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12682         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12683         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12684         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12685         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12686         * testsuite/Makefile.in: Rebuild.
12687
12688         * fileread.cc (make_view): Add casts to avoid warning.
12689
12690 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12691
12692         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12693         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12694
12695 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12696
12697         * options.h (General_options::output_is_executable): New.
12698         (General_options::output_is_pie): New.
12699         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12700         for shared libraries.
12701         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12702
12703 2008-09-11  Chris Demetriou  <cgd@google.com>
12704
12705         * options.h (origin): New -z option.
12706         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12707         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12708         in DT_FLAGS_1.
12709
12710 2008-09-05  Cary Coutant  <ccoutant@google.com>
12711
12712         * fileread.cc (File_read::make_view): Add check for attempt to map
12713         beyond end of file.
12714
12715 2008-09-05  Cary Coutant  <ccoutant@google.com>
12716
12717         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12718         explicit instantiations.
12719
12720 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12721
12722         PR gold/6858
12723         * options.cc (General_options::finalize): Allow undefined symbols
12724         in shlibs if linking -shared.
12725
12726         PR gold/6859
12727         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12728         symbols as not needing a dynsym entry.
12729
12730 2008-08-20  Craig Silverstein  <csilvers@google.com>
12731
12732         * fileread.cc (File_read::open): Do not lock the file unless it
12733         was successfully opened.
12734
12735 2008-08-14  Cary Coutant  <ccoutant@google.com>
12736
12737         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12738         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12739         * testsuite/tls_test.cc (struct int128): 128-bit struct
12740         for testing TLS relocs with non-zero addend.
12741         (v12): New TLS variable.
12742         (t12): New test.
12743         (t_last): Add check for v12.
12744         * testsuite/tls_test.h (t12): New function.
12745         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12746
12747 2008-08-13  Ian Lance Taylor  <iant@google.com>
12748
12749         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12750         set tls_segment_ or relro_segment_.
12751         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12752         when appropriate.
12753         * output.h (Output_section::clear_is_relro): New function.
12754         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12755         sections specially even when output_data_ is empty.
12756         (Output_segment::maximum_alignment): When first section is relro,
12757         only force alignment for PT_LOAD segments.
12758         * script.cc (script_data_segment_align): New function.
12759         (script_data_segment_relro_end): New function.
12760         * script-c.h (script_data_segment_align): Declare.
12761         (script_data_segment_relro_end): Declare.
12762         * script-sections.h (class Script_sections): Declare
12763         data_segment_align and data_segment_relro_end.  Add fields
12764         segment_align_index_ and saw_relro_end_.
12765         * script-sections.cc (class Sections_element): Add set_is_relro
12766         virtual function.  Add new bool* parameter to place_orphan_here.
12767         Add get_output_section virtual function.
12768         (class Output_section_definition): Add set_is_relro.  Add new
12769         bool* parameter to place_orphan_here.  Add get_output_section.
12770         Add is_relro_ field.
12771         (Output_section_definition::Output_section_definition): Initialize
12772         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12773         and is_relro_ fields.
12774         (Output_section_definition::place_orphan_here): Add is_relro
12775         parameter.
12776         (Output_section_definition::set_section_addresses): Set relro for
12777         output section.
12778         (Output_section_definition::alternate_constraint): Likewise.
12779         (class Orphan_output_section): Add new bool* parameter to
12780         place_orphan_here.  Add get_output_section.
12781         (Orphan_output_section::place_orphan_here): Add is_relro
12782         parameter.
12783         (Script_sections::Script_sections): Initialize
12784         data_segment_align_index_ and saw_relro_end_.
12785         (Script_sections::data_segment_align): New function.
12786         (Script_sections::data_segment_relro_end): New function.
12787         (Script_sections::place_orphan): Set or clear is_relro.
12788         (Script_sections::set_section_addresses): Force alignment of first
12789         TLS section.
12790         * yyscript.y (exp): Call script_data_segment_align and
12791         script_data_segment_relro_end.
12792         * testsuite/relro_script_test.t: New file.
12793         * testsuite/relro_test.cc (using_script): Declare.
12794         (t1, t2): Test using_script.
12795         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12796         (relro_script_test_SOURCES): Define.
12797         (relro_script_test_DEPENDENCIES): Define.
12798         (relro_script_test_LDFLAGS): Define.
12799         (relro_script_test_LDADD): Define.
12800         (relro_script_test.so): New target.
12801         * testsuite/Makefile.in: Rebuild.
12802
12803 2008-08-06  Cary Coutant <ccoutant@google.com>
12804
12805         * archive.cc (Archive::total_archives, Archive::total_members)
12806         (Archive::total_members_loaded): New variables.
12807         (Archive::setup): Add parameter.  Add option to preread
12808         archive symbols.
12809         (Archive::read_armap): Add counter.
12810         (Archive::get_file_and_offset): New function.
12811         (Archive::get_elf_object_for_member): New function.
12812         (Archive::read_all_symbols): New function.
12813         (Archive::read_symbols): New function.
12814         (Archive::add_symbols): Add counters.
12815         (Archive::include_all_members): Use armap to find members if it's
12816         already built.
12817         (Archive::include_member): Skip reading symbols if already read.
12818         Factored code into Archive::get_file_and_offset and
12819         Archive::get_elf_object_for_member.  Changed call to
12820         Mapfile::report_include_archive_member.
12821         (Archive::print_stats): New function.
12822         * archive.h: Declare Object and Read_symbols_data classes.
12823         (Archive::Archive): Add initializers for new members.
12824         (Archive::setup): Add parameter.
12825         (Archive::print_stats): New function.
12826         (Archive::total_archives, Archive::total_members)
12827         (Archive::total_members_loaded): New variables.
12828         (Archive::get_file_and_offset): New function.
12829         (Archive::get_elf_object_for_member): New function.
12830         (Archive::read_all_symbols): New function.
12831         (Archive::read_symbols): New function.
12832         (Archive::Archive_member): New class.
12833         (Archive::members_): New member.
12834         (Archive::num_members_): New member.
12835         * main.cc: Include archive.h.
12836         (main): Call Archive::print_stats.
12837         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12838         archive parameter; member_name is now the fully-decorated name.
12839         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12840         * options.h: (General_options): Add --preread-archive-symbols option.
12841         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12842         Archive::setup.
12843
12844 2008-08-04  Ian Lance Taylor  <iant@google.com>
12845
12846         * symtab.h (Symbol::use_plt_offset): New function.
12847         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12848         * powerpc.cc (Relocate::relocate): Likewise.
12849         * sparc.cc (Relocate::relocate): Likewise.
12850         * x86_64.cc (Relocate::relocate): Likewise.
12851         * testsuite/weak_plt.sh: New test.
12852         * testsuite/weak_plt_main.cc: New test.
12853         * testsuite/weak_plt_shared.cc: New test.
12854         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12855         (check_PROGRAMS): Add weak_plt.
12856         (check_DATA): Add weak_plt_shared.so.
12857         (weak_plt_main_pic.o, weak_plt): New targets.
12858         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12859         * testsuite/Makefile.in: Rebuild.
12860
12861         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12862         gcctestdir/ld.
12863         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12864         * testsuite/Makefile.in: Rebuild.
12865
12866 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12867
12868         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12869         * Makefile.in: Regenerate.
12870         * po/POTFILES.in: Regenerate.
12871
12872 2008-07-29  Ian Lance Taylor  <iant@google.com>
12873
12874         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12875         symbols before other symbols.
12876         * testsuite/script_test_2.cc (test_addr): Declare.
12877         (test_addr_alias): Declare.
12878         (main): Check that test_addr and test_addr_alias have the right
12879         values.
12880         * testsuite/script_test_2.t: Define test_addr_alias and
12881         test_addr.
12882
12883 2008-07-24  Ian Lance Taylor  <iant@google.com>
12884
12885         PR 5990
12886         * descriptors.cc: New file.
12887         * descriptors.h: New file.
12888         * gold-threads.h (class Hold_optional_lock): New class.
12889         * fileread.cc: Include "descriptors.h".
12890         (File_read::~File_read): Release descriptor rather than closing
12891         it.
12892         (File_read::open) [file]: Call open_descriptor rather than open.
12893         Set is_descriptor_opened_.
12894         (File_read::open) [memory]: Assert that descriptor is not open.
12895         (File_read::reopen_descriptor): New function.
12896         (File_read::release): Release descriptor.
12897         (File_read::do_read): Make non-const.  Reopen descriptor.
12898         (File_read::read): Make non-const.
12899         (File_read::make_view): Reopen descriptor.
12900         (File_read::do_readv): Likewise.
12901         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12902         Update declarations.
12903         * layout.cc: Include "descriptors.h".
12904         (Layout::create_build_id): Use open_descriptor rather than open.
12905         * output.cc: Include "descriptors.h".
12906         (Output_file::open): Use open_descriptor rather than open.
12907         * archive.cc (Archive::const_iterator): Change Archive to be
12908         non-const.
12909         (Archive::begin, Archive::end): Make non-const.
12910         (Archive::count_members): Likewise.
12911         * archive.h (class Archive): Update declarations.
12912         * object.h (Object::read): Make non-const.
12913         * Makefile.am (CCFILES): Add descriptors.cc.
12914         (HFILES): Add descriptors.h.
12915         * Makefile.in: Rebuild.
12916
12917         PR 6716
12918         * gold.h: Always include <clocale>.  Add Solaris workarounds
12919         following code in binutils/sysdep.h.
12920
12921         PR 6048
12922         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12923         this->eh_frame_hdr_ is NULL before using it.
12924
12925         * dynobj.cc (Versions::Versions): Update comment.
12926
12927         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12928         the base version name.
12929
12930         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12931         array size plus one.
12932         (Stringpool_template::set_string_offsets): Subtract one from key
12933         before using it as an array index.
12934         (Stringpool_template::get_offset_with_length): Likewise.
12935         (Stringpool_template::write_to_buffer): Likewise.
12936         * stringpool.h (Stringpool_template::get_offset_from_key):
12937         Likewise.
12938
12939 2008-07-23  Ian Lance Taylor  <iant@google.com>
12940
12941         PR 6658
12942         * object.h (Merged_symbol_value::value): Do our best to handle a
12943         negative addend.
12944
12945         PR 6647
12946         * script.cc (Version_script_info::get_versions): Don't add empty
12947         version tag to return value.
12948         (Version_script_info::get_symbol_version_helper): Change return
12949         type to bool.  Add pversion parameter.  Change all callers.
12950         (script_register_vers_node): Don't require a non-NULL tag.
12951         * script.h (class Version_script_info): Update declarations.
12952         (Version_script_info::get_symbol_version): Change return type to
12953         bool.  Add version parameter.  Change all callers.
12954         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12955         handling.  Handle an empty version from a version script.
12956         (Symbol_table::define_special_symbol): Likewise.
12957         * testsuite/ver_test_10.script: New file.
12958         * testsuite/ver_test_10.sh: New file.
12959         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12960         (check_DATA): Add ver_test_10.syms.
12961         (ver_test_10.syms, ver_test_10.so): New target.
12962         * testsuite/Makefile.in: Rebuild.
12963
12964 2008-07-23  Simon Baldwin  <simonb@google.com>
12965
12966         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12967         to zero for undefined symbols from dynamic libraries.
12968
12969 2008-07-23  Ian Lance Taylor  <iant@google.com>
12970
12971         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12972         Change all callers.
12973         * symtab.h (class Symbol_table): Update declaration.
12974         * testsuite/ver_test_9.cc: New file.
12975         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12976         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12977         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12978         (ver_test_9.so, ver_test_9.o): New targets.
12979         * testsuite/Makefile.in: Rebuild.
12980
12981 2008-07-22  Ian Lance Taylor  <iant@google.com>
12982
12983         * options.h (class General_options): Define --check-sections.
12984         * layout.cc (Layout::set_segment_offsets): Handle
12985         --check-sections.
12986
12987         * options.h (class General_options): Define -n/--nmagic and
12988         -N/--omagic.
12989         * options.cc (General_options::finalize): For -n/--nmagic or
12990         -N/--omagic, set -static.
12991         * layout.cc (Layout::attach_allocated_section_to_segment): If
12992         -N/--omagic, don't put read-only and read-write sections in
12993         different segments.
12994         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12995         finding a read-only segment.
12996         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12997         don't set the minimum segment alignment to the common page size,
12998         and don't set the file offset to the address modulo the page size.
12999         * script-sections.cc (Script_sections::create_segments): If
13000         -n/--omagic, don't put read-only and read-write sections in
13001         different segments.
13002
13003         * cref.cc: New file.
13004         * cref.h: New file.
13005         * options.h (class General_options): Add --print-symbol-counts.
13006         * main.cc (main): Issue defined symbol report if requested.
13007         * archive.cc (Archive::interpret_header): Make into a const member
13008         function.
13009         (Archive::add_symbols): Call Input_objects::archive_start and
13010         archive_stop.
13011         (Archive::const_iterator): Define new class.
13012         (Archive::begin, Archive::end): New functions.
13013         (Archive::include_all_members): Rewrite to use iterator.
13014         (Archive::count_members): New function.
13015         * archive.h (class Archive): Update declarations.
13016         (Archive::filename): New function.
13017         * object.cc: Include "cref.h".
13018         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13019         (Sized_relobj::do_get_global_symbol_counts): New function.
13020         (Input_objects::add_object): Add object to cross-referencer.
13021         (Input_objects::archive_start): New function.
13022         (Input_objects::archive_stop): New function.
13023         (Input_objects::print_symbol_counts): New function.
13024         * object.h: Declare Cref and Archive.
13025         (Object::get_global_symbol_counts): New function.
13026         (Object::do_get_global_symbol_counts): New pure virtual function.
13027         (class Sized_relobj): Add defined_count_ field.  Update
13028         declarations.
13029         (class Input_objects): Add cref_ field.  Update constructor.
13030         Update declarations.
13031         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13032         defined_count_.
13033         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13034         symbol counts.
13035         (Sized_dynobj::do_get_global_symbol_counts): New function.
13036         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13037         defined_count_.  Update declarations.  Define Symbols typedef.
13038         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13039         parameter.  Change all callers.
13040         (Symbol_table::add_from_dynobj): Add sympointers and defined
13041         parameters.  Change all callers.
13042         * symtab.h (class Symbol_table): Update declarations.
13043         * Makefile.am (CCFILES): Add cref.cc.
13044         (HFILES): Add cref.h.
13045         * Makefile.in: Rebuild.
13046
13047 2008-07-22  Simon Baldwin  <simonb@google.com>
13048
13049         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13050         to zero when writing undefined symbols.
13051
13052 2008-07-22  Ian Lance Taylor  <iant@google.com>
13053
13054         * output.cc (Output_section::add_input_section): Don't try to
13055         merge empty merge sections.
13056
13057 2008-07-21  Craig Silverstein  <csilvers@google.com>
13058
13059         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13060         Include symbol version in error message.
13061
13062 2008-07-20  Chris Demetriou  <cgd@google.com>
13063
13064         * configure.ac (gold_cv_c_random_seed): New configured variable.
13065         (RANDOM_SEED_CFLAGS): New substituted variable.
13066         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13067         * configure: Rebuild.
13068         * Makefile.in: Likewise.
13069         * testsuite/Makefile.in: Likewise.
13070
13071 2008-07-18  Ian Lance Taylor  <iant@google.com>
13072
13073         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13074         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13075         * testsuite/ver_test_main.cc (main): Call t4.
13076         (t4, t4_2a): Define.
13077         * testsuite/ver_test_2.cc (t4_2): Define.
13078         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13079         * testsuite/ver_test_4.cc (t4_2a): Define.
13080         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13081         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13082
13083 2008-07-17  Ian Lance Taylor  <iant@google.com>
13084
13085         * dynobj.cc (Versions::add_def): If we give an error about a
13086         missing version, go ahead and create the version anyhow.
13087
13088 2008-07-10  Ian Lance Taylor  <iant@google.com>
13089
13090         Handle output sections with more than 0x7fffffff bytes.
13091         * object.h (class Relobj): Change map_to_output_ to
13092         output_sections_, and just keep a section pointer.  Change all
13093         uses.  Move comdat group support to Sized_relobj.
13094         (Relobj::is_section_specially_mapped): Remove.
13095         (Relobj::output_section): Remove poff parameter.  Change all
13096         callers.
13097         (Relobj::output_section_offset): New function.
13098         (Relobj::set_section_offset): Rewrite.
13099         (Relobj::map_to_output): Remove.
13100         (Relobj::output_sections): New function.
13101         (Relobj::do_output_section_offset): New pure virtual function.
13102         (Relobj::do_set_section_offset): Likewise.
13103         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13104         group support from Relobj.  Update declarations.
13105         (Sized_relobj::get_output_section_offset): New function.
13106         (Sized_relobj::do_output_section_offset): New function.
13107         (Sized_relobj::do_set_section_offset): New function.
13108         * object.cc (Relobj::output_section_address): Remove.
13109         (Sized_relobj::Sized_relobj): Initialize new fields.
13110         (Sized_relobj::include_section_group): Cast find_kept_object to
13111         Sized_relobj.
13112         (Sized_relobj::include_linkonce_section): Likewise.
13113         (Sized_relobj::do_layout): Use separate arrays for output section
13114         and output offset.
13115         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13116         output_sections.
13117         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13118         output_sections and section_offsets.
13119         (Sized_relobj::write_local_symbols): Likewise.
13120         (map_to_kept_section): Compute output address directly.
13121         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13122         output_sections and section_offsets.
13123         (Sized_relobj::write_sections): Likewise.
13124         (Sized_relobj::relocate_sections): Likewise.
13125         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13126         * output.h (class Output_reloc): Update declarations.  Change
13127         u2_.relobj to Sized_relobj*.
13128         (class Output_data_reloc): Change add functions to use
13129         Sized_relobj*.
13130         * output.cc (Output_reloc::Output_reloc): Change relobj to
13131         Sized_relobj*.
13132         (Output_reloc::local_section_offset): Change return type to
13133         Elf_Addr.  Use get_output_section_offset.
13134         (Output_reloc::get_address): Likewise.
13135         (Output_section::is_input_address_mapped): Don't call
13136         is_section_specially_mapped.
13137         (Output_section::output_offset): Likewise.
13138         (Output_section::output_address): Likewise.
13139         (Output_section::starting_output_address): Likewise.
13140         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13141         parameter to Sized_relobj*.
13142         (Copy_relocs::need_copy_reloc): Likewise.
13143         (Copy_relocs::save): Likewise.
13144         * copy-relocs.h (class Copy_relocs): Update declarations.
13145         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13146         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13147         * target-reloc.h (relocate_for_relocatable): Change
13148         offset_in_output_section type to Elf_Addr.  Change code that uses
13149         it as well.
13150         * layout.cc (Layout::layout): Always set *off.
13151         * mapfile.cc (Mapfile::print_input_section): Use
13152         output_section_offset.
13153         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13154         Sized_relobj*.
13155         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13156         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13157         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13158
13159 2008-07-03  Ian Lance Taylor  <iant@google.com>
13160
13161         * layout.cc (Layout::include_section): Do not discard unrecognized
13162         SHT_STRTAB sections.
13163
13164 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13165
13166         * script.cc (Lex::can_continue_name): Make '?' allowable in
13167         version-script names.
13168         * testsuite/version_script.map: Change glob pattern to use '?'
13169
13170 2008-06-30  Manish Singh  <yosh@gimp.org>
13171
13172         PR 6585
13173         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13174         Correct typo.
13175
13176 2008-06-30  Ian Lance Taylor  <iant@google.com>
13177
13178         PR 6660
13179         PR 6682
13180         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13181         versions]: Don't try to read the value in the contents, since we
13182         don't use it.  Use the template endianness when writing.
13183
13184 2008-06-25  Cary Coutant  <ccoutant@google.com>
13185
13186         * fileread.cc (File_read::make_view): Assert on zero-length view.
13187         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13188         symbol table when there are no symbols to read.
13189
13190 2008-06-23  Craig Silverstein  <csilvers@google.com>
13191
13192         * version.cc (version_string): Bump to 1.7
13193
13194 2008-06-18  Craig Silverstein  <csilvers@google.com>
13195
13196         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13197         constant 0xFFFF to type Valtype.
13198         (Powerpc_relocate_functions::rel16_ha): Likewise.
13199
13200 2008-06-17  Ian Lance Taylor  <iant@google.com>
13201
13202         * output.h (Output_section::Input_section): Initialize p2align_ to
13203         zero for Output_section_data constructors.
13204         (Output_section::Input_section::addralign): If not an input
13205         section, return the alignment of the Output_section_data.
13206         * testsuite/copy_test.cc: New file.
13207         * testsuite/copy_test_1.cc: New file.
13208         * testsuite/copy_test_2.cc: New file.
13209         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13210         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13211         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13212         (copy_test_1_pic.o, copy_test_1.so): New targets.
13213         (copy_test_2_pic.o, copy_test_2.so): New targets.
13214         * testsuite/Makefile.in: Rebuild.
13215
13216         * script-sections.cc (Script_sections::place_orphan): Initialize
13217         local variable exact.
13218
13219 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13220
13221         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13222
13223 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13224             David S. Miller  <davem@davemloft.net>
13225
13226         * powerpc.cc: New file.
13227         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13228         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13229         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13230         * Makefile.in: Rebuild.
13231
13232 2008-06-09  Ian Lance Taylor  <iant@google.com>
13233
13234         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13235         <exception>.
13236         (throwing, orig_terminate): New static variables.
13237         (terminate_handler): New static function.
13238         (t2): Set terminate handler.
13239
13240 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13241
13242         PR 6584
13243         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13244         alignment.
13245
13246 2008-05-30  Cary Coutant  <ccoutant@google.com>
13247
13248         * archive.cc (Archive::include_all_members) Correct to step
13249         over symbol table and extended name table in thin archives.
13250
13251 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13252
13253         PR 6407
13254         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13255         calculation.
13256
13257 2008-05-28  Caleb Howe  <cshowe@google.com>
13258
13259         * reduced_debug_output.cc: New file.
13260         * reduced_debug_output.h: New file.
13261         * options.h (class General_options): Add --strip-debug-non-line.
13262         * options.cc (General_options::finalize): Add strip_debug_non_line
13263         to the strip heirarchy.
13264         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13265         fields.
13266         * layout.cc: Include "reduced_debug_output.h".
13267         (Layout::Layout): Initialize new fields.
13268         (line_only_debug_sections): New static array.
13269         (is_lines_only_debug_sections): New static inline function.
13270         (Layout::include_section): Handle --strip-debug-non-line.
13271         (Layout::make_output_section): If --strip-debug-non-line, build
13272         new output sections for .debug_abbrev and .debug_info.
13273         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13274         gold.  Warn about possible overflow.
13275         (read_signed_LEB_128): Likewise.
13276         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13277         (read_signed_LEB_128): Declare.
13278         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13279         (HFILES): Add reduced_debug_output.h.
13280         * Makefile.in: Rebuild.
13281
13282 2008-05-21  Ian Lance Taylor  <iant@google.com>
13283
13284         * mapfile.cc: New file.
13285         * mapfile.h: New file.
13286         * options.h (class General_options): Add -M/--print-map and -Map.
13287         * options.cc (General_options::finalize): Make -M equivalent to
13288         -Map -.
13289         * main.cc: Include <cstdio> and "mapfile.h".
13290         (main): Open mapfile if requested.
13291         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13292         constructor.  Change caller.
13293         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13294         (queue_middle_tasks): Likewise.
13295         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13296         declarations.
13297         * archive.cc: Include "mapfile.h".
13298         (Archive::add_symbols): Add mapfile parameter.  Change all
13299         callers.  Pass mapfile, symbol, and reason to include_member.
13300         (Archive::include_all_members): Add mapfile parameter.  Change all
13301         callers.
13302         (Archive::include_member): Add mapfile, sym, and why parameters.
13303         Change all callers.  Report inclusion to map file.
13304         * archive.h: Include "fileread.h".
13305         (class Archive): Update declarations.
13306         (Archive::file): New const method.
13307         (class Add_archive_symbols): Add mapfile_ field.  Update
13308         constructor.  Change all callers.
13309         * readsyms.h (class Read_symbols): Likewise.
13310         (class Finish_group): Likewise.
13311         (class Read_script): Likewise.
13312         * common.cc: Include "mapfile.h".
13313         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13314         all callers.
13315         (Symbol_table::do_allocate_commons): Likewise.
13316         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13317         symbol allocation to mapfile.
13318         * common.h (class Allocate_commons_task): Add mapfile_ field.
13319         Update constructor.  Change all callers.
13320         * symtab.h (class Symbol_table): Update declarations.
13321         * layout.cc: Include "mapfile.h".
13322         (Layout_task_runner::run): Print information to mapfile.
13323         (Layout::create_gold_note): Change Output_data_fixed_space to
13324         Output_data_zero_fill.
13325         (Layout::create_build_id): Likewise.
13326         (Layout::print_to_mapfile): New function.
13327         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13328         constructor.  Change caller.
13329         (class Layout): Declare print_to_mapfile.
13330         * output.cc (Output_section::Input_section::print_to_mapfile): New
13331         function.
13332         (Output_section::add_input_section): If producing a map, always
13333         add to input_sections_ list.
13334         (Output_section::do_print_to_mapfile): New function.
13335         (Output_segment::print_sections_to_mapfile): New function.
13336         (Output_segment::print_section_list_to_mapfile): New function.
13337         * output.h: Include "mapfile.h".
13338         (Output_data::print_to_mapfile): New function.
13339         (Output_data::do_print_to_mapfile): New virtual function.
13340         (Output_segment_headers::do_print_to_mapfile): New function.
13341         (Output_file_header::do_print_to_mapfile): New function.
13342         (Output_data_const::do_print_to_mapfile): New function.
13343         (class Output_data_const_buffer): Add map_name_ field.  Update
13344         constructor.  Change all callers.  Add do_print_to_mapfile
13345         function.
13346         (class Output_data_fixed_space): Likewise.
13347         (class Output_data_space): Likewise.
13348         (class Output_data_zero_fill): New class.
13349         (Output_data_strtab::do_print_to_mapfile): New function.
13350         (Output_data_reloc_base::do_print_to_mapfile): New function.
13351         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13352         (Output_data_group::do_print_to_mapfile): New function.
13353         (Output_data_got::do_print_to_mapfile): New function.
13354         (Output_data_dynamic::do_print_to_mapfile): New function.
13355         (Output_symtab_xindex::do_print_to_mapfile): New function.
13356         (class Output_section): Declare do_print_to_mapflie.  Declare
13357         print_to_mapfile in Input_section.
13358         (class Output_segment): Declare new functions.
13359         * object.h (Sized_relobj::symbol_count): New function.
13360         * script-sections.cc
13361         (Output_section_element_dot_assignment::set_section_addresses):
13362         Change Output_data_fixed_space to Output_data_zero_fill.
13363         (Output_data_expression::do_print_to_mapfile): New function.
13364         * script.cc (read_input_script): Add mapfile parameter.  Change
13365         all callers.
13366         * script.h (read_input_script): Update declaration.
13367         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13368         (Eh_frame::do_print_to_mapfile): New function.
13369         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13370         (Output_merge_string::do_print_to_mapfile): New function.
13371         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13372         function.
13373         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13374         function.
13375         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13376         function.
13377         * Makefile.am (CCFILES): Add mapfile.cc.
13378         (HFILES): Add mapfile.h.
13379         * Makefile.in: Rebuild.
13380
13381 2008-05-19  Ian Lance Taylor  <iant@google.com>
13382
13383         * options.h (class General_options): Add -z relro.
13384         * layout.cc (Layout::Layout): Initialize relro_segment_.
13385         (Layout::add_output_section_data): Return the output section.
13386         (Layout::make_output_section): Rcognize relro sections and mark
13387         them appropriately.
13388         (Layout::attach_allocated_section_to_segment): Put relro sections
13389         in a PT_GNU_RELRO segment.
13390         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13391         section as relro.
13392         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13393         PT_TLS segments.
13394         (Layout::linkonce_mapping): Map d.rel.ro.local to
13395         .data.rel.ro.local.
13396         (Layout::output_section_name): Us .data.rel.ro.local for any
13397         section which begins with that.
13398         * layout.h (class Layout): Update add_output_section_data
13399         declaration.  Add relro_segment_ field.
13400         * output.cc (Output_section::Output_section): Initialize is_relro_
13401         and is_relro_local_ fields.
13402         (Output_segment::add_output_section): Group relro sections.
13403         (Output_segment::is_first_section_relro): New function.
13404         (Output_segment::maximum_alignment): If there is a relro section,
13405         align the segment to the common page size.
13406         (Output_segment::set_section_addresses): Track whether we are
13407         looking at relro sections.  If the last section is a relro
13408         section, align to the common page size.
13409         (Output_segment::set_section_list_addresses): Add in_relro
13410         parameter.  Change all callers.  Align to the page size when
13411         moving from relro to non-relro section.
13412         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13413         segment.
13414         * output.h (class Output_section): Add is_relro_ and
13415         is_relro_local_ fields.
13416         (Output_section::is_relro): New function.
13417         (Output_section::set_is_relro): New function.
13418         (Output_section::is_relro_local): New function.
13419         (Output_section::set_is_relro_local): New function.
13420         (class Output_segment): Update declarations.
13421         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13422         * sparc.cc (Target_sparc::got_section): Likewise.
13423         * x86_64.cc (Target_x86_64::got_section): Likewise.
13424         * testsuite/relro_test_main.cc: New file.
13425         * testsuite/relro_test.cc: New file.
13426         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13427         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13428         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13429         (relro_test.so, relro_test_pic.o): New targets.
13430         * testsuite/Makefile.in: Rebuild.
13431
13432 2008-05-16  Ian Lance Taylor  <iant@google.com>
13433
13434         * output.cc (Output_segment::add_output_section): Remove front
13435         parameter.
13436         * output.h (class Output_segment): Remove
13437         add_initial_output_section and overloaded add_output_section.
13438         Update declaration of remaining add_output_section.
13439         * layout.cc (Layout::create_interp): Call add_output_section
13440         rather than add_initial_output_section.
13441         (Layout::finish_dynamic_section): Likewise.
13442
13443         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13444         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13445         know the dynamic type.
13446         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13447         field.  Initialize it in constructor.
13448         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13449         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13450         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13451         reloc.
13452
13453         * output.cc (Output_reloc::get_address): Change return type to
13454         Elf_Addr.
13455         * output.h (class Output_reloc): Update get_address declaration.
13456         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13457         for section addresses.
13458
13459 2008-05-09  Ian Lance Taylor  <iant@google.com>
13460
13461         PR 6493
13462         * gold.cc (gold_nomem): Use return value of write.
13463
13464 2008-05-08  Ian Lance Taylor  <iant@google.com>
13465
13466         * symtab.c (Symbol::init_base_output_data): Add version
13467         parameter.  Change all callers.
13468         (Symbol::init_base_output_segment): Likewise.
13469         (Symbol::init_base_constant): Likewise.
13470         (Symbol::init_base_undefined): Likewise.
13471         (Sized_symbol::init_output_data): Likewise.
13472         (Sized_symbol::init_output_segment): Likewise.
13473         (Sized_symbol::init_constant): Likewise.
13474         (Sized_symbol::init_undefined): Likewise.
13475         (Symbol_table::do_define_in_output_data): If the new symbol has a
13476         version, mark it as the default.
13477         (Symbol_table::do_define_in_output_segment): Likewise.
13478         (Symbol_table::do_define_as_constant): Likewise.
13479         * symtab.h (class Symbol): Update declarations.
13480         (class Sized_symbol): Likewise.
13481         * resolve.cc (Symbol::override_version): New function.
13482         (Symbol::override_base): Call override_version.
13483         (Symbol::override_base_with_special): Likewise.
13484         * testsuite/ver_script_8.script: New file.
13485         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13486         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13487         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13488         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13489
13490 2008-05-06  Ian Lance Taylor  <iant@google.com>
13491
13492         PR 6049
13493         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13494         functions.
13495         (class General_options): Remove existing --undefined, and add
13496         --no-undefined instead.  Add new --undefined as synonym for -u.
13497         * archive.cc (Archive::add_symbols): Check whether symbol was
13498         named with -u.
13499         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13500         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13501         all uses.  Add IS_UNDEFINED.  Update declarations to split
13502         different versions of init_base.  Declare init_base_undefined.
13503         (Symbol::is_defined): Handle IS_UNDEFINED.
13504         (Symbol::is_undefined): Likewise.
13505         (Symbol::is_weak_undefined): Call is_undefined.
13506         (Symbol::is_absolute): Handle IS_CONSTANT.
13507         (class Sized_symbol): Update declarations to split different
13508         versions of init.  Declare init_undefined.
13509         (class Symbol_table): Declare new functions.
13510         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13511         Change all callers.
13512         (Symbol::init_base_output_data): Likewise.
13513         (Symbol::init_base_output_segment): Likewise.
13514         (Symbol::init_base_constant): Likewise.
13515         (Symbol::init_base_undefined): New function.
13516         (Sized_symbol::init_object): Rename from init.  Change all
13517         callers.
13518         (Sized_symbol::init_output_data): Likewise.
13519         (Sized_symbol::init_output_segment): Likewise.
13520         (Sized_symbol::init_constant): Likewise.
13521         (Sized_symbol::init_undefined): New function.
13522         (Symbol_table::add_undefined_symbols_from_command_line): New
13523         function.
13524         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13525         function.
13526         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13527         (Symbol::output_section): Likewise.
13528         (Symbol::set_output_section): Likewise.
13529         (Symbol_table::sized_finalize_symbol): Likewise.
13530         (Symbol_table::sized_write_globals): Likewise.
13531         * resolve.cc (Symbol_table::should_override): Likewise.
13532         (Symbol::override_base_with_special): Likewise.
13533
13534         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13535         symbol, change it to have default visibility.
13536         * testsuite/protected_1.cc: New file.
13537         * testsuite/protected_2.cc: New file.
13538         * testsuite/protected_3.cc: New file.
13539         * testsuite/protected_main_1.cc: New file.
13540         * testsuite/protected_main_2.cc: New file.
13541         * testsuite/protected_main_3.cc: New file.
13542         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13543         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13544         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13545         (protected_1.so): New target.
13546         (protected_1_pic.o, protected_2_pic.o): New targets.
13547         (protected_3_pic.o): New target.
13548         (check_PROGRAMS): Add protected_2.
13549         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13550         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13551         * testsuite/Makefile.in: Rebuild.
13552
13553         * options.h (DEFINE_var): Add set_user_set_##varname__.
13554         (DEFINE_bool_alias): New macro.
13555         (class General_options): Define -Bstatic using DEFINE_bool_alias
13556         rather than DEFINE_special.  Add --undefined as an alias for -z
13557         defs.
13558         * options.cc (General_options::parse_Bstatic): Remove.
13559
13560         * options.h (class General_options): Add --fatal-warnings.
13561         * main.cc (main): Implement --fatal-warnings.
13562         * errors.h (Errors::warning_count): New function.
13563
13564         * options.h (class General_options): Add -Bsymbolic-functions.
13565         * symtab.h (Symbol::is_preemptible): Check for
13566         -Bsymbolic-functions.
13567
13568 2008-05-05  Ian Lance Taylor  <iant@google.com>
13569
13570         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13571         as noVARNAME rather than no-VARNAME.
13572         (class General_options): Add option -z combreloc.
13573         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13574         get_address.
13575         (Output_reloc::sort_before) [SHT_REL]: New function.
13576         (Output_reloc::sort_before) [SHT_RELA]: New function.
13577         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13578         Sort_relocs_comparison.
13579         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13580         parameter.  Change all callers.
13581         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13582         sort_relocs parameter.  Change all callers.
13583         * output.cc (Output_reloc::get_address): New function, broken out
13584         of write_rel.
13585         (Output_reloc::write_rel): Call it.
13586         (Output_reloc::compare): New function.
13587         (Output_data_reloc_base::do_write): Optionally sort relocs.
13588
13589         * configure.ac: If targ_extra_obj is set, link it in.
13590         * configure.tgt: Initialize all variables.
13591         (x86_64*): Set targ_extra_obj and targ_extra_size.
13592         * configure: Rebuild.
13593
13594         * object.cc (Sized_relobj::include_section_group): Adjust section
13595         indexes read from group data.  Build vector to pass to
13596         layout_group.
13597         * layout.cc (Layout::layout_group): Add flags and shndxes
13598         parameters.  Remove contents parameter.  Change caller.  Update
13599         explicit instantiations.
13600         * layout.h (class Layout): Update layout_group declaration.
13601         * output.cc (Output_data_group::Output_data_group): Add flags and
13602         input_shndxes parameters.  Remove contents parameter.  Change
13603         caller.
13604         (Output_data_group::do_write): Change input_sections_ to
13605         input_shndxes_.
13606         * output.h (class Output_data_group): Update constructor
13607         declaration.  Rename input_sections_ to input_shndxes_.
13608         * testsuite/many_sections_test.cc: Add template.
13609
13610 2008-04-30  Cary Coutant  <ccoutant@google.com>
13611
13612         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13613
13614         * layout.cc (Layout::include_section): Refactored check for debug
13615         info section.
13616         (Layout::add_comdat): Add new parameters.  Change type
13617         of signature parameter.  Add object and shndx to signatures table.
13618         (Layout::find_kept_object): New function.
13619         * layout.h: Include <cstring>.
13620         (Layout::is_debug_info_section): New function.
13621         (Layout::add_comdat): Add new parameters.
13622         (Layout::find_kept_object): New function.
13623         (Layout::Kept_section): New struct.
13624         (Layout::Signatures): Change type of map range.
13625         * object.cc (Relobj::output_section_address): New function.
13626         (Sized_relobj::include_section_group): Add new parameters.  Change
13627         calls to Layout::add_comdat.  Change to build table of kept comdat
13628         groups and table mapping discarded sections to kept sections.
13629         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13630         (Sized_relobj::do_layout): Change calls to include_section_group and
13631         include_linkonce_section.
13632         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13633         value to zero when section is discarded.
13634         (Sized_relobj::map_to_kept_section): New function.
13635         * object.h (Relobj::output_section_address): New function.
13636         (Relobj::Comdat_group): New type.
13637         (Relobj::find_comdat_group): New function.
13638         (Relobj::Comdat_group_table): New type.
13639         (Relobj::Kept_comdat_section): New type.
13640         (Relobj::Kept_comdat_section_table): New type.
13641         (Relobj::add_comdat_group): New function.
13642         (Relobj::set_kept_comdat_section): New function.
13643         (Relobj::get_kept_comdat_section): New function.
13644         (Relobj::comdat_groups_): New field.
13645         (Relobj::kept_comdat_sections_): New field.
13646         (Symbol_value::input_value): Update comment.
13647         (Sized_relobj::map_to_kept_section) New function.
13648         (Sized_relobj::include_linkonce_section): Add new parameter.
13649         * target-reloc.h (Comdat_behavior): New type.
13650         (get_comdat_behavior): New function.
13651         (relocate_section): Add code to map a discarded section to the
13652         corresponding kept section when applying a relocation.
13653
13654 2008-04-30  Craig Silverstein  <csilvers@google.com>
13655
13656         * dwarf_reader.cc (next_generation_count): New static var.
13657         (Addr2line_cache_entry): New struct.
13658         (addr2line_cache): New static var.
13659         (Dwarf_line_info::one_addr2line): Added caching.
13660         (Dwarf_line_info::clear_addr2line_cache): New function.
13661         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13662         cache-size parameter.
13663         (Dwarf_line_info::one_addr2line_cache): New function.
13664         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13665         new cache-size argument to one_addr2line(), and clear cache.
13666
13667 2008-04-28  Cary Coutant  <ccoutant@google.com>
13668
13669         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13670         R_386_PC8 relocations.
13671
13672 2008-04-23  Ian Lance Taylor  <iant@google.com>
13673
13674         * object.cc (Sized_relobj::include_section_group): Check for
13675         invalid section group.
13676
13677         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13678         header size.
13679
13680         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13681         than read for file header.
13682         * archive.cc (Archive::include_member): Likewise.
13683
13684 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13685
13686         * aclocal.m4: Regenerate.
13687         * configure: Regenerate.
13688
13689 2008-04-19  Ian Lance Taylor  <iant@google.com>
13690
13691         * version.cc (version_string): Bump to 1.6.
13692
13693         * testsuite/Makefile.am (many_sections_r_test): New target.
13694         (many_sections_r_test_SOURCES): Remove.
13695         (many_sections_r_test_DEPENDENCIES): Remove.
13696         (many_sections_r_test_LDFLAGS): Remove.
13697         (many_sections_r_test_LDADD): Remove.
13698
13699         * object.cc (Sized_relobj::do_add_symbols): Always pass
13700         local_symbol_count_ to add_from_relobj.
13701
13702         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13703         every thousand variables.
13704         * testsuite/Makefile.in: Rebuild.
13705
13706         * object.cc (Xindex::initialize_symtab_xindex): New function.
13707         (Xindex::read_symtab_xindex): New function.
13708         (Xindex::sym_xindex_to_shndx): New function.
13709         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13710         available.
13711         (Sized_relobj::do_initialize_xindex): New function.
13712         (Sized_relobj::do_read_symbols): Adjust section links.
13713         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13714         parameter.  Change all callers.
13715         (Sized_relobj::include_section_group): Adjust section links and
13716         symbol section indexes.
13717         (Sized_relobj::do_layout): Adjust section links.
13718         (Sized_relobj::do_count_local_symbols): Adjust section links and
13719         symbol section indexes.
13720         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13721         ordinary and special symbols.
13722         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13723         dynsym_xindex parameters.  Change all callers.  Adjust section
13724         links.  Use SHN_XINDEX when needed.
13725         (Sized_relobj::get_symbol_location_info): Adjust section links.
13726         Don't get fooled by special symbols.
13727         * object.h (class Xindex): Define.
13728         (class Object): Add xindex_ parameter.  Declare virtual functoin
13729         do_initialize_xindex.
13730         (Object::adjust_sym_shndx): New function.
13731         (Object::set_xindex): New protected function.
13732         (class Symbol_value): Add is_ordinary_shndx_ field.
13733         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13734         (Symbol_value::value): Assert ordinary section.
13735         (Symbol_value::initialize_input_to_output_map): Likewise.
13736         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13737         Change all callers.
13738         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13739         all callers.
13740         (class Sized_relobj): Update declarations.
13741         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13742         parameter.  Change all callers.
13743         (Sized_relobj::adjust_shndx): New function.
13744         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13745         field.
13746         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13747         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13748         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13749         (Sized_dynobj::read_dynsym_section): Adjust section links.
13750         (Sized_dynobj::read_dynamic): Likewise.
13751         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13752         section links.
13753         (Sized_dynobj::do_initialize_xindex): New function.
13754         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13755         do_initialize_xindex.
13756         (Sized_dynobj::adjust_shndx): New function.
13757         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13758         dynsym_xindex_ fields.
13759         (Layout::finalize): Add a call to set_section_indexes before
13760         creating the symtab sections.
13761         (Layout::set_section_indexes): Don't do anything if the section
13762         already has a section index.
13763         (Layout::create_symtab_sections): Add shnum parameter.  Change
13764         caller.  Create .symtab_shndx section if needed.
13765         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13766         caller.
13767         (Layout::allocated_output_section_count): New function.
13768         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13769         needed.
13770         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13771         fields.  Update declarations.
13772         (Layout::symtab_xindex): New function.
13773         (Layout::dynsym_xindex): New function.
13774         (class Write_symbols_task): Add layout_ field.
13775         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13776         Change caller.
13777         * output.cc (Output_section_headers::Output_section_headers): Add
13778         shstrtab_section parameter.  Change all callers.
13779         (Output_section_headers::do_sized_write): Store overflow values
13780         for section count and section string table section index in
13781         section header zero.
13782         (Output_file_header::do_sized_write): Check for overflow of
13783         section count and section string table section index.
13784         (Output_symtab_xindex::do_write): New function.
13785         (Output_symtab_xindex::endian_do_write): New function.
13786         * output.h (class Output_section_headers): Add shstrtab_section_.
13787         Update declarations.
13788         (class Output_symtab_xindex): Define.
13789         (Output_section::has_out_shndx): New function.
13790         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13791         field.
13792         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13793         Change all callers.
13794         (Sized_symbol::init): Likewise.
13795         (Symbol::output_section): Check for ordinary symbol.
13796         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13797         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13798         callers.
13799         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13800         Change all callers.  Simplify handling of symbols from sections
13801         not included in the link.
13802         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13803         distinction.
13804         (Weak_alias_sorter::operator()): Assert that symbols are
13805         ordinary.
13806         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13807         distinction.
13808         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13809         parameters.  Change all callers.
13810         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13811         symbol distinction.  Use SHN_XINDEX when needed.
13812         (Symbol_table::write_section_symbol): Add symtab_xindex
13813         parameter.  Change all callers.
13814         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13815         SHN_XINDEX when needed.
13816         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13817         declarations.
13818         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13819         (Symbol::is_defined): Check is_ordinary.
13820         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13821         (Symbol::is_absolute, Symbol::is_common): Likewise.
13822         (class Sized_symbol): Update declarations.
13823         (class Symbol_table): Update declarations.
13824         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13825         parameters.  Change all callers.
13826         (Sized_symbol::override): Likewise.
13827         (Symbol_table::override): Likewise.
13828         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13829         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13830         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13831         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13832         to be in an ordinary section.
13833         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13834         object and is_ordinary parameters.  Change all callers.
13835         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13836         Change all callers.  Don't add undefined or non-ordinary symbols
13837         to reloc_map_.
13838         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13839         Change all callers.
13840         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13841         declarations.
13842         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13843         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13844         (Sized_relobj::relocate_sections): Likewise.
13845         * target-reloc.h (scan_relocs): Adjust section symbol index.
13846         (scan_relocatable_relocs): Likewise.
13847         * i386.cc (Scan::local): Check for ordinary symbols.
13848         * sparc.cc (Scan::local): Likewise.
13849         * x86_64.cc (Scan::local): Likewise.
13850         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13851         to symbol_section_and_value.
13852         * testsuite/many_sections_test.cc: New file.
13853         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13854         (check_PROGRAMS): Add many_sections_test.
13855         (many_sections_test_SOURCES): Define.
13856         (many_sections_test_DEPENDENCIES): Define.
13857         (many_sections_test_LDFLAGS): Define.
13858         (BUILT_SOURCES): Add many_sections_define.h.
13859         (many_sections_define.h): New target.
13860         (BUILT_SOURCES): Add many_sections_check.h.
13861         (many_sections_check.h): New target.
13862         (check_PROGRAMS): Add many_sections_r_test.
13863         (many_sections_r_test_SOURCES): Define.
13864         (many_sections_r_test_DEPENDENCIES): Define.
13865         (many_sections_r_test_LDFLAGS): Define.
13866         (many_sections_r_test_LDADD): Define.
13867         (many_sections_r_test.o): New target.
13868         * testsuite/Makefile.in: Rebuild.
13869
13870 2008-04-17  Cary Coutant  <ccoutant@google.com>
13871
13872         * errors.cc (Errors::info): New function.
13873         (gold_info): New function.
13874         * errors.h (Errors::info): New function.
13875         * gold.h (gold_info): New function.
13876         * object.cc (Input_objects::add_object): Print trace output.
13877         * options.cc (options::parse_set): New function.
13878         (General_options::parse_wrap): Deleted.
13879         (General_options::General_options): Deleted initializer.
13880         * options.h (options::String_set): New typedef.
13881         (options::parse_set): New function.
13882         (DEFINE_set): New macro.
13883         (General_options::wrap): Changed to use DEFINE_set. Changed
13884         callers of any_wrap_symbols and is_wrap_symbol.
13885         (General_options::trace, General_options::trace_symbol):
13886         New options.
13887         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13888         (General_options::wrap_symbols_): Deleted.
13889         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13890
13891 2008-04-17  David S. Miller  <davem@davemloft.net>
13892
13893         * options.cc (General_options::parse_V): New function.
13894         * options.h: Add entries for -V and -Qy.
13895
13896 2008-04-17  Ian Lance Taylor  <iant@google.com>
13897
13898         * common.cc (Symbol_table::allocate_commons): Remove options
13899         parameter.  Change caller.
13900         (Symbol_table::do_allocate_commons): Remove options parameter.
13901         Change caller.  Just call do_allocate_commons_list twice.
13902         (Symbol_table::do_allocate_commons_list): New function, broken out
13903         of do_allocate_commons.
13904         * common.h (class Allocate_commons_task): Remove options_ field.
13905         Update constructor.
13906         * symtab.cc (Symbol_table::Symbol_table): Initialize
13907         tls_commons_.
13908         (Symbol_table::add_from_object): Put TLS common symbols on
13909         tls_commons_ list.
13910         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13911         which are IN_OUTPUT_DATA.
13912         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13913         allocate_commons and do_allocate_commons declarations.  Declare
13914         do_allocate_commons_list.
13915         * gold.cc (queue_middle_tasks): Update creation of
13916         Allocate_commons_task to not pass options.
13917         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13918         (TLS_TEST_C_FLAGS): New variable.
13919         (tls_test_c_pic.o): New target.
13920         (tls_test_shared.so): Link in tls_test_c_pic.o.
13921         (tls_test_c_pic_ie.o): New target.
13922         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13923         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13924         (tls_test_c.o): New target.
13925         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13926         (tls_pic_test_LDADD): Likewise.
13927         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13928         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13929         (tls_test_c_gnu2.o): New target.
13930         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13931         tls_test_c_gnu2.o.
13932         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13933         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13934         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13935         * testsuite/tls_test.cc: Include "config.h".
13936         (t_last): Call t11_last.
13937         * testsuite/tls_test.h (t11, t11_last): Declare.
13938         * testsuite/tls_test_c.c: New file.
13939         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13940         * configure.ac: Check for OpenMP support.
13941         * configure, config.in, Makefile.in: Rebuild.
13942         * testsuite/Makefile.in: Rebuild.
13943
13944 2008-04-16  Cary Coutant  <ccoutant@google.com>
13945
13946         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13947         (Target_i386::tls_base_symbol_defined_): New field.
13948         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13949         (Target_i386::Scan::global): Likewise.
13950         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13951         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13952         (Target_x86_64::tls_base_symbol_defined_): New field.
13953         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13954         (Target_x86_64::Scan::global): Likewise.
13955
13956 2008-04-16  Cary Coutant  <ccoutant@google.com>
13957
13958         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13959         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13960         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13961         building shared libraries.
13962         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13963         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13964         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13965         * testsuite/Makefile.in: Rebuild.
13966         * testsuite/weak_undef.h: New file.
13967         * testsuite/weak_undef_file1.cc: Add extra test cases.
13968         * testsuite/weak_undef_file2.cc: Likewise.
13969         * testsuite/weak_undef_test.cc: Likewise.
13970
13971 2008-04-16  David S. Miller  <davem@davemloft.net>
13972
13973         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13974         Add issued_non_pic_error_ field.  Declare check_non_pic.
13975         (Target_sparc::Scan::check_non_pic): New function.
13976         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13977         (Target_sparc::Scan::global): Likewise.
13978
13979         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13980         * configure: Rebuild.
13981
13982         * options.h (DEFINE_enable): New macro.
13983         (new_dtags): New enable option.
13984         (initfirst, interpose, loadfltr, nodefaultlib,
13985         nodelete, nodlopen, nodump): New -z options.
13986         * layout.cc (Layout:finish_dynamic_section): If new
13987         dtags enabled, emit DT_RUNPATH.  Also, emit a
13988         DT_FLAGS_1 containing any specified -z flags.
13989
13990 2008-04-16  Ian Lance Taylor  <iant@google.com>
13991
13992         * copy-relocs.cc: New file.
13993         * copy-relocs.h: New file.
13994         * reloc.cc: Remove Copy_relocs code.
13995         * reloc.h: Likewise.
13996         * reloc-types.h (struct Reloc_types) [both versions]: Add
13997         get_reloc_addend_noerror.
13998         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13999         variants of add_global which take an addend which must be zero.
14000         * i386.cc: Include "copy-relocs.h".
14001         (class Target_i386): Change type of copy_relocs_ to variable,
14002         update initializer.
14003         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14004         Change all callers.
14005         (Target_i386::do_finalize_sections): Change handling of
14006         copy_relocs_.
14007         * sparc.cc: Include "copy-relocs.h".
14008         (class Target_sparc): Change type of copy_relocs_ to variable,
14009         update initializer.
14010         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14011         Change all callers.
14012         (Target_sparc::do_finalize_sections): Change handling of
14013         copy_relocs_.
14014         * x86_64.cc: Include "copy-relocs.h".
14015         (class Target_x86_64): Change type of copy_relocs_ to variable,
14016         update initializer.
14017         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14018         class.  Change all callers.
14019         (Target_x86_64::do_finalize_sections): Change handling of
14020         copy_relocs_.
14021         * Makefile.am (CCFILES): Add copy-relocs.cc.
14022         (HFILES): Add copy-relocs.h.
14023
14024         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14025
14026         * testsuite/script_test_4.sh: Permit leading zeroes.
14027
14028 2008-04-15  Ian Lance Taylor  <iant@google.com>
14029
14030         * script-sections.cc (Script_sections::create_segments): Use
14031         header_size_adjustment even when there is enough room for the
14032         headers.
14033         * testsuite/script_test_4.sh: New file.
14034         * testsuite/script_test_4.t: New file.
14035         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14036         (check_DATA): Add script_test_4.stdout.
14037         (MOSTLYCLEANFILES): Likewise.
14038         (script_test_4): New target.
14039         (script_test_4.stdout): New target.
14040         * testsuite/Makefile.in: Rebuild.
14041
14042         * sparc.cc: Add definitions for Output_data_plt_sparc class
14043         constants.
14044
14045 2008-04-14  David S. Miller  <davem@davemloft.net>
14046
14047         * sparc.cc: New file.
14048         * Makefile.am (TARGETSOURCES): Add sparc.cc
14049         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14050         * configure.tgt: Document targ_extra_size and
14051         targ_extra_big_endian.  Add entries for sparc-* and
14052         sparc64-*.
14053         * configure.ac: Handle targ_extra_size and
14054         targ_extra_big_endian.
14055         * Makefile.in: Rebuild.
14056         * configure: Likewise.
14057         * po/POTFILES.in: Likewise.
14058         * po/gold.pot: Likewise.
14059
14060 2008-04-14  Ian Lance Taylor  <iant@google.com>
14061
14062         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14063         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14064         in the name/type/flags to section mapping.  Don't call
14065         allocate_output_section.
14066         (Layout::choose_output_section): Change parameter from adjust_name
14067         to is_input_section.  Don't permit input sections after sections
14068         are attached to segments.  Don't call allocate_output_section.
14069         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14070         not write_enable_output_section.
14071         (Layout::make_output_section): Don't push to
14072         unattached_section_list_ nor call attach_to_segment.  Call
14073         attach_section_to_segment if sections are attached.
14074         (Layout::attach_sections_to_segments): New function.
14075         (Layout::attach_section_to_segment): New function.
14076         (Layout::attach_allocated_section_to_segment): Rename from
14077         attach_to_segment.  Remove flags parameter.
14078         (Layout::allocate_output_section): Remove function.
14079         (Layout::write_enable_output_section): Remove function.
14080         * layout.h (class Layout): Update for above changes.  Add new
14081         field sections_are_attached_.
14082         * output.h (Output_section::update_flags_for_input_section): New
14083         function.
14084         * output.cc (Output_section::add_input_section): Call
14085         update_flags_for_input_section.
14086         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14087
14088 2008-04-11  Cary Coutant  <ccoutant@google.com>
14089
14090         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14091         thought unnecessary.
14092         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14093
14094 2008-04-11  Ian Lance Taylor  <iant@google.com>
14095
14096         * output.h (class Output_section_data): Remove inline definition
14097         of set_addralign.
14098         * output.cc (Output_section_data::set_addralign): New function.
14099
14100 2008-04-11  Cary Coutant  <ccoutant@google.com>
14101
14102         Add support for TLS descriptors for i386 and x86_64.
14103         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14104         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14105         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14106         GOT_TYPE_TLS_DESC.
14107         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14108         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14109         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14110         relocations.
14111         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14112         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14113         Fix problem with initial-exec relocations.
14114         (Target_i386::Relocate::relocate_tls): Likewise.
14115         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14116         relaxation.
14117         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14118         support for section-plus-offset dynamic table entries.
14119         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14120         (Output_data_dynamic::Dynamic_entry): Add support for
14121         section-plus-offset dynamic table entries.
14122         (Output_data_dynamic::Classification): Likewise.
14123         (Output_data_dynamic::classification_): Renamed offset_.
14124         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14125         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14126         (Target_x86_64::make_plt_section): New function.
14127         (Target_x86_64::reserve_tlsdesc_entries): New function.
14128         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14129         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14130         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14131         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14132         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14133         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14134         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14135         add extra PLT entry for TLS descriptors.
14136         (Output_data_plt_x86_64::got_): New field.
14137         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14138         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14139         fields.
14140         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14141         descriptors.
14142         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14143         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14144         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14145         R_386_TLS_DESC_CALL relocations.
14146         (Target_x86_64::Scan::global): Likewise.
14147         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14148         for TLS descriptors.
14149         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14150         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14151         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14152         GD-to-IE relaxation.
14153         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14154         and TLS_DESCRIPTORS.
14155         * Makefile.in: Rebuild.
14156         * configure: Rebuild.
14157         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14158         (tls_test_shared2.so): New target.
14159         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14160         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14161         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14162         (tls_shared_gd_to_ie_test_LDADD): New variable.
14163         (tls_shared_gnu2_gd_to_ie_test): New target.
14164         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14165         New targets.
14166         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14167         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14168         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14169         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14170         (tls_shared_gnu2_test): New target.
14171         (tls_test_gnu2_shared.so): New target.
14172         (tls_shared_gnu2_test_SOURCES): New variable.
14173         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14174         (tls_shared_gnu2_test_LDFLAGS): New variable.
14175         (tls_shared_gnu2_test_LDADD): New variable.
14176         * testsuite/Makefile.in: Rebuild.
14177         * testsuite/Makefile.
14178
14179 2008-04-11  Ian Lance Taylor  <iant@google.com>
14180
14181         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14182         justsyms.t.
14183         * testsuite/Makefile.in: Rebuild.
14184
14185         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14186         long.
14187         * testsuite/script_test_2.cc (main): Adjust test.
14188
14189 2008-04-11  David S. Miller  <davem@davemloft.net>
14190             Ian Lance Taylor  <iant@google.com>
14191
14192         * options.h (General_options): Add entries for '-Y' and
14193         '-relax'.
14194         * options.cc (General_options:finalize): If -Y was used, add those
14195         entries to the library path instead of the default "/lib" and
14196         "/usr/lib".
14197
14198 2008-04-11  David S. Miller  <davem@davemloft.net>
14199
14200         * testsuite/justsyms.t: Start at 0x100.
14201         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14202         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14203         long.
14204         * testsuite/script_test_2.cc: Adjust string and section length
14205         checks.
14206
14207 2008-04-09  Ian Lance Taylor  <iant@google.com>
14208
14209         PR gold/5996
14210         * script-sections.cc (Sections_element::allocate_to_segment): Add
14211         orphan parameter.
14212         (Output_section_definition::allocate_to_segment): Likewise.
14213         (Orphan_output_section::allocate_to_segment): Likewise.
14214         (Script_sections::attach_sections_using_phdrs_clause): Don't
14215         propagate non-PT_LOAD segments to orphan sections.
14216         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14217         readelf rather than objdump.
14218         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14219         .interp section and PT_INTERP segment are the same size.
14220         * testsuite/Makefile.in: Rebuild.
14221
14222         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14223         aliases for symbols defined in the same object.
14224         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14225         (weak_alias_test_SOURCES): New variable.
14226         (weak_alias_test_DEPENDENCIES): New variable.
14227         (weak_alias_test_LDFLAGS): New variable.
14228         (weak_alias_test_LDADD): New variable.
14229         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14230         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14231         (weak_alias_test_3.o): New target.
14232         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14233         * testsuite/weak_alias_test_main.cc: New file.
14234         * testsuite/weak_alias_test_1.cc: New file.
14235         * testsuite/weak_alias_test_2.cc: New file.
14236         * testsuite/weak_alias_test_3.cc: New file.
14237
14238 2008-04-08  Ian Lance Taylor  <iant@google.com>
14239
14240         * options.h (class General_options): Add --noinhibit-exec option.
14241         * main.cc (main): Check --noinhibit-exec.
14242
14243         * options.h (class General_options): Define --wrap as a special
14244         option.  Add wrap_symbols_ field.
14245         (General_options::any_wrap_symbols): New function.
14246         (General_options::is_wrap_symbol): New function.
14247         * options.cc (General_options::parse_wrap): New function.
14248         (General_options::General_options): Initialize wrap_symbols_.
14249         * symtab.cc (Symbol_table::wrap_symbol): New function.
14250         (Symbol_table::add_from_object): Handle --wrap.
14251         * symtab.h (class Symbol_table): Declare wrap_symbol.
14252         * target.h (Target::wrap_char): New function.
14253         (Target::Target_info): Add wrap_char field.
14254         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14255         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14256         * testsuite/testfile.cc (Target_test::test_target_info):
14257         Likewise.
14258
14259         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14260         there is one.
14261
14262         * layout.h (class Layout): Add added_eh_frame_data_ field.
14263         * layout.cc (Layout::Layout): Initialize new field.
14264         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14265         output section until we find a section we merged successfully.
14266         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14267         that the size be non-zero.
14268
14269         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14270         qualifier.
14271
14272 2008-04-08  Craig Silverstein  <csilvers@google.com>
14273
14274         * configure.ac: Export new conditional variable HAVE_ZLIB.
14275         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14276         on HAVE_ZLIB.
14277         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14278         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14279
14280 2008-04-07  Ian Lance Taylor  <iant@google.com>
14281
14282         * version.cc (version_string): Set to "1.5".
14283
14284         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14285         Add issued_non_pic_error_ field.  Declare check_non_pic.
14286         (Target_x86_64::Scan::check_non_pic): New function.
14287         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14288         (Target_x86_64::Scan::global): Likewise.
14289
14290         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14291         addend parameter.  Change caller.  Handle merge sections.
14292         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14293         Address to Addend.  Don't add in the result of
14294         local_section_offset, pass down the addend and use the returned
14295         value.
14296         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14297         Update declarations of local_section_offset and symbol_value.
14298         * testsuite/two_file_test_1.cc (t18): New function.
14299         * testsuite/two_file_test_2.cc (f18): New function.
14300         * testsuite/two_file_test_main.cc (main): Call t18.
14301         * testsuite/two_file_test.h (t18, f18): Declare.
14302
14303         * configure.ac: Don't test for objdump, c++filt, or readelf.
14304         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14305         conditionals.
14306         (TEST_READELF): New variable.
14307         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14308         (check_PROGRAMS): Add two_file_strip_test.
14309         (two_file_strip_test): New target.
14310         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14311         (two_file_same_shared_strip_test_SOURCES): New variable.
14312         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14313         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14314         (two_file_same_shared_strip_test_LDADD): New variable.
14315         (two_file_shared_strip.so): New target.
14316         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14317         (ver_test_5.syms, ver_test_7.syms): Likewise.
14318         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14319         (strip_test_3.stdout): Use TEST_OBJDUMP.
14320         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14321
14322 2008-04-04  Cary Coutant  <ccoutant@google.com>
14323
14324         * symtab.h (Symbol::is_weak_undefined): New function.
14325         (Symbol::is_strong_undefined): New function.
14326         (Symbol::is_absolute): New function.
14327         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14328         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14329         absolute symbols.
14330         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14331         (weak_undef_test): New target.
14332         * testsuite/Makefile.in: Rebuild.
14333         * testsuite/weak_undef_file1.cc: New file.
14334         * testsuite/weak_undef_file2.cc: New file.
14335         * testsuite/weak_undef_test.cc: New file.
14336
14337 2008-04-03  Craig Silverstein  <csilvers@google.com>
14338
14339         * compressed_output.h (class Output_compressed_section): Use
14340         unsigned buffer.
14341         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14342         add zlib header.
14343         (zlib_compressed_suffix): Removed.
14344         (Output_compressed_section::set_final_data_size): Use unsigned
14345         buffers.
14346         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14347         Fix linker invocation.
14348         (flagstest_o_specialfile_and_compress_debug_sections):
14349         Likewise.
14350         * testsuite/Makefile.in: Regenerated.
14351
14352 2008-04-02  David S. Miller  <davem@davemloft.net>
14353
14354         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14355         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14356
14357 2008-04-02  Craig Silverstein  <csilvers@google.com>
14358
14359         * TODO: New file.
14360
14361 2008-04-02  Ian Lance Taylor  <iant@google.com>
14362
14363         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14364         parameters.  Update for new key type to views_.  Change all
14365         callers.
14366         (File_read::read): Adjust for byteshift in returned view.
14367         (File_read::add_view): New function, broken out of
14368         find_and_make_view.
14369         (File_read::make_view): New function, broken out of
14370         find_and_make_view.
14371         (File_read::find_or_make_view): Add offset and aligned
14372         parameters.  Rewrite accordingly.  Change all callers.
14373         (File_read::get_view): Add offset and aligned parameters.  Adjust
14374         for byteshift in return value.
14375         (File_read::get_lasting_view): Likewise.
14376         * fileread.h (class File_read): Update declarations.
14377         (class File_read::View): Add byteshift_ field.  Add byteshift to
14378         constructor.  Add byteshift method.
14379         * archive.h (Archive::clear_uncached_views): New function.
14380         (Archive::get_view): Add aligned parameter.  Change all callers.
14381         * object.h (Object::get_view): Add aligned parameter.  Change all
14382         callers.
14383         (Object::get_lasting_view): Likewise.
14384
14385         * fileread.cc (File_read::release): Don't call clear_views if
14386         there are multiple objects.
14387         * fileread.h (File_read::clear_uncached_views): New function.
14388         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14389         on the archive.
14390
14391 2008-03-31  Cary Coutant  <ccoutant@google.com>
14392
14393         Add thin archive support.
14394         * archive.cc (Archive::armagt): New const.
14395         (Archive::setup): Remove task parameter and calls to unlock.
14396         (Archive::unlock_nested_archives): New function.
14397         (Archive::read_header): Add nested_off parameter. Change
14398         all callers.
14399         (Archive::interpret_header): Likewise.
14400         (Archive::include_all_members): Change to handle thin
14401         archives.
14402         (Archive::include_member): Likewise.
14403         * archive.h (Archive::Archive): Add new parameters and
14404         initializers.
14405         (Archive::armagt): New const.
14406         (Archive::setup): Remove task parameter.
14407         (Archive::unlock_nested_archives): New function.
14408         (Archive::read_header): Add nested_off parameter.
14409         (Archive::interpret_header): Likewise.
14410         (Archive::Nested_archive_table): New typedef.
14411         (Archive::is_thin_archive_): New field.
14412         (Archive::nested_archives_): New field.
14413         (Archive::options_): New field.
14414         (Archive::dirpath_): New field.
14415         (Archive::task_): New field.
14416         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14417         for thin archives.  Pass additional parameters to
14418         Archive::Archive.  Unlock the archive file after calling
14419         Archive::setup.
14420
14421 2008-03-29  Ian Lance Taylor  <iant@google.com>
14422
14423         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14424         version symbol to be local.
14425         * testsuite/ver_test_4.sh: New file.
14426         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14427         (check_DATA): Add ver_test_4.syms.
14428         (ver_test_4.syms): New target.
14429         * testsuite/Makefile.in: Rebuild.
14430
14431         * output.cc
14432         (Output_section::Input_section_sort_entry::has_priority): New
14433         function.
14434         (Output_section::Input_section_sort_entry::match_file_name): New
14435         function.
14436         (Output_section::Input_section_sort_entry::match_section_name):
14437         Remove.
14438         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14439         Remove.
14440         (Output_section::Input_section_sort_entry::match_section_file):
14441         Remove.
14442         (Output_section::Input_section_sort_compare::operator()): Rewrite
14443         using new Input_section_sort_entry functions.  Sort crtbegin and
14444         crtend first.  Sort sections with no priority before sections with
14445         a priority.
14446         * testsuite/initpri1.c (d3): Check j != 4.
14447         (cd5): New constructor/destructor function.
14448         (main): Check j != 2.
14449
14450         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14451         new symbol when resolving, don't call set_is_default.
14452         * testsuite/ver_test_7.cc: New file.
14453         * testsuite/ver_test_7.sh: New file.
14454         * testsuite/Makefile.am (ver_test_7.so): New target.
14455         (ver_test_7.o): New target.
14456         (check_SCRIPTS): Add ver_test_7.sh.
14457         (check_DATA): Add ver_test_7.syms.
14458         (ver_test_7.syms): New target.
14459
14460 2008-03-28  Ian Lance Taylor  <iant@google.com>
14461
14462         * layout.cc (Layout::layout): If we see an input section with a
14463         name that needs sorting, set the must_sort flag for the output
14464         section.
14465         (Layout::make_output_section): If the name of the output section
14466         indicates that it might require sorting, set the may_sort flag.
14467         * output.h (Output_section::may_sort_attached_input_sections): New
14468         function.
14469         (Output_section::set_may_sort_attached_input_sections): New
14470         function.
14471         (Output_section::must_sort_attached_input_sections): New
14472         function.
14473         (Output_section::set_must_sort_attached_input_sections): New
14474         function.
14475         (class Output_section): Declare Input_section_sort_entry.  Define
14476         Input_section_sort_compare.  Declare
14477         sort_attached_input_sections.  Add new fields:
14478         may_sort_attached_input_sections_,
14479         must_sort_attached_input_sections_,
14480         attached_input_sections_are_sorted_.
14481         * output.cc (Output_section::Output_section): Initialize new
14482         fields.
14483         (Output_section::add_input_section): Add an entry to
14484         input_sections_ if may_sort or must_sort are true.
14485         (Output_section::set_final_data_size): Call
14486         sort_attached_input_sections if necessary.
14487         (Output_section::Input_section_sort_entry): Define new class.
14488         (Output_section::Input_section_sort_compare::operator()): New
14489         function.
14490         (Output_section::sort_attached_input_sections): New function.
14491         * configure.ac: Check whether the compiler supports constructor
14492         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14493         * testsuite/initpri1.c: New file.
14494         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14495         CONSTRUCTOR_PRIORITY.
14496         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14497         (initpri1_LDFLAGS): New variable.
14498         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14499
14500 2008-03-27  Ian Lance Taylor  <iant@google.com>
14501
14502         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14503         * testsuite/common_test_1.c: New file.
14504         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14505         (common_test_1_SOURCES): New variable.
14506         (common_test_1_DEPENDENCIES): New variable.
14507         (common_test_1_LDFLAGS): New variable.
14508
14509         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14510         and commons_ correctly when NAME/VERSION does not override
14511         NAME/NULL.
14512         * testsuite/ver_test_6.c: New file.
14513         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14514         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14515         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14516
14517 2008-03-26  Ian Lance Taylor  <iant@google.com>
14518
14519         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14520         of an undefined symbol from a version script.
14521         * testsuite/Makefile.am (ver_test_5.so): New target.
14522         (ver_test_5.o): New target.
14523         (check_SCRIPTS): Add ver_test_5.sh.
14524         (check_DATA): Add ver_test_5.syms.
14525         (ver_test_5.syms): New target.
14526         * testsuite/ver_test_5.cc: New file.
14527         * testsuite/ver_test_5.script: New file.
14528         * testsuite/ver_test_5.sh: New file.
14529         * Makefile.in, testsuite/Makefile.in: Rebuild.
14530
14531         PR gold/5986
14532         Fix problems building gold with gcc 4.3.0.
14533         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14534         (gold_error_at_location, gold_warning_at_location): Use it.
14535         * configure.ac: Check whether we can compile and use a template
14536         function with a printf attribute.
14537         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14538         when jumping over bytes.
14539         * object.cc: Instantiate Object::read_section_data.
14540         * debug.h: Include <cstring>
14541         * dwarf_reader.cc: Include <algorithm>
14542         * main.cc: Include <cstring>.
14543         * options.cc: Include <cstring>.
14544         * output.cc: Include <cstring>.
14545         * script.cc: Include <cstring>.
14546         * script.h: Include <string>.
14547         * symtab.cc: Include <cstring> and <algorithm>.
14548         * target-select.cc: Include <cstring>.
14549         * version.cc: Include <string>.
14550         * testsuite/testmain.cc: Include <cstdlib>.
14551         * configure, config.in: Rebuild.
14552
14553 2008-03-25  Ian Lance Taylor  <iant@google.com>
14554
14555         * options.cc: Include "../bfd/bfdver.h".
14556         (options::help): Print bug reporting address.
14557
14558         * version.cc (print_version): Adjust output for current value of
14559         BFD_VERSION_STRING.
14560
14561         * NEWS: New file.
14562
14563         * options.cc (options::help): Print list of supported targets.
14564         * target-select.h: Include <vector>.
14565         (class Target_selector): Make machine_, size_, and is_big_endian_
14566         fields const.  Add bfd_name_ and instantiated_target_ fields.
14567         (Target_selector::Target_selector): Add bfd_name parameter.
14568         (Target_selector::recognize): Make non-virtual, call
14569         do_recognize.
14570         (Target_selector::recognize_by_name): Make non-virtual, call
14571         do_recognize_by_name.
14572         (Target_selector::supported_names): New function.
14573         (Target_selector::bfd_name): New function.
14574         (Target_selector::do_instantiate_target): New pure virtual
14575         function.
14576         (Target_selector::do_recognize): New virtual function.
14577         (Target_selector::do_recognize_by_name): New virtual function.
14578         (Target_selector::instantiate_target): New private function.
14579         (supported_target_names): Declare.
14580         * target-select.cc (Target_selector::Target_selector): Update for
14581         new parameter and fields.
14582         (select_target_by_name): Check that the name matches before
14583         calling recognize_by_name.
14584         (supported_target_names): New function.
14585         * i386.cc (class Target_selector_i386): Update Target_selector
14586         constructor call.  Remove recognize and recognize_by_name.  Add
14587         do_instantiate_target.
14588         * x86_64.cc (class Target_selector_x86_64): Likewise.
14589         * testsuite/testfile.cc (class Target_selector_test): Update for
14590         changes to Target_selector.
14591
14592         * README: Rewrite, with some notes on unsupported features.
14593
14594 2008-03-24  Cary Coutant  <ccoutant@google.com>
14595
14596         * i386.cc (Target_i386::Got_type): New enum declaration.
14597         (Target_i386::Scan::local): Updated callers of Output_data_got
14598         member functions.
14599         (Target_i386::Scan::global): Likewise.
14600         (Target_i386::Relocate::relocate): Likewise.
14601         (Target_i386::Relocate::relocate_tls): Likewise.
14602         * object.h (Got_offset_list): New class.
14603         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14604         (Sized_relobj::local_got_offset): Likewise.
14605         (Sized_relobj::set_local_got_offset): Likewise.
14606         (Sized_relobj::local_has_tls_got_offset): Removed.
14607         (Sized_relobj::local_tls_got_offset): Removed.
14608         (Sized_relobj::set_local_tls_got_offset): Removed.
14609         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14610         * output.cc (Output_data_got::add_global): Added got_type parameter.
14611         (Output_data_got::add_global_with_rel): Likewise.
14612         (Output_data_got::add_global_with_rela): Likewise.
14613         (Output_data_got::add_global_pair_with_rel): New function.
14614         (Output_data_got::add_global_pair_with_rela): New function.
14615         (Output_data_got::add_local): Added got_type parameter.
14616         (Output_data_got::add_local_with_rel): Likewise.
14617         (Output_data_got::add_local_with_rela): Likewise.
14618         (Output_data_got::add_local_pair_with_rel): New function.
14619         (Output_data_got::add_local_pair_with_rela): New function.
14620         (Output_data_got::add_global_tls): Removed.
14621         (Output_data_got::add_global_tls_with_rel): Removed.
14622         (Output_data_got::add_global_tls_with_rela): Removed.
14623         (Output_data_got::add_local_tls): Removed.
14624         (Output_data_got::add_local_tls_with_rel): Removed.
14625         (Output_data_got::add_local_tls_with_rela): Removed.
14626         * output.h (Output_data_got::add_global): Added got_type parameter.
14627         (Output_data_got::add_global_with_rel): Likewise.
14628         (Output_data_got::add_global_with_rela): Likewise.
14629         (Output_data_got::add_global_pair_with_rel): New function.
14630         (Output_data_got::add_global_pair_with_rela): New function.
14631         (Output_data_got::add_local): Added got_type parameter.
14632         (Output_data_got::add_local_with_rel): Likewise.
14633         (Output_data_got::add_local_with_rela): Likewise.
14634         (Output_data_got::add_local_pair_with_rel): New function.
14635         (Output_data_got::add_local_pair_with_rela): New function.
14636         (Output_data_got::add_global_tls): Removed.
14637         (Output_data_got::add_global_tls_with_rel): Removed.
14638         (Output_data_got::add_global_tls_with_rela): Removed.
14639         (Output_data_got::add_local_tls): Removed.
14640         (Output_data_got::add_local_tls_with_rel): Removed.
14641         (Output_data_got::add_local_tls_with_rela): Removed.
14642         * resolve.cc (Symbol::override_base_with_special): Removed
14643         reference to has_got_offset_ field.
14644         * symtab.cc (Symbol::init_fields): Replaced initialization
14645         of got_offset_ with got_offsets_.  Removed initialization
14646         of has_got_offset_
14647         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14648         (Symbol::got_offset): Likewise.
14649         (Symbol::set_got_offset): Likewise.
14650         (Symbol::has_tls_got_offset): Removed.
14651         (Symbol::tls_got_offset): Removed.
14652         (Symbol::set_tls_got_offset): Removed.
14653         (Symbol::got_offset_): Removed.
14654         (Symbol::tls_mod_got_offset_): Removed.
14655         (Symbol::tls_pair_got_offset_): Removed.
14656         (Symbol::got_offsets_): New field.
14657         (Symbol::has_got_offset): Removed.
14658         (Symbol::has_tls_mod_got_offset): Removed.
14659         (Symbol::has_tls_pair_got_offset): Removed.
14660         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14661         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14662         member functions.
14663         (Target_x86_64::Scan::global): Likewise.
14664         (Target_x86_64::Relocate::relocate): Likewise.
14665         (Target_x86_64::Relocate::relocate_tls): Likewise.
14666
14667 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14668
14669         * yyscript.y: Fix spelling error in comment.
14670
14671 2008-03-24  Ian Lance Taylor  <iant@google.com>
14672
14673         * options.h (class General_options): Define build_id option.
14674         * layout.h (class Layout): Declare write_build_id, create_note,
14675         create_build_id.  Add build_id_note_ member.
14676         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14677         "libiberty.h", "md5.h", "sha1.h".
14678         (Layout::Layout): Initialize eh_frame_data_,
14679         eh_frame_hdr_section_, and build_id_note_.
14680         (Layout::finalize): Call create_build_id.
14681         (Layout::create_note): New function, broken out of
14682         Layout::create_gold_note.
14683         (Layout::create_gold_note): Call create_note.
14684         (Layout::create_build_id): New function.
14685         (Layout::write_build_id): New function.
14686         (Close_task_runner::run): Call write_build_id.
14687
14688         * x86_64.cc: Correct license to GPLv3.
14689
14690 2008-03-23  Ian Lance Taylor  <iant@google.com>
14691
14692         * options.cc: Include "demangle.h".
14693         (parse_optional_string): New function.
14694         (parse_long_option): Handle takes_optional_argument.
14695         (parse_short_option): Update dash_z initializer.  Handle
14696         takes_optional_argument.
14697         (General_options::General_options): Initialize do_demangle_.
14698         (General_options::finalize): Set do_demangle_.  Handle demangling
14699         style.
14700         * options.h (parse_optional_string): Declare.
14701         (struct One_option): Add optional_arg field.  Update constructor.
14702         Update call constructor calls.  Add takes_optional_argument
14703         function.
14704         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14705         (DEFINE_optional_string): Define.
14706         (General_options::demangle): Change from DEFINE_bool to
14707         DEFINE_optional_string.
14708         (General_options::no_demangle): New function.
14709         (General_options::do_demangle): New function.
14710         (General_options::set_do_demangle): New function.
14711         (General_options::execstack_status_): Move definition to end of
14712         class definition.
14713         (General_options::static_): Likewise.
14714         (General_options::do_demangle_): New field.
14715         * object.cc (big_endian>::get_symbol_location_info): Call
14716         Options::do_demangle, not Options::demangle.
14717         * symtab.cc (demangle): Likewise.
14718
14719 2008-03-22  Ian Lance Taylor  <iant@google.com>
14720
14721         * gold.h: Include <cstddef> and <sys/types.h>
14722         * options.h: Include <cstring>.
14723
14724 2008-03-21  Ian Lance Taylor  <iant@google.com>
14725
14726         * Added source code to GNU binutils.
14727 \f
14728 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14729
14730 Copying and distribution of this file, with or without modification,
14731 are permitted in any medium without royalty provided the copyright
14732 notice and this notice are preserved.
14733
14734 Local Variables:
14735 mode: change-log
14736 left-margin: 8
14737 fill-column: 74
14738 version-control: never
14739 End: