* options.cc (General_options::string_to_object_format): Accept
[external/binutils.git] / gold / ChangeLog
1 2013-03-08  Ian Lance Taylor  <iant@google.com>
2
3         * options.cc (General_options::string_to_object_format): Accept
4         "default".
5
6 2013-03-08  Alan Modra  <amodra@gmail.com>
7
8         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
9         pointer to Post_fde.
10         (struct Post_fde): Move definition to here..
11         * ehframe.cc (struct Post_fde): ..from here.
12         (Cie::write): Don't alloc Post_fde.
13         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
14
15 2013-03-07  Alan Modra  <amodra@gmail.com>
16
17         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
18         relocation referencing .LC0.
19         * testsuite/discard_locals_test.sh: Remove FIXMEs.
20
21 2013-03-07  Alan Modra  <amodra@gmail.com>
22
23         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
24         always_inline.  Add assembly for powerpc to avoid GOT.
25
26 2013-03-07  Alan Modra  <amodra@gmail.com>
27
28         * testsuite/script_test_10.sh: Don't test .bss section
29         header number.
30
31 2013-03-06  Alan Modra  <amodra@gmail.com>
32
33         * powerpc.cc (class Powerpc_relobj): Move some member functions.
34         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
35         all callers.  Handle folded sections.
36         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
37         to Powerpc_relobj.
38         (Global_symbol_visitor_opd::operator()): Likewise.
39
40 2013-03-04  Alan Modra  <amodra@gmail.com>
41
42         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
43         * testsuite/Makefile.in: Regenerate.
44
45 2013-03-01  Cary Coutant  <ccoutant@google.com>
46
47         Add dwp support for v2 DWARF package file format.
48         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
49         tu_length parameter.  Adjust all callers.
50         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
51         * dwp.cc: Include dwarf.h.
52         (Section_bounds): New struct type.
53         (Unit_set): New struct type.
54         (Dwo_file::Dwo_file): Initialize new data member.
55         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
56         Combine and rename to...
57         (Dwo_file::read_unit_index): ...this.
58         (Dwo_file::sized_read_compunit_index)
59         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
60         (Dwo_file::sized_read_unit_index): ...this.
61         (Dwo_file::copy_section): Remove section_name, is_str_offsets
62         parameters; add section_id parameter.
63         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
64         (Dwo_file::add_unit_set): ...this.
65         (Dwo_file::shndx_map_): Remove.
66         (Dwo_file::sect_offsets_): New data member.
67         (Dwp_output_file::Dwp_output_file): Initialize new data members.
68         (Dwp_output_file::add_section): Rename to...
69         (Dwp_output_file::add_contribution): ...this.
70         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
71         (Dwp_output_file::add_tu_set): Likewise.
72         (Dwp_output_file::Contribution): New type.
73         (Dwp_output_file::Section::contributions): New data member.
74         (Dwp_output_file::Cu_or_tu_set): Remove.
75         (Dwp_output_file::Section::Section): New ctor.
76         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
77         (Dwp_output_file::Dwp_index::Section_table): New type.
78         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
79         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
80         parameter.
81         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
82         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
83         (Dwp_output_file::Dwp_index::section_table): New member function.
84         (Dwp_output_file::Dwp_index::section_table_end): New member function.
85         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
86         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
87         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
88         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
89         (Dwp_output_file::Dwp_index::section_table_): New data member.
90         (Dwp_output_file::Dwp_index::section_mask_): New data member.
91         (Dwp_output_file::add_output_section): New member function.
92         (Dwp_output_file::write_new_section): New member function.
93         (Dwp_output_file::write_contributions): New member function.
94         (Dwp_output_file::section_id_map_): New data member.
95         (class Dwo_id_info_reader): Remove.
96         (class Unit_reader): New class.
97         (get_dwarf_section_name): New function.
98         (Dwo_file::read_executable): Adjust initializations of class data.
99         (Dwo_file::read): Add support for v2 package file format.
100         (Dwo_file::read_unit_index): Likewise.
101         (Dwo_file::sized_read_unit_index): Likewise.
102         (Dwo_file::copy_section): Likewise.
103         (Dwo_file::add_unit_set): Likewise.
104         (Dwp_output_file::add_output_section): Likewise.
105         (Dwp_output_file::add_contribution): Likewise.
106         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
107         for empty slot.
108         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
109         file format.
110         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
111         slot.
112         (Dwp_output_file::initialize): Remove unused function.
113         (Dwp_output_file::finalize): Add support for v2 package file format.
114         (Dwp_output_file::write_index): Likewise.
115         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
116         function prototype.
117
118 2013-03-01  Cary Coutant  <ccoutant@google.com>
119
120         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
121         function into class definition in header file.
122         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
123         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
124         New function.
125         (Dwarf_info_reader::check_buffer): Move here from .cc file.
126
127 2013-02-28  Alan Modra  <amodra@gmail.com>
128
129         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
130         * target.cc (Target::do_plt_fde_location): New function.
131         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
132         accessor function, and constructor param.
133         (struct Post_fde, Post_fdes): Declare.
134         (Cie::write): Add post_fdes param.
135         * ehframe.cc (Fde::write): Use plt_fde_location.
136         (struct Post_fde): Define.
137         (Cie::write): Stash FDEs added post merge mapping.
138         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
139         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
140         (Eh_frame::do_sized_write): Arrange to write post map FDES after
141         other FDEs.
142         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
143         (Target_powerpc::has_glink): New function.
144         (Target_powerpc::do_relax): Add eh_frame info for stubs.
145         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
146         glink_eh_frame_fde_32, default_fde): New data.
147         (Stub_table::eh_frame_added_): New var.
148         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
149         Make const.
150         (Stub_table::add_eh_frame): New function.
151         (Output_data_glink::add_eh_frame): New function.
152         (Target_powerpc::make_glink_section): Call add_eh_frame.
153
154 2013-02-15  Ian Lance Taylor  <iant@google.com>
155
156         * options.h (DEFINE_uint64_alias): Define.
157         (class General_options): Add -Ttext-segment as an alias for
158         -Ttext.
159
160 2013-02-15  Alan Modra  <amodra@gmail.com>
161
162         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
163         (Stub_table::do_write): ..here, two places.
164         (Stub_table::plt_call_size): Use it here too.
165
166 2013-02-11  Ian Lance Taylor  <iant@google.com>
167
168         * descriptors.cc (Descriptors::close_all): New function.
169         * descriptors.h (class Descriptors): Declare close_all.
170         (close_all_descriptors): New inline function.
171         * plugin.cc: Include "descriptors.h".
172         (Plugin_manager::cleanup): Call close_all_descriptors.
173
174 2013-02-06  Alan Modra  <amodra@gmail.com>
175
176         * README: Update coding style link.
177
178 2013-01-28  Cary Coutant  <ccoutant@google.com>
179
180         * dwp.cc (File_list): New typedef.
181         (Dwo_name_info_reader): New class.
182         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
183         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
184         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
185         (Dwo_file::read_executable): New function.
186         (Dwo_file::read): Move common setup code to ...
187         (Dwo_file::make_object): ... here.
188         (dwp_options): Add --exec/-e.
189         (usage): Likewise.
190         (main): Likewise.
191
192 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
193
194         * layout.cc (Layout::layout): Check for option text_reorder.
195         (Layout::make_output_section): Ditto.
196         * options.h (text_reorder): New option.
197         * output.cc (Input_section_sort_compare): Remove special ordering
198         of section names.
199         (Output_section::
200          Input_section_sort_section_name_special_ordering_compare::
201          operator()): New function.
202         (Output_section::sort_attached_input_sections): Use new sort function
203         for .text.
204         * output.h (Input_section_sort_section_name_special_ordering_compare):
205         New struct.
206         * testsuite/Makefile.am (text_section_grouping): Test option
207         --no-text-reorder
208         * testsuite/Makefile.in: Regenerate.
209         * testsuite/text_section_grouping.sh: Check order of functions without
210         default text reordering.
211
212 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
213
214         * options.h (General_options): Change default to true for new_dtags.
215
216 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
217
218         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
219         when enable_new_dtags is false.  Only add DT_RUNPATH when
220         enable_new_dtags is true.
221
222 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
223
224         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
225         used in declaration and definition consistent.
226         (Target_powerpc::symval_for_branch): Ditto.
227
228 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
229
230         * testsuite/plugin_final_layout.cc: Fix comment.
231
232 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
233
234         * layout.cc (Layout::layout): Do not do default sorting for
235         text sections when section ordering is specified.
236         (make_output_section): Ditto.
237         * testsuite/plugin_final_layout.cc: Name the function sections
238         to catch reordering issues.
239
240 2013-01-15  Alan Modra  <amodra@gmail.com>
241
242         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
243         plt-thread-safe.
244
245 2013-01-15  Alan Modra  <amodra@gmail.com>
246
247         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
248         * testsuite/Makefile.in: Regenerate.
249
250 2013-01-14  Alan Modra  <amodra@gmail.com>
251
252         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
253         * testsuite/Makefile.in: Regenerate.
254
255 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
256
257         PR bfd/14430
258         Fix mingw gold build with plugins enabled
259         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
260         * configure.ac: Export DLOPEN_LIBS and add headers check.
261         * plugin.cc: Handle non-dlfcn case.
262         * Makefile.in: Regenerate.
263         * config.in: Regenerate.
264         * configure: Regenerate.
265         * testsuite/Makefile.in: Regenerate.
266
267 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
268
269         * output.h (sort_attached_input_sections): Change to be public.
270         * script-sections.cc
271         (Output_section_definition::set_section_addresses): Sort
272         attached input sections according to section order before linker
273         script assigns section addresses.
274         (Orphan_output_section::set_section_addresses): Sort
275         attached input sections according to section order before linker
276         script assigns section addresses.
277         * Makefile.am (final_layout.sh): Use a simple linker script to
278         check if section ordering still works.
279         * Makefile.in: Regenerate.
280
281 2013-01-09  Ben Cheng  <bccheng@google.com>
282
283         * arm.cc (Target_arm::attributes_accept_div): New function.
284         (Target_arm::attributes_forbid_div): New function.
285         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
286         attribute using the same new functions as what bfd/elf32_arm.c
287         does.
288
289 2013-01-07  Cary Coutant  <ccoutant@google.com>
290
291         PR gold/14993
292         * output.cc (Output_section::add_input_section): For incremental
293         updates, don't track input sections that are allocated from patch
294         space.
295
296 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
297             Ian Lance Taylor  <iant@google.com>
298
299         PR gold/14897
300         * configure.ac (--enable-ld): Removed.
301         (install_as_default): Set to yes only for --enable-gold=default
302         or --disable-ld.
303         * configure: Regenerated.
304
305 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
306
307         * options.h (General_options): Add -fuse-ld= for GCC linker
308         option compatibility.
309
310 2013-01-04  Cary Coutant  <ccoutant@google.com>
311
312         * configure.ac: Fix typo restoring CXXFLAGS.
313         * configure: Regenerate.
314
315 2013-01-04  Cary Coutant  <ccoutant@google.com>
316
317         * testsuite/Makefile.am (CXXLINK_S): New macro.
318         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
319         * testsuite/Makefile.in: Regenerate.
320
321 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
322
323         * version.cc (print_version): Update copyright year to 2013.
324
325 2012-12-20  Ian Lance Taylor  <iant@google.com>
326
327         * layout.cc (Layout::special_ordering_of_input_section): New
328         function.
329         (Layout::layout): If input section requires special ordering, must
330         sort input sections.
331         (Layout::make_output_section): May sort .text input sections.
332         (Layout::is_section_name_prefix_grouped): Remove.
333         * layout.h (class Layout): Declare
334         special_ordering_of_input_section.  Don't declare
335         is_section_name_prefix_grouped.
336         * output.cc (Output_section::add_input_section): Revert last
337         change.
338         (Output_section::Input_section_sort::match_file_name): Don't crash
339         if called on output section data.
340         (Output_section::Input_section_sort_compare): Sort based on
341         special ordering.
342         (Output_section::Input_section_sort_section_order_index_compare):
343         Revert last patch.
344         (Output_section::sort_attached_input_sections): Likewise.
345
346 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
347
348         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
349         * layout.h (Layout::is_section_name_prefix_grouped): New function.
350         * output.cc (Output_section::add_input_section): Check if section
351         name contains special prefix.  Keep input sections to sort such
352         sections.
353         (Output_section::Input_section_sort_section_order_index_compare
354          ::operator()): Group sections according to prefixes.
355         (Output_section::sort_attached_input_sections): Add condition to
356         Input_section_entry constructor call.
357         * testsuite/Makefile.am (text_section_grouping): New test.
358         * testsuite/Makefile.in: Regenerate.
359         * testsuite/text_section_grouping.cc: New file.
360         * testsuite/text_section_grouping.sh: New file.
361
362 2012-12-17  Nick Clifton  <nickc@redhat.com>
363
364         * Makefile.am: Add copyright notice.
365         * NEWS: Likewise.
366         * README: Likewise.
367         * configure.ac: Likewise.
368         * ftruncate.c: Likewise.
369         * Makefile.in: Regenerate.
370
371 2012-12-14  Cary Coutant  <ccoutant@google.com>
372
373         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
374         --no-as-needed flag.
375         (exception_separate_shared_12_test): Likewise.
376         (incremental_copy_test): Likewise.
377         * testsuite/Makefile.in: Regenerate.
378
379 2012-12-14  Cary Coutant  <ccoutant@google.com>
380
381         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
382         (Dwp_output_file::Dwp_index::enter_set): Add assert.
383
384 2012-12-12  Alan Modra  <amodra@gmail.com>
385
386         * powerpc.cc (class Track_tls): New.
387         (class Relocate, class Scan): Inherit Track_tls.
388         (Target_powerpc::Scan::local, global): Track tls optimization
389         and avoid creating plt entry for __tls_get_addr if all uses
390         are optimized away.
391         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
392
393 2012-12-12  Alan Modra  <amodra@gmail.com>
394
395         * options.h (General_options): Add --toc-sort/--no-toc-sort.
396         Replace no_toc_optimize with toc_optimize.
397         * output.h (Output_section::input_sections): Provide non-const variant.
398         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
399         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
400         accessors.
401         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
402         (class Sort_toc_sections): New.
403         (Target_powerpc::do_finalize_sections): Sort toc sections.
404         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
405
406 2012-12-10  Roland McGrath  <mcgrathr@google.com>
407
408         * testsuite/binary_unittest.cc (read_all): New function.
409         (Sized_binary_test): Use it instead of ::read.
410         * fileread.cc (do_read): Don't assume pread always reads the whole
411         amount in a single call.
412
413 2012-12-10  Alan Modra  <amodra@gmail.com>
414
415         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
416         Set EM_PPC64 or EM_PPC here.
417         (Target_selector_powerpc::do_recognize): Delete.
418
419 2012-12-10  Alan Modra  <amodra@gmail.com>
420
421         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
422         stub_table_.
423         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
424
425 2012-12-07  Roland McGrath  <mcgrathr@google.com>
426
427         * testsuite/binary_unittest.cc (Sized_binary_test):
428         Use open_descriptor rather than ::open.
429
430 2012-12-07  Alan Modra  <amodra@gmail.com>
431
432         * powerpc.cc (Stub_table::do_write): Delete redundant Address
433         typedef and invalid_address constant.
434         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
435         instantiate constants.
436
437 2012-12-06  Roland McGrath  <mcgrathr@google.com>
438
439         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
440         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
441         * aclocal.m4: Regenerate.
442         * configure: Regenerate.
443         * Makefile.in: Regenerate.
444         * testsuite/Makefile.in: Regenerate.
445
446 2012-12-07  Alan Modra  <amodra@gmail.com>
447
448         * options.h (General_options): Add no_toc_optimize.
449         * powerpc.cc (ok_lo_toc_insn): New function.
450         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
451
452 2012-12-06  Alan Modra  <amodra@gmail.com>
453
454         * options.h (General_options): Add plt_align, plt_static_chain,
455         plt_thread_safe.  Update stub_group_size help text.
456         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
457         for new plt_thread_safe_ var.
458         (use_plt_offset): Correct comments.
459         (Target_powerpc::do_relax): Look for thread creation symbols to
460         determine default plt_thread_safe value.  Clear plt call stubs
461         as well as branch stubs each iteration.
462         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
463         insn constants.
464         (l, hi, ha, write_insn): Move earlier.
465         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
466         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
467         plt stubs too.
468         (Stub_table::update_size): Adjust.
469         (Stub_table::prev_size, set_prev_size): Delete.
470         (Stub_table::stub_align): Let --plt-align affect result.
471         (Stub_table::plt_call_size): Calculate sizes for various stubs.
472         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
473         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
474         (Stub_table::do_write): Support more stub variants.
475
476 2012-12-04  Alan Modra  <amodra@gmail.com>
477
478         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
479         (Target_powerpc::do_define_standard_symbols): New function.
480
481 2012-12-03  Alan Modra  <amodra@gmail.com>
482
483         * output.h: Formatting, whitespace.
484
485 2012-12-03  Alan Modra  <amodra@gmail.com>
486
487         * layout.h (Layout::get_executable_sections): Declare.
488         * layout.cc (Layout::get_executable_sections): New function.
489         * arm.cc (Target_arm::group_sections): Use it.
490         (Arm_output_section::group_sections): Delete now redundant test.
491         * output.cc (Output_reloc::Output_reloc): Add is_relative.
492         param to handle relative relocs.
493         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
494         (Output_data_reloc::add_absolute): Adjust.
495         (Output_data_reloc::add_relative): New function.
496         (Output_data::reset_data_size): New function.
497         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
498         (Output_section::set_addralign): New function.
499         (Output_section::checkpoint_set_addralign): New function.
500         (Output_section::clear_section_offsets_need_adjustment): New function.
501         (Output_section::input_sections): Make public.
502         * powerpc.cc (class Output_data_brlt_powerpc): New.
503         (class Stub_table, class Stub_control): New.
504         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
505         stub_table_, set_stub_table, stub_table): New vectors and accessor
506         functions.
507         (Target_powerpc::do_may_relax, do_relax, push_branch,
508         new_stub_table, stub_tables, brlt_section, group_sections,
509         add_branch_lookup_table, find_branch_lookup_table,
510         write_branch_lookup_table, make_brlt_section): New functions.
511         (Target_powerpc::struct Sort_sections, class Branch_info): New.
512         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
513         branch_info_): New vars.
514         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
515         make call stubs here.
516         (Output_data_glink): Remove all call stub handling from this class.
517         (Target_powerpc::Scan::local, global): Save interesting branch
518         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
519         (Target_powerpc::do_finalize_sections): Only make reg save/restore
520         functions on final link.
521         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
522         Handle long branch destinations too.
523         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
524         do_plt_address_for_local): Adjust lookup of plt call stubs.
525
526 2012-11-30  Alan Modra  <amodra@gmail.com>
527
528         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
529         relocs against protected symbols when building 32-bit shared libs.
530
531 2012-11-30  Alan Modra  <amodra@gmail.com>
532
533         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
534         param.  Call got_section() to make .got.  Update all callers
535         and their callers and so on.
536
537 2012-11-30  Alan Modra  <amodra@gmail.com>
538
539         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
540         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
541         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
542         value if it already exists.
543
544 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
545
546         PR gold/14858
547         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
548
549 2012-11-14  Roland McGrath  <mcgrathr@google.com>
550
551         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
552         than bfc instruction for data sandboxing.
553
554 2012-11-08  Alan Modra  <amodra@gmail.com>
555
556         * po/POTFILES.in: Regenerate.
557
558 2012-11-05  Alan Modra  <amodra@gmail.com>
559
560         * configure.ac: Apply 2012-09-10 change to config.in here.
561         * configure: Regenerate.
562
563 2012-11-05  Alan Modra  <amodra@gmail.com>
564
565         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
566         (struct Opd_ent): Use "Address" rather than "Offset".
567         (Output_data_got_powerpc::got_base_offset): Return Valtype.
568         (Target_powerpc::got_section): Make public.
569         (Target_powerpc::scan_relocs): Move code setting symbols..
570         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
571         Create _SDA_BASE_ only when referenced.
572
573 2012-11-02  Roland McGrath  <mcgrathr@google.com>
574
575         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
576         from last change.
577
578 2012-11-01  Roland McGrath  <mcgrathr@google.com>
579
580         * target.h (Sized_target::relocate_relocs): Use Elf_Off
581         for offset_in_output_section parameter.
582         (Sized_target::relocate_special_relocatable): Likewise.
583         * arm.cc (Target_arm::relocate_relocs): Likewise.
584         (Target_arm::relocate_special_relocatable): Likewise.
585         * i386.cc (Target_i386::relocate_relocs): Likewise.
586         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
587         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
588         * target-reloc.h (relocate_relocs): Likewise.
589         * testsuite/testfile.cc (Target_test): Likewise.
590         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
591         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
592
593         * system.h: Move inclusion of <clocale> to after <libintl.h> in
594         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
595
596         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
597         parameter, which is unused in the [!F_SETFD] case.
598
599         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
600         SYMNDX to off_t before comparing it to this->data_size().
601         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
602         * incremental.cc (Output_section_incremental_inputs::do_write):
603         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
604
605         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
606
607 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
608
609         * gold.cc (Target_arm::do_adjust_elf_header): Add the
610         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
611         in EABI_VER5.
612
613 2012-10-29  Cary Coutant  <ccoutant@google.com>
614
615         * dwp.cc (usage): Add file and exit status parameters;
616         add --help and --version options.
617         (print_version): New function.
618         (main): Add --help and --version options.
619
620 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
621
622         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
623         final_layout_sequence.txt.
624         * testsuite/Makefile.in: Regenerated.
625
626 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
627
628         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
629         COMPILE generated by automake.
630         (LINK1): Likewise.
631         (CXXCOMPILE1): Likewise.
632         (CXXLINK1): Likewise.
633         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
634         (LINK): Likewise.
635         (CXXCOMPILE): Likewise.
636         (CXXLINK): Likewise.
637         * testsuite/Makefile.in: Regenerated.
638
639 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
640
641         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
642         on bad fwrite return.
643
644 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
645
646         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
647         on val.
648
649 2012-10-23  Cary Coutant  <ccoutant@google.com>
650
651         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
652         * testsuite/Makefile.in: Regenerate.
653         * testsuite/dwp_test.h: New source file.
654         * testsuite/dwp_test_1.cc: New source file.
655         * testsuite/dwp_test_1.s: New source file.
656         * testsuite/dwp_test_1.sh: New source file.
657         * testsuite/dwp_test_1b.cc: New source file.
658         * testsuite/dwp_test_1b.s: New source file.
659         * testsuite/dwp_test_2.cc: New source file.
660         * testsuite/dwp_test_2.s: New source file.
661         * testsuite/dwp_test_2.sh: New source file.
662         * testsuite/dwp_test_main.cc: New source file.
663         * testsuite/dwp_test_main.s: New source file.
664
665 2012-10-23  Cary Coutant  <ccoutant@google.com>
666
667         * dwp.h: New header file.
668         * dwp.cc: New source file.
669         * gold.h: Move shared declarations to system.h.
670         * system.h: New header file.
671         * Makefile.am: Add dwp.
672         * Makefile.in: Regenerate.
673
674 2012-10-23  Cary Coutant  <ccoutant@google.com>
675
676         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
677         Dwarf_info_reader::read_from_pointer.
678         (Dwarf_pubnames_table::read_header): Likewise.
679         (Dwarf_pubnames_table::next_name): Likewise.
680         (Dwarf_die::read_attributes): Likewise.
681         (Dwarf_die::skip_attributes): Likewise.
682         (Dwarf_info_reader::read_from_pointer): New function template.
683         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
684         (Dwarf_pubnames_table): Likewise.
685         (Dwarf_info_reader::read_from_pointer): New function template.
686         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
687         Dwarf_pubnames_table ctor.
688
689 2012-10-23  Cary Coutant  <ccoutant@google.com>
690
691         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
692         abbrev_shndx.
693         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
694         abbrev_shndx_.
695         (Dwarf_info_reader::set_abbrev_shndx): New method.
696         (Dwarf_info_reader::abbrev_shndx_): New data member.
697
698 2012-10-23  Cary Coutant  <ccoutant@google.com>
699
700         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
701         from object, not parameters.
702         (Dwarf_info_reader::parse): Likewise.
703         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
704         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
705         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
706         methods.
707
708 2012-10-23  Cary Coutant  <ccoutant@google.com>
709
710         * fileread.cc (Input_file::Input_file): New constructor.
711         * fileread.h (class Input_file): Add new constructor.
712
713 2012-10-18  Alan Modra  <amodra@gmail.com>
714
715         PR gold/14727
716         * object.cc (Relobj::is_section_name_included): Also match
717         .sdata personality section.
718
719 2012-10-18  Alan Modra  <amodra@gmail.com>
720
721         * target-reloc.h (class Default_comdat_behavior): New, package up..
722         (get_comdat_behaviour): ..this.
723         (relocate_section): Add Relocate_comdat_behavior template arg,
724         adjust code to suit.
725         * arm.cc (Target_arm::relocate_section): Adjust to suit.
726         (Target_arm::scan_reloc_section): Likewise.
727         * i386.cc (Target_i386::relocate_section): Likewise.
728         * sparc.cc (Target_sparc::relocate_section): Likewise.
729         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
730         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
731         * powerpc.cc (class Relocate_comdat_behavior): New.
732         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
733         gold::relocate_section with new template arg.
734
735 2012-10-18  Alan Modra  <amodra@gmail.com>
736
737         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
738         dynamic relocs for GOT_TPREL got entries, without symbol if
739         resolving locally.
740         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
741         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
742         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
743
744 2012-10-17  Alan Modra  <amodra@gmail.com>
745
746         PR gold/14726
747         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
748
749 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
750
751         * layout.cc (Layout::include_section): Keep sections marked
752         SHF_EXCLUDE when doing relocatable links.
753
754 2012-10-16  Alan Modra  <amodra@gmail.com>
755
756         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
757         (Target_powerpc::do_finalize_sections): Call it.
758         (Output_data_save_res): New class and supporting functions.
759         (Target_powerpc::symval_for_branch): Only look up .opd entry for
760         normal symbols defined in object files.
761
762 2012-10-12  Alan Modra  <amodra@gmail.com>
763
764         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
765         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
766         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
767         section if scan_opd_relocs not yet called.
768         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
769
770 2012-10-12  Alan Modra  <amodra@gmail.com>
771
772         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
773         add_local_ifunc_entry): Revert last change.
774         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
775
776 2012-10-05  Alan Modra  <amodra@gmail.com>
777
778         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
779         do_plt_address_for_global): New functions.
780         (Output_data_got_powerpc::do_write): Don't segfault when linking
781         statically.
782         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
783         add_local_ifunc_entry): Return true on adding entry..
784         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
785         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
786         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
787         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
788         set up symbols here.
789         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
790         syms here.  Do so even when no .iplt.  Don't segfault when linking
791         statically.
792         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
793         new variants without reloc param.
794         (Glink_sym_ent::Glink_sym_ent): Likewise.
795         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
796         reloc when refs will resolve to plt call stub.
797         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
798         R_PPC_PLTREL24 to resolve locally.
799         (Target_powerpc::Scan::global): Correct ifunc handling.
800         (Target_powerpc::Relocate::relocate): Correct local sym glink
801         lookup.  Don't destroy "value" when we have a plt call stub,
802         and when checking plt call validity.
803         (Target_powerpc::do_dynsym_value): Simplify.
804
805 2012-10-05  Alan Modra  <amodra@gmail.com>
806
807         * i386.cc (Output_data_plt_i386::address_for_global,
808         address_for_local): Add plt offset to returned value.  Adjust uses.
809         * sparc.cc (Output_data_plt_sparc::address_for_global,
810         address_for_local): Likewise.
811         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
812         address_for_local): Likewise.
813         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
814         address_for_local): Likewise.
815         * target.h (Target::plt_address_for_global, plt_address_for_local):
816         Update comment.
817         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
818         (Output_data_got::Got_entry::write): Nor here.
819         * output.h: Comment fix.
820
821 2012-10-02  Jiong Wang  <jiwang@tilera.com>
822
823         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
824         global_offset_table_ value for larget got.
825         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
826
827 2012-09-29  Alan Modra  <amodra@gmail.com>
828
829         * powerpc.cc (Target_powerpc::iplt_): New output section.
830         (Target_powerpc::iplt_section, make_iplt_section,
831         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
832         (Target_powerpc::make_plt_entry): Handle ifunc syms.
833         Target_powerpc::plt_entry_count): Count iplt entries too.
834         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
835         reloc section in constructor.  New params.
836         (Target_powerpc::make_plt_section): Create reloc section here instead.
837         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
838         functions.
839         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
840         (Output_data_glink::add_entry, find_entry): New functions to
841         deal with local syms.
842         (Glink_sym_ent): Add support for local syms.
843         (Output_data_glink::do_write): Handle ifunc plt entries.
844         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
845         (Target_powerpc::Scan::local, global): Handle ifunc syms.
846         (Target_powerpc::Relocate::relocate): Likewise.
847         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
848
849 2012-09-25  Alan Modra  <amodra@gmail.com>
850
851         * object.h (Sized_relobj_file::adjust_local_symbol,
852         do_adjust_local_symbol): New functions.
853         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
854         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
855         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
856         and irregular opd entry spacing.
857         (Powerpc_relobj::do_read_relocs): Add opd size checks.
858         (Global_symbol_visitor_opd): New functor.
859         (Target_powerpc::do_finalize_sections): Omit global symbols defined
860         on deleted opd entries.
861
862 2012-09-15  Jiong Wang  <jiwang@tilera.com>
863
864         * tilegx.cc: New file.
865         * Makefile.am (TARGETSOURCES): Add tilegx.cc
866         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
867         * configure.tgt: Add entries for tilegx*.
868         * configure.ac: Likewise.
869         * Makefile.in: Rebuild.
870         * configure: Likewise.
871         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
872         tilegx.
873
874 2012-09-13  Alan Modra  <amodra@gmail.com>
875
876         * target-reloc.h (scan_relocs): Call scan.local for relocs
877         against symbols in discarded sections.  Pass is_discarded
878         param.
879         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
880         Add is_discarded param.
881         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
882         is_discarded to flag opd entry as discarded.  Don't emit dyn
883         relocs on such entries.
884         (Target_powerpc::Scan::global): Similarly detect and handle
885         such opd entries.
886         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
887         opd_ent_.  Update all uses.
888         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
889         (Target_powerpc::relocate_section): Zero out discarded opd
890         entry relocs.
891
892 2012-09-12  Ian Lance Taylor  <iant@google.com>
893
894         PR gold/14570
895         * output.cc: Rename Output_data_got template parameter from size
896         to got_size for all functions.  Compile all variants of
897         Output_data_got.
898         (Output_data_got::Got_entry::write): Correct use of size for
899         symbol value.  Use local_is_tls rather than casting to
900         Sized_relobj_file.
901         * object.h (class Object): Add local_is_tls and do_local_is_tls.
902         (class Sized_relobj_file): Add do_local_is_tls.
903         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
904
905 2012-09-11  Alan Modra  <amodra@gmail.com>
906
907         PR gold/14566
908         * layout.cc (Layout::set_segment_offsets): When using
909         common-page-size alignment, ensure we are on a new max-page-size
910         page.
911         * output.cc (Output_segment::set_section_addresses): Use
912         abi_pagesize, not common_pagesize for relro boundary.
913         (Output_segment::set_offset): Likewise.
914
915 2012-09-11  Alan Modra  <amodra@gmail.com>
916
917         * output.h (Output_data_got::add_global_tls, add_local_tls,
918         add_local_tls_pair): New functions.
919         (Output_data_got::add_local_pair_with_rel): Remove second
920         reloc param.  Expand comment.
921         (Output_data_got::Got_entry): Rename use_plt_offset_ to
922         use_plt_or_tls_offset_, similarly for constructor param.
923         (Output_data_got::Got_entry::write): Add got_index param.
924         * output.cc (Output_data_got::add_global_tls, add_local_tls,
925         add_local_tls_pair): New functions.
926         (Output_data_got::Got_entry::write): Handle tls symbols
927         with use_plt_or_tls_offset_ set specially.
928         (Output_data_got::add_local_pair_with_rel): Only one reloc.
929         (Output_data_got::do_write): Replace iterator with index, pass
930         index to entry write function.
931         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
932         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
933         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
934         call.
935         * i386.cc (Target_i386::Scan::local): Likewise.
936         * sparc.cc (Target_sparc::Scan::local): Likewise.
937         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
938         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
939         do_tls_offset_for_global): New functions.
940         (Target_powerpc::Scan::local): Correct TLS relocations and got
941         entry values.
942         (Target_powerpc::Scan::global): Don't emit unnecessary
943         dynamic relocations on TLS GOT entries.
944
945 2012-09-10  Matthias Klose  <doko@ubuntu.com>
946
947         * config.in: Disable sanity check for kfreebsd.
948
949 2012-09-10  Sterling Augustine  <saugustine@google.com>
950
951         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
952         (Gdb_index::pubtypes_read): New parameter.
953         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
954         to calls.
955         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
956         pubtypes_object_.
957
958 2012-09-09  Alan Modra  <amodra@gmail.com>
959
960         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
961         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
962         * gc.h (gc_process_relocs): Call target gc_add_reference.
963         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
964         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
965         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
966         unnecessary cast.
967         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
968         to cater for when we don't need code offset.  Update use.
969         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
970         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
971         set_opd_valid): New functions.
972         (Target_powerpc::do_gc_add_reference): New function.
973         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
974         stashed refs.
975         (Target_powerpc::do_gc_mark_symbol): New function.
976
977 2012-09-06  Cary Coutant  <ccoutant@google.com>
978
979         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
980         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
981         (Dwarf_die::skip_attributes): Likewise.
982         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
983         * testsuite/gdb_index_test.cc (inline_func_1): New function.
984         (main): Call it.
985         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
986
987 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
988
989         * testsuite/script_test_3.t: Add .got.plt output section
990         statement.
991         * testsuite/script_test_4.t: Likewise.
992
993 2012-09-05  Alan Modra  <amodra@gmail.com>
994
995         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
996         update all uses and lose "enum" when using type.
997
998 2012-09-05  Alan Modra  <amodra@gmail.com>
999
1000         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1001         * configure: Regenerate.
1002         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1003         (plugin_final_layout.stdout): Likewise.
1004         (memory_test): Set page sizes to 0x1000.
1005         * testsuite/Makefile.in: Regenerate.
1006         * testsuite/discard_locals_test.sh: Add FIXME comment.
1007         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1008         * testsuite/pr14265.t: Add .got output section statement.
1009         * testsuite/script_test_2.t: Likewise.
1010         * testsuite/script_test_3.t: Likewise.
1011         * testsuite/script_test_4.t: Likewise.
1012         * testsuite/script_test_5.t: Likewise.
1013         * testsuite/script_test_6.t: Likewise.
1014         * testsuite/script_test_7.t: Likewise.
1015         * testsuite/script_test_9.t: Likewise.
1016
1017 2012-09-05  Alan Modra  <amodra@gmail.com>
1018
1019         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1020         (Powerpc_relocate_functions::Status): New typedef.
1021         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1022         (Target_powerpc::Scan::local): Handle REL64.
1023         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1024         for REL32 and REL64.
1025         (Target_powerpc::symval_for_branch): New function, extracted from..
1026         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1027         checks.  Report overflow errors.
1028
1029 2012-09-05  Alan Modra  <amodra@gmail.com>
1030
1031         * object.h (Sized_relobj_file::emit_relocs): Delete.
1032         (Sized_relobj_file::emit_relocs_reltype): Delete.
1033         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1034         relocate_relocs for --emit-relocs.
1035         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1036         * output.h: Update comment.
1037         (Output_segment::first_section): New function.
1038         (Output_segment::first_section_load_address): Use first_section.
1039         * output.cc (Output_segment::first_section): New function extracted..
1040         (Output_segment::first_section_load_address): ..from here.  Delete.
1041         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1042         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1043         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1044         adjust call to target.h function.
1045         * i386.cc (Target_i386): Likewise.
1046         * sparc.cc (Target_sparc): Likewise.
1047         * x86_64.cc (Target_x86_64): Likewise.
1048         * powerpc.cc (Target_powerpc): Likewise.
1049         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1050         first tls section has section symbol for optimised local dynamic
1051         output relocs.
1052         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1053         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1054         optimised tls code.
1055         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1056         Rename to relocate_relocs.  Update error message.
1057
1058 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1059
1060         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1061         --just-symbols.
1062
1063 2012-08-31  Alan Modra  <amodra@gmail.com>
1064
1065         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1066         (Powerpc_relobj::toc_base_offset): New stub function.
1067         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1068         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1069         (Target_powerpc::Relocate::enum skip_tls): New.
1070         (Target_powerpc::call_tls_get_addr_): New var.
1071         (Target_powerpc::is_branch_reloc): Move to file scope.
1072         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1073         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1074         New functions.
1075         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1076         (powerpc_info): Correct common_pagesize for ppc64.
1077         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1078         (Powerpc_relocate_functions): Add overflow check enums and functions.
1079         Add non-shift version of rela, rela_ua.  Delete all rel public
1080         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1081         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1082         addr16_ha3, addr14 functions.
1083         (Output_data_got_powerpc::add_constant_pair): New function.
1084         (Output_data_got_powerpc::got_base_offset): Likewise.
1085         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1086         (instruction constants): Sort, add some more.
1087         (Output_data_glink::do_write): Add and use Address typedef.  Use
1088         object->toc_base_offset() stub for 64-bit.
1089         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1090         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1091         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1092         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1093         Always treat .opd relocs as against locally defined symbol.
1094         Correct condition for RELATIVE relocs.
1095         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1096         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1097         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1098         calculations.  Handle TLS relocs, and more.  Add overflow
1099         checking and adjust for Powerpc_relocate_functions changes.
1100         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1101         Reinstate --emit-relocs code with FIXME.
1102
1103 2012-08-30  Alan Modra  <amodra@gmail.com>
1104
1105         * layout.cc (Layout::set_segment_offsets): Set p_align to
1106         abi_pagesize, not common_pagesize.
1107         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1108         to determine whether file header can go in segment.
1109
1110 2012-08-30  Alan Modra  <amodra@gmail.com>
1111
1112         * output.h (Output_reloc::Output_reloc <output section>): Add
1113         is_relative param.  Adjust calls.
1114         (Output_reloc::add_output_section_relative): New functions.
1115         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1116         is_relative.
1117         (Output_reloc::symbol_value): Handle SECTION_CODE.
1118
1119 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1120
1121         * gold.cc (queue_middle_tasks): Call layout again when unique
1122         segments for sections is desired.
1123         * layout.cc (Layout::Layout): Initialize new members.
1124         (Layout::get_output_section_flags): New function.
1125         (Layout::choose_output_section): Call get_output_section_flags.
1126         (Layout::layout): Make output section for mapping to a unique segment.
1127         (Layout::insert_section_segment_map): New function.
1128         (Layout::attach_allocated_section_to_segment): Make unique segment for
1129         output sections marked so.
1130         (Layout::segment_precedes): Check for unique segments when sorting.
1131         * layout.h (Layout::Unique_segment_info): New struct.
1132         (Layout::Section_segment_map): New typedef.
1133         (Layout::insert_section_segment_map): New function.
1134         (Layout::get_output_section_flags): New function.
1135         (Layout::is_unique_segment_for_sections_specified): New function.
1136         (Layout::set_unique_segment_for_sections_specified): New function.
1137         (Layout::unique_segment_for_sections_specified_): New member.
1138         (Layout::section_segment_map_): New member.
1139         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1140         Rename is_gc_pass_one to is_pass_one.
1141         Rename is_gc_pass_two to is_pass_two.
1142         Rename is_gc_or_icf to is_two_pass.
1143         Check for which pass based on whether symbols data is present.
1144         Make it two pass when unique segments for sections is desired.
1145         * output.cc (Output_section::Output_section): Initialize new
1146         members.
1147         * output.h (Output_section::is_unique_segment): New function.
1148         (Output_section::set_is_unique_segment): New function.
1149         (Output_section::is_unique_segment_): New member.
1150         (Output_section::extra_segment_flags): New function.
1151         (Output_section::set_extra_segment_flags): New function.
1152         (Output_section::extra_segment_flags_): New member.
1153         (Output_section::segment_alignment): New function.
1154         (Output_section::set_segment_alignment): New function.
1155         (Output_section::segment_alignment_): New member.
1156         (Output_segment::Output_segment): Initialize is_unique_segment_.
1157         (Output_segment::is_unique_segment): New function.
1158         (Output_segment::set_is_unique_segment): New function.
1159         (Output_segment::is_unique_segment_): New member.
1160         * plugin.cc (allow_unique_segment_for_sections): New function.
1161         (unique_segment_for_sections): New function.
1162         (Plugin::load): Add new functions to transfer vector.
1163         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1164         * Makefile.in: Regenerate.
1165         * testsuite/plugin_final_layout.sh: Check if unique segment
1166         functionality works.
1167         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1168         are available.
1169         (allow_unique_segment_for_sections): New global.
1170         (unique_segment_for_sections): New global.
1171         (claim_file_hook): Call allow_unique_segment_for_sections.
1172         (all_symbols_read_hook): Call unique_segment_for_sections.
1173
1174 2012-08-22  Cary Coutant  <ccoutant@google.com>
1175
1176         * layout.cc (Layout::include_section): Don't assert on GROUP
1177         sections with --emit-relocs.
1178
1179 2012-08-21  Cary Coutant  <ccoutant@google.com>
1180
1181         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1182         if --export-dynamic-symbol names an undef symbol.
1183
1184 2012-08-18  Alan Modra  <amodra@gmail.com>
1185
1186         * powerpc.cc: Formatting and white space.
1187         (Powerpc_relobj): Rename got2_section_ to special_.
1188         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1189         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1190         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1191         (Target_powerpc): Add Address typedef and invalid_address.  Use
1192         throughout.
1193         (Target_powerpc::is_branch_reloc): New function.
1194         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1195         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1196         for dst_mask, value and addend.
1197         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1198         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1199         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1200         uint16_t for 24-bit offset.  Use get_output_section_offset and
1201         check return.
1202         (Target_powerpc::Scan::local): Handle more relocs.
1203         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1204         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1205         Plug in toc restoring insn after plt calls.  Translate branches
1206         to function descriptor symbols to corresponding entry point.
1207         (Target_powerpc::relocate_for_relocatable): Check return from
1208         get_output_section_offset.
1209         * symtab.h: Comment typo.
1210
1211 2012-08-14  Ian Lance Taylor  <iant@google.com>
1212
1213         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1214         unsupported_relocal_local to call unsupported_reloc_global.
1215
1216 2012-08-14  Nick Clifton  <nickc@redhat.com>
1217
1218         PR ld/14265
1219         * script-sections.cc (Sections_element::output_section_name): Add
1220         keep return parameter.
1221         (Output_section_element::match_name): Add keep return parameter.
1222         Return the value of the keep_ member.
1223         * script-sections.h (class Output_section): Update
1224         output_section_name prototype.
1225         * layout.cc (Layout::keep_input_section): New public member
1226         function.
1227         (Layout::choose_output_section): Pass keep parameter to
1228         output_section_name.
1229         * layout.h (class Layout): Add keep_input_section.
1230         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1231         sections.
1232         * testsuite/Makefile.am: Add a test.
1233         * testsuite/Makefile.in: Regenerate.
1234         * testsuite/pr14265.c: Source file for the test.
1235         * testsuite/pr14265.t: Linker script for the test.
1236         * testsuite/pr14265.sh: Shell script for the test.
1237
1238 2012-08-14  Alan Modra  <amodra@gmail.com>
1239
1240         * target.h (Target::output_section_name): New function.
1241         (Target::do_output_section_name): New function.
1242         * layout.cc (Layout::choose_output_section): Call the above.
1243         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1244
1245 2012-08-14  Alan Modra  <amodra@gmail.com>
1246
1247         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1248         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1249         for replace_constant call.
1250         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1251         (Output_data_glink::do_print_to_mapfile): New function.
1252         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1253         (Target_powerpc::Relocate::relocate): Likewise.
1254
1255 2012-08-14  Alan Modra  <amodra@gmail.com>
1256
1257         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1258         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1259         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1260         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1261         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1262         here.
1263         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1264         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1265         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1266         here.
1267         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1268         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1269
1270 2012-08-12  Alan Modra  <amodra@gmail.com>
1271
1272         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1273         (glink insn constants): Use uint32_t.
1274         (Output_data_glink::add_entry): Use insert, not [] operator.
1275
1276 2012-08-11  Alan Modra  <amodra@gmail.com>
1277
1278         * object.h (Sized_relobj_file::find_shdr): New function.
1279         (Sized_relobj_file::find_special_sections): New function.
1280         * object.cc (Sized_relobj_file::find_shdr): New function.
1281         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1282         (Sized_relobj_file::find_special_sections): New function, split out..
1283         (Sized_relobj_file::do_read_symbols): ..from here.
1284         * output.h (Output_data_got::replace_constant): New function.
1285         (Output_data_got::num_entries): New function.
1286         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1287         (Output_data_got::got_offset): Protected rather than private.
1288         (Output_data_got::replace_got_entry): New function.
1289         * output.cc (Output_data_got::replace_got_entry): New function.
1290         * powerpc.cc (class Powerpc_relobj): New.
1291         (class Powerpc_relocate_functions): Delete all psymval variants or
1292         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1293         Implement _ha functions using corresponding _hi function.
1294         (Powerpc_relobj::find_special_sections): New function.
1295         (Target_powerpc::do_make_elf_object): New function.
1296         (class Output_data_got_powerpc): New.
1297         (class Output_data_glink): New.
1298         (class Powerpc_scan_relocatable_reloc): New.
1299         Many more changes througout file.
1300
1301 2012-08-09  Nick Clifton  <nickc@redhat.com>
1302
1303         * po/vi.po: Updated Vietnamese translation.
1304
1305 2012-08-07  Ian Lance Taylor  <iant@google.com>
1306
1307         * layout.cc (Layout::add_target_dynamic_tags): If
1308         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1309         plt_rel.
1310
1311 2012-07-30  Nick Clifton  <nickc@redhat.com>
1312
1313         * po/gold.pot: Updated template.
1314         * po/es.po: Updated Spanish translation.
1315
1316 2012-07-18  Cary Coutant  <ccoutant@google.com>
1317
1318         PR gold/14344
1319         * configure.ac: Add check for -gpubnames support.
1320         * configure: Regenerate.
1321         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1322         support; force -gno-pubnames.
1323         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1324         support.
1325         (gdb_index_test_4): New test.
1326         * testsuite/Makefile.in: Regenerate.
1327         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1328         * testsuite/gdb_index_test_2.sh: Likewise.
1329         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1330         * testsuite/gdb_index_test_4.sh: New script.
1331         * testsuite/gdb_index_test_comm.sh: New script with common code;
1332         don't look for space after colon.
1333
1334 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1335
1336         * gold.cc (queue_middle_tasks): Update function order only after
1337         deferred objects due to plugins are processed.
1338
1339 2012-07-11  Ian Lance Taylor  <iant@google.com>
1340
1341         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1342         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1343         (Target_arm::scan_reloc_for_stub): Likewise.
1344         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1345         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1346         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1347         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1348         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1349
1350 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1351             Ian Lance Taylor  <iant@google.com>
1352
1353         PR gold/14309
1354         * configure.ac: Test whether std::tr1::hash<off_t> works.
1355         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1356         needed.
1357         * output.h (class Output_fill): Add virtual destructor.
1358         * configure, config.in: Rebuild.
1359
1360 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1361
1362         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1363
1364 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1365
1366         * plugin.cc (Plugin::load): Handle position independent executables.
1367
1368 2012-06-06  Cary Coutant  <ccoutant@google.com>
1369
1370         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1371         add .debug_macro.
1372         (lines_only_debug_sections): Likewise.
1373         (gdb_fast_lookup_sections): New static array.
1374         (is_gdb_debug_section): Rename formal parameter.
1375         (is_lines_only_debug_section): Likewise.
1376         (is_gdb_fast_lookup_section): New function.
1377         (Layout::include_section): Check for ".zdebug_" prefix; pass
1378         section name suffix to is_gdb_debug_section, et al.; check for
1379         fast-lookup sections when building .gdb_index.
1380         * options.h (--strip-debug-gdb): Update GDB version number.
1381
1382 2012-06-06  Cary Coutant  <ccoutant@google.com>
1383
1384         * configure.ac: Add check for fallocate.
1385         * configure: Regenerate.
1386         * config.in: Regenerate.
1387
1388         * options.h (class General_options): Add --mmap-output-file and
1389         --posix-fallocate options.
1390         * output.cc: (posix_fallocate): Remove; replace with...
1391         (gold_fallocate): New function.
1392         (Output_file::map_no_anonymous): Call gold_fallocate.
1393         (Output_file::map): Check --mmap-output-file option.
1394
1395 2012-06-05  Jing Yu  <jingyu@google.com>
1396
1397         * gold.h (textdomain): Add do {} to empty while(0).
1398         (bindtextdomain): Likewise.
1399
1400 2012-06-04  Cary Coutant  <ccoutant@google.com>
1401
1402         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1403         has_dynsym_index.
1404
1405 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1406
1407         * symtab.cc (Symbol_table::define_special_symbol):
1408         Initialize *poldsym to prevent uninitialized variable errors.
1409
1410 2012-05-23  Cary Coutant  <ccoutant@google.com>
1411
1412         * layout.cc (Layout::section_name_mapping): Add rules to handle
1413         exact match on .data.rel.ro.local or .data.rel.ro.
1414         (Layout::output_section_name): Check for exact matches.
1415
1416 2012-05-23  Cary Coutant  <ccoutant@google.com>
1417
1418         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1419         more carefully.
1420
1421 2012-05-22  Cary Coutant  <ccoutant@google.com>
1422
1423         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1424         object before exporting symbol.
1425
1426 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1427
1428         * testsuite/tls_test.cc: Include "config.h" first.
1429         * testsuite/tls_test_c.c: Likewise.
1430
1431 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1432             Nick Clifton  <nickc@redhat.com>
1433
1434         PR 14072
1435         * configure.in: Add check that sysdep.h has been included before
1436         any system header files.
1437         * configure: Regenerate.
1438         * config.in: Regenerate.
1439
1440 2012-05-14  Cary Coutant  <ccoutant@google.com>
1441
1442         * layout.cc (Layout::make_output_section): Mark .tdata section
1443         as RELRO.
1444         * testsuite/relro_test.cc: Add a TLS variable.
1445
1446 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1447
1448         PR gold/14091
1449         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1450         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1451         R_X86_64_64.
1452
1453 2012-05-08  Cary Coutant  <ccoutant@google.com>
1454
1455         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1456         (lines_only_debug_sections): Likewise.
1457
1458 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1459
1460         * nacl.cc: New file.
1461         * nacl.h: New file.
1462         * Makefile.am (CCFILES, HFILES): Add them.
1463         * Makefile.in: Regenerate.
1464         * i386.cc (Output_data_plt_i386_nacl): New class.
1465         (Output_data_plt_i386_nacl_exec): New class.
1466         (Output_data_plt_i386_nacl_dyn): New class.
1467         (Target_i386_nacl): New class.
1468         (Target_selector_i386_nacl): New class.
1469         (target_selector_i386): Use it instead of Target_selector_i386.
1470         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1471         (Target_x86_64_nacl): New class.
1472         (Target_selector_x86_64_nacl): New class.
1473         (target_selector_x86_64, target_selector_x32): Use it instead of
1474         Target_selector_x86_64.
1475         * arm.cc (Output_data_plt_arm_nacl): New class.
1476         (Target_arm_nacl): New class.
1477         (Target_selector_arm_nacl): New class.
1478         (target_selector_arm, target_selector_armbe): Use it instead of
1479         Target_selector_arm.
1480
1481         * target-select.cc (select_target): Take new Input_file* and off_t
1482         arguments, pass them on to recognize method of selector.
1483         * object.cc (make_elf_sized_object): Update caller.
1484         * parameters.cc (parameters_force_valid_target): Likewise.
1485         * incremental.cc (make_sized_incremental_binary): Likewise.
1486         * target-select.h: Update decl.
1487         (Target_selector::recognize): Take new Input_file* argument,
1488         pass it on to do_recognize.
1489         (Target_selector::do_recognize): Take new Input_file* argument.
1490         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1491         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1492         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1493         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1494
1495         * target.h (Target::Target_info): New members isolate_execinstr
1496         and rosegment_gap.
1497         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1498         * arm.cc (Target_arm::arm_info): Update initializer.
1499         * i386.cc (Target_i386::i386_info): Likewise.
1500         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1501         * sparc.cc (Target_sparc::sparc_info): Likewise.
1502         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1503         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1504         * layout.cc (Layout::attach_allocated_section_to_segment):
1505         Take new const Target* argument.  If target->isolate_execinstr(), act
1506         like --rosegment.
1507         (Layout::find_first_load_seg): Take new const Target* argument;
1508         if target->isolate_execinstr(), reject PF_X segments.
1509         (Layout::relaxation_loop_body): Update caller.
1510         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1511         reset file offset to zero when we hit LOAD_SEG, and then do a second
1512         loop over the segments before LOAD_SEG to reassign offsets after
1513         addresses have been determined.  Handle target->rosegment_gap().
1514         (Layout::attach_section_to_segment): Take new const Target* argument;
1515         pass it to attach_allocated_section_to_segment.
1516         (Layout::make_output_section): Update caller.
1517         (Layout::attach_sections_to_segments): Take new const Target* argument;
1518         pass it to attach_section_to_segment.
1519         * gold.cc (queue_middle_tasks): Update caller.
1520         * layout.h (Layout): Update method decls with new arguments.
1521
1522         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1523         Target_info pointer to use.
1524         (Target_arm::do_make_data_plt): New virtual method.
1525         (Target_arm::make_data_plt): New method that calls it.
1526         (Target_arm::make_plt_entry): Use it.
1527         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1528         for the section alignment.
1529         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1530         method.
1531         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1532         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1533         method.
1534         (Output_data_plt_arm::get_plt_entry_size): Call it.
1535         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1536         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1537         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1538         method.
1539         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1540         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1541         method instead of sizeof(plt_entry).
1542         (Output_data_plt_arm::add_entry): Likewise.
1543         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1544         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1545         than static method.
1546         (Target_arm::plt_entry_size): Likewise.
1547         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1548         Move to ...
1549         (Output_data_plt_arm_standard): ... here, new class.
1550         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1551         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1552         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1553
1554         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1555         Take additional argument for the PLT entry size.
1556         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1557         Use get_plt_entry_size method rather than plt_entry_size variable.
1558         (Output_data_plt_x86_64::reserve_slot): Likewise.
1559         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1560         (Output_data_plt_x86_64::add_entry): Likewise.
1561         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1562         (Output_data_plt_x86_64::address_for_global): Likewise.
1563         (Output_data_plt_x86_64::address_for_local): Likewise.
1564         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1565         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1566         Make method non-static.
1567         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1568         method.
1569         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1570         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1571         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1572         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1573         virtual method.
1574         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1575         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1576         virtual method.
1577         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1578         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1579         virtual method.
1580         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1581         (Output_data_plt_x86_64::plt_entry_size)
1582         (Output_data_plt_x86_64::first_plt_entry)
1583         (Output_data_plt_x86_64::plt_entry)
1584         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1585         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1586         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1587         (Output_data_plt_x86_64_standard): ... here, new class.
1588         (Target_x86_64::Target_x86_64): Take optional argument for the
1589         Target_info pointer to use.
1590         (Target_x86_64::do_make_data_plt): New virtual method.
1591         (Target_x86_64::make_data_plt): New method to call it.
1592         (Target_x86_64::init_got_plt_for_update): Use that.
1593         Call this->plt_->add_eh_frame method here.
1594         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1595         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1596         rather than static method.
1597         (Target_x86_64::plt_entry_size): Likewise.
1598         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1599         rather than plt_entry_size variable.  Move guts of PLT filling to...
1600         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1601         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1602         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1603
1604         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1605         additional argument for the section alignment.
1606         Don't do add_eh_frame_for_plt here.
1607         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1608         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1609         variable.
1610         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1611         method.
1612         (Output_data_plt_i386::get_plt_entry_size): Call it.
1613         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1614         (Output_data_plt_i386::add_eh_frame): New method to call it.
1615         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1616         method.
1617         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1618         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1619         method.
1620         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1621         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1622         method instead of plt_entry_size.
1623         (Output_data_plt_i386::plt_entry_size)
1624         (Output_data_plt_i386::plt_eh_frame_fde_size)
1625         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1626         (Output_data_plt_i386_standard): ... here, new class.
1627         (Output_data_plt_i386_exec): New class.
1628         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1629         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1630         (Output_data_plt_i386::exec_plt_entry): Move to ...
1631         (Output_data_plt_i386_exec::plt_entry): ... here.
1632         (Output_data_plt_i386_dyn): New class.
1633         (Output_data_plt_i386::first_plt_entry): Move to ...
1634         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1635         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1636         (Output_data_plt_i386_dyn::plt_entry): ... here.
1637         (Target_i386::Target_i386): Take optional argument for the Target_info
1638         pointer to use.
1639         (Target_i386::do_make_data_plt): New virtual method.
1640         (Target_i386::make_data_plt): New method to call it.
1641         (Target_i386::make_plt_section): Use that.
1642         Call this->plt_->add_eh_frame method here.
1643         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1644         rather than plt_entry_size variable.
1645         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1646         (Output_data_plt_i386::address_for_local): Likewise.
1647         (Output_data_plt_i386::do_write): Likewise.
1648         Move guts of PLT filling to...
1649         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1650         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1651         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1652         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1653
1654 2012-05-01  Cary Coutant  <ccoutant@google.com>
1655
1656         * dwarf_reader.cc (Dwarf_die::read_attributes)
1657         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1658         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1659         * reduced_debug_output.cc
1660         (Output_reduced_debug_info_section::get_die_end): Remove
1661         DW_FORM_GNU_ref_index.  Add default case.
1662
1663 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1664
1665         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1666         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1667         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1668         DW_AT_high_pc as offset from DW_AT_low_pc.
1669
1670         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1671         * testsuite/Makefile.in: Regenerate.
1672         * testsuite/gdb_index_test_3.c: New test source file.
1673         * testsuite/gdb_index_test_3.sh: New test source file.
1674
1675 2012-04-25  Ian Lance Taylor  <iant@google.com>
1676
1677         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1678         pointer.
1679         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1680         as a class, not a struct.
1681         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1682         (Target_arm::apply_cortex_a8_workaround): Likewise.
1683         * gc.h: Declare Reloc_types as a struct, not a class.
1684         * object.h: Declare Symbols_data as a struct.
1685         * reloc.h: Declare Read_relocs_data as a struct.
1686         * target.h: Declare Relocate_info as a struct.
1687
1688 2012-04-24  David S. Miller  <davem@davemloft.net>
1689
1690         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1691         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1692         and R_SPARC_WPLT30.
1693
1694 2012-04-24  Cary Coutant  <ccoutant@google.com>
1695
1696         * incremental-dump.cc (find_input_containing_global): Replace
1697         magic number with symbolic constant.
1698         (dump_incremental_inputs): Update version number.
1699         * incremental.cc (Output_section_incremental_inputs): Update version
1700         number; import symbolic constants from Incremental_inputs_reader.
1701         (Incremental_inputs::create_data_sections): Align relocations
1702         section correctly for 64-bit targets.
1703         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1704         constants; add padding.
1705         (Output_section_incremental_inputs::write_header): Add assert for
1706         header_size.
1707         (Output_section_incremental_inputs::write_input_files): Add assert
1708         for input_entry_size.
1709         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1710         add assert for object_info_size, input_section_entry_size,
1711         global_sym_entry_size.
1712         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1713         for data structure sizes; use them.
1714         (Incremental_input_entry_reader): Import symbolic constants from
1715         Incremental_inputs_reader; use them.
1716
1717 2012-04-23  David S. Miller  <davem@davemloft.net>
1718
1719         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1720         and elf_flags_set_.
1721         (Target_sparc::Target_sparc): Initialize new fields.
1722         (Target_sparc::do_make_elf_object): New function.
1723         (Target_sparc::do_adjust_elf_header): New function.
1724
1725 2012-04-23  Cary Coutant  <ccoutant@google.com>
1726
1727         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1728         CU range table of gdb index.
1729
1730 2012-04-20  David S. Miller  <davem@davemloft.net>
1731
1732         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1733         instead of false.
1734
1735 2012-04-16  David S. Miller  <davem@davemloft.net>
1736
1737         * sparc.cc (Target_sparc::got_address): New function.
1738         (Sparc_relocate_functions::gdop_hix22): New function.
1739         (Sparc_relocate_functions::gdop_lox10): New function.
1740         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1741         relocs.
1742         (Target_sparc::Scan::local): Likewise if the global symbol is not
1743         preemptible and is not IFUNC.
1744         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1745         transformations for local and non-preemptible non-IFUNC global
1746         symbols.
1747
1748         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1749         writing out 64-bit part of ranges.
1750
1751         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1752         -fpic and -fpie respectively.
1753         * Makefile.in: Regenerate.
1754
1755         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1756         (Target_sparc::Target_sparc): Initialize new field.
1757         (Target_sparc::do_plt_section_for_global): New function.
1758         (Target_sparc::do_plt_section_for_local): New function.
1759         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1760         (Target_sparc::make_plt_section): New function, broken out of
1761         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1762         (Target_sparc::make_plt_entry): Call make_plt_section.
1763         (Target_sparc::make_local_ifunc_plt_entry): New function.
1764         (Target_sparc::rela_ifunc_section): New function.
1765         (Target_sparc::plt_section): Remove const.
1766         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1767         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1768         and ifunc_count_ fields.
1769         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1770         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1771         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1772         (Output_data_plt_sparc::rela_ifunc): New function.
1773         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1774         (Output_data_plt_sparc::has_ifunc_section): New function.
1775         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1776         (Output_data_plt_sparc::address_for_global): New function.
1777         (Output_data_plt_sparc::address_for_local): New function.
1778         (Output_data_plt_sparc::plt_index_to_offset): New function.
1779         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1780         and entry_count.
1781         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1782         entry_count.
1783         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1784         R_SPARC_JMP_IREL to switch.
1785         (Target_sparc::Scan::check_non_pic): Likewise.
1786         (Target_sparc::Scan::local): Handle IFUNC symbols.
1787         (Target_sparc::Scan::local): Likewise.
1788         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1789         and plt_address_for_local.
1790         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1791         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1792
1793         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1794         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1795         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1796         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1797         global relocs too.
1798         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1799         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1800         calls.
1801         * sparc.cc (Target_sparc::Scan::global): Likewise.
1802         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1803
1804 2012-04-16  Cary Coutant  <ccoutant@google.com>
1805
1806         * archive.cc (Library_base::should_include_member): Check for
1807         --export-dynamic-symbol.
1808         * options.h (class General_options): Add --export-dynamic-symbol.
1809         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1810         --export-dynamic-symbol.
1811         (Symbol_table::gc_mark_undef_symbols): Likewise.
1812         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1813
1814 2012-04-12  David S. Miller  <davem@davemloft.net>
1815
1816         * sparc.cc (Reloc::wdisp10): New relocation method.
1817         (Reloc::h34): Likewise.
1818         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1819         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1820         R_SPARC_WDISP10.
1821         (Target_sparc::Scan::local): Likewise.
1822         (Target_sparc::Scan::global): Likewise.
1823         (Target_sparc::Relocate::relocate): Likewise.
1824
1825 2012-04-09  Cary Coutant  <ccoutant@google.com>
1826
1827         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1828         low_pc == 0.
1829
1830 2012-04-06  Ian Lance Taylor  <iant@google.com>
1831
1832         * timer.cc: #include <unistd.h>.
1833
1834 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1835
1836         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1837         * config.in: Regenerate.
1838         * configure: Regenerate.
1839
1840 2012-04-05  Nick Clifton  <nickc@redhat.com>
1841
1842         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1843         (AM_LC_MESSAGES): Add.
1844         * aclocal.m4: Regenerate.
1845         * config.in: Regenerate.
1846         * configure: Regenerate.
1847
1848 2012-03-21  Cary Coutant  <ccoutant@google.com>
1849
1850         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1851         * Makefile.in: Regenerate.
1852         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1853         (Sized_elf_reloc_mapper::symbol_section): New function.
1854         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1855         (make_elf_reloc_mapper): New function.
1856         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1857         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1858         (Dwarf_abbrev_table::do_get_abbrev): New function.
1859         (Dwarf_ranges_table::read_ranges_table): New function.
1860         (Dwarf_ranges_table::read_range_list): New function.
1861         (Dwarf_pubnames_table::read_section): New function.
1862         (Dwarf_pubnames_table::read_header): New function.
1863         (Dwarf_pubnames_table::next_name): New function.
1864         (Dwarf_die::Dwarf_die): New function.
1865         (Dwarf_die::read_attributes): New function.
1866         (Dwarf_die::skip_attributes): New function.
1867         (Dwarf_die::set_name): New function.
1868         (Dwarf_die::set_linkage_name): New function.
1869         (Dwarf_die::attribute): New function.
1870         (Dwarf_die::string_attribute): New function.
1871         (Dwarf_die::int_attribute): New function.
1872         (Dwarf_die::uint_attribute): New function.
1873         (Dwarf_die::ref_attribute): New function.
1874         (Dwarf_die::child_offset): New function.
1875         (Dwarf_die::sibling_offset): New function.
1876         (Dwarf_info_reader::check_buffer): New function.
1877         (Dwarf_info_reader::parse): New function.
1878         (Dwarf_info_reader::do_parse): New function.
1879         (Dwarf_info_reader::do_read_string_table): New function.
1880         (Dwarf_info_reader::lookup_reloc): New function.
1881         (Dwarf_info_reader::get_string): New function.
1882         (Dwarf_info_reader::visit_compilation_unit): New function.
1883         (Dwarf_info_reader::visit_type_unit): New function.
1884         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1885         Sized_elf_reloc_mapper.
1886         (Sized_dwarf_line_info::symbol_section): Remove function.
1887         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1888         (Sized_dwarf_line_info::read_line_mappings): Remove object
1889         parameter, adjust callers.
1890         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1891         * dwarf_reader.h: Include <sys/types.h>.
1892         (class Track_relocs): Remove forward declaration.
1893         (class Elf_reloc_mapper): New class.
1894         (class Sized_elf_reloc_mapper): New class.
1895         (class Dwarf_abbrev_table): New class.
1896         (class Dwarf_range_list): New class.
1897         (class Dwarf_ranges_table): New class.
1898         (class Dwarf_pubnames_table): New class.
1899         (class Dwarf_die): New class.
1900         (class Dwarf_info_reader): New class.
1901         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1902         (Sized_dwarf_line_info::symbol_section): Remove member function.
1903         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1904         base class.
1905         * gdb-index.cc: New source file.
1906         * gdb-index.h: New source file.
1907         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1908         and .debug_types sections, call Layout::add_to_gdb_index.
1909         (Sized_relobj_incr::do_section_name): Implement.
1910         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1911         return type; Implement.
1912         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1913         return type.
1914         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1915         parameter list and return type.
1916         (Sized_incr_dynobj::do_section_contents): Likewise.
1917         * layout.cc: Include gdb-index.h.
1918         (Layout::Layout): Initialize gdb_index_data_.
1919         (Layout::init_fixed_output_section): Check for .gdb_index section.
1920         (Layout::add_to_gdb_index): New function. Instantiate.
1921         * layout.h: Add forward declaration for class Gdb_index.
1922         (Layout::add_to_gdb_index): New member function.
1923         (Layout::gdb_index_data_): New data member.
1924         * main.cc: Include gdb-index.h.
1925         (main): Print statistics for gdb index.
1926         * object.cc (Object::section_contents): Move code into
1927         do_section_contents.
1928         (need_decompressed_section): Check for sections needed when building
1929         gdb index.
1930         (build_compressed_section_map): Likewise.
1931         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1932         gdb index.
1933         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1934         sections; call Layout::add_to_gdb_index.
1935         (Sized_relobj_file::do_decompressed_section_contents): Call
1936         do_section_contents directly.
1937         * object.h (Object::do_section_contents): Adjust parameter list and
1938         return type.
1939         (Object::do_decompressed_section_contents): Call do_section_contents
1940         directly.
1941         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1942         return type.
1943         * options.h (class General_options): Add --gdb-index option.
1944         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1945         list and return type.
1946         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1947         * reloc.h (Track_relocs::checkpoint): New function.
1948         (Track_relocs::reset): New function.
1949
1950         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1951         New test cases.
1952         * testsuite/Makefile.in: Regenerate.
1953         * testsuite/gdb_index_test.cc: New test source file.
1954         * testsuite/gdb_index_test_1.sh: New test source file.
1955         * testsuite/gdb_index_test_2.sh: New test source file.
1956
1957 2012-03-19  Doug Kwan  <dougkwan@google.com>
1958
1959         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1960         (Target_arm::do_finalize_sections): Remove code which defines
1961         __exidx_start and __exidx_end.  Make symbol table parameter
1962         anonymous as it is not used.
1963         * gold.cc (queue_middle_tasks): Call target hook to define any
1964         target-specific symbols.
1965         * target.h (Target::define_standard_symbols): New method.
1966         (Target::do_define_standard_symbols): Same.
1967         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1968         * testsuite/Makefile.in: Regenerate.
1969         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1970         and __exidx_end.
1971         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1972         relocations are generated for __exidx_start and __exidx_end.
1973
1974 2012-03-16  Doug Kwan  <dougkwan@google.com>
1975
1976         * testsuite/Makefile.am: Disable test initpri3b.
1977         * testsuite/Makefile.in: Regenerate.
1978
1979 2012-03-15  Doug Kwan  <dougkwan@google.com>
1980
1981         * arm.cc (Target_arm::got_section): Make .got section read-only
1982         if -z now is given.
1983
1984 2012-03-15  Ian Lance Taylor  <iant@google.com>
1985
1986         PR gold/13850
1987         * layout.cc (Layout::make_output_section): Correctly mark
1988         SHT_INIT_ARRAY, et. al., as relro.
1989
1990 2012-03-14  Doug Kwan  <dougkwan@google.com>
1991
1992         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1993         dynamic relocations for protected symbols in shared objects.
1994
1995 2012-03-13  Ian Lance Taylor  <iant@google.com>
1996
1997         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1998         keep the larger alignment.
1999
2000 2012-03-12  Cary Coutant  <ccoutant@google.com>
2001
2002         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2003         handling of DW_LNE_define_file.
2004
2005 2012-03-12  Cary Coutant  <ccoutant@google.com>
2006
2007         * reduced_debug_output.cc
2008         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2009         codes to switch.
2010
2011 2012-02-29  Cary Coutant  <ccoutant@google.com>
2012
2013         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2014
2015 2012-02-29  Cary Coutant  <ccoutant@google.com>
2016
2017         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2018         Call Object::decompressed_section_contents.
2019         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2020         New dtor.
2021         (Sized_dwarf_line_info::buffer_start_): New data member.
2022         * merge.cc (Output_merge_data::do_add_input_section): Call
2023         Object::decompressed_section_contents.
2024         (Output_merge_string::do_add_input_section): Likewise.
2025         * object.cc (need_decompressed_section): New function.
2026         (build_compressed_section_map): Decompress sections needed later.
2027         (Sized_relobj_file::do_decompressed_section_contents): New function.
2028         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2029         * object.h (Object::decompressed_section_contents): New function.
2030         (Object::discard_decompressed_sections): New function.
2031         (Object::do_decompressed_section_contents): New function.
2032         (Object::do_discard_decompressed_sections): New function.
2033         (Compressed_section_info): New type.
2034         (Compressed_section_map): Include decompressed section contents.
2035         (Sized_relobj_file::do_decompressed_section_contents): New function.
2036         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2037
2038 2012-02-16  Cary Coutant  <ccoutant@google.com>
2039
2040         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2041         * testsuite/Makefile.in: Regenerate.
2042
2043 2012-02-14  Cary Coutant  <ccoutant@google.com>
2044
2045         * options.cc (General_options::finalize): Disallow -pie and -static.
2046
2047 2012-02-03  Doug Kwan  <dougkwan@google.com>
2048
2049         * arm.cc (Arm_relocate_functions::abs8,
2050         Arm_relocate_functions::abs16): Use
2051         Bits::has_signed_unsigned_overflow32.
2052         (Arm_relocate_functions::thm_abs8): Correct range of
2053         overflow check.
2054         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2055         in assertions.
2056
2057 2012-02-02  Doug Kwan  <dougkwan@google.com>
2058
2059         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2060         position independent outputs, not just shared objects.
2061
2062 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2063
2064         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2065         * configure: Regenerated.
2066
2067 2012-01-27  Ian Lance Taylor  <iant@google.com>
2068
2069         * reloc.h (Bits): New class with static functions, copied from
2070         namespace utils in arm.cc.
2071         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2072         instead.
2073
2074 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2075
2076         * incremental.cc (write_info_blocks): Correct relocation offset.
2077
2078 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2079
2080         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2081         (Relocate::tls_gd_to_le): Likewise.
2082
2083 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2084
2085         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2086
2087 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2088
2089         * configure.ac: Check if -mcmodel=medium works.
2090         * configure: Regenerated.
2091
2092 2012-01-24  Cary Coutant  <ccoutant@google.com>
2093
2094         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2095         definition and ...
2096         (read_unsigned_LEB_128_x): ... this new function.
2097         (read_signed_LEB_128): Replaced with inline definition and ...
2098         (read_signed_LEB_128_x): ... this new function.
2099         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2100         (read_unsigned_LEB_128): Add inline definition.
2101         (read_signed_LEB_128_x): New function.
2102         (read_signed_LEB_128): Add inline definition.
2103         * testsuite/Makefile.am (leb128_unittest): New unit test.
2104         * testsuite/Makefile.in: Regenerate.
2105         * testsuite/leb128_unittest.cc: New unit test.
2106
2107 2012-01-23  Ian Lance Taylor  <iant@google.com>
2108
2109         PR gold/13617
2110         * i386.cc (Target_i386::do_code_fill): When using a jmp
2111         instruction, pad with nop instructions.
2112         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2113
2114 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2115
2116         * x86_64.cc (gc_process_relocs): Add typename on types used in
2117         template.
2118         (scan_relocs): Likewise.
2119         (relocate_section): Likewise.
2120         (apply_relocation): Likewise.
2121
2122 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2123
2124         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2125         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2126         under x32.
2127
2128 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2129
2130         * x86_64.cc: Initial support for x32.
2131
2132 2012-01-03  Cary Coutant  <ccoutant@google.com>
2133
2134         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2135         Use abstract base class for GOT.
2136         * gold/output.h (class Output_data_got_base): New abstract base class.
2137         (class Output_data_got): Derive from new base class, adjust ctors.
2138         (Output_data_got::reserve_slot): Make virtual; rename to
2139         do_reserve_slot; Adjust callers.
2140         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2141         pointer to abstract base class.
2142         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2143
2144 2011-12-18  Ian Lance Taylor  <iant@google.com>
2145
2146         * object.h (Relobj::local_symbol_value): New function.
2147         (Relobj::local_plt_offset): New function.
2148         (Relobj::local_has_got_offset): New function.
2149         (Relobj::local_got_offset): New function.
2150         (Relobj::set_local_got_offset): New function.
2151         (Relobj::do_local_symbol_value): New pure virtual function.
2152         (Relobj::do_local_plt_offset): Likewise.
2153         (Relobj::do_local_has_got_offset): Likewise.
2154         (Relobj::do_local_got_offset): Likewise.
2155         (Relobj::do_set_local_got_offset): Likewise.
2156         (Sized_relobj::do_local_has_got_offset): Rename from
2157         local_has_got_offset.
2158         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2159         (Sized_relobj::do_set_local_got_offset): Rename from
2160         set_local_got_offset.
2161         (Sized_relobj_file::do_local_plt_offset): Rename from
2162         local_plt_offset.
2163         (Sized_relobj_file::do_local_symbol_value): New function.
2164         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2165         local_plt_offset.
2166         * output.cc (Output_data_got::Got_entry::write): Change object to
2167         Relobj.  Use local_symbol_value.
2168         (Output_data_got::add_global_with_rel): Change rel_dyn to
2169         Output_data_reloc_generic*.  Use add_global_generic.
2170         (Output_data_got::add_global_with_rela): Remove.  Change all
2171         callers to use add_global_with_rel.
2172         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2173         Output_data_reloc_generic*.  Use add_global_generic.
2174         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2175         callers to use add_global_pair_with_rel.
2176         (Output_data_got::add_local): Change object to Relobj*.
2177         (Output_data_got::add_local_plt): Likewise.
2178         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2179         change rel_dyn to Output_data_reloc_generic*.  Use
2180         add_local_generic.
2181         (Output_data_got::add_local_with_rela): Remove.  Change all
2182         callers to use all_local_with_rel.
2183         (Output_data_got::add_local_pair_with_rel): Change object to
2184         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2185         add_output_section_generic.
2186         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2187         callers to use add_local_pair_with_rel.
2188         (Output_data_got::reserve_local): Change object to Relobj*.
2189         * output.h: (class Output_data_reloc_generic): Add pure virtual
2190         declarations for add_global_generic, add_local_generic,
2191         add_output_section_generic.
2192         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2193         functions for Output_data_reloc_generic.  Update declarations for
2194         changes listed in output.cc.
2195         (class Output_data_got): Change template parameter to got_size.
2196         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2197         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2198         function.
2199         (Sized_relobj_incr::do_local_plt_offset): New function.
2200         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2201         add_global_generic.
2202
2203 2011-12-17  Cary Coutant  <ccoutant@google.com>
2204
2205         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2206         * resolve.cc (Symbol_table::resolve): Likewise.
2207         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2208         arrays.
2209         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2210
2211 2011-12-16  Ian Lance Taylor  <iant@google.com>
2212
2213         * output.h (Output_data_reloc_generic::add): Only call
2214         add_dynamic_reloc if this is a dynamic reloc section.
2215
2216 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2217
2218         PR gold/13505
2219         * target-reloc.h (apply_relocation): Replace <64, false> with
2220         <size, big_endian>.
2221
2222 2011-11-25  Nick Clifton  <nickc@redhat.com>
2223
2224         * po/it.po: New Italian translation.
2225
2226 2011-11-17  Sterling Augustine  <saugustine@google.com>
2227
2228         * script.cc (script_include_directive): Implement.
2229         (read_script_file): New local variables name and search_path. Update
2230         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2231         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2232         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2233
2234 2011-11-11  Sterling Augustine  <saugustine@google.com>
2235
2236         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2237         (file_or_sections_cmd): Likewise.
2238
2239 2011-11-11  Doug Kwan  <dougkwan@google.com>
2240
2241         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2242         if --just-symbols is given.
2243
2244 2011-11-10  Doug Kwan  <dougkwan@google.com>
2245
2246         PR gold/13362
2247         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2248         when processing data relocs.
2249         * reloc.h (Relocate_functions::rel_unaligned): New method.
2250         (Relocate_functions::pcrel_unaligned): Ditto.
2251         (Relocate_functions::rel32_unaligned): Ditto.
2252         (Relocate_functions::pcrel32_unaligned): Ditto.
2253
2254 2011-11-09  Doug Kwan  <dougkwan@google.com>
2255
2256         PR gold/13362
2257         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2258         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2259         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2260         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2261         (Relocate_functions::rel_unaligned): New.
2262         (Relocate_functions::rel32_unaligned): New.
2263         * target-reloc.h (relocate_for_relocatable): Add code to handle
2264         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2265         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2266         arm_unaligned_reloc_r): New targets.
2267         * testsuite/Makefile.in: Regenerate.
2268         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2269         linking.
2270
2271 2011-11-02  Ian Lance Taylor  <iant@google.com>
2272
2273         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2274         NATIVE_LINKER.
2275         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2276         * options.cc (General_options::finalize): Use library search path
2277         from configure script if specified.  If not native and no sysroot,
2278         only search TOOLLIBDIR.
2279         * options.h (Search_directory::Search_directory): Change name to
2280         const std::string&.
2281         (General_options::add_to_library_path_with_sysroot): Change arg to
2282         const std::string&.
2283         * configure, Makefile.in, config.in: Rebuild.
2284
2285 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2286
2287         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2288         we are working around the ARM1176 Erratum.
2289         * options.h (General_options::fix_arm1176): Add option.
2290         * testsuite/Makefile.am: Add testcases, and keep current ones
2291         working.
2292         * testsuite/Makefile.in: Regenerate.
2293         * testsuite/arm_fix_1176.s: New file.
2294         * testsuite/arm_fix_1176.sh: Likewise.
2295
2296 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2297
2298         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2299         may_use_blx_.
2300         (Target_arm::may_use_blx): Remove method.
2301         (Target_arm::set_may_use_blx): Likewise.
2302         (Target_arm::may_use_v4t_interworking): New method.
2303         (Target_arm::may_use_v5t_interworking): Likewise.
2304         (Target_arm::may_use_blx_): Remove member variable.
2305         (Arm_relocate_functions::arm_branch_common): Check for v5T
2306         interworking.
2307         (Arm_relocate_functions::thumb_branch_common): Likewise.
2308         (Reloc_stub::stub_type_for_reloc): Likewise.
2309         (Target_arm::do_finalize_sections): Correct interworking checks.
2310         * testsuite/Makefile.am: Add new tests.
2311         * testsuite/Makefile.in: Regenerate.
2312         * testsuite/arm_farcall_arm_arm.s: New test.
2313         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2314         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2315         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2316         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2317         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2318         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2319         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2320
2321 2011-10-31  Cary Coutant  <ccoutant@google.com>
2322
2323         PR gold/13023
2324         * expression.cc (Expression::eval_with_dot): Add
2325         is_section_dot_assignment parameter.
2326         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2327         absolute and assigning to dot within a section.
2328         * script-sections.cc
2329         (Output_section_element_assignment::set_section_addresses): Pass
2330         dot_section to set_if_absolute.
2331         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2332         as is_section_dot_assignment flag to eval_with_dot.
2333         (Output_section_element_dot_assignment::set_section_addresses):
2334         Likewise.
2335         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2336         parameter.  Also set value if relative to dot_section; set the
2337         symbol's output_section.
2338         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2339         parameter.  Adjust all callers.
2340         (Expression::eval_maybe_dot): Likewise.
2341         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2342         Adjust all callers.
2343         * testsuite/script_test_2.t: Test assignment of an absolute value
2344         to dot within an output section element.
2345
2346 2011-10-31  Cary Coutant  <ccoutant@google.com>
2347
2348         * options.h (class General_options): Add --[no-]gnu-unique options.
2349         * symtab.cc (Symbol_table::sized_write_globals): Convert
2350         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2351
2352 2011-10-31  Cary Coutant  <ccoutant@google.com>
2353
2354         PR gold/13359
2355         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2356         unnecessary assertion.
2357         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2358
2359 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2360
2361         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2362         gc_mark_symbol.
2363         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2364         gc_mark_symbol.
2365         Change to just keep the section associated with symbol.
2366         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2367         they are externally visible and --export-dynamic is turned on.
2368         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2369
2370 2011-10-19  Ian Lance Taylor  <iant@google.com>
2371
2372         PR gold/13163
2373         * script-sections.cc
2374         (Output_section_element_dot_assignment::needs_output_section): New
2375         function.
2376
2377 2011-10-19  Ian Lance Taylor  <iant@google.com>
2378
2379         PR gold/13204
2380         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2381         --section-start option was seen.
2382         * options.h (General_options::any_section_start): New function.
2383
2384 2011-10-18  David S. Miller  <davem@davemloft.net>
2385
2386         PR binutils/13301
2387         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2388         member to track relocation locations that have moved during TLS
2389         reloc optimizations.
2390         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2391         (Target_sparc::Relocate::relocate): Adjust view down by 4
2392         bytes if it matches reloc_adjust_addr_.
2393         (Target_sparc::Relocate::relocate_tls): Always move the
2394         __tls_get_addr call delay slot instruction forward 4 bytes when
2395         performing relaxation.
2396
2397 2011-10-18  Cary Coutant  <ccoutant@google.com>
2398
2399         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2400         (Output_file::map_no_anonymous): Check for non-zero
2401         return code from posix_fallocate.
2402
2403 2011-10-17  Cary Coutant  <ccoutant@google.com>
2404
2405         PR gold/13245
2406         * plugin.cc (is_visible_from_outside): Check for symbols
2407         referenced from dynamic objects.
2408         * resolve.cc (Symbol_table::resolve): Don't count references
2409         from dynamic objects as references from real ELF files.
2410         * testsuite/plugin_test_2.sh: Adjust expected result.
2411
2412 2011-10-17  Cary Coutant  <ccoutant@google.com>
2413
2414         * gold.cc: Include timer.h.
2415         (queue_middle_tasks): Stamp time.
2416         (queue_final_tasks): Likewise.
2417         * main.cc (main): Store timer in parameters.  Print timers
2418         for each pass.
2419         * parameters.cc (Parameters::Parameters): Initialize timer_.
2420         (Parameters::set_timer): New function.
2421         (set_parameters_timer): New function.
2422         * parameters.h (Parameters::set_timer): New function.
2423         (Parameters::timer): New function.
2424         (Parameters::timer_): New data member.
2425         (set_parameters_timer): New function.
2426         * timer.cc (Timer::stamp): New function.
2427         (Timer::get_pass_time): New function.
2428         * timer.h (Timer::stamp): New function.
2429         (Timer::get_pass_time): New function.
2430         (Timer::pass_times_): New data member.
2431
2432 2011-10-17  Cary Coutant  <ccoutant@google.com>
2433
2434         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2435         task for members of lib groups.
2436
2437 2011-10-17  Cary Coutant  <ccoutant@google.com>
2438
2439         PR gold/13288
2440         * fileread.cc (File_read::find_view): Add assert.
2441         (File_read::make_view): Move bounds check (replace with assert)...
2442         (File_read::find_or_make_view): ... to here.
2443
2444 2011-10-12  Cary Coutant  <ccoutant@google.com>
2445
2446         * output.cc (Output_file::open_base_file): Handle case where
2447         ::read returns less than requested size.
2448
2449 2011-10-10  Cary Coutant  <ccoutant@google.com>
2450
2451         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2452         Initialize defined_count_.
2453         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2454         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2455         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2456         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2457         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2458         * incremental.h (Sized_relobj_incr::defined_count_): New data
2459         member.
2460         (Sized_incr_dynobj::defined_count_): New data member.
2461         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2462         Return zeroes instead of internal error.
2463
2464 2011-10-10  Cary Coutant  <ccoutant@google.com>
2465
2466         PR gold/13249
2467         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2468         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2469         * output.h (class Output_reloc): Add use_plt_offset flag.
2470         (Output_reloc::type_): Adjust size of bit field.
2471         (Output_reloc::use_plt_offset_): New bit field.
2472         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2473         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2474         flag.  Adjust all callers.
2475         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2476         creating RELATIVE relocations.
2477
2478 2011-10-10  Nick Clifton  <nickc@redhat.com>
2479
2480         * po/es.po: Updated Spanish translation.
2481         * po/fi.po: Updated Finnish translation.
2482
2483 2011-10-03   Diego Novillo  <dnovillo@google.com>
2484
2485         * options.cc (parse_uint): Fix dereference of RETVAL.
2486
2487 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2488
2489         * layout.h (section_order_map_): New member.
2490         (get_section_order_map): New member function.
2491         * output.cc (Output_section::add_input_section): Check for patterns
2492         only when --section-ordering-file is specified.
2493         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2494         output_sections have been formed.
2495         * layout.cc (Layout_Layout): Initialize section_order_map_.
2496         * plugin.cc (update_section_order): Store order in order_map. Do not
2497         update the order.
2498         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2499         * testsuite/Makefile.in: Regenerate.
2500         * testsuite/plugin_section_order.c: New file.
2501         * testsuite/plugin_final_layout.cc: New file.
2502         * testsuite/plugin_final_layout.sh: New file.
2503
2504 2011-09-29  Cary Coutant  <ccoutant@google.com>
2505
2506         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2507         Check for NULL.
2508         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2509         symbols during incremental update.
2510         (Symbol_table::add_from_dynobj): Likewise.
2511
2512 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2513             Ian Lance Taylor  <iant@google.com>
2514
2515         * symtab.cc (Symbol_table::define_special_symbol): Always
2516         canonicalize version string.
2517
2518 2011-09-26  Cary Coutant  <ccoutant@google.com>
2519
2520         * gold.cc (queue_initial_tasks): Move option checks ...
2521         * options.cc (General_options::finalize): ... to here. Disable
2522         some options; make others fatal.
2523
2524 2011-09-26  Cary Coutant  <ccoutant@google.com>
2525
2526         gcc PR lto/47247
2527         * plugin.cc (get_symbols_v2): New function.
2528         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2529         (is_referenced_from_outside): New function.
2530         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2531         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2532         (get_symbols): Pass version parameter.
2533         (get_symbols_v2): New function.
2534         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2535         parameter.
2536         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2537         (onload): Add LDPT_GET_SYMBOLS_V2.
2538         (all_symbols_read_hook): Use get_symbols_v2; check for
2539         LDPR_PREVAILING_DEF_IRONLY_EXP.
2540         * testsuite/plugin_test_3.sh: Update expected results.
2541
2542 2011-09-23  Simon Baldwin  <simonb@google.com>
2543
2544         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2545         configuration options.
2546         * configure: Regenerate.
2547         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2548         * Makefile.in: Regenerate.
2549         * testsuite/Makefile.in: Regenerate.
2550
2551 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2552
2553         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2554
2555 2011-09-19  Cary Coutant  <ccoutant@google.com>
2556
2557         * incremental.cc (can_incremental_update): Fix typo in comment.
2558         * incremental.h (can_incremental_update): Likewise.
2559
2560 2011-09-18  Cary Coutant  <ccoutant@google.com>
2561
2562         * incremental.cc (can_incremental_update): New function.
2563         * incremental.h (can_incremental_update): New function.
2564         * layout.cc (Layout::init_fixed_output_section): Call it.
2565         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2566         * object.cc (Sized_relobj_file::do_layout): Call
2567         can_incremental_update.
2568
2569 2011-09-13  Cary Coutant  <ccoutant@google.com>
2570
2571         * configure.ac: Check for glibc support for gnu_indirect_function
2572         support with static linking, setting automake conditional
2573         IFUNC_STATIC.
2574         * Makefile.in: Regenerate.
2575         * configure: Regenerate.
2576
2577         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2578         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2579         for IFUNC_STATIC.
2580         * testsuite/Makefile.in: Regenerate.
2581
2582 2011-09-13  Cary Coutant  <ccoutant@google.com>
2583
2584         * incremental.cc (Sized_relobj_incr::do_layout): Call
2585         report_comdat_group for kept comdat sections.
2586         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2587         * testsuite/Makefile.in: Regenerate.
2588         * testsuite/incr_comdat_test_1.cc: New source file.
2589         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2590         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2591         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2592
2593 2011-09-13  Ian Lance Taylor  <iant@google.com>
2594
2595         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2596         variable external_symbols_offset.
2597
2598 2011-09-12  Ian Lance Taylor  <iant@google.com>
2599
2600         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2601         triggered if object has no symbols.
2602
2603 2011-09-09  David S. Miller  <davem@davemloft.net>
2604
2605         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2606         (Output_fill_debug_line::do_write): Likewise.
2607
2608 2011-08-29  Cary Coutant  <ccoutant@google.com>
2609
2610         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2611         casts to match formatting specs.
2612         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2613
2614 2011-08-26  Cary Coutant  <ccoutant@google.com>
2615
2616         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2617         remaining hole size when allocating.
2618         (Layout::make_output_section): Set fill methods for debug sections.
2619         * layout.h (Free_list::Free_list_node): Move from private to
2620         public.
2621         (Free_list::set_min_hole_size): New function.
2622         (Free_list::begin, Free_list::end): New functions.
2623         (Free_list::min_hole_): New data member.
2624         * output.cc: Include dwarf.h.
2625         (Output_fill_debug_info::do_minimum_hole_size): New function.
2626         (Output_fill_debug_info::do_write): New function.
2627         (Output_fill_debug_line::do_minimum_hole_size): New function.
2628         (Output_fill_debug_line::do_write): New function.
2629         (Output_section::Output_section): Initialize new data member.
2630         (Output_section::set_final_data_size): Ensure patch space is larger
2631         than minimum hole size.
2632         (Output_section::do_write): Fill holes in debug sections.
2633         * output.h (Output_fill): New class.
2634         (Output_fill_debug_info): New class.
2635         (Output_fill_debug_line): New class.
2636         (Output_section::set_free_space_fill): New function.
2637         (Output_section::free_space_fill_): New data member.
2638         * testsuite/Makefile.am (incremental_test_3): Add
2639         --incremental-patch option.
2640         (incremental_test_4): Likewise.
2641         (incremental_test_5): Likewise.
2642         (incremental_test_6): Likewise.
2643         (incremental_copy_test): Likewise.
2644         (incremental_common_test_1): Likewise.
2645         * testsuite/Makefile.in: Regenerate.
2646
2647 2011-08-26  Nick Clifton  <nickc@redhat.com>
2648
2649         * po/es.po: Updated Spanish translation.
2650
2651 2011-08-01  Cary Coutant  <ccoutant@google.com>
2652
2653         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2654         * gold/testsuite/Makefile.in: Regenerate.
2655         * gold/testsuite/justsyms_exec.c: New source file.
2656         * gold/testsuite/justsyms_lib.c: New source file.
2657
2658 2011-08-01  Cary Coutant  <ccoutant@google.com>
2659
2660         * layout.cc (Layout::set_segment_offsets): Don't realign text
2661         segment if -Ttext was specified.
2662         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2663         file type.
2664         * object.h (Sized_relobj_file::e_type): New function.
2665         (Sized_relobj_file::e_type_): New data member.
2666         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2667         base address for ET_EXEC files.
2668         * target.cc (Target::do_make_elf_object_implementation): Allow
2669         ET_EXEC files with --just-symbols option.
2670
2671 2011-07-28  Cary Coutant  <ccoutant@google.com>
2672
2673         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2674         Add thread_number parameter.
2675         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2676         * workqueue-threads.cc
2677         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2678         current thread if its thread number is greater than desired thread
2679         count.
2680         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2681         Add thread_number parameter.
2682         (Workqueue::should_cancel_thread): Likewise.
2683         (Workqueue::find_runnable_or_wait): Pass thread_number to
2684         should_cancel_thread.
2685         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2686         parameter.
2687
2688 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2689
2690         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2691         only after checking if it cannot be forced local.
2692         * symtab.h (is_externally_visible): Check if the symbol is not forced
2693         local.
2694
2695 2011-07-15  Ian Lance Taylor  <iant@google.com>
2696
2697         * options.h (class General_options): Add --print-output-format.
2698         Move -EL next to -EB, for  better --help output.
2699         * target-select.cc: Include <cstdio>, "options.h", and
2700         "parameters.h".
2701         (Target_selector::do_target_bfd_name): New function.
2702         (print_output_format): New function.
2703         * target-select.h (class Target_selector): Update declarations.
2704         (Target_selector::target_bfd_name): New function.
2705         (print_output_format): Declare.
2706         * main.cc: Include "target-select.h".
2707         (main): Handle --print-output-format.
2708         * gold.cc: Include "target-select.h".
2709         (queue_initial_tasks): Handle --print-output-format when there are
2710         no input files.
2711         * parameters.cc (parameters_force_valid_target): Give a better
2712         error message if -EB/-EL does not match target.
2713         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2714         function.
2715
2716 2011-07-15  Ian Lance Taylor  <iant@google.com>
2717
2718         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2719         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2720         (Output_data_plt_i386::do_write): Write address of .dynamic
2721         section to first entry in .got.plt section.
2722         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2723         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2724         Initialize layout_.
2725         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2726         section to first entry in .got.plt section.
2727         * layout.h (Layout::dynamic_section): New function.
2728
2729 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2730
2731         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2732         to claim_file call.
2733         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2734         input_section_position_, and input_section_glob_.
2735         (read_layout_from_file): Call function section_ordering_specified.
2736         * layout.h (is_section_ordering_specified): New function.
2737         (section_ordering_specified): New function.
2738         (section_ordering_specified_): New boolean member.
2739         * main.cc(main): Call load_plugins after layout object is defined.
2740         * output.cc (Output_section::add_input_section): Use
2741         function section_ordering_specified to check if section ordering is
2742         needed.
2743         * output.cc (Output_section::add_relaxed_input_section): Use
2744         function section_ordering_specified to check if section ordering is
2745         needed.
2746         (Output_section::update_section_layout): New function.
2747         (Output_section::sort_attached_input_sections): Check if input section
2748         must be reordered.
2749         * output.h (Output_section::update_section_layout): New function.
2750         * plugin.cc (get_section_count): New function.
2751         (get_section_type): New function.
2752         (get_section_name): New function.
2753         (get_section_contents): New function.
2754         (update_section_order): New function.
2755         (allow_section_ordering): New function.
2756         (Plugin::load): Add the new interfaces to the transfer vector.
2757         (Plugin_manager::load_plugins): New parameter.
2758         (Plugin_manager::all_symbols_read): New parameter.
2759         (Plugin_manager::claim_file): New parameter. Save the elf object for
2760         unclaimed objects.
2761         (Plugin_manager::get_elf_object): New function.
2762         (Plugin_manager::get_view): Change to directly use the bool to check
2763         if get_view is called from claim_file_hook.
2764         * plugin.h (input_objects): New function
2765         (Plugin__manager::load_plugins): New parameter.
2766         (Plugin_manager::claim_file): New parameter.
2767         (Plugin_manager::get_elf_object): New function.
2768         (Plugin_manager::in_claim_file_handler): New function.
2769         (Plugin_manager::in_claim_file_handler_): New member.
2770         (layout): New function.
2771         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2772         handler with an extra parameter. Make the elf object before calling
2773         claim_file handler.
2774         * testsuite/plugin_test.c (get_section_count): New function pointer.
2775         (get_section_type): New function pointer.
2776         (get_section_name): New function pointer.
2777         (get_section_contents): New function pointer.
2778         (update_section_order): New function pointer.
2779         (allow_section_ordering): New function pointer.
2780         (onload): Check if the new interfaces exist.
2781
2782 2011-07-13  Ian Lance Taylor  <iant@google.com>
2783
2784         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2785         relro section.
2786         * x86_64.cc (Target_x86_64::got_section): Likewise.
2787         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2788         (relro_now_test_SOURCES): New variable.
2789         (relro_now_test_DEPENDENCIES): New variable.
2790         (relro_now_test_LDFLAGS): New variable.
2791         (relro_now_test_LDADD): New variable.
2792         (relro_now_test.so): New target.
2793         * testsuite/Makefile.in: Rebuild.
2794
2795 2011-07-12  Ian Lance Taylor  <iant@google.com>
2796
2797         PR gold/12980
2798         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2799         GLOB_DAT relocation rather than a RELATIVE relocation for a
2800         protected symbol when creating a shared library.
2801         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2802         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2803         * testsuite/protected_main_1.cc (main): Test that protected
2804         function has same address.
2805
2806 2011-07-11  Ian Lance Taylor  <iant@google.com>
2807
2808         PR gold/12979
2809         * options.h (class General_options): Add -Bgroup.
2810         * options.cc (General_options::finalize): If -Bgroup is set,
2811         default to --unresolved-symbols=report-all.
2812         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2813         * target-reloc.h (issue_undefined_symbol_error): Handle
2814         --unresolved-symbols=report-all.
2815
2816 2011-07-08  Ian Lance Taylor  <iant@google.com>
2817
2818         PR gold/11985
2819         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2820         if linker script discards key sections.
2821         (Layout::create_dynamic_symtab): Likewise.
2822         (Layout::assign_local_dynsym_offsets): Likewise.
2823         (Layout::sized_create_version_sections): Likewise.
2824         (Layout::create_interp): Likewise.
2825         (Layout::finish_dynamic_section): Likewise.
2826         (Layout::set_dynamic_symbol_size): Likewise.
2827
2828 2011-07-08  Ian Lance Taylor  <iant@google.com>
2829
2830         PR gold/12386
2831         * options.h (class General_options): Add --unresolved-symbols.
2832         * target-reloc.h (issue_undefined_symbol_error): Check
2833         --unresolved-symbols.  Add comments.
2834
2835 2011-07-08  Ian Lance Taylor  <iant@google.com>
2836
2837         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2838         expression more complex.
2839
2840 2011-07-08  Ian Lance Taylor  <iant@google.com>
2841
2842         PR gold/11317
2843         * target-reloc.h (issue_undefined_symbol_error): New inline
2844         function, broken out of relocate_section.
2845         (relocate_section): Call issue_undefined_symbol_error.
2846         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2847         there is no TLS segment if we are about to issue an undefined
2848         symbol error.
2849         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2850
2851 2011-07-08  Ian Lance Taylor  <iant@google.com>
2852
2853         PR gold/12279
2854         * resolve.cc (Symbol_table::should_override): Add fromtype
2855         parameter.  Change all callers.  Give error when linking together
2856         TLS and non-TLS symbol.
2857         (Symbol_table::should_override_with_special): Add fromtype
2858         parameter.  Change all callers.
2859         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2860         there is no TLS segment if we have reported some errors.
2861         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2862
2863 2011-07-08  Ian Lance Taylor  <iant@google.com>
2864
2865         PR gold/12372
2866         * target.h (Target::plt_address_for_global): New function.
2867         (Target::plt_address_for_local): New function.
2868         (Target::plt_section_for_global): Remove.
2869         (Target::plt_section_for_local): Remove.
2870         (Target::do_plt_address_for_global): New virtual function.
2871         (Target::do_plt_address_for_local): New virtual function.
2872         (Target::do_plt_section_for_global): Remove.
2873         (Target::do_plt_section_for_local): Remove.
2874         (Target::register_global_plt_entry): Add Symbol_table and Layout
2875         parameters.
2876         * output.cc (Output_data_got::Got_entry::write): Use
2877         plt_address_for_global and plt_address_for_local.
2878         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2879         address of output section.
2880         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2881         got_irelative_, and irelative_count_ fields.  Update
2882         declarations.
2883         (Output_data_plt_i386::has_irelative_section): New function.
2884         (Output_data_plt_i386::entry_count): Add irelative_count_.
2885         (Output_data_plt_i386::set_final_data_size): Likewise.
2886         (class Target_i386): Add got_irelative_ and rel_irelative_
2887         fields.  Update declarations.
2888         (Target_i386::Target_i386): Initialize new fields.
2889         (Target_i386::do_plt_address_for_global): New function replacing
2890         do_plt_section_for_global.
2891         (Target_i386::do_plt_address_for_local): New function replacing
2892         do_plt_section_for_local.
2893         (Target_i386::got_section): Create got_irelative_.
2894         (Target_i386::rel_irelative_section): New function.
2895         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2896         fields.  Don't define __rel_iplt_{start,end}.
2897         (Output_data_plt_i386::add_entry): Add symtab and layout
2898         parameters.  Change all callers.  Use different PLT and GOT for
2899         IFUNC symbols.
2900         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2901         layout parameters.  Change all callers.  Use different PLT and
2902         GOT.
2903         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2904         (Output_data_plt_i386::rel_irelative): New function.
2905         (Output_data_plt_i386::address_for_global): New function.
2906         (Output_data_plt_i386::address_for_local): New function.
2907         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2908         IRELATIVE GOT when changing IFUNC GOT entries.
2909         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2910         reloc.
2911         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2912         if we didn't create an IRELATIVE GOT.
2913         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2914         plt_address_for_local.
2915         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2916         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2917         got_irelative_, and irelative_count_ fields.  Update
2918         declarations.
2919         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2920         Initialize new fields.  Remove symtab parameter.  Change all
2921         callers.
2922         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2923         irelative_count_.
2924         (Output_data_plt_x86_64::has_irelative_section): New function.
2925         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2926         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2927         fields.  Update declarations.
2928         (Target_x86_64::Target_x86_64): Initialize new fields.
2929         (Target_x86_64::do_plt_address_for_global): New function replacing
2930         do_plt_section_for_global.
2931         (Target_x86_64::do_plt_address_for_local): New function replacing
2932         do_plt_section_for_local.
2933         (Target_x86_64::got_section): Create got_irelative_.
2934         (Target_x86_64::rela_irelative_section): New function.
2935         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2936         all callers.  Don't create __rel_iplt_{start,end}.
2937         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2938         parameters.  Change all callers.  Use different PLT and GOT for
2939         IFUNC symbols.
2940         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2941         layout parameters.  Change all callers.  Use different PLT and
2942         GOT.
2943         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2944         parameters.  Change all callers.  Use different PLT and GOT for
2945         IFUNC symbols.
2946         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2947         (Output_data_plt_x86_64::rela_irelative): New function.
2948         (Output_data_plt_x86_64::address_for_global): New function.
2949         (Output_data_plt_x86_64::address_for_local): New function.
2950         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2951         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2952         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2953         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2954         parameters.
2955         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2956         reloc.
2957         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2958         symbols if we didn't create an IRELATIVE GOT.
2959         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2960         plt_address_for_local.
2961         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2962         * testsuite/ifuncvar1.c: New test file.
2963         * testsuite/ifuncvar2.c: New test file.
2964         * testsuite/ifuncvar3.c: New test file.
2965         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2966         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2967         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2968         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2969         * testsuite/Makefile.in: Rebuild.
2970
2971 2011-07-07  Cary Coutant  <ccoutant@google.com>
2972
2973         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2974         (two_file_test_1_ndebug.o): Likewise.
2975         (two_file_test_1b_ndebug.o): Likewise.
2976         (two_file_test_2_ndebug.o): Likewise.
2977         (two_file_test_main_ndebug.o): Likewise.
2978         (incremental_test_2): Link with no-debug versions.
2979
2980 2011-07-06  Cary Coutant  <ccoutant@google.com>
2981
2982         * gold/incremental.cc
2983         (Output_section_incremental_inputs::write_info_blocks): Check for
2984         hidden and internal symbols.
2985
2986 2011-07-06  Cary Coutant  <ccoutant@google.com>
2987
2988         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2989         Check disposition for startup file.
2990         (Incremental_inputs::report_command_line): Ignore
2991         --incremental-startup-unchanged option.
2992         * options.cc (General_options::parse_incremental_startup_unchanged):
2993         New function.
2994         (General_options::General_options): Initialize new data member.
2995         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2996         (General_options): Add --incremental-startup-unchanged option.
2997         (General_options::incremental_startup_disposition): New function.
2998         (General_options::incremental_startup_disposition_): New data member.
2999
3000 2011-07-06  Cary Coutant  <ccoutant@google.com>
3001
3002         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3003         input file index to Script_info ctor.
3004         (Sized_incremental_binary::do_file_has_changed): Find the
3005         command-line argument for files named in scripts.
3006         * incremental.h (Script_info::Script_info): New ctor
3007         with input file index.
3008         (Script_info::input_file_index): New function.
3009         (Script_info::input_file_index_): New data member.
3010         (Incremental_binary::get_library): Add const.
3011         (Incremental_binary::get_script_info): Add const.
3012         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3013         * testsuite/Makefile.am (incremental_test_5): New test case.
3014         (incremental_test_6): New test case.
3015         * testsuite/Makefile.in: Regenerate.
3016
3017 2011-07-06  Cary Coutant  <ccoutant@google.com>
3018
3019         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3020         debug output when command lines differ.
3021
3022 2011-07-06  Cary Coutant  <ccoutant@google.com>
3023
3024         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3025         --incremental-patch option.
3026         * layout.cc (Free_list::allocate): Extend allocation beyond original
3027         end if enabled.
3028         (Layout::make_output_section): Mark sections that should get
3029         patch space.
3030         * options.cc (parse_percent): New function.
3031         * options.h (parse_percent): New function.
3032         (DEFINE_percent): New macro.
3033         (General_options): Add --incremental-patch option.
3034         * output.cc (Output_section::Output_section): Initialize new data
3035         members.
3036         (Output_section::add_input_section): Print section name when out
3037         of patch space.
3038         (Output_section::add_output_section_data): Likewise.
3039         (Output_section::set_final_data_size): Add patch space when
3040         doing --incremental-full.
3041         (Output_section::do_reset_address_and_file_offset): Remove patch
3042         space.
3043         (Output_segment::set_section_list_addresses): Print debug output
3044         only if --incremental-update.
3045         * output.h (Output_section::set_is_patch_space_allowed): New function.
3046         (Output_section::is_patch_space_allowed_): New data member.
3047         (Output_section::patch_space_): New data member.
3048         * parameters.cc (Parameters::incremental_full): New function.
3049         * parameters.h (Parameters::incremental_full): New function
3050         * testsuite/Makefile.am (incremental_test_2): Add test for
3051         --incremental-patch option.
3052         * testsuite/Makefile.in: Regenerate.
3053         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3054         (t18): Remove function body.
3055
3056 2011-07-05  Doug Kwan  <dougkwan@google.com>
3057
3058         PR gold/12771
3059         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3060         Arm_Address type for relocation result.
3061         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3062         overflow check.
3063         (Arm_relocate_functions::abs32): Use unaligned access.
3064         (Arm_relocate_functions::rel32): Ditto.
3065         (Arm_relocate_functions::prel31): Ditto.
3066         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3067         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3068         static data relocations.
3069         * testsuite/Makefile.in: Regnerate.
3070         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3071
3072 2011-07-05  Ian Lance Taylor  <iant@google.com>
3073
3074         PR gold/12392
3075         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3076         symbols if necessary.
3077         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3078
3079 2011-07-05  Ian Lance Taylor  <iant@google.com>
3080
3081         PR gold/12952
3082         * resolve.cc (Symbol::override_base_with_special): Simply override
3083         version with special symbol version, ignoring previous version.
3084
3085 2011-07-05  Ian Lance Taylor  <iant@google.com>
3086
3087         * object.cc (Sized_relobj_file::include_section_group): Add
3088         information to comment about signature location.
3089
3090 2011-07-02  Ian Lance Taylor  <iant@google.com>
3091
3092         PR gold/12957
3093         * options.h (class General_options): Add -f and -F.
3094         * options.cc (General_options::finalize): Fatal error if -f/-F
3095         are used without -shared.
3096         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3097
3098 2011-07-02  Ian Lance Taylor  <iant@google.com>
3099
3100         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3101
3102 2011-07-01  Ian Lance Taylor  <iant@google.com>
3103
3104         PR gold/12525
3105         PR gold/12952
3106         * resolve.cc (Symbol::override_base_with_special): Don't override
3107         the version if the overriding symbol has a different name.
3108         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3109         all callers.  If we give an error about an undefined version,
3110         define the base version if necessary.
3111         * dynobj.h (class Versions): Update declaration.
3112         * testsuite/weak_alias_test_5.cc: New file.
3113         * testsuite/weak_alias_test.script: New file.
3114         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3115         and versioned_alias have the right value, and call t2.
3116         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3117         weak_alias_test_5.so.
3118         (weak_alias_test_LDADD): Likewise.
3119         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3120         * testsuite/Makefile.in: Rebuild.
3121
3122 2011-07-01  Ian Lance Taylor  <iant@google.com>
3123
3124         PR gold/12525
3125         * options.h (class General_options): Support -z notext.
3126         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3127         -Wl,-z,notext.
3128         (two_file_shared_nonpic.so): Likewise.
3129         (two_file_shared_mixed.so): Likewise.
3130         (two_file_shared_mixed_1.so): Likewise.
3131         (weak_undef_lib_nonpic.so): Likewise.
3132         (alt/weak_undef_lib_nonpic.so): Likewise.
3133         (tls_test_shared_nonpic.so): Likewise.
3134         * testsuite/Makefile.in: Rebuild.
3135
3136 2011-07-01  Ian Lance Taylor  <iant@google.com>
3137
3138         PR gold/12525
3139         * configure.ac: Test whether static linking works, setting
3140         the automake conditional HAVE_STATIC.
3141         * testsuite/Makefile.am: Disable tests using -static if
3142         HAVE_STATIC is not true.
3143         * configure, testsuite/Makefile.in: Rebuild.
3144
3145 2011-07-01  Ian Lance Taylor  <iant@google.com>
3146
3147         PR gold/12525
3148         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3149         Assert if we see DW_EH_PE_indirect.
3150         * target.h (Target::ehframe_datarel_base): New function.
3151         (Target::do_ehframe_datarel_base): New target function.
3152         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3153         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3154         function.
3155
3156 2011-07-01  Ian Lance Taylor  <iant@google.com>
3157
3158         PR gold/12571
3159         * options.h (class General_options): Add
3160         --ld-generated-unwind-info.
3161         * ehframe.cc (Fde::write): Add address parameter.  Change all
3162         callers.  If associated with PLT, fill in address and size.
3163         (Cie::set_output_offset): Only add merge mapping if there is an
3164         object.
3165         (Cie::write): Add address parameter.  Change all callers.
3166         (Eh_frame::add_ehframe_for_plt): New function.
3167         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3168         input_offset_ fields into union u_, with new plt field.
3169         (Fde::Fde): Adjust for new union field.
3170         (Fde::Fde) [Output_data version]: New constructor.
3171         (Fde::add_mapping): Only add merge mapping if there is an object.
3172         (class Cie): Update declarations.
3173         (class Eh_frame): Declare add_ehframe_for_plt.
3174         * layout.cc (Layout::layout_eh_frame): Break out code into
3175         make_eh_frame_section, and call it.
3176         (Layout::make_eh_frame_section): New function.
3177         (Layout::add_eh_frame_for_plt): New function.
3178         * layout.h (class Layout): Update declarations.
3179         * merge.cc (Merge_map::add_mapping): Add assertion.
3180         * i386.cc: Include "dwarf.h".
3181         (class Output_data_plt_i386): Make first_plt_entry,
3182         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3183         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3184         and plt_eh_frame_fde.
3185         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3186         boundary.  Call add_eh_frame_for_plt if appropriate.
3187         * x86_64.cc: Include "dwarf.h".
3188         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3189         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3190         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3191         and plt_eh_frame_fde.
3192         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3193         appropriate.
3194
3195 2011-06-29  Ian Lance Taylor  <iant@google.com>
3196
3197         PR gold/12629
3198         * object.cc (Sized_relobj_file::layout_section): Change shdr
3199         parameter to be const.
3200         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3201         out of do_layout.
3202         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3203         appropriate.  Call layout_eh_frame_section.
3204         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3205         sections.
3206         * object.h (class Sized_relobj_file): Update declarations.
3207
3208 2011-06-29  Ian Lance Taylor  <iant@google.com>
3209
3210         PR gold/12652
3211         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3212         modifier.
3213         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3214
3215 2011-06-29  Ian Lance Taylor  <iant@google.com>
3216
3217         PR gold/12675
3218         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3219         SHT_X86_64_UNWIND.
3220         * layout.cc (Layout::layout_eh_frame): Likewise.
3221
3222 2011-06-29  Ian Lance Taylor  <iant@google.com>
3223
3224         PR gold/12695
3225         * layout.cc (Layout::symtab_section_shndx): New function.
3226         * layout.h (class Layout): Declare symtab_section_shndx.
3227         * output.cc (Output_section::write_header): Call it.
3228
3229 2011-06-29  Ian Lance Taylor  <iant@google.com>
3230
3231         PR gold/12818
3232         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3233         symbols which are not used in a relocation.
3234
3235 2011-06-28  Ian Lance Taylor  <iant@google.com>
3236
3237         PR gold/12898
3238         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3239         script create indistinguishable segments.
3240         (Layout::set_segment_offsets): Use stable_sort when sorting
3241         segments.  Pass this to Compare_segments constructor.
3242         * layout.h (class Layout): Make segment_precedes non-static.
3243         (class Compare_segments): Change from struct to class.  Add
3244         layout_ field.  Add constructor.
3245         * script-sections.cc
3246         (Script_sections::attach_sections_using_phdrs_clause): Rename
3247         local orphan to is_orphan.  Don't report failure to put empty
3248         section in segment.  On attachment failure, report name of
3249         section, and attach to first PT_LOAD segment.
3250
3251 2011-06-28  Ian Lance Taylor  <iant@google.com>
3252
3253         PR gold/12934
3254         * target-select.cc (Target_selector::Target_selector): Add
3255         emulation parameter.  Change all callers.
3256         (select_target_by_bfd_name): Rename from select_target_by_name.
3257         Change all callers.
3258         (select_target_by_emulation): New function.
3259         (supported_emulation_names): New function.
3260         * target-select.h (class Target_selector): Add emulation_ field.
3261         Update declarations.
3262         (Target_selector::recognize_by_bfd_name): Rename from
3263         recognize_by_name.  Change all callers.
3264         (Target_selector::supported_bfd_names): Rename from
3265         supported_names.  Change all callers.
3266         (Target_selector::recognize_by_emulation): New function.
3267         (Target_selector::supported_emulations): New function.
3268         (Target_selector::emulation): New function.
3269         (Target_selector::do_recognize_by_bfd_name): Rename from
3270         do_recognize_by_name.  Change all callers.
3271         (Target_selector::do_supported_bfd_names): Rename from
3272         do_supported_names.  Change all callers.
3273         (Target_selector::do_recognize_by_emulation): New function.
3274         (Target_selector::do_supported_emulations): New function.
3275         (select_target_by_bfd_name): Change name in declaration.
3276         (select_target_by_emulation): Declare.
3277         (supported_emulation_names): Declare.
3278         * parameters.cc (parameters_force_valid_target): Try to find
3279         target based on emulation from -m option.
3280         * options.h (class General_options): Change doc string for -m.
3281         * options.cc (help): Print emulations.
3282         (General_options::parse_V): Likewise.
3283         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3284         Add emulation parameter.  Change all callers.
3285
3286 2011-06-28  Ian Lance Taylor  <iant@google.com>
3287
3288         * target.h (class Target): Add osabi_ field.
3289         (Target::osabi): New function.
3290         (Target::set_osabi): New function.
3291         (Target::Target): Initialize osabi_.
3292         (Target::do_adjust_elf_header): Make pure virtual.
3293         (Sized_target::do_adjust_elf_header): Declare.
3294         * target.cc (Sized_target::do_adjust_elf_header): New function.
3295         (class Sized_target): Instantiate all versions.
3296         * freebsd.h (class Target_freebsd): Remove.
3297         (Target_selector_freebsd::do_recognize): Call set_osabi on
3298         Target.
3299         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3300         (Target_selector_freebsd::set_osabi): Remove.
3301         * i386.cc (class Target_i386): Inherit from Sized_target rather
3302         than Target_freebsd.
3303         * x86_64.cc (class Target_x86_64): Likewise.
3304
3305 2011-06-28  Ian Lance Taylor  <iant@google.com>
3306
3307         * target.h (Target::can_check_for_function_pointers): Rewrite.
3308         Make non-virtual.
3309         (Target::can_icf_inline_merge_sections): Likewise.
3310         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3311         (Target::Target_info): Add can_icf_inline_merge_sections field.
3312         (Target::do_can_check_for_function_pointers): New virtual
3313         function.
3314         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3315         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3316         from can_check_for_function_pointers, move in file.
3317         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3318         section_may_have_icf_unsafe_poineters, move in file.
3319         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3320         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3321         Rename from can_check_for_function_pointers, move in file.
3322         (Target_i386::can_icf_inline_merge_sections): Remove.
3323         (Target_i386::i386_info): Initialize
3324         can_icf_inline_merge_sections.
3325         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3326         Initialize can_icf_inline_merge_sections.
3327         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3328         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3329         Rename from can_check_for_function_pointers, move in file.
3330         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3331         (Target_x86_64::x86_64_info): Initialize
3332         can_icf_inline_merge_sections.
3333         * testsuite/testfile.cc (Target_test::test_target_info):
3334         Likewise.
3335         * icf.cc (get_section_contents): Correct formatting.
3336
3337 2011-06-27  Ian Lance Taylor  <iant@google.com>
3338
3339         * symtab.cc (Symbol::versioned_name): New function.
3340         (Symbol_table::add_to_final_symtab): Use versioned_name when
3341         appropriate.
3342         (Symbol_table::sized_write_symbol): Likewise.
3343         * symtab.h (class Symbol): Declare versioned_name.
3344         * stringpool.h (class Stringpool_template): Add variant of add
3345         which takes a std::basic_string.
3346         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3347         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3348         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3349         (ver_test_12.o): New target.
3350         * testsuite/Makefile.in: Rebuild.
3351
3352 2011-06-27  Doug Kwan  <dougkwan@google.com>
3353
3354         * arm.cc (Arm_relocate_functions::thm_jump8,
3355         Arm_relocate_functions::thm_jump11): Use a wider signed
3356         type to compute offset.
3357         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3358         arm_thm_jump8.
3359         * testsuite/Makefile.in: Regenerate.
3360         * testsuite/arm_branch_in_range.sh: Check test results of
3361         arm_thm_jump11 and arm_thm_jump8.
3362         * testsuite/arm_thm_jump11.s: New test source file.
3363         * testsuite/arm_thm_jump11.t: New linker script.
3364         * testsuite/arm_thm_jump8.s: New test source file.
3365         * testsuite/arm_thm_jump8.t: New linker script.
3366
3367 2011-06-24  Ian Lance Taylor  <iant@google.com>
3368
3369         * layout.cc: Include "object.h".
3370         (ctors_sections_in_init_array): New static variable.
3371         (Layout::is_ctors_in_init_array): New function.
3372         (Layout::layout): Add entry to ctors_sections_in_init_array if
3373         appropriate.
3374         * layout.h (class Layout): Declare is_ctors_in_init_array.
3375         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3376         is_ctors_reverse_view is set.
3377         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3378         all callers.  Set is_ctors_reverse_view field of View_size.
3379         (Sized_relobj_file::reverse_words): New function.
3380         * object.h (Sized_relobj_file::View_size): Add
3381         is_ctors_reverse_view field.
3382         (class Sized_relobj_file): Update declarations.
3383         * testsuite/initpri3.c: New test.
3384         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3385         initpri3b.
3386         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3387         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3388         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3389         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3390         * testsuite/Makefile.in: Rebuild.
3391
3392 2011-06-24  Cary Coutant  <ccoutant@google.com>
3393
3394         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3395         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3396         (debug_msg_cdebug.err): New targets.
3397         * testsuite/Makefile.in: Regenerate.
3398         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3399         Fix checks for link with shared library.
3400
3401 2011-06-24  Doug Kwan  <dougkwan@google.com>
3402
3403         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3404         skip empty text sections.
3405         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3406
3407 2011-06-22  Ian Lance Taylor  <iant@google.com>
3408
3409         PR gold/12910
3410         * options.h (class General_options): Add --ctors-in-init-array.
3411         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3412         friends as SHT_PROGBITS for merging sections.
3413         (Layout::layout): Remove special handling of .init_array and
3414         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3415         and .dtors if ctors_in_init_array.
3416         (Layout::make_output_section): Force correct section types for
3417         .init_array and friends.  Don't sort if doing relocatable link,
3418         Don't sort .ctors and .dtors if ctors_in_init_array.
3419         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3420         (Layout::output_section_name): Add relobj parameter.  Change all
3421         callers.  Handle .ctors. and .dtors. in code rather than table.
3422         Handle .ctors and .dtors if ctors_in_init_array.
3423         (Layout::match_file_name): New function, moved from output.cc.
3424         * layout.h (class Layout): Update declarations.
3425         * output.cc: Include "layout.h".
3426         (Input_section_sort_entry::get_priority): New function.
3427         (Input_section_sort_entry::match_file_name): Just call
3428         Layout::match_file_name.
3429         (Output_section::Input_section_sort_init_fini_compare::operator()):
3430         Handle .ctors and .dtors.  Sort by explicit priority rather than
3431         by name.
3432         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3433         * testsuite/initpri2.c: New test.
3434         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3435         (check_PROGRAMS): Add initpri2.
3436         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3437         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3438         * configure, testsuite/Makefile.in: Rebuild.
3439
3440 2011-06-19  Ian Lance Taylor  <iant@google.com>
3441
3442         PR gold/12880
3443         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3444         .interp section to a PT_INTERP segment even if we have seen a
3445         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3446         clause in a linker script.
3447         (Layout::finalize): Don't create a .interp section if we've
3448         already create a PT_INTERP segment.
3449         (Layout::create_interp): Always call choose_output_section (revert
3450         patch of 2011-06-17).  Don't create PT_INTERP segment.
3451         * script-sections.cc
3452         (Script_sections::create_note_and_tls_segments): Add a .interp
3453         section to a PT_INTERP segment even if we have seen a
3454         --dynamic-linker option.
3455
3456 2011-06-18  Ian Lance Taylor  <iant@google.com>
3457
3458         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3459         merely because a non-PT_LOAD segment has a dynamic reloc.
3460
3461 2011-06-18  Ian Lance Taylor  <iant@google.com>
3462
3463         * layout.cc (Layout::finish_dynamic_section): Don't create
3464         DT_FLAGS entry if not needed.
3465
3466 2011-06-18  Ian Lance Taylor  <iant@google.com>
3467
3468         PR gold/12745
3469         * layout.cc (Layout::layout_eh_frame): Correct handling of
3470         writable .eh_frame section.
3471
3472 2011-06-17  Ian Lance Taylor  <iant@google.com>
3473
3474         PR gold/12893
3475         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3476         symbol is redefined with the exact same object and value.
3477
3478 2011-06-17  Ian Lance Taylor  <iant@google.com>
3479
3480         PR gold/12880
3481         * layout.h (class Layout): Add interp_segment_ field.
3482         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3483         (Layout::attach_allocated_section_to_segment): If making shared
3484         library, put .interp section in PT_INTERP segment.
3485         (Layout::finalize): Also call create_interp if -dynamic-linker
3486         option was used.
3487         (Layout::create_interp): Assert that there is no PT_INTERP
3488         segment.  If not using a SECTIONS clause, use make_output_section.
3489         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3490         * script-sections.cc
3491         (Script_sections::create_note_and_tls_segments): If making shared
3492         library, put .interp section in PT_INTERP segment.
3493
3494 2011-06-17  Ian Lance Taylor  <iant@google.com>
3495
3496         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3497         when making a shared library.
3498
3499 2011-06-17  Ian Lance Taylor  <iant@google.com>
3500
3501         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3502         parameter.  Change all callers.  Don't issue warning about PC32
3503         against locally defined symbol.
3504
3505 2011-06-16  Ian Lance Taylor  <iant@google.com>
3506
3507         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3508         occurs in same object.
3509
3510 2011-06-14  Alan Modra  <amodra@gmail.com>
3511
3512         * po/POTFILES.in: Regenerate.
3513
3514 2011-06-09  Ian Lance Taylor  <iant@google.com>
3515
3516         * script-sections.cc
3517         (Orphan_output_section::set_section_addresses): For a relocatable
3518         link set address to 0.
3519
3520 2011-06-09  Cary Coutant  <ccoutant@google.com>
3521
3522         PR gold/12804
3523         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3524         used with --compress-debug-sections.
3525         * gold/object.cc (Sized_relobj_file::do_layout): Report
3526         uncompressed size of compressed input sections.
3527
3528 2011-06-08  Cary Coutant  <ccoutant@google.com>
3529
3530         PR gold/12804
3531         * testsuite/two_file_test_2_v1.cc: Change initialization of
3532         v2 to keep it in .data.
3533
3534 2011-06-07  Cary Coutant  <ccoutant@google.com>
3535
3536         * common.cc (Symbol_table::do_allocate_commons_list): Call
3537         gold_fallback.
3538         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3539         (Errors::fallback): New function.
3540         (gold_fallback): New function.
3541         * errors.h (Errors::fallback): New function.
3542         * gold.cc (gold_exit): Change status parameter to enum; adjust
3543         all callers.
3544         (queue_initial_tasks): Call gold_fallback.
3545         * gold.h: Include cstdlib.
3546         (Exit_status): New enum type.
3547         (gold_exit): Change status parameter to enum.
3548         (gold_fallback): New function.
3549         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3550         (Layout::create_symtab_sections): Likewise.
3551         (Layout::create_shdrs): Likewise.
3552         * main.cc (main): Adjust call to gold_exit.
3553         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3554         (Output_data_got::add_got_entry_pair): Likewise.
3555         (Output_section::add_input_section): Likewise.
3556         (Output_section::add_output_section_data): Likewise.
3557         (Output_segment::set_section_list_addresses): Likewise.
3558         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3559
3560 2011-06-07  Cary Coutant  <ccoutant@google.com>
3561
3562         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3563         for incremental links.
3564         * output.cc (Output_segment::set_section_list_addresses): Remove
3565         FIXME and test for TLS or BSS.
3566
3567 2011-06-07  Cary Coutant  <ccoutant@google.com>
3568
3569         * testsuite/Makefile.am: Add incremental_copy_test,
3570         incremental_common_test_1.
3571         * testsuite/Makefile.in: Regenerate.
3572         * testsuite/common_test_1_v1.c: New source file.
3573         * testsuite/common_test_1_v2.c: New source file.
3574         * testsuite/copy_test_v1.cc: New source file.
3575
3576 2011-06-07  Cary Coutant  <ccoutant@google.com>
3577
3578         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3579         update, allocate common from bss section's free list.
3580         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3581         linker-defined symbols.
3582         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3583         Skip GOT and PLT entries that are no longer referenced.
3584         (Output_section_incremental_inputs::write_info_blocks): Mark
3585         linker-defined symbols.
3586         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3587         * output.cc (Output_section::allocate): New function.
3588         * output.h (Output_section::allocate): New function.
3589         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3590         linker-defined symbols.
3591         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3592         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3593         (Symbol::init_base_output_data): Likewise.
3594         (Symbol::init_base_output_segment): Likewise.
3595         (Symbol::init_base_constant): Likewise.
3596         (Sized_symbol::init_output_data): Likewise.
3597         (Sized_symbol::init_output_segment): Likewise.
3598         (Sized_symbol::init_constant): Likewise.
3599         (Symbol_table::do_define_in_output_data): Likewise.
3600         (Symbol_table::do_define_in_output_segment): Likewise.
3601         (Symbol_table::do_define_as_constant): Likewise.
3602         * symtab.h (Symbol::is_predefined): New function.
3603         (Symbol::init_base_output_data): Add is_predefined parameter.
3604         (Symbol::init_base_output_segment): Likewise.
3605         (Symbol::init_base_constant): Likewise.
3606         (Symbol::is_predefined_): New data member.
3607         (Sized_symbol::init_output_data): Add is_predefined parameter.
3608         (Sized_symbol::init_output_segment): Likewise.
3609         (Sized_symbol::init_constant): Likewise.
3610         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3611
3612 2011-06-07  Cary Coutant  <ccoutant@google.com>
3613
3614         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3615         instead of emit_copy_reloc.
3616         (Copy_relocs::emit_copy_reloc): Refactor.
3617         (Copy_relocs::make_copy_reloc): New function.
3618         (Copy_relocs::add_copy_reloc): Remove.
3619         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3620         section.
3621         (Copy_relocs::make_copy_reloc): New function.
3622         (Copy_relocs::add_copy_reloc): Remove.
3623         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3624         unchanged input files.
3625         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3626         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3627         Reserve BSS space for COPY relocations.
3628         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3629         (Output_section_incremental_inputs::write_info_blocks): Record
3630         whether a symbol is copied from a shared object.
3631         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3632         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3633         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3634         (Incremental_input_entry_reader::get_output_symbol_index): Add
3635         is_copy parameter.
3636         (Incremental_binary::emit_copy_relocs): New function.
3637         (Incremental_binary::do_emit_copy_relocs): New function.
3638         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3639         new data member.
3640         (Sized_incremental_binary::add_copy_reloc): New function.
3641         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3642         (Sized_incremental_binary::Copy_reloc): New struct.
3643         (Sized_incremental_binary::Copy_relocs): New typedef.
3644         (Sized_incremental_binary::copy_relocs_): New data member.
3645         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3646         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3647         * target.h (Sized_target::emit_copy_reloc): New function.
3648         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3649
3650 2011-06-02  Cary Coutant  <ccoutant@google.com>
3651
3652         PR gold/12163
3653         * gold/archive.cc (Archive::Archive): Initialize new data member.
3654         (Archive::include_all_members): Return if archive has already been
3655         included.
3656         * gold/archive.h (Archive::include_all_members_): New data member.
3657
3658 2011-06-02  Nick Clifton  <nickc@redhat.com>
3659
3660         * dynobj.h: Fix spelling mistake in comment.
3661         * output.cc: Likewise.
3662
3663 2011-05-31  Doug Kwan  <dougkwan@google.com>
3664             Asier Llano
3665
3666         PR gold/12826
3667         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3668         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3669         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3670         redundant arm_exidx_test.so.
3671         * testsuite/Makefile.in: Regenerate.
3672         (check_SCRIPTS): Add pr12826.sh
3673         (check_DATA): Add pr12826.stdout
3674         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3675         * testsuite/pr12826.sh: New file.
3676         * testsuite/pr12826_1.s: Ditto.
3677         * testsuite/pr12826_1.s: Ditto.
3678
3679 2011-05-30  Ian Lance Taylor  <iant@google.com>
3680
3681         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3682         sections.
3683
3684 2011-05-29  Ian Lance Taylor  <iant@google.com>
3685
3686         PR gold/12804
3687         * testsuite/Makefile.am: Use different file name for two_file_test
3688         temporary file for each incremental test.
3689         * testsuite/Makefile.in: Rebuild.
3690
3691 2011-05-29  Ian Lance Taylor  <iant@google.com>
3692
3693         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3694         binary input file is empty.
3695
3696 2011-05-27  Ian Lance Taylor  <iant@google.com>
3697
3698         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3699         (ver_test_9.so): Likewise.
3700         * testsuite/Makefile.in: Rebuild.
3701
3702 2011-05-26 Cary Coutant  <ccoutant@google.com>
3703
3704         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3705         * incremental.cc (Incremental_inputs::report_input_section): Fix
3706         comment, indentation.
3707         (Incremental_inputs::report_comdat_group): New function.
3708         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3709         of data for incremental input file entry.
3710         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3711         group count, COMDAT group signatures.
3712         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3713         an unchanged input file.
3714         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3715         Initialize new data member.
3716         (Incremental_object_entry::add_comdat_group): New function.
3717         (Incremental_object_entry::get_comdat_group_count): New function.
3718         (Incremental_object_entry::get_comdat_signature_key): New function.
3719         (Incremental_object_entry::groups_): New data member.
3720         (Incremental_inputs::report_comdat_group): New function.
3721         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3722         data for incremental input file entry.
3723         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3724         (Incremental_input_entry_reader::get_input_section): Adjust size of
3725         data for incremental input file entry.
3726         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3727         (Incremental_input_entry_reader::get_comdat_group_signature): New
3728         function.
3729         * object.cc (Sized_relobj::include_section_group): Report kept
3730         COMDAT groups for incremental links.
3731
3732 2011-05-24  David Meyer  <pdox@google.com>
3733
3734         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3735         with name parameter.  Add found_name parameter.
3736         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3737         * dirsearch.h (class Dirsearch): Update declaration.
3738
3739 2011-05-24  Ian Lance Taylor  <iant@google.com>
3740
3741         * archive.cc (Library_base::should_include_member): Pull in object
3742         from archive if it defines the entry symbol.
3743         * parameters.cc (Parameters::entry): New function.
3744         * parameters.h (class Parameters): Declare entry.
3745         * output.h (class Output_file_header): Remove entry_ field.
3746         * output.cc (Output_file_header::Output_file_header): Remove entry
3747         parameter.  Change all callers.
3748         (Output_file_header::entry): Use parameters->entry.
3749         * gold.cc (queue_middle_tasks): Likewise.
3750         * plugin.cc (Plugin_hook::run): Likewise.
3751
3752 2011-05-24 Cary Coutant  <ccoutant@google.com>
3753
3754         * gold.cc (queue_initial_tasks): Pass incremental base filename
3755         to Output_file::open_base_file; don't print error message.
3756         * incremental-dump.cc (main): Adjust call to
3757         Output_file::open_for_modification.
3758         * incremental-dump.cc (main): Likewise.
3759         * incremental.cc (Incremental_inputs::report_command_line):
3760         Ignore --incremental-base option when comparing command lines.
3761         Ignore parameter when given as separate argument.
3762         * options.h (class General_options): Add --incremental-base.
3763         * output.cc (Output_file::Output_file):
3764         (Output_file::open_base_file): Add base_name and writable parameters;
3765         read base file into new file; print error message here.
3766         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3767         callers.
3768         * output.h (Output_file::open_for_modification): Rename to...
3769         (Output_file::open_base_file): ...this; add base_name and
3770         writable parameters; adjust all callers.
3771         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3772         callers.
3773         * testsuite/Makefile.am (incremental_test_4): Test
3774         --incremental-base.
3775         * testsuite/Makefile.in: Regenerate.
3776
3777 2011-05-24 Cary Coutant  <ccoutant@google.com>
3778
3779         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3780         incremental_test_4.
3781         * testsuite/Makefile.in: Regenerate.
3782         * testsuite/two_file_test_1_v1.cc: New test source file.
3783         * testsuite/two_file_test_1b_v1.cc: New test source file.
3784         * testsuite/two_file_test_2_v1.cc: New test source file.
3785
3786 2011-05-24 Cary Coutant  <ccoutant@google.com>
3787
3788         * dynobj.h (Dynobj::do_dynobj): New function.
3789         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3790         flag and soname for shared objects.
3791         * incremental.cc (Incremental_inputs::report_object): Make
3792         either Incremental_object_entry or Incremental_dynobj_entry; add
3793         soname to string table.
3794         (Incremental_inputs::report_input_section): Add assertion.
3795         (Output_section_incremental_inputs::set_final_data_size): Adjust
3796         type of input file entry for shared libraries; adjust size of
3797         shared library info entry.
3798         (Output_section_incremental_inputs::write_input_files): Write
3799         as_needed flag for shared libraries.
3800         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3801         of input file entry for shared libraries; write soname.
3802         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3803         soname from incremental info.
3804         * incremental.h (enum Incremental_input_flags): Add
3805         INCREMENTAL_INPUT_AS_NEEDED.
3806         (Incremental_input_entry::Incremental_input_entry): Initialize new
3807         data member.
3808         (Incremental_input_entry::set_as_needed): New function.
3809         (Incremental_input_entry::as_needed): New function.
3810         (Incremental_input_entry::do_dynobj_entry): New function.
3811         (Incremental_input_entry::as_needed_): New data member.
3812         (Incremental_object_entry::Incremental_object_entry): Don't check
3813         for shared library.
3814         (Incremental_object_entry::do_type): Likewise.
3815         (class Incremental_dynobj_entry): New class.
3816         (Incremental_input_entry_reader::as_needed): New function.
3817         (Incremental_input_entry_reader::get_soname): New function.
3818         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3819         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3820         size of shared library info entry.
3821         * layout.cc (Layout::finish_dynamic_section): Don't test for
3822         incremental link when adding DT_NEEDED entries.
3823         * object.h (Object::Object): Initialize new data member.
3824         (Object::dynobj): New function.
3825         (Object::set_as_needed): New function.
3826         (Object::as_needed): New function.
3827         (Object::do_dynobj): New function.
3828         (Object::as_needed_): New data member.
3829
3830 2011-05-24 Cary Coutant  <ccoutant@google.com>
3831
3832         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3833         info; adjust display of GOT entries.
3834         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3835         vector of input objects; remove file_status_.
3836         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3837         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3838         got_plt reader; call target hooks to reserve GOT entries.
3839         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3840         of input file info header and GOT info entry.
3841         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3842         relocation info.
3843         (Got_plt_view_info::got_descriptor): Remove.
3844         (Got_plt_view_info::sym_index): New data member.
3845         (Got_plt_view_info::input_index): New data member.
3846         (Local_got_offset_visitor::visit): Write input file index.
3847         (Global_got_offset_visitor::visit): Write 0 for input file index.
3848         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3849         with sym_index and input_index.
3850         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3851         incremental info GOT entry; replace got_descriptor with input_index.
3852         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3853         map from input file index to object.
3854         (Sized_relobj_incr::do_layout): Replace direct data member reference
3855         with accessor function.
3856         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3857         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3858         Adjust size of input file info header.
3859         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3860         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3861         (Incremental_input_entry_reader::get_input_section): Adjust size of
3862         input file info header.
3863         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3864         of incremental info GOT entry.
3865         (Incremental_got_plt_reader::get_got_desc): Remove.
3866         (Incremental_got_plt_reader::get_got_symndx): New function.
3867         (Incremental_got_plt_reader::get_got_input_index): New function.
3868         (Sized_incremental_binary::Sized_incremental_binary): Remove
3869         file_status_; add input_objects_.
3870         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3871         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3872         (Sized_incremental_binary::file_is_unchanged): Remove.
3873         (Sized_incremental_binary::set_input_object): New function.
3874         (Sized_incremental_binary::input_object): New function.
3875         (Sized_incremental_binary::file_status_): Remove.
3876         (Sized_incremental_binary::input_objects_): New data member.
3877         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3878         references.
3879         (Sized_relobj_incr::invalid_address): Move to base class.
3880         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3881         class.
3882         (Sized_relobj_incr::do_output_section_offset): Likewise.
3883         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3884         (Sized_relobj_incr::section_offsets_): Likewise.
3885         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3886         function.
3887         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3888         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3889         with accessor function.
3890         (Sized_relobj_file::do_layout): Likewise.
3891         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3892         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3893         (Sized_relobj_file::compute_final_local_value): Replace refs to
3894         section_offsets_ with accessor function.
3895         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3896         * object.h (Relobj::Relobj): Initialize new data members.
3897         (Relobj::add_dyn_reloc): New function.
3898         (Relobj::first_dyn_reloc): New function.
3899         (Relobj::dyn_reloc_count): New function.
3900         (Relobj::first_dyn_reloc_): New data member.
3901         (Relobj::dyn_reloc_count_): New data member.
3902         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3903         references.
3904         (Sized_relobj::Address): New typedef.
3905         (Sized_relobj::invalid_address): Move here from child class.
3906         (Sized_relobj::Sized_relobj): Initialize new data members.
3907         (Sized_relobj::sized_relobj): New function.
3908         (Sized_relobj::is_output_section_offset_invalid): Move here from
3909         child class.
3910         (Sized_relobj::get_output_section_offset): Likewise.
3911         (Sized_relobj::local_has_got_offset): Likewise.
3912         (Sized_relobj::local_got_offset): Likewise.
3913         (Sized_relobj::set_local_got_offset): Likewise.
3914         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3915         (Sized_relobj::clear_got_offsets): New function.
3916         (Sized_relobj::section_offsets): Move here from child class.
3917         (Sized_relobj::do_output_section_offset): Likewise.
3918         (Sized_relobj::do_set_section_offset): Likewise.
3919         (Sized_relobj::Local_got_offsets): Likewise.
3920         (Sized_relobj::local_got_offsets_): Likewise.
3921         (Sized_relobj::section_offsets_): Likewise.
3922         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3923         references.
3924         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3925         class.
3926         (Sized_relobj_file::sized_relobj): New function
3927         (Sized_relobj_file::local_has_got_offset): Move to base class.
3928         (Sized_relobj_file::local_got_offset): Likewise.
3929         (Sized_relobj_file::set_local_got_offset): Likewise.
3930         (Sized_relobj_file::get_output_section_offset): Likewise.
3931         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3932         (Sized_relobj_file::do_output_section_offset): Likewise.
3933         (Sized_relobj_file::do_set_section_offset): Likewise.
3934         (Sized_relobj_file::Local_got_offsets): Likewise.
3935         (Sized_relobj_file::local_got_offsets_): Likewise.
3936         (Sized_relobj_file::section_offsets_): Likewise.
3937         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3938         (all constructors).
3939         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3940         (Output_reloc::get_symbol_index): Likewise.
3941         (Output_reloc::local_section_offset): Likewise.
3942         (Output_reloc::get_address): Likewise.
3943         (Output_reloc::symbol_value): Likewise.
3944         (Output_data_got::reserve_slot): Move to class definition.
3945         (Output_data_got::reserve_local): New function.
3946         (Output_data_got::reserve_slot_for_global): Remove.
3947         (Output_data_got::reserve_global): New function.
3948         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3949         (all constructors, two instantiations).
3950         (Output_reloc::get_relobj): New function (two instantiations).
3951         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3952         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3953         (Output_data_reloc::add_global): Adjust type of relobj.
3954         (Output_data_reloc::add_global_relative): Likewise.
3955         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3956         (Output_data_reloc::add_local): Likewise.
3957         (Output_data_reloc::add_local_relative): Likewise.
3958         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3959         (Output_data_reloc::add_local_section): Likewise.
3960         (Output_data_reloc::add_output_section): Likewise.
3961         (Output_data_reloc::add_absolute): Likewise.
3962         (Output_data_reloc::add_target_specific): Likewise.
3963         (Output_data_got::reserve_slot): Move definition here.
3964         (Output_data_got::reserve_local): New function.
3965         (Output_data_got::reserve_global): New function.
3966         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3967         section_offsets_ with accessor function.
3968         (Sized_relobj_file::write_sections): Likewise.
3969         (Sized_relobj_file::do_relocate_sections): Likewise.
3970         * target.h (Sized_target::reserve_local_got_entry): New function.
3971         (Sized_target::reserve_global_got_entry): New function.
3972         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3973         (Target_x86_64::reserve_global_got_entry): New function.
3974         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3975
3976 2011-05-23 Cary Coutant  <ccoutant@google.com>
3977
3978         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3979         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3980         bit when checking got_type.
3981         * incremental.cc (Sized_incremental_binary::setup_readers):
3982         Store symbol table and string table locations; initialize bit vector
3983         of file status flags.
3984         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3985         unchanged files.
3986         (Sized_incremental_binary::do_process_got_plt): New function.
3987         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3988         (Output_section_incremental_inputs::set_final_data_size): Record
3989         file index for each input file.
3990         (Output_section_incremental_inputs::write_got_plt): Store file index
3991         instead of input entry offset for each GOT entry.
3992         * incremental.h
3993         (Incremental_input_entry::Incremental_input_entry): Initialize new
3994         data member.
3995         (Incremental_input_entry::set_offset): Store file index.
3996         (Incremental_input_entry::get_file_index): New function.
3997         (Incremental_input_entry::file_index_): New data member.
3998         (Incremental_binary::process_got_plt): New function.
3999         (Incremental_binary::do_process_got_plt): New function.
4000         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4001         data members.
4002         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4003         (Sized_incremental_binary::set_file_is_unchanged): New function.
4004         (Sized_incremental_binary::file_is_unchanged): New function.
4005         (Sized_incremental_binary::do_process_got_plt): New function.
4006         (Sized_incremental_binary::file_status_): New data member.
4007         (Sized_incremental_binary::main_symtab_loc_): New data member.
4008         (Sized_incremental_binary::main_strtab_loc_): New data member.
4009         * output.cc (Output_data_got::Got_entry::write): Add case
4010         RESERVED_CODE.
4011         (Output_data_got::add_global): Call add_got_entry.
4012         (Output_data_got::add_global_plt): Likewise.
4013         (Output_data_got::add_global_with_rel): Likewise.
4014         (Output_data_got::add_global_with_rela): Likewise.
4015         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4016         (Output_data_got::add_global_pair_with_rela): Likewise.
4017         (Output_data_got::add_local): Call add_got_entry.
4018         (Output_data_got::add_local_plt): Likewise.
4019         (Output_data_got::add_local_with_rel): Likewise.
4020         (Output_data_got::add_local_with_rela): Likewise.
4021         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4022         (Output_data_got::add_local_pair_with_rela): Likewise.
4023         (Output_data_got::reserve_slot): New function.
4024         (Output_data_got::reserve_slot_for_global): New function.
4025         (Output_data_got::add_got_entry): New function.
4026         (Output_data_got::add_got_entry_pair): New function.
4027         (Output_section::add_output_section_data): Edit FIXME.
4028         * output.h
4029         (Output_section_data_build::Output_section_data_build): New
4030         constructor with size parameter.
4031         (Output_data_space::Output_data_space): Likewise.
4032         (Output_data_got::Output_data_got): Initialize new data member; new
4033         constructor with size parameter.
4034         (Output_data_got::add_constant): Call add_got_entry.
4035         (Output_data_got::reserve_slot): New function.
4036         (Output_data_got::reserve_slot_for_global): New function.
4037         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4038         (Output_data_got::add_got_entry): New function.
4039         (Output_data_got::add_got_entry_pair): New function.
4040         (Output_data_got::free_list_): New data member.
4041         * target.h (Sized_target::init_got_plt_for_update): New function.
4042         (Sized_target::register_global_plt_entry): New function.
4043         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4044         Initialize new data member; call init; add constructor with PLT count.
4045         (Output_data_plt_x86_64::init): New function.
4046         (Output_data_plt_x86_64::add_relocation): New function.
4047         (Output_data_plt_x86_64::reserve_slot): New function.
4048         (Output_data_plt_x86_64::free_list_): New data member.
4049         (Target_x86_64::init_got_plt_for_update): New function.
4050         (Target_x86_64::register_global_plt_entry): New function.
4051         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4052         incremental updates.
4053         (Output_data_plt_x86_64::add_relocation): New function.
4054         * testsuite/object_unittest.cc (Object_test): Set default options.
4055
4056 2011-05-16  Ian Lance Taylor  <iant@google.com>
4057
4058         * options.h (class General_options): Make -i a synonym for -r.
4059
4060 2011-05-16  Ian Lance Taylor  <iant@google.com>
4061
4062         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4063
4064 2011-05-10 Cary Coutant  <ccoutant@google.com>
4065
4066         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4067         strip_all (-s).
4068
4069 2011-05-06  Ian Lance Taylor  <iant@google.com>
4070
4071         * layout.cc (Layout::layout): If the output section flags change,
4072         update the ordering.
4073
4074 2011-04-25 Cary Coutant  <ccoutant@google.com>
4075
4076         * incremental-dump.cc (dump_incremental_inputs): Print local
4077         symbol info for each input file.
4078         * incremental.cc
4079         (Output_section_incremental_inputs::set_final_data_size): Add local
4080         symbol info to input file entries in incremental info.
4081         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4082         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4083         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4084         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4085         implementation.
4086         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4087         (Sized_incr_relobj::do_relocate): Write the local symbols.
4088         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4089         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4090         Adjust size of input file header.
4091         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4092         (Incremental_inputs_reader::get_local_symbol_count): New function.
4093         (Incremental_inputs_reader::get_input_section): Adjust size of input
4094         file header.
4095         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4096         (Sized_incr_relobj::This): New typedef.
4097         (Sized_incr_relobj::sym_size): New const data member.
4098         (Sized_incr_relobj::Local_symbol): New struct.
4099         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4100         (Sized_incr_relobj::do_local_symbol_offset): New function.
4101         (Sized_incr_relobj::local_symbol_count_): New data member.
4102         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4103         (Sized_incr_relobj::local_symbol_index_): New data member.
4104         (Sized_incr_relobj::local_symbol_offset_): New data member.
4105         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4106         (Sized_incr_relobj::local_symbols_): New data member.
4107         * object.h (Relobj::output_local_symbol_count): New function.
4108         (Relobj::local_symbol_offset): New function.
4109         (Relobj::do_output_local_symbol_count): New function.
4110         (Relobj::do_local_symbol_offset): New function.
4111         (Sized_relobj::do_output_local_symbol_count): New function.
4112         (Sized_relobj::do_local_symbol_offset): New function.
4113
4114 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4115
4116         * descriptors.cc (set_close_on_exec): New function.
4117         (Descriptors::open): Use set_close_on_exec.
4118         * output.cc (S_ISLNK): Define if not defined.
4119
4120 2011-04-22 Cary Coutant  <ccoutant@google.com>
4121
4122         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4123         global symbol map.
4124         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4125         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4126         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4127         relocations.
4128         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4129         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4130         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4131         * incremental.h
4132         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4133         function.
4134         (Incremental_binary::apply_incremental_relocs): New function.
4135         (Incremental_binary::do_apply_incremental_relocs): New function.
4136         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4137         data member.
4138         (Sized_incremental_binary::add_global_symbol): New function.
4139         (Sized_incremental_binary::global_symbol): New function.
4140         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4141         (Sized_incremental_binary::symbol_map_): New data member.
4142         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4143         * target.h (Sized_target::apply_relocation): New function.
4144         * target-reloc.h (apply_relocation): New function.
4145         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4146
4147 2011-04-22  Doug Kwan  <dougkwan@google.com>
4148
4149         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4150         flag of a SHT_ARM_EXIDX section.
4151         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4152         * testsuite/Makefile.in: Regenerate.
4153         * testsuite/arm_exidx_test.s: New file.
4154         * testsuite/arm_exidx_test.sh: Same.
4155
4156 2011-04-20 Cary Coutant  <ccoutant@google.com>
4157
4158         PR gold/12689
4159         * archive.h (Incremental_archive_entry::Archive_member):
4160         Initialize arg_serial_ (second constructor).
4161
4162 2011-04-17  Ian Lance Taylor  <iant@google.com>
4163
4164         * object.cc (Relocate_info::location): Simplify location string.
4165         * errors.cc (Errors::error_at_location): Don't print program
4166         name.
4167         (Errors::warning_at_location): Likewise.
4168         (Errors::undefined_symbol): Likewise.
4169         * testsuite/debug_msg.sh: Update accordingly.
4170
4171 2011-04-14 Cary Coutant  <ccoutant@google.com>
4172
4173         * gold/layout.cc (Layout::symtab_section_offset): New function.
4174         * gold/layout.h (Layout::symtab_section_offset): New function.
4175         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4176
4177 2011-04-12  Ian Lance Taylor  <iant@google.com>
4178
4179         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4180         with MREMAP_MAYMOVE.
4181         * output.h (class Output_file): Add map_is_allocated_ field.
4182         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4183         not available, provide stubs.  If mremap is not available, #define
4184         it to gold_mremap.
4185         (MREMAP_MAYMOVE): Define if not defined.
4186         (Output_file::Output_file): Initialize map_is_allocated_.
4187         (Output_file::resize): Check map_is_allocated_.
4188         (Output_file::map_anonymous): If mmap fails, use malloc.
4189         (Output_file::unmap): Don't do anything for an anonymous map.
4190         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4191         is not available, provide stubs.
4192         (File_read::View::~View): Use free rather than delete[].
4193         (File_read::make_view): Use malloc rather than new[].  If mmap
4194         fails, use malloc.
4195         (File_read::find_or_make_view): Use malloc rather than new[].
4196         * gold.h: Remove HAVE_REMAP code.
4197         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4198         exists.  Rename mremap to gold_mremap.  If mmap is not available
4199         don't do anything.
4200         * configure, config.in: Rebuild.
4201
4202 2011-04-11  Ian Lance Taylor  <iant@google.com>
4203
4204         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4205         initialize local variable v.
4206
4207 2011-04-11  Cary Coutant  <ccoutant@google.com>
4208
4209         * archive.cc (Archive::include_member): Adjust call to
4210         report_object.
4211         (Add_archive_symbols::run): Track argument serial numbers.
4212         (Lib_group::include_member): Likewise.
4213         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4214         * archive.h (Incremental_archive_entry::Archive_member):
4215         Initialize arg_serial_.
4216         (Archive_member::arg_serial_): New data member.
4217         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4218         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4219         incremental link.
4220         (Sized_dynobj::do_for_all_local_got_entries): New function.
4221         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4222         function.
4223         * fileread.cc (get_mtime): New function.
4224         * fileread.h (get_mtime): New function.
4225         * gold.cc (queue_initial_tasks): Check for incremental update.
4226         (process_incremental_input): New function.
4227         (queue_middle_tasks): Don't force valid target for incremental
4228         update.
4229         * incremental-dump.cc (find_input_containing_global): Adjust
4230         size of symbol info entry.
4231         (dump_incremental_inputs): Dump argument serial number and
4232         in_system_directory flag; bias shndx by 1; print symbol names
4233         when dumping per-file symbol lists; use new symbol info readers.
4234         * incremental.cc
4235         (Output_section_incremental_inputs:update_data_size): New function.
4236         (Sized_incremental_binary::setup_readers): Setup input readers
4237         for each input file; build maps for files added from libraries
4238         and scripts.
4239         (Sized_incremental_binary::check_input_args): New function.
4240         (Sized_incremental_binary::do_check_inputs): Build map of argument
4241         serial numbers to input arguments.
4242         (Sized_incremental_binary::do_file_has_changed): Rename
4243         do_file_is_unchanged to this; compare file modification times.
4244         (Sized_incremental_binary::do_init_layout): New function.
4245         (Sized_incremental_binary::do_reserve_layout): New function.
4246         (Sized_incremental_binary::do_get_input_reader): Remove.
4247         (Sized_incremental_binary::get_symtab_view): New function.
4248         (Incremental_checker::can_incrementally_link_output_file): Remove.
4249         (Incremental_inputs::report_command_line): Exclude --debug options.
4250         (Incremental_inputs::report_archive_begin): Add parameter; track
4251         argument serial numbers; don't put input file entry for archive
4252         before archive members.
4253         (Incremental_inputs::report_archive_end): Put input file entry
4254         for archive after archive members.
4255         (Incremental_inputs::report_object): Add parameter; track argument
4256         serial numbers and in_system_directory flag.
4257         (Incremental_inputs::report_script): Add parameter; track argument
4258         serial numbers.
4259         (Output_section_incremental_inputs::set_final_data_size): Adjust
4260         size of symbol info entry; check for forwarding symbols.
4261         (Output_section_incremental_inputs::write_input_files): Write
4262         in_system_directory flag and argument serial number.
4263         (Output_section_incremental_inputs::write_info_blocks): Map section
4264         indices between incremental info and original input file; store
4265         input section index for each symbol.
4266         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4267         change operator() to visit().
4268         (class Global_got_offset_visitor): Likewise.
4269         (class Global_symbol_visitor_got_plt):
4270         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4271         classes.
4272         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4273         (Sized_incr_relobj::do_read_symbols): New function.
4274         (Sized_incr_relobj::do_layout): New function.
4275         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4276         (Sized_incr_relobj::do_add_symbols): New function.
4277         (Sized_incr_relobj::do_should_include_member): New function.
4278         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4279         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4280         (Sized_incr_relobj::do_section_size): New function.
4281         (Sized_incr_relobj::do_section_name): New function.
4282         (Sized_incr_relobj::do_section_contents): New function.
4283         (Sized_incr_relobj::do_section_flags): New function.
4284         (Sized_incr_relobj::do_section_entsize): New function.
4285         (Sized_incr_relobj::do_section_address): New function.
4286         (Sized_incr_relobj::do_section_type): New function.
4287         (Sized_incr_relobj::do_section_link): New function.
4288         (Sized_incr_relobj::do_section_info): New function.
4289         (Sized_incr_relobj::do_section_addralign): New function.
4290         (Sized_incr_relobj::do_initialize_xindex): New function.
4291         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4292         (Sized_incr_relobj::do_read_relocs): New function.
4293         (Sized_incr_relobj::do_gc_process_relocs): New function.
4294         (Sized_incr_relobj::do_scan_relocs): New function.
4295         (Sized_incr_relobj::do_count_local_symbols): New function.
4296         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4297         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4298         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4299         (Sized_incr_relobj::do_relocate): New function.
4300         (Sized_incr_relobj::do_set_section_offset): New function.
4301         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4302         (Sized_incr_dynobj::do_read_symbols): New function.
4303         (Sized_incr_dynobj::do_layout): New function.
4304         (Sized_incr_dynobj::do_add_symbols): New function.
4305         (Sized_incr_dynobj::do_should_include_member): New function.
4306         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4307         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4308         (Sized_incr_dynobj::do_section_size): New function.
4309         (Sized_incr_dynobj::do_section_name): New function.
4310         (Sized_incr_dynobj::do_section_contents): New function.
4311         (Sized_incr_dynobj::do_section_flags): New function.
4312         (Sized_incr_dynobj::do_section_entsize): New function.
4313         (Sized_incr_dynobj::do_section_address): New function.
4314         (Sized_incr_dynobj::do_section_type): New function.
4315         (Sized_incr_dynobj::do_section_link): New function.
4316         (Sized_incr_dynobj::do_section_info): New function.
4317         (Sized_incr_dynobj::do_section_addralign): New function.
4318         (Sized_incr_dynobj::do_initialize_xindex): New function.
4319         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4320         (make_sized_incremental_object): New function.
4321         (Incremental_library::copy_unused_symbols): New function.
4322         (Incremental_library::do_for_all_unused_symbols): New function.
4323         * incremental.h (enum Incremental_input_flags): New type.
4324         (class Incremental_checker): Remove.
4325         (Incremental_input_entry::Incremental_input_entry): Add argument
4326         serial number.
4327         (Incremental_input_entry::arg_serial): New function.
4328         (Incremental_input_entry::set_is_in_system_directory): New function.
4329         (Incremental_input_entry::is_in_system_directory): New function.
4330         (Incremental_input_entry::arg_serial_): New data member.
4331         (Incremental_input_entry::is_in_system_directory_): New data member.
4332         (class Script_info): Move here from script.h.
4333         (Script_info::Script_info): Add filename parameter.
4334         (Script_info::filename): New function.
4335         (Script_info::filename_): New data member.
4336         (Incremental_script_entry::Incremental_script_entry): Add argument
4337         serial number.
4338         (Incremental_object_entry::Incremental_object_entry): Likewise.
4339         (Incremental_object_entry::add_input_section): Build list of input
4340         sections with map to original shndx.
4341         (Incremental_object_entry::get_input_section_index): New function.
4342         (Incremental_object_entry::shndx_): New data member.
4343         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4344         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4345         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4346         serial number.
4347         (Incremental_inputs::report_archive_begin): Likewise.
4348         (Incremental_inputs::report_object): Likewise.
4349         (Incremental_inputs::report_script): Likewise.
4350         (class Incremental_global_symbol_reader): New class.
4351         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4352         and store flags and input file type.
4353         (Incremental_input_entry_reader::arg_serial): New function.
4354         (Incremental_input_entry_reader::type): Extract type from flags.
4355         (Incremental_input_entry_reader::is_in_system_directory): New function.
4356         (Incremental_input_entry_reader::get_input_section_count): Call
4357         accessor function for type.
4358         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4359         function for type; adjust size of global symbol entry.
4360         (Incremental_input_entry_reader::get_global_symbol_count): Call
4361         accessor function for type.
4362         (Incremental_input_entry_reader::get_object_count): Likewise.
4363         (Incremental_input_entry_reader::get_object_offset): Likewise.
4364         (Incremental_input_entry_reader::get_member_count): Likewise.
4365         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4366         (Incremental_input_entry_reader::get_member_offset): Likewise.
4367         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4368         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4369         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4370         (Incremental_input_entry_reader::get_global_symbol_reader): New
4371         function.
4372         (Incremental_input_entry_reader::get_output_symbol_index): New
4373         function.
4374         (Incremental_input_entry_reader::type_): Remove.
4375         (Incremental_input_entry_reader::flags_): New data member.
4376         (Incremental_inputs_reader::input_file_offset): New function.
4377         (Incremental_inputs_reader::input_file_index): New function.
4378         (Incremental_inputs_reader::input_file): Call input_file_offset.
4379         (Incremental_inputs_reader::input_file_at_offset): New function.
4380         (Incremental_relocs_reader::get_r_type): Reformat.
4381         (Incremental_relocs_reader::get_r_shndx): Reformat.
4382         (Incremental_relocs_reader::get_r_offset): Reformat.
4383         (Incremental_relocs_reader::data): New function.
4384         (Incremental_binary::Incremental_binary): Initialize new data members.
4385         (Incremental_binary::check_inputs): Add cmdline parameter.
4386         (Incremental_binary::file_is_unchanged): Remove.
4387         (Input_reader::arg_serial): New function.
4388         (Input_reader::get_unused_symbol_count): New function.
4389         (Input_reader::get_unused_symbol): New function.
4390         (Input_reader::do_arg_serial): New function.
4391         (Input_reader::do_get_unused_symbol_count): New function.
4392         (Input_reader::do_get_unused_symbol): New function.
4393         (Incremental_binary::input_file_count): New function.
4394         (Incremental_binary::get_input_reader): Change signature to use
4395         index instead of filename.
4396         (Incremental_binary::file_has_changed): New function.
4397         (Incremental_binary::get_input_argument): New function.
4398         (Incremental_binary::get_library): New function.
4399         (Incremental_binary::get_script_info): New function.
4400         (Incremental_binary::init_layout): New function.
4401         (Incremental_binary::reserve_layout): New function.
4402         (Incremental_binary::output_file): New function.
4403         (Incremental_binary::do_check_inputs): New function.
4404         (Incremental_binary::do_file_is_unchanged): Remove.
4405         (Incremental_binary::do_file_has_changed): New function.
4406         (Incremental_binary::do_init_layout): New function.
4407         (Incremental_binary::do_reserve_layout): New function.
4408         (Incremental_binary::do_input_file_count): New function.
4409         (Incremental_binary::do_get_input_reader): Change signature.
4410         (Incremental_binary::input_args_map_): New data member.
4411         (Incremental_binary::library_map_): New data member.
4412         (Incremental_binary::script_map_): New data member.
4413         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4414         new data members.
4415         (Sized_incremental_binary::output_section): New function.
4416         (Sized_incremental_binary::inputs_reader): Add const.
4417         (Sized_incremental_binary::symtab_reader): Add const.
4418         (Sized_incremental_binary::relocs_reader): Add const.
4419         (Sized_incremental_binary::got_plt_reader): Add const.
4420         (Sized_incremental_binary::get_symtab_view): New function.
4421         (Sized_incremental_binary::Inputs_reader): New typedef.
4422         (Sized_incremental_binary::Input_entry_reader): New typedef.
4423         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4424         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4425         (Sized_incremental_binary::do_file_has_changed): New function.
4426         (Sized_incremental_binary::do_init_layout): New function.
4427         (Sized_incremental_binary::do_reserve_layout): New function.
4428         (Sized_input_reader::Inputs_reader): Remove.
4429         (Sized_input_reader::Input_entry_reader): Remove.
4430         (Sized_input_reader::do_arg_serial): New function.
4431         (Sized_input_reader::do_get_unused_symbol_count): New function.
4432         (Sized_input_reader::do_get_unused_symbol): New function.
4433         (Sized_incremental_binary::do_input_file_count): New function.
4434         (Sized_incremental_binary::do_get_input_reader): Change signature;
4435         use index instead of filename.
4436         (Sized_incremental_binary::section_map_): New data member.
4437         (Sized_incremental_binary::input_entry_readers_): New data member.
4438         (class Sized_incr_relobj): New class.
4439         (class Sized_incr_dynobj): New class.
4440         (make_sized_incremental_object): New function.
4441         (class Incremental_library): New class.
4442         * layout.cc (Free_list::num_lists): New static data member.
4443         (Free_list::num_nodes): New static data member.
4444         (Free_list::num_removes): New static data member.
4445         (Free_list::num_remove_visits): New static data member.
4446         (Free_list::num_allocates): New static data member.
4447         (Free_list::num_allocate_visits): New static data member.
4448         (Free_list::init): New function.
4449         (Free_list::remove): New function.
4450         (Free_list::allocate): New function.
4451         (Free_list::dump): New function.
4452         (Free_list::print_stats): New function.
4453         (Layout_task_runner::run): Resize output file for incremental updates.
4454         (Layout::Layout): Initialize new data members.
4455         (Layout::set_incremental_base): New function.
4456         (Layout::init_fixed_output_section): New function.
4457         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4458         incremental updates.
4459         (Layout::create_gold_note): Do not create gold note section for
4460         incremental updates.
4461         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4462         for incremental updates.
4463         (Layout::set_section_offsets): For incremental updates, allocate space
4464         from free list.
4465         (Layout::create_symtab_sections): Layout with offsets relative to
4466         start of section; for incremental updates, allocate space from free
4467         list.
4468         (Layout::create_shdrs): For incremental updates, allocate space from
4469         free list.
4470         (Layout::finish_dynamic_section): For incremental updates, do not
4471         check --as-needed (fixed in subsequent patch).
4472         * layout.h (class Free_list): New class.
4473         (Layout::set_incremental_base): New function.
4474         (Layout::incremental_base): New function.
4475         (Layout::init_fixed_output_section): New function.
4476         (Layout::allocate): New function.
4477         (Layout::incremental_base_): New data member.
4478         (Layout::free_list_): New data member.
4479         * main.cc (main): Print Free_list statistics.
4480         * object.cc (Relobj::finalize_incremental_relocs): Add
4481         clear_counts parameter; clear counts only when clear_counts is set.
4482         (Sized_relobj::Sized_relobj): Initialize new base class.
4483         (Sized_relobj::do_layout): Don't report special sections.
4484         (Sized_relobj::do_for_all_local_got_entries): New function.
4485         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4486         symtab_off to all symbol table offsets.
4487         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4488         * object.h (class Got_offset_list): Move to top of file.
4489         (Object::Object): Allow case where input_file == NULL.
4490         (Object::~Object): Likewise.
4491         (Object::input_file): Assert that input_file != NULL.
4492         (Object::lock): Allow case where input_file == NULL.
4493         (Object::unlock): Likewise.
4494         (Object::is_locked): Likewise.
4495         (Object::token): Likewise.
4496         (Object::release): Likewise.
4497         (Object::is_incremental): New function.
4498         (Object::get_mtime): New function.
4499         (Object::for_all_local_got_entries): New function.
4500         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4501         (Object::set_is_in_system_directory): New function.
4502         (Object::is_in_system_directory): New function.
4503         (Object::do_is_incremental): New function.
4504         (Object::do_get_mtime): New function.
4505         (Object::do_for_all_local_got_entries): New function.
4506         (Object::is_in_system_directory_): New data member.
4507         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4508         (class Sized_relobj_base): New class.
4509         (class Sized_relobj): Derive from Sized_relobj_base.
4510         (class Sized_relobj::Symbols): Redeclare from base class.
4511         (class Sized_relobj::local_got_offset_list): Remove.
4512         (class Sized_relobj::Output_sections): Redeclare from base class.
4513         (class Sized_relobj::do_for_all_local_got_entries): New function.
4514         (class Sized_relobj::write_local_symbols): Add offset parameter.
4515         (class Sized_relobj::local_symbol_offset_): Update comment.
4516         (class Sized_relobj::local_dynsym_offset_): Update comment.
4517         * options.cc (Input_arguments::add_file): Remove const.
4518         * options.h (Input_file_argument::Input_file_argument):
4519         Initialize arg_serial_ (all constructors).
4520         (Input_file_argument::set_arg_serial): New function.
4521         (Input_file_argument::arg_serial): New function.
4522         (Input_file_argument::arg_serial_): New data member.
4523         (Input_arguments::Input_arguments): Initialize file_count_.
4524         (Input_arguments::add_file): Remove const.
4525         (Input_arguments::number_of_input_files): New function.
4526         (Input_arguments::file_count_): New data member.
4527         (Command_line::number_of_input_files): Call
4528         Input_arguments::number_of_input_files.
4529         * output.cc (Output_segment_headers::Output_segment_headers):
4530         Set current size.
4531         (Output_section::Input_section::current_data_size): New function.
4532         (Output_section::Output_section): Initialize new data members.
4533         (Output_section::add_input_section): Don't do merge sections for
4534         an incremental link; allocate space from free list for an
4535         incremental update.
4536         (Output_section::add_output_section_data): Allocate space from
4537         free list for an incremental update.
4538         (Output_section::update_data_size): New function.
4539         (Output_section::set_fixed_layout): New function.
4540         (Output_section::reserve): New function.
4541         (Output_segment::set_section_addresses): Remove const.
4542         (Output_segment::set_section_list_addresses): Remove const; allocate
4543         space from free list for an incremental update.
4544         (Output_segment::set_offset): Adjust size of RELRO segment for an
4545         incremental update.
4546         * output.h (Output_data::current_data_size): Move here from
4547         child classes.
4548         (Output_data::pre_finalize_data_size): New function.
4549         (Output_data::update_data_size): New function.
4550         (Output_section_headers::update_data_size): new function.
4551         (Output_section_data_build::current_data_size): Move to Output_data.
4552         (Output_data_strtab::update_data_size): New function.
4553         (Output_section::current_data_size): Move to Output_data.
4554         (Output_section::set_fixed_layout): New function.
4555         (Output_section::has_fixed_layout): New function.
4556         (Output_section::reserve): New function.
4557         (Output_section::update_data_size): New function.
4558         (Output_section::has_fixed_layout_): New data member.
4559         (Output_section::free_list_): New data member.
4560         (Output_segment::set_section_addresses): Remove const.
4561         (Output_segment::set_section_list_addresses): Remove const.
4562         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4563         New function.
4564         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4565         New function.
4566         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4567         parameter when calling Add_symbols constructor; store argument
4568         serial number for members of a lib group.
4569         (Add_symbols::locks): Allow case where token == NULL.
4570         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4571         (Read_member::~Read_member): New function.
4572         (Read_member::is_runnable): New function.
4573         (Read_member::locks): New function.
4574         (Read_member::run): New function.
4575         (Check_script::~Check_script): New function.
4576         (Check_script::is_runnable): New function.
4577         (Check_script::locks): New function.
4578         (Check_script::run): New function.
4579         (Check_library::~Check_library): New function.
4580         (Check_library::is_runnable): New function.
4581         (Check_library::locks): New function.
4582         (Check_library::run): New function.
4583         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4584         (Add_symbols::library_): New data member.
4585         (class Read_member): New class.
4586         (class Check_script): New class.
4587         (class Check_library): New class.
4588         * reloc.cc (Read_relocs::is_runnable): Allow case where
4589         token == NULL.
4590         (Read_relocs::locks): Likewise.
4591         (Scan_relocs::locks): Likewise.
4592         (Relocate_task::locks): Likewise.
4593         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4594         to clear counters.
4595         (Sized_relobj::incremental_relocs_scan): Fix comment.
4596         (Sized_relobj::do_relocate): Pass output file offset to
4597         write_local_symbols.
4598         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4599         from class declaration.
4600         * script.cc (read_input_script): Allocate Script_info; pass
4601         argument serial number to report_script.
4602         * script.h (class Script_info): Move to incremental.h.
4603         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4604         * symtab.h (Symbol_table::add_from_incrobj): New function.
4605         (Symbol_table::set_file_offset): New function.
4606
4607 2011-04-05  Cary Coutant  <ccoutant@google.com>
4608
4609         * incremental-dump.cc (dump_incremental_inputs): Change signature
4610         to take a Sized_incremental_binary; change caller.  Use readers
4611         in Sized_incremental_binary.
4612         * incremental.cc
4613         (Sized_incremental_binary::find_incremental_inputs_sections):
4614         Rename do_find_incremental_inputs_sections to this.
4615         (Sized_incremental_binary::setup_readers): New function.
4616         (Sized_incremental_binary::do_check_inputs): Check
4617         has_incremental_info_ flag; move setup code to setup_readers;
4618         use input readers.
4619         (Sized_incremental_binary::do_file_is_unchanged): New function.
4620         (Sized_incremental_binary::do_get_input_reader): New function.
4621         * incremental.h (class Incremental_binary): Move to end of file.
4622         (Incremental_binary::file_is_unchanged): New function.
4623         (Incremental_binary::do_file_is_unchanged): New function.
4624         (Incremental_binary::Input_reader): New class.
4625         (Incremental_binary::get_input_reader): New function.
4626         (class Sized_incremental_binary): Move to end of file.
4627         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4628         input section reader classes.
4629         (Sized_incremental_binary::has_incremental_info): New function.
4630         (Sized_incremental_binary::inputs_reader): New function.
4631         (Sized_incremental_binary::symtab_reader): New function.
4632         (Sized_incremental_binary::relocs_reader): New function.
4633         (Sized_incremental_binary::got_plt_reader): New function.
4634         (Sized_incremental_binary::do_file_is_unchanged): New function.
4635         (Sized_incremental_binary::Sized_input_reader): New class.
4636         (Sized_incremental_binary::get_input_reader): New function.
4637         (Sized_incremental_binary::find_incremental_inputs_sections):
4638         Rename do_find_incremental_inputs_sections to this.
4639         (Sized_incremental_binary::setup_readers): New function.
4640         (Sized_incremental_binary::has_incremental_info_): New data member.
4641         (Sized_incremental_binary::inputs_reader_): New data member.
4642         (Sized_incremental_binary::symtab_reader_): New data member.
4643         (Sized_incremental_binary::relocs_reader_): New data member.
4644         (Sized_incremental_binary::got_plt_reader_): New data member.
4645         (Sized_incremental_binary::current_input_file_): New data member.
4646
4647 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4648
4649         PR gold/12640
4650         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4651         violation.
4652
4653 2011-03-30  Cary Coutant  <ccoutant@google.com>
4654
4655         * archive.cc (Archive::include_member): Adjust call to report_object.
4656         (Add_archive_symbols::run): Add script_info to call to
4657         report_archive_begin.
4658         (Lib_group::include_member): Adjust call to report_object.
4659         (Add_lib_group_symbols::run): Adjust call to report_object.
4660         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4661         blocks.  Add object count for script input files.
4662         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4663         script_info parameter; change all callers.
4664         (Incremental_inputs::report_object): Add script_info parameter;
4665         change all callers.
4666         (Incremental_inputs::report_script): Store backpointer to
4667         incremental info entry.
4668         (Output_section_incremental_inputs::set_final_data_size): Record
4669         additional information for scripts.
4670         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4671         * incremental.h (Incremental_script_entry::add_object): New function.
4672         (Incremental_script_entry::get_object_count): New function.
4673         (Incremental_script_entry::get_object): New function.
4674         (Incremental_script_entry::objects_): New data member; adjust
4675         constructor.
4676         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4677         (Incremental_inputs::report_object): Add script_info parameter.
4678         (Incremental_inputs_reader::get_object_count): New function.
4679         (Incremental_inputs_reader::get_object_offset): New function.
4680         * options.cc (Input_arguments::add_file): Return reference to
4681         new input argument.
4682         * options.h (Input_argument::set_script_info): New function.
4683         (Input_argument::script_info): New function.
4684         (Input_argument::script_info_): New data member; adjust all
4685         constructors.
4686         (Input_file_group::add_file): Return reference to new input argument.
4687         (Input_file_lib::add_file): Likewise.
4688         (Input_arguments::add_file): Likewise.
4689         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4690         * script.cc (Parser_closure::Parser_closure): Add script_info
4691         parameter; adjust all callers.
4692         (Parser_closure::script_info): New function.
4693         (Parser_closure::script_info_): New data member.
4694         (read_input_script): Report scripts earlier to incremental info.
4695         (script_add_file): Set script_info in Input_argument.
4696         (script_add_library): Likewise.
4697         * script.h (Script_options::Script_info): Rewrite class.
4698
4699 2011-03-29  Cary Coutant  <ccoutant@google.com>
4700
4701         * archive.cc (Library_base::should_include_member): Move
4702         method here from class Archive.
4703         (Archive::Archive): Initialize base class.
4704         (Archive::should_include_member): Move to base class.
4705         (Archive::do_for_all_unused_symbols): New function.
4706         (Add_archive_symbols::run): Remove redundant access to
4707         incremental_inputs.
4708         (Lib_group::Lib_group): Initialize base class.
4709         (Lib_group::do_filename): New function.
4710         (Lib_group::include_member): Pass pointer to Lib_group to
4711         report_object.
4712         (Lib_group::do_for_all_unused_symbols): New function.
4713         (Add_lib_group_symbols::run): Report archive information for
4714         incremental links.
4715         * archive.h (class Library_base): New base class.
4716         (class Archive): Derive from Library_base.
4717         (Archive::filename): Move to base class.
4718         (Archive::set_incremental_info): Likewise.
4719         (Archive::incremental_info): Likewise.
4720         (Archive::Should_include): Likewise.
4721         (Archive::should_include_member): Likewise.
4722         (Archive::Armap_entry): Remove.
4723         (Archive::Unused_symbol_iterator): Remove.
4724         (Archive::unused_symbols_begin): Remove.
4725         (Archive::unused_symbols_end): Remove.
4726         (Archive::do_filename): New function.
4727         (Archive::do_get_mtime): New function.
4728         (Archive::do_for_all_unused_symbols): New function.
4729         (Archive::task_): Move to base class.
4730         (Archive::incremental_info_): Likewise.
4731         (class Lib_group): Derive from Library_base.
4732         (Lib_group::do_filename): New function.
4733         (Lib_group::do_get_mtime): New function.
4734         (Lib_group::do_for_all_unused_symbols): New function.
4735         (Lib_group::task_): Move to base class.
4736         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4737         function.
4738         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4739         function.
4740         * incremental.cc (Incremental_inputs::report_archive_begin):
4741         Use Library_base; call library's get_mtime; add incremental inputs
4742         entry before members.
4743         (class Unused_symbol_visitor): New class.
4744         (Incremental_inputs::report_archive_end): Use Library_base; use
4745         visitor class to record unused symbols; don't add incremental inputs
4746         entry after members.
4747         (Incremental_inputs::report_object): Use Library_base.
4748         * incremental.h
4749         (Incremental_archive_entry::Incremental_archive_entry): Remove
4750         unused Archive parameter.
4751         (Incremental_inputs::report_archive_begin): Use Library_base.
4752         (Incremental_inputs::report_archive_end): Likewise.
4753         (Incremental_inputs::report_object): Likewise.
4754         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4755         function.
4756         * object.h (Object::for_all_global_symbols): New function.
4757         (Object::do_for_all_global_symbols): New function.
4758         (Sized_relobj::do_for_all_global_symbols): New function.
4759         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4760         function.
4761         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4762         function.
4763
4764 2011-03-27  Ian Lance Taylor  <iant@google.com>
4765
4766         * archive.cc (Archive::interpret_header): Return -1 if something
4767         goes wrong.  Change callers accordingly.
4768
4769 2011-03-25  Cary Coutant  <ccoutant@google.com>
4770
4771         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4772         * testsuite/Makefile.in: Regenerate.
4773
4774 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4775
4776         * plugin.cc (get_view): New.
4777         (Plugin::load): Pass get_view to the plugin.
4778         (Plugin_manager::get_view): New.
4779
4780 2011-03-21  Ian Lance Taylor  <iant@google.com>
4781
4782         * testsuite/final_layout.sh: Rewrite to not use dc.
4783         * testsuite/relro_test.sh: Fail if dc is not present.
4784
4785 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4786
4787         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4788         Change == to -eq.
4789         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4790         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4791         Change == to -eq.
4792         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4793         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4794
4795 2011-03-14  Ian Lance Taylor  <iant@google.com>
4796
4797         * script-sections.cc (Sort_output_sections::script_compare):
4798         Rename from is_before, change return type.
4799         (Sort_output_sections::operator()): Adjust accordingly.
4800
4801 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4802
4803         PR gold/12572
4804         * testsuite/odr_violation2.cc: Add comment to make all error line
4805         numbers double digits.
4806         * testsuite/debug_msg.sh: Adjust expected errors.
4807
4808 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4809
4810         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4811         but mark earlier ones as non-canonical
4812         (offset_to_iterator): Update search target and example
4813         (do_addr2line): Return extra lines in a vector*
4814         (format_file_lineno): Extract from do_addr2line
4815         (one_addr2line): Add vector* out-param
4816         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4817         when a lineno entry appeared last for its instruction
4818         (Dwarf_line_info): Add vector* out-param
4819         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4820         * symtab.cc (Odr_violation_compare): Include the lineno in the
4821         comparison again.
4822         (linenos_from_loc): New. Combine the canonical line for an
4823         address with its other lines.
4824         (True_if_intersect): New. Helper functor to make
4825         std::set_intersection a query.
4826         (detect_odr_violations): Compare sets of lines instead of just
4827         one line for each function. This became less deterministic, but
4828         has fewer false positives.
4829         * symtab.h: Declarations.
4830         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4831         mix an optimized and non-optimized object in the same binary
4832         (odr_violation2.so): Same.
4833         * testsuite/Makefile.in: Regenerate from Makefile.am.
4834         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4835         * testsuite/debug_msg.sh: Update line numbers and add
4836         assertions.
4837         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4838         non-optimized context.
4839         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4840         isn't inlined, and use OdrDerived in an optimized context.
4841         * testsuite/odr_header1.h: Defines OdrDerived, where
4842         optimization will change the
4843         first-instruction-in-the-destructor's file and line number.
4844         * testsuite/odr_header2.h: Defines OdrBase.
4845
4846 2011-03-09  Ian Lance Taylor  <iant@google.com>
4847
4848         * fileread.cc (File_read::clear_views): Don't delete the whole
4849         file view.
4850
4851 2011-03-08  Ian Lance Taylor  <iant@google.com>
4852
4853         PR gold/12525
4854         * fileread.cc: #include <climits>.
4855         (GOLD_IOV_MAX): Define.
4856         (File_read::read_multiple): Limit number of entries by iov_max.
4857         * fileread.h (class File_read): Always set max_readv_entries to
4858         128.
4859
4860 2011-03-07  Ian Lance Taylor  <iant@google.com>
4861
4862         PR gold/12525
4863         * options.h (class General_options): Add -dy and -dn.
4864
4865 2011-03-02  Cary Coutant  <ccoutant@google.com>
4866
4867         * testsuite/script_test_9.t: Add TLS segment.
4868
4869 2011-03-02  Simon Baldwin  <simonb@google.com>
4870
4871         * configure.ac: Add check for gnu_indirect_function support in
4872         the toolchain building binutils.
4873         * configure: Rebuild.
4874
4875 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4876
4877         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4878         plugin only symbols.
4879         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4880         in plugin files as not needed in the symbol table.
4881
4882 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4883
4884         * output.cc (Output_section::add_input_section): Delay fill
4885         generation for section ordering.
4886
4887 2011-02-09  Ian Lance Taylor  <iant@google.com>
4888
4889         PR gold/12316
4890         * object.h (class Sized_relobj): Remove clear_local_symbols.
4891         * reloc.cc (Sized_relobj::do_relocate): Don't call
4892         clear_local_symbols.
4893
4894 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4895
4896         * plugin.cc (is_visible_from_outside): Return true for symbols
4897         in the -u option.
4898
4899 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4900
4901         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4902         filename.
4903
4904 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4905
4906         * icf.h (is_section_foldable_candidate): Change type of parameter
4907         to std::string.
4908         * icf.cc (Icf::find_identical_sections): Change type of local variable
4909         section_name to be std::string.
4910         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4911
4912 2011-01-25  Ian Lance Taylor  <iant@google.com>
4913
4914         * script.cc (script_add_extern): Rewrite to use
4915         add_symbol_reference.
4916
4917 2011-01-25  Doug Kwan  <dougkwan@google.com>
4918
4919         * icf.cc (get_section_contents): Always lock section's object.
4920
4921 2011-01-24  Ian Lance Taylor  <iant@google.com>
4922
4923         * options.h (class General_options): Accept
4924         --no-detect-odr-violations.
4925
4926 2011-01-24  Ian Lance Taylor  <iant@google.com>
4927
4928         * version.cc (version_string): Bump to 1.11.
4929
4930 2011-01-24  Ian Lance Taylor  <iant@google.com>
4931
4932         * plugin.cc (class Plugin_rescan): Define new class.
4933         (Plugin_manager::claim_file): Set any_claimed_.
4934         (Plugin_manager::save_archive): New function.
4935         (Plugin_manager::save_input_group): New function.
4936         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4937         necessary.
4938         (Plugin_manager::new_undefined_symbol): New function.
4939         (Plugin_manager::rescan): New function.
4940         (Plugin_manager::rescannable_defines): New function.
4941         (Plugin_manager::add_input_file): Set any_added_.
4942         * plugin.h (class Plugin_manager): define new fields rescannable_,
4943         undefined_symbols_, any_claimed_, and any_added_.  Declare
4944         Plugin_rescan as friend.  Declare new functions.
4945         (Plugin_manager::Rescannable): Define type.
4946         (Plugin_manager::Rescannable_list): Define type.
4947         (Plugin_manager::Undefined_symbol_list): Define type.
4948         (Plugin_manager::Plugin_manager): Initialize new fields.
4949         * archive.cc (Archive::defines_symbol): New function.
4950         (Add_archive_symbols::run): Pass archive to plugins if any.
4951         * archive.h (class Archive): Declare defines_symbol.
4952         * readsyms.cc (Input_group::~Input_group): New function.
4953         (Finish_group::run): Pass input_group to plugins if any.
4954         * readsyms.h (class Input_group): Declare destructor.
4955         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4956         any.
4957
4958 2011-01-10  Ian Lance Taylor  <iant@google.com>
4959
4960         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4961         section as relro.
4962         (Layout::set_segment_offsets): Reset increase_relro before calling
4963         set_section_addresses a second time.
4964
4965 2011-01-04  Cary Coutant  <ccoutant@google.com>
4966
4967         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4968         sections before NOBITS sections.
4969
4970 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4971
4972         * version.cc (print_version): Update copyright to 2011.
4973
4974 2010-12-23  Cary Coutant  <ccoutant@google.com>
4975
4976         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4977         of OS to this->add.  Add OD parameter to second form of the function.
4978
4979 2010-12-20  Ian Lance Taylor  <iant@google.com>
4980
4981         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4982         second of two consecutive entries with same offset.
4983
4984 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4985
4986         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4987         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4988         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4989         to avoid unneeded links against $(LDADD).
4990         * testsuite/Makefile.in: Regenerate.
4991
4992 2010-12-15  Ian Lance Taylor  <iant@google.com>
4993
4994         PR gold/12324
4995         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4996         for R_X86_64_32 and R_X86_64_PC32.
4997         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4998         ver_matching_def_pic.o.
4999         (ver_matching_def_pic.o): New target.
5000
5001 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5002
5003         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5004         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5005         Move definition before File_read::View member definitions.
5006         (File_read::View::~View): Initialize and hold lock before
5007         updating current_mapped_bytes.
5008
5009 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5010
5011         * dwarf_reader.cc: Remove outdated comment.
5012         * gold-threads.cc: Fix typo in error message.
5013         * archive.cc: Fix typos in comments.
5014         * archive.h: Likewise.
5015         * arm-reloc-property.cc: Likewise.
5016         * arm-reloc-property.h: Likewise.
5017         * arm-reloc.def: Likewise.
5018         * arm.cc: Likewise.
5019         * attributes.h: Likewise.
5020         * cref.cc: Likewise.
5021         * ehframe.cc: Likewise.
5022         * fileread.h: Likewise.
5023         * gold.h: Likewise.
5024         * i386.cc: Likewise.
5025         * icf.cc: Likewise.
5026         * incremental.h: Likewise.
5027         * int_encoding.cc: Likewise.
5028         * layout.h: Likewise.
5029         * main.cc: Likewise.
5030         * merge.h: Likewise.
5031         * object.cc: Likewise.
5032         * object.h: Likewise.
5033         * options.cc: Likewise.
5034         * readsyms.cc: Likewise.
5035         * reduced_debug_output.cc: Likewise.
5036         * reloc.cc: Likewise.
5037         * script-sections.cc: Likewise.
5038         * sparc.cc: Likewise.
5039         * symtab.h: Likewise.
5040         * target-reloc.h: Likewise.
5041         * target.cc: Likewise.
5042         * target.h: Likewise.
5043         * timer.cc: Likewise.
5044         * timer.h: Likewise.
5045         * x86_64.cc: Likewise.
5046
5047 2010-12-09  Cary Coutant  <ccoutant@google.com>
5048
5049         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5050         stack.
5051         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5052         parameter; change all callers.
5053         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5054         * options.h (warn_execstack): New option.
5055
5056 2010-12-07  Doug Kwan  <dougkwan@google.com>
5057
5058         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5059         like function call relocations.
5060
5061 2010-12-07  Ian Lance Taylor  <iant@google.com>
5062
5063         * archive.cc (Archive::get_elf_object_for_member): Permit
5064         punconfigured to be NULL.
5065         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5066         (Archive::include_member): Pass NULL to get_elf_object_for_member
5067         if we searched for the archive and this is the first included
5068         object.
5069
5070 2010-12-01  Ian Lance Taylor  <iant@google.com>
5071
5072         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5073         track_relocs_type_ field.
5074         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5075         Set track_relocs_type_.
5076         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5077         contents when using RELA relocs.
5078         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5079         reloc_map_.
5080         * reloc.cc (Track_relocs::next_addend): New function.
5081         * reloc.h (class Track_relocs): Declare next_addend.
5082
5083 2010-12-01  Ian Lance Taylor  <iant@google.com>
5084
5085         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5086         virtual destructor.
5087
5088 2010-12-01  Ian Lance Taylor  <iant@google.com>
5089
5090         * README: Update compilers known to work and fail.
5091
5092 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5093
5094         * configure.in: For --enable-gold, handle value `default' instead of
5095         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5096         not the default.
5097         * configure: Regenerate.
5098
5099 2010-11-18  Doug Kwan  <dougkwan@google.com>
5100
5101         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5102         and right_alignment to be zero.  Store result alignment only if it is
5103         greater than existing alignment.
5104
5105 2010-11-16  Cary Coutant  <ccoutant@google.com>
5106
5107         PR gold/12220
5108         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5109         Check for ".zdebug_line".
5110
5111 2010-11-16  Doug Kwan  <dougkwan@google.com>
5112             Cary Coutant  <ccoutant@google.com>
5113
5114         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5115         by reference; adjust all callers.
5116         * output.cc (Output_segment::set_section_addresses): Adjust references
5117         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5118         list is empty.
5119         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5120         end at page boundary.
5121
5122 2010-11-16  Cary Coutant  <ccoutant@google.com>
5123
5124         PR gold/12220
5125         * layout.cc (Layout::choose_output_section): Transform names of
5126         compressed sections even when using a script with a SECTIONS clause.
5127         (Layout::output_section_name): Remove code to transform
5128         compressed debug section names.
5129         * output.cc (Output_section::add_input_section): Use uncompressed
5130         section size when tracking input sections.
5131
5132 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5133
5134         * symtab.h (Symbol::NON_PIC_REF): Remove.
5135         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5136         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5137         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5138         (Symbol::use_plt_offset): Take a flags argument and pass it
5139         directly to needs_dynamic_reloc.  Restrict check for undefined
5140         weak symbols to function calls.
5141         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5142         (Target_arm::Scan::global): Use it.
5143         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5144         (Target_arm::Relocate::relocate): Likewise.
5145         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5146         parameter with an r_type parameter.  Use get_reference_flags
5147         to get the flags.
5148         (Target_arm::Relocate::relocate): Update accordingly.
5149         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5150         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5151         (Target_i386::Scan::global): Likewise.
5152         (Target_i386::Relocate::relocate): Likewise.
5153         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5154         parameter with an r_type parameter.  Use get_reference_flags
5155         to get the flags.
5156         (Target_i386::Relocate::relocate): Update accordingly.
5157         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5158         (Target_powerpc::Scan::global): Use it.
5159         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5160         (Target_powerpc::Relocate::relocate): Likewise.
5161         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5162         (Target_sparc::Scan::global): Use it.
5163         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5164         (Target_sparc::Relocate::relocate): Likewise.
5165         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5166         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5167         (Target_x86_64::Scan::global): Likewise.
5168         (Target_x86_64::Relocate::relocate): Likewise.
5169
5170 2010-11-08  Doug Kwan  <dougkwan@google.com>
5171             Cary Coutant  <ccoutant@google.com>
5172
5173         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5174         (Arm_exidx_merge_section::section_contents_): New data member.
5175         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5176         (Arm_input_section::~Arm_input_section): De-allocate memory.
5177         (Arm_input_section::original_contents_): New data member.
5178         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5179         in parameters instead of calling Object::section_contents without
5180         locking.
5181         (Arm_output_section::group_section): New parameter TASK.  Pass it
5182         to callees that need locking objects.
5183         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5184         to lock EXIDX input sections.  Fix a formatting issue.  Call
5185         Arm_exidx_merged_section::build_contents to create merged section
5186         contents.
5187         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5188         to lock object of stub table owner.
5189         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5190         TEXT_SIZE to initialize data member TEXT_SIZE_.
5191         (Arm_exidx_input_section::addralign): Fix typo in comment.
5192         (Arm_exidx_input_section::text_size): New method.
5193         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5194         that require locking objects.  Lock objects before scanning for stubs
5195         and updating local symbols.
5196         (Arm_input_section<big_endian>::init): Copy contents of original
5197         input section.
5198         (Arm_input_section<big_endian>::do_write): Use saved contents of
5199         original input section instead of calling Object::section_contents
5200         without locking.
5201         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5202         size without calling Object::section_size().
5203         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5204         for size.  Allocate a buffer for merged EXIDX entries.
5205         (Arm_exidx_merged_section::build_contents): New method.
5206         (Arm_exidx_merged_section::do_write): Move merge section contents
5207         building code to Arm_exidx_merged_section::build_contetns.  Write
5208         out contetns in buffer instead of building it on the fly.
5209         (Arm_relobj::make_exidx_input_section): Also pass text section size
5210         to Arm_exidx_input_section constructor.
5211         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5212         (Arm_dynobj::do_read_symbols): Fix memory leak.
5213         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5214         * target.h: (class Task): Add forward declaration.
5215         (Target::relax): Add new parameter TASK and pass it to
5216         Target::do_relax().
5217         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5218
5219 2010-11-05  Cary Coutant  <ccoutant@google.com>
5220
5221         PR gold/10708
5222         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5223         object when reading from the file.
5224         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5225         second layout pass.
5226         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5227         when reading section contents.
5228         (get_section_contents): Likewise.
5229         (icf::find_identical_sections): Likewise.
5230         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5231         object when reading from the file.
5232         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5233         the object when doing deferred section layout.
5234
5235 2010-11-03  Nick Clifton  <nickc@redhat.com>
5236
5237         PR gold/12001
5238         * script.h (class Symbol_assignment: name): New member.  Returns
5239         the name of the symbol.
5240         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5241         Returns true if the given symbol name is on the list of
5242         assignments wating to be processed.
5243         * archive.cc (should_incldue_member): If the symbol is undefined,
5244         check to see if it is on the list of symbols pending assignment.
5245
5246 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5247
5248         * script-sections.cc (Script_sections::find_memory_region): Check
5249         for a NULL output section pointer.
5250
5251 2010-10-29  Doug Kwan  <dougkwan@google.com>
5252
5253         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5254         Output_section::add_relaxed_input_section.
5255         * output.cc (Output_section::add_relaxed_input_section): Add new
5256         arguments LAYOUT and NAME.  Set section order index.
5257         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5258         Copy section order index.
5259         * output.h (Output_section::add_relaxed_input_section): Add new
5260         arguments LAYOUT and NAME.
5261
5262 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5263
5264         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5265         NATIVE_OR_CROSS_LINKER.
5266         * testsuite/Makefile.in: Regenerate.
5267
5268 2010-10-20  Doug Kwan  <dougkwan@google.com>
5269
5270         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5271         without SHF_LINK_ORDER flags.
5272         * layout.cc (Layout::choose_output_section): Do not filter
5273         SHF_LINK_ORDER flag in a relocatable link.
5274
5275 2010-10-17  Cary Coutant  <ccoutant@google.com>
5276
5277         * output.h (Output_segment::set_section_addresses): Change function
5278         signature.  Update all callers.
5279         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5280         sections.
5281         (Output_segment::set_section_addresses): Align after last TLS
5282         section.  Add padding before last relro section instead of after.
5283
5284 2010-10-17  Doug Kwan  <dougkwan@google.com>
5285
5286         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5287         GOT output section to be writable.
5288
5289 2010-10-14  Cary Coutant  <ccoutant@google.com>
5290
5291         * debug.h (DEBUG_INCREMENTAL): New flag.
5292         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5293         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5294         mode.
5295         * incremental.cc (report_command_line): Ignore all forms of
5296         --incremental.
5297         * layout.cc (Layout::Layout): Check parameters for incremental link
5298         mode.
5299         * options.cc (General_options::parse_incremental): New function.
5300         (General_options::parse_no_incremental): New function.
5301         (General_options::parse_incremental_full): New function.
5302         (General_options::parse_incremental_update): New function.
5303         (General_options::incremental_mode_): New data member.
5304         (General_options::finalize): Check incremental_mode_.
5305         * options.h (General_options): Update help text for --incremental.
5306         Add --no-incremental, --incremental-full, --incremental-update.
5307         (General_options::Incremental_mode): New enum type.
5308         (General_options::incremental_mode): New function.
5309         (General_options::incremental_mode_): New data member.
5310         * parameters.cc (Parameters::incremental_mode_): New data member.
5311         (Parameters::set_options): Set incremental_mode_.
5312         (Parameters::set_incremental_full): New function.
5313         (Parameters::incremental): New function.
5314         (Parameters::incremental_update): New function.
5315         (set_parameters_incremental_full): New function.
5316         * parameters.h (Parameters::set_incremental_full): New function.
5317         (Parameters::incremental): New function.
5318         (Parameters::incremental_update): New function.
5319         (Parameters::incremental_mode_): New data member.
5320         (set_parameters_incremental_full): New function.
5321         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5322         incremental link mode.
5323         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5324         (Sized_relobj::do_relocate_sections): Likewise.
5325         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5326         option.
5327         * testsuite/Makefile.in: Regenerate.
5328         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5329
5330 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5331
5332         * script-sections.h (class Script_sections): Make
5333         Sections_elements typedef public.
5334         * script-sections.cc (class Sort_output_sections): Add elements_
5335         field.  Add constructor which sets it; change all callers.
5336         (Sort_output_sections::is_before): New function.
5337         (Sort_output_sections::operator()): Call is_before.
5338         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5339         conditional.
5340         * testsuite/script_test_10.sh: New test. Test script section
5341         order.
5342         * testsuite/script_test_10.t: Likewise.
5343         * testsuite/script_test_10.s: Likewise.
5344         * testsuite/Makefile.am: Wrap the cross linker tests and the
5345         common tests into NATIVE_OR_CROSS_LINKER.
5346         (check_SCRIPTS): Add script_test_10.sh.
5347         (check_DATA): Add script_test_10.stdout.
5348         (script_test_10.o, script_test_10): New targets.
5349         (script_test_10.stdout): New target.
5350         * configure, testsuite/Makefile.in: Regenerate.
5351
5352 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5353
5354         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5355         error for the deprecated relocations.
5356         (Target_arm::Scan::global): Likewise.
5357         (Target_arm::Relocate::relocate): Likewise.
5358
5359 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5360
5361         * fileread.cc (Input_file::find_file): Initialize *found_name
5362         and *namep when using the fallback search for case 4.
5363
5364 2010-10-11  Cary Coutant  <ccoutant@google.com>
5365
5366         * options.h (class General_options): Redefine -z lazy as an alias for
5367         the negation of -z now.
5368
5369 2010-10-11  Ian Lance Taylor  <iant@google.com>
5370
5371         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5372         binding.
5373
5374 2010-10-06  Nick Clifton  <nickc@redhat.com>
5375
5376         * script-sections.cc(class Memory_region): Remove
5377         current_lma_offset_ field.  Rename current_vma_offset_ to
5378         current_offset_.  Add last_section_ field.
5379         (Memory_region::get_current_vma_address): Rename to
5380         get_current_address.
5381         (Memory_region::get_current_lma_address): Delete.
5382         (Memory_region::increment_vma_offset): Rename to
5383         increment_offset.
5384         (Memory_region::increment_lma_offset): Delete.
5385         (Memory_region::attributes_compatible): New method.  Returns
5386         true if the provided section is compatible with the region.
5387         (Memory_region::get_last_section): New method.  Returns the last
5388         section to use the region.
5389         (Memory_region::set_last_section): New method.  Stores the last
5390         section to use the region.
5391         (Script_sections::block_in_region): New method.  Returns true if
5392         a block of memory is contained within a region.
5393         (Script_sections::find_memory_region): New method.  Locates a
5394         memory region to be used to set a VMA or LMA address.
5395         (Output_section_definition::set_section_addresses): Add code to
5396         check for addresses set by memory regions.
5397         (Output_segment::set_section_addresses): Remove memory region
5398         walking code.
5399         (Script_sections::create_segment): Add a warning if a header
5400         segment is created outside of any region.
5401         * script-sections.h (class Script_sections): Add prototypes for
5402         find_memory_region and block_in_region methods.
5403         * testsuite/memory_test.s: Use .long instead of .word.
5404         * testsuite/memory_test.t: Add some more output sections.
5405         * testsuite/memory_test.sh: Update expected output.
5406
5407 2010-10-02  Doug Kwan  <dougkwan@google.com>
5408
5409         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5410         defintion to symtab.h
5411         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5412         declaration to defintion.
5413
5414 2010-10-01  Nick Clifton  <nickc@redhat.com>
5415
5416         * expression.cc (eval): Replace dummy argument with NULL.
5417         (eval_maybe_dot): Check for a NULL result section pointer.
5418         (Symbol_expression::value): Likewise.
5419         (Dot_expression::value): Likewise.
5420         (BINARY_EXPRESSION): Likewise.
5421         (Max_expression::value): Likewise.
5422         (Min_expression::value): Likewise.
5423         (Absolute_expression::value): Likewise.
5424         (Addr_expression::value_from_output_section): Likewise.
5425         (Loaddddr_expression::value_from_output_section): Likewise.
5426         (Segment_start_expression::value): Likewise.
5427         * script-sections.cc
5428         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5429         argument with NULL.
5430         (Sections_elememt_dot_assignment::set_section_addresses):
5431         Likewise.
5432         (Output_data_expression::do_write_to_buffer): Likewise.
5433         (Output_section_definition::finalize_symbols): Likewise.
5434         (Output_section_definition::set_section_addresses): Likewise.
5435
5436 2010-09-30  Doug Kwan  <dougkwan@google.com>
5437
5438         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5439
5440 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5441
5442         * target.h (Target::can_icf_inline_merge_sections): New virtual
5443         function.
5444         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5445         virtual function.
5446         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5447         virtual function.
5448         * icf.cc (get_section_contents): Inline merge sections only when
5449         target allows it.
5450
5451 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5452
5453         * configure: Regenerate.
5454
5455 2010-09-17  Ian Lance Taylor  <iant@google.com>
5456
5457         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5458         * testsuite/Makefile.am (memory_test.o): New target.
5459         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5460         memory_test.t.
5461         * testsuite/Makefile.in: Rebuild.
5462
5463 2010-09-17  Doug Kwan  <dougkwan@google.com>
5464
5465         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5466         defintion if relocation uses GOT entries of the symbol.
5467         * testsuite/icf_safe_test.sh: Fix test.
5468         * testsuite/icf_safe_so_test.sh: Fix test.
5469
5470 2010-09-16  Cary Coutant  <ccoutant@google.com>
5471
5472         * script_sections.cc (class Memory_region): Remove "NULL" from
5473         vector initializations.
5474
5475 2010-09-15  Cary Coutant  <ccoutant@google.com>
5476
5477         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5478         Resolve forwarding symbols.
5479
5480 2010-09-15  Doug Kwan  <dougkwan@google.com>
5481
5482         * gold/testsuite/script_test_3.t: Add ARM special sections.
5483         * gold/testsuite/script_test_4.t: Same.
5484         * gold/testsuite/script_test_5.t: Same.
5485         * gold/testsuite/script_test_6.t: Same.
5486         * gold/testsuite/script_test_7.t: Same.
5487         * gold/testsuite/script_test_7.t: Same.
5488         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5489
5490 2010-09-14  Cary Coutant  <ccoutant@google.com>
5491
5492         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5493         (Target_x86_64::Relocate::relocate_tls): Replace check for
5494         saw_tls_block_reloc_ with test for executable section.
5495
5496 2010-09-12  Cary Coutant  <ccoutant@google.com>
5497
5498         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5499         position-independent executables to shared libraries need dynamic
5500         relocations.
5501         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5502         position-independent executables.
5503         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5504         * testsuite/Makefile.in: Regenerate.
5505
5506 2010-09-10  Nick Clifton  <nickc@redhat.com>
5507
5508         PR gold/11997
5509         * testsuite/memory_test.t: Discard any sections that are not
5510         needed.
5511
5512 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5513
5514         PR gold/11996
5515         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5516         "This::" to work around a bug in gcc 4.2.
5517
5518         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5519
5520 2010-09-09  Rafael Espindola  <espindola@google.com>
5521
5522         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5523         sections with different PF_X flags in the same segment.
5524         (Layout::find_first_load_seg): Search all segments to find the first
5525         one.
5526         * options.h (rosegment): New.
5527
5528 2010-09-08  Rafael Espindola  <espindola@google.com>
5529
5530         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5531
5532 2010-09-08  Doug Kwan  <dougkwan@google.com>
5533
5534         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5535         (Arm_relobj::do_relocate_sections): Add new parameter for output
5536         file to match the parent.
5537         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5538         of local symbols instead of input values.  Update code to track
5539         changes in gold::relocate_section.
5540         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5541         (Sized_relobj::compute_final_local_value_internal): New methods.
5542         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5543         body into private version of Sized_relobj::compute_final_local_value.
5544         Call the inline method.
5545         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5546         merged symbol value if there is one.
5547         (Symbol_value::has_output_value): New method defintiion.
5548         (Sized_relobj::Compute_final_local_value_status): New enum type.
5549         (Sized_relobj::compute_final_local_value): New methods.
5550         (Sized_relobj::compute_final_local_value_internal): New methods.
5551         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5552         and arm_cortex_a8.sh.
5553         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5554         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5555         New tests.
5556         * Makefile.in: Regenerate.
5557         * testsuite/arm_bl_out_of_range.s: Update test.
5558         * testsuite/thumb_bl_out_of_range.s: Ditto.
5559         * testsuite/thumb_blx_out_of_range.s: Ditto.
5560         * testsuite/arm_branch_out_of_range.sh: New file.
5561         * testsuite/arm_cortex_a8.sh: Ditto.
5562         * testsuite/arm_cortex_a8_b.s: Ditto.
5563         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5564         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5565         * testsuite/arm_cortex_a8_bl.s: Ditto.
5566         * testsuite/arm_cortex_a8_blx.s: Ditto.
5567         * testsuite/arm_cortex_a8_local.s: Ditto.
5568         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5569         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5570
5571 2010-09-08  Rafael Espindola  <espindola@google.com>
5572
5573         * Makefile.am (memory_test.stdout): Run readelf with -W.
5574         * Makefile.in: Regenerate.
5575         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5576         64 bit output.
5577
5578 2010-09-08  Rafael Espindola  <espindola@google.com>
5579
5580         * script-sections.cc (Script_sections::add_memory_region): Convert
5581         field precision to int.
5582         * script.cc (script_set_section_region, script_set_section_region):
5583         Convert field precision to int.
5584
5585 2010-09-08  Rafael Espindola  <espindola@google.com>
5586
5587         * arm.cc (do_finalize_sections): Create the __exidx_start and
5588         __exdix_end symbols even when the section is missing.
5589
5590 2010-09-08  Nick Clifton  <nickc@redhat.com>
5591
5592         * README: Remove claim that MEMORY is not supported.
5593         * expression.cc (script_exp_function_origin)
5594         (script_exp_function_length): Move from here to ...
5595         * script.cc: ... here.
5596         (script_set_section_region, script_add_memory)
5597         (script_parse_memory_attr, script_include_directive): New
5598         functions.
5599         * script-sections.cc
5600         (class Memory_region): New class.
5601         (class Output_section_definition): Add set_memory_region,
5602         set_section_vma, set_section_lma and get_section_name methods.
5603         (class Script_Sections): Add add_memory_region,
5604         find_memory_region, find_memory_region_origin,
5605         find_memory_region_length and set_memory_region methods.
5606         Have set_section_addresses method walk the list of set memory
5607         regions.
5608         Extend the print methos to display memory regions.
5609         * script-sections.h: Add prototypes for new methods.
5610         Add enum for MEMORY region attributes.
5611         * yyscript.y: Add support for parsing MEMORY regions.
5612         * script-c.h: Add prototypes for new functions.
5613         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5614         * testsuite/Makefile.in: Regenerate.
5615         * testsuite/memory_test.sh: New script.
5616         * testsuite/memory_test.s: New assembler source file.
5617         * testsuite/memory_test.t: New linker script.
5618
5619 2010-08-27  Doug Kwan  <dougkwan@google.com>
5620
5621         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5622         reference override an existing dynamic weak reference.
5623         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5624         * testsuite/Makefile.in: Regenerate.
5625         * testsuite/dyn_weak_ref.sh: New file.
5626         * testsuite/dyn_weak_ref_1.c: Ditto.
5627         * testsuite/dyn_weak_ref_2.c: Ditto.
5628
5629 2010-08-27  Ian Lance Taylor  <iant@google.com>
5630
5631         * incremental.h (class Incremental_input_entry): Add virtual
5632         destructor.
5633
5634 2010-08-27  Ian Lance Taylor  <iant@google.com>
5635
5636         * testsuite/start_lib_test_3.c: Mark t3 as used.
5637
5638 2010-08-27  Nick Clifton  <nickc@redhat.com>
5639
5640         * options.cc (version_script): Fix small typo in previous
5641         whitespace tidyup.
5642
5643 2010-08-25  Nick Clifton  <nickc@redhat.com>
5644
5645         * archive.cc: Formatting fixes: Remove whitespace between
5646         typename and following asterisk.  Remove whitespace between
5647         function name and opening parenthesis.
5648         * archive.h: Likewise.
5649         * arm.cc: Likewise.
5650         * attributes.cc: Likewise.
5651         * attributes.h: Likewise.
5652         * common.cc: Likewise.
5653         * copy-relocs.cc: Likewise.
5654         * dirsearch.h: Likewise.
5655         * dynobj.cc: Likewise.
5656         * ehframe.cc: Likewise.
5657         * ehframe.h: Likewise.
5658         * expression.cc: Likewise.
5659         * fileread.cc: Likewise.
5660         * fileread.h: Likewise.
5661         * gc.h: Likewise.
5662         * gold-threads.cc: Likewise.
5663         * gold.cc: Likewise.
5664         * i386.cc: Likewise.
5665         * icf.h: Likewise.
5666         * incremental-dump.cc: Likewise.
5667         * incremental.cc: Likewise.
5668         * layout.cc: Likewise.
5669         * layout.h: Likewise.
5670         * main.cc: Likewise.
5671         * merge.cc: Likewise.
5672         * merge.h: Likewise.
5673         * object.cc: Likewise.
5674         * object.h: Likewise.
5675         * options.cc: Likewise.
5676         * options.h: Likewise.
5677         * output.cc: Likewise.
5678         * output.h: Likewise.
5679         * plugin.cc: Likewise.
5680         * plugin.h: Likewise.
5681         * powerpc.cc: Likewise.
5682         * reloc.cc: Likewise.
5683         * script-c.h: Likewise.
5684         * script-sections.cc: Likewise.
5685         * script.cc: Likewise.
5686         * stringpool.cc: Likewise.
5687         * symtab.cc: Likewise.
5688         * symtab.h: Likewise.
5689         * target.cc: Likewise.
5690         * timer.cc: Likewise.
5691         * timer.h: Likewise.
5692         * version.cc: Likewise.
5693         * x86_64.cc: Likewise.
5694
5695 2010-08-24  Nick Clifton  <nickc@redhat.com>
5696
5697         PR 11899
5698         * layout.cc (segment_precedes): Sort segments by their physical
5699         addresses, if they have been set.
5700
5701 2010-08-23  Cary Coutant  <ccoutant@google.com>
5702
5703         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5704         symbols data.
5705         (Lib_group::include_member): Unlock object after deleting its
5706         symbols data.
5707         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5708         the bug fixed here.
5709
5710 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5711             Cary Coutant  <ccoutant@google.com>
5712
5713         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5714         constructor, and set_blocker.
5715         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5716         readsyms_blocker_.
5717         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5718         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5719         * testsuite/Makefile.am (start_lib_test): New test case.
5720         * testsuite/Makefile.in: Regenerate.
5721         * testsuite/start_lib_test_main.c: New file.
5722         * testsuite/start_lib_test_1.c: New file.
5723         * testsuite/start_lib_test_2.c: New file.
5724         * testsuite/start_lib_test_3.c: New file.
5725
5726 2010-08-19  Ian Lance Taylor  <iant@google.com>
5727
5728         * Makefile.in: Rebuild with automake 1.11.1.
5729         * aclocal.m4: Likewise.
5730         * testsuite/Makefile.in: Likewise.
5731
5732 2010-08-19  Ian Lance Taylor  <iant@google.com>
5733
5734         PR 10893
5735         * i386.cc (class Output_data_plt_i386): Update declarations.
5736         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5737         local_ifuncs_ fields.
5738         (Target_i386::do_plt_section_for_global): New function.
5739         (Target_i386::do_plt_section_for_local): New function.
5740         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5741         parameter; change all callers.  Initialize global_ifuncs_ and
5742         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5743         __rel_iplt_end.
5744         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5745         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5746         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5747         symbols.
5748         (Target_i386::make_plt_section): New function, broken out of
5749         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5750         (Target_i386::make_plt_entry): Call make_plt_section.
5751         (Target_i386::make_local_ifunc_plt_entry): New function.
5752         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5753         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5754         R_386_IRELATIVE to switch.
5755         (Target_i386::Scan::global): Likewise.
5756         (Target_i386::Relocate::relocate): Likewise.
5757         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5758         switch.
5759         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5760         (Target_x86_64::do_plt_section_for_global): New function.
5761         (Target_x86_64::do_plt_section_for_local): New function.
5762         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5763         parameter; change all callers.  If doing a static link define
5764         __rela_iplt_start and __rela_iplt_end.
5765         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5766         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5767         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5768         to point to .plt.
5769         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5770         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5771         switch.
5772         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5773         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5774         R_X86_64_IRELATIVE to switch.
5775         (Target_x86_64::Scan::global): Likewise.
5776         (Target_x86_64::Relocate::relocate): Likewise.
5777         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5778         switch.
5779         * target.h (class Target): Add plt_section_for_global and
5780         plt_section_for_local functions.  Add do_plt_section_for_global
5781         and do_plt_section_for_local virtual functions.
5782         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5783         clarifying comments.
5784         (Symbol::use_plt_offset): Handle IFUNC symbol.
5785         * object.cc (Sized_relobj::Sized_relobj): Initialize
5786         local_plt_offsets_.
5787         (Sized_relobj::local_has_plt_offset): New function.
5788         (Sized_relobj::local_plt_offset): New function.
5789         (Sized_relobj::set_local_plt_offset): New function.
5790         (Sized_relobj::do_count): Handle IFUNC symbol.
5791         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5792         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5793         is_ifunc_symbol functions.
5794         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5795         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5796         local_plt_offsets_ field.
5797         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5798         * output.h (class Output_section_data): Add non-const
5799         output_section function.
5800         (class Output_data_got): Update declarations.
5801         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5802         Add use_plt_offset parameter to global and local constructors.
5803         Change all callers.  Change local_sym_index_ field to 31 bits.
5804         Change GSYM_CODE and CONSTANT_CODE accordingly.
5805         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5806         doing a static link don't set sh_link field.
5807         (Output_data_got::Got_entry::write): Use PLT offset if
5808         appropriate.
5809         (Output_data_got::add_global_plt): New function.
5810         (Output_data_got::add_local_plt): New function.
5811         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5812         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5813         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5814         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5815         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5816         IFUNC conditional.
5817         * testsuite/ifunc-sel.h: New file.
5818         * testsuite/ifuncmain1.c: New file.
5819         * testsuite/ifuncmain1vis.c: New file.
5820         * testsuite/ifuncmod1.c: New file.
5821         * testsuite/ifuncdep2.c: New file.
5822         * testsuite/ifuncmain2.c: New file.
5823         * testsuite/ifuncmain3.c: New file.
5824         * testsuite/ifuncmod3.c: New file.
5825         * testsuite/ifuncmain4.c: New file.
5826         * testsuite/ifuncmain5.c: New file.
5827         * testsuite/ifuncmod5.c: New file.
5828         * testsuite/ifuncmain6pie.c: New file.
5829         * testsuite/ifuncmod6.c: New file.
5830         * testsuite/ifuncmain7.c: New file.
5831         * configure, testsuite/Makefile.in: Rebuild.
5832
5833 2010-08-18  Ian Lance Taylor  <iant@google.com>
5834
5835         * incremental.cc
5836         (Output_section_incremental_inputs::write_input_files): Add cast
5837         to avoid signed/unsigned comparison warning.
5838         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5839
5840 2010-08-12  Cary Coutant  <ccoutant@google.com>
5841
5842         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5843
5844 2010-08-13  Ian Lance Taylor  <iant@google.com>
5845
5846         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5847
5848 2010-08-12  Cary Coutant  <ccoutant@google.com>
5849             Doug Kwan  <dougkwan@google.com>
5850
5851         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5852         defintion overrides non-weak undef, remember that the original undef
5853         is not weak.
5854         * symtab.cc (Symbol_table::sized_write_global): For undef without
5855         an original weak binding, set binding to global in output.
5856         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5857         * testsuite/Makefile.in: Regenerate.
5858         * testsuite/strong_ref_weak_def.sh: New file.
5859         * testsuite/strong_ref_weak_def_1.c: Ditto.
5860         * testsuite/strong_ref_weak_def_2.c: Ditto.
5861
5862 2010-08-12  Cary Coutant  <ccoutant@google.com>
5863
5864         * testsuite/incremental_test.sh: Rewrite.
5865         * testsuite/incremental_test_1.c: Rewrite.
5866         * testsuite/incremental_test_2.c: Rewrite.
5867
5868 2010-08-12  Cary Coutant  <ccoutant@google.com>
5869
5870         * arm.cc (Target_arm::got_size): Add const.
5871         (Target_arm::got_entry_count): New function.
5872         (Target_arm::plt_entry_count): New function.
5873         (Target_arm::first_plt_entry_offset): New function.
5874         (Target_arm::plt_entry_size): New function.
5875         (Output_data_plt_arm::entry_count): New function.
5876         (Output_data_plt_arm::first_plt_entry_offset): New function.
5877         (Output_data_plt_arm::get_plt_entry_size): New function.
5878         * i386.cc (Target_i386::got_size): Add const.
5879         (Target_i386::got_entry_count): New function.
5880         (Target_i386::plt_entry_count): New function.
5881         (Target_i386::first_plt_entry_offset): New function.
5882         (Target_i386::plt_entry_size): New function.
5883         (Output_data_plt_i386::entry_count): New function.
5884         (Output_data_plt_i386::first_plt_entry_offset): New function.
5885         (Output_data_plt_i386::get_plt_entry_size): New function.
5886         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5887         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5888         * incremental.cc: Include target.h.
5889         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5890         parameter.  Adjust all callers.  Find incremental_got_plt section.
5891         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5892         section.
5893         (Output_section_incremental_inputs::set_final_data_size): Calculate
5894         size of incremental_got_plt section.
5895         (Output_section_incremental_inputs::do_write): Write the
5896         incremental_got_plt section.
5897         (Got_plt_view_info): New struct.
5898         (Local_got_offset_visitor): New class.
5899         (Global_got_offset_visitor): New class.
5900         (Global_symbol_visitor_got_plt): New class.
5901         (Output_section_incremental_inputs::write_got_plt): New function.
5902         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5903         Add parameter.  Adjust all callers.
5904         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5905         (Incremental_inputs::got_plt_section): New function.
5906         (Incremental_inputs::got_plt_section_): New data member.
5907         (Incremental_got_plt_reader): New class.
5908         * layout.cc (Layout::create_incremental_info_sections): Add the
5909         incremental_got_plt section.
5910         * object.h (Got_offset_list::get_list): New function.
5911         (Got offset_list::for_all_got_offsets): New function.
5912         (Sized_relobj::local_got_offset_list): New function.
5913         * powerpc.cc (Target_powerpc::got_size): Add const.
5914         (Target_powerpc::got_entry_count): New function.
5915         (Target_powerpc::plt_entry_count): New function.
5916         (Target_powerpc::first_plt_entry_offset): New function.
5917         (Target_powerpc::plt_entry_size): New function.
5918         (Output_data_plt_powerpc::entry_count): New function.
5919         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5920         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5921         * sparc.cc (Target_sparc::got_size): Add const.
5922         (Target_sparc::got_entry_count): New function.
5923         (Target_sparc::plt_entry_count): New function.
5924         (Target_sparc::first_plt_entry_offset): New function.
5925         (Target_sparc::plt_entry_size): New function.
5926         (Output_data_plt_sparc::entry_count): New function.
5927         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5928         (Output_data_plt_sparc::get_plt_entry_size): New function.
5929         * symtab.h (Symbol::got_offset_list): New function.
5930         (Symbol_table::for_all_symbols): New function.
5931         * target.h (Sized_target::got_entry_count): New function.
5932         (Sized_target::plt_entry_count): New function.
5933         (Sized_target::plt_entry_size): New function.
5934         * x86_64.cc (Target_x86_64::got_size): Add const.
5935         (Target_x86_64::got_entry_count): New function.
5936         (Target_x86_64::plt_entry_count): New function.
5937         (Target_x86_64::first_plt_entry_offset): New function.
5938         (Target_x86_64::plt_entry_size): New function.
5939         (Output_data_plt_x86_64::entry_count): New function.
5940         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5941         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5942
5943 2010-08-12  Cary Coutant  <ccoutant@google.com>
5944
5945         * archive.cc: Include incremental.h.
5946         (Archive::Archive): Initialize incremental_info_.
5947         (Archive::include_member): Record archive members in incremental info.
5948         (Add_archive_symbols::run): Record begin and end of an archive in
5949         incremental info.
5950         (Lib_group::include_member): Record objects in incremental info.
5951         * archive.h (Incremental_archive_entry): Forward declaration.
5952         (Archive::set_incremental_info): New member function.
5953         (Archive::incremental_info): New member function.
5954         (Archive::Unused_symbol_iterator): New class.
5955         (Archive::unused_symbols_begin): New member function.
5956         (Archive::unused_symbols_end): New member function.
5957         (Archive::incremental_info_): New data member.
5958         * incremental-dump.cc (find_input_containing_global): New function.
5959         (dump_incremental_inputs): Dump new incremental info sections.
5960         * incremental.cc: Include symtab.h.
5961         (Output_section_incremental_inputs): New class.
5962         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5963         new incremental info sections.
5964         (Sized_incremental_binary::do_check_inputs): Likewise.
5965         (Incremental_inputs::report_archive): Remove.
5966         (Incremental_inputs::report_archive_begin): New function.
5967         (Incremental_inputs::report_archive_end): New function.
5968         (Incremental_inputs::report_object): New function.
5969         (Incremental_inputs::finalize_inputs): Remove.
5970         (Incremental_inputs::report_input_section): New function.
5971         (Incremental_inputs::report_script): Rewrite.
5972         (Incremental_inputs::finalize): Do nothing but finalize string table.
5973         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5974         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5975         (Incremental_inputs::create_data_sections): New function.
5976         (Incremental_inputs::relocs_entsize): New function.
5977         (Output_section_incremental_inputs::set_final_data_size): New function.
5978         (Output_section_incremental_inputs::do_write): New function.
5979         (Output_section_incremental_inputs::write_header): New function.
5980         (Output_section_incremental_inputs::write_input_files): New function.
5981         (Output_section_incremental_inputs::write_info_blocks): New function.
5982         (Output_section_incremental_inputs::write_symtab): New function.
5983         * incremental.h (Incremental_script_entry): Forward declaration.
5984         (Incremental_object_entry): Forward declaration.
5985         (Incremental_archive_entry): Forward declaration.
5986         (Incremental_inputs): Forward declaration.
5987         (Incremental_inputs_header_data): Remove.
5988         (Incremental_inputs_header): Remove.
5989         (Incremental_inputs_header_write): Remove.
5990         (Incremental_inputs_entry_data): Remove.
5991         (Incremental_inputs_entry): Remove.
5992         (Incremental_inputs_entry_write): Remove.
5993         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5994         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5995         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5996         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5997         Likewise.
5998         (Incremental_input_entry): New class.
5999         (Incremental_script_entry): New class.
6000         (Incremental_object_entry): New class.
6001         (Incremental_archive_entry): New class.
6002         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6003         (Incremental_inputs::report_inputs): Remove.
6004         (Incremental_inputs::report_archive): Remove.
6005         (Incremental_inputs::report_archive_begin): New function.
6006         (Incremental_inputs::report_archive_end): New function.
6007         (Incremental_inputs::report_object): Change prototype.
6008         (Incremental_inputs::report_input_section): New function.
6009         (Incremental_inputs::report_script): Change prototype.
6010         (Incremental_inputs::get_reloc_count): New function.
6011         (Incremental_inputs::set_reloc_count): New function.
6012         (Incremental_inputs::create_data_sections): New function.
6013         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6014         (Incremental_inputs::inputs_section): New function.
6015         (Incremental_inputs::symtab_section): New function.
6016         (Incremental_inputs::relocs_section): New function.
6017         (Incremental_inputs::get_stringpool): Add const.
6018         (Incremental_inputs::command_line): Add const.
6019         (Incremental_inputs::inputs): Remove.
6020         (Incremental_inputs::command_line_key): New function.
6021         (Incremental_inputs::input_file_count): New function.
6022         (Incremental_inputs::input_files): New function.
6023         (Incremental_inputs::relocs_entsize): New function.
6024         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6025         (Incremental_inputs::finalize_inputs): Remove.
6026         (Incremental_inputs::Input_info): Remove.
6027         (Incremental_inputs::lock_): Remove.
6028         (Incremental_inputs::inputs_): Change type.
6029         (Incremental_inputs::inputs_map_): Remove.
6030         (Incremental_inputs::current_object_entry_): New data member.
6031         (Incremental_inputs::inputs_section_): New data member.
6032         (Incremental_inputs::symtab_section_): New data member.
6033         (Incremental_inputs::relocs_section_): New data member.
6034         (Incremental_inputs::reloc_count_): New data member.
6035         (Incremental_inputs_reader): New class.
6036         (Incremental_symtab_reader): New class.
6037         (Incremental_relocs_reader): New class.
6038         * layout.cc (Layout::finalize): Move finalization of incremental info
6039         and creation of incremental info sections to follow finalization of
6040         symbol table.  Set offsets for postprocessing sections.
6041         (Layout::create_incremental_info_sections): Call
6042         Incremental_inputs::create_data_sections.  Add incremental symtab
6043         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6044         sections to layout after input sections.
6045         * layout.h (struct Timespec): Forward declaration.
6046         (Layout::incremental_inputs): Add const.
6047         (Layout::create_incremental_info_sections): Add parameter.
6048         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6049         * object.cc: Include incremental.h.
6050         (Relobj::finalize_incremental_relocs): New function.
6051         (Sized_relobj::do_layout): Record input sections in incremental info.
6052         * object.h (Object::output_section): New function.
6053         (Object::output_section_offset): Moved from Relobj.
6054         (Object::get_incremental_reloc_base): New function.
6055         (Object::get_incremental_reloc_count): New function.
6056         (Object::do_output_section): New function.
6057         (Object::do_output_section_offset): Moved from Relobj.
6058         (Object::do_get_incremental_reloc_base): New function.
6059         (Object::do_get_incremental_reloc_count): New function.
6060         (Object::Object): Initialize new data members.
6061         (Relobj::output_section): Renamed do_output_section and moved to
6062         protected.
6063         (Relobj::output_section_offset): Moved to Object.
6064         (Relobj::do_get_incremental_reloc_base): New function.
6065         (Relobj::do_get_incremental_reloc_count): New function.
6066         (Relobj::allocate_incremental_reloc_counts): New function.
6067         (Relobj::count_incremental_reloc): New function.
6068         (Relobj::finalize_incremental_relocs): New function.
6069         (Relobj::next_incremental_reloc_index): New function.
6070         (Relobj::reloc_counts_): New data member.
6071         (Relobj::reloc_bases_): New data member.
6072         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6073         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6074         (Sized_relobj::incremental_relocs_scan): New function.
6075         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6076         (Sized_relobj::incremental_relocs_write): New function.
6077         (Sized_relobj::incremental_relocs_write_reltype): New function.
6078         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6079         incremental link.
6080         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6081         archives and object files elsewhere.
6082         (Add_symbols::run): Report object files here.
6083         (Finish_group::run): Report end of archive at end of group.
6084         * reloc.cc: Include layout.h, incremental.h.
6085         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6086         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6087         (Sized_relobj::incremental_relocs_scan): New function.
6088         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6089         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6090         (Sized_relobj::incremental_relocs_write): New function.
6091         (Sized_relobj::incremental_relocs_write_reltype): New function.
6092         * script.cc (read_input_script): Rewrite test for incremental link.
6093         Change call to Incremental_inputs::report_script.
6094         * symtab.h (Symbol_table::first_global_index): New function.
6095         (Symbol_table::output_count): New function.
6096
6097 2010-08-12  Doug Kwan  <dougkwan@google.com>
6098
6099         * arm.cc (Target_arm::merge_object_attributes): Check command line
6100         options --no-wchar-size-warning and --no-enum-size-warning.
6101         * options.h (General_options): Add ld-compatible options
6102         --no-enum-size-warning and --no-wchar-size-warning.
6103
6104 2010-08-04  Ian Lance Taylor  <iant@google.com>
6105
6106         * x86_64.cc (Target_x86_64::Scan::local): Use
6107         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6108         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6109         (Target_x86_64::Scan::global): Likewise.
6110         (Target_x86_64::Relocate::relocate): Likewise.
6111         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6112         Likewise.
6113
6114 2010-08-03  Cary Coutant  <ccoutant@google.com>
6115
6116         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6117         to reserve space in merged_strings vector. Keep total input size
6118         for stats.
6119         (Output_merge_string::do_print_merge_stats): Print total input size.
6120         * merge.h (Output_merge_string): Add input_size_ field.
6121         * stringpool.cc (Stringpool_template::string_length): Move
6122         implementations out of Stringpool_template class and place in
6123         stringpool.h.
6124         * stringpool.h (string_length): Move out of Stringpool_template.
6125
6126 2010-08-03  Ian Lance Taylor  <iant@google.com>
6127
6128         PR 11712
6129         * layout.cc (relaxation_loop_body): If address of load segment is
6130         set, adjust address to include headers if possible.
6131
6132 2010-08-03  Ian Lance Taylor  <iant@google.com>
6133
6134         * version.cc (version_string): Bump to 1.10.
6135
6136 2010-08-03  Ian Lance Taylor  <iant@google.com>
6137
6138         PR 11805
6139         * layout.h (enum Output_section_order): Define.
6140         (class Layout): Update declarations.
6141         * layout.cc (Layout::get_output_section): Add order parameter.
6142         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6143         is_first_non_relro parameters.  Change all callers.
6144         (Layout::choose_output_section): Likewise.
6145         (Layout::add_output_section_data): Likewise.
6146         (Layout::make_output_section): Likewise.  Set order.
6147         (Layout::default_section_order): New function.
6148         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6149         * output.cc (Output_section::Output_section): Initialize order_.
6150         Don't initialize deleted fields.
6151         (Output_segment::Output_segment): Don't initialize deleted
6152         fields.
6153         (Output_segment::add_output_section_to_load): New function
6154         replacing add_output_section.  Change all callers to call this or
6155         add_output_section_to_nonload.
6156         (Output_segment::add_output_section_to_nonload): New function.
6157         (Output_segment::remove_output_section): Rewrite.
6158         (Output_segment::add_initial_output_data): Likewise.
6159         (Output_segment::has_any_data_sections): Likewise.
6160         (Output_segment::is_first_section_relro): Likewise.
6161         (Output_segment::maximum_alignment): Likewise.
6162         (Output_segment::has_dynamic_reloc): New function replacing
6163         dynamic_reloc_count.  Change all callers.
6164         (Output_segment::has_dynamic_reloc_list): New function replacing
6165         dynamic_reloc_count_list.  Change all callers.
6166         (Output_segment::set_section_addresses): Rewrite.
6167         (Output_segment::set_offset): Rewrite.
6168         (Output_segment::find_first_and_last_list): Remove.
6169         (Output_segment::set_tls_offsets): Rewrite.
6170         (Output_segment::first_section_load_address): Likewise.
6171         (Output_segment::output_section_count): Likewise.
6172         (Output_segment::section_with_lowest_load_address): Likewise.
6173         (Output_segment::write_section_headers): Likewise.
6174         (Output_segment::print_sections_to_map): Likewise.
6175         * output.h (class Output_data): Remove dynamic_reloc_count_
6176         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6177         (Output_data::add_dynamic_reloc): Rewrite.
6178         (Output_data::has_dynamic_reloc): New function.
6179         (Output_data::dynamic_reloc_count): Remove.
6180         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6181         is_last_relro_, is_first_non_relro_, is_interp_,
6182         is_dynamic_linker_section_ fields.  Add order and set_order
6183         functions.  Remove is_relro_local, set_is_relro_local,
6184         is_last_relro, set_is_last_relro, is_first_non_relro,
6185         set_is_first_non_relro functions, is_interp, set_is_interp,
6186         is_dynamic_linker_section, and set_is_dynamic_linker_section
6187         functions.
6188         (class Output_segment): Change Output_data_list from std::list to
6189         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6190         output_bss_ fields.  Update declarations.
6191
6192 2010-08-02  Ian Lance Taylor  <iant@google.com>
6193
6194         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6195         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6196         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6197
6198 2010-08-02  Ian Lance Taylor  <iant@google.com>
6199
6200         PR 11855
6201         * script.cc (Script_options::Script_options): Initialize
6202         symbol_definitions_ and symbol_references_.
6203         (Script_options::add_symbol_assignment): Update
6204         symbol_definitions_ and symbol_references_.
6205         (Script_options::add_symbol_reference): New function.
6206         (script_symbol): New function.
6207         * script.h (class Script_options): Add symbol_definitions_ and
6208         symbol_references_ fields.
6209         (Script_options::referenced_const_iterator): New type.
6210         (Script_options::referenced_begin): New function.
6211         (Script_options::referenced_end): New function.
6212         (Script_options::is_referenced): New function.
6213         (Script_options::any_unreferenced): New function.
6214         * script-c.h (script_symbol): Declare.
6215         * yyscript.y (exp): Call script_symbol.
6216         * symtab.cc: Include "script.h".
6217         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6218         Change all callers.  Check symbols referenced by scripts.
6219         (Symbol_table::add_undefined_symbols_from_command_line): Add
6220         layout parameter.  Change all callers.
6221         (Symbol_table::do_add_undefined_symbols_from_command_line):
6222         Likewise.  Break out loop body.  Check symbols referenced by
6223         scripts.
6224         (Symbol_table::add_undefined_symbol_from_command_line): New
6225         function broken out of
6226         do_add_undefined_symbols_from_command_line.
6227         * symtab.h (class Symbol_table): Update declarations.
6228         * archive.cc: Include "layout.h".
6229         (Archive::should_include_member): Add layout parameter.  Change
6230         all callers.  Check for symbol mentioned in expression.
6231         * archive.h (class Archive): Update declaration.
6232         * object.cc (Sized_relobj::do_should_include_member): Add layout
6233         parameter.
6234         * object.h (Object::should_include_member): Add layout parameter.
6235         Change all callers.
6236         (Object::do_should_include_member): Add layout parameter.
6237         (class Sized_relobj): Update declaration.
6238         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6239         parameter.
6240         * dynobj.h (class Sized_dynobj): Update declaration.
6241         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6242         layout parameter.
6243         * plugin.h (class Sized_pluginobj): Update declaration.
6244
6245 2010-08-02  Ian Lance Taylor  <iant@google.com>
6246
6247         PR 11866
6248         * output.cc (Output_segment::set_offset): Search for the first and
6249         last sections rather than assuming that the list is in order.
6250         (Output_segment::find_first_and_last_list): New function.
6251         * output.h (class Output_segment): Update declarations.
6252         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6253         (relro_strip_test_SOURCES): New variable.
6254         (relro_strip_test_DEPENDENCIES): New variable.
6255         (relro_strip_test_LDFLAGS): New variable.
6256         (relro_strip_test_LDADD): New variable.
6257         (relro_strip_test.so): New target.
6258
6259 2010-08-02  Ian Lance Taylor  <iant@google.com>
6260
6261         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6262         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6263         (Target_i386::got_tlsdesc_section): New function.
6264         (Target_i386::got_section): Create space for GOT entries for
6265         TLSDESC relocations.
6266         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6267         R_386_TLS_GOTDESC.
6268         (Target_i386::Scan::global): Likewise.
6269         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6270         using TLSDESC GOT.
6271         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6272         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6273         (Target_x86_64::got_tlsdesc_section): New function.
6274         (Target_x86_64::got_section): Create space for GOT entries for
6275         TLSDESC relocations.
6276         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6277         R_386_TLS_GOTDESC.
6278         (Target_x86_64::Scan::global): Likewise.
6279         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6280         using TLSDESC GOT.
6281
6282 2010-08-02  Ian Lance Taylor  <iant@google.com>
6283
6284         * testsuite/final_layout.sh: Use dc to convert from hex to
6285         decimal.
6286
6287 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6288
6289         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6290         paramter to the call to gold::gc_process_relocs.
6291         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6292         paramter to the call to gold::gc_process_relocs.
6293         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6294         parameter to the call to gold::gc_process_relocs.
6295         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6296         template parameter to the call to gold::gc_process_relocs.
6297         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6298         paramter to the call to gold::gc_process_relocs.
6299         * gc.h (get_embedded_addend_size): New function.
6300         (gc_process_relocs): Save the size of the reloc for use by ICF.
6301         * icf.cc (get_section_contents): Get the addend from the text section
6302         for SHT_REL relocation sections.
6303         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6304         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6305         * int_encoding.h (read_from_pointer): New overloaded function.
6306         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6307         * testsuite/icf_sht_rel_addend_test.sh: New file.
6308         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6309         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6310
6311 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6312
6313         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6314         * Makefile.in: Regenerate.
6315         * testsuite/Makefile.in: Regenerate.
6316
6317 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6318
6319         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6320         * gold/testsuite/debug_msg.cc: Likewise.
6321         * gold/testsuite/odr_violation1.cc
6322         * gold/testsuite/odr_violation2.cc
6323
6324 2010-07-21  Cary Coutant  <ccoutant@google.com>
6325
6326         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6327         string, and length fields.
6328         (Output_merge_string::Merged_strings_list): New type.
6329         (Output_merge_string::Merged_strings_lists): New typedef.
6330         (Output_merge_string): Replace merged_strings_ with
6331         merged_strings_lists_.
6332         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6333         Merged_strings_list per input object and section.  Don't store pointer
6334         to the string.  Don't store length with each merged string entry.
6335         (Output_merge_string::finalize_merged_data): Loop over list of merged
6336         strings lists.  Recompute length of each merged string.
6337
6338 2010-07-15  Cary Coutant  <ccoutant@google.com>
6339
6340         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6341         here.
6342
6343 2010-07-14  Ian Lance Taylor  <iant@google.com>
6344
6345         * descriptors.cc (Descriptors::open): Report correct name in error
6346         message.
6347
6348 2010-07-13  Doug Kwan  <dougkwan@google.com>
6349
6350         * arm.cc (Arm_input_section::Arm_input_section): For a
6351         SHT_ARM_EXIDX section, always keeps the input sections.
6352         (Arm_input_section::set_exidx_section_link): New method.
6353         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6354         has_errors_ to false.
6355         (Arm_exidx_input_section::has_errors,
6356         Arm_exidx_input_section::set_has_errors): New methods.
6357         (Arm_exidx_input_section::has_errors_): New data member.
6358         (Arm_relobj::get_exidx_shndx_list): New method.
6359         (Arm_output_section::append_text_sections_to_list): Do not skip
6360         section without SHF_EXECINSTR.
6361         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6362         errors.
6363         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6364         section header.  Make error messages more verbose.  Check for
6365         a non-executable section linked to an EXIDX section.
6366         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6367         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6368         check that there is no deferred EXIDX section if we exit early.
6369         Instead of not making an EXIDX section in case of an error, make one
6370         and set the has_errors flag of it.
6371         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6372         in a relocatable link.
6373         (Target_arm::do_relax): Look for the EXIDX output section instead of
6374         assuming that it is called .ARM.exidx.
6375         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6376         section list.  Do not check for SHF_EXECINSTR section flags but
6377         skip any input section with errors.
6378         * output.cc (Output_section::Output_section): Initialize
6379         always_keeps_input_sections_ to false.
6380         (Output_section::add_input_section): Check for
6381         always_keeps_input_sections_.
6382         *  output.h (Output_section::always_keeps_input_sections,
6383         Output_section::set_always_keeps_input_sections): New methods.
6384         (Output_section::always_keeps_input_sections): New data member.
6385
6386 2010-07-13  Rafael Espindola  <espindola@google.com>
6387
6388         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6389         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6390
6391 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6392             Ian Lance Taylor  <iant@google.com>
6393
6394         * output.h (Output_section_lookup_maps::add_merge_section):
6395         Correct check of whether value was inserted.
6396         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6397         (Output_section_lookup_maps::add_relaxed_input_section):
6398         Likewise.
6399         * arm.cc (Target_arm::got_section): Remove used local os.
6400         * i386.cc (Target_i386::got_section): Likewise.
6401         * x86_64.cc (Target_x86_64::got_section): Likewise.
6402         * sparc.cc (Target_sparc::got_section): Likewise.
6403         (Target_sparc::relocate): Remove unused local have_got_offset.
6404         * powerpc.cc (Target_powerpc::relocate): Likewise.
6405
6406 2010-07-13  Ian Lance Taylor  <iant@google.com>
6407
6408         * compressed_output.cc (zlib_decompress): Fix signature in
6409         !HAVE_ZLIB_H case.
6410
6411         * archive.cc (Archive::include_member): Unlock an external member
6412         of a thin archive.  Don't bother to delete an object we know is
6413         NULL.
6414
6415 2010-07-12  Cary Coutant  <ccoutant@google.com>
6416
6417         * compressed_output.cc (zlib_decompress): New function.
6418         (get_uncompressed_size): New function.
6419         (decompress_input_section): New function.
6420         * compressed_output.h (get_uncompressed_size): New function.
6421         (decompress_input_section): New function.
6422         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6423         Handle compressed debug sections.
6424         * layout.cc (is_compressed_debug_section): New function.
6425         (Layout::output_section_name): Map compressed section names to
6426         canonical names.
6427         * layout.h (is_compressed_debug_section): New function.
6428         (is_debug_info_section): Recognize compressed debug sections.
6429         * merge.cc: Include compressed_output.h.
6430         (Output_merge_data::do_add_input_section): Handle compressed
6431         debug sections.
6432         (Output_merge_string::do_add_input_section): Handle compressed
6433         debug sections.
6434         * object.cc: Include compressed_output.h.
6435         (Sized_relobj::Sized_relobj): Initialize new data members.
6436         (build_compressed_section_map): New function.
6437         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6438         * object.h (Object::section_is_compressed): New method.
6439         (Object::do_section_is_compressed): New method.
6440         (Sized_relobj::Compressed_section_map): New type.
6441         (Sized_relobj::do_section_is_compressed): New method.
6442         (Sized_relobj::compressed_sections_): New data member.
6443         * output.cc (Output_section::add_input_section): Handle compressed
6444         debug sections.
6445         * reloc.cc: Include compressed_output.h.
6446         (Sized_relobj::write_sections): Handle compressed debug sections.
6447
6448 2010-07-08  Cary Coutant  <ccoutant@google.com>
6449
6450         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6451         weak when resolving to a dynamic def.
6452         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6453         for weak undef/dynamic def cases. Adjust callers.
6454         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6455         undef_binding_weak_.
6456         (Symbol_table::sized_write_globals): Adjust symbol binding.
6457         (Symbol_table::sized_write_symbol): Add binding parameter.
6458         * symtab.h (Symbol::set_undef_binding): New method.
6459         (Symbol::is_undef_binding_weak): New method.
6460         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6461         (Symbol_table::should_override): Add new parameter.
6462         (Symbol_table::sized_write_symbol): Add new parameter.
6463
6464         * testsuite/weak_undef_file1.cc: Add new test case.
6465         * testsuite/weak_undef_file2.cc: Fix header comment.
6466         * testsuite/weak_undef_test.cc: Add new test case.
6467
6468 2010-06-29  Doug Kwan  <dougkwan@google.com>
6469
6470         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6471         Initialize USE_SYMBOL_.
6472         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6473         definition.
6474         (Arm_reloc_property::uses_symbol_): New data member declaration.
6475         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6476         uses symbol value and symbol is undefined but not weakly undefined.
6477
6478 2010-06-28  Rafael Espindola  <espindola@google.com>
6479
6480         * plugin.cc (Plugin::load): Use dlerror.
6481
6482 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6483
6484         * symtab.cc (detect_odr_violations): When reporting an ODR
6485         violation, report an object where the symbol is defined.
6486
6487 2010-06-25  Doug Kwan  <dougkwan@google.com>
6488
6489         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6490         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6491         definition.
6492         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6493         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6494         target hook to detect function points.
6495         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6496         * icf.h (Icf::check_section_for_function_pointers): Change type of
6497         parameter SECTION_NAME to const reference to std::string.  Use
6498         target hook to determine if section may have unsafe pointers.
6499         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6500         method definition.
6501
6502 2010-06-21  Rafael Espindola  <espindola@google.com>
6503
6504         * fileread.cc (Input_file::find_fie): New
6505         (Input_file::open): Use Input_file::find_fie.
6506         * fileread.h (Input_file::find_fie): New
6507         * plugin.cc (set_extra_library_path): New.
6508         (Plugin::load): Add set_extra_library_path to the transfer vector.
6509         (Plugin_manager::set_extra_library_path): New.
6510         (Plugin_manager::add_input_file): Use the extra search path if set.
6511         (set_extra_library_path(): New.
6512         * plugin.h (Plugin_manager): Add set_extra_library_path and
6513         extra_search_path_.
6514
6515 2010-06-19  Cary Coutant  <ccoutant@google.com>
6516
6517         * layout.cc (gdb_sections): Add .debug_types.
6518         (lines_only_debug_sections): Likewise.
6519
6520 2010-06-18  Rafael Espindola  <espindola@google.com>
6521
6522         * plugin.cc (add_input_file,add_input_library)
6523         (Plugin_manager::add_input_file): Make filename arguments const.
6524         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6525         const.
6526
6527 2010-06-16  Doug Kwan  <dougkwan@google.com>
6528
6529         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6530         .ARM.attributes section if we have not merged any input
6531         attributes sections.
6532
6533 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6534
6535         * arm.cc: Allow combining objects with no EABI version
6536         information.
6537
6538 2010-06-15  Rafael Espindola  <espindola@google.com>
6539
6540         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6541
6542 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6543
6544         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6545         (struct iovec): Correct !HAVE_READV definition.
6546
6547 2010-06-10  Cary Coutant  <ccoutant@google.com>
6548
6549         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6550         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6551         reloc sections.
6552         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6553
6554         PR 11683
6555         * symtab.h (Symbol::is_placeholder): New member function.
6556         * target-reloc.h (relocate_section): Check for placeholder symbols.
6557
6558         * testsuite/Makefile.am (plugin_test_8): New test.
6559         (plugin_test_9): New test.
6560         * testsuite/Makefile.in: Regenerate.
6561
6562 2010-06-09  Nick Clifton  <nickc@redhat.com>
6563
6564         * yyscript.y (input_list_element): Allow strings prefixed with
6565         the '-' character.  Treat these as libraries.
6566         * script.cc (script_add_library): New function.  Adds a library
6567         specified by "-l<name>" found in an input script.
6568         * script-c.h: Add prototype for script_add_library.
6569
6570 2010-06-07  Doug Kwan  <dougkwan@google.com>
6571
6572         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6573         Restrict stub-group size to be within long conditional branch
6574         range when working around cortex-A8 erratum.
6575
6576 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6577
6578         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6579         #ifdef typo.
6580
6581 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6582
6583         PR gold/11658
6584         * output.cc
6585         (Output_section::Input_section_sort_entry::compare_section_ordering):
6586         Change to return non-zero correctly.
6587         (Output_section::Input_section_sort_section_order_index_compare
6588         ::operator()): Change to fix ambiguity in comparisons.
6589
6590 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6591
6592         * gold.h (is_wildcard_string): New function.
6593         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6594         (Layout::layout_eh_frame): Ditto.
6595         (Layout::find_section_order_index): New method.
6596         (Layout::read_layout_from_file): New method.
6597         * layout.h (Layout::find_section_order_index): New method.
6598         (Layout::read_layout_from_file): New method.
6599         (Layout::input_section_position_): New private member.
6600         (Layout::input_section_glob_): New private member.
6601         * main.cc (main): Call read_layout_from_file here.
6602         * options.h (--section-ordering-file): New option.
6603         * output.cc (Output_section::input_section_order_specified_): New
6604         member.
6605         (Output_section::Output_section): Initialize new member.
6606         (Output_section::add_input_section): Add new parameter.
6607         Keep input sections when --section-ordering-file is used.
6608         (Output_section::set_final_data_size): Sort input sections when
6609         section ordering file is specified.
6610         (Output_section::Input_section_sort_entry): Add new parameter.
6611         Check sorting type.
6612         (Output_section::Input_section_sort_entry::compare_section_ordering):
6613         New method.
6614         (Output_section::Input_section_sort_compare::operator()): Change to
6615         consider section_order_index.
6616         (Output_section::Input_section_sort_init_fini_compare::operator()):
6617         Change to consider section_order_index.
6618         (Output_section::Input_section_sort_section_order_index_compare
6619         ::operator()): New method.
6620         (Output_section::sort_attached_input_sections): Change to sort
6621         according to section order when specified.
6622         (Output_section::add_input_section<32, true>): Add new parameter.
6623         (Output_section::add_input_section<64, true>): Add new parameter.
6624         (Output_section::add_input_section<32, false>): Add new parameter.
6625         (Output_section::add_input_section<64, false>): Add new parameter.
6626         * output.h (Output_section::add_input_section): Add new parameter.
6627         (Output_section::input_section_order_specified): New
6628         method.
6629         (Output_section::set_input_section_order_specified): New method.
6630         (Input_section::Input_section): Initialize section_order_index_.
6631         (Input_section::section_order_index): New method.
6632         (Input_section::set_section_order_index): New method.
6633         (Input_section::section_order_index_): New member.
6634         (Input_section::Input_section_sort_section_order_index_compare): New
6635         struct.
6636         (Output_section::input_section_order_specified_): New member.
6637         * script-sections.cc (is_wildcard_string): Delete and move modified
6638         method to gold.h.
6639         (Output_section_element_input::Output_section_element_input): Modify
6640         call to is_wildcard_string.
6641         (Output_section_element_input::Input_section_pattern
6642         ::Input_section_pattern): Ditto.
6643         (Output_section_element_input::Output_section_element_input): Ditto.
6644         * testsuite/Makefile.am (final_layout): New test case.
6645         * testsuite/Makefile.in: Regenerate.
6646         * testsuite/final_layout.cc: New file.
6647         * testsuite/final_layout.sh: New file.
6648
6649 2010-06-01  Rafael Espindola  <espindola@google.com>
6650
6651         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6652
6653 2010-06-01  Rafael Espindola  <espindola@google.com>
6654
6655         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6656         visibility of symbols.
6657
6658 2010-05-27  Doug Kwan  <dougkwan@google.com>
6659
6660         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6661         from start of output section instead of address for a local symbol
6662         in a merged or relaxed section when doing a relocatable link.
6663
6664 2010-05-26  Rafael Espindola  <espindola@google.com>
6665
6666         PR 11604
6667         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6668         adding sections the garbage collector removed.
6669         * gold/testsuite/Makefile.am: Add test.
6670         * gold/testsuite/Makefile.in: Regenerate.
6671         * gold/testsuite/plugin_test_7.sh: New.
6672         * gold/testsuite/plugin_test_7_1.c: New.
6673         * gold/testsuite/plugin_test_7_2.c: New.
6674
6675 2010-05-26  Rafael Espindola  <espindola@google.com>
6676
6677         * script-sections.cc (Output_section_definition::set_section_addresses):
6678         Check for --section-start.
6679
6680 2010-05-26  Doug Kwan  <dougkwan@google.com>
6681
6682         * arm.cc (Arm_scan_relocatable_relocs): New class.
6683         (Target_arm::relocate_special_relocatable): New method.
6684         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6685         (Arm_relocate_functions::thumb_branch_common): Same.
6686         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6687         instead of Default_scan_relocatable_relocs.
6688         * target-reloc.h (relocate_for_relocatable): Let target handle
6689         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6690         * target.h (Sized_target::relocate_special_relocatable): New method.
6691
6692 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6693
6694         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6695
6696 2010-05-23  Doug Kwan  <dougkwan@google.com>
6697
6698         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6699         instead of a cast.
6700         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6701         with a direct branch, not a conditional branch, to a stub.
6702         * merge.cc (Output_merge_base::record_input_section): New method
6703         defintion.
6704         (Output_merge_data::do_add_input_section): Record input section if
6705         keeps-input-sections flag is set.
6706         (Output_merge_string::do_add_input_section): Ditto.
6707         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6708         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6709         INPUT_SECTIONS_.
6710         (Output_merge_base::keeps_input_sections,
6711         Output_merge_base::set_keeps_input_sections,
6712         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6713         method definitions.
6714         (Output_merge_base::Input_sections): New type declaration.
6715         (Output_merge_base::input_sections_begin,
6716         Output_merge_base::input_sections_end,
6717         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6718         (Output_merge_base::bool keeps_input_sections_,
6719         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6720         Output_merge_base::input_sections_): New data members.
6721         (Output_merge_data::do_set_keeps_input_sections): New method
6722         defintion.
6723         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6724         * output.cc (Output_section::Input_section::relobj): Move method
6725         defintion from class declaration to here and handle merge sections.
6726         (Output_section::Input_section::shndx): Ditto.
6727         (Output_section::Output_section): Remove initializations of removed
6728         data members and initialize new data member LOOKUP_MAPS_.
6729         (Output_section::add_input_section): Set keeps-input-sections flag
6730         for a newly created merge output section as appropriate.  Adjust code
6731         to use Output_section_lookup_maps class.
6732         (Output_section::add_relaxed_input_section): Adjst code for lookup
6733         maps code refactoring.
6734         (Output_section::add_merge_input_section): Add a new parameter
6735         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6736         class.  If adding input section to a newly created merge output
6737         section fails, remove the new merge section.
6738         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6739         Adjust code for use of the Output_section_lookup_maps class.
6740         (Output_section::find_merge_section): Ditto.
6741         (Output_section::build_lookup_maps): New method defintion.
6742         (Output_section::find_relaxed_input_section): Adjust code to use
6743         Output_section_lookup_maps class.
6744         (Output_section::get_input_sections): Export merge sections.  Adjust
6745         code to use Output_section_lookup_maps class.
6746         (Output_section:::add_script_input_section): Adjust code to use
6747         Output_section_lookup_maps class.  Update lookup maps for merge
6748         sections also.
6749         (Output_section::discard_states): Use Output_section_lookup_maps.
6750         (Output_section::restore_states): Same.
6751         * output.h (Merge_section_properties): Move class defintion out of
6752         Output_section.
6753         (Output_section_lookup_maps): New class.
6754         (Output_section::Input_section::is_merge_section): New method
6755         defintion.
6756         (Output_section::Input_section::relobj): Move defintion out of class
6757         defintion.  Declare method only.
6758         (Output_section::Input_section::shndx): Ditto.
6759         (Output_section::Input_section::output_merge_base): New method defintion.
6760         (Output_section::Input_section::u2_.pomb): New union field.
6761         (Output_section::Merge_section_by_properties_map,
6762         Output_section::Output_section_data_by_input_section_map,
6763         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6764         Remove types.
6765         (Output_section::add_merge_input_section): Add new parameter
6766         KEEPS_INPUT_SECTIONS.
6767         (Output_section::build_lookup_maps): New method declaration.
6768         (Output_section::merge_section_map_,
6769         Output_section::merge_section_by_properties_map_,
6770         Output_section::relaxed_input_section_map_,
6771         Output_section::is_relaxed_input_section_map_valid_): Remove data
6772         members.
6773         (Output_section::lookup_maps_): New data member.
6774
6775 2010-05-21  Doug Kwan  <dougkwan@google.com>
6776
6777         PR gold/11619
6778         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6779         avoid a compilation error.
6780
6781 2010-05-19  Rafael Espindola  <espindola@google.com>
6782
6783         * script-sections.cc (Output_section_definition::allocate_to_segment):
6784         Update the phdrs_list even when the output section is NULL.
6785         * testsuite/Makefile.am: Add test.
6786         * testsuite/Makefile.in: Regenerate.
6787         * testsuite/script_test_9.cc: New.
6788         * testsuite/script_test_9.sh: New.
6789         * testsuite/script_test_9.t: New.
6790
6791 2010-05-19  Doug Kwan  <dougkwan@google.com>
6792
6793         * arm.cc (Arm_input_section::original_size): New method.
6794         (Arm_input_section::do_addralign): Add a cast.
6795         (Arm_input_section::do_output_offset): Remove static cast.
6796         (Arm_input_section::original_addralign,
6797          Arm_input_section::original_size_): Change type to uint32_t.
6798         (Arm_input_section::init): Add safe casts for section alignment
6799         and size.
6800         (Arm_input_section::set_final_data_size): Do not set address and
6801         offset of stub table.
6802         (Arm_output_section::fix_exidx_coverage): Change use of of
6803         Output_section::Simple_input_section to that of
6804         Output_section::Input_section.
6805         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6806         except for the first pass.
6807         * output.cc (Output_section::get_input_sections): Change type of
6808         input_sections to std::list<Input_section>.
6809         (Output_section::add_script_input_section): Rename from
6810         Output_section::add_simple_input_section.  Change type of SIS
6811         parameter from Simple_input_section to Input_section.
6812         * output.h (Output_section::Simple_input_section): Remove class.
6813         (Output_section::Input_section): Change class visibility to public.
6814         (Output_section::Input_section::addralign): Use stored alignments
6815         for special input sections if set.
6816         (Output_section::Input_section::set_addralign): New method.
6817         (Output_section::get_input_sections): Change parameter type from
6818         list of Simple_input_section to list of Input_section.
6819         (Output_section::add_script_input_section): Rename from
6820         Output_section::add_simple_input_section. Change first parameter's
6821         type from Simple_input_section to Input_section and remove the
6822         second and third parameters.
6823         * script-sections.cc (Input_section::Input_section_list): Change
6824         type to list of Output_section::Input_section/
6825         (Input_section_info::Input_section_info): Change parameter type of
6826         INPUT_SECTION to Output_section::Input_section.
6827         (Input_section_info::input_section): Change return type.
6828         (Input_section_info::input_section_): Change type to
6829         Output_section::Input_section.
6830         (Output_section_element_input::set_section_addresses): Adjust code
6831         to use Output_section::Input_section instead of
6832         Output_section::Simple_input_section.  Adjust code for renaming
6833         of Output_section::add_simple_input_section.
6834         (Orphan_output_section::set_section_addresses): Ditto.
6835
6836 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6837
6838         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6839         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6840
6841 2010-05-18  Rafael Espindola  <espindola@google.com>
6842
6843         * options.cc (General_options::finalize): Handle -nostdlib.
6844         * options.h (nostdlib): New option.
6845         * script.cc (script_add_search_dir): Handle -nostdlib.
6846
6847 2010-05-12  Doug Kwan  <dougkwan@google.com>
6848
6849         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6850         attributes section only if there no attributes section after merging.
6851         (Target_arm::merge_object_attributes): Move value of
6852         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6853         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6854         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6855         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6856         and arm_attr_merge_7.stdout.
6857         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6858         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6859         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6860         arm_attr_merge_7b.o): New rules.
6861         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6862         arm_attr_merge_7
6863         * testsuite/Makefile.in: Regenerate.
6864         * testsuite/arm_attr_merge.sh: New file.
6865         * testsuite/arm_attr_merge_[67][ab].s: Same.
6866
6867 2010-05-05  Nick Clifton  <nickc@redhat.com>
6868
6869         * po/es.po: Updated Spanish translation.
6870
6871 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6872
6873         * Makefile.am (install-exec-local): Properly install gold as
6874         default cross linker.
6875         * Makefile.in: Regenerated.
6876
6877 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6878             Nick Clifton  <nickc@redhat.com>
6879
6880         * configure.ac (install_as_default): Define and set to false
6881         unless --enable-gold or --enable-gold=both/gold has been
6882         specified.
6883         * configure: Regenerate.
6884
6885         * Makefile.am (install-exec-local): Install the executable as
6886         'ld.gold'.  If install_as_default is true then also install it as
6887         'ld'.
6888         * Makefile.in: Regenerated.
6889
6890 2010-04-24  Ian Lance Taylor  <iant@google.com>
6891
6892         * layout.cc (Layout::layout_reloc): In relocatable link don't
6893         combine reloc sections for grouped sections.
6894
6895 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6896
6897         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6898         sections that are not ordinary to icf.
6899         * icf.cc (get_section_contents): Handle relocation pointing to section
6900         with no object or shndx information.
6901         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6902         * testsuite/Makefile.in: Regenerate.
6903         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6904         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6905
6906 2010-04-22  Ian Lance Taylor  <iant@google.com>
6907
6908         * expression.cc (Expression::Expression_eval_info): Add
6909         result_alignment_pointer field.
6910         (Expression::eval_with_dot): Add result_alignment_pointer
6911         parameter.  Change all callers.
6912         (Expression::eval_maybe_dot): Likewise.
6913         (class Binary_expression): Add alignment_pointer parameter to
6914         left_value and right_value.  Change all callers.
6915         (BINARY_EXPRESSION): Set result alignment.
6916         (class Trinary_expression): Add alignment_pointer parameter to
6917         arg2_value and arg3_value.  Change all callers.
6918         (Trinary_cond::value): Set result alignment.
6919         (Max_expression::value, Min_expression::value): Likewise.
6920         (Align_expression::value): Likewise.
6921         * script-sections.cc (class Sections_element): Add dot_alignment
6922         parameter to set_section_addresses virtual function.  Update
6923         instantiations.
6924         (class Output_section_element): Likewise.
6925         (Script_sections::create_segments): Add dot_alignment parameter.
6926         Change all callers.
6927         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6928         (Script_sections::set_phdrs_clause_addresses): Likewise.
6929         * script-sections.h: Update declarations.
6930         * script.h: Update declarations.
6931         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6932         min_p_align.
6933         * testsuite/script_test_3.t: Set large alignment.
6934         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6935         segment has expected alignment.
6936
6937 2010-04-22  Nick Clifton  <nickc@redhat.com>
6938
6939         * po/gold.pot: Updated by the Translation project.
6940         * po/vi.po: Updated Vietnamese translation.
6941
6942 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6943
6944         * testsuite/Makefile.am (check_PROGRAMS): Add
6945         icf_virtual_function_folding_test.
6946         * testsuite/Makefile.in: Regenerated.
6947
6948 2010-04-15  Andrew Haley  <aph@redhat.com>
6949
6950         * options.h (merge_exidx_entries): New option.
6951         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6952         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6953         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6954         (Target_arm::merge_exidx_entries): New function.
6955         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6956         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6957         to Arm_exidx_fixup constructor.
6958         Add new arg, merge_exidx_entries.
6959         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6960         Arm_output_section::fix_exidx_coverage.
6961
6962 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6963
6964         * icf.cc (get_section_contents): Check for preemptible functions.
6965         Ignore addend when appropriate.
6966         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6967         section folded.
6968         (add_from_relobj): Check for section folded.
6969         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6970         * symtab.h (should_add_dynsym_entry): Add new parameter.
6971         * target-reloc.h (scan_relocs): Check for section folded.
6972         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6973         Check reloc types for function pointers in shared objects.
6974         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6975         case.
6976         (icf_preemptible_functions_test): New test case.
6977         (icf_string_merge_test): New test case.
6978         * testsuite.Makefile.in: Regenerate.
6979         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6980         bar_glob.  Refactor code.
6981         * testsuite/icf_preemptible_functions_test.cc: New file.
6982         * testsuite/icf_preemptible_functions_test.sh: New file.
6983         * testsuite/icf_string_merge_test.cc: New file.
6984         * testsuite/icf_string_merge_test.sh: New file.
6985         * testsuite/icf_virtual_function_folding_test.cc: New file.
6986         * testsuite/icf_virtual_function_folding_test.sh: New file.
6987
6988 2010-04-14  Doug Kwan  <dougkwan@google.com>
6989
6990         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6991         for local symbol recounting if we remove a section due to ICF.
6992         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6993         there are no regular objects in input.
6994
6995 2010-04-13  Doug Kwan  <dougkwan@google.com>
6996
6997         * arm.cc (Arm_input_section::set_final_data_size): Compute
6998         accurate final data size instead of using current data size.
6999
7000 2010-04-09  Doug Kwan  <dougkwan@google.com>
7001
7002         * layout.cc (Layout::choose_output_section): Handle script section
7003         types.
7004         (Layout::make_output_section_for_script): Add section type parameter.
7005         Handle script section types.
7006         * layout.h (Layout::make_output_section_for_script): Add section
7007         type parameter.
7008         * output.cc (Output_section::Output_section): Initialize data member
7009         is_noload_.
7010         (Output_section::do_reset_address_and_file_offset): Do not set address
7011         to 0 if section is a NOLOAD section.
7012         * output.h (Output_section::is_noload): New method.
7013         (Output_section::set_is_noload): Ditto.
7014         (Output_section::is_noload_): New data member.
7015         * script-c.h (Script_section_type): New enum type.
7016         (struct Parser_output_section_header): Add new file section_type.
7017         * script-sections.cc (Sections_element::output_section_name): Add
7018         parameter for returning script section type.
7019         (Output_section_definition::output_section_name): Ditto.
7020         (Output_section_definition::section_type)P; New method.
7021         (Output_section_definiton::script_section_type_name): Ditto.
7022         (Output_section_definition::script_section_type_): New data member.
7023         (Output_section_definition::Output_section_definition): Initialize
7024         data member Output_section_definition::script_section_type_.
7025         (Output_section_definition::create_sections): Pass script section type
7026         to Layout::make_output_section_for_script.
7027         (Output_section_definition::output_section_name): Return script
7028         section type to caller.
7029         (Output_section_definition::set_section_address): Do not advance
7030         dot value and load address if section type is NOLOAD.  Set address
7031         of NOLOAD sections regardless of section flags.
7032         (Output_section_definition::print): Print section type if it is
7033         not SCRIPT_SECTION_TYPE_NONE.
7034         (Output_section_definition::section_type): New method.
7035         (Output_section_definition::script_section_type_name): Ditto.
7036         (Script_sections::output_section_name): Add new parameter
7037         PSECTION_TYPE for returning script section type.  Pass it to
7038         section elements.  Handle discard sections.
7039         (Sort_output_sections::operator()): Handle NOLOAD sections.
7040         * script-sections.h (Script_sections::Section_type): New enum type.
7041         (Script_sections::output_section_name): Add a new parameter for
7042         returning script section type.
7043         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7044         INFO and NOLOAD.
7045         * yyscript.y (union): Add new field SECTION_TYPE.
7046         (COPY, DSECT, INFO, NOLOAD): New tokens.
7047         (opt_address_and_section_type): Change type to output_section_header.
7048         (section_type): New non-terminal
7049         (section_header): Handle section type.
7050         (opt_address_and_section_type): Return section type value.
7051
7052 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7053
7054         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7055         * testsuite/plugin_common_test_2.c (foo): Likewise.
7056
7057 2010-04-08  Doug Kwan  <dougkwan@google.com>
7058
7059         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7060         Output_merge_data.
7061         * output.cc (Output_section::add_merge_input_section): Simplify
7062         code and return status of Output_merge_base::add_input_section.
7063         Update merge section map only if Output_merge_base::add_input_section
7064         returns true.
7065
7066 2010-04-07  Doug Kwan  <dougkwan@google.com>
7067
7068         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7069         if section is marked as containing instructions but has no mapping
7070         symbols.
7071         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7072         correct section index.
7073         (Arm_relobj::find_linked_text_section): Ditto.
7074
7075 2010-04-07  Cary Coutant  <ccoutant@google.com>
7076
7077         * archive.cc (include_member): Destroy Read_symbols_data object before
7078         releasing file.
7079         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7080         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7081         (Read_symbols_data::~Read_symbols_data) New destructor.
7082         (Section_relocs::Section_relocs) New constructor.
7083         (Section_relocs::~Section_relocs) New destructor.
7084         (Read_relocs_data::Read_relocs_data) New constructor.
7085         (Read_relocs_data::~Read_relocs_data) New destructor.
7086         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7087         pointers to NULL after deleting.
7088
7089 2010-04-07  Doug Kwan  <dougkwan@google.com>
7090
7091         * arm.cc: Replace "endianity" with "endianness" in comments.
7092         (Arm_exidx_cantunwind): Ditto.
7093         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7094         (Arm_relobj::merge_flags_and_attributes): New method.
7095         (Arm_relobj::merge_flags_and_attributes_): New data member.
7096         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7097         (Arm_relobj::scan_sections_for_stubs): Ditto.
7098         (Arm_relobj::do_read_symbols): Check to see if we really want to
7099         merge processor-specific flags and attributes.  Exit early if
7100         an object is empty except for section names and the undefined symbol.
7101         (Target_arm::do_finalize_sections): Move check for ELF format to
7102         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7103         attributes from a regular object only when we have determined that
7104         it is aapropriate.  Do not create an .ARM.attributes section in
7105         output if there is no regular input object.
7106         (Target_arm::merge_processor_specific_flags): Check
7107         --warn-mismatch before printing any error.
7108         (Target_arm::merge_object_attributes): Ditto.
7109         * gold.cc (queue_middle_tasks): Handle the case in which there is
7110         no regular object in input.
7111         * options.cc (General_options::parse_EB): New method.
7112         (General_options::parse_EL): Same.
7113         (General_options::General_options): Initialize endianness_.
7114         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7115         New options.
7116         (General_options::Endianness): New enum.
7117         (General_options::endianness): New method.
7118         (General_options::endianness_): New data member.
7119         * parameters.cc (Parameters::set_options): Check target endianness.
7120         (Parameters::set_target_once): Ditto.
7121         (Parameters::check_target_endianness): New method.
7122         (parameters_force_valid_target): If either -EL or -EB is specified,
7123         use it to define endianness of default target.
7124         * parameters.h (Parameters::check_target_endianness): New method
7125         declaration.
7126         * target.h (class Target): Change "endianity" to "endianness"
7127         in comments.
7128
7129 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7130
7131         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7132         * configure: Regenerate.
7133         * Makefile.in: Regenerate.
7134         * testsuite/Makefile.in: Regenerate.
7135
7136 2010-04-06  Cary Coutant  <ccoutant@google.com>
7137
7138         gcc PR lto/42757
7139         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7140         prevailing definitions of common symbols.
7141         * testsuite/plugin_test_6.sh: New test case.
7142         * testsuite/plugin_common_test_1.c: New test case.
7143         * testsuite/plugin_common_test_2.c: New test case.
7144         * testsuite/Makefile.am (plugin_test_6): New test case.
7145         * testsuite/Makefile.in: Regenerate.
7146
7147 2010-04-06  Nick Clifton  <nickc@redhat.com>
7148
7149         * po/vi.po: New Vietnamese translation.
7150
7151 2010-03-30  Doug Kwan  <dougkwan@google.com>
7152
7153         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7154
7155 2010-03-25  Doug Kwan  <dougkwan@google.com>
7156
7157         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7158         to avoid a conversion warning on a 32-bit host.
7159
7160 2010-03-24  Ian Lance Taylor  <iant@google.com>
7161
7162         * testsuite/script_test_3.t: Add a TLS segment.
7163         * testsuite/Makefile.am (check_PROGRAMS): Add
7164         tls_phdrs_script_test.
7165         (tls_phdrs_script_test_SOURCES): Define.
7166         (tls_phdrs_script_test_DEPENDENCIES): Define.
7167         (tls_phdrs_script_test_LDFLAGS): Define.
7168         (tls_phdrs_script_test_LDADD): Define.
7169         * testsuite/Makefile.in: Rebuild.
7170
7171 2010-03-23  Cary Coutant  <ccoutant@google.com>
7172
7173         * fileread.cc (find_or_make_view): Fix comment.
7174
7175 2010-03-23  Ian Lance Taylor  <iant@google.com>
7176
7177         * script-sections.cc (class Orphan_section_placement): Define
7178         PLACE_TLS and PLACE_TLS_BSS.
7179         (Orphan_section_placement::Orphan_section_placement): Initialize
7180         new places.
7181         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7182         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7183         (tls_script_test_SOURCES): Define.
7184         (tls_script_test_DEPENDENCIES): Define.
7185         (tls_script_test_LDFLAGS): Define.
7186         (tls_script_test_LDADD): Define.
7187         * testsuite/Makefile.in: Rebuild.
7188
7189 2010-03-22  Doug Kwan  <dougkwan@google.com>
7190
7191         * arm.cc (Arm_relocate_functions::abs8,
7192         Arm_relocate_functions::abs16): Use correct check for overflow
7193         specified in the ARM ELF specs.
7194         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7195         target of a BLX instruction specially.
7196         (Reloc_stub::stub_type_for_reloc): Ditto.
7197         (Relocate::relocate): Use symbolic names instead of numeric relocation
7198         codes to report error.
7199         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7200         workaround.
7201         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7202         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7203         thumb2_blx_out_of_range.stdout
7204         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7205         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7206         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7207         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7208         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7209         thumb2_blx_in_range, thumb2_blx_in_range.o,
7210         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7211         thumb2_blx_out_of_range.o): New rules.
7212         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7213         thumb2_blx_in_range and thumb2_blx_out_of_range.
7214         * testsuite/Makefile.in: Regenerate.
7215         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7216         * testsuite/thumb_blx_in_range.s: New file.
7217         * testsuite/thumb_blx_out_of_range.s: New file.
7218
7219 2010-03-22  Rafael Espindola  <espindola@google.com>
7220
7221         * archive.cc (Should_include): Move to archive.h.
7222         (should_include_member): Make it a member of Archive.
7223         (Lib_group): New.
7224         (Add_lib_group_symbols): New.
7225         * archive.h: Include options.h.
7226         (Archive_member): Moved from Archive.
7227         (Should_include): Moved from archive.cc.
7228         (Lib_group): New.
7229         (Add_lib_group_symbols): New.
7230         * dynobj.cc (do_should_include_member): New.
7231         * dynobj.h (do_should_include_member): New.
7232         * gold.cc (queue_initial_tasks): Update call to queue.
7233         * main.cc (main): Print lib group stats.
7234         * object.cc (do_should_include_member): New.
7235         * object.h: Include archive.h.
7236         (Object::should_include_member): New.
7237         (Object::do_should_include_member): New.
7238         (Sized_relobj::do_should_include_member): New.
7239         * options.cc (General_options::parse_start_lib): New.
7240         (General_options::parse_end_lib): New.
7241         (Input_arguments::add_file): Handle lib groups.
7242         (Input_arguments::start_group): Check we are not in a lib.
7243         (Input_arguments::start_lib): New.
7244         (Input_arguments::end_lib): New.
7245         * options.h (General_options): Add start_lib and end_lib.
7246         (Input_argument::lib_): New.
7247         (Input_argument::lib): New.
7248         (Input_argument::is_lib): New.
7249         (Input_file_lib): New.
7250         (Input_arguments::in_lib_): New.
7251         (Input_arguments::in_lib): New.
7252         (Input_arguments::start_lib): New.
7253         (Input_arguments::end_lib_): New.
7254         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7255         in unused members as preempted.
7256         (Sized_pluginobj::do_should_include_member): New.
7257         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7258         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7259         return the blocker.
7260         (Read_symbols::do_whole_lib_group): New.
7261         (Read_symbols::do_lib_group): New.
7262         (Read_symbols::do_read_symbols): Handle lib groups.
7263         (Read_symbols::get_name): Handle lib groups.
7264         * readsyms.h (Read_symbols): Add an archive member pointer.
7265         (Read_symbols::do_whole_lib_group): New.
7266         (Read_symbols::do_lib_group): New.
7267         (Read_symbols::member_): New.
7268         * script.cc (read_input_script): Update call to queue_soon.
7269
7270 2010-03-19  Doug Kwan  <dougkwan@google.com>
7271
7272         * arm.cc (Stub_table::Stub_table): Initialize new data members
7273         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7274         (Stub_table::add_reloc_stub): Assign stub offset and update
7275         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7276         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7277         New data members.
7278         (Stub_table::update_data_size_and_addralign): Use
7279         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7280         instead of going over all reloc stubs.
7281         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7282         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7283         Stringpool_template::offset_ to size of Stringpool_char.
7284         (Stringpool_template::new_key_offset): Remove code to initialize
7285         Stringpool_template::offset_.
7286         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7287         Stringpool_template::offset_ to zero.
7288
7289 2010-03-15  Doug Kwan  <dougkwan@google.com>
7290
7291         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7292         offset_.
7293         (Stringpool_template::new_key_offset): New method.
7294         (Stringpool_template::add_string): Assign offsets when adding new
7295         strings.
7296         (Stringpool_template::set_string_offsets): Do not set string offsets
7297         when not optimizing.
7298         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7299         member size_.
7300         (Chunked_vector::clear): Clear size_.
7301         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7302         (Chunked_vector::size): Return size_.
7303         (Chunked_vector::push_back): Use size_ to find insert position.
7304         (Chunked_vector::size_): New data member.
7305         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7306         (Stringpool_template::new_key_offset): New method declaration.
7307         (Stringpool_template::offset_): New data member.
7308
7309 2010-03-15   Rafael Espindola  <espindola@google.com>
7310
7311         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7312         Add_symbols' constructor.
7313         * readsyms.h (Add_symbols): Remove the input_group member.
7314
7315 2010-03-10  Ian Lance Taylor  <iant@google.com>
7316
7317         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7318         target to ask whether a reference to a symbol requires a stack
7319         split.
7320         * target.h (Target::is_call_to_non_split): New function.
7321         (Target::do_is_call_to_non_split): Declare virtual function.
7322         * target.cc: Include "symtab.h".
7323         (Target::do_is_call_to_non_split): New function.
7324         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7325
7326 2010-03-10  Cary Coutant  <ccoutant@google.com>
7327
7328         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7329         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7330         (File_read::open[2]): Add whole_file_view_ to list of views.
7331         (File_read::make_view): Remove test of whole_file_view_.
7332         (File_read::find_or_make_view): Create whole_file_view_ if
7333         necessary.
7334         (File_read::clear_views): Replace bool parameter with enum;
7335         adjust all callers.  Don't delete views with permanent data;
7336         do delete cached views and views from archives if
7337         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7338         if clearing the corresponding view.
7339         * fileread.h (File_read::Clear_views_mode): New enum.
7340         (File_read::View::is_permanent_view): New method.
7341         (File_read::clear_views): Replace bool parameter
7342         with enum; adjust all callers.
7343         * options.h (General_options): Change keep_files_mapped option;
7344         add map_whole_files.
7345         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7346         releasing the file.
7347         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7348         the file.
7349
7350 2010-03-10  David S. Miller  <davem@davemloft.net>
7351
7352         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7353
7354 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7355
7356         * icf.cc (get_section_contents): Add '@' marker after processing the
7357         merge reloc.
7358
7359 2010-03-08  Doug Kwan  <dougkwan@google.com>
7360
7361         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7362         due to a conversion warning.
7363         (Arm_relobj::update_output_local_symbol_count): Check for local
7364         symbol with unset output index.
7365
7366 2010-03-05  Ian Lance Taylor  <iant@google.com>
7367
7368         * options.h (class General_options): Add --spare-dynamic-tags.
7369         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7370         --spare-dynamic-tags.
7371
7372 2010-03-05  Ian Lance Taylor  <iant@google.com>
7373
7374         * incremental.cc: Include "libiberty.h".
7375
7376 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7377
7378         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7379         function, is_info_ member.
7380         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7381         (Versions::Versions): Update caller.
7382         (Versions::define_base_version): Likewise.
7383         (Versions::add_def): Likewise.
7384
7385 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7386
7387         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7388         (Scan::possible_function_pointer_reloc): New function.
7389         (Scan::local_reloc_may_be_function_pointer): Change to call
7390         possible_function_pointer_reloc.
7391         (Scan::global_reloc_may_be_function_pointer): Ditto.
7392         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7393         relocations in ".data.rel.ro._ZTV" section.
7394         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7395         * testsuite/icf_safe_so_test.cc: Ditto.
7396         * testsuite/icf_safe_test.cc: Ditto.
7397         * testsuite/icf_safe_test.sh: Ditto.
7398
7399 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7400             Ian Lance Taylor  <iant@google.com>
7401
7402         * target-reloc.h (relocate_section): Check the symbol table index
7403         for -1U before setting the local symbol index.
7404         (scan_relocatable_relocs): If copying the relocation, record that
7405         the local symbol is required.
7406         * object.h (Symbol_value::is_output_symtab_index_set): New
7407         function.
7408         (Symbol_value::may_be_discarded_from_output_symtab): New
7409         function.
7410         (Symbol_value::has_output_symtab_entry): New function.
7411         (Symbol_value::needs_output_symtab_entry): Remove.
7412         (Symbol_value::output_symtab_index): Make sure the symbol index is
7413         set.
7414         (Symbol_value::set_output_symtab_index): Make sure the symbol
7415         index is not set.  Make sure the new index is valid.
7416         (Symbol_value::set_must_have_output_symtab_entry): New function.
7417         (Symbol_value::has_output_dynsym_entry): New function.
7418         (Symbol_value::set_output_dynsym_index): Make sure the new index
7419         is valid.
7420         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7421         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7422         local symbol if permitted.
7423         (Sized_relobj::do_finalize_local_symbols): Call
7424         is_output_symtab_index_set rather than needs_output_symtab_entry.
7425         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7426         rather than needs_output_symtab_entry.  Call
7427         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7428         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7429         is_output_symtab_index_set rather than needs_output_symtab_entry.
7430         * testsuite/discard_locals_relocatable_test.c: New file.
7431         * testsuite/discard_locals_test.sh: Test -r.
7432         * testsuite/Makefile.am (check_DATA): Add
7433         discard_locals_relocatable_test1.syms,
7434         discard_local_relocatable_test2.syms.
7435         (MOSTLYCLEANFILES): Likewise.  Also add
7436         discard_locals_relocatable_test1.lout and
7437         discard_locals_relocatable_test2.out.
7438         (discard_locals_relocatable_test1.syms): New target.
7439         (discard_locals_relocatable_test.o): New target.
7440         (discard_locals_relocatable_test1.out): New target.
7441         (discard_locals_relocatable_test2.syms): New target.
7442         (discard_locals_relocatable_test2.out): New target.
7443         (various): Add missing ../ld-new dependencies.
7444         * testsuite/Makefile.in: Rebuild.
7445
7446 2010-03-03  Nick Clifton  <nickc@redhat.com>
7447
7448         * po/fi.po: New Finnish translation.
7449
7450 2010-03-01  Doug Kwan  <dougkwan@google.com>
7451
7452         * layout.cc (Layout::Layout): Force section types of .init_array*,
7453         .preinit_array* and .fini_array* sections.
7454         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7455         Fix check of return value of std::string::find.().
7456         (Output_section::Input_section_sort_compare::operator()): Remove
7457         comment about .init_array.
7458         (Output_section::Input_section_sort_init_fini_compare::operator()):
7459         New method.
7460         (Output_section::sort_attached_input_sections): Handle .init_array
7461         and .fini_array specially.
7462         * output.h (Output_section::Inut_section_sort_compare): Update
7463         comment.
7464         (Output_section::Input_section_sort_init_fini_compare): New struct.
7465
7466 2010-02-26  Doug Kwan  <dougkwan@google.com>
7467
7468         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7469         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7470         * testsuite/debug_msg.sh: Avoid matching source line number for
7471         use of global variable undef_int.
7472
7473 2010-02-26  Doug Kwan  <dougkwan@google.com>
7474
7475         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7476         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7477         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7478         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7479         * options.cc (General_options::General_options): Initialize member
7480         fix_v4bx_.
7481         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7482         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7483         and rm_no_fix_v4bx.stdout
7484         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7485         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7486         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7487         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7488         and arm_no_fix_v4bx.
7489         * Makefile.in: Regenerate.
7490         * testsuite/arm_fix_v4bx.s: New file.
7491         * testsuite/arm_fix_v4bx.sh: Ditto.
7492
7493 2010-02-24  Doug Kwan  <dougkwan@google.com>
7494
7495         * arm.cc (Target_arm::got_section): Make the .got section the first
7496         non RELRO section in the data segment.
7497         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7498         suffixes of section names.
7499
7500 2010-02-24  Doug Kwan  <dougkwan@google.com>
7501
7502         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7503         flags and attributes merging if an input file is a binary file.
7504         * fileread.cc (Input_file::open): Record format of original file.
7505         * fileread.h (Input_file::Format): New enum type.
7506         (Input_file::Input_file): Initialize data member format_.
7507         (Input_file::format): New method definition.
7508         (Input_file::format_):: New data member.
7509
7510 2010-02-24  Doug Kwan  <dougkwan@google.com>
7511
7512         * arm.cc (Arm_output_data_got): New class.
7513         (ARM_TCB_SIZE): New constant
7514         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7515         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7516         If user uses a script with a SECTIONS clause, issue only a warning
7517         for a misplaced EXIDX input section.  Otherwise, issue an error.
7518         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7519         garbage collection.
7520         (Target_arm::got_mode_index_entry): Handle static linking.
7521         (Target_arm::Scan::local): Ditto.
7522         (Target_arm::Scan::global): Ditto.
7523         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7524         all incorrectly implemented relocations.
7525         (Target_arm::fix_exidx_coverage): Pass layout to
7526         Arm_output_section::fix_exidx_coverage.
7527         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7528         from ".ARM.exidx." and ".ARM.extab.".
7529
7530 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7531
7532         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7533         section if it does not already exist.
7534         * attributes.cc (Attributes_section_data::Attributes_section_data):
7535         Don't crash if size is zero.
7536
7537 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7538             Ian Lance Taylor  <iant@google.com>
7539
7540         * gold.cc (queue_middle_tasks): If no input files were opened,
7541         exit.
7542         * workqueue.h (Task_function::Task_function): Assert that there is
7543         a blocker.
7544
7545 2010-02-22  Doug Kwan  <dougkwan@google.com>
7546
7547         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7548         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7549         types to avoid warnings due to different uint64_t implementations
7550         on different hosts.
7551
7552 2010-02-21  Doug Kwan  <dougkwan@google.com>
7553
7554         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7555         handling of the maximum backward branch offset.
7556         (Arm_relocate_functions::thumb_branch_common): Ditto.
7557         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7558         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7559         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7560         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7561         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7562         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7563         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7564         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7565         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7566         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7567         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7568         thumb2_bl_out_of_range.o): New rules.
7569         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7570         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7571         thumb2_bl_out_of_range
7572         * testsuite/Makefile.in: Regenerate.
7573         * testsuite/arm_bl_in_range.s: New file.
7574         * testsuite/arm_bl_out_of_range.s: Ditto.
7575         * testsuite/arm_branch_in_range.sh: Ditto.
7576         * testsuite/arm_branch_range.t: Ditto.
7577         * testsuite/thumb2_branch_range.t: Ditto.
7578         * testsuite/thumb_bl_in_range.s: Ditto.
7579         * testsuite/thumb_bl_out_of_range.s: Ditto.
7580         * testsuite/thumb_branch_range.t: Ditto.
7581
7582 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7583
7584         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7585         Add reloc offset information.
7586         * icf.cc (get_section_contents): Change iterators to point to the new
7587         vectors. Add reloc offset information to the contents.
7588         * icf.h (Icf::Sections_reachable_info): New typedef.
7589         (Icf::Sections_reachable_list): New typedef.
7590         (Icf::Offset_info): New typedef.
7591         (Icf::Reloc_info): New struct typedef.
7592         (Icf::Reloc_info_list): New typedef.
7593         (Icf::symbol_reloc_list): Delete method.
7594         (Icf::addend_reloc_list): Delete method.
7595         (Icf::section_reloc_list): Delete method.
7596         (Icf::reloc_info_list): New method.
7597         (Icf::reloc_info_list_): New member.
7598
7599 2010-02-19  Doug Kwan  <dougkwan@google.com>
7600
7601         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7602         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7603         * arm.cc (Arm_relocation_functions): New forward declaration.
7604         (Target_arm::Target_arm): Initialize new data members
7605         got_mod_index_offset_ and tls_base_symbol_defined_.
7606         (Target_arm::Relocate::relocate_tls): New method.
7607         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7608          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7609         New methods.
7610         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7611         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7612         (Target_arm::got_mod_index_offset_,
7613         Target_arm::tls_base_symbol_defined_): New data members.
7614         (Target_arm::Scan::local, Target::Scan::global,
7615         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7616         relocations.
7617
7618 2010-02-18  Doug Kwan  <dougkwan@google.com>
7619
7620         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7621         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7622         text section as a parameter becuase some broken tools may not set
7623         the link in section header.
7624         (Target_arm::has_got_section): New method.
7625         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7626         without any mapping symbol as data only.  Remove warning.
7627         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7628         link in its section header, try to discover the link by inspecting the
7629         REL31 relocation at the beginning of the section.
7630         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7631         in error message.
7632         (Target_arm::Scan::global): Treat any reference to the symbol
7633         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7634
7635 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7636
7637         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7638         (Scan::global_reloc_may_be_function_pointer): New function.
7639         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7640         (Scan::global_reloc_may_be_function_pointer): New function.
7641         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7642         (Scan::global_reloc_may_be_function_pointer): New function.
7643         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7644         (Scan::global_reloc_may_be_function_pointer): New function.
7645         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7646         (Scan::global_reloc_may_be_function_pointer): New function.
7647         (Scan::possible_function_pointer_reloc): New function.
7648         (Target_x86_64::can_check_for_function_pointers): New function.
7649         * gc.h (gc_process_relocs): Scan relocation types to determine if
7650         function pointers were taken for targets that support it.
7651         * icf.cc (Icf::find_identical_sections): Include functions for
7652         folding in safe ICF whose pointer is not taken.
7653         * icf.h (Secn_fptr_taken_set): New typedef.
7654         (fptr_section_id_): New member.
7655         (section_has_function_pointers): New function.
7656         (set_section_has_function_pointers): New function.
7657         (check_section_for_function_pointers): New function.
7658         * options.h: Fix comment for safe ICF option.
7659         * target.h (can_check_for_function_pointers): New function.
7660         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7661         Modify icf_safe_test for X86-64.
7662         * testsuite/Makefile.in: Regenerate.
7663         * testsuite/icf_safe_so_test.cc: New file.
7664         * testsuite/icf_safe_so_test.sh: New file.
7665         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7666         (main): Change to take pointer to function kept_func_3.
7667         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7668         folding is done correctly for X86-64.
7669
7670 2010-02-12  David S. Miller  <davem@davemloft.net>
7671
7672         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7673         is_symbolless parameter.
7674         (Output_reloc<SHT_REL>::is_symbolless): New.
7675         (Output_reloc<SHT_REL>::is_symbolless_): New.
7676         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7677         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7678         (Output_reloc<SHT_RELA>::is_symbolless): New.
7679         (Output_data_reloc::add_global): Handle is_symbolless.
7680         (Output_data_reloc::add_global_relative): Likewise.
7681         (Output_data_reloc::add_local): Likewise.
7682         (Output_data_reloc::add_local_relative): Likewise.
7683         (Output_data_reloc::add_symbolless_global_addend): New.
7684         (Output_data_reloc::add_symbolless_local_addend): New.
7685         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7686         is_symbolless.
7687         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7688         instead of ->is_relative_
7689         (Output_reloc::write): Likewise.
7690         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7691         (Output_reloc::write_rel): Simplify.
7692
7693         * sparc.cc (Target_sparc::Scan::local): Use
7694         ->add_symbolless_local_addend as needed.
7695         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7696         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7697         based upon relocation offset.
7698
7699 2010-02-11  Doug Kwan  <dougkwan@google.com>
7700
7701         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7702         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7703         beginning of function.
7704         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7705         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7706         parameter is_32bit in calls to should_apply_static_reloc.
7707         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7708         (check_DATA): Add arm_abs_global.stdout.
7709         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7710         arm_abs_global.stdout): New rules.
7711         (MOSTLLYCLEANFILES): Add arm_abs_global
7712         * Makefile.in: Regenerate.
7713         * testsuite/arm_abs_global.s: New file.
7714         * testsuite/arm_abs_global.sh: Ditto.
7715         * testsuite/arm_abs_lib.s: Ditto.
7716
7717 2010-02-11  Ian Lance Taylor  <iant@google.com>
7718
7719         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7720         Read_relocs task.
7721         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7722         Allocate_commons_task first.
7723         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7724         task, rather than symtab_lock_.
7725         (Gc_process_relocs::~Gc_process_relocs): New function.
7726         (Gc_process_relocs::is_runnable): Check this_blocker_.
7727         (Gc_process_relocs::locks): Use next_blocker_ rather than
7728         blocker_.
7729         (Scan_relocs::~Scan_relocs): New function.
7730         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7731         symtab_lock_.
7732         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7733         next_blocker_.
7734         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7735         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7736         constructor accordingly.
7737         (class Gc_process_relocs): Likewise.
7738         (class Scan_relocs): Likewise.
7739         * common.h (class Allocate_commons_task): Remove symtab_lock_
7740         field, and corresponding constructor parameter.
7741         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7742         symtab_lock_.
7743         (Allocate_commons_task::locks): Likewise.
7744
7745 2010-02-11  Ian Lance Taylor  <iant@google.com>
7746
7747         * gold-threads.h (class Once): Define.
7748         (class Initialize_lock): Rewrite as child of Once.
7749         * gold-threads.cc (class Once_initialize): Define.
7750         (once_pointer_control): New static variable.
7751         (once_pointer, once_arg): New static variables.
7752         (c_run_once): New static function.
7753         (Once::Once, Once::run_once, Once::internal_run): New functions.
7754         (class Initialize_lock_once): Remove.
7755         (initialize_lock_control): Remove.
7756         (initialize_lock_pointer): Remove.
7757         (initialize_lock_once): Remove.
7758         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7759         (Initialize_lock::initialize): Rewrite.
7760         (Initialize_lock::do_run_once): New function.
7761         * archive.cc (Archive::interpret_header): Only clear name if it is
7762         not already empty.
7763         * fileread.cc: Include "gold-threads.h"
7764         (file_counts_lock): New static variable.
7765         (file_counts_initialize_lock): Likewise.
7766         (File_read::release): Only increment counts when using --stats.
7767         Use a lock around the increment.
7768         * parameters.cc (class Set_parameters_target_once): Define.
7769         (set_parameters_target_once): New static variable.
7770         (Parameters::Parameters): Move here from parameters.h.
7771         (Parameters::set_target): Rewrite.
7772         (Parameters::set_target_once): New function.
7773         (Parameters::clear_target): Move here and rewrite.
7774         * parameters.h (class Parameters): Update declarations.  Add
7775         set_parameters_target_once_ field.
7776         (Parameters::Parameters): Move to parameters.cc.
7777         (Parameters::clear_target): Likewise.
7778         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7779         task.
7780         (Start_group::~Start_group): New function.
7781         (Start_group::is_runnable): New function.
7782         (Start_group::locks, Start_group::run): New functions.
7783         (Finish_group::run): Change saw_undefined to size_t.
7784         * readsyms.h (class Start_group): Define.
7785         (class Finish_group): Change saw_undefined_ field to size_t.
7786         (Finish_group::Finish_group): Remove saw_undefined and
7787         this_blocker parameters.  Change all callers.
7788         (Finish_group::set_saw_undefined): New function.
7789         (Finish_group::set_blocker): New function.
7790         * symtab.h (class Symbol_table): Change saw_undefined to return
7791         size_t.  Change saw_undefined_ field to size_t.
7792         * target-select.cc (Set_target_once::do_run_once): New function.
7793         (Target_selector::Target_selector): Initialize set_target_once_
7794         field.  Don't initialize lock_ and initialize_lock_ fields.
7795         (Target_selector::instantiate_target): Rewrite.
7796         (Target_selector::set_target): New function.
7797         * target-select.h (class Set_target_once): Define.
7798         (class Target_selector): Update declarations.  Make
7799         Set_target_once a friend.  Remove lock_ and initialize_lock_
7800         fields.  Add set_target_once_ field.
7801
7802 2010-02-10  Ian Lance Taylor  <iant@google.com>
7803
7804         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7805         queueing any tasks.
7806         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7807         (queue_middle_tasks): Add all blockers before queueing any tasks.
7808         (queue_final_tasks): Likewise.
7809         * token.h (Task_token::add_blockers): New function.
7810         * object.h (Input_objects::number_of_relobjs): New function.
7811
7812 2010-02-10  Ian Lance Taylor  <iant@google.com>
7813
7814         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7815         shared, not if not position independent.
7816         * x86_64.cc (Relocate::relocate_tls): Likewise.
7817         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7818         (tls_pie_pic_test): New target.
7819         * testsuite/Makefile.in: Rebuild.
7820
7821         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7822         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7823         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7824         * testsuite/Makefile.in: Rebuild.
7825
7826 2010-02-09  David S. Miller  <davem@davemloft.net>
7827
7828         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7829         R_SPARC_RELATIVE using ->add_local_relative().
7830         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7831
7832         * output.h (Output_data_dynamic::add_section_size): New method
7833         that takes two Output_data objects.
7834         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7835         entry param.  Handle it in initializers.
7836         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7837         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7838         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7839         arg.
7840         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7841         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7842         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7843         for dynrel_includes_plt.
7844         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7845         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7846         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7847         before .rela.plt
7848         (Target_sparc::do_finalize_sections): Update to pass true for
7849         dynrel_includes_plt.
7850         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7851         output before .rela.plt
7852         (Target_powerpc::do_finalize_sections): Update to pass true for
7853         dynrel_includes_plt when 32-bit.
7854
7855 2010-02-08  Doug Kwan  <dougkwan@google.com>
7856
7857         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7858         method.
7859         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7860         Arm_relobj::scan_section_for_cortex_a8_stubs,
7861         Arm_relobj::do_relocation_section): Instead of calling
7862         Output_section::output_address, use faster
7863         Arm_relobj::simple_input_section_output_address.
7864
7865 2010-02-08  David S. Miller  <davem@davemloft.net>
7866
7867         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7868         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7869         relocation helper function.
7870
7871         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7872         just like R_SPARC_GOT{10,13,22}.
7873         (Target_sparc::Scan::local): Likewise.
7874         (Target_sparc::Relocate:relocate): Likewise.
7875
7876 2010-02-06  Ian Lance Taylor  <iant@google.com>
7877
7878         * configure.ac: Rewrite targetobjs duplicate removal code to use
7879         only shell constructs.
7880         * configure: Rebuild.
7881
7882 2010-02-05  Doug Kwan  <dougkwan@google.com>
7883
7884         PR 11247
7885         * arm.cc (Arm_relobj::section_is_scannable): New method.
7886         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7887         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7888
7889 2010-02-04  Doug Kwan  <dougkwan@google.com>
7890
7891         PR 11247
7892         * arm-reloc-property.cc (cstdio): Include.
7893         * configure.ac (targetobjs): Remove duplicates.
7894         * configure: Regenerate.
7895         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7896         big and little endian version for a given address size.
7897
7898 2010-02-03  Doug Kwan  <dougkwan@google.com>
7899
7900         * arm-reloc-property.cc
7901         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7902         definition.
7903         * arm-reloc-property.h
7904         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7905         New method definition.
7906         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7907         declaration.
7908         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7909         overflow to N.
7910         (GOT_PREL): Change implemented to Y.
7911         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7912         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7913         (Arm_relocate_functions::movw_abs_nc): Remove method.
7914         (Arm_relocate_functions::movt_abs): Ditto.
7915         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7916         (Arm_relocate_functions::thm_movt_abs): Ditto.
7917         (Arm_relocate_functions::movw_rel_nc): Ditto.
7918         (Arm_relocate_functions::movw_rel): Ditto.
7919         (Arm_relocate_functions::movt_rel): Ditto.
7920         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7921         (Arm_relocate_functions:thm_movw_rel): Ditto.
7922         (Arm_relocate_functions:thm_movt_rel): Ditto.
7923         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7924         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7925         New method definitions.
7926         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7927         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7928         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7929         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7930         (Target_arm::Relocate::relocate): Check for non-static or
7931         unimplemented relocation code and exit early.  Change calls to
7932         Target_arm::reloc_uses_thumb_bit and
7933         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7934         instead.  Refactor code to handle similar relocations to increase
7935         code sharing.  Remove check for unsupported relocation code in switch
7936         statement.
7937         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7938         relocation property table to find out size.  Change error message to
7939         print out the name of a relocation code instead of the numeric value.
7940         (Target_arm::scan_reloc_for_stub): Use relocation property table
7941         instead of calling Target_arm::reloc_uses_thumb_bit().
7942
7943 2010-02-02  Doug Kwan  <dougkwan@google.com>
7944
7945         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7946         types of relaxed input section.
7947
7948 2010-02-02  Doug Kwan  <dougkwan@google.com>
7949
7950         * Makefile.am (HFILES): Add arm-reloc-property.h.
7951         (DEFFILES): New.
7952         (TARGETSOURCES): Add arm-reloc-property.cc
7953         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7954         (libgold_a_SOURCES): $(DEFFILES)
7955         * Makefile.in: Regenerate.
7956         * arm-reloc-property.cc: New file.
7957         * arm-reloc-property.h: New file.
7958         * arm-reloc.def: New file.
7959         * arm.cc: Update comments.
7960         (arm-reloc-property.h): New included header.
7961         (arm_reloc_property_table): New global variable.
7962         (Target_arm::do_select_as_default_target): New method definition.
7963         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7964         arm-reloc-property to targ_extra_obj.
7965         * parameters.cc (set_parameters_target): Call
7966         Target::select_as_default_target().
7967         * target.h (Target::select_as_default_target): New method definition.
7968         (Target::do_select_as_default_target): Same.
7969
7970 2010-02-01  Doug Kwan  <dougkwan@google.com>
7971
7972         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7973         first_output_text_section_.
7974         (Arm_exidx_fixup::first_output_text_section): New method definition.
7975         (Arm_exidx_fixup::first_output_text_section_): New data member.
7976         (Arm_exidx_fixup::process_exidx_section): Record the first text
7977         output section seen.
7978         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7979         and entsize in output section header.
7980
7981 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7982
7983         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7984         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7985         (Arm_relocate_functions::thm_alu11): New Method.
7986         (Arm_relocate_functions::thm_pc8): New Method.
7987         (Arm_relocate_functions::thm_pc12): New Method.
7988         (Target_arm::Scan::local): Handle the relocations.
7989         (Target_arm::Scan::global): Likewise.
7990         (Target_arm::Relocate::relocate): Likewise.
7991         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7992
7993 2010-01-29  Doug Kwan  <dougkwan@google.com>
7994
7995         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7996         of relocation types as ld.
7997
7998 2010-01-29  Doug Kwan  <dougkwan@google.com>
7999
8000         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8001         to public.
8002         (Arm_relocate_functions::thumb_branch_common): Ditto.
8003         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8004         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8005         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8006         Arm_relocate_functions::jump24): Remove.
8007         (Target_arm::Relocate::relocate): Adjust code to call
8008         Arm_relocation_functions::arm_branch_common and
8009         Arm_relocation_functions::thumb_branch_common instead of their removed
8010         wrappers.  Merge switch-cases together to reduce source code size.
8011
8012 2010-01-29  Doug Kwan  <dougkwan@google.com>
8013
8014         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8015         output_local_symbol_count_needs_update_.
8016         (Arm_relobj::output_local_symbol_count_needs_update,
8017          Arm_relobj::set_output_local_symbol_count_needs_update,
8018          Arm_relobj::update_output_local_symbol_count): New methods.
8019         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8020         member.
8021         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8022         of pointed function as in a R_ARM_PREL31 relocation.
8023         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8024         for output local symbol count updating.
8025         (Target_arm::do_relax): Update output local symbol counts in objects
8026         if necessary.
8027         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8028
8029 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8030
8031         * arm.cc: Added support for the ARM relocations:
8032         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8033         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8034         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8035         movw_prel_nc).
8036         (Arm_relocate_functions::movw_rel): New method.
8037         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8038         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8039         thm_movw_prel_nc).
8040         (Arm_relocate_functions::thm_movw_rel): New method.
8041         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8042         thm_movt_prel).
8043         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8044         relocations.
8045         (Target_arm::Scan::global): Likewise.
8046         (Target_arm::Relocate::relocate): Likewise.
8047         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8048         Likewise.
8049
8050 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8051
8052         * arm.cc: Added support for ARM group relocations.
8053         (Target_arm::reloc_needs_sym_origin): New method.
8054         (Arm_relocate_functions::calc_grp_kn): New method.
8055         (Arm_relocate_functions::calc_grp_residual): New method.
8056         (Arm_relocate_functions::calc_grp_gn): New method.
8057         (Arm_relocate_functions::arm_grp_alu): New Method.
8058         (Arm_relocate_functions::arm_grp_ldr): New Method.
8059         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8060         (Arm_relocate_functions::arm_grp_ldc): New Method.
8061         (Target_arm::Scan::local): Handle the ARM group relocations.
8062         (Target_arm::Scan::global): Likewise.
8063         (Target_arm::Relocate::relocate): Likewise.
8064         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8065         Likewise.
8066
8067 2010-01-26  Doug Kwan  <dougkwan@google.com>
8068
8069         * arm.cc (set): Include.
8070         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8071         pointer type.
8072         (Arm_output_section::Text_section_list): New type.
8073         (Arm_output_section::append_text_sections_to_list): New method.
8074         (Arm_output_section::fix_exidx_coverage): Ditto.
8075         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8076         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8077         Relobj::set_section_offset() instead of
8078         Sized_relobj::invalidate_section_offset().
8079         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8080         parameter for section headers. Ignore relocation sections for
8081         unallocated sections and EXIDX sections.
8082         (Target_arm::fix_exidx_coverage): New method.
8083         (Target_arm::output_section_address_less_than): New type.
8084         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8085         linked text section instead of the EXIDX section.
8086         (Arm_output_section::create_stub_group): Add an assertion to check
8087         that this is not an EXIDX output section.
8088         (Arm_output_section::append_text_sections_to_list): New method.
8089         (Arm_output_section::fix_exidx_coverage): Ditto.
8090         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8091         Arm_relobj::section_needs_reloc_stub_scanning.
8092         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8093         first pass.
8094         (Target_arm::fix_exidx_coverage): New method.
8095         * object.h (Relobj::set_output_section): New method.
8096         (Sized_relobj::invalidate_section_offset): Remove method.
8097         (Sized_relobj::do_invalidate_section_offset): Remove method.
8098         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8099
8100 2010-01-25  Doug Kwan  <dougkwan@google.com>
8101
8102         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8103         Fix warning due to signed and unsigned comparison on a 32-bit host.
8104
8105 2010-01-22  Doug Kwan  <dougkwan@google.com>
8106
8107         * arm.cc (Target_arm::do_relax): Record an output section for section
8108         offset adjustment it contains any stub table that has changed.
8109         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8110         offsets in an output section if necessary.
8111         * output.cc (Output_section::Output_section): Initialize
8112         section_offsets_need_adjustments_.
8113         (Output_section::add_input_section_for_script): Renamed to
8114         Output_section::add_simple_input_section.
8115         (Output_section::save_states): Add a comment.
8116         (Output_section::discard_states): New method defintion.
8117         (Output_section::adjust_section_offsets): Same.
8118         * output.h (Output_section::add_input_section_for_script): Renamed to
8119         Output_section::add_simple_input_section.
8120         (Output_section::discard_states): New method declaration.
8121         (Output_section::adjust_section_offsets): Same.
8122         (Output_section::section_offsets_need_adjustment,
8123         Output_section::set_section_offsets_need_adjustment): New method
8124         definitions.
8125         (Output_section::section_offsets_need_adjustment_): New data member.
8126         * script-sections.cc
8127         (Output_section_element_input::set_section_address): Adjust code for
8128         renaming of Output_section::add_input_section_for_script.
8129         (Orphan_output_section::set_section_address): Same.
8130
8131 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8132
8133         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8134         Fix_v4bx enum values .
8135         * gold/options.h (General_options): New option definitions.
8136         (General_options::fix_v4bx): New method.
8137         (General_options::Fix_v4bx): New enum.
8138         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8139         (General_options::parse_fix_v4bx_interworking): New method.
8140
8141 2010-01-22  Doug Kwan  <dougkwan@google.com>
8142
8143         * arm.cc (Arm_exidx_fixup): New class.
8144
8145 2010-01-21  Doug Kwan  <dougkwan@google.com>
8146
8147         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8148         classes.
8149         (Arm_exidx_section_offset_map): New type.
8150
8151 2010-01-21  Doug Kwan  <dougkwan@google.com>
8152
8153         * arm.cc (Arm_exidx_input_section): New class.
8154         (Arm_relobj::exidx_input_section_by_link,
8155         Arm_relobj::exidx_input_section_by_shndx,
8156         Arm_relobj::make_exidx_input_section): New methods.
8157         (read_arm_attributes_section): Remove.
8158         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8159         information about them.
8160         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8161         to here.
8162
8163 2010-01-20  Doug Kwan  <dougkwan@google.com>
8164
8165         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8166         Input_section_specifier to Section_id.
8167         (Target_arm::new_arm_input_section: Adjust code for change of key
8168         type.
8169         (Target_arm::find_arm_input_section): Ditto.
8170         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8171         (Section_id): Remove.
8172         (Garbage_collection::Section_id_hash): Remove.
8173         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8174         (Section_id): Remove.
8175         (Icf::Section_id_hash): Remove.
8176         * object.h (Section_id, Const_section_id, Section_id_hash,
8177         Const_section_id_hash): New type definitions.
8178         * output.cc (Output_section::add_relaxed_input_section): Change to
8179         use Const_section_id instead of Input_section_specifier as key type.
8180         (Output_section::add_merge_input_section): Ditto.
8181         (Output_section::build_relaxation_map): Change to use Section_id
8182         instead of Input_section_specifier as key type.
8183         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8184         Ditto.
8185         (Output_section::convert_input_sections_to_relaxed_sections): Change
8186         to use Const_section_id instead of Input_section_specifier as key type.
8187         (Output_section::find_merge_section): Ditto.
8188         (Output_section::find_relaxed_input_section): Ditto.
8189         * output.h (Input_section_specifier): Remove class.
8190         (Output_section::Output_section_data_by_input_section_map): Change
8191         key type to Const_section_id.
8192         (Output_section::Output_relaxed_input_section_by_input_section_map):
8193         Ditto.
8194         (Output_section::Relaxation_map): Change key type to Section_id.
8195
8196 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8197
8198         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8199         (class Arm_v4bx_stub): New class.
8200         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8201         (Stub_factory::make_arm_v4bx_stub): New method.
8202         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8203         (Stub_table::empty): Handle v4bx stubs.
8204         (Stub_table::add_arm_v4bx_stub): New method.
8205         (Stub_table::find_arm_v4bx_stub): New method.
8206         (Arm_relocate_functions::v4bx): New method.
8207         (Target_arm::fix_v4bx): New method.
8208         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8209         (Stub_table::relocate_stubs): Likewise.
8210         (Stub_table::do_write): Likewise.
8211         (Stub_table::update_data_size_and_addralign): Likewise.
8212         (Stub_table::finalize_stubs):  Likewise.
8213         (Target_arm::Scan::local): Likewise.
8214         (Target_arm::Scan::global): Likewise.
8215         (Target_arm::do_finalize_sections): Likewise.
8216         (Target_arm::Relocate::relocate): Likewise.
8217         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8218         Likewise.
8219         (Target_arm::scan_reloc_for_stub): Likewise.
8220         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8221
8222 2010-01-19  Ian Lance Taylor  <iant@google.com>
8223
8224         * output.cc (Output_section_headers::do_sized_write): Write large
8225         segment count to sh_info field.
8226         (Output_file_header::do_sized_write): For large segment count,
8227         write PN_XNUM to e_phnum field.
8228
8229 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8230
8231         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8232         (Arm_relocate_functions::thm_jump8): New function.
8233         (Arm_relocate_functions::thm_jump11): New function.
8234         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8235         R_ARM_THM_JUMP11.
8236         (Target_arm::Scan::global): Likewise.
8237         (Target_arm::Relocate::relocate): Likewise.
8238         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8239         Likewise.
8240
8241 2010-01-14  Doug Kwan  <dougkwan@google.com>
8242
8243         * arm.cc (map, utility): Include headers.
8244         (Target_arm::apply_cortex_a8_workaround): New method.
8245         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8246         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8247         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8248         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8249         the --[no-]fix-cortex-a8 command line options.
8250         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8251         (Target_arm::relocate_stub): Use addend in instruction template.
8252         * options.h (DEFINE_bool): Set the user-set flag.
8253         (General_options): Add --[no-]-fix-cortex options.
8254         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8255         : Update fast look-up map after conversion.
8256
8257 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8258
8259         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8260         in the first pass of do_layout.
8261
8262 2010-01-13  Doug Kwan  <dougkwan@google.com>
8263
8264         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8265         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8266         apparent compiler problem of not folding static constant integral
8267         data members of elfcpp::Elf_sizes<32>.
8268
8269 2010-01-13  Doug Kwan  <dougkwan@google.com>
8270
8271         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8272         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8273         Arm_relobj::scan_section_for_cortex_a8_erratum,
8274         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8275         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8276         sections to scan for relocation stubs into a new method
8277         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8278         relocation and Cortex-A8 stub scanning.
8279         (Target_arm::do_relax): Force stubs to be after stubbed sections
8280         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8281         the beginning of a new relaxation pass.  Update a comment.
8282         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8283
8284 2010-01-12  Ian Lance Taylor  <iant@google.com>
8285
8286         * target-reloc.h (visibility_error): New inline function.
8287         (relocate_section): Call visibility_error.
8288         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8289         (MOSTLYCLEANFILES): Likewise.
8290         (protected_4_pic.o, protected_3.err): New targets.
8291         * testsuite/protected_4.cc: New file.
8292
8293 2010-01-12  Doug Kwan  <dougkwan@google.com>
8294
8295         * arm.cc (Cortex_a8_reloc): New class.
8296         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8297         and cortex_a8_relocs_info_.
8298         (Target_arm::fix_cortex_a8): New method definition.
8299         (Target_arm::Cortex_a8_relocs_info): New type.
8300         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8301         New data member declarations.
8302         (Target_arm::scan_reloc_for_stub): Record information about
8303         relocations for THUMB branches that might be exempted from the
8304         Cortex-A8 workaround.
8305         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8306         at the beginning of a relaxation pass.
8307
8308 2010-01-12  Doug Kwan  <dougkwan@google.com>
8309
8310         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8311         (Arm_relobj::Mapping_symbol_position,
8312          Arm_reloj::Mapping_symbol_position_less,
8313          Arm_relobj::Mapping_symbols_info): New types.
8314         (Target_arm::is_mapping_symbol_name): New method definition.
8315         (Arm_relobj::do_count_local_symbols): Save information about mapping
8316         symbols.
8317
8318 2010-01-11  Doug Kwan  <dougkwan@google.com>
8319
8320         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8321         Arm_relocate_functions::thumb32_branch_upper,
8322         Arm_relocate_functions::thumb32_branch_lower,
8323         Arm_relocate_functions::thumb32_cond_branch_offset,
8324         Arm_relocate_functions::thumb32_cond_branch_upper,
8325         Arm_relocate_functions::thumb32_cond_branch_lower,
8326         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8327         branch offset encoding.
8328         (Arm_relocate_functions::thumb_branch_common): Use new branch
8329         offset encoding methods to avoid code duplication.
8330         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8331         (Stub_addend_reader::operator()): Use new branch encoding method
8332         to avoid code duplication.
8333
8334 2010-01-11  Doug Kwan  <dougkwan@google.com>
8335
8336         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8337         (Target_arm::do_finalize_sections): Define special EXIDX section
8338         symbols only if referenced.
8339         * gc.h (Garbage_collection::add_reference): New method.
8340         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8341         code duplication.
8342
8343 2010-01-11  Ian Lance Taylor  <iant@google.com>
8344
8345         * script.cc (Version_script_info::build_expression_list_lookup):
8346         Change complaing about duplicate wildcard match from error to
8347         warning.
8348
8349         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8350         of 2009-12-30.
8351         (Version_script_info::Version_script_info): Initialize globs_,
8352         default_version_, default_is_global_, and exact_.  Don't
8353         initialize globals_ or locals_.
8354         (Version_script_info::build_lookup_tables): Build local symbols
8355         first.
8356         (Version_script_info::unquote): New function.
8357         (Version_script_info::add_exact_match): New function.
8358         (Version_script_info::build_expression_list_lookup): Remove lookup
8359         parameter.  Add is_global parameter.  Change all callers.  Handle
8360         wildcard pattern specially.  Unquote pattern.  Call
8361         add_exact_match.
8362         (Version_script_info::get_name_to_match): New function.
8363         (Version_script_info::get_symbol_version): New function.
8364         (Version_script_info::get_symbol_version_helper): Remove.
8365         (Version_script_info::check_unmatched_names): Call unquote.
8366         * script.h (class Version_script_info): Change get_symbol_version
8367         to be non-inline and add is_global parameter; change all callers.
8368         Rewrite symbol_is_local.  Update declarations.  Define struct
8369         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8370         Remove globals_ and locals_ members.  Add exact_, globs_,
8371         default_version_, is_global_.
8372         (Version_script_info::Glob): Remove pattern, add expression and
8373         is_global.  Update constructor.  Change all callers.
8374         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8375         default version.
8376         (Versions::symbol_section_contents): If a symbol is undefined, or
8377         defined in a dynamic object, set the version index to
8378         VER_NDX_LOCAL.
8379         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8380         symbol_is_local.
8381         (Symbol_table::add_from_pluginobj): Likewise.
8382         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8383
8384 2010-01-11  Doug Kwan  <dougkwan@google.com>
8385
8386         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8387         (incremental_dump_LDADD): Add linking option for libintl.
8388         * Makefile.in: Regenerate.
8389
8390 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8391
8392         PR gold/11144
8393         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8394         instead of -Ds.
8395         * testsuite/Makefile.in: Regenerated.
8396
8397 2010-01-10  Doug Kwan  <dougkwan@google.com>
8398
8399         * options.h (DEFINE_var): Use parentheses around argument varname__
8400         in macro body to avoid any unintended subsequent substitutions.
8401
8402 2010-01-10  Ian Lance Taylor  <iant@google.com>
8403
8404         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8405         candidates before doing symbol resolution.
8406
8407         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8408         ODR candidates if only one is weak.
8409
8410 2010-01-08  Ian Lance Taylor  <iant@google.com>
8411
8412         * script.cc (Version_script_info::build_expression_list_lookup):
8413         Don't warn about ambiguous version, just record the ambiguity.
8414         (Version_script_info::get_symbol_version_helper): Give error if
8415         version is ambiguous.
8416
8417 2010-01-08  Doug Kwan  <dougkwan@google.com>
8418
8419         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8420         prev_data_size_ and prev_addralign_.  Remove initializer for
8421         deleted data member has_been_changed_.
8422         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8423         to determine if the table is empty.
8424         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8425         Remove.
8426         (Stub_table::add_reloc_stub): Define method in class definition
8427         instead of just declaring it there.
8428         (Stub_table::add_cortex_a8_stub): New method definition.
8429         (Stub_table::update_data_size_and_addralign): Ditto.
8430         (Stub_table::finalize_stubs): Ditto.
8431         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8432         (Stub_table::do_addralign_): Return address alignment in the
8433         (Stub_table::do_reset_address_and_file_offset): Define method in
8434         class definition instead of declaring it there.  Set current data
8435         size to be the data size of the previous pass.
8436         (Stub_table::set_final_data_size): Use current data size as the
8437         final data size.
8438         (Stub_table::relocate_stub): Change parameter type of stub from
8439         Reloc_stub pointer to Stub pointer.
8440         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8441         (Stub_table::Cortex_a8_stub_list): New typedef.
8442         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8443          Stub_table::prev_addralign_): New data member.
8444         (Arm_relobj::Arm_relobj): Initialize data member
8445         section_has_cortex_a8_workaround_.
8446         (Arm_relobj::section_has_cortex_a8_workaround,
8447          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8448          definitions.
8449         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8450         declarations.
8451         (Target_arm::relocate_stub): Change parameter type of stub from
8452         Reloc_stub pointer to Stub pointer.
8453         (Insn_template::size, Insn_template::alignment): Handle
8454         THUMB16_SPECIAL_TYPE.
8455         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8456          Stub_table::update_data_size_and_addralign,
8457          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8458         definitions.
8459         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8460         (Stub_table::do_write): Ditto.
8461         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8462
8463 2010-01-08  Ian Lance Taylor  <iant@google.com>
8464
8465         PR 11108
8466         * symtab.h (class Symbol): Remove fields is_target_special_ and
8467         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8468         (Symbol::is_defined_in_discarded_section): New function.
8469         (Symbol::set_is_defined_in_discarded_section): New function.
8470         (Symbol::has_plt_offset): Rewrite.
8471         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8472         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8473         Don't initialize is_target_special_ or has_plt_offset_.
8474         Initialize is_defined_in_discarded_section_.
8475         (Symbol_table::add_from_relobj): If appropriate, set
8476         is_defined_in_discarded_section.
8477         * resolve.cc (Symbol::override_base_with_special): Don't test
8478         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8479         * target-reloc.h (relocate_section): Do special handling for
8480         symbols defined in discarded sections for global symbols as well
8481         as local symbols.
8482
8483 2010-01-08  Ian Lance Taylor  <iant@google.com>
8484
8485         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8486         the SHT_SYMTAB case.
8487
8488 2010-01-08  Ian Lance Taylor  <iant@google.com>
8489
8490         * object.cc (Sized_relobj::do_layout): Don't get confused if
8491         layout_eh_frame returns NULL.
8492
8493 2010-01-08  Ian Lance Taylor  <iant@google.com>
8494
8495         PR 11084
8496         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8497         dynamic symbol table, use the normal symbol table.
8498         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8499         symbol table.
8500
8501 2010-01-08  Ian Lance Taylor  <iant@google.com>
8502
8503         PR 11072
8504         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8505         sections.
8506
8507 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8508
8509         * version.cc (print_version): Change to "Copyright 2010".
8510
8511 2010-01-08  Ian Lance Taylor  <iant@google.com>
8512
8513         PR 10287
8514         PR 11063
8515         * i386.cc (class Target_i386): Change return type of plt_section
8516         to be non-const.
8517         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8518         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8519         tls_desc_rel_ field.
8520         (Output_data_plt_i386::rel_tls_desc): New function.
8521         (Target_i386::rel_tls_desc_section): New function.
8522         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8523         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8524         R_386_TLS_DESC reloc in rel_tls_desc_section.
8525         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8526         Define struct Tlsdesc_info.
8527         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8528         (Target_x86_64::do_reloc_symbol_index): New function.
8529         (Target_x86_64::add_tlsdesc_info): New function.
8530         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8531         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8532         tlsdesc_rel_ field.
8533         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8534         all callers.
8535         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8536         (Target_x86_64::rela_tlsdesc_section): New function.
8537         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8538         handling.
8539         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8540         (Target_x86_64::do_reloc_addend): New function.
8541         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8542         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8543         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8544         (Output_reloc::type): New function.
8545         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8546         (Output_reloc::is_target_specific): New function.
8547         (Output_reloc::target_arg): New function.
8548         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8549         absolute relocs and target specific relocs.
8550         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8551         add_target_specific.
8552         (class Output_data_reloc) [SHT_RELA]: Likewise.
8553         * output.cc (Output_reloc::Output_reloc): Add four new versions
8554         for absolute relocs and target specific relocs.
8555         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8556         (Output_reloc::get_symbol_index): Likewise.
8557         (Output_reloc::local_section_offset): Check that local_sym_index_
8558         is not TARGET_CODE or 0.
8559         (Output_reloc::symbol_value): Likewise.
8560         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8561         reloc.
8562         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8563         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8564         functions.
8565         * layout.cc (add_target_dynamic_tags): Use output section for
8566         DT_PLTRELSZ and DT_JMPREL.
8567
8568 2010-01-07  Ian Lance Taylor  <iant@google.com>
8569
8570         PR 11061
8571         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8572         function.
8573         (class Output_data_reloc_generic): Define.
8574         (class Output_data_reloc_base): Change base class to
8575         Output_data_reloc_generic.  Change add() method to call
8576         bump_relative_reloc_count for a relative reloc.  Remove
8577         sort_relocs_ field.
8578         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8579         to sort_relocs().
8580         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8581         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8582         appropriate.
8583         * layout.h (class Layout): Update declaration.
8584
8585 2010-01-07  Ian Lance Taylor  <iant@google.com>
8586
8587         * output.h (class Output_data): Add const version of
8588         output_section and do_output_section.
8589         (class Output_section_data): Add const version of
8590         do_output_section.
8591         (class Output_section): Likewise.
8592         * layout.cc (Layout::add_target_dynamic_tags): New function.
8593         * layout.h (class Layout): Update declarations.
8594         * arm.cc (Target_arm::do_finalize_sections): Use
8595         add_target_dynamic_tags.
8596         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8597         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8598         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8599         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8600
8601 2010-01-07  Ian Lance Taylor  <iant@google.com>
8602
8603         PR 11042
8604         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8605         object as needed.
8606
8607 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8608             Ian Lance Taylor  <iant@google.com>
8609
8610         PR 11019
8611         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8612         Xindex::read_symtab_xindex.
8613
8614 2010-01-07  Doug Kwan  <dougkwan@google.com>
8615
8616         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8617         (Insn_template::thumb16_bcond_insn): New method declaration.
8618         (Insn_template): Fix spelling.
8619         (Stub::thumb16_special): New method declaration.
8620         (Stub::do_write): Define virtual method which was previously pure
8621         virtual.
8622         (Stub::do_thumb16_special): New method declaration.
8623         (Stub::do_fixed_endian_write): New template member.
8624         (Reloc_stub::do_write): Remove.
8625         (Reloc_stub::do_fixed_endian_write): Remove.
8626         (Cortex_a8_stub): New class definition.
8627         (Stub_factory::make_cortex_a8_stub): New method definition.
8628         (Stub_factory::Stub_factory): Add missing static storage class
8629         qualifier for elf32_arm_stub_a8_veneer_blx.
8630
8631 2010-01-07  Ian Lance Taylor  <iant@google.com>
8632
8633         PR 10980
8634         * options.h (class General_options): Add --warn-unresolved-symbols
8635         and --error-unresolved-symbols.
8636         * errors.cc (Errors::undefined_symbol): Implement
8637         --warn-unresolved-symbols.
8638
8639         * options.h (class General_options): Add -z text and -z textoff.
8640         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8641
8642 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8643
8644         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8645         (Garbage_collection::cident_sections): New function.
8646         (Garbage_collection::add_cident_section): New function.
8647         (Garbage_collection::cident_sections_): New member.
8648         (gc_process_relocs): Add references to sections whose names are C
8649         identifiers.
8650         * gold.h (cident_section_start_prefix): New constant.
8651         (cident_section_stop_prefix): New constant.
8652         (is_cident): New function.
8653         * layout.cc (Layout::define_section_symbols): Replace string constants
8654         with the newly defined constants.
8655         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8656         C identifiers.
8657         * testsuite/Makefile.am: Add gc_orphan_section_test.
8658         * testsuite/Makefile.in: Regenerate.
8659         * testsuite/gc_orphan_section_test.cc: New file.
8660         * testsuite/gc_orphan_section_test.sh: New file.
8661
8662 2010-01-06  Ian Lance Taylor  <iant@google.com>
8663
8664         PR 10980
8665         * options.h (class General_options): Add --warn-shared-textrel.
8666         * layout.cc (Layout::finish_dynamic_section): Implement
8667         --warn-shared-textrel.
8668
8669         PR 10980
8670         * options.h (class General_options): Add --warn-multiple-gp.
8671
8672 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8673
8674         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8675         $(THREADSLIB) and $(LIBDL).
8676         * Makefile.in: Rebuild.
8677
8678 2010-01-06  Ian Lance Taylor  <iant@google.com>
8679
8680         PR 10980
8681         * options.cc (General_options::parse_section_start): New function.
8682         (General_options::section_start): New function.
8683         (General_options::General_options): Initialize all members.
8684         * options.h: Include <map>
8685         (class General_options): Add --section-start.  Add section_starts_
8686         member.
8687         * layout.cc (Layout::attach_allocated_section_to_segment): If
8688         --section-start was used, set the address of the segment.  Remove
8689         local sort_sections.
8690         (Layout::relaxation_loop_body): If the address of the load segment
8691         has been set by --section-start, don't use it.
8692         * output.h (Output_segment::update_flags_for_output_section): New
8693         function.
8694         * output.cc (Output_segment::add_output_section): Call
8695         update_flags_for_output_section.
8696
8697 2010-01-05  Ian Lance Taylor  <iant@google.com>
8698
8699         PR 10980
8700         * options.h (class General_options): Add --undefined-version.
8701         * script.cc (struct Version_expression): Add was_matched_by_symbol
8702         field.
8703         (Version_script_info::matched_symbol): New function.
8704         (Version_script_info::get_symbol_version_helper): Call
8705         matched_symbol.
8706         (Version_script_info::check_unmatched_names): New function.
8707         * script.h (class Version_script_info): Update declarations.
8708         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8709
8710         * options.h (class General_options): Use DEFINE_bool_alias for
8711         allow_multiple_definition.
8712         * resolve.cc (Symbol_table::should_override): Don't test
8713         allow_multiple_definition.
8714
8715         PR 10980
8716         * options.h (class General_options): Add --cref.
8717         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8718         until after printing cref table.
8719         * cref.cc: Include "symtab.h".
8720         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8721         (Cref_table_compare::operator()): New function.
8722         (Cref_inputs::gather_cref): New function.
8723         (filecol): New static const.
8724         (Cref_inputs::print_cref): New function.
8725         (Cref::print_cref): New function.
8726         * cref.h: Include <cstdio>.
8727         (class Cref): Update declarations.
8728         * mapfile.h (Mapfile::file): New function.
8729         * object.h (class Object): Define Symbols.  Declare virtual
8730         do_get_global_symbols.
8731         (Object::get_global_symbols): New function.
8732         * object.cc (Input_objects::add_object): Pass object to cref_ if
8733         --cref.
8734         (Input_objects::archive_start): Likewise.
8735         (Input_objects::archive_stop): Likewise.
8736         (Input_objects::print_cref): New function.
8737         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8738         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8739         --cref.
8740         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8741         function.
8742         * plugin.h (class Sized_pluginobj): Update declarations.
8743
8744 2010-01-05  Ian Lance Taylor  <iant@google.com>
8745
8746         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8747         to is_default_version.  Rename insdef to insdefault.
8748         (Symbol_table::add_from_relobj): Rename def to is_default_version
8749         and local to is_forced_local.
8750         (Symbol_table::add_from_pluginobj): Likewise.
8751         (Symbol_table::add_from_dynobj): Likewise.
8752         (Symbol_table::define_special_symbol): Rename insdef to
8753         insdefault.
8754
8755 2010-01-04  Ian Lance Taylor  <iant@google.com>
8756
8757         PR 10980
8758         * options.h (class General_options): Add
8759         --allow-multiple-definition and -z muldefs.
8760         * resolve.cc (Symbol_table::should_override): Don't warn about a
8761         multiple symbol definition if --allow-multiple-definition or -z
8762         muldefs.
8763
8764         PR 10980
8765         * options.h (class General_options): Add --add-needed and
8766         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8767         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8768         error if --copy-dt-needed-entries aka --add-needed is used and
8769         would cause a change in behaviour.
8770
8771         PR 10980
8772         * options.h (class General_options): Add -G as a short version of
8773         --shared.  Add no-op options -assert, -g, and -i.
8774
8775 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8776
8777         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8778         check for .text or .gnu.linkonce.t sections.
8779         * icf.cc (Icf::find_identical_sections): Ditto.
8780         Change the detection for mangled function name within the section
8781         name.
8782         * icf.h (is_section_foldable_candidate): New function.
8783
8784 2009-12-30  Ian Lance Taylor  <iant@google.com>
8785
8786         PR 10980
8787         * options.h (class General_options): Permit two dashes with
8788         --retain-symbols-file.
8789
8790 2009-12-30  Ian Lance Taylor  <iant@google.com>
8791
8792         PR 10979
8793         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8794         don't put the file header and segment headers in the text
8795         segment.
8796
8797         PR 10979
8798         * common.cc (Sort_commons::operator()): Stabilize sort when both
8799         entries are NULL.
8800         (Symbol_table::do_allocate_commons_list): When allocating common
8801         symbols, skip a symbol which is no longer common.
8802         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8803         an object before checking its type.
8804         * testsuite/common_test_2.c: New file.
8805         * testsuite/common_test_3.c: New file.
8806         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8807         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8808         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8809         (common_test_2_pic.o, common_test_2.so): New targets.
8810         (common_test_3_pic.o, common_test_3.so): New targets.
8811         * testsuite/Makefile.in: Rebuild.
8812
8813         PR 10979
8814         * script.cc (read_input_script): If we see a new SECTIONS clause,
8815         and we have added an input section, give an error.
8816         * layout.h (class Layout): Add have_added_input_section function.
8817         Add have_added_input_section_ field.
8818         * layout.cc (Layout::Layout): Initialize
8819         have_added_input_section_.
8820         (Layout::layout): Set have_added_input_section_.
8821         (Layout::layout_eh_frame): Likewise.
8822
8823 2009-12-30  Ian Lance Taylor  <iant@google.com>
8824
8825         PR 10931
8826         * options.h (class General_options): Add --sort-common option.
8827         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8828         * common.cc (Sort_common): Add sort_order parameter to
8829         constructor.  Add sort_order_ field.
8830         (Sort_commons::operator): Check sort_order_.
8831         (Symbol_table::allocate_commons): Determine the sort order.
8832         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8833         Change all callers.
8834         (Symbol_table::do_allocate_commons_list): Likewise.
8835
8836 2009-12-30  Ian Lance Taylor  <iant@google.com>
8837
8838         PR 10916
8839         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8840         symbols from this object, don't change the visibility of an
8841         undefined symbol.
8842         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8843
8844 2009-12-30  Ian Lance Taylor  <iant@google.com>
8845
8846         PR 10861
8847         * script.h (class Version_script_info): Define Language enum.
8848         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8849         new fields globals_, locals_, and is_finalized_.
8850         * script.cc: Various formatting fixes.
8851         (class Parser_closure): Change language_stack_ from a vector of
8852         std::string to one of Version_script_info::Language.  Adjust all
8853         uses accordingly.
8854         (class Lazy_demangler): Remove.
8855         (struct Version_expression): Change language from std::string to
8856         Version_script_info::Language.
8857         (Version_script_info::Version_script_info): New function.
8858         (Version_script_info::~Version_script_info): Don't call clear.
8859         (Version_script_info::finalize): New function.
8860         (Version_script_info::build_lookup_tables): New function.
8861         (Version_script_info::build_expression_list_lookup): New
8862         function.
8863         (Version_script_info::get_symbol_version_helper): Rewrite to use
8864         lookup tables.
8865         (Version_script_info::print_expression_list): Adjust to use
8866         Version_script_info::Language.
8867         (script_push_lex_into_version_mode): Check that the version script
8868         has not been finalized.
8869         (version_script_push_lang): Change language string to
8870         Version_script_info::Language.
8871         * options.cc (Command_line::version_script): New function.
8872         * options.h (class General_options): Add finalize_dynamic_list
8873         function.  Change version_script from declaration to definition.
8874         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8875         * testsuite/version_script.map: Remove duplicate def of foo.
8876         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8877         version_script.map.
8878         * testsuite/Makefile.in: Rebuild.
8879
8880 2009-12-30  Ian Lance Taylor  <iant@google.com>
8881
8882         PR 10843
8883         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8884         if the input symbol index is 0, make the output symbol index 0.
8885
8886 2009-12-30  Ian Lance Taylor  <iant@google.com>
8887
8888         PR 10670
8889         * options.h (class General_options): Add -x/--discard-all.
8890         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8891         --discard-all.  If the local symbol needs a dynamic entry, check
8892         that before handling --discard-locals.
8893
8894 2009-12-30  Ian Lance Taylor  <iant@google.com>
8895
8896         PR 10450
8897         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8898         flags to PF_R.
8899         (Output_segment::add_output_section): Don't change the flags if
8900         the type is PT_TLS.
8901
8902         PR 10450
8903         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8904         GNU hash table if they need a dynamic value.  Otherwise, don't add
8905         them if they are defined in a dynamic object or are forced local.
8906
8907 2009-12-29  Ian Lance Taylor  <iant@google.com>
8908
8909         PR 10450
8910         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8911         .gnu.hash table for a 32-bit target.
8912
8913         PR 10450
8914         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8915         regular and a dynamic object only needs a dynamic symbol table
8916         entry if it is externally visible.
8917
8918         PR 10450
8919         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8920         constructor.  Add global_offset_table_ field.
8921         (Target_i386::got_section): Set global_offset_table_.
8922         (Target_i386::do_finalize_sections): Set global_offset_table_
8923         size.
8924         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8925         in constructor.  Add global_offset_table_ field.
8926         (Target_x86_64::got_section): Set global_offset_table_.
8927         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8928         size.
8929
8930         * layout.cc (Layout::Layout): Initialize increase_relro_.
8931         (Layout::get_output_section): Add is_relro, is_last_relro, and
8932         is_first_non_relro parameters.  Change all callers.
8933         (Layout::choose_output_section): Likewise.
8934         (Layout::add_output_section_data): Likewise.
8935         (Layout::make_output_section): Likewise.
8936         (Layout::set_segment_offsets): Clear increase_relro when using a
8937         linker script.
8938         * layout.h (class Layout): Add increase_relro method.  Add
8939         increase_relro_ field.  Update declarations.
8940         * output.cc (Output_section::Output_section): Initialize
8941         is_last_relro_ and is_first_non_relro_.
8942         (Output_segment::add_output_section): Group relro sections is
8943         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8944         (Output_segment::maximum_alignment): Remove relro handling.
8945         (Output_segment::set_section_addresses): Add increase_relro
8946         parameter.  Change all callers.  Add initial alignment to align
8947         relro sections on separate page.  Remove old relro handling.
8948         (Output_segment::set_section_list_addresses): Remove in_relro
8949         parameter.  Change all callers.
8950         (Output_segment::set_offset): Add increase parameter.  Change all
8951         callers.  Remove old relro handling.
8952         * output.h (class Output_section): Add new methods: is_last_relro,
8953         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8954         Add is_last_relro_ and is_first_non_relro_ fields.
8955         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8956         Create separate .got.plt section.  Call increase_relro.
8957         * x86_64.cc (Target_x86_64::got_section): Likewise.
8958         * testsuite/relro_script_test.t: Add .got.plt.
8959
8960         PR 10450
8961         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8962         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8963         (Layout::finalize): Call set_dynamic_symbol_size.
8964         (Layout::set_dynamic_symbol_size): New function.
8965         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8966         set_dynamic_symbol_size.
8967
8968         PR 10450
8969         * output.h (class Output_section): Add is_entsize_zero_ field.
8970         * output.cc (Output_section::Output_section): Initialize
8971         is_entsize_zero_.
8972         (Output_section::set_entsize): If two different entsizes are
8973         requested, force it to zero.
8974         (Output_section::add_input_section): Set flags for .debug_str
8975         before updating section flags.  Set entsize.
8976         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8977         and SHF_STRING if all input sections have those flags.
8978
8979 2009-12-29   Rafael Espindola  <espindola@google.com>
8980
8981         * main.cc (main): Fix the sys time reporting.
8982         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8983         reporting.
8984
8985 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8986
8987         * options.cc (General_options::parse_version): Allow -v to exit
8988         without an error if there is nothing to link.
8989
8990 2009-12-29  Ian Lance Taylor  <iant@google.com>
8991
8992         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8993         using a version of gcc before 4.1.
8994         * configure: Rebuild.
8995
8996 2009-12-28  Chris Demetriou  <cgd@google.com>
8997
8998         * attributes.cc (Output_attributes_section_data::do_write): Use
8999         std::vector::front rather than std::vector::data.
9000
9001 2009-12-28  Ian Lance Taylor  <iant@google.com>
9002
9003         * symtab.h (class Symbol_table): Add enum Defined.
9004         * resolve.cc (Symbol_table::should_override): Add defined
9005         parameter.  Change all callers.  Test whether object is NULL
9006         before calling a method on it.
9007         (Symbol_table::report_resolve_problem): Add defined parameter.
9008         Change all callers.
9009         (Symbol_table::should_override_with_special): Likewise.
9010         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9011         parameter.  Change all callers.
9012         (Symbol_table::do_define_in_output_data): Likewise.
9013         (Symbol_table::define_in_output_segment): Likewise.
9014         (Symbol_table::do_define_in_output_segment): Likewise.
9015         (Symbol_table::define_as_constant): Likewise.
9016         (Symbol_table::do_define_as_constant): Likewise.
9017         * script.h (class Symbol_assignment): Add is_defsym parameter to
9018         constructor; change all callers.
9019         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9020         parameter.  Change all callers.  Add is_defsym_ field.
9021         (class Parser_closure): Add parsing_defsym parameter to
9022         constructor; change all callers.  Add parsing_defsym accessor
9023         function.  Add parsing_defsym_ field.
9024
9025 2009-12-28  Ian Lance Taylor  <iant@google.com>
9026
9027         * gold.cc (queue_middle_tasks): Fix formatting.
9028         * object.cc (Relobj::is_section_name_included): Likewise.
9029
9030 2009-12-23  Ian Lance Taylor  <iant@google.com>
9031
9032         * i386.cc (Target_i386::do_calls_non_split): Recognize
9033         -fsplit-stack prologue for a function with a static chain.
9034         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9035         -fsplit-stack prologue when using %r11.
9036
9037 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9038
9039         * options.cc (General_options::parse_version): Make -v continue and do
9040         the link like GNU ld does.
9041
9042 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9043
9044         * Makefile.am (CCFILES): Add timer.cc.
9045         (HFILES): Add timer.h.
9046         * configure.ac: Check for sysconf and times.
9047         * main.cc: include timer.h.
9048         (main): Use Timer instead of get_run_time.
9049         * timer.cc: New.
9050         * timer.h: New.
9051         * workqueue.cc: include timer.h.
9052         (Workqueue::find_and_run_task):
9053         Report user, sys and wall time.
9054         * Makefile.in: Regenerate.
9055         * config.in: Regenerate.
9056         * configure: Regenerate.
9057
9058 2009-12-16  Doug Kwan  <dougkwan@google.com>
9059
9060         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9061         sections.
9062         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9063         relaxed input sections.
9064         * output.cc (Output_section::find_relaxed_input_section): Change
9065         return type to Output_relaxed_input_section pointer.  Adjust code
9066         for new type of relaxed_input_section_map_.
9067         * output.h (Output_section::find_relaxed_input_section): Change
9068         return type to Output_relaxed_input_section pointer.
9069         (Output_section::Output_relaxed_input_section_by_input_section_map):
9070         New type.
9071         (Output_section::relaxed_input_section_map_): Change type to
9072         Output_section::Output_relaxed_input_section_by_input_section_map.
9073         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9074         input section.
9075
9076 2009-12-15  Ian Lance Taylor  <iant@google.com>
9077
9078         * layout.cc (Layout::create_shstrtab): Only write out after input
9079         sections if we are compressing debug sections.
9080
9081 2009-12-15  Ian Lance Taylor  <iant@google.com>
9082
9083         * archive.cc (Archive::add_symbols): Only look up a symbol without
9084         a version if there is, in fact, a version.
9085
9086 2009-12-14  Ian Lance Taylor  <iant@google.com>
9087
9088         Revert -Wshadow changes, all changes from:
9089         2009-12-11  Doug Kwan  <dougkwan@google.com>
9090         2009-12-11  Nick Clifton  <nickc@redhat.com>
9091         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9092
9093 2009-12-11  Doug Kwan  <dougkwan@google.com>
9094
9095         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9096         due to -Wshadow.
9097         * attributes.cc (Object_attribute::size): Ditto.
9098         (Attributes_section_data::size): Ditto.
9099         (Attributes_section_data::Attributes_section_data): Ditto.
9100         (Output_attributes_section_data::do_write): Ditto.
9101         * attributes.h (Object_attribute::set_type): Ditto.
9102         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9103
9104 2009-12-11  Nick Clifton  <nickc@redhat.com>
9105
9106         * archive.cc: Fix shadowed variable warnings.
9107         * arm.cc: Likewise.
9108         * compressed_output.cc: Likewise.
9109         * compressed_output.h: Likewise.
9110         * configure: Likewise.
9111         * dwarf_reader.cc: Likewise.
9112         * dynobj.cc: Likewise.
9113         * dynobj.h: Likewise.
9114         * ehframe.cc: Likewise.
9115         * ehframe.h: Likewise.
9116         * errors.cc: Likewise.
9117         * expression.cc: Likewise.
9118         * fileread.cc: Likewise.
9119         * fileread.h: Likewise.
9120         * freebsd.h: Likewise.
9121         * i386.cc: Likewise.
9122         * icf.cc: Likewise.
9123         * incremental.h: Likewise.
9124         * layout.cc: Likewise.
9125         * layout.h: Likewise.
9126         * mapfile.cc: Likewise.
9127         * merge.cc: Likewise.
9128         * merge.h: Likewise.
9129         * object.cc: Likewise.
9130         * object.h: Likewise.
9131         * options.h: Likewise.
9132         * output.cc: Likewise.
9133         * output.h: Likewise.
9134         * parameters.cc: Likewise.
9135         * plugin.cc: Likewise.
9136         * powerpc.cc: Likewise.
9137         * reduced_debug_output.cc: Likewise.
9138         * reduced_debug_output.h: Likewise.
9139         * reloc.cc: Likewise.
9140         * reloc.h: Likewise.
9141         * resolve.cc: Likewise.
9142         * script-sections.cc: Likewise.
9143         * script.cc: Likewise.
9144         * script.h: Likewise.
9145         * sparc.cc: Likewise.
9146         * symtab.cc: Likewise.
9147         * symtab.h: Likewise.
9148         * target-select.cc: Likewise.
9149         * target-select.h: Likewise.
9150         * token.h: Likewise.
9151         * workqueue.cc: Likewise.
9152         * workqueue.h: Likewise.
9153         * x86_64.cc: Likewise.
9154
9155 2009-12-10  Doug Kwan  <dougkwan@google.com>
9156
9157         * arm.cc (attributes.h): New include.
9158         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9159         (Arm_relobj::~Arm_relobj): Delete object pointed by
9160         attributes_section_data_.
9161         (Arm_relobj::attributes_section_data): New method definition.
9162         (Arm_relobj::attributes_section_data_): New data member declaration.
9163         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9164         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9165         attributes_section_data_.
9166         (Arm_dynobj::attributes_section_data): New method definition.
9167         (Arm_dynobj::attributes_section_data_): New data member declaration.
9168         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9169         initialization value of may_use_blx_ to false.
9170         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9171         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9172         object attributes to compute results instead of hard-coding.
9173         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9174         Target_arm::get_secondary_compatible_arch,
9175         Target_arm::set_secondary_compatible_arch
9176         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9177         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9178         New method declarations.
9179         (Target_arm::get_aeabi_object_attribute): New method definition.
9180         (Target_arm::attributes_section_data_): New data member declaration.
9181         (read_arm_attributes_section): New template definition.
9182         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9183         (Arm_dynobj::do_read_symbols): Ditto.
9184         (Target_arm::do_finalize_sections): Merge attributes sections from
9185         input.  Check for BLX use after attributes section merging.
9186         Fix __exidx_start and __exidx_end visibility.  Create an
9187         .ARM.attributes section if necessary.
9188         (Target_arm::get_secondary_compatible_arch,
9189         Target_arm::set_secondary_compatible_arch,
9190         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9191         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9192         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9193         New method definitions.
9194
9195 2009-12-09  Ian Lance Taylor  <iant@google.com>
9196
9197         * plugin.cc (Plugin::load): Don't cast from void* to a function
9198         pointer.
9199
9200 2009-12-09  Ian Lance Taylor  <iant@google.com>
9201
9202         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9203         information fields.
9204
9205 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9206
9207         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9208         Replace two_file_shared_1.so with two_file_shared_2.so.
9209         * testsuite/Makefile.in: Regenerated.
9210
9211 2009-12-08  Doug Kwan  <dougkwan@google.com>
9212
9213         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9214         (HFILES): Add attributes.h and int_encoding.h.
9215         * Makefile.in: Regenerate.
9216         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9217         function definitions to int_encoding.cc
9218         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9219         prototypes to int_encoding.h
9220         * reduced_debug_output.cc (int_encoding.h): New include.
9221         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9222         function definitions to int_encoding.cc
9223         (insert_into_vector, read_from_pointer): Move template definitions to
9224         int_encoding.h
9225         * attributes.cc: New file.
9226         * attributes.h: New file.
9227         * int_encoding.cc: New file.
9228         * int_encoding.h: New file.
9229
9230 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9231
9232         PR gold/11055
9233         * incremental-dump.cc (dump_incremental_inputs): New.
9234         (main): Use dump_incremental_inputs.
9235
9236 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9237
9238         PR gold/10893
9239         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9240         checking elfcpp::STT_FUNC.
9241         (Target_i386::Relocate::relocate): Likewise.
9242         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9243
9244         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9245         symbols from shared libraries into normal FUNC symbols.
9246
9247         * symtab.h (Symbol): Add is_func and use it.
9248
9249 2009-12-05  Doug Kwan  <dougkwan@google.com>
9250
9251         * arm.cc (Target_arm::arm_info): Initialize new fields
9252         attributes_section and attributes_vendor.
9253         * i386.cc (Target_i386::i386_info): Same.
9254         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9255         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9256         fields attributes_section and attributes_vendor.
9257         * sparc.cc (Target_sparc::sparc_info): Same.
9258         * target.h (Target::attributes_section, Target::attributes_vendor,
9259         Target::is_attributes_section, Target::attribute_arg_type,
9260         Target::attributes_order): New method definitions.
9261         (Target::Target_info::attributes_section,
9262         Target::Target_info::attributes_vendor): New fields.
9263         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9264         virtual method definitions.
9265         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9266         attributes_section and attributes_vendor.
9267         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9268
9269 2009-12-05  Doug Kwan  <dougkwan@google.com>
9270
9271         * arm.cc: Update comments about interworking and stub generation.
9272         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9273         considered as non-PIC.
9274         (Arm_relocate_functions::base_abs): Fix formatting.
9275         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9276         of function to use GOT entry address instead of offset.
9277         (Target_arm::Scan::global): Issue an error if a symbol would need a
9278         PLT does not get one because it is untyped.  Remove code to create
9279         dynamic symbols for relative branches.
9280         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9281         takes unsigned integer instead of boolean.
9282
9283 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9284
9285         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9286         (two_file_test_LDADD): Likewise.
9287         (common_test_1_LDADD): Likewise.
9288         (exception_test_LDADD) Likewise.
9289         (weak_test_LDADD): Likewise.
9290         (many_sections_test_LDADD): Likewise.
9291         (initpri1_LDADD): Likewise.
9292         (script_test_1_LDADD): Likewise.
9293         (script_test_2_LDADD): Likewise.
9294         (justsyms_LDADD): Likewise.
9295         (binary_test_LDADD): Likewise.
9296         (large_LDADD): Likewise.
9297         * testsuite/Makefile.in: Regenerated.
9298
9299 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9300
9301         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9302         (Symbol_table::override_with_special): Likewise.
9303         (Symbol_table::add_from_object): Likewise.
9304
9305 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9306
9307         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9308         Don't set the data_offset twice.
9309
9310 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9311
9312         * testsuite/Makefile.in: Regenerate.
9313
9314 2009-12-03  Doug Kwan  <dougkwan@google.com>
9315
9316         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9317         (Target_arm::do_finalize_sections): Add parameter for symbol table
9318         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9319         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9320         parameter for symbol table pointer.
9321         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9322         an additional parameter for a pointer to symbol table.
9323         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9324         parameter for a symbol table pointer.
9325         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9326         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9327         Ditto.
9328         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9329         parameter for a symbol table pointer.
9330
9331 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9332
9333         * incremental.cc (Incremental_inputs_header)
9334         (Incremental_inputs_header_write, Incremental_inputs_entry)
9335         (Incremental_inputs_entry_write): Move ...
9336         * incremental.h (Incremental_inputs_header)
9337         (Incremental_inputs_header_write, Incremental_inputs_entry)
9338         (Incremental_inputs_entry_write): here.
9339
9340 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9341
9342         * incremental.cc (make_sized_incremental_binary): Set the target.
9343         Error if it is incompatible.
9344         * output.h (Output_file): Add filename method.
9345
9346 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9347
9348         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9349         from the get_* methods.
9350
9351 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9352
9353         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9354         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9355         Write 0 for the data_offset of scripts.
9356
9357 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9358
9359         * testsuite/Makefile.am: Add the incremental_test.sh test.
9360         * testsuite/incremental_test.sh: New.
9361         * testsuite/incremental_test_1.c: New.
9362         * testsuite/incremental_test_2.c: New.
9363
9364 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9365
9366         * incremental-dump.cc (main): Fix typos.
9367
9368 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9369
9370         PR gold/11025
9371         * incremental-dump.cc (main): Use llu to print 64 bit values.
9372
9373 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9374             H.J. Lu  <hongjiu.lu@intel.com>
9375
9376         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9377         $(LIBDL).
9378         (incremental_dump_LDADD): Likewise.
9379         * Makefile.in: Regenerated.
9380
9381 2009-11-25  Doug Kwan  <dougkwan@google.com>
9382
9383         Revert:
9384
9385         2009-11-25  Doug Kwan  <dougkwan@google.com>
9386
9387                 * arm.cc (Target_arm::Target_arm): Move method definition
9388                 outside of class definition.  Add code to handle
9389                 --target1-rel, --target1-abs and --target2= options.
9390                 (Target_arm::get_reloc_reloc_type): Change method to be
9391                 non-static and const.
9392                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9393                 New data member declaration.
9394                 (Target_arm::Scan::local, Target_arm::Scan::global,
9395                 Target_arm::Relocate::relocate,
9396                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9397                 Adjust call to Target_arm::get_real_reloc_type.
9398                 (Target_arm::get_real_reloc_type): Use command line options
9399                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9400                 * options.h (--target1-rel, --target1-abs, --target2): New
9401                 ARM-only options.
9402
9403 2009-11-25  Doug Kwan  <dougkwan@google.com>
9404
9405         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9406         class definition.  Add code to handle --target1-rel, --target1-abs
9407         and --target2= options.
9408         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9409         and const.
9410         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9411         member declaration.
9412         (Target_arm::Scan::local, Target_arm::Scan::global,
9413         Target_arm::Relocate::relocate,
9414         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9415         call to Target_arm::get_real_reloc_type.
9416         (Target_arm::get_real_reloc_type): Use command line options to
9417         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9418         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9419         options.
9420
9421 2009-11-25  Doug Kwan  <dougkwan@google.com>
9422
9423         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9424         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9425         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9426         formatting.
9427         (Arm_relocate_functions::thm_call): Replace body with a call to
9428         Arm_relocate_functions::thumb_branch_common.
9429         (Arm_relocate_functions::thm_jump24,
9430         Arm_relocate_functions::thm_xpc22): New method definitions.
9431         (Arm_relocate_functions::thumb_branch_common): New method definition.
9432         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9433         operator.
9434         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9435         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9436
9437 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9438
9439         * Makefile.am: Build incremental-dump
9440         * Makefile.in: Regenerate.
9441         * incremental-dump.cc: New.
9442         * incremental.cc (Incremental_inputs_header_data,
9443         Incremental_inputs_entry_data): Move to incremental.h
9444         * incremental.h: (Incremental_inputs_header_data,
9445         Incremental_inputs_entry_data): Move from incremental.cc
9446
9447 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9448
9449         * incremental.cc (Incremental_inputs_header,
9450         Incremental_inputs_header_write, Incremental_inputs_entry,
9451         Incremental_inputs_entry_write): Add a typedef with the data type.
9452
9453 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9454
9455         * incremental.cc (Incremental_inputs_header,
9456         Incremental_inputs_header_write, Incremental_inputs_entry,
9457         Incremental_inputs_entry_write): Update comment about which
9458         type has the filed descriptions.
9459
9460 2009-11-15  Doug Kwan  <dougkwan@google.com>
9461
9462         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9463         (Arm_relocate_functions::arm_branch_common): Change method defintion
9464         in class definition to a method declaration and update list of formal
9465         parameters.
9466         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9467         Arm_relocation_functions::jump24): Adjust call to
9468         Arm_relocate_functions::arm_branch_common.  Update list of formal
9469         parameters.
9470         (Arm_relocate_functions::xpc25): New method definition.
9471         (Arm_relocate_functions::arm_branch_common): Move method defintion
9472         out from class definition.  Use stubs for mode-switching and extending
9473         branch ranges.
9474         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9475         specially.  Change code to enable use of stubs in ARM branches.
9476
9477 2009-11-10  Doug Kwan  <dougkwan@google.com>
9478
9479         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9480         in method declaration.
9481         (Target_arm::relocate_stub): New method declaration.
9482         (Target_arm::default_target): Change to return a pointer instead of
9483         a const reference.
9484         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9485         Target_arm::default_target.
9486         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9487         method definition.
9488         (Target_arm::relocate_section): Adjust view.
9489         (Target_arm::relocate_stub): New method definition.
9490
9491 2009-11-10  Doug Kwan  <dougkwan@google.com>
9492
9493         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9494         a format warning.
9495         * incremental.cc (open_incremental_binary): Initialized local
9496         variables to avoid warnings.
9497         * object.cc (make_elf_object): Ditto.
9498         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9499         a format warning.
9500
9501 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9502
9503         PR gold/10930
9504         * testsuite/plugin_test.c: Include "config.h".
9505
9506 2009-11-09  Doug Kwan  <dougkwan@google.com>
9507
9508         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9509         (arm_symbol_value): Remove.
9510         (Arm_relocate_functions::arm_branch_common,
9511         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9512         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9513         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9514         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9515         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9516         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9517         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9518         Arm_relocate_functions::thm_mobw_abs_nc,
9519         Arm_relocate_functions::thm_mov_abs,
9520         Arm_relocate_functions::movw_prel_nc,
9521         Arm_relocate_functions::thm_movt_abs,
9522         Arm_relocate_functions::movt_prel,
9523         Arm_relocate_functions::thm_movw_prel_nc,
9524         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9525         (Target_arm::Relocate::relocate): Only decompose address into two
9526         parts if relocation type uses the thumb-bit and pass the actual
9527         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9528         calls to methods in Arm_relocate_functions for this change.
9529
9530 2009-11-08  Ian Lance Taylor  <iant@google.com>
9531
9532         PR 10925
9533         * reloc.cc: Instantiate
9534         Sized_relobj::initialize_input_to_output_maps and
9535         Sized_relobj:free_input_to_output_maps.
9536
9537 2009-11-06  Ian Lance Taylor  <iant@google.com>
9538
9539         PR 10876
9540         * defstd.cc (in_segment): Set only_if_ref true for "end".
9541
9542 2009-11-06  Doug Kwan  <dougkwan@google.com>
9543
9544         * arm.cc (class Reloc_stub): Correct a comment.
9545         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9546         (Target_arm::scan_section_for_stubs): New method declaration.
9547         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9548         Change methods from private to protected.
9549         (Target_arm::do_may_relax): New method definition.
9550         (Target_arm::do_relax, Target_arm::group_sections,
9551         Target_arm::scan_reloc_for_stub,
9552         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9553         (Target_arm::arm_input_section_map_): New data member declaration.
9554         (Target_arm::scan_reloc_for_stub,
9555         Target_arm::scan_reloc_section_for_stubs,
9556         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9557         Target_arm::do_relax): New method definitions.
9558
9559 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9560
9561         * configure.ac: Check for (struct stat)::st_mtim
9562         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9563         * config.in: Regenerate.
9564         * configure: Regenerate.
9565
9566 2009-11-05  Ian Lance Taylor  <iant@google.com>
9567
9568         PR 10910
9569         * output.cc (Output_segment::add_output_section): Add missing
9570         return statement.
9571
9572 2009-11-04  Ian Lance Taylor  <iant@google.com>
9573
9574         PR 10880
9575         * object.h (class Object): Add is_needed and set_is_needed
9576         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9577         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9578         defined in a dynamic object and referenced by a regular object,
9579         set is_needed for the dynamic object.
9580         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9581         if the file is marked with as_needed and it is not needed.
9582
9583 2009-11-04  Ian Lance Taylor  <iant@google.com>
9584
9585         PR 10887
9586         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9587         tags if data is discarded by linker script.
9588         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9589         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9590         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9591         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9592
9593 2009-11-04  Ian Lance Taylor  <iant@google.com>
9594
9595         * layout.cc (Layout::get_output_section): Add is_interp and
9596         is_dynamic_linker_section parameters.  Change all callers.
9597         (Layout::choose_output_section): Likewise.
9598         (Layout::make_output_section): Likewise.
9599         (Layout::add_output_section_data): Add is_dynamic_linker_section
9600         parameter.  Change all callers.
9601         * layout.h (class Layout): Update declarations.
9602         * output.h (class Output_section): Add is_interp, set_is_interp,
9603         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9604         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9605         generate_code_fills_at_write_ to a bitfield.
9606         * output.cc (Output_section::Output_sections): Initialize new
9607         fields.
9608         (Output_segment::add_output_section): Add do_sort parameter.
9609         Change all callers.
9610
9611 2009-11-03  Ian Lance Taylor  <iant@google.com>
9612
9613         PR 10860
9614         * options.h (class General_options): Add --warn-common.
9615         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9616         merging two common symbols.
9617         (Symbol_table::should_override): Handle --warn-common when merging
9618         a common symbol with a defined symbol.  Use report_resolve_problem
9619         for multiple definitions.
9620         (Symbol_table::report_resolve_problem): New function.
9621         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9622
9623 2009-11-03  Doug Kwan  <dougkwan@google.com>
9624
9625         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9626         stub_factory_.
9627         (Target_arm::stub_factory): New method definition.
9628         (Target_arm::new_arm_input_section,
9629         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9630         Target_arm::reloc_uses_thumb_bit): New method declarations.
9631         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9632         New type definitions.
9633         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9634         member declarations.
9635         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9636         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9637         New method definitions.
9638
9639 2009-11-03  Ian Lance Taylor  <iant@google.com>
9640
9641         * options.h (class General_options): Add --warn_constructors.
9642
9643 2009-11-03  Ian Lance Taylor  <iant@google.com>
9644
9645         PR 10893
9646         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9647         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9648
9649 2009-11-03  Ian Lance Taylor  <iant@google.com>
9650
9651         PR 10895
9652         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9653         --msgid-bugs-address.
9654         (install-pdf): New target.
9655         (install-data_yes): Look up one directory to find mkinstalldirs.
9656
9657 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9658
9659         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9660         tree.
9661
9662 2009-10-30  Doug Kwan  <dougkwan@google.com>
9663
9664         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9665
9666 2009-10-30  Doug Kwan  <dougkwan@google.com>
9667
9668         * arm.cc (Stub_addend_reader): New struct template definition
9669         and partial specializations.
9670         (Stub_addend_reader::operator()): New method definition for a
9671         partially specialized template.
9672
9673 2009-10-30  Doug Kwan  <dougkwan@google.com>
9674
9675         * arm.cc (Arm_relobj::processor_specific_flags): New method
9676         definition.
9677         (Arm_relobj::do_read_symbols): New method declaration.
9678         (Arm_relobj::processor_specific_flags_): New data member declaration.
9679         (Arm_dynobj): New class definition.
9680         (Target_arm::do_finalize_sections): Add input_objects parameter.
9681         (Target_arm::do_adjust_elf_header): New method declaration.
9682         (Target_arm::are_eabi_versions_compatible,
9683         (Target_arm::merge_processor_specific_flags): New method declaration.
9684         (Target_arm::do_make_elf_object): New overloaded method definitions
9685         and declaration.
9686         (Arm_relobj::do_read_symbols): New method definition.
9687         (Arm_dynobj::do_read_symbols): Ditto.
9688         (Target_arm::do_finalize_sections): Add input_objects parameters.
9689         Merge processor-specific flags from all input objects.
9690         (Target_arm::are_eabi_versions_compatible,
9691         Target_arm::merge_processor_specific_flags,
9692         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9693         New method definitions.
9694         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9695         Input_objects pointer type parameter.
9696         * layout.cc (Layout::finalize): Pass input objects to target's.
9697         finalize_sections function.
9698         * output.cc (Output_file_header::do_sized_write): Set ELF file
9699         header's processor-specific flags.
9700         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9701         Input_objects pointer type parameter.
9702         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9703         * target.h (Input_objects): New forward class declaration.
9704         (Target::processor_specific_flags,
9705         Target::are_processor_specific_flags_sect): New method definitions.
9706         (Target::finalize_sections): Add input_objects parameter.
9707         (Target::Target): Initialize processor_specific_flags_ and
9708         are_processor_specific_flags_set_.
9709         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9710         parameter.
9711         (Target::set_processor_specific_flags): New method definition.
9712         (Target::processor_specific_flags_,
9713         Target::are_processor_specific_flags_set_): New data member
9714         declarations.
9715         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9716         Input_objects pointer type parameter.
9717
9718 2009-10-30  Doug Kwan  <dougkwan@google.com>
9719
9720         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9721
9722 2009-10-28  Ian Lance Taylor  <iant@google.com>
9723
9724         * object.h (class Relobj): Drop options parameter from
9725         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9726         do_scan_relocs, do_relocate.  Change all callers.
9727         (class Sized_relobj): Drop options parameters from
9728         do_gc_process_relocs, do_scan_relocs, do_relocate,
9729         do_relocate_sections, relocate_sections, emit_relocs_scan,
9730         emit_relocs_scan_reltype.  Change all callers.
9731         (struct Relocate_info): Remove options field and all references to
9732         it.
9733         * reloc.h (class Read_relocs): Remove options constructor
9734         parameter and options_ field.  Change all callers.
9735         (class Gc_process_relocs, class Scan_relocs): Likewise.
9736         (class Relocate_task): Likewise.
9737         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9738         all callers.
9739         (scan_relocatable_relocs): Likewise.
9740         * target.h (class Sized_target): Remove options parameter from
9741         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9742         all callers.
9743         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9744         callers.
9745         * arm.cc: Update functions to remove options parameters.
9746         * i386.cc: Likewise.
9747         * powerpc.cc: Likewise.
9748         * sparc.cc: Likewise.
9749         * x86_64.cc: Likewise.
9750         * testsuite/testfile.cc: Likewise.
9751
9752 2009-10-28  Doug Kwan  <dougkwan@google.com>
9753
9754         * arm.cc (Arm_relobj): New class definition.
9755         (Arm_relobj::scan_sections_for_stubs,
9756         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9757         New method definitions.
9758
9759 2009-10-28  Cary Coutant  <ccoutant@google.com>
9760
9761         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9762         (Plugin::cleanup_done_): New member.
9763         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9764         (Plugin_manager::cleanup_done_): Remove.
9765         (Plugin_manager::add_input_file): Edit error message.
9766         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9767         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9768
9769 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9770
9771         * fileread.cc: (File_read::View::~View): Use the new
9772         data_ownership_ filed.
9773         (File_read::~File_read): Dispose the new whole_file_view_.
9774         (File_read::open): Mmap the whole file if needed.
9775         (File_read::open): Use whole_file_view_ instead of contents_.
9776         (File_read::find_view): Use whole_file_view_ if applicable.
9777         (File_read::do_read): Use whole_file_view_ instead of contents_.
9778         (File_read::make_view): Use whole_file_view_ instead of contents_,
9779         update File_read::View::View call.
9780         (File_read::find_or_make_view): Update File_read::View::View
9781         call.
9782         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9783         remove contents_
9784         (File_read::View::Data_ownership): New enum.
9785         (File_read::View::View): Replace bool mapped_ with Data_ownership
9786         argument.
9787         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9788         (File_read::View::data_ownership_): New field.
9789         (File_read::contents_): Remove (replaced by whole_file_view_).
9790         (File_read::whole_file_view_): New field.
9791         * options.h (class General_options): Add --keep-files-mapped.
9792
9793 2009-10-27  Cary Coutant  <ccoutant@google.com>
9794
9795         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9796         * testsuite/Makefile.am (plugin_test_5): New test case.
9797         * testsuite/Makefile.in: Regenerate.
9798
9799 2009-10-25  Doug Kwan  <dougkwan@google.com>
9800
9801         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9802         from private to protected to allow access by child class.
9803         (Sized_relobj::do_relocate_sections): New method declaration.
9804         (Sized_relobj::relocate_sections): Virtualize.
9805         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9806         Sized_relobj::relocate_sections.  Instantiate template explicitly
9807         for different target sizes and endianity.
9808
9809 2009-10-24  Doug Kwan  <dougkwan@google.com>
9810
9811         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9812         (Arm_input_section::as_arm_input_section): New method.
9813         (Arm_output_section): New class definition.
9814         (Arm_output_section::create_stub_group,
9815         Arm_output_section::group_sections): New method definitions.
9816
9817 2009-10-22  Doug Kwan  <dougkwan@google.com>
9818
9819         * arm.cc (Arm_input_section): New class definition.
9820         (Arm_input_section::init, Arm_input_section:do_write,
9821         Arm_input_section::set_final_data_size,
9822         Arm_input_section::do_reset_address_and_file_offset): New method
9823         definitions.
9824
9825 2009-10-21  Doug Kwan  <dougkwan@google.com>
9826
9827         * arm.cc (Stub_table, Arm_input_section): New forward class
9828         declarations.
9829         (Stub_table): New class defintion.
9830         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9831         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9832         New method definition.
9833
9834 2009-10-21  Doug Kwan  <dougkwan@google.com>
9835
9836         * arm.cc: Update copyright comments.
9837         (Target_arm): New forward class template declaration.
9838         (Arm_address): New type.
9839         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9840         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9841         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9842         constants.
9843         (Insn_template): Same.
9844         (DEF_STUBS): New macro.
9845         (Stub_type): New enum type.
9846         (Stub_template): New class definition.
9847         (Stub): Same.
9848         (Reloc_stub): Same.
9849         (Stub_factory): Same.
9850         (Target_arm::Target_arm): Initialize may_use_blx_ and
9851         should_force_pic_veneer_.
9852         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9853         Target_arm::should_force_pic_veneer,
9854         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9855         Target_arm::using_thumb_only, Target_arm:;default_target): New
9856         method defintions.
9857         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9858         New data member declarations.
9859         (Insn_template::size, Insn_template::alignment): New method defintions.
9860         (Stub_template::Stub_template): New method definition.
9861         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9862         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9863         (Stub_factory::Stub_factory): New method definition.
9864         * gold.h (string_hash): New template.
9865         * output.h (Input_section_specifier::hash_value): Use
9866         gold::string_hash.
9867         (Input_section_specifier::string_hash): Remove.
9868         * stringpool.cc (Stringpool_template::string_hash): Use
9869         gold::string_hash.
9870
9871 2009-10-20  Doug Kwan  <dougkwan@google.com>
9872
9873         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9874         symbols of relaxed input sections.
9875         * output.h (Output_section::find_relaxed_input_section): Make
9876         method public.
9877
9878 2009-10-16  Doug Kwan  <dougkwan@google.com>
9879
9880         * dynobj.cc (Versions::Versions): Initialize version_script_.
9881         Only insert base version symbol definition for a shared object
9882         if version script defines any version versions.
9883         (Versions::define_base_version): New method definition.
9884         (Versions::add_def): Check that base version is not needed.
9885         (Versions::add_need): Define base version lazily.
9886         * dynobj.h (Versions::define_base_version): New method declaration.
9887         (Versions::needs_base_version_): New data member declaration.
9888         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9889         (check_DATA): Add no_version_test.stdout.
9890         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9891         New make rules.
9892         * testsuite/Makefile.in: Regenerate.
9893         * testsuite/no_version_test.c: New file.
9894         * testsuite/no_version_test.sh: Ditto.
9895
9896 2009-10-16  Doug Kwan  <dougkwan@google.com>
9897
9898         * expression.cc (class Segment_start_expression): New class definition.
9899         (Segment_start_expression::value): New method definition.
9900         (script_exp_function_segment_start): Return a new
9901         Segment_start_expression.
9902         * gold/script-c.h (script_saw_segment_start_expression): New function
9903         prototype.
9904         * script-sections.cc (Script_sections::Script_sections): Initialize
9905         SAW_SEGMENT_START_EXPRESSION_ to false.
9906         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9907         and -Tbbs options to specify section addresses if given in
9908         command line and no SEGMENT_START expression is seen in a script.
9909         * script-sections.h (Script_sections::saw_segment_start_expression,
9910         Script_sections::set_saw_segment_start_expression): New method
9911         definition.
9912         (Script_sections::saw_segment_start_expression_): New data member
9913         declaration.
9914         * script.cc (script_saw_segment_start_expression): New function.
9915         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9916         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9917         script_test_7.sh and script_test_8.sh.
9918         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9919         script_test_8.stdout.
9920         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9921         (script_test_6, script_test_6.stdout, script_test_7,
9922         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9923         * Makefile.in: Regenerate.
9924         * testsuite/script_test_6.sh: New file.
9925         * testsuite/script_test_6.t: Same.
9926         * testsuite/script_test_7.sh: Same.
9927         * testsuite/script_test_7.t: Same.
9928         * testsuite/script_test_8.sh: Same.
9929
9930 2009-10-16  Doug Kwan  <dougkwan@google.com>
9931
9932         * output.cc (Output_segment::set_section_list_address): Cast
9933         expressions to unsigned long long type to avoid format warnings.
9934
9935 2009-10-15  Ian Lance Taylor  <iant@google.com>
9936
9937         * script.cc (Script_options::add_symbol_assignment): Always add a
9938         dot assignment to script_sections_.
9939         * script-sections.cc (Script_sections::add_dot_assignment):
9940         Initialize if necessary.
9941
9942         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9943         program headers with no load segment if there is a linker script.
9944
9945         * layout.cc (Layout::set_segment_offsets): Align the file offset
9946         to the segment aligment for -N or -n with no load segment.
9947         * output.cc (Output_segment::add_output_section): Don't crash if
9948         the first section is a TLS section.
9949         (Output_segment::set_section_list_addresses): Print an error
9950         message if the address moves backward in a linker script.
9951         * script-sections.cc
9952         (Output_section_element_input::set_section_addresses): Don't
9953         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9954         (Orphan_output_section::set_section_addresses): Likewise.
9955
9956 2009-10-15  Doug Kwan  <dougkwan@google.com>
9957
9958         * layout.cc (Layout::finish_dynamic_section): Generate tags
9959         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9960         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9961         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9962
9963 2009-10-14  Ian Lance Taylor  <iant@google.com>
9964
9965         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9966         fields.
9967         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9968         data_shdr fields of relinfo.
9969         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9970         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9971         R_386_TLS_LDO_32, adjust based on section flags.
9972         (Target_i386::Relocate::fix_up_ldo): Remove.
9973
9974 2009-10-13  Ian Lance Taylor  <iant@google.com>
9975
9976         Add support for -pie.
9977         * options.h (class General_options): Add -pie and
9978         --pic-executable.
9979         (General_options::output_is_position_independent): Test -pie.
9980         (General_options::output_is_executable): Return true if not shared
9981         and not relocatable.
9982         (General_options::output_is_pie): Remove.
9983         * options.cc (General_options::finalize): Reject incompatible uses
9984         of -pie.
9985         * gold.cc (queue_middle_tasks): A -pie link is not static.
9986         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9987         * symtab.cc (Symbol::final_value_is_known): Return false if
9988         output_is_position_independent.
9989         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9990         output_is_position_independent.
9991         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9992         output_is_position_independent.
9993         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9994         output_is_position_independent.
9995         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9996         two_file_pie_test.
9997         (basic_pie_test.o, basic_pie_test): New targets.
9998         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9999         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10000         (two_file_pie_test): New target.
10001         * testsuite/Makefile.in: Rebuild.
10002         * README: Remove note saying that -pie is not supported.
10003
10004 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10005
10006         * options.h (class General_options): Add -init and -fini.
10007         * layout.cc (Layout::finish_dynamic_section): Emit
10008         given init and fini functions.
10009
10010 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10011
10012         * gc.h (gc_process_relocs): Check if icf is enabled using new
10013         function.
10014         * gold.cc (queue_initial_tasks): Likewise.
10015         (queue_middle_tasks): Likewise.
10016         * object.cc (do_layout): Likewise.
10017         * symtab.cc (is_section_folded): Likewise.
10018         * main.cc (main): Likewise.
10019         * reloc.cc (Read_relocs::run): Likewise.
10020         (Sized_relobj::do_scan_relocs): Likewise.
10021         * icf.cc (is_function_ctor_or_dtor): New function.
10022         (Icf::find_identical_sections): Check if function is ctor or dtor when
10023         safe icf is chosen.
10024         * options.h (General_options::icf): Change option to be an enum.
10025         (Icf_status): New enum.
10026         (icf_enabled): New method.
10027         (icf_safe_folding): New method.
10028         (set_icf_status): New method.
10029         (icf_status_): New variable.
10030         * (options.cc) (General_options::finalize): Set icf_status_.
10031         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10032         icf_test and icf_keep_unique_test to use the --icf enum flag.
10033         * testsuite/icf_safe_test.sh: New file.
10034         * testsuite/icf_safe_test.cc: New file.
10035
10036 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10037
10038         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10039         includes to gc.h and icf.h.
10040         * arm.cc: Include gc.h.
10041         * gold.cc: Likewise.
10042         * i386.cc: Likewise.
10043         * powerpc.cc: Likewise.
10044         * sparc.cc: Likewise.
10045         * x86_64.cc: Likewise.
10046         * gc.h: Include icf.h.
10047
10048 2009-10-11  Ian Lance Taylor  <iant@google.com>
10049
10050         * plugin.cc: Include "gold.h" before other header files.
10051
10052 2009-10-10  Chris Demetriou  <cgd@google.com>
10053
10054         * options.h (Input_file_argument::Input_file_type): New enum.
10055         (Input_file_argument::is_lib_): Replace with...
10056         (Input_file_argument::type_): New member.
10057         (Input_file_argument::Input_file_argument): Take Input_file_type
10058         'type' rather than boolean 'is_lib' as second argument.
10059         (Input_file_argument::is_lib): Use type_.
10060         (Input_file_argument::is_searched_file): New function.
10061         (Input_file_argument::may_need_search): Handle is_searched_file.
10062         * options.cc (General_options::parse_library): Support -l:filename.
10063         (General_options::parse_just_symbols): Update for Input_file_argument
10064         changes.
10065         (Command_line::process): Likewise.
10066         * archive.cc (Archive::get_file_and_offset): Likewise.
10067         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10068         * script.cc (read_script_file, script_add_file): Likewise.
10069         * fileread.cc (Input_file::Input_file): Likewise.
10070         (Input_file::will_search_for): Handle is_searched_file.
10071         (Input_file::open): Likewise.
10072         * readsyms.cc (Read_symbols::get_name): Likewise.
10073         * testsuite/Makefile.am (searched_file_test): New test.
10074         * testsuite/Makefile.in: Regenerate.
10075         * testsuite/searched_file_test.cc: New file.
10076         * testsuite/searched_file_test_lib.cc: New file.
10077
10078 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10079             Ian Lance Taylor  <iant@google.com>
10080
10081         * descriptor.cc: Include <cstdio> and "binary-io.h".
10082         (Descriptors::open): Open the files in binary mode always.
10083         * script.cc (Lex::get_token): Treat \r as whitespace.
10084
10085 2009-10-09  Ian Lance Taylor  <iant@google.com>
10086
10087         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10088
10089 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10090             Ian Lance Taylor  <iant@google.com>
10091
10092         * configure.ac: Check for readv function also.
10093         * fileread.cc (readv): Define if not HAVE_READV.
10094         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10095         does not exist.
10096         * config.in: Regenerate.
10097         * configure: Regenerate.
10098
10099 2009-10-09  Doug Kwan  <dougkwan@google.com>
10100
10101         * layout.cc (Layout::make_output_section): Call target hook to make
10102         ordinary output section.
10103         (Layout::finalize): Adjust parameter list of call the
10104         Target::may_relax().
10105         * layout.h (class Layout::section_list): New method.
10106         * merge.h (Output_merge_base::entsize): Change visibility to public.
10107         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10108         New methods.
10109         (Output_merge_string::do_is_string): New method.
10110         * object.cc (Sized_relobj::do_setup): renamed from
10111         Sized_relobj::set_up.
10112         * object.h (Sized_relobj::adjust_shndx,
10113         Sized_relobj::initializ_input_to_output_maps,
10114         Sized_relobj::free_input_to_output_maps): Change visibilities to
10115         protected.
10116         (Sized_relobj::setup): Virtualize.
10117         (Sized_relobj::do_setup): New method declaration.
10118         (Sized_relobj::invalidate_section_offset,
10119         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10120         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10121         * options.cc (parse_int): New function.
10122         * options.h (parse_int): New declaration.
10123         (DEFINE_int): New macro.
10124         (stub_group_size): New option.
10125         * output.cc (Output_section::Output_section): Initialize memebers
10126         merge_section_map_, merge_section_by_properties_map_,
10127         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10128         (Output_section::add_input_section): Handled deferred code-fill
10129         generation and remove an old comment.
10130         (Output_section::add_relaxed_input_section): New method definition.
10131         (Output_section::add_merge_input_section): Use merge section by
10132         properties map to speed to search.  Update merge section maps
10133         as appropriate.
10134         (Output_section::build_relaxation_map): New method definition.
10135         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10136         Same.
10137         (Output_section::relax_input_section): Renamed to
10138         Output_section::convert_input_sections_to_relaxed_sections and change
10139         interface to take a vector of pointers to relaxed sections.
10140         (Output_section::find_merge_section,
10141         Output_section::find_relaxed_input_section): New method definitions.
10142         (Output_section::is_input_address_mapped,
10143         Output_section::output_offset, Output_section::output_address):
10144         Use output section data maps to speed up searching.
10145         (Output_section::find_starting_output_address): Add comments.
10146         (Output_section::do_write,
10147         Output_section::write_to_postprocessing_buffer): Do code-fill
10148         generation as appropriate.
10149         (Output_section::get_input_sections): Invalidate relaxed input section
10150         map.
10151         (Output_section::restore_states): Adjust type of checkpoint .
10152         Invalidate relaxed input section map.
10153         * output.h (Output_merge_base): New class declaration.
10154         (Input_section_specifier): New class defintion.
10155         (class Output_relaxed_input_section) Change base class to
10156         Output_section_data_build.
10157         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10158         base class initializer.
10159         (Output_section::add_relaxed_input_section): New method declaration.
10160         (Output_section::Input_section): Change visibility to protected.
10161         (Output_section::Input_section::relobj,
10162         Output_section::Input_section::shndx): Handle relaxed input sections.
10163         Output_section::input_sections) Change visibility to protected.  Also
10164         define overload to return a non-const pointer.
10165         (Output_section::Merge_section_properties): New class defintion.
10166         (Output_section::Merge_section_by_properties_map,
10167         Output_section::Output_section_data_by_input_section_map,
10168         Output_section::Relaxation_map): New types.
10169         (Output_section::relax_input_section): Rename method to
10170         Output_section::convert_input_sections_to_relaxed_sections and change
10171         interface to take a vector of relaxed section pointers.
10172         (Output_section::find_merge_section,
10173         Output_section::find_relaxed_input_section,
10174         Output_section::build_relaxation_map,
10175         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10176         New method declarations.
10177         (Output_section::merge_section_map_
10178         Output_section::merge_section_by_properties_map_,
10179         Output_section::relaxed_input_section_map_,
10180         Output_section::is_relaxed_input_section_map_valid_,
10181         Output_section::generate_code_fills_at_write_): New data members.
10182         * script-sections.cc
10183         (Output_section_element_input::set_section_addresses): Call
10184         current_data_size and addralign methods of relaxed input sections.
10185         (Orphan_output_section::set_section_addresses): Call current_data_size
10186         and addralign methods of relaxed input sections.
10187         * symtab.cc (Symbol_table::compute_final_value): Extract template
10188         from the body of Symbol_table::sized_finalize_symbol.
10189         (Symbol_table::sized_finalized_symbol): Call
10190         Symbol_table::compute_final_value.
10191         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10192         (Symbol_table::compute_final_value): New templated method declaration.
10193         * target.cc (Target::do_make_output_section): New method defintion.
10194         * target.h (Target::make_output_section): New method declaration.
10195         (Target::relax): Add more parameters for input objects, symbol table
10196         and layout.  Adjust call to do_relax.
10197         (Target::do_make_output_section): New method declaration.
10198         (Target::do_relax): Add parameters for input objects, symbol table
10199         and layout.
10200
10201 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10202
10203         * pread.c: Include stdio.h.
10204
10205 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10206
10207         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10208         defined.
10209
10210 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10211
10212         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10213         Change read_shndx type to unsigned int.
10214         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10215         int.
10216         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10217         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10218         Change read_shndx type to unsigned int.
10219         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10220         int.
10221         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10222         * layout.cc (Layout::create_symtab_sections): Cast the result of
10223         local_symcount * symsize to off_t in the gold_assert.
10224
10225 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10226
10227         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10228         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10229         R_ARM_BASE_ABS.
10230         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10231         (Arm_relocate_functions::thm_abs5): New function.
10232         (Arm_relocate_functions::abs12): New function.
10233         (Arm_relocate_functions::abs16): New function.
10234         (Arm_relocate_functions::base_abs): New function.
10235         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10236         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10237         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10238         R_ARM_BASE_ABS.
10239         (Scan::global): Likewise.
10240         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10241         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10242         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10243         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10244         R_ARM_BASE_ABS.
10245
10246 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10247
10248         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10249         (Arm_relocate_functions::movt_prel): New function.
10250         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10251         (Arm_relocate_functions::thm_movt_prel): New function.
10252         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10253         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10254         (Scan::global, Relocate::relocate): Likewise.
10255         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10256
10257 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10258
10259         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10260         Incremental_checker.
10261         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10262         unsigned int.
10263         (class Incremental_inputs_header): New class.
10264         (Incremental_inputs_header_writer): Edit comment.
10265         (Incremental_inputs_entry): New class.
10266         (Incremental_inputs_entry_writer): Edit comment.
10267         (Sized_incremental_binary::do_find_incremental_inputs_section):
10268         Add *strtab_shndx parameter, fill it.
10269         (Sized_incremental_binary::do_check_inputs): New method.
10270         (Incremental_checker::can_incrementally_link_output_file): Use
10271         Sized_incremental_binary::check_inputs.
10272         (Incremental_inputs::report_command_line): Save command line in
10273         command_line_.
10274         * incremental.h:
10275         (Incremental_binary::find_incremental_inputs_section): New
10276         method.
10277         (Incremental_binary::do_find_incremental_inputs_section): Add
10278         strtab_shndx parameter.
10279         (Incremental_binary::do_check_inputs): New pure virtual method.
10280         (Sized_incremental_binary::do_check_inputs): Declare.
10281         (Incremental_checker::Incremental_checker): Add incremental_inputs
10282         parameter, use it to initialize incremental_inputs_.
10283         (Incremental_checker::incremental_inputs_): New field.
10284         (Incremental_checker::command_line): New method.
10285         (Incremental_checker::inputs): New method.
10286         (Incremental_checker::command_line_): New field.
10287
10288 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10289
10290         * incremental.cc: Include <cstdarg> and "target-select.h".
10291         (vexplain_no_incremental): New function.
10292         (explain_no_incremental): New function.
10293         (Incremental_binary::error): New method.
10294         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10295         method.
10296         (make_sized_incremental_binary): New function.
10297         (open_incremental_binary): New function.
10298         (can_incrementally_link_file): Add checks if output is ELF and has
10299         inputs section.
10300         * incremental.h: Include "elfcpp_file.h" and "output.h".
10301         (Incremental_binary): New class.
10302         (Sized_incremental_binary): New class.
10303         (open_incremental_binary): Declare.
10304         * object.cc (is_elf_object): Use
10305         elfcpp::Elf_recognizer::is_elf_file.
10306         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10307         * output.h (Output_file::filesize): New method.
10308
10309 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10310
10311         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10312         New function.
10313         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10314         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10315         function.
10316         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10317         function.
10318         (Arm_relocate_functions::movw_abs_nc): New function.
10319         (Arm_relocate_functions::movt_abs): New function.
10320         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10321         (Arm_relocate_functions::thm_movt_abs): New function.
10322         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10323         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10324         (Scan::global): Likewise.
10325         (Relocate::relocate): Likewise.
10326         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10327
10328 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10329
10330         * arm.cc (Arm_relocate_functions::got_prel) New function.
10331         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10332         (Relocate::relocate): Likewise.
10333         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10334
10335 2009-10-06  Ian Lance Taylor  <iant@google.com>
10336
10337         * options.h (class General_options): Define
10338         split_stack_adjust_size parameter.
10339         * object.h (class Object): Add uses_split_stack_ and
10340         has_no_split_stack_ fields.  Add uses_split_stack and
10341         has_no_split_stack accessor functions.  Declare
10342         handle_split_stack_section.
10343         (class Reloc_symbol_changes): Define.
10344         (class Sized_relobj): Define Function_offsets.  Declare
10345         split_stack_adjust, split_stack_adjust_reltype, and
10346         find_functions.
10347         * object.cc (Object::handle_split_stack_section): New function.
10348         (Sized_relobj::do_layout): Call handle_split_stack_section.
10349         * dynobj.cc (Sized_dynobj::do_layout): Call
10350         handle_split_stack_section.
10351         * reloc.cc (Sized_relobj::relocate_sections): Call
10352         split_stack_adjust for executable sections in split_stack
10353         objects.  Pass reloc_map to relocate_section.
10354         (Sized_relobj::split_stack_adjust): New function.
10355         (Sized_relobj::split_stack_adjust_reltype): New function.
10356         (Sized_relobj::find_functions): New function.
10357         * target-reloc.h: Include "object.h".
10358         (relocate_section): Add reloc_symbol_changes parameter.  Change
10359         all callers.
10360         * target.h (class Target): Add calls_non_split method.  Declare
10361         do_calls_non_split virtual method.  Declare match_view and
10362         set_view_to_nop.
10363         * target.cc: Include "elfcpp.h".
10364         (Target::do_calls_non_split): New function.
10365         (Target::match_view): New function.
10366         (Target::set_view_to_nop): New function.
10367         * gold.cc (queue_middle_tasks): Give an error if mixing
10368         split-stack and non-split-stack objects with -r.
10369         * i386.cc (Target_i386::relocate_section): Add
10370         reloc_symbol_changes parameter.
10371         (Target_i386::do_calls_non_split): New function.
10372         * x86_64.cc (Target_x86_64::relocate_section): Add
10373         reloc_symbol_changes parameter.
10374         (Target_x86_64::do_calls_non_split): New function.
10375         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10376         parameter.
10377         * powerpc.cc (Target_powerpc::relocate_section): Add
10378         reloc_symbol_changes parameter.
10379         * sparc.cc (Target_sparc::relocate_section): Add
10380         reloc_symbol_changes parameter.
10381         * configure.ac: Call AM_CONDITIONAL for the default target.
10382         * configure: Rebuild.
10383         * testsuite/Makefile.am (TEST_AS): New variable.
10384         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10385         (check_DATA): Add split_i386 and split_x86_64 files.
10386         (SPLIT_DEFSYMS): Define.
10387         (split_i386_[1234n].o): New targets.
10388         (split_i386_[124]): New targets.
10389         (split_i386_[1234r].stdout): New targets.
10390         (split_x86_64_[1234n].o): New targets.
10391         (split_x86_64_[124]): New targets.
10392         (split_x86_64_[1234r].stdout): New targets.
10393         (MOSTLYCLEANFILES): Add new executables.
10394         * testsuite/split_i386.sh: New file.
10395         * testsuite/split_x86_64.sh: New file.
10396         * testsuite/split_i386_1.s: New file.
10397         * testsuite/split_i386_2.s: New file.
10398         * testsuite/split_i386_3.s: New file.
10399         * testsuite/split_i386_4.s: New file.
10400         * testsuite/split_i386_n.s: New file.
10401         * testsuite/split_x86_64_1.s: New file.
10402         * testsuite/split_x86_64_2.s: New file.
10403         * testsuite/split_x86_64_3.s: New file.
10404         * testsuite/split_x86_64_4.s: New file.
10405         * testsuite/split_x86_64_n.s: New file.
10406         * testsuite/testfile.cc (Target_test): Update relocation_section
10407         function.
10408         * testsuite/Makefile.in: Rebuild.
10409
10410 2009-10-06  Ian Lance Taylor  <iant@google.com>
10411
10412         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10413         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10414         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10415         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10416         the address on ldo_addrs_.
10417         (Target_i386::Relocate::fix_up_ldo): New function.
10418
10419 2009-10-06   Rafael Espindola  <espindola@google.com>
10420
10421         * plugin.cc (add_input_library): New.
10422         (Plugin::load): Add add_input_library to tv.
10423         (Plugin_manager::add_input_file): Add the is_lib argument.
10424         (add_input_file): Update call to Plugin_manager::add_input_file.
10425         (add_input_library): New.
10426         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10427
10428 2009-09-30  Doug Kwan  <dougkwan@google.com>
10429
10430         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10431         symbol and call Symbol::may_need_copy_reloc to determine if
10432         a copy reloc is needed.
10433         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10434         nocopyreloc is given in command line.
10435         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10436         given in command line.
10437         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10438         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10439         of the removed Target_i386::may_need_copy_reloc.
10440         * options.h (copyreloc): New option with default value false.
10441         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10442         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10443         instead of the removed Target_powerpc::may_need_copy_reloc.
10444         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10445         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10446         instead of the removed Target_sparc::may_need_copy_reloc.
10447         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10448         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10449         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10450         instead of the removed Target_x86_64::may_need_copy_reloc.
10451
10452 2009-09-30  Ian Lance Taylor  <iant@google.com>
10453
10454         * object.h (class Object): Remove target_ field, and target,
10455         sized_target, and set_target methods.
10456         (Object::sized_target): Remove.
10457         (class Sized_relobj): Update declarations.  Remove sized_target.
10458         * object.cc (Sized_relobj::setup): Remove target parameter.
10459         Change all callers.
10460         (Input_objects::add_object): Don't do anything with the target.
10461         (make_elf_sized_object): Add punconfigured parameter.  Change all
10462         callers.  Set or test parameter target.
10463         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10464         Change all callers.
10465         * parameters.cc (Parameters::set_target): Change parameter type to
10466         be non-const.
10467         (Parameters::default_target): Remove.
10468         (set_parameters_target): Change parameter type to be non-const.
10469         (parameters_force_valid_target): New function.
10470         (parameters_clear_target): New function.
10471         * parameters.h (class Parameters): Update declarations.  Remove
10472         default_target method.  Add sized_target and clear_target
10473         methods.  Change target_ to be non-const.
10474         (set_parameters_target): Update declaration.
10475         (parameters_force_valid_target): Declare.
10476         (parameters_clear_target): Declare.
10477         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10478         as NULL if we aren't searching.
10479         (Add_symbols::run): Don't check for compatible target.
10480         * fileread.cc (Input_file::open_binary): Call
10481         parameters_force_valid_target.
10482         * gold.cc (queue_middle_tasks): Likewise.
10483         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10484         set_target on object.
10485         * dynobj.h (class Sized_dynobj): Update declarations.
10486         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10487         make_elf_object returns NULL.
10488         (Archive::include_member): Don't check whether object target is
10489         compatible.
10490         * output.cc (Output_section::add_input_section): Get target from
10491         parameters.
10492         (Output_section::relax_input_section): Likewise.
10493         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10494         parameters.
10495         (Sized_relobj::do_scan_relocs): Likewise.
10496         (Sized_relobj::relocate_sections): Likewise.
10497         * resolve.cc (Symbol_table::resolve): Likewise.
10498         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10499         parameter.  Change all callers.
10500         (Symbol_table::add_from_object): Get target from parameters.
10501         (Symbol_table::add_from_relobj): Don't check object target.
10502         (Symbol_table::add_from_dynobj): Likewise.
10503         (Symbol_table::define_special_symbol): Get target from
10504         parameters.
10505         * symtab.h (class Symbol_table): Update declaration.
10506         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10507         parameter.  Change all callers.  Clear parameter target.
10508         (Binary_test): Test target here.
10509         * testsuite/object_unittest.cc (gold_testsuite): Remove
10510         target_test_pointer parameter.  Change all callers.
10511         (Object_test): Test target here.
10512
10513 2009-09-26  Ian Lance Taylor  <iant@google.com>
10514
10515         * testsuite/initpri1.c: Don't try to use constructor priorities if
10516         compiling with gcc before 4.3.
10517
10518 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10519
10520         * testsuite/retain_symbols_file_test.sh (check_present): Change
10521         output file name to retain_symbols_file_test.stdout.
10522         (check_absent): Likewise.
10523
10524 2009-09-18  Craig Silverstein  <csilvers@google.com>
10525
10526         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10527         * options.cc: Include <cerrno> and <fstream>.
10528         (General_options::finalize): Parse -retain-symbols-file tag.
10529         * options.h: New flag.
10530         (General_options): New method should_retain_symbol, new
10531         variable symbols_to_retain.
10532         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10533         should_retain_symbol map.
10534         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10535         * testsuite/Makefile.in: Regenerate.
10536         * testsuite/retain_symbols_file_test.sh: New file.
10537
10538 2009-09-18  Nick Clifton  <nickc@redhat.com>
10539
10540         * po/es.po: Updated Spanish translation.
10541
10542 2009-09-17  Doug Kwan  <dougkwan@google.com>
10543
10544         * debug.h (DEBUG_RELAXATION): New constant.
10545         (DEBUG_ALL): Add DEBUG_RELAXATION.
10546         (debug_string_to_enum): Add relaxation debug option.
10547         * layout.cc
10548         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10549         Layout::Relaxation_debug_check::read_sections,
10550         Layout::Relaxation_debug_check::read_sections): New method definitions.
10551         (Layout::Layout): Initialize data members
10552         record_output_section_data_from_scrips_,
10553         script_output_section_data_list_ and relaxation_debug_check_.
10554         (Layout::save_segments, Layout::restore_segments,
10555         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10556         Layout::relaxation_loop_body): New method definitions.
10557         (Layout::finalize): Support relaxation.  Move section layout code to
10558         Layout::relaxation_loop_body.
10559         (Layout::set_asection_address_from_script): Move code for orphan
10560         section placement out.
10561         (Layout::place_orphan_sections_in_script): New method definition.
10562         * layout.h (Output_segment_headers, Output_file_header):
10563         New forward class declarations.
10564         (Layout::~Layout): Define.
10565         (Layout::new_output_section_data_from_script): New method definition.
10566         (Layout::place_orphan_sections_in_script): New method declaration.
10567         (Layout::Segment_states): New type declaration.
10568         (Layout::save_segments, Layout::restore_segments,
10569         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10570         Layout::relaxation_loop_body): New method declarations.
10571         (Layout::Output_section_data_list): New type declaration.
10572         (Layout::Relaxation_debug_check): New class definition.
10573         (Layout::record_output_section_data_from_script_,
10574         Layout::script_output_section_data_list_, Layout::segment_states_,
10575         Layout::relaxation_debug_check_): New data members.
10576         * output.cc: (Output_section_headers::do_size): New method definition.
10577         (Output_section_headers::Output_section_headers): Move size
10578         computation to Output_section_headers::do_size.
10579         (Output_segment_headers::do_size): New method definition.
10580         (Output_file_header::Output_file_header): Move size computation to
10581         Output_file_header::do_size and call it.
10582         (Output_file_header::do_size): New method definition.
10583         (Output_data_group::Output_data_group): Adjust call to
10584         Output_section_data.
10585         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10586         (Output_symtab_xindex::do_write): Add array bound check.
10587         (Output_section::Input_section::print_to_mapfile): Handle
10588         RELAXED_INPUT_SECTION_CODE.
10589         (Output_section::Output_section): Initialize data member checkpoint_.
10590         (Output_section::~Output_section): Delete checkpoint object pointed
10591         by checkpoint_.
10592         (Output_section::add_input_section): Always add an Input_section if
10593         relaxing.
10594         (Output_section::add_merge_input_section): Add assert.
10595         (Output_section::relax_input_section): New method definition.
10596         (Output_section::set_final_data_size): Set load address to zero for
10597         an unallocated section.
10598         (Output_section::do_address_and_file_offset_have_reset_values):
10599         New method definition.
10600         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10601         Handle relaxed input section.
10602         (Output_section::sort_attached_input_sections): Checkpoint input
10603         section list lazily.
10604         (Output_section::get_input_sections): Change type of input_sections to
10605         list of Simple_input_section pointers.  Checkpoint input section list
10606         lazily.  Also handle relaxed input sections.
10607         (Output_section::add_input_section_for_script): Take a reference to
10608         a Simple_input_section object instead of Relobj pointer and section
10609         index as parameter.  Handle relaxed input sections.
10610         (Output_section::save_states, Output_section::restore_states): New
10611         method definitions.
10612         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10613         (Output_data::is_data_size_fixed): New method definition.
10614         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10615         if it is fixed.
10616         (Output_data::address_and_file_offset_have_reset_values): New method
10617         definition.
10618         (Output_data::do_address_and_file_offset_have_reset_values): New method
10619         definition.
10620         (Output_data::set_data_size): Check that data size is not fixed.
10621         (Output_data::fix_data_size): New method definition.
10622         (Output_data::is_data_size_fixed_): New data member.
10623         (Output_section_headers::set_final_data_size): New method definition.
10624         (Output_section_headers::do_size): New method declaration.
10625         (Output_segment_headers::set_final_data_size): New method definition.
10626         (Output_segment_headers::do_size): New method declaration.
10627         (Output_file_header::set_final_data_size)::New method definition.
10628         (Output_file_header::do_size)::New method declaration.
10629         (Output_section_data::Output_section_data): Add new parameter
10630         is_data_size_fixed and use it to fix data size.
10631         (Output_data_const::Output_data_const): Adjust call to base class
10632         constructor and fix data size.
10633         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10634         base class constructor and fix data size.
10635         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10636         base class constructor and fix data size.
10637         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10638         class constructor and fix data size.
10639         (Output_data_group::set_final_data_size): New method definition.
10640         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10641         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10642         class constructor and fix data size.
10643         (Output_relaxed_input_section): New class definition.
10644         (Output_section::Simple_input_section): New class definition.
10645         (Output_section::get_input_sections): Adjust parameter list.
10646         (Output_section::add_input_section_for_script): Same.
10647         (Output_section::save_states, Output_section::restore_states,
10648         Output_section::do_address_and_file_offset_have_reset_values,
10649         (Output_section::Input_section::Input_section): Handle
10650         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10651         Output_relaxed_input_section.
10652         (Output_section::Input_section::is_input_section,
10653         Output_section::Input_section::set_output_section): Handle relaxed
10654         input section.
10655         (Output_section::Input_section::is_relaxed_input_section,
10656         Output_section::Input_section::output_section_data,
10657         Output_section::Input_section::relaxed_input_section): New method
10658         definitions.
10659         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10660         value.
10661         (Output_section::Input_section::u1_): Update comments.
10662         (Output_section::Input_section::u2_): Add new union member poris.
10663         (Output_section::Checkpoint_output_section): New classs definition.
10664         (Output_section::relax_input_section): New method declaration.
10665         (Output_section::checkpoint_): New data member.
10666         (Output_segment): Update comments.
10667         (Output_segment::Output_segment): Un-privatize copy constructor.
10668         (Output_segment::operator=): Un-privatize.
10669         * script-sections.cc (Output_section_element::Input_section_list):
10670         Change element type to Output_section::Simple_input_section.
10671         (Output_section_element_dot_assignment::set_section_addresses):
10672         Register output section data for relaxation clean up.
10673         (Output_data_exression::Output_data_expression): Adjust call to base
10674         constructor to fix data size.
10675         (Output_section_element_data::set_section_addresses): Register
10676         Output_data_expression object for relaxation clean up.
10677         (struct Input_section_info): Replace Relobj pointer and section index
10678         pair with Output_section::Simple_input_section and Convert struct to a
10679         class.
10680         (Input_section_sorter::operator()): Adjust access to
10681         Input_section_info data member to use accessors.
10682         (Output_section_element_input::set_section_addresses): Use layout
10683         parameter.  Adjust code to use Output_section::Simple_input_section
10684         and Input_secction_info classes.  Register filler for relaxation
10685         clean up.
10686         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10687         and section index pair with Output_section::Simple_input_section
10688         class.  Adjust code accordingly.
10689         (Phdrs_element::release_segment): New method definition.
10690         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10691         segment list.
10692         (Script_sections::release_segments): New method definition.
10693         * gold/script-sections.h (Script_sections::release_segments): New
10694         method declaration.
10695         * gold/target.h (Target::may_relax, Target::relax,
10696         Target::do_may_relax, Target::do_relax): New method definitions.
10697
10698 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10699
10700         * arm.cc (has_signed_unsigned_overflow): New function.
10701         (Arm_relocate_functions::abs8): New function.
10702         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10703         (Target_arm::Scan::global): Likewise.
10704         (Target_arm::relocate::relocate): Likewise.
10705         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10706         Likewise.
10707
10708 2009-09-16  Cary Coutant  <ccoutant@google.com>
10709
10710         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10711         * testsuite/Makefile.in: Regenerate.
10712
10713 2009-09-11  Nick Clifton  <nickc@redhat.com>
10714
10715         * po/gold.pot: Updated by the Translation project.
10716
10717 2009-09-08  Cary Coutant  <ccoutant@google.com>
10718
10719         * output.cc (Output_file::open): Add execute permission to empty file.
10720         * testsuite/Makefile.am (permission_test): New test.
10721         * testsuite/Makefile.in: Regenerate.
10722
10723 2009-09-02  Ian Lance Taylor  <iant@google.com>
10724
10725         * output.cc (Output_file::resize): Call map_no_anonymous rather
10726         than map.
10727
10728 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10729
10730         * gold.cc: Include "incremental.h".
10731         (queue_initial_tasks): Call Incremental_checker methods.
10732         * incremental.cc: Include "output.h".
10733         (Incremental_checker::can_incrementally_link_output_file): New
10734         method.
10735         * incremental.h (Incremental_checker): New class.
10736
10737         * output.cc (Output_file::open_for_modification): New method.
10738         (Output_file::map_anonymous): Changed return type to bool.  Record
10739         map in base_ field.
10740         (Output_file::map_no_anonymous): New method, broken out of map.
10741         (Output_file::map): Use map_no_anonymous and map_anonymous.
10742         * output.h (class Output_file): Update declarations.
10743
10744 2009-08-24  Cary Coutant  <ccoutant@google.com>
10745
10746         * options.h (Command_line::Pre_options): New class.
10747         (Command_line::pre_options): New member.
10748         * options.cc (gold::options::ready_to_register): New variable.
10749         (One_option::register_option): Do nothing if not registering options.
10750         Assert if same short option registered twice.
10751         (General_options::General_options): Turn off option registration when
10752         done constructing.
10753         (Command_line::Pre_options::Pre_options): New constructor.
10754
10755 2009-08-24  Cary Coutant  <ccoutant@google.com>
10756
10757         * options.h (General_options::no_keep_memory): Remove incorrect
10758         short option.
10759
10760 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10761
10762         * Makefile.am (am__skiplex, am__skipyacc): New.
10763         * Makefile.in: Regenerate.
10764
10765 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10766
10767         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10768         (INCLUDES): ... this.
10769         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10770         (AM_CPPFLAGS): Renamed from ...
10771         (INCLUDE): ... this.
10772         * Makefile.in, testsuite/Makefile.in: Regenerate.
10773
10774         * Makefile.in: Regenerate.
10775         * aclocal.m4: Likewise.
10776         * config.in: Likewise.
10777         * configure: Likewise.
10778         * testsuite/Makefile.in: Likewise.
10779
10780         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10781         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10782         * Makefile.in: Regenerate.
10783         * testsuite/Makefile.in: Regenerate.
10784
10785 2009-08-19  Cary Coutant  <ccoutant@google.com>
10786
10787         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10788         symbols in shared libraries overridden by hidden or internal symbols
10789         in the main program.
10790
10791 2009-08-19  Chris Demetriou  <cgd@google.com>
10792
10793         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10794         checking source file names in error messages.
10795
10796 2009-08-18  Doug Kwan  <dougkwan@google.com>
10797
10798         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10799         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10800         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10801         an elfcpp::Ehdr as parameter.
10802         * object.cc (Object::set_target): Remove the version that looks up
10803         a target and sets it.
10804         (Sized_relobj::setup): Take a Target object instead of
10805         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10806         (make_elf_sized_object): Find target and ask target to
10807         make an ELF object.
10808         * object.h: (Object::set_target): Remove the version that looks up
10809         a target and sets it.
10810         (Sized_relobj::setup): Take a Target object instead of
10811         an elfcpp:Ehdr as parameter.
10812         * target.cc: Include dynobj.h.
10813         (Target::do_make_elf_object_implementation): New.
10814         (Target::do_make_elf_object): New.
10815         * target.h (Target::make_elf_object): New template declaration.
10816         (Target::do_make_elf_object): New method declarations.
10817         (Target::do_make_elf_object_implementation): New template declaration.
10818
10819 2009-08-14  Ian Lance Taylor  <iant@google.com>
10820
10821         * gold.h (FUNCTION_NAME): Define.
10822         (gold_unreachable): Use FUNCTION_NAME.
10823
10824 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10825
10826         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10827         symbol in the --keep-unique list is not found.
10828
10829 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10830
10831         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10832         been maked as --keep-unique.
10833         (Icf::unfold_section): New function.
10834         * icf.h (Icf::unfold_section): New function.
10835         * options.h (General_options::keep_unique): New option.
10836         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10837         * testsuite/Makefile.in: Regenerate.
10838         * testsuite/icf_keep_unique_test.sh: New file.
10839         * testsuite/icf_keep_unique_test.cc: New file.
10840
10841 2009-08-12  Cary Coutant  <ccoutant@google.com>
10842
10843         PR 10471
10844         * resolve.cc (Symbol_table::resolve): Check for references from
10845         dynamic objects to hidden and internal symbols.
10846         * testsuite/Makefile.am (hidden_test.sh): New test.
10847         * testsuite/Makefile.in: Regenerate.
10848         * testsuite/hidden_test.sh: New script.
10849         * testsuite/hidden_test_1.c: New test source.
10850         * testsuite/hidden_test_main.c: New test source.
10851
10852 2009-08-11  Doug Kwan  <dougkwan@google.com>
10853
10854         * arm.cc: Update comments.
10855         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10856         segment to locate the .ARM.exidx section if present.
10857
10858 2009-08-09  Doug Kwan  <dougkwan@google.com>
10859
10860         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10861         patch.
10862
10863 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10864         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10865         compiler warnings.
10866
10867 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10868
10869         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10870         valid tls_segment only for non-debug-section relocations.
10871         * testsuite/Makefile.am: Add gc_tls_test.
10872         * testsuite/Makefile.in: Regenerate.
10873         * testsuite/gc_tls_test.cc: New file.
10874         * testsuite/gc_tls_test.sh: New file.
10875
10876 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10877
10878         * icf.cc: New file.
10879         * icf.h: New file.
10880         * Makefile.am (CCFILES): Add icf.cc.
10881         (HFILES): Add icf.h
10882         * Makefile.in: Regenerate.
10883         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10884         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10885         section, symbol and addend information for the relocs.
10886         * gold.cc (queue_middle_tasks): Call identical code folding.
10887         * gold.h: Add defines for multimap.
10888         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10889         to the call of finalize_local_symbols.
10890         * main.cc (main): Create object of class Icf.
10891         * object.cc (Sized_relobj::do_layout): Allow this function to be
10892         called twice during icf.
10893         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10894         to sections marked as identical by icf.
10895         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10896         when available.
10897         (Sized_relobj::do_section_entsize): New function.
10898         * object.h (Object::section_entsize): New function.
10899         (Object::do_section_entsize): New pure virtual function.
10900         (Relobj::finalize_local_symbols): Add new parameter.
10901         (Relobj::do_section_entsize): New function.
10902         * options.h (General_options::icf): New option.
10903         (General_options::icf_iterations): New option.
10904         (General_options::print_icf_sections): New option.
10905         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10906         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10907         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10908         icf.
10909         * symtab.cc (Symbol_table::is_section_folded): New function.
10910         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10911         to sections marked as identical by icf.
10912         * symtab.h (Symbol_table::set_icf): New function.
10913         (Symbol_table::icf): New function.
10914         (Symbol_table::is_section_folded): New function.
10915         (Symbol_table::icf_): New data member.
10916         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10917         * testsuite/Makefile.am: Add commands to build icf_test.
10918         * testsuite/Makefile.in: Regenerate.
10919         * testsuite/icf_test.sh: New file.
10920         * testsuite/icf_test.cc: New file.
10921
10922 2009-07-24  Chris Demetriou  <cgd@google.com>
10923
10924         * layout.cc (is_compressible_debug_section): Fix incorrect
10925         comment about compressed section names.
10926
10927 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10928
10929         PR 10419
10930         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10931
10932 2009-07-16  Ian Lance Taylor  <iant@google.com>
10933
10934         PR 10400
10935         * layout.h: #include <map>.
10936         (class Kept_section): Change from struct to class.  Add accessors
10937         and setters.  Add section size to Comdat_group mapping.  Change
10938         Comdat_group to std::map.  Add is_comdat_ field.  Add
10939         linkonce_size field in union.
10940         (class Layout): Update declaration of find_or_add_kept_section.
10941         Don't declare find_kept_object.
10942         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10943         parameter.  Add object, shndx, is_comdat, and is_group_name
10944         parameters.  Change all callers.  Adjust for new Kept_section.
10945         (Layout::find_kept_object): Remove.
10946         * object.cc (Sized_relobj::include_section_group): Update use of
10947         Kept_section.  Rename secnum to shndx.  Only record
10948         Kept_comdat_section if sections are the same size.
10949         (Sized_relobj::include_linkonce_section): Update use of
10950         Kept_section.  Only record Kept_comdat_section if sections are the
10951         same size.  Set size of linkonce section.
10952         (Sized_relobj::map_to_kept_section): Update call to
10953         get_kept_comdat_section.
10954         * object.h (class Sized_relobj): Rename fields in
10955         Kept_comdat_section to drop trailing underscores; change object
10956         field to Relobj*.  Change Kept_comdat_section_table to store
10957         struct rather than pointer.
10958         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10959         Add kept_object and kept_shndx parameters.  Change all callers.
10960         (Sized_relobj::get_kept_comdat_section): Change return type to
10961         bool.  Add kept_object and kept_shndx parameters.  Change all
10962         callers.
10963         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10964         Layout::find_or_add_kept_section.
10965
10966 2009-07-09  Ian Lance Taylor  <iant@google.com>
10967
10968         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10969         Reserve space in the hash table.
10970
10971 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10972
10973         * fileread.cc (File_read::get_mtime): New method.
10974         * fileread.h (Timespec): New structure.
10975         (File_read::get_mtime): New method.
10976         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10977         Renamed from timestamp_nsec.
10978         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10979         Elf_Xword.
10980         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10981         timestamp_nsec.
10982         (Incremental_inputs::report_archive): Save mtime; style fix.
10983         (Incremental_inputs::report_obejct): Save mtime; style fix.
10984         (Incremental_inputs::report_script): Save mtime; style fix.
10985         (Incremental_inputs::finalize_inputs): Style fix.
10986         (Incremental_inputs::finalize): Style fix.
10987         (Incremental_inputs::create_input_section_data): Store inputs
10988         mtime.
10989         * incremental.h (Incremental_inputs::report_script): Add mtime
10990         argument.
10991         (Incremental_inputs::Input_info::Input_info): Intialize only one
10992         union member.
10993         (Incremental_inputs::Input_info::archive): Move to nameless
10994         union.
10995         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10996         (Incremental_inputs::Input_info::script): Move to nameless union.
10997         (Incremental_inputs::mtime): New field.
10998         * script.cc (read_input_script): Pass file mtime to
10999         Incremental_input.
11000         * script.h (Script_info::inputs): Style fix.
11001
11002 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11003
11004         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11005         instead of 32.
11006
11007 2009-06-24  Ian Lance Taylor  <iant@google.com>
11008
11009         PR 10156
11010         * layout.cc (Layout::choose_output_section): If we find an
11011         existing section, update the flags.
11012         (Layout::create_notes): New function, broken out of
11013         Layout::finalize.
11014         (Layout::finalize): Don't create note sections.
11015         (Layout::create_note): Don't crash if linker script discards
11016         section.
11017         (Layout::create_gold_note): Likewise.
11018         (Layout::create_build_id): Likewise.  Don't set
11019         after_input_sections on the section.
11020         (Layout::create_executable_stack_info): Remove target parameter.
11021         Change caller.
11022         * layout.h (class Layout): Declare create_notes.  Update
11023         declaration of create_executable_stack_info.
11024         * gold.cc (queue_middle_tasks): Call create_notes.
11025         * output.cc (Output_section::update_flags_for_input_section): Move
11026         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11027         invalid.
11028         * output.h (Output_data::mark_address_invalid): New function.
11029         (class Output_section): Only declare, not define,
11030         update_flags_for_input_section.  Remove set_flags.
11031
11032 2009-06-24  Ian Lance Taylor  <iant@google.com>
11033
11034         * script-sections.cc (Output_section_definition::
11035         set_section_addresses): Rename shadowing local load_address to
11036         laddr.
11037
11038 2009-06-24  Ian Lance Taylor  <iant@google.com>
11039
11040         PR 10244
11041         * reloc.cc (relocate_sections): Skip empty relocation sections.
11042
11043 2009-06-23  Ian Lance Taylor  <iant@google.com>
11044
11045         PR 10156
11046         * layout.cc (Layout::create_note): Use choose_output_section
11047         rather than make_output_section.
11048
11049 2009-06-23  Ian Lance Taylor  <iant@google.com>
11050
11051         PR 10237
11052         * options.cc (General_options::parse_V): Set printed_version_.
11053         (General_options::General_options): Initialize printed_version_.
11054         * options.h (class General_options): Add printed_version_ field.
11055         * gold.cc (queue_initial_tasks): If there are no input files,
11056         don't give a fatal error if we printed the version information.
11057         (queue_middle_tasks): If using -r with a shared object, give a
11058         fatal error rather than an ordinary error.
11059
11060 2009-06-23  Ian Lance Taylor  <iant@google.com>
11061
11062         PR 10219
11063         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11064         (Layout::make_output_section): Set have_stabstr_section_ if we see
11065         a .stab*str section.
11066         (Layout::finalize): Call link_stabs_sections.
11067         (Layout::link_stabs_sections): New file.
11068         * layout.h (class Layout): Add have_stabstr_section_ field.
11069         Declare link_stabs_sections.
11070
11071 2009-06-23  Doug Kwan  <dougkwan@google.com>
11072
11073         * Makefile.am (libgold_a_LIBADD): New.
11074         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11075         * Makefile.in: Regenerate.
11076         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11077         * configure: Regenerate.
11078         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11079         * fileread.cc: Include sys/state.h
11080         * gold.h: Declare memmem and strndup if found missing.
11081         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11082
11083 2009-06-23  Ian Lance Taylor  <iant@google.com>
11084
11085         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11086         * configure: Rebuild.
11087
11088 2009-06-23  Ian Lance Taylor  <iant@google.com>
11089
11090         PR 10147
11091         * object.cc (Object::section_contents): Don't try to get a view if
11092         the section has length zero.
11093         (Object::handle_gnu_warning_section): If the section is empty, use
11094         the name of the section as the warning.
11095
11096 2009-06-23  Ian Lance Taylor  <iant@google.com>
11097
11098         PR 10133
11099         * stringpool.h (class Stringpool_template): Add optimize_ field.
11100         (Stringpool_template::set_optimize): New function.
11101         * stringpool.cc (Stringpool_template::Stringpool_template):
11102         Initialize optimize_ field.
11103         (Stringpool_template::set_string_offsets): Test local optimize
11104         fild rather than parameter.
11105         * layout.cc (Layout::Layout): Call set_optimize on the section
11106         name stringpool.
11107
11108 2009-06-22  Ian Lance Taylor  <iant@google.com>
11109
11110         PR 10030
11111         * yyscript.y: Parse TARGET.
11112         * script.cc (script_set_target): New function.
11113         * script-c.h (script_set_target): Declare.
11114         * options.cc (General_options::string_to_object_format): Rename
11115         from string_to_object_format in anonymous namespace.  Change
11116         callers.
11117         * options.h (class General_options): Declare
11118         string_to_object_format.
11119
11120 2009-06-22  Ian Lance Taylor  <iant@google.com>
11121
11122         * script-sections.cc (Script_sections::create_segments): Don't put
11123         program headers in a PT_LOAD segment if -n or -N.
11124
11125 2009-06-22  Ian Lance Taylor  <iant@google.com>
11126
11127         PR 10141
11128         * options.h (class General_options): Add -z lazy and -z now.  Sort
11129         -z options into alphabetical order.
11130         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11131
11132 2009-06-21  Ian Lance Taylor  <iant@google.com>
11133
11134         * layout.cc (Layout::make_output_section): Call
11135         Target::new_output_section.
11136         (Layout::attach_allocated_section_to_segment): Put large section
11137         sections in a separate load segment with the large segment flag
11138         set.
11139         (Layout::segment_precedes): Sort large data segments after other
11140         load segments.
11141         (align_file_offset): New static function.
11142         (Layout::set_segment_offsets): Use align_file_offset.
11143         * output.h (class Output_section): Add is_small_section_ and
11144         is_large_section_ fields.
11145         (Output_section::is_small_section): New function.
11146         (Output_section::set_is_small_section):  New function.
11147         (Output_section::is_large_section): New function.
11148         (Output_section::set_is_large_section): New function.
11149         (Output_section::is_large_data_section): New function.
11150         (class Output_segment): Add is_large_data_segment_ field.
11151         (Output_segment::is_large_data_segment): New function.
11152         (Output_segment::set_is_large_data_segment): New function.
11153         * output.cc (Output_section::Output_section): Initialize new
11154         fields.
11155         (Output_segment::Output_segment): Likewise.
11156         (Output_segment::add_output_section): Add assertion that large
11157         data sections always go in large data segments.  Force small data
11158         sections to the end of the list of data sections.  Force small BSS
11159         sections to the start of the list of BSS sections.  For large BSS
11160         sections to the end of the list of BSS sections.
11161         * symtab.h (class Symbol): Declare is_common_shndx.
11162         (Symbol::is_defined): Check Symbol::is_common_shndx.
11163         (Symbol::is_common): Likewise.
11164         (class Symbol_table): Define enum Commons_section_type.  Update
11165         declarations.  Add small_commons_ and large_commons_ fields.
11166         * symtab.cc (Symbol::is_common_shndx): New function.
11167         (Symbol_table::Symbol_table): Initialize new fields.
11168         (Symbol_table::add_from_object): Put small and large common
11169         symbols in the right list.
11170         (Symbol_table::sized_finalized_symbol): Check
11171         Symbol::is_common_shndx.
11172         (Symbol_table::sized_write_globals): Likewise.
11173         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11174         common symbol lists.  Don't call do_allocate_commons_list if the
11175         list is empty.
11176         (Symbol_table::do_allocate_commons_list): Remove is_tls
11177         parameter.  Add comons_section_type parameter.  Change all
11178         callers.  Handle small and large common symbols.
11179         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11180         Symbol::is_common_shndx.
11181         * resolve.cc (symbol_to_bits): Likewise.
11182         * target.h (Target::small_common_shndx): New function.
11183         (Target::small_common_section_flags): New function.
11184         (Target::large_common_shndx): New function.
11185         (Target::large_common_section_flags): New function.
11186         (Target::new_output_section): New function.
11187         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11188         small_common_section_flags, and large_common_section_flags
11189         fields.
11190         (Target::do_new_output_section): New virtual function.
11191         * arm.cc (Target_arm::arm_info): Initialize new fields.
11192         * i386.cc (Target_i386::i386_info): Likewise.
11193         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11194         Likewise.
11195         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11196         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11197         (Target_x86_64::do_new_output_section): New function.
11198         * configure.ac: Define conditional MCMODEL_MEDIUM.
11199         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11200         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11201         (large_LDFLAGS): Define.
11202         * testsuite/large.c: New file.
11203         * testsuite/testfile.cc (Target_test::test_target_info):
11204         Initialize new fields.
11205         * configure, testsuite/Makefile.in: Rebuild.
11206
11207 2009-06-05  Doug Kwan  <dougkwan@google.com>
11208
11209         * Makefile.am (CCFILES): Add target.cc.
11210         * Makefile.in: Regenerate.
11211         * i386.cc (class Target_i386): Define new virtual method to
11212         override do_is_local_label_name in parent.
11213         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11214         local symbols if --discard-locals or -X is given.
11215         * options.h (class General_options): Declare new options
11216         '--discard-locals' and '-X' for discarding locals.
11217         * target.h (class Target): Define new methods is_local_label_name.
11218         Declare new virtual method do_is_local_label_name.
11219         * target.cc: New file.
11220         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11221         (check_SCRIPTS): Add discard_locals_test.sh.
11222         (check_DATA): Add discard_local_tests.syms.
11223         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11224         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11225         * testsuite/Makefile.in: Regenerate.
11226         * testsuite/discard_locals_test.c: New file.
11227         * testsuite/discard_locals_test.sh: Same.
11228
11229 2009-06-05  Doug Kwan  <dougkwan@google.com>
11230
11231         * object.cc (Sized_relobj::Sized_relobj): Initialize
11232         discarded_eh_frame_shndx_ to -1U.
11233         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11234         section.
11235         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11236         a discarded .eh_frame section.
11237         (Sized_relobj::do_finalize_local_symbols): Ditto.
11238         * object.h (class Sized_relobj): Declare new member
11239         discarded_eh_frame_shndx_.
11240         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11241         (local_labels_test.o, local_labels_test): New rules.
11242         * testsuite/Makefile.in: Regenerate.
11243
11244 2009-06-04  Doug Kwan  <dougkwan@google.com>
11245
11246         * layout.cc (Layout::section_name_mapping): Add mapping for
11247         special ARM sections.
11248
11249 2009-06-03  Doug Kwan  <dougkwan@google.com>
11250
11251         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11252         (utils::has_overflow): Same.
11253
11254 2009-06-03  Ian Lance Taylor  <iant@google.com>
11255
11256         * layout.cc (Layout::section_name_mapping): New array, replacing
11257         Layout::linkonce_mapping.
11258         (Layout::section_name_mapping_count): New variable, replacing
11259         Layout::linkonce_mapping_count.
11260         (Layout::linkonce_output_name): Remove.
11261         (Layout::output_section_name): Rewrite.
11262         * layout.h (class Layout): Rename Linkonce_mapping to
11263         Section_name_mapping, linkonce_mapping to section_name_mapping,
11264         linkonce_mapping_count to section_name_mapping_count.  Don't
11265         declare linkonce_output_name.
11266
11267 2009-06-03  Doug Kwan  <dougkwan@google.com>
11268
11269         * gold/arm.cc (namespace utils): New.
11270         (Target_arm::reloc_is_non_pic): Define new method.
11271         (class Arm_relocate_functions): New.
11272         (Target_arm::Relocate::relocate): Handle relocation types used by
11273         Android.
11274
11275 2009-06-03  Ian Lance Taylor  <iant@google.com>
11276
11277         * arm.cc (Target_arm::scan::global): Use || instead of |.
11278
11279 2009-06-02  Doug Kwan  <dougkwan@google.com>
11280
11281         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11282         issued_non_pic_error_.
11283         (class Target_arm::Scan): Declare new method check_non_pic.
11284         Define new method symbol_needs_plt_entry.
11285         Declare new data member issued_non_pic_error_.
11286         (class Target_arm::Relocate): Declare new method
11287         should_apply_static_reloc.
11288         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11289         (Target_arm::Scan::check_non_pic): Define new method.
11290         (Target_arm::Scan::local): Handle a small subset of reloc types used
11291         by Android.
11292         (Target_arm::Scan::local): Same.
11293         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11294
11295 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11296
11297         * incremental.cc (Incremental_inputs::report_command_line): Filter
11298         out --incremental-* options.
11299
11300 2009-05-29  Doug Kwan  <dougkwan@google.com>
11301
11302         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11303         template class.
11304         (class Target_arm): Update comment.
11305         (Target_arm::Target_arm): Initialize new data members GOT_,
11306         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11307         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11308         and Target_arm::rel_dyn_section.
11309         Declare new_enum Target_arm::Got_type.
11310         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11311         and DYNBSS_.
11312         Update commments for member do_dynsym_value.
11313         (Target_arm::got_size, Target_arm::plt_section,
11314         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11315         new methods inside class defintion.
11316         (Target_arm::got_section): Define new method.
11317         (Target_arm::rel_dyn_section): Same.
11318         (Output_data_plt_arm): New template class.
11319         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11320         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11321         (Output_data_plt_arm::add_entry): Same.
11322         (Output_data_plt_arm::first_plt_entry): Define new
11323         static data member for PLT instruction template.
11324         (Output_data_plt_arm::plt_entry): Same.
11325         (Output_data_plt_arm::do_write): Define new method.
11326         (Target_arm::make_plt_entry): Same.
11327         (Target_arm::do_finalize_sections): Same.
11328         (Target_arm::do_dynsym_value): Same.
11329
11330 2009-05-28  Doug Kwan  <dougkwan@google.com>
11331
11332         * Makefile.am (TARGETSOURCES): Add arm.cc.
11333         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11334         * Makefile.in: Regenerate.
11335         * arm.cc: New file.
11336         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11337
11338 2009-05-26  Doug Kwan  <dougkwan@google.com>
11339
11340         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11341         (General_options::check_excluded_libs): Strip off directories in
11342         archive name before matching like GNU ld does.
11343         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11344         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11345         (exclude_libs_test_LDFLAGS): Add linker option
11346         -Wl,--exclude-libs,libexclude_libs_test_3
11347         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11348         an explicit archive without using -l.
11349         (alt/libexclude_libs_test_3.a): New make rule.
11350         * testsuite/Makefile.in: Regenerate.
11351         * testsuite/exclude_libs_test.c : Declare lib3_default().
11352         (main): Call it.
11353         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11354         * exclude_libs_test_3.c: New file.
11355
11356 2009-05-26  Nick Clifton  <nickc@redhat.com>
11357
11358         * po/id.po: New Indonesian translation.
11359         * po/gold.pot: Updated template file.
11360
11361 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11362
11363         * testsuite/Makefile.am: Add -ffunction-sections to compile
11364         gc_comdat_test files.  Add -Wl,--gc-sections to build
11365         gc_comdat_test.
11366         * testsuite/Makefile.in: Regenerate.
11367         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11368
11369 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11370
11371         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11372         kept comdat section was garbage collected.
11373         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11374         * testsuite/Makefile.in: Regenerate.
11375         * testsuite/gc_comdat_test.sh: New file.
11376         * testsuite/gc_comdat_test_1.cc: New file.
11377         * testsuite/gc_comdat_test_2.cc: New file.
11378
11379 2009-05-19  Doug Kwan  <dougkwan@google.com>
11380
11381         * archive.cc (Archive::Archive): Move constructor from archive.h
11382         to here.  Initialize no_export_.
11383         (Archive::get_elf_object_for_member): Set no_export flag of object.
11384         * archive.h (Archive::Archive): Move constructor body to
11385         archive.cc.
11386         (Archive::no_export): New method.
11387         (Archive::no_export_): New field.
11388         * object.h (Object::Object): Initialize no_export_ to false.
11389         (Object::no_export, Object::set_no_export): New methods.
11390         (Object::no_export_): New field.
11391         * options.cc (General_options::parse_exclude_libs): New method.
11392         (General_options::check_excluded_libs) Same.
11393         * options.h (exclude_libs): New option.
11394         (General_options::check_excluded_libs): New method declaration.
11395         (General_options::excluded_libs_): New field.
11396         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11397         default or protected visibility if an object has no-export flag set.
11398         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11399         (check_SCRIPTS): Add exclude_libs_test.sh.
11400         (check_DATA): Add exclude_libs_test.syms.
11401         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11402         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11403         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11404         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11405         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11406         libexclude_libs_test_2.a): New rules.
11407         * testsuite/Makefile.in: Regenerate.
11408         * testsuite/exclude_libs_test.c: New file.
11409         * testsuite/exclude_libs_test.sh: Ditto.
11410         * testsuite/exclude_libs_test_1.c: Ditto.
11411         * testsuite/exclude_libs_test_2.c: Ditto.
11412
11413 2009-05-15  Ian Lance Taylor  <iant@google.com>
11414
11415         * configure.ac: Check for declarations for cases where libiberty.h
11416         checks HAVE_DECL_xxx.
11417         * configure, config.in: Rebuild.
11418
11419 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11420
11421         * gold.h (Incremental_argument_list): Remove (invalid) forward
11422         declaration.
11423         * incremental.cc (Incremental_inputs::report_achive): New method.
11424         (Incremental_inputs::report_object): New method.
11425         (Incremental_inputs::report_script): New method.
11426         (Incremental_inputs::finalize_inputs): New method.
11427         (Incremental_inputs::finalize): Call finalize_inputs().
11428         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11429         Create inputs entries.
11430         * incremental.h (Incremental_input_type): New enum.
11431         (Incremental_inputs::Incremental_input): Initialize new fields.
11432         (Incremental_inputs::report_inputs): New method.
11433         (Incremental_inputs::report_achive): New method.
11434         (Incremental_inputs::report_object): New method.
11435         (Incremental_inputs::report_script): New method.
11436         (Incremental_inputs::finalize_inputs): New method.
11437         (Incremental_inputs::Input_info): New struct.
11438         (Incremental_inputs::Input_info_map): New typedef.
11439         (Incremental_inputs::lock_): New field.
11440         (Incremental_inputs::Inputs_): New field.
11441         (Incremental_inputs::Inputs_map): New field.
11442         * main.cc (main): Call Incremental_input::report_inputs.
11443         * options.h (Input_argument_list): Typedef moved from
11444         Input_arguments.
11445         (Input_file_group::Files): Remove, use ::Input_argument_list.
11446         (Input_file_group::Input_argument_list): Remove, use
11447         ::Input_argument_list.
11448         * plugin.cc (Plugin_manager::add_input_file): Add error in
11449         incremental build.
11450         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11451         functions.
11452         * script.cc (read_input_script): Call
11453         Incremental_input::report_script.
11454         * script.h (Script_info): New class.
11455
11456 2009-04-27  Ian Lance Taylor  <iant@google.com>
11457
11458         * x86_64.cc (do_adjust_output_section): Set entsize to
11459         plt_entry_size.
11460
11461 2009-04-23  Elliott Hughes  <enh@google.com>
11462
11463         * output.cc (Output_file::close): After short writes, continue
11464         writing from the correct offset in the buffer being written.
11465
11466 2009-04-23  Chris Demetriou  <cgd@google.com>
11467
11468         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11469         * configure: Regenerate.
11470         * config.in: Regenerate.
11471         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11472         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11473
11474 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11475
11476         * incremental.cc (Incremental_inputs_header_data): Renamed from
11477         Incremental_input_header_data.
11478         (Incremental_inputs_header_data::data_size): New field.
11479         (Incremental_inputs_header_data::put_input_file_count): Renamed
11480         from input_file_count.
11481         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11482         from command_line_offset.
11483         (Incremental_inputs_header_data::put_reserved): Renamed from
11484         put_reserved.
11485         (Incremental_inputs_entry_data): Renamed from
11486         Incremental_input_entry_data.
11487         (Incremental_inputs_entry_data::data_size): New field.
11488         (Incremental_inputs::report_command_line): New method.
11489         (Incremental_inputs::finalize): New method.
11490         (Incremental_inputs::create_incremental_inputs_data): New method.
11491         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11492         * incremental.h: New file.
11493         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11494         (Layout::finalize): Create incremental inputs section in
11495         incremental builds.
11496         (Layout::create_incremental_info_sections): New method.
11497         * layout.h (Layout::incremental_inputs): New method.
11498         (Layout::create_incremental_info_sections): New method.
11499         (Layout::incremental_inputs_): New field.
11500         * main.cc (main): Notify Incremental_input of the command line.
11501
11502 2009-04-01  Ian Lance Taylor  <iant@google.com>
11503             Mikolaj Zalewski  <mikolajz@google.com>
11504
11505         * gold.h (reserve_unordered_map): Define, three versions, one for
11506         each version of Unordered_map.
11507         * layout.cc (Layout::Layout): Remove options parameter.  Add
11508         number_of_input_files parameter.  Don't initialize options_.
11509         Initialize number_of_input_files_ and resized_signatures_.  Move
11510         sections_are_attached_.
11511         (Layout::layout_group): Reserve space for group_signatures_.
11512         (Layout::find_or_add_kept_section): Change name parameter to be a
11513         reference.  Resize signatures_ map when it gets large enough.
11514         (Layout::layout_eh_frame): Use parameters->options() instead of
11515         this->options_.
11516         (Layout::make_output_section): Likewise.
11517         (Layout::attach_allocated_section_to_segment): Likewise.
11518         (Layout::finalize, Layout::create_executable_stack): Likewise.
11519         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11520         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11521         * layout.h (class Layout): Update declarations.  Remove options_
11522         field.  Add number_of_input_files_ and resized_signatures_
11523         fields.  Move sections_are_attached_ field.
11524         * main.cc (main): Pass number of input files to Layout
11525         constructor.  Don't pass options.
11526
11527 2009-03-30  Ian Lance Taylor  <iant@google.com>
11528
11529         * ffsll.c (ffsll): Correct implementation.
11530
11531 2009-03-27  Ian Lance Taylor  <iant@google.com>
11532
11533         * ffsll.c: New file.
11534         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11535         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11536         * ftruncate.c (ftruncate): Declare before definition.
11537         * mremap.c (mremap): Likewise.
11538         * pread.c (pread): Likewise.
11539         * configure, Makefile.in, config.in: Rebuild.
11540
11541         * mremap.c: New file.
11542         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11543         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11544         (mremap): Declare if HAVE_MREMAP is not defined.
11545         * configure, Makefile.in, config.in: Rebuild.
11546
11547 2009-03-27  Cary Coutant  <ccoutant@google.com>
11548
11549         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11550         position independent.
11551         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11552         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11553
11554 2009-03-24  Cary Coutant  <ccoutant@google.com>
11555
11556         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11557         an executable.
11558         (needs_dynamic_reloc): Likewise.
11559
11560 2009-03-24  Ian Lance Taylor  <iant@google.com>
11561
11562         * yyscript.y (file_cmd): Recognize EXTERN.
11563         (extern_name_list, extern_name_list_body): New nonterminals.
11564         * script.cc (script_add_extern): Define.
11565         * script-c.h (script_add_extern): Declare.
11566
11567 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11568
11569         * object.cc (is_elf_object): Define.
11570         * object.h (is_elf_object): Declare.
11571         * archive.cc (Archive::get_elf_object_for_member): Call
11572         is_elf_object.
11573         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11574
11575 2009-03-24  Elliott Hughes  <enh@google.com>
11576
11577         * output.cc (Output_file::map_anonymous): Define.
11578         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11579         try an anonymous one.  Report the size if the mmap fails.
11580         * output.h (class Output_file): Declare map_anonymous.
11581
11582 2009-03-24  Ian Lance Taylor  <iant@google.com>
11583
11584         * target-select.cc (instantiate_target): Don't acquire the lock if
11585         the instantiated_target_ field has already been set.
11586
11587 2009-03-23  Ian Lance Taylor  <iant@google.com>
11588
11589         * gold-threads.h (class Initialize_lock): Define.
11590         * gold-threads.cc (class Initialize_lock_once): Define.
11591         (initialize_lock_control): New static variable.
11592         (initialize_lock_pointer): New static variable.
11593         (initialize_lock_once): New static function.
11594         (Initialize_lock::Initialize_lock): Define.
11595         (Initialize_lock::initialize): Define.
11596         * target-select.h: Include "gold-threads.h".
11597         (class Target_selector): Add lock_ and initialize_lock_ fields.
11598         Don't define instantiate_target, just declare it.
11599         * target-select.cc (Target_selector::Target_selector): Initialize
11600         new fields.
11601         (Target_selector::instantiate_target): Define.
11602         * descriptors.h: Include "gold-threads.h".
11603         (class Descriptors): Add initialize_lock_ field.
11604         * descriptors.cc (Descriptors::Descriptors): Initialize new
11605         field.
11606         (Descriptors::open): Use initialize_lock_ field
11607         * errors.h (class Errors): Add initialize_lock_ field.
11608         * errors.cc (Errors::Errors): Initialize new field.
11609         (Errors::initialize_lock): Use initialize_lock_ field.
11610         * powerpc.cc (class Target_selector_powerpc): Remove
11611         instantiated_target_ field.  In do_recognize call
11612         instantiate_target rather than do_instantiate_target.  In
11613         do_instantiate_target just allocate a new target.
11614         * sparc.cc (class Target_selector_sparc): Likewise.
11615
11616         * freebsd.h: New file.
11617         * i386.cc: Include "freebsd.h".
11618         (Target_i386): Derive from Target_freebsd rather than
11619         Sized_target.
11620         (Target_selector_i386): Derive from Target_selector_freebsd rather
11621         than Target_selector.
11622         * x86_64.cc: Include "freebsd.h".
11623         (Target_x86_64): Derive from Target_freebsd rather than
11624         Sized_target.
11625         (Target_selector_x86_64): Derive from Target_selector_freebsd
11626         rather than Target_selector.
11627         * target.h (class Target): Add adjust_elf_header and
11628         do_adjust_elf_header.
11629         * output.cc (Output_file_header:: do_sized_write): Call target
11630         adjust_elf_header routine.
11631         * configure.tgt: Set targ_osabi.
11632         * configure.ac: Define GOLD_DEFAULT_OSABI.
11633         * parameters.cc (Parameters::default_target): Pass
11634         GOLD_DEFAULT_OSABI to select_target.
11635         * target-select.h (class Target_selector): Make instantiate_target
11636         protected rather than private.
11637         * Makefile.am (HFILES): Add freebsd.h.
11638         * configure, Makefile.in, config.in: Rebuild.
11639
11640         * merge.cc (do_add_input_section): Correct pend value.  Change
11641         message about last entry not being null terminated from error to
11642         warning.
11643
11644 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11645
11646         * incremental.cc: New file.
11647         * Makefile.am (CCFILES): Add incremental.cc.
11648         * Makefile.in: Rebuild.
11649
11650 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11651
11652         * layout.cc (Layout::output_section_name): Preserve names
11653         of '.note.' sections.
11654
11655 2009-03-19  Ian Lance Taylor  <iant@google.com>
11656
11657         * descriptors.cc (Descriptors::open): Check that the options are
11658         valid before using them.
11659
11660 2009-03-18  Ian Lance Taylor  <iant@google.com>
11661
11662         * script-sections.h: Include <list>.
11663         (class Script_sections): Change Sections_elements from std::vector
11664         to std::list.  Typedef public Elements_iterator.  Add
11665         orphan_section_placement_, data_segment_align_start_, and
11666         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11667         field.
11668         * script-sections.cc (class Orphan_section_placement): New class.
11669         (class Sections_element): Add virtual functions is_relro and
11670         orphan_section_init.  Remove virtual function place_orphan_here.
11671         (class Output_section_definition): Add is_relro and
11672         orphan_section_init.  Remove place_orphan_here.
11673         (class Orphan_output_section): Likewise.
11674         (Script_sections::Script_sections): Update for field changes.
11675         (Script_sections::data_segment_align): Set saw_data_segment_align_
11676         and data_segment_align_start_, not data_segment_align_index.
11677         (Script_sections::data_segment_relro_end): Check
11678         saw_data_segment_align_.  Use data_segment_align_start_ rather
11679         than data_segment_align_index_.
11680         (Script_sections::place_orphan): Rewrite to use
11681         Orphan_section_placement.
11682
11683 2009-03-17  Ian Lance Taylor  <iant@google.com>
11684
11685         * archive.cc (Archive::add_symbols): Check for a version attached
11686         to the symbol name in the archive map.
11687         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11688         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11689         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11690         (ver_test_11.a): New target.
11691         * testsuite/Makefile.in: Rebuild.
11692
11693         * configure.ac: Check for chsize and posix_fallocate.  Replace
11694         ftruncate.
11695         * ftruncate.c: New file, from gnulib.
11696         * output.cc (posix_fallocate): Define dummy version if not
11697         HAVE_POSIX_FALLOCATE.
11698         (Output_file::map): Call posix_fallocate rather than lseek and
11699         write.
11700         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11701         * configure, Makefile.in, config.in: Rebuild.
11702
11703 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11704
11705         * layout.h (Layout::create_note): Add section_name parameter.
11706         * layout.cc (Layout::create_note): Likewise.
11707         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11708
11709 2009-03-17  Ian Lance Taylor  <iant@google.com>
11710
11711         * descriptors.cc: Include "options.h".
11712         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11713         (Descriptors::open): Always use O_CLOEXEC when opening a new
11714         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11715         then set FD_CLOEXEC.
11716
11717         * sparc.cc (class Target_sparc): Add has_got_section.
11718         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11719         make sure we have a GOT section.
11720
11721         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11722         (Target_sparc::Scan::local): Likewise.
11723         (Target_sparc::Scan::global): Likewise.
11724         (Target_sparc::Relocate::relocate): Likewise.
11725         (Target_sparc::Relocate::relocate_tls): Likewise.
11726
11727         * symtab.cc (Symbol_table::define_default_version): New function,
11728         broken out of add_from_object.
11729         (Symbol_table::add_from_object): Call define_default_version.
11730         (Symbol_table::define_special_symbol): Add resolve_oldsym
11731         parameter.  Change all callers.  If the version for a symbol comes
11732         from a version script, resolve it with the symbol with the same
11733         name with no version.  Also add the symbol without a version if
11734         appropriate.
11735         (do_define_in_output_data): If resolving with oldsym, don't delete
11736         sym.
11737         (do_define_in_output_segment): Likewise.
11738         (do_define_as_constant): Likewise.
11739         * symtab.h (class Symbol_table): Update declarations.
11740
11741 2009-03-13  Ian Lance Taylor  <iant@google.com>
11742
11743         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11744         (Read_symbols::requeue): New function.
11745         (Read_symbols::do_read_symbols): If make_elf_object fails because
11746         the target type is not configured, and the file was searched for,
11747         issue a warning and retry with the next directory.
11748         (Add_symbols::run): If the file has an incompatible format, and
11749         it was searched for, requeue the Read_symbols task.  On error,
11750         release the object.
11751         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11752         dirindex parameter to constructor.  Change all callers.  Declare
11753         incompatible_warning and requeue.
11754         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11755         input_argument_ and input_group_ fields.  Add them to
11756         constructor.  Change all callers.
11757         (class Read_script): Add dirindex_ field.  Add it to constructor.
11758         Change all callers.
11759         * archive.cc (Archive::setup): Remove input_objects parameter.
11760         Change all callers.
11761         (Archive::get_file_and_offset): Likewise.
11762         (Archive::read_all_symbols): Likewise.
11763         (Archive::read_symbols): Likewise.
11764         (Archive::get_elf_object_for_member): Remove input_objects
11765         parameter.  Add punconfigured parameter.  Change all callers.
11766         (Archive::add_symbols): Change return type to bool.  Check return
11767         value of include_member.
11768         (Archive::include_all_members): Likewise.
11769         (Archive::include_member): Change return type to bool.  Return
11770         false if first included object has incompatible target.  Set
11771         included_member_ field.
11772         (Add_archive_symbols::run): If add_symbols returns false, requeue
11773         Read_symbols task.
11774         * archive.h (class Archive): Add included_member_ field.
11775         Initialize it in constructor.  Add input_file and searched_for
11776         methods.  Update declarations.
11777         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11778         input_argument_ fields.  Add them to constructor.  Change all
11779         callers.
11780         * script.cc: Include "target-select.h".
11781         (class Parser_closure): Add skip_on_incompatible_target_ and
11782         found_incompatible_target_ fields.  Add
11783         skip_on_incompatible_target parameter to constructor.  Change all
11784         callers.  Add methods skip_on_incompatible_target,
11785         clear_skip_on_incompatible_target, found_incompatible_target, and
11786         set_found_incompatible_target.
11787         (read_input_script): Add dirindex parameter.  Change all callers.
11788         If parser finds an incompatible target, requeue Read_symbols
11789         task.
11790         (script_set_symbol): Clear skip_on_incompatible_target in
11791         closure.
11792         (script_add_assertion, script_parse_option): Likewise.
11793         (script_start_sections, script_add_phdr): Likewise.
11794         (script_check_output_format): New function.
11795         * script.h (read_input_script): Update declaration.
11796         * script-c.h (script_check_output_format): Declare.
11797         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11798         (ignore_cmd): Remove OUTPUT_FORMAT.
11799         * fileread.cc (Input_file::Input_file): Add explicit this.
11800         (Input_file::will_search_for): New function.
11801         (Input_file::open): Add pindex parameter.  Change all callers.
11802         * fileread.h (class Input_file): Add input_file_argument method.
11803         Declare will_search_for.  Update declarations.
11804         * object.cc (make_elf_object): Add punconfigured parameter.
11805         Change all callers.
11806         * object.h (class Object): Make input_file public.  Add
11807         searched_for method.
11808         (make_elf_object): Update declaration.
11809         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11810         restart search.
11811         * dirsearch.h (class Dirsearch): Update declaration.
11812         * options.h (class General_options): Add --warn-search-mismatch.
11813         * parameters.cc (Parameters::is_compatible_target): New function.
11814         * parameters.h (class Parameters): Declare is_compatible_target.
11815         * workqueue.cc (Workqueue::add_blocker): New function.
11816         * workqueue.h (class Workqueue): Declare add_blocker.
11817
11818         * fileread.cc (Input_file::open): Remove options parameter.
11819         Change all callers.
11820         (Input_file::open_binary): Likewise.
11821         * script.cc (read_input_script): Likewise.
11822         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11823         options parameter from constructor.  Change all callers.
11824         (class Read_script): Likewise.
11825         * fileread.h (class Input_file): Update declarations.
11826         * script.h (read_input_script): Update declaration.
11827
11828 2009-03-10  Nick Clifton  <nickc@redhat.com>
11829
11830         * po/es.po: New Spanish translation.
11831
11832 2009-03-06  Cary Coutant  <ccoutant@google.com>
11833
11834         * options.cc (parse_short_option): Keep dash_z from registering itself.
11835
11836 2009-03-03  Ian Lance Taylor  <iant@google.com>
11837
11838         PR 9918
11839         * target-reloc.h (relocate_section): Pass output_section to
11840         relocate.
11841         * i386.cc (Target_i386::should_apply_static_reloc): Add
11842         output_section parameter.  Change all callers.
11843         (Target_i386::Relocate::relocate): Add output_section parameter.
11844         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11845         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11846         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11847         * testsuite/two_file_shared.sh: New script.
11848         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11849         (check_DATA): Add two_file_shared.dbg.
11850         (two_file_shared.dbg): New target.
11851         * testsuite/Makefile.in: Rebuild.
11852
11853 2009-03-01  Ian Lance Taylor  <iant@google.com>
11854
11855         * configure.ac: Check for byteswap.h.
11856         * configure: Rebuild.
11857         * config.in: Rebuild.
11858
11859 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11860
11861         * layout.cc (Layout::find_or_add_kept_section): New function.
11862         (Layout::add_comdat): Removed.
11863         * layout.h (struct Kept_section): Move out of class Layout.
11864         Remove trailing underscores from field names.  Add group_sections
11865         field.  Rename group_ field to is_group.  Change all uses.
11866         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11867         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11868         comdat_groups_ field.
11869         (Sized_relobj::include_section_group): Use
11870         find_or_add_kept_section and Kept_section::group_sections.
11871         (Sized_relobj::include_linkonce_section): Likewise.
11872         * object.cc (class Sized_relobj): Don't define Comdat_group or
11873         Comdat_group_table.  Remove find_comdat_group and
11874         add_comdat_group.  Remove comdat_groups_ field.
11875         * plugin.cc (include_comdat_group): Use
11876         Layout::find_or_add_kept_section.
11877
11878 2009-02-28  Ian Lance Taylor  <iant@google.com>
11879
11880         * README: --gc-sections and map files are now supported.  Document
11881         some build requirements.
11882
11883         PR 6992
11884         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11885         relocatable link set the value of the section symbol to zero.
11886         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11887         relocatable link don't include the section address in the local
11888         symbol value.
11889
11890 2009-02-27  Ian Lance Taylor  <iant@google.com>
11891
11892         PR 6811
11893         * options.h (class Search_directory): Add is_system_directory.
11894         (class General_options): Declare is_in_system_directory.
11895         * options.cc (get_relative_sysroot): Make static.
11896         (get_default_sysroot): Make static.
11897         (General_optoins::is_in_system_directory): New function.
11898         * fileread.cc (Input_file::is_in_system_directory): New function.
11899         * fileread.h (class Input_file): Declare is_in_system_directory.
11900         * object.h (class Object): Add is_in_system_directory.
11901         (class Input_objects): Remove system_library_directory_ field.
11902         * object.cc (Input_objects::add_object): Don't set
11903         system_library_directory_.
11904         (input_objects::found_in_system_library_directory): Remove.
11905         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11906         parameter.  Change all callers.
11907         (Symbol_table::sized_write_globals): Likewise.
11908         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11909         Call Object::is_in_system_directory.
11910         * symtab.h (class Symbol_table): Update declarations.
11911
11912         PR 5990
11913         * descriptors.h (Open_descriptor): Add is_on_stack field.
11914         * descriptors.cc (Descriptors::open): If the descriptor is on the
11915         top of the stack, remove it.  Initialize is_on_stack field.
11916         (Descriptors::release): Only add pod to stack if it is not on the
11917         stack already.
11918         (Descriptors::close_some_descriptor): Clear stack_next and
11919         is_on_stack fields.
11920
11921         PR 7091
11922         * output.cc (Output_section::find_starting_output_address): Rename
11923         from starting_output_address; add PADDR parameter; change return
11924         type.
11925         * output.h (class Output_section): Declare
11926         find_starting_output_address instead of starting_output_address.
11927         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11928         section symbol for which we can't find a merge section.
11929
11930         PR 9836
11931         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11932         hidden or internal, force the symbol to be local.
11933         * resolve.cc (Symbol::override_visibility): Define.
11934         (Symbol::override_base): Use override_visibility.
11935         (Symbol_table::resolve): Likewise.
11936         (Symbol::override_base_with_special): Likewise.
11937         (Symbol_table::override_with_special): If the visibility is hidden
11938         or internal, force the symbol to be local.
11939         * symtab.h (class Symbol): Add set_visibility and
11940         override_visibility.
11941         * testsuite/ver_test_1.sh: New file.
11942         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11943         (check_DATA): Add ver_test_1.syms.
11944         (ver_test_1.syms): New target.
11945         * testsuite/Makefile.in: Rebuild.
11946
11947 2009-02-25  Cary Coutant  <ccoutant@google.com>
11948
11949         * layout.cc (Layout::choose_output_section): Don't rename sections
11950         when using a linker script that has a SECTIONS clause.
11951         * Makefile.in: Regenerate.
11952
11953         * testsuite/Makefile.am (script_test_5.sh): New test case.
11954         * testsuite/Makefile.in: Regenerate.
11955         * testsuite/script_test_5.cc: New file.
11956         * testsuite/script_test_5.sh: New file.
11957         * testsuite/script_test_5.t: New file.
11958
11959 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11960
11961         * archive.cc (Archive::include_member): Update calls to add_symbols.
11962         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11963         the Layout argument.
11964         * dynobj.h (do_add_symbols): Add the Layout argument.
11965         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11966         Layout argument.
11967         * object.h (Object::add_symbols): Add the Layout argument.
11968         (Object::do_add_symbols): Add the Layout argument.
11969         (Sized_relobj::do_add_symbols): Add the Layout argument.
11970         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11971         Unify the two versions.
11972         (Add_plugin_symbols): Remove.
11973         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11974         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11975         (Add_plugin_symbols): Remove.
11976         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11977         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11978         (Add_symbols::run): Make it work with Pulginobj.
11979
11980 2009-02-06  Ian Lance Taylor  <iant@google.com>
11981
11982         * object.cc (Sized_relobj::do_layout): Make info message start
11983         with lower case letter.
11984
11985 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11986
11987         * binary.cc: Fix file comment.
11988
11989         * options.h (enum Incremental_disposition): Define.
11990         (class General_options): Add new options: --incremental,
11991         --incremental_changed, --incremental_unchanged,
11992         --incremental_unknown.  Add incremental_disposition_ and
11993         implicit_incremental_ fields.
11994         (General_options::incremental_disposition): New function.
11995         (class Position_dependent_options): Add incremental_disposition
11996         option.
11997         (Position_dependent_options::copy_from_options): Set incremental
11998         dispositions.
11999         * options.cc (General_options::parse_incremental_changed): New
12000         function.
12001         (General_options::parse_incremental_unchanged): New function.
12002         (General_options::parse_incremental_unknown): New function.
12003         (General_options::General_options): Initialize new fields
12004         incremental_disposition_ and implicit_incremental_.
12005         (General_options::finalize): Check for uasge of --incremental-*
12006         without --incremental.
12007
12008 2009-02-06  Chris Demetriou  <cgd@google.com>
12009
12010         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12011         pointer and to report location as the file name associated with
12012         the symbol.
12013         (gold_undefined_symbol_at_location): New function to replace the
12014         old gold_undefined_symbol functionality.
12015         * target-reloc.h (relocate_section): Update to use
12016         gold_undefined_symbol_at_location.
12017         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12018         Call gold_undefined_symbol function rather than gold_error.
12019         * errors.h (Errors::undefined_symbol): Take location as a
12020         string, rather than calculating it from a relocation.
12021         * errors.cc (Errors::fatal): Print "fatal error:" before the
12022         formatted message.
12023         (Errors::error, Errors::error_at_location): Print "error: "
12024         before the formatted message.
12025         (Errors::undefined_symbol): Take location as a string, rather
12026         than calculating it from a relocation.
12027         (gold_undefined_symbol_at_location): New function akin to
12028         old gold_undefined_symbol, calculates location from relocation.
12029         (gold_undefined_symbol): Change to take only a Symbol pointer
12030         and to report location as the file name associated with the symbol.
12031         * testsuite/debug_msg.sh: Update for changed error messages.
12032         * testsuite/undef_symbol.sh: Likewise.
12033
12034 2009-02-04  Duncan Sands  <baldrick@free.fr>
12035
12036         PR 9812
12037         * reduced_debug_output.h
12038         (Output_reduced_debug_abbrev_section::failed): Use format for
12039         gold_warning.
12040         (Output_reduced_debug_info_section::faild): Likewise.
12041
12042 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12043
12044         * script.cc (Lazy_demangler): New class.
12045         (Version_script_info::get_symbol_version_helper): Demangle a
12046         symbol only once.
12047
12048 2009-01-29  Cary Coutant  <ccoutant@google.com>
12049
12050         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12051         to __tls_get_addr.
12052         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12053
12054 2009-01-28  Ian Lance Taylor  <iant@google.com>
12055
12056         * version.cc (version_string): Bump to 1.9.
12057
12058         * gold.h: Include <cstring> and <stdint.h>.
12059         * version.cc: Include <cstdio>.
12060         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12061         warning.
12062         * reduced_debug_output.cc (insert_into_vector): Rename from
12063         Insert_into_vector; change all callers.  Use Swap_unaligned to
12064         avoid aliasing issue; remove union since it is unnecessary.
12065
12066 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12067
12068         * Makefile.am (CCFILES): Add gc.cc.
12069         (HFILES): Add gc.h.
12070         * Makefile.in: Regenerate.
12071         * gold.cc (Gc_runner): New class.
12072         (queue_initial_tasks): Call garbage collection related tasks
12073         when corresponding options are invoked.
12074         (queue_middle_gc_tasks): New function.
12075         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12076         processed early before laying out sections during garbage collection.
12077         * gold.h (queue_middle_gc_tasks): New function.
12078         (is_prefix_of): Move from "layout.cc".
12079         * i386.cc (Target_i386::gc_process_relocs): New function.
12080         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12081         * main.cc (main): Create object of class "Garbage_collection".
12082         * object.cc (Relobj::copy_symbols_data): New function.
12083         (Relobj::is_section_name_included): New function.
12084         (Sized_relobj::do_layout): Allow this function to be called twice
12085         during garbage collection and defer layout of section during the
12086         first call.
12087         * object.h (Relobj::get_symbols_data): New function.
12088         (Relobj::is_section_name_included): New function.
12089         (Relobj::copy_symbols_data): New function.
12090         (Relobj::set_symbols_data): New function.
12091         (Relobj::get_relocs_data): New function.
12092         (Relobj::set_relocs_data): New function.
12093         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12094         (Relobj::gc_process_relocs): New function.
12095         (Relobj::do_gc_process_relocs): New pure virtual function.
12096         (Relobj::sd_): New data member.
12097         (Sized_relobj::is_output_section_offset_invalid): New function.
12098         (Sized_relobj::do_gc_process_relocs): New function.
12099         * options.h (General_options::gc_sections): Modify to not be a no-op.
12100         (General_options::print_gc_sections): New option.
12101         * plugin.cc (Plugin_finish::run): Remove function call to
12102         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12103         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12104         * reloc.cc (Read_relocs::run): Add task to process relocs and
12105         determine unreferenced sections when doing garbage collection.
12106         (Gc_process_relocs): New class.
12107         (Sized_relobj::do_gc_process_relocs): New function.
12108         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12109         sections that are garbage collected.
12110         * reloc.h (Gc_process_relocs): New class.
12111         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12112         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12113         symbols whose corresponding sections are garbage collected.
12114         (Symbol_table::Symbol_table): Add new parameter for the garbage
12115         collection object.
12116         (Symbol_table::gc_mark_undef_symbols): New function.
12117         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12118         (Symbol_table::gc_mark_dyn_syms): New function.
12119         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12120         as garbage.
12121         (Symbol_table::add_from_object): Likewise.
12122         (Symbol_table::add_from_relobj): When building shared objects, do not
12123         treat externally visible symbols as garbage.
12124         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12125         table information for static and relocatable links.
12126         * symtab.h (Symbol_table::set_gc): New function.
12127         (Symbol_table::gc): New function.
12128         (Symbol_table::gc_mark_undef_symbols): New function.
12129         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12130         (Symbol_table::gc_mark_dyn_syms): New function.
12131         (Symbol_table::gc_): New data member.
12132         * target.h (Sized_target::gc_process_relocs): New pure virtual
12133         function.
12134         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12135         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12136
12137 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12138
12139         * options.h (General_options::gc_sections): Define as a no-op for now.
12140         (General_options::no_keep_memory): Ditto.
12141         (General_options::Bshareable): Define.
12142         * options.cc (General_options::finalize): Honor -Bshareable.
12143
12144 2009-01-20  Andreas Schwab  <schwab@suse.de>
12145
12146         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12147         read the value in the contents, since we don't use it.  Use the
12148         template endianness when writing.
12149         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12150
12151 2009-01-19  Andreas Schwab  <schwab@suse.de>
12152
12153         * configure.tgt (powerpc64-*): Fix targ_obj.
12154
12155 2009-01-15  Ian Lance Taylor  <iant@google.com>
12156
12157         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12158         local symbols when stripping all symbols.
12159
12160 2009-01-14  Cary Coutant  <ccoutant@google.com>
12161
12162         * output.cc (Output_reloc): Add explicit instantiations.
12163
12164 2009-01-14  Cary Coutant  <ccoutant@google.com>
12165
12166         * archive.cc (Archive::get_elf_object_for_member): Remove call
12167         to File_read::claim_for_plugin.
12168         * descriptors.cc (Descriptors::open): Remove reference to
12169         is_claimed.
12170         (Descriptors::claim_for_plugin): Remove.
12171         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12172         (Descriptors::is_claimed): Remove.
12173         (claim_descriptor_for_plugin): Remove.
12174         * fileread.cc (File_read::claim_for_plugin): Remove.
12175         * fileread.h (File_read::claim_for_plugin): Remove.
12176         (File_read::descriptor): Reopen descriptor if necessary.
12177         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12178         (Plugin_manager::all_symbols_read): Add task parameter. Change
12179         all callers.
12180         (Plugin_manager::get_input_file): New function.
12181         (Plugin_manager::release_input_file): New function.
12182         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12183         corresponding data member.
12184         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12185         and pass to base constructor. Change all callers.
12186         (get_input_file, release_input_file): New functions.
12187         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12188         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12189         (Plugin_manager::all_symbols_read): Add task parameter.
12190         (Plugin_manager::get_input_file): New function.
12191         (Plugin_manager::release_input_file): New function.
12192         (Plugin_manager::task_): New data member.
12193         (Pluginobj::Pluginobj): Add filesize parameter.
12194         (Pluginobj::filename): New function.
12195         (Pluginobj::descriptor): New function.
12196         (Pluginobj::filesize): New function.
12197         (Pluginobj::filesize_): New data member.
12198         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12199         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12200         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12201
12202         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12203         with archive libraries.
12204         * testsuite/Makefile.in: Regenerate.
12205         * testsuite/plugin_test.c (struct sym_info): New type.
12206         (get_input_file, release_input_file): New static variables.
12207         (onload): Capture new transfer vector entries.
12208         (claim_file_hook): Stop reading at end of file according to filesize.
12209         Factor out parsing of readelf output into separate function.
12210         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12211         APIs and get the source file name from the symbol table.  Convert
12212         source file name to corresponding object file name.  Print info
12213         message when adding new input files.
12214         (parse_readelf_line): New function.
12215         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12216         * testsuite/plugin_test_2.sh: Likewise.
12217         * testsuite/plugin_test_3.sh: Likewise.
12218         * testsuite/plugin_test_4.sh: New test case.
12219
12220 2009-01-07  Ian Lance Taylor  <iant@google.com>
12221
12222         * version.cc (version_string): Bump to 1.8.
12223
12224 2008-12-23  Cary Coutant  <ccoutant@google.com>
12225
12226         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12227         * plugin.cc (Plugin_manager::finish): Rename as
12228         layout_deferred_objects.  Move cleanup to separate function.
12229         (Plugin_manager::cleanup): New function.
12230         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12231         separately.
12232         * plugin.h (Plugin_manager::finish): Rename as
12233         layout_deferred_objects.
12234         (Plugin_manager::cleanup): New function.
12235         (Plugin_manager::cleanup_done): New field.
12236
12237 2008-12-23  Cary Coutant  <ccoutant@google.com>
12238
12239         * plugin.cc (is_visible_from_outside): New function.
12240         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12241         so we don't return "IR only" status for exported symbols or -r links.
12242
12243         * testsuite/Makefile.am (plugin_test_3): New test case.
12244         * testsuite/Makefile.in: Regenerate.
12245         * testsuite/plugin_test_3.sh: New file.
12246
12247 2008-12-22  Cary Coutant  <ccoutant@google.com>
12248
12249         * object.cc (Sized_relobj::layout_section): New function.
12250         (Sized_relobj::do_layout): Defer layout of input sections until after
12251         plugin has provided replacement files.
12252         (Sized_relobj::do_layout_deferred_sections): New function.
12253         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12254         (Relobj::layout_deferred_sections): New function.
12255         (Relobj::do_layout_deferred_sections): New function.
12256         (Sized_relobj::do_layout_deferred_sections): New function.
12257         (Sized_relobj::layout_section): New function.
12258         (Sized_relobj::Deferred_layout): New structure.
12259         (Sized_relobj::deferred_layout_): New field.
12260         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12261         Change all callers.  Layout deferred sections.
12262         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12263         references.
12264         (Plugin_hook::run): Move code from do_plugin_hook inline.
12265         (Plugin_hook::do_plugin_hook): Remove.
12266         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12267         (Plugin_manager::finish): Renamed, was cleanup.
12268         (Plugin_manager::should_defer_layout): New function.
12269         (Plugin_manager::add_deferred_layout_object): New function.
12270         (Plugin_manager::Deferred_layout_list): New type.
12271         (Plugin_manager::deferred_layout_objects_): New field.
12272         (Plugin_hook::do_plugin_hook): Remove.
12273
12274 2008-12-17  Ian Lance Taylor  <iant@google.com>
12275
12276         * options.h (class General_options): Add --no case for
12277         --export-dynamic.
12278
12279 2008-12-16  Cary Coutant  <ccoutant@google.com>
12280
12281         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12282         vector.
12283         (Plugin_manager::claim_file): Create plugin object even if
12284         plugin did not call the add_symbols callback.
12285         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12286         asking for more symbols than were added.
12287         * testsuite/Makefile.am (plugin_test_1): Add test case with
12288         no global symbols.
12289         (empty.syms): New target.
12290         * testsuite/Makefile.in: Regenerate.
12291         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12292         message. Don't call add_symbols if no globals.
12293         (all_symbols_read_hook): Don't provide replacement for empty
12294         claimed file.
12295
12296 2008-12-12  Ian Lance Taylor  <iant@google.com>
12297
12298         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12299         r_type == 0 for a local symbol with r_sym == 0.
12300         (scan_relocatable_relocs): Pass r_sym to
12301         local_non_section_strategy.
12302         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12303         r_sym parameter.
12304
12305         * configure.ac: Update test for TLS descriptors: they are
12306         supported as of glibc 2.9.
12307         * configure: Rebuild.
12308
12309 2008-12-11  Ian Lance Taylor  <iant@google.com>
12310
12311         PR 7091
12312         * target-reloc.h (Default_scan_relocatable_relocs): For each
12313         function, map r_type == 0 to RELOC_DISCARD.
12314
12315 2008-12-10  Cary Coutant  <ccoutant@google.com>
12316
12317         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12318         object to override a kept COMDAT group from a plugin object.
12319
12320 2008-12-09  Ian Lance Taylor  <iant@google.com>
12321
12322         PR 7088
12323         * yyscript.y (file_cmd): Handle INPUT.
12324
12325         * testsuite/initpri1.c: Change all declarations to be full
12326         prototypes by adding void, to avoid compiler warnings.
12327
12328 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12329
12330         * options.cc (General_options::parse_plugin_opt): New.
12331         (General_options::add_plugin): The argument now is just the filename.
12332         (General_options::add_plugin_option): New.
12333         * options.h (plugin_opt): New.
12334         (add_plugin): Change argument name.
12335         (add_plugin_option): New.
12336         * plugin.cc (Plugin::load): Don't parse the plugin option.
12337         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12338         (Plugin::add_option): New.
12339         (Plugin::args_): Change type.
12340         (Plugin::filename_): New.
12341         (Plugin_manager::add_plugin_option): New.
12342         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12343         * testsuite/Makefile.in: Regenerate.
12344
12345 2008-12-05  Cary Coutant  <ccoutant@google.com>
12346
12347         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12348         Handle --strip-lto-sections option.
12349         * options.h (strip_lto_sections): New option.
12350
12351 2008-12-01  Cary Coutant  <ccoutant@google.com>
12352
12353         * plugin.cc (ld_plugin_message): Change format parameter to const.
12354         Fix mismatch between new[] and delete.
12355
12356 2008-11-14  Cary Coutant  <ccoutant@google.com>
12357
12358         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12359         instead of -1U.
12360
12361 2008-11-05  Craig Silverstein  <csilvers@google.com>
12362
12363         * options.cc (General_options::parse_dynamic_list): New function.
12364         * options.h (General_options): New flags dynamic_list,
12365         dynamic_list_data, dynamic_list_cpp_new, and
12366         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12367         (General_options::in_dynamic_list): New function.
12368         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12369         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12370         (Lex::can_continue_name): Likewise.
12371         (yylex): Likewise.
12372         (read_script_file): New parameter script_options.
12373         (read_dynamic_list): New function.
12374         (Script_options::define_dynamic_list): New function.
12375         (dynamic_list_keyword_parsecodes): New variable.
12376         (dynamic_list_keywords): New variable.
12377         * script.h (Script_options::define_dynamic_list): New function
12378         prototype.
12379         (read_dynamic_list): New function prototype.
12380         * symtab.cc (strprefix): New macro.
12381         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12382         dynamic_list_data, dynamic_list_cpp_new, and
12383         dynamic_list_cpp_typeinfo.
12384         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12385         (dynamic_list_expr): New rule.
12386         (dynamic_list_nodes): Likewise.
12387         (dynamic_list_node): Likewise.
12388         * testsuite/Makefile.am (dynamic_list): New test.
12389         * testsuite/Makefile.in: Regenerated.
12390         * testsuite/dynamic_list.t: New file.
12391         * testsuite/dynamic_list.sh: New file.
12392
12393 2008-11-05  Craig Silverstein  <csilvers@google.com>
12394
12395         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12396         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12397         (t11_last): Likewise.
12398         * testsuite/ver_test_6.c (main): Likewise.
12399
12400 2008-10-07  Cary Coutant  <ccoutant@google.com>
12401
12402         * options.c (General_options::finalize): Add check for -static and
12403         -shared.
12404         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12405         is not empty.
12406
12407 2008-10-02  Cary Coutant  <ccoutant@google.com>
12408
12409         * plugin.cc (make_sized_plugin_object): Fix conditional
12410         compilation to work when not all targets are enabled.
12411
12412 2008-09-29  Cary Coutant  <ccoutant@google.com>
12413
12414         * archive.cc (Archive::get_file_and_offset): Use filename instead
12415         of name to get library path.
12416         (Archive::include_member): Unlock external member of a thin archive.
12417
12418         * testsuite/Makefile.am (TEST_AR): New variable.
12419         (thin_archive_test_1): New test.
12420         (thin_archive_test_2): New test.
12421         * testsuite/Makefile.in: Regenerate.
12422         * testsuite/thin_archive_main.cc: New file.
12423         * testsuite/thin_archive_test_1.cc: New file.
12424         * testsuite/thin_archive_test_2.cc: New file.
12425         * testsuite/thin_archive_test_3.cc: New file.
12426         * testsuite/thin_archive_test_4.cc: New file.
12427
12428 2008-09-29  Cary Coutant  <ccoutant@google.com>
12429
12430         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12431         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12432         instead of -1U.
12433         (Sized_relobj::do_finalize_local_symbols): Likewise.
12434         (Sized_relobj::map_to_kept_section): Likewise.
12435         * object.h (Sized_relobj::invalid_address): New constant.
12436         (Sized_relobj::do_output_section_offset): Check for invalid_address
12437         and return -1ULL.
12438         * output.cc (Output_reloc::local_section_offset): Use constant
12439         invalid_address instead of -1U.
12440         (Output_reloc::get_address): Likewise.
12441         (Output_section::output_address): Change -1U to -1ULL.
12442         * output.h (Output_reloc::invalid_address): New constant.
12443         * reloc.cc (Sized_relobj::write_sections): Use constant
12444         invalid_address instead of -1U.
12445         (Sized_relobj::relocate_sections): Likewise.
12446         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12447         values for merge sections.
12448         * target-reloc.h (relocate_for_relocatable): Use constant
12449         invalid_address instead of -1U.
12450
12451 2008-09-19  Cary Coutant  <ccoutant@google.com>
12452
12453         Add plugin functionality for link-time optimization (LTO).
12454         * configure.ac (plugins): Add --enable-plugins option.
12455         * configure: Regenerate.
12456         * config.in: Regenerate.
12457         * Makefile.am (LIBDL): New variable.
12458         (CCFILES): Add plugin.cc.
12459         (HFILES): Add plugin.h.
12460         (ldadd_var): Add LIBDL.
12461         * Makefile.in: Regenerate.
12462
12463         * archive.cc: Include "plugin.h".
12464         (Archive::setup): Don't preread archive symbols when using a plugin.
12465         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12466         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12467         files.
12468         (Archive::include_member): Add symbols from plugin objects.
12469         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12470         * descriptors.cc (Descriptors::open): Check for file descriptors
12471         abandoned by plugins.
12472         (Descriptors::claim_for_plugin): New function.
12473         * descriptors.h (Descriptors::claim_for_plugin): New function.
12474         (Open_descriptor::is_claimed): New field.
12475         (claim_descriptor_for_plugin): New function.
12476         * fileread.cc (File_read::claim_for_plugin): New function.
12477         * fileread.h (File_read::claim_for_plugin): New function.
12478         (File_read::descriptor): New function.
12479         * gold.cc: Include "plugin.h".
12480         (queue_initial_tasks): Add task to call plugin hooks for generating
12481         new object files.
12482         * main.cc: Include "plugin.h".
12483         (main): Load plugin libraries.
12484         * object.h (Pluginobj): Declare.
12485         (Object::pluginobj): New function.
12486         (Object::do_pluginobj): New function.
12487         (Object::set_target): New function.
12488         * options.cc: Include "plugin.h".
12489         (General_options::parse_plugin): New function.
12490         (General_options::General_options): Initialize plugins_ field.
12491         (General_options::add_plugin): New function.
12492         * options.h (Plugin_manager): Declare.
12493         (General_options): Add --plugin option.
12494         (General_options::has_plugins): New function.
12495         (General_options::plugins): New function.
12496         (General_options::add_plugin): New function.
12497         (General_options::plugins_): New field.
12498         * plugin.cc: New file.
12499         * plugin.h: New file.
12500         * readsyms.cc: Include "plugin.h".
12501         (Read_symbols::do_read_symbols): Check for archive before checking
12502         for ELF file.  Call plugin hooks to claim files.
12503         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12504         from a real object file; force override when processing replacement
12505         files.
12506         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12507         (Symbol::init_base_object): Likewise.
12508         (Symbol::init_base_output_data): Likewise.
12509         (Symbol::init_base_output_segment): Likewise.
12510         (Symbol::init_base_constant): Likewise.
12511         (Symbol::init_base_undefined): Likewise.
12512         (Symbol::output_section): Assert that object is not a plugin.
12513         (Symbol_table::add_from_pluginobj): New function.
12514         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12515         undefined.
12516         (Symbol_table::sized_write_globals): Likewise.
12517         (Symbol_table::add_from_pluginobj): Instantiate template.
12518         * symtab.h (Sized_pluginobj): Declare.
12519         (Symbol::in_real_elf): New function.
12520         (Symbol::set_in_real_elf): New function.
12521         (Symbol::in_real_elf_): New field.
12522         (Symbol_table::add_from_pluginobj): New function.
12523
12524         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12525         (LIBDL): New variable.
12526         (LDADD): Add LIBDL.
12527         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12528         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12529         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12530         (MOSTLYCLEANFILES): Likewise.
12531         * testsuite/Makefile.in: Regenerate.
12532         * testsuite/plugin_test.c: New file.
12533         * testsuite/plugin_test_1.sh: New file.
12534         * testsuite/plugin_test_2.sh: New file.
12535
12536 2008-09-16  Ian Lance Taylor  <iant@google.com>
12537
12538         * target-reloc.h (relocate_section): Check whether a symbol is
12539         defined by the ABI before reporting an undefined symbol error.
12540         * target.h (Target::is_defined_by_abi): Make parameter const.
12541         (Target::do_is_defined_by_abi): Likewise.
12542         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12543         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12544         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12545         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12546         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12547         * testsuite/Makefile.in: Rebuild.
12548
12549         * fileread.cc (make_view): Add casts to avoid warning.
12550
12551 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12552
12553         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12554         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12555
12556 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12557
12558         * options.h (General_options::output_is_executable): New.
12559         (General_options::output_is_pie): New.
12560         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12561         for shared libraries.
12562         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12563
12564 2008-09-11  Chris Demetriou  <cgd@google.com>
12565
12566         * options.h (origin): New -z option.
12567         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12568         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12569         in DT_FLAGS_1.
12570
12571 2008-09-05  Cary Coutant  <ccoutant@google.com>
12572
12573         * fileread.cc (File_read::make_view): Add check for attempt to map
12574         beyond end of file.
12575
12576 2008-09-05  Cary Coutant  <ccoutant@google.com>
12577
12578         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12579         explicit instantiations.
12580
12581 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12582
12583         PR gold/6858
12584         * options.cc (General_options::finalize): Allow undefined symbols
12585         in shlibs if linking -shared.
12586
12587         PR gold/6859
12588         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12589         symbols as not needing a dynsym entry.
12590
12591 2008-08-20  Craig Silverstein  <csilvers@google.com>
12592
12593         * fileread.cc (File_read::open): Do not lock the file unless it
12594         was successfully opened.
12595
12596 2008-08-14  Cary Coutant  <ccoutant@google.com>
12597
12598         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12599         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12600         * testsuite/tls_test.cc (struct int128): 128-bit struct
12601         for testing TLS relocs with non-zero addend.
12602         (v12): New TLS variable.
12603         (t12): New test.
12604         (t_last): Add check for v12.
12605         * testsuite/tls_test.h (t12): New function.
12606         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12607
12608 2008-08-13  Ian Lance Taylor  <iant@google.com>
12609
12610         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12611         set tls_segment_ or relro_segment_.
12612         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12613         when appropriate.
12614         * output.h (Output_section::clear_is_relro): New function.
12615         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12616         sections specially even when output_data_ is empty.
12617         (Output_segment::maximum_alignment): When first section is relro,
12618         only force alignment for PT_LOAD segments.
12619         * script.cc (script_data_segment_align): New function.
12620         (script_data_segment_relro_end): New function.
12621         * script-c.h (script_data_segment_align): Declare.
12622         (script_data_segment_relro_end): Declare.
12623         * script-sections.h (class Script_sections): Declare
12624         data_segment_align and data_segment_relro_end.  Add fields
12625         segment_align_index_ and saw_relro_end_.
12626         * script-sections.cc (class Sections_element): Add set_is_relro
12627         virtual function.  Add new bool* parameter to place_orphan_here.
12628         Add get_output_section virtual function.
12629         (class Output_section_definition): Add set_is_relro.  Add new
12630         bool* parameter to place_orphan_here.  Add get_output_section.
12631         Add is_relro_ field.
12632         (Output_section_definition::Output_section_definition): Initialize
12633         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12634         and is_relro_ fields.
12635         (Output_section_definition::place_orphan_here): Add is_relro
12636         parameter.
12637         (Output_section_definition::set_section_addresses): Set relro for
12638         output section.
12639         (Output_section_definition::alternate_constraint): Likewise.
12640         (class Orphan_output_section): Add new bool* parameter to
12641         place_orphan_here.  Add get_output_section.
12642         (Orphan_output_section::place_orphan_here): Add is_relro
12643         parameter.
12644         (Script_sections::Script_sections): Initialize
12645         data_segment_align_index_ and saw_relro_end_.
12646         (Script_sections::data_segment_align): New function.
12647         (Script_sections::data_segment_relro_end): New function.
12648         (Script_sections::place_orphan): Set or clear is_relro.
12649         (Script_sections::set_section_addresses): Force alignment of first
12650         TLS section.
12651         * yyscript.y (exp): Call script_data_segment_align and
12652         script_data_segment_relro_end.
12653         * testsuite/relro_script_test.t: New file.
12654         * testsuite/relro_test.cc (using_script): Declare.
12655         (t1, t2): Test using_script.
12656         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12657         (relro_script_test_SOURCES): Define.
12658         (relro_script_test_DEPENDENCIES): Define.
12659         (relro_script_test_LDFLAGS): Define.
12660         (relro_script_test_LDADD): Define.
12661         (relro_script_test.so): New target.
12662         * testsuite/Makefile.in: Rebuild.
12663
12664 2008-08-06  Cary Coutant <ccoutant@google.com>
12665
12666         * archive.cc (Archive::total_archives, Archive::total_members)
12667         (Archive::total_members_loaded): New variables.
12668         (Archive::setup): Add parameter.  Add option to preread
12669         archive symbols.
12670         (Archive::read_armap): Add counter.
12671         (Archive::get_file_and_offset): New function.
12672         (Archive::get_elf_object_for_member): New function.
12673         (Archive::read_all_symbols): New function.
12674         (Archive::read_symbols): New function.
12675         (Archive::add_symbols): Add counters.
12676         (Archive::include_all_members): Use armap to find members if it's
12677         already built.
12678         (Archive::include_member): Skip reading symbols if already read.
12679         Factored code into Archive::get_file_and_offset and
12680         Archive::get_elf_object_for_member.  Changed call to
12681         Mapfile::report_include_archive_member.
12682         (Archive::print_stats): New function.
12683         * archive.h: Declare Object and Read_symbols_data classes.
12684         (Archive::Archive): Add initializers for new members.
12685         (Archive::setup): Add parameter.
12686         (Archive::print_stats): New function.
12687         (Archive::total_archives, Archive::total_members)
12688         (Archive::total_members_loaded): New variables.
12689         (Archive::get_file_and_offset): New function.
12690         (Archive::get_elf_object_for_member): New function.
12691         (Archive::read_all_symbols): New function.
12692         (Archive::read_symbols): New function.
12693         (Archive::Archive_member): New class.
12694         (Archive::members_): New member.
12695         (Archive::num_members_): New member.
12696         * main.cc: Include archive.h.
12697         (main): Call Archive::print_stats.
12698         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12699         archive parameter; member_name is now the fully-decorated name.
12700         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12701         * options.h: (General_options): Add --preread-archive-symbols option.
12702         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12703         Archive::setup.
12704
12705 2008-08-04  Ian Lance Taylor  <iant@google.com>
12706
12707         * symtab.h (Symbol::use_plt_offset): New function.
12708         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12709         * powerpc.cc (Relocate::relocate): Likewise.
12710         * sparc.cc (Relocate::relocate): Likewise.
12711         * x86_64.cc (Relocate::relocate): Likewise.
12712         * testsuite/weak_plt.sh: New test.
12713         * testsuite/weak_plt_main.cc: New test.
12714         * testsuite/weak_plt_shared.cc: New test.
12715         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12716         (check_PROGRAMS): Add weak_plt.
12717         (check_DATA): Add weak_plt_shared.so.
12718         (weak_plt_main_pic.o, weak_plt): New targets.
12719         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12720         * testsuite/Makefile.in: Rebuild.
12721
12722         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12723         gcctestdir/ld.
12724         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12725         * testsuite/Makefile.in: Rebuild.
12726
12727 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12728
12729         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12730         * Makefile.in: Regenerate.
12731         * po/POTFILES.in: Regenerate.
12732
12733 2008-07-29  Ian Lance Taylor  <iant@google.com>
12734
12735         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12736         symbols before other symbols.
12737         * testsuite/script_test_2.cc (test_addr): Declare.
12738         (test_addr_alias): Declare.
12739         (main): Check that test_addr and test_addr_alias have the right
12740         values.
12741         * testsuite/script_test_2.t: Define test_addr_alias and
12742         test_addr.
12743
12744 2008-07-24  Ian Lance Taylor  <iant@google.com>
12745
12746         PR 5990
12747         * descriptors.cc: New file.
12748         * descriptors.h: New file.
12749         * gold-threads.h (class Hold_optional_lock): New class.
12750         * fileread.cc: Include "descriptors.h".
12751         (File_read::~File_read): Release descriptor rather than closing
12752         it.
12753         (File_read::open) [file]: Call open_descriptor rather than open.
12754         Set is_descriptor_opened_.
12755         (File_read::open) [memory]: Assert that descriptor is not open.
12756         (File_read::reopen_descriptor): New function.
12757         (File_read::release): Release descriptor.
12758         (File_read::do_read): Make non-const.  Reopen descriptor.
12759         (File_read::read): Make non-const.
12760         (File_read::make_view): Reopen descriptor.
12761         (File_read::do_readv): Likewise.
12762         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12763         Update declarations.
12764         * layout.cc: Include "descriptors.h".
12765         (Layout::create_build_id): Use open_descriptor rather than open.
12766         * output.cc: Include "descriptors.h".
12767         (Output_file::open): Use open_descriptor rather than open.
12768         * archive.cc (Archive::const_iterator): Change Archive to be
12769         non-const.
12770         (Archive::begin, Archive::end): Make non-const.
12771         (Archive::count_members): Likewise.
12772         * archive.h (class Archive): Update declarations.
12773         * object.h (Object::read): Make non-const.
12774         * Makefile.am (CCFILES): Add descriptors.cc.
12775         (HFILES): Add descriptors.h.
12776         * Makefile.in: Rebuild.
12777
12778         PR 6716
12779         * gold.h: Always include <clocale>.  Add Solaris workarounds
12780         following code in binutils/sysdep.h.
12781
12782         PR 6048
12783         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12784         this->eh_frame_hdr_ is NULL before using it.
12785
12786         * dynobj.cc (Versions::Versions): Update comment.
12787
12788         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12789         the base version name.
12790
12791         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12792         array size plus one.
12793         (Stringpool_template::set_string_offsets): Subtract one from key
12794         before using it as an array index.
12795         (Stringpool_template::get_offset_with_length): Likewise.
12796         (Stringpool_template::write_to_buffer): Likewise.
12797         * stringpool.h (Stringpool_template::get_offset_from_key):
12798         Likewise.
12799
12800 2008-07-23  Ian Lance Taylor  <iant@google.com>
12801
12802         PR 6658
12803         * object.h (Merged_symbol_value::value): Do our best to handle a
12804         negative addend.
12805
12806         PR 6647
12807         * script.cc (Version_script_info::get_versions): Don't add empty
12808         version tag to return value.
12809         (Version_script_info::get_symbol_version_helper): Change return
12810         type to bool.  Add pversion parameter.  Change all callers.
12811         (script_register_vers_node): Don't require a non-NULL tag.
12812         * script.h (class Version_script_info): Update declarations.
12813         (Version_script_info::get_symbol_version): Change return type to
12814         bool.  Add version parameter.  Change all callers.
12815         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12816         handling.  Handle an empty version from a version script.
12817         (Symbol_table::define_special_symbol): Likewise.
12818         * testsuite/ver_test_10.script: New file.
12819         * testsuite/ver_test_10.sh: New file.
12820         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12821         (check_DATA): Add ver_test_10.syms.
12822         (ver_test_10.syms, ver_test_10.so): New target.
12823         * testsuite/Makefile.in: Rebuild.
12824
12825 2008-07-23  Simon Baldwin  <simonb@google.com>
12826
12827         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12828         to zero for undefined symbols from dynamic libraries.
12829
12830 2008-07-23  Ian Lance Taylor  <iant@google.com>
12831
12832         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12833         Change all callers.
12834         * symtab.h (class Symbol_table): Update declaration.
12835         * testsuite/ver_test_9.cc: New file.
12836         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12837         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12838         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12839         (ver_test_9.so, ver_test_9.o): New targets.
12840         * testsuite/Makefile.in: Rebuild.
12841
12842 2008-07-22  Ian Lance Taylor  <iant@google.com>
12843
12844         * options.h (class General_options): Define --check-sections.
12845         * layout.cc (Layout::set_segment_offsets): Handle
12846         --check-sections.
12847
12848         * options.h (class General_options): Define -n/--nmagic and
12849         -N/--omagic.
12850         * options.cc (General_options::finalize): For -n/--nmagic or
12851         -N/--omagic, set -static.
12852         * layout.cc (Layout::attach_allocated_section_to_segment): If
12853         -N/--omagic, don't put read-only and read-write sections in
12854         different segments.
12855         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12856         finding a read-only segment.
12857         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12858         don't set the minimum segment alignment to the common page size,
12859         and don't set the file offset to the address modulo the page size.
12860         * script-sections.cc (Script_sections::create_segments): If
12861         -n/--omagic, don't put read-only and read-write sections in
12862         different segments.
12863
12864         * cref.cc: New file.
12865         * cref.h: New file.
12866         * options.h (class General_options): Add --print-symbol-counts.
12867         * main.cc (main): Issue defined symbol report if requested.
12868         * archive.cc (Archive::interpret_header): Make into a const member
12869         function.
12870         (Archive::add_symbols): Call Input_objects::archive_start and
12871         archive_stop.
12872         (Archive::const_iterator): Define new class.
12873         (Archive::begin, Archive::end): New functions.
12874         (Archive::include_all_members): Rewrite to use iterator.
12875         (Archive::count_members): New function.
12876         * archive.h (class Archive): Update declarations.
12877         (Archive::filename): New function.
12878         * object.cc: Include "cref.h".
12879         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12880         (Sized_relobj::do_get_global_symbol_counts): New function.
12881         (Input_objects::add_object): Add object to cross-referencer.
12882         (Input_objects::archive_start): New function.
12883         (Input_objects::archive_stop): New function.
12884         (Input_objects::print_symbol_counts): New function.
12885         * object.h: Declare Cref and Archive.
12886         (Object::get_global_symbol_counts): New function.
12887         (Object::do_get_global_symbol_counts): New pure virtual function.
12888         (class Sized_relobj): Add defined_count_ field.  Update
12889         declarations.
12890         (class Input_objects): Add cref_ field.  Update constructor.
12891         Update declarations.
12892         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12893         defined_count_.
12894         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12895         symbol counts.
12896         (Sized_dynobj::do_get_global_symbol_counts): New function.
12897         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12898         defined_count_.  Update declarations.  Define Symbols typedef.
12899         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12900         parameter.  Change all callers.
12901         (Symbol_table::add_from_dynobj): Add sympointers and defined
12902         parameters.  Change all callers.
12903         * symtab.h (class Symbol_table): Update declarations.
12904         * Makefile.am (CCFILES): Add cref.cc.
12905         (HFILES): Add cref.h.
12906         * Makefile.in: Rebuild.
12907
12908 2008-07-22  Simon Baldwin  <simonb@google.com>
12909
12910         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12911         to zero when writing undefined symbols.
12912
12913 2008-07-22  Ian Lance Taylor  <iant@google.com>
12914
12915         * output.cc (Output_section::add_input_section): Don't try to
12916         merge empty merge sections.
12917
12918 2008-07-21  Craig Silverstein  <csilvers@google.com>
12919
12920         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12921         Include symbol version in error message.
12922
12923 2008-07-20  Chris Demetriou  <cgd@google.com>
12924
12925         * configure.ac (gold_cv_c_random_seed): New configured variable.
12926         (RANDOM_SEED_CFLAGS): New substituted variable.
12927         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12928         * configure: Rebuild.
12929         * Makefile.in: Likewise.
12930         * testsuite/Makefile.in: Likewise.
12931
12932 2008-07-18  Ian Lance Taylor  <iant@google.com>
12933
12934         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12935         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12936         * testsuite/ver_test_main.cc (main): Call t4.
12937         (t4, t4_2a): Define.
12938         * testsuite/ver_test_2.cc (t4_2): Define.
12939         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12940         * testsuite/ver_test_4.cc (t4_2a): Define.
12941         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12942         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12943
12944 2008-07-17  Ian Lance Taylor  <iant@google.com>
12945
12946         * dynobj.cc (Versions::add_def): If we give an error about a
12947         missing version, go ahead and create the version anyhow.
12948
12949 2008-07-10  Ian Lance Taylor  <iant@google.com>
12950
12951         Handle output sections with more than 0x7fffffff bytes.
12952         * object.h (class Relobj): Change map_to_output_ to
12953         output_sections_, and just keep a section pointer.  Change all
12954         uses.  Move comdat group support to Sized_relobj.
12955         (Relobj::is_section_specially_mapped): Remove.
12956         (Relobj::output_section): Remove poff parameter.  Change all
12957         callers.
12958         (Relobj::output_section_offset): New function.
12959         (Relobj::set_section_offset): Rewrite.
12960         (Relobj::map_to_output): Remove.
12961         (Relobj::output_sections): New function.
12962         (Relobj::do_output_section_offset): New pure virtual function.
12963         (Relobj::do_set_section_offset): Likewise.
12964         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12965         group support from Relobj.  Update declarations.
12966         (Sized_relobj::get_output_section_offset): New function.
12967         (Sized_relobj::do_output_section_offset): New function.
12968         (Sized_relobj::do_set_section_offset): New function.
12969         * object.cc (Relobj::output_section_address): Remove.
12970         (Sized_relobj::Sized_relobj): Initialize new fields.
12971         (Sized_relobj::include_section_group): Cast find_kept_object to
12972         Sized_relobj.
12973         (Sized_relobj::include_linkonce_section): Likewise.
12974         (Sized_relobj::do_layout): Use separate arrays for output section
12975         and output offset.
12976         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12977         output_sections.
12978         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12979         output_sections and section_offsets.
12980         (Sized_relobj::write_local_symbols): Likewise.
12981         (map_to_kept_section): Compute output address directly.
12982         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12983         output_sections and section_offsets.
12984         (Sized_relobj::write_sections): Likewise.
12985         (Sized_relobj::relocate_sections): Likewise.
12986         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12987         * output.h (class Output_reloc): Update declarations.  Change
12988         u2_.relobj to Sized_relobj*.
12989         (class Output_data_reloc): Change add functions to use
12990         Sized_relobj*.
12991         * output.cc (Output_reloc::Output_reloc): Change relobj to
12992         Sized_relobj*.
12993         (Output_reloc::local_section_offset): Change return type to
12994         Elf_Addr.  Use get_output_section_offset.
12995         (Output_reloc::get_address): Likewise.
12996         (Output_section::is_input_address_mapped): Don't call
12997         is_section_specially_mapped.
12998         (Output_section::output_offset): Likewise.
12999         (Output_section::output_address): Likewise.
13000         (Output_section::starting_output_address): Likewise.
13001         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13002         parameter to Sized_relobj*.
13003         (Copy_relocs::need_copy_reloc): Likewise.
13004         (Copy_relocs::save): Likewise.
13005         * copy-relocs.h (class Copy_relocs): Update declarations.
13006         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13007         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13008         * target-reloc.h (relocate_for_relocatable): Change
13009         offset_in_output_section type to Elf_Addr.  Change code that uses
13010         it as well.
13011         * layout.cc (Layout::layout): Always set *off.
13012         * mapfile.cc (Mapfile::print_input_section): Use
13013         output_section_offset.
13014         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13015         Sized_relobj*.
13016         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13017         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13018         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13019
13020 2008-07-03  Ian Lance Taylor  <iant@google.com>
13021
13022         * layout.cc (Layout::include_section): Do not discard unrecognized
13023         SHT_STRTAB sections.
13024
13025 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13026
13027         * script.cc (Lex::can_continue_name): Make '?' allowable in
13028         version-script names.
13029         * testsuite/version_script.map: Change glob pattern to use '?'
13030
13031 2008-06-30  Manish Singh  <yosh@gimp.org>
13032
13033         PR 6585
13034         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13035         Correct typo.
13036
13037 2008-06-30  Ian Lance Taylor  <iant@google.com>
13038
13039         PR 6660
13040         PR 6682
13041         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13042         versions]: Don't try to read the value in the contents, since we
13043         don't use it.  Use the template endianness when writing.
13044
13045 2008-06-25  Cary Coutant  <ccoutant@google.com>
13046
13047         * fileread.cc (File_read::make_view): Assert on zero-length view.
13048         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13049         symbol table when there are no symbols to read.
13050
13051 2008-06-23  Craig Silverstein  <csilvers@google.com>
13052
13053         * version.cc (version_string): Bump to 1.7
13054
13055 2008-06-18  Craig Silverstein  <csilvers@google.com>
13056
13057         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13058         constant 0xFFFF to type Valtype.
13059         (Powerpc_relocate_functions::rel16_ha): Likewise.
13060
13061 2008-06-17  Ian Lance Taylor  <iant@google.com>
13062
13063         * output.h (Output_section::Input_section): Initialize p2align_ to
13064         zero for Output_section_data constructors.
13065         (Output_section::Input_section::addralign): If not an input
13066         section, return the alignment of the Output_section_data.
13067         * testsuite/copy_test.cc: New file.
13068         * testsuite/copy_test_1.cc: New file.
13069         * testsuite/copy_test_2.cc: New file.
13070         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13071         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13072         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13073         (copy_test_1_pic.o, copy_test_1.so): New targets.
13074         (copy_test_2_pic.o, copy_test_2.so): New targets.
13075         * testsuite/Makefile.in: Rebuild.
13076
13077         * script-sections.cc (Script_sections::place_orphan): Initialize
13078         local variable exact.
13079
13080 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13081
13082         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13083
13084 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13085             David S. Miller  <davem@davemloft.net>
13086
13087         * powerpc.cc: New file.
13088         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13089         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13090         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13091         * Makefile.in: Rebuild.
13092
13093 2008-06-09  Ian Lance Taylor  <iant@google.com>
13094
13095         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13096         <exception>.
13097         (throwing, orig_terminate): New static variables.
13098         (terminate_handler): New static function.
13099         (t2): Set terminate handler.
13100
13101 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13102
13103         PR 6584
13104         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13105         alignment.
13106
13107 2008-05-30  Cary Coutant  <ccoutant@google.com>
13108
13109         * archive.cc (Archive::include_all_members) Correct to step
13110         over symbol table and extended name table in thin archives.
13111
13112 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13113
13114         PR 6407
13115         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13116         calculation.
13117
13118 2008-05-28  Caleb Howe  <cshowe@google.com>
13119
13120         * reduced_debug_output.cc: New file.
13121         * reduced_debug_output.h: New file.
13122         * options.h (class General_options): Add --strip-debug-non-line.
13123         * options.cc (General_options::finalize): Add strip_debug_non_line
13124         to the strip heirarchy.
13125         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13126         fields.
13127         * layout.cc: Include "reduced_debug_output.h".
13128         (Layout::Layout): Initialize new fields.
13129         (line_only_debug_sections): New static array.
13130         (is_lines_only_debug_sections): New static inline function.
13131         (Layout::include_section): Handle --strip-debug-non-line.
13132         (Layout::make_output_section): If --strip-debug-non-line, build
13133         new output sections for .debug_abbrev and .debug_info.
13134         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13135         gold.  Warn about possible overflow.
13136         (read_signed_LEB_128): Likewise.
13137         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13138         (read_signed_LEB_128): Declare.
13139         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13140         (HFILES): Add reduced_debug_output.h.
13141         * Makefile.in: Rebuild.
13142
13143 2008-05-21  Ian Lance Taylor  <iant@google.com>
13144
13145         * mapfile.cc: New file.
13146         * mapfile.h: New file.
13147         * options.h (class General_options): Add -M/--print-map and -Map.
13148         * options.cc (General_options::finalize): Make -M equivalent to
13149         -Map -.
13150         * main.cc: Include <cstdio> and "mapfile.h".
13151         (main): Open mapfile if requested.
13152         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13153         constructor.  Change caller.
13154         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13155         (queue_middle_tasks): Likewise.
13156         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13157         declarations.
13158         * archive.cc: Include "mapfile.h".
13159         (Archive::add_symbols): Add mapfile parameter.  Change all
13160         callers.  Pass mapfile, symbol, and reason to include_member.
13161         (Archive::include_all_members): Add mapfile parameter.  Change all
13162         callers.
13163         (Archive::include_member): Add mapfile, sym, and why parameters.
13164         Change all callers.  Report inclusion to map file.
13165         * archive.h: Include "fileread.h".
13166         (class Archive): Update declarations.
13167         (Archive::file): New const method.
13168         (class Add_archive_symbols): Add mapfile_ field.  Update
13169         constructor.  Change all callers.
13170         * readsyms.h (class Read_symbols): Likewise.
13171         (class Finish_group): Likewise.
13172         (class Read_script): Likewise.
13173         * common.cc: Include "mapfile.h".
13174         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13175         all callers.
13176         (Symbol_table::do_allocate_commons): Likewise.
13177         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13178         symbol allocation to mapfile.
13179         * common.h (class Allocate_commons_task): Add mapfile_ field.
13180         Update constructor.  Change all callers.
13181         * symtab.h (class Symbol_table): Update declarations.
13182         * layout.cc: Include "mapfile.h".
13183         (Layout_task_runner::run): Print information to mapfile.
13184         (Layout::create_gold_note): Change Output_data_fixed_space to
13185         Output_data_zero_fill.
13186         (Layout::create_build_id): Likewise.
13187         (Layout::print_to_mapfile): New function.
13188         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13189         constructor.  Change caller.
13190         (class Layout): Declare print_to_mapfile.
13191         * output.cc (Output_section::Input_section::print_to_mapfile): New
13192         function.
13193         (Output_section::add_input_section): If producing a map, always
13194         add to input_sections_ list.
13195         (Output_section::do_print_to_mapfile): New function.
13196         (Output_segment::print_sections_to_mapfile): New function.
13197         (Output_segment::print_section_list_to_mapfile): New function.
13198         * output.h: Include "mapfile.h".
13199         (Output_data::print_to_mapfile): New function.
13200         (Output_data::do_print_to_mapfile): New virtual function.
13201         (Output_segment_headers::do_print_to_mapfile): New function.
13202         (Output_file_header::do_print_to_mapfile): New function.
13203         (Output_data_const::do_print_to_mapfile): New function.
13204         (class Output_data_const_buffer): Add map_name_ field.  Update
13205         constructor.  Change all callers.  Add do_print_to_mapfile
13206         function.
13207         (class Output_data_fixed_space): Likewise.
13208         (class Output_data_space): Likewise.
13209         (class Output_data_zero_fill): New class.
13210         (Output_data_strtab::do_print_to_mapfile): New function.
13211         (Output_data_reloc_base::do_print_to_mapfile): New function.
13212         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13213         (Output_data_group::do_print_to_mapfile): New function.
13214         (Output_data_got::do_print_to_mapfile): New function.
13215         (Output_data_dynamic::do_print_to_mapfile): New function.
13216         (Output_symtab_xindex::do_print_to_mapfile): New function.
13217         (class Output_section): Declare do_print_to_mapflie.  Declare
13218         print_to_mapfile in Input_section.
13219         (class Output_segment): Declare new functions.
13220         * object.h (Sized_relobj::symbol_count): New function.
13221         * script-sections.cc
13222         (Output_section_element_dot_assignment::set_section_addresses):
13223         Change Output_data_fixed_space to Output_data_zero_fill.
13224         (Output_data_expression::do_print_to_mapfile): New function.
13225         * script.cc (read_input_script): Add mapfile parameter.  Change
13226         all callers.
13227         * script.h (read_input_script): Update declaration.
13228         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13229         (Eh_frame::do_print_to_mapfile): New function.
13230         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13231         (Output_merge_string::do_print_to_mapfile): New function.
13232         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13233         function.
13234         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13235         function.
13236         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13237         function.
13238         * Makefile.am (CCFILES): Add mapfile.cc.
13239         (HFILES): Add mapfile.h.
13240         * Makefile.in: Rebuild.
13241
13242 2008-05-19  Ian Lance Taylor  <iant@google.com>
13243
13244         * options.h (class General_options): Add -z relro.
13245         * layout.cc (Layout::Layout): Initialize relro_segment_.
13246         (Layout::add_output_section_data): Return the output section.
13247         (Layout::make_output_section): Rcognize relro sections and mark
13248         them appropriately.
13249         (Layout::attach_allocated_section_to_segment): Put relro sections
13250         in a PT_GNU_RELRO segment.
13251         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13252         section as relro.
13253         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13254         PT_TLS segments.
13255         (Layout::linkonce_mapping): Map d.rel.ro.local to
13256         .data.rel.ro.local.
13257         (Layout::output_section_name): Us .data.rel.ro.local for any
13258         section which begins with that.
13259         * layout.h (class Layout): Update add_output_section_data
13260         declaration.  Add relro_segment_ field.
13261         * output.cc (Output_section::Output_section): Initialize is_relro_
13262         and is_relro_local_ fields.
13263         (Output_segment::add_output_section): Group relro sections.
13264         (Output_segment::is_first_section_relro): New function.
13265         (Output_segment::maximum_alignment): If there is a relro section,
13266         align the segment to the common page size.
13267         (Output_segment::set_section_addresses): Track whether we are
13268         looking at relro sections.  If the last section is a relro
13269         section, align to the common page size.
13270         (Output_segment::set_section_list_addresses): Add in_relro
13271         parameter.  Change all callers.  Align to the page size when
13272         moving from relro to non-relro section.
13273         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13274         segment.
13275         * output.h (class Output_section): Add is_relro_ and
13276         is_relro_local_ fields.
13277         (Output_section::is_relro): New function.
13278         (Output_section::set_is_relro): New function.
13279         (Output_section::is_relro_local): New function.
13280         (Output_section::set_is_relro_local): New function.
13281         (class Output_segment): Update declarations.
13282         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13283         * sparc.cc (Target_sparc::got_section): Likewise.
13284         * x86_64.cc (Target_x86_64::got_section): Likewise.
13285         * testsuite/relro_test_main.cc: New file.
13286         * testsuite/relro_test.cc: New file.
13287         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13288         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13289         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13290         (relro_test.so, relro_test_pic.o): New targets.
13291         * testsuite/Makefile.in: Rebuild.
13292
13293 2008-05-16  Ian Lance Taylor  <iant@google.com>
13294
13295         * output.cc (Output_segment::add_output_section): Remove front
13296         parameter.
13297         * output.h (class Output_segment): Remove
13298         add_initial_output_section and overloaded add_output_section.
13299         Update declaration of remaining add_output_section.
13300         * layout.cc (Layout::create_interp): Call add_output_section
13301         rather than add_initial_output_section.
13302         (Layout::finish_dynamic_section): Likewise.
13303
13304         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13305         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13306         know the dynamic type.
13307         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13308         field.  Initialize it in constructor.
13309         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13310         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13311         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13312         reloc.
13313
13314         * output.cc (Output_reloc::get_address): Change return type to
13315         Elf_Addr.
13316         * output.h (class Output_reloc): Update get_address declaration.
13317         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13318         for section addresses.
13319
13320 2008-05-09  Ian Lance Taylor  <iant@google.com>
13321
13322         PR 6493
13323         * gold.cc (gold_nomem): Use return value of write.
13324
13325 2008-05-08  Ian Lance Taylor  <iant@google.com>
13326
13327         * symtab.c (Symbol::init_base_output_data): Add version
13328         parameter.  Change all callers.
13329         (Symbol::init_base_output_segment): Likewise.
13330         (Symbol::init_base_constant): Likewise.
13331         (Symbol::init_base_undefined): Likewise.
13332         (Sized_symbol::init_output_data): Likewise.
13333         (Sized_symbol::init_output_segment): Likewise.
13334         (Sized_symbol::init_constant): Likewise.
13335         (Sized_symbol::init_undefined): Likewise.
13336         (Symbol_table::do_define_in_output_data): If the new symbol has a
13337         version, mark it as the default.
13338         (Symbol_table::do_define_in_output_segment): Likewise.
13339         (Symbol_table::do_define_as_constant): Likewise.
13340         * symtab.h (class Symbol): Update declarations.
13341         (class Sized_symbol): Likewise.
13342         * resolve.cc (Symbol::override_version): New function.
13343         (Symbol::override_base): Call override_version.
13344         (Symbol::override_base_with_special): Likewise.
13345         * testsuite/ver_script_8.script: New file.
13346         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13347         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13348         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13349         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13350
13351 2008-05-06  Ian Lance Taylor  <iant@google.com>
13352
13353         PR 6049
13354         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13355         functions.
13356         (class General_options): Remove existing --undefined, and add
13357         --no-undefined instead.  Add new --undefined as synonym for -u.
13358         * archive.cc (Archive::add_symbols): Check whether symbol was
13359         named with -u.
13360         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13361         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13362         all uses.  Add IS_UNDEFINED.  Update declarations to split
13363         different versions of init_base.  Declare init_base_undefined.
13364         (Symbol::is_defined): Handle IS_UNDEFINED.
13365         (Symbol::is_undefined): Likewise.
13366         (Symbol::is_weak_undefined): Call is_undefined.
13367         (Symbol::is_absolute): Handle IS_CONSTANT.
13368         (class Sized_symbol): Update declarations to split different
13369         versions of init.  Declare init_undefined.
13370         (class Symbol_table): Declare new functions.
13371         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13372         Change all callers.
13373         (Symbol::init_base_output_data): Likewise.
13374         (Symbol::init_base_output_segment): Likewise.
13375         (Symbol::init_base_constant): Likewise.
13376         (Symbol::init_base_undefined): New function.
13377         (Sized_symbol::init_object): Rename from init.  Change all
13378         callers.
13379         (Sized_symbol::init_output_data): Likewise.
13380         (Sized_symbol::init_output_segment): Likewise.
13381         (Sized_symbol::init_constant): Likewise.
13382         (Sized_symbol::init_undefined): New function.
13383         (Symbol_table::add_undefined_symbols_from_command_line): New
13384         function.
13385         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13386         function.
13387         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13388         (Symbol::output_section): Likewise.
13389         (Symbol::set_output_section): Likewise.
13390         (Symbol_table::sized_finalize_symbol): Likewise.
13391         (Symbol_table::sized_write_globals): Likewise.
13392         * resolve.cc (Symbol_table::should_override): Likewise.
13393         (Symbol::override_base_with_special): Likewise.
13394
13395         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13396         symbol, change it to have default visibility.
13397         * testsuite/protected_1.cc: New file.
13398         * testsuite/protected_2.cc: New file.
13399         * testsuite/protected_3.cc: New file.
13400         * testsuite/protected_main_1.cc: New file.
13401         * testsuite/protected_main_2.cc: New file.
13402         * testsuite/protected_main_3.cc: New file.
13403         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13404         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13405         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13406         (protected_1.so): New target.
13407         (protected_1_pic.o, protected_2_pic.o): New targets.
13408         (protected_3_pic.o): New target.
13409         (check_PROGRAMS): Add protected_2.
13410         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13411         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13412         * testsuite/Makefile.in: Rebuild.
13413
13414         * options.h (DEFINE_var): Add set_user_set_##varname__.
13415         (DEFINE_bool_alias): New macro.
13416         (class General_options): Define -Bstatic using DEFINE_bool_alias
13417         rather than DEFINE_special.  Add --undefined as an alias for -z
13418         defs.
13419         * options.cc (General_options::parse_Bstatic): Remove.
13420
13421         * options.h (class General_options): Add --fatal-warnings.
13422         * main.cc (main): Implement --fatal-warnings.
13423         * errors.h (Errors::warning_count): New function.
13424
13425         * options.h (class General_options): Add -Bsymbolic-functions.
13426         * symtab.h (Symbol::is_preemptible): Check for
13427         -Bsymbolic-functions.
13428
13429 2008-05-05  Ian Lance Taylor  <iant@google.com>
13430
13431         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13432         as noVARNAME rather than no-VARNAME.
13433         (class General_options): Add option -z combreloc.
13434         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13435         get_address.
13436         (Output_reloc::sort_before) [SHT_REL]: New function.
13437         (Output_reloc::sort_before) [SHT_RELA]: New function.
13438         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13439         Sort_relocs_comparison.
13440         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13441         parameter.  Change all callers.
13442         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13443         sort_relocs parameter.  Change all callers.
13444         * output.cc (Output_reloc::get_address): New function, broken out
13445         of write_rel.
13446         (Output_reloc::write_rel): Call it.
13447         (Output_reloc::compare): New function.
13448         (Output_data_reloc_base::do_write): Optionally sort relocs.
13449
13450         * configure.ac: If targ_extra_obj is set, link it in.
13451         * configure.tgt: Initialize all variables.
13452         (x86_64*): Set targ_extra_obj and targ_extra_size.
13453         * configure: Rebuild.
13454
13455         * object.cc (Sized_relobj::include_section_group): Adjust section
13456         indexes read from group data.  Build vector to pass to
13457         layout_group.
13458         * layout.cc (Layout::layout_group): Add flags and shndxes
13459         parameters.  Remove contents parameter.  Change caller.  Update
13460         explicit instantiations.
13461         * layout.h (class Layout): Update layout_group declaration.
13462         * output.cc (Output_data_group::Output_data_group): Add flags and
13463         input_shndxes parameters.  Remove contents parameter.  Change
13464         caller.
13465         (Output_data_group::do_write): Change input_sections_ to
13466         input_shndxes_.
13467         * output.h (class Output_data_group): Update constructor
13468         declaration.  Rename input_sections_ to input_shndxes_.
13469         * testsuite/many_sections_test.cc: Add template.
13470
13471 2008-04-30  Cary Coutant  <ccoutant@google.com>
13472
13473         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13474
13475         * layout.cc (Layout::include_section): Refactored check for debug
13476         info section.
13477         (Layout::add_comdat): Add new parameters.  Change type
13478         of signature parameter.  Add object and shndx to signatures table.
13479         (Layout::find_kept_object): New function.
13480         * layout.h: Include <cstring>.
13481         (Layout::is_debug_info_section): New function.
13482         (Layout::add_comdat): Add new parameters.
13483         (Layout::find_kept_object): New function.
13484         (Layout::Kept_section): New struct.
13485         (Layout::Signatures): Change type of map range.
13486         * object.cc (Relobj::output_section_address): New function.
13487         (Sized_relobj::include_section_group): Add new parameters.  Change
13488         calls to Layout::add_comdat.  Change to build table of kept comdat
13489         groups and table mapping discarded sections to kept sections.
13490         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13491         (Sized_relobj::do_layout): Change calls to include_section_group and
13492         include_linkonce_section.
13493         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13494         value to zero when section is discarded.
13495         (Sized_relobj::map_to_kept_section): New function.
13496         * object.h (Relobj::output_section_address): New function.
13497         (Relobj::Comdat_group): New type.
13498         (Relobj::find_comdat_group): New function.
13499         (Relobj::Comdat_group_table): New type.
13500         (Relobj::Kept_comdat_section): New type.
13501         (Relobj::Kept_comdat_section_table): New type.
13502         (Relobj::add_comdat_group): New function.
13503         (Relobj::set_kept_comdat_section): New function.
13504         (Relobj::get_kept_comdat_section): New function.
13505         (Relobj::comdat_groups_): New field.
13506         (Relobj::kept_comdat_sections_): New field.
13507         (Symbol_value::input_value): Update comment.
13508         (Sized_relobj::map_to_kept_section) New function.
13509         (Sized_relobj::include_linkonce_section): Add new parameter.
13510         * target-reloc.h (Comdat_behavior): New type.
13511         (get_comdat_behavior): New function.
13512         (relocate_section): Add code to map a discarded section to the
13513         corresponding kept section when applying a relocation.
13514
13515 2008-04-30  Craig Silverstein  <csilvers@google.com>
13516
13517         * dwarf_reader.cc (next_generation_count): New static var.
13518         (Addr2line_cache_entry): New struct.
13519         (addr2line_cache): New static var.
13520         (Dwarf_line_info::one_addr2line): Added caching.
13521         (Dwarf_line_info::clear_addr2line_cache): New function.
13522         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13523         cache-size parameter.
13524         (Dwarf_line_info::one_addr2line_cache): New function.
13525         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13526         new cache-size argument to one_addr2line(), and clear cache.
13527
13528 2008-04-28  Cary Coutant  <ccoutant@google.com>
13529
13530         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13531         R_386_PC8 relocations.
13532
13533 2008-04-23  Ian Lance Taylor  <iant@google.com>
13534
13535         * object.cc (Sized_relobj::include_section_group): Check for
13536         invalid section group.
13537
13538         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13539         header size.
13540
13541         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13542         than read for file header.
13543         * archive.cc (Archive::include_member): Likewise.
13544
13545 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13546
13547         * aclocal.m4: Regenerate.
13548         * configure: Regenerate.
13549
13550 2008-04-19  Ian Lance Taylor  <iant@google.com>
13551
13552         * version.cc (version_string): Bump to 1.6.
13553
13554         * testsuite/Makefile.am (many_sections_r_test): New target.
13555         (many_sections_r_test_SOURCES): Remove.
13556         (many_sections_r_test_DEPENDENCIES): Remove.
13557         (many_sections_r_test_LDFLAGS): Remove.
13558         (many_sections_r_test_LDADD): Remove.
13559
13560         * object.cc (Sized_relobj::do_add_symbols): Always pass
13561         local_symbol_count_ to add_from_relobj.
13562
13563         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13564         every thousand variables.
13565         * testsuite/Makefile.in: Rebuild.
13566
13567         * object.cc (Xindex::initialize_symtab_xindex): New function.
13568         (Xindex::read_symtab_xindex): New function.
13569         (Xindex::sym_xindex_to_shndx): New function.
13570         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13571         available.
13572         (Sized_relobj::do_initialize_xindex): New function.
13573         (Sized_relobj::do_read_symbols): Adjust section links.
13574         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13575         parameter.  Change all callers.
13576         (Sized_relobj::include_section_group): Adjust section links and
13577         symbol section indexes.
13578         (Sized_relobj::do_layout): Adjust section links.
13579         (Sized_relobj::do_count_local_symbols): Adjust section links and
13580         symbol section indexes.
13581         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13582         ordinary and special symbols.
13583         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13584         dynsym_xindex parameters.  Change all callers.  Adjust section
13585         links.  Use SHN_XINDEX when needed.
13586         (Sized_relobj::get_symbol_location_info): Adjust section links.
13587         Don't get fooled by special symbols.
13588         * object.h (class Xindex): Define.
13589         (class Object): Add xindex_ parameter.  Declare virtual functoin
13590         do_initialize_xindex.
13591         (Object::adjust_sym_shndx): New function.
13592         (Object::set_xindex): New protected function.
13593         (class Symbol_value): Add is_ordinary_shndx_ field.
13594         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13595         (Symbol_value::value): Assert ordinary section.
13596         (Symbol_value::initialize_input_to_output_map): Likewise.
13597         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13598         Change all callers.
13599         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13600         all callers.
13601         (class Sized_relobj): Update declarations.
13602         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13603         parameter.  Change all callers.
13604         (Sized_relobj::adjust_shndx): New function.
13605         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13606         field.
13607         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13608         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13609         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13610         (Sized_dynobj::read_dynsym_section): Adjust section links.
13611         (Sized_dynobj::read_dynamic): Likewise.
13612         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13613         section links.
13614         (Sized_dynobj::do_initialize_xindex): New function.
13615         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13616         do_initialize_xindex.
13617         (Sized_dynobj::adjust_shndx): New function.
13618         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13619         dynsym_xindex_ fields.
13620         (Layout::finalize): Add a call to set_section_indexes before
13621         creating the symtab sections.
13622         (Layout::set_section_indexes): Don't do anything if the section
13623         already has a section index.
13624         (Layout::create_symtab_sections): Add shnum parameter.  Change
13625         caller.  Create .symtab_shndx section if needed.
13626         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13627         caller.
13628         (Layout::allocated_output_section_count): New function.
13629         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13630         needed.
13631         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13632         fields.  Update declarations.
13633         (Layout::symtab_xindex): New function.
13634         (Layout::dynsym_xindex): New function.
13635         (class Write_symbols_task): Add layout_ field.
13636         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13637         Change caller.
13638         * output.cc (Output_section_headers::Output_section_headers): Add
13639         shstrtab_section parameter.  Change all callers.
13640         (Output_section_headers::do_sized_write): Store overflow values
13641         for section count and section string table section index in
13642         section header zero.
13643         (Output_file_header::do_sized_write): Check for overflow of
13644         section count and section string table section index.
13645         (Output_symtab_xindex::do_write): New function.
13646         (Output_symtab_xindex::endian_do_write): New function.
13647         * output.h (class Output_section_headers): Add shstrtab_section_.
13648         Update declarations.
13649         (class Output_symtab_xindex): Define.
13650         (Output_section::has_out_shndx): New function.
13651         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13652         field.
13653         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13654         Change all callers.
13655         (Sized_symbol::init): Likewise.
13656         (Symbol::output_section): Check for ordinary symbol.
13657         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13658         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13659         callers.
13660         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13661         Change all callers.  Simplify handling of symbols from sections
13662         not included in the link.
13663         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13664         distinction.
13665         (Weak_alias_sorter::operator()): Assert that symbols are
13666         ordinary.
13667         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13668         distinction.
13669         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13670         parameters.  Change all callers.
13671         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13672         symbol distinction.  Use SHN_XINDEX when needed.
13673         (Symbol_table::write_section_symbol): Add symtab_xindex
13674         parameter.  Change all callers.
13675         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13676         SHN_XINDEX when needed.
13677         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13678         declarations.
13679         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13680         (Symbol::is_defined): Check is_ordinary.
13681         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13682         (Symbol::is_absolute, Symbol::is_common): Likewise.
13683         (class Sized_symbol): Update declarations.
13684         (class Symbol_table): Update declarations.
13685         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13686         parameters.  Change all callers.
13687         (Sized_symbol::override): Likewise.
13688         (Symbol_table::override): Likewise.
13689         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13690         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13691         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13692         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13693         to be in an ordinary section.
13694         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13695         object and is_ordinary parameters.  Change all callers.
13696         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13697         Change all callers.  Don't add undefined or non-ordinary symbols
13698         to reloc_map_.
13699         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13700         Change all callers.
13701         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13702         declarations.
13703         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13704         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13705         (Sized_relobj::relocate_sections): Likewise.
13706         * target-reloc.h (scan_relocs): Adjust section symbol index.
13707         (scan_relocatable_relocs): Likewise.
13708         * i386.cc (Scan::local): Check for ordinary symbols.
13709         * sparc.cc (Scan::local): Likewise.
13710         * x86_64.cc (Scan::local): Likewise.
13711         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13712         to symbol_section_and_value.
13713         * testsuite/many_sections_test.cc: New file.
13714         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13715         (check_PROGRAMS): Add many_sections_test.
13716         (many_sections_test_SOURCES): Define.
13717         (many_sections_test_DEPENDENCIES): Define.
13718         (many_sections_test_LDFLAGS): Define.
13719         (BUILT_SOURCES): Add many_sections_define.h.
13720         (many_sections_define.h): New target.
13721         (BUILT_SOURCES): Add many_sections_check.h.
13722         (many_sections_check.h): New target.
13723         (check_PROGRAMS): Add many_sections_r_test.
13724         (many_sections_r_test_SOURCES): Define.
13725         (many_sections_r_test_DEPENDENCIES): Define.
13726         (many_sections_r_test_LDFLAGS): Define.
13727         (many_sections_r_test_LDADD): Define.
13728         (many_sections_r_test.o): New target.
13729         * testsuite/Makefile.in: Rebuild.
13730
13731 2008-04-17  Cary Coutant  <ccoutant@google.com>
13732
13733         * errors.cc (Errors::info): New function.
13734         (gold_info): New function.
13735         * errors.h (Errors::info): New function.
13736         * gold.h (gold_info): New function.
13737         * object.cc (Input_objects::add_object): Print trace output.
13738         * options.cc (options::parse_set): New function.
13739         (General_options::parse_wrap): Deleted.
13740         (General_options::General_options): Deleted initializer.
13741         * options.h (options::String_set): New typedef.
13742         (options::parse_set): New function.
13743         (DEFINE_set): New macro.
13744         (General_options::wrap): Changed to use DEFINE_set. Changed
13745         callers of any_wrap_symbols and is_wrap_symbol.
13746         (General_options::trace, General_options::trace_symbol):
13747         New options.
13748         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13749         (General_options::wrap_symbols_): Deleted.
13750         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13751
13752 2008-04-17  David S. Miller  <davem@davemloft.net>
13753
13754         * options.cc (General_options::parse_V): New function.
13755         * options.h: Add entries for -V and -Qy.
13756
13757 2008-04-17  Ian Lance Taylor  <iant@google.com>
13758
13759         * common.cc (Symbol_table::allocate_commons): Remove options
13760         parameter.  Change caller.
13761         (Symbol_table::do_allocate_commons): Remove options parameter.
13762         Change caller.  Just call do_allocate_commons_list twice.
13763         (Symbol_table::do_allocate_commons_list): New function, broken out
13764         of do_allocate_commons.
13765         * common.h (class Allocate_commons_task): Remove options_ field.
13766         Update constructor.
13767         * symtab.cc (Symbol_table::Symbol_table): Initialize
13768         tls_commons_.
13769         (Symbol_table::add_from_object): Put TLS common symbols on
13770         tls_commons_ list.
13771         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13772         which are IN_OUTPUT_DATA.
13773         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13774         allocate_commons and do_allocate_commons declarations.  Declare
13775         do_allocate_commons_list.
13776         * gold.cc (queue_middle_tasks): Update creation of
13777         Allocate_commons_task to not pass options.
13778         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13779         (TLS_TEST_C_FLAGS): New variable.
13780         (tls_test_c_pic.o): New target.
13781         (tls_test_shared.so): Link in tls_test_c_pic.o.
13782         (tls_test_c_pic_ie.o): New target.
13783         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13784         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13785         (tls_test_c.o): New target.
13786         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13787         (tls_pic_test_LDADD): Likewise.
13788         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13789         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13790         (tls_test_c_gnu2.o): New target.
13791         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13792         tls_test_c_gnu2.o.
13793         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13794         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13795         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13796         * testsuite/tls_test.cc: Include "config.h".
13797         (t_last): Call t11_last.
13798         * testsuite/tls_test.h (t11, t11_last): Declare.
13799         * testsuite/tls_test_c.c: New file.
13800         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13801         * configure.ac: Check for OpenMP support.
13802         * configure, config.in, Makefile.in: Rebuild.
13803         * testsuite/Makefile.in: Rebuild.
13804
13805 2008-04-16  Cary Coutant  <ccoutant@google.com>
13806
13807         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13808         (Target_i386::tls_base_symbol_defined_): New field.
13809         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13810         (Target_i386::Scan::global): Likewise.
13811         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13812         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13813         (Target_x86_64::tls_base_symbol_defined_): New field.
13814         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13815         (Target_x86_64::Scan::global): Likewise.
13816
13817 2008-04-16  Cary Coutant  <ccoutant@google.com>
13818
13819         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13820         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13821         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13822         building shared libraries.
13823         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13824         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13825         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13826         * testsuite/Makefile.in: Rebuild.
13827         * testsuite/weak_undef.h: New file.
13828         * testsuite/weak_undef_file1.cc: Add extra test cases.
13829         * testsuite/weak_undef_file2.cc: Likewise.
13830         * testsuite/weak_undef_test.cc: Likewise.
13831
13832 2008-04-16  David S. Miller  <davem@davemloft.net>
13833
13834         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13835         Add issued_non_pic_error_ field.  Declare check_non_pic.
13836         (Target_sparc::Scan::check_non_pic): New function.
13837         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13838         (Target_sparc::Scan::global): Likewise.
13839
13840         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13841         * configure: Rebuild.
13842
13843         * options.h (DEFINE_enable): New macro.
13844         (new_dtags): New enable option.
13845         (initfirst, interpose, loadfltr, nodefaultlib,
13846         nodelete, nodlopen, nodump): New -z options.
13847         * layout.cc (Layout:finish_dynamic_section): If new
13848         dtags enabled, emit DT_RUNPATH.  Also, emit a
13849         DT_FLAGS_1 containing any specified -z flags.
13850
13851 2008-04-16  Ian Lance Taylor  <iant@google.com>
13852
13853         * copy-relocs.cc: New file.
13854         * copy-relocs.h: New file.
13855         * reloc.cc: Remove Copy_relocs code.
13856         * reloc.h: Likewise.
13857         * reloc-types.h (struct Reloc_types) [both versions]: Add
13858         get_reloc_addend_noerror.
13859         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13860         variants of add_global which take an addend which must be zero.
13861         * i386.cc: Include "copy-relocs.h".
13862         (class Target_i386): Change type of copy_relocs_ to variable,
13863         update initializer.
13864         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13865         Change all callers.
13866         (Target_i386::do_finalize_sections): Change handling of
13867         copy_relocs_.
13868         * sparc.cc: Include "copy-relocs.h".
13869         (class Target_sparc): Change type of copy_relocs_ to variable,
13870         update initializer.
13871         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13872         Change all callers.
13873         (Target_sparc::do_finalize_sections): Change handling of
13874         copy_relocs_.
13875         * x86_64.cc: Include "copy-relocs.h".
13876         (class Target_x86_64): Change type of copy_relocs_ to variable,
13877         update initializer.
13878         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13879         class.  Change all callers.
13880         (Target_x86_64::do_finalize_sections): Change handling of
13881         copy_relocs_.
13882         * Makefile.am (CCFILES): Add copy-relocs.cc.
13883         (HFILES): Add copy-relocs.h.
13884
13885         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13886
13887         * testsuite/script_test_4.sh: Permit leading zeroes.
13888
13889 2008-04-15  Ian Lance Taylor  <iant@google.com>
13890
13891         * script-sections.cc (Script_sections::create_segments): Use
13892         header_size_adjustment even when there is enough room for the
13893         headers.
13894         * testsuite/script_test_4.sh: New file.
13895         * testsuite/script_test_4.t: New file.
13896         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13897         (check_DATA): Add script_test_4.stdout.
13898         (MOSTLYCLEANFILES): Likewise.
13899         (script_test_4): New target.
13900         (script_test_4.stdout): New target.
13901         * testsuite/Makefile.in: Rebuild.
13902
13903         * sparc.cc: Add definitions for Output_data_plt_sparc class
13904         constants.
13905
13906 2008-04-14  David S. Miller  <davem@davemloft.net>
13907
13908         * sparc.cc: New file.
13909         * Makefile.am (TARGETSOURCES): Add sparc.cc
13910         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13911         * configure.tgt: Document targ_extra_size and
13912         targ_extra_big_endian.  Add entries for sparc-* and
13913         sparc64-*.
13914         * configure.ac: Handle targ_extra_size and
13915         targ_extra_big_endian.
13916         * Makefile.in: Rebuild.
13917         * configure: Likewise.
13918         * po/POTFILES.in: Likewise.
13919         * po/gold.pot: Likewise.
13920
13921 2008-04-14  Ian Lance Taylor  <iant@google.com>
13922
13923         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13924         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13925         in the name/type/flags to section mapping.  Don't call
13926         allocate_output_section.
13927         (Layout::choose_output_section): Change parameter from adjust_name
13928         to is_input_section.  Don't permit input sections after sections
13929         are attached to segments.  Don't call allocate_output_section.
13930         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13931         not write_enable_output_section.
13932         (Layout::make_output_section): Don't push to
13933         unattached_section_list_ nor call attach_to_segment.  Call
13934         attach_section_to_segment if sections are attached.
13935         (Layout::attach_sections_to_segments): New function.
13936         (Layout::attach_section_to_segment): New function.
13937         (Layout::attach_allocated_section_to_segment): Rename from
13938         attach_to_segment.  Remove flags parameter.
13939         (Layout::allocate_output_section): Remove function.
13940         (Layout::write_enable_output_section): Remove function.
13941         * layout.h (class Layout): Update for above changes.  Add new
13942         field sections_are_attached_.
13943         * output.h (Output_section::update_flags_for_input_section): New
13944         function.
13945         * output.cc (Output_section::add_input_section): Call
13946         update_flags_for_input_section.
13947         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13948
13949 2008-04-11  Cary Coutant  <ccoutant@google.com>
13950
13951         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13952         thought unnecessary.
13953         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13954
13955 2008-04-11  Ian Lance Taylor  <iant@google.com>
13956
13957         * output.h (class Output_section_data): Remove inline definition
13958         of set_addralign.
13959         * output.cc (Output_section_data::set_addralign): New function.
13960
13961 2008-04-11  Cary Coutant  <ccoutant@google.com>
13962
13963         Add support for TLS descriptors for i386 and x86_64.
13964         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13965         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13966         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13967         GOT_TYPE_TLS_DESC.
13968         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13969         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13970         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13971         relocations.
13972         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13973         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13974         Fix problem with initial-exec relocations.
13975         (Target_i386::Relocate::relocate_tls): Likewise.
13976         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13977         relaxation.
13978         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13979         support for section-plus-offset dynamic table entries.
13980         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13981         (Output_data_dynamic::Dynamic_entry): Add support for
13982         section-plus-offset dynamic table entries.
13983         (Output_data_dynamic::Classification): Likewise.
13984         (Output_data_dynamic::classification_): Renamed offset_.
13985         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13986         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13987         (Target_x86_64::make_plt_section): New function.
13988         (Target_x86_64::reserve_tlsdesc_entries): New function.
13989         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13990         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13991         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13992         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13993         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13994         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13995         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13996         add extra PLT entry for TLS descriptors.
13997         (Output_data_plt_x86_64::got_): New field.
13998         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13999         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14000         fields.
14001         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14002         descriptors.
14003         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14004         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14005         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14006         R_386_TLS_DESC_CALL relocations.
14007         (Target_x86_64::Scan::global): Likewise.
14008         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14009         for TLS descriptors.
14010         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14011         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14012         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14013         GD-to-IE relaxation.
14014         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14015         and TLS_DESCRIPTORS.
14016         * Makefile.in: Rebuild.
14017         * configure: Rebuild.
14018         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14019         (tls_test_shared2.so): New target.
14020         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14021         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14022         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14023         (tls_shared_gd_to_ie_test_LDADD): New variable.
14024         (tls_shared_gnu2_gd_to_ie_test): New target.
14025         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14026         New targets.
14027         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14028         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14029         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14030         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14031         (tls_shared_gnu2_test): New target.
14032         (tls_test_gnu2_shared.so): New target.
14033         (tls_shared_gnu2_test_SOURCES): New variable.
14034         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14035         (tls_shared_gnu2_test_LDFLAGS): New variable.
14036         (tls_shared_gnu2_test_LDADD): New variable.
14037         * testsuite/Makefile.in: Rebuild.
14038         * testsuite/Makefile.
14039
14040 2008-04-11  Ian Lance Taylor  <iant@google.com>
14041
14042         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14043         justsyms.t.
14044         * testsuite/Makefile.in: Rebuild.
14045
14046         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14047         long.
14048         * testsuite/script_test_2.cc (main): Adjust test.
14049
14050 2008-04-11  David S. Miller  <davem@davemloft.net>
14051             Ian Lance Taylor  <iant@google.com>
14052
14053         * options.h (General_options): Add entries for '-Y' and
14054         '-relax'.
14055         * options.cc (General_options:finalize): If -Y was used, add those
14056         entries to the library path instead of the default "/lib" and
14057         "/usr/lib".
14058
14059 2008-04-11  David S. Miller  <davem@davemloft.net>
14060
14061         * testsuite/justsyms.t: Start at 0x100.
14062         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14063         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14064         long.
14065         * testsuite/script_test_2.cc: Adjust string and section length
14066         checks.
14067
14068 2008-04-09  Ian Lance Taylor  <iant@google.com>
14069
14070         PR gold/5996
14071         * script-sections.cc (Sections_element::allocate_to_segment): Add
14072         orphan parameter.
14073         (Output_section_definition::allocate_to_segment): Likewise.
14074         (Orphan_output_section::allocate_to_segment): Likewise.
14075         (Script_sections::attach_sections_using_phdrs_clause): Don't
14076         propagate non-PT_LOAD segments to orphan sections.
14077         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14078         readelf rather than objdump.
14079         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14080         .interp section and PT_INTERP segment are the same size.
14081         * testsuite/Makefile.in: Rebuild.
14082
14083         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14084         aliases for symbols defined in the same object.
14085         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14086         (weak_alias_test_SOURCES): New variable.
14087         (weak_alias_test_DEPENDENCIES): New variable.
14088         (weak_alias_test_LDFLAGS): New variable.
14089         (weak_alias_test_LDADD): New variable.
14090         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14091         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14092         (weak_alias_test_3.o): New target.
14093         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14094         * testsuite/weak_alias_test_main.cc: New file.
14095         * testsuite/weak_alias_test_1.cc: New file.
14096         * testsuite/weak_alias_test_2.cc: New file.
14097         * testsuite/weak_alias_test_3.cc: New file.
14098
14099 2008-04-08  Ian Lance Taylor  <iant@google.com>
14100
14101         * options.h (class General_options): Add --noinhibit-exec option.
14102         * main.cc (main): Check --noinhibit-exec.
14103
14104         * options.h (class General_options): Define --wrap as a special
14105         option.  Add wrap_symbols_ field.
14106         (General_options::any_wrap_symbols): New function.
14107         (General_options::is_wrap_symbol): New function.
14108         * options.cc (General_options::parse_wrap): New function.
14109         (General_options::General_options): Initialize wrap_symbols_.
14110         * symtab.cc (Symbol_table::wrap_symbol): New function.
14111         (Symbol_table::add_from_object): Handle --wrap.
14112         * symtab.h (class Symbol_table): Declare wrap_symbol.
14113         * target.h (Target::wrap_char): New function.
14114         (Target::Target_info): Add wrap_char field.
14115         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14116         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14117         * testsuite/testfile.cc (Target_test::test_target_info):
14118         Likewise.
14119
14120         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14121         there is one.
14122
14123         * layout.h (class Layout): Add added_eh_frame_data_ field.
14124         * layout.cc (Layout::Layout): Initialize new field.
14125         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14126         output section until we find a section we merged successfully.
14127         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14128         that the size be non-zero.
14129
14130         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14131         qualifier.
14132
14133 2008-04-08  Craig Silverstein  <csilvers@google.com>
14134
14135         * configure.ac: Export new conditional variable HAVE_ZLIB.
14136         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14137         on HAVE_ZLIB.
14138         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14139         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14140
14141 2008-04-07  Ian Lance Taylor  <iant@google.com>
14142
14143         * version.cc (version_string): Set to "1.5".
14144
14145         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14146         Add issued_non_pic_error_ field.  Declare check_non_pic.
14147         (Target_x86_64::Scan::check_non_pic): New function.
14148         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14149         (Target_x86_64::Scan::global): Likewise.
14150
14151         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14152         addend parameter.  Change caller.  Handle merge sections.
14153         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14154         Address to Addend.  Don't add in the result of
14155         local_section_offset, pass down the addend and use the returned
14156         value.
14157         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14158         Update declarations of local_section_offset and symbol_value.
14159         * testsuite/two_file_test_1.cc (t18): New function.
14160         * testsuite/two_file_test_2.cc (f18): New function.
14161         * testsuite/two_file_test_main.cc (main): Call t18.
14162         * testsuite/two_file_test.h (t18, f18): Declare.
14163
14164         * configure.ac: Don't test for objdump, c++filt, or readelf.
14165         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14166         conditionals.
14167         (TEST_READELF): New variable.
14168         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14169         (check_PROGRAMS): Add two_file_strip_test.
14170         (two_file_strip_test): New target.
14171         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14172         (two_file_same_shared_strip_test_SOURCES): New variable.
14173         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14174         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14175         (two_file_same_shared_strip_test_LDADD): New variable.
14176         (two_file_shared_strip.so): New target.
14177         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14178         (ver_test_5.syms, ver_test_7.syms): Likewise.
14179         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14180         (strip_test_3.stdout): Use TEST_OBJDUMP.
14181         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14182
14183 2008-04-04  Cary Coutant  <ccoutant@google.com>
14184
14185         * symtab.h (Symbol::is_weak_undefined): New function.
14186         (Symbol::is_strong_undefined): New function.
14187         (Symbol::is_absolute): New function.
14188         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14189         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14190         absolute symbols.
14191         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14192         (weak_undef_test): New target.
14193         * testsuite/Makefile.in: Rebuild.
14194         * testsuite/weak_undef_file1.cc: New file.
14195         * testsuite/weak_undef_file2.cc: New file.
14196         * testsuite/weak_undef_test.cc: New file.
14197
14198 2008-04-03  Craig Silverstein  <csilvers@google.com>
14199
14200         * compressed_output.h (class Output_compressed_section): Use
14201         unsigned buffer.
14202         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14203         add zlib header.
14204         (zlib_compressed_suffix): Removed.
14205         (Output_compressed_section::set_final_data_size): Use unsigned
14206         buffers.
14207         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14208         Fix linker invocation.
14209         (flagstest_o_specialfile_and_compress_debug_sections):
14210         Likewise.
14211         * testsuite/Makefile.in: Regenerated.
14212
14213 2008-04-02  David S. Miller  <davem@davemloft.net>
14214
14215         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14216         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14217
14218 2008-04-02  Craig Silverstein  <csilvers@google.com>
14219
14220         * TODO: New file.
14221
14222 2008-04-02  Ian Lance Taylor  <iant@google.com>
14223
14224         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14225         parameters.  Update for new key type to views_.  Change all
14226         callers.
14227         (File_read::read): Adjust for byteshift in returned view.
14228         (File_read::add_view): New function, broken out of
14229         find_and_make_view.
14230         (File_read::make_view): New function, broken out of
14231         find_and_make_view.
14232         (File_read::find_or_make_view): Add offset and aligned
14233         parameters.  Rewrite accordingly.  Change all callers.
14234         (File_read::get_view): Add offset and aligned parameters.  Adjust
14235         for byteshift in return value.
14236         (File_read::get_lasting_view): Likewise.
14237         * fileread.h (class File_read): Update declarations.
14238         (class File_read::View): Add byteshift_ field.  Add byteshift to
14239         constructor.  Add byteshift method.
14240         * archive.h (Archive::clear_uncached_views): New function.
14241         (Archive::get_view): Add aligned parameter.  Change all callers.
14242         * object.h (Object::get_view): Add aligned parameter.  Change all
14243         callers.
14244         (Object::get_lasting_view): Likewise.
14245
14246         * fileread.cc (File_read::release): Don't call clear_views if
14247         there are multiple objects.
14248         * fileread.h (File_read::clear_uncached_views): New function.
14249         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14250         on the archive.
14251
14252 2008-03-31  Cary Coutant  <ccoutant@google.com>
14253
14254         Add thin archive support.
14255         * archive.cc (Archive::armagt): New const.
14256         (Archive::setup): Remove task parameter and calls to unlock.
14257         (Archive::unlock_nested_archives): New function.
14258         (Archive::read_header): Add nested_off parameter. Change
14259         all callers.
14260         (Archive::interpret_header): Likewise.
14261         (Archive::include_all_members): Change to handle thin
14262         archives.
14263         (Archive::include_member): Likewise.
14264         * archive.h (Archive::Archive): Add new parameters and
14265         initializers.
14266         (Archive::armagt): New const.
14267         (Archive::setup): Remove task parameter.
14268         (Archive::unlock_nested_archives): New function.
14269         (Archive::read_header): Add nested_off parameter.
14270         (Archive::interpret_header): Likewise.
14271         (Archive::Nested_archive_table): New typedef.
14272         (Archive::is_thin_archive_): New field.
14273         (Archive::nested_archives_): New field.
14274         (Archive::options_): New field.
14275         (Archive::dirpath_): New field.
14276         (Archive::task_): New field.
14277         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14278         for thin archives.  Pass additional parameters to
14279         Archive::Archive.  Unlock the archive file after calling
14280         Archive::setup.
14281
14282 2008-03-29  Ian Lance Taylor  <iant@google.com>
14283
14284         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14285         version symbol to be local.
14286         * testsuite/ver_test_4.sh: New file.
14287         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14288         (check_DATA): Add ver_test_4.syms.
14289         (ver_test_4.syms): New target.
14290         * testsuite/Makefile.in: Rebuild.
14291
14292         * output.cc
14293         (Output_section::Input_section_sort_entry::has_priority): New
14294         function.
14295         (Output_section::Input_section_sort_entry::match_file_name): New
14296         function.
14297         (Output_section::Input_section_sort_entry::match_section_name):
14298         Remove.
14299         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14300         Remove.
14301         (Output_section::Input_section_sort_entry::match_section_file):
14302         Remove.
14303         (Output_section::Input_section_sort_compare::operator()): Rewrite
14304         using new Input_section_sort_entry functions.  Sort crtbegin and
14305         crtend first.  Sort sections with no priority before sections with
14306         a priority.
14307         * testsuite/initpri1.c (d3): Check j != 4.
14308         (cd5): New constructor/destructor function.
14309         (main): Check j != 2.
14310
14311         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14312         new symbol when resolving, don't call set_is_default.
14313         * testsuite/ver_test_7.cc: New file.
14314         * testsuite/ver_test_7.sh: New file.
14315         * testsuite/Makefile.am (ver_test_7.so): New target.
14316         (ver_test_7.o): New target.
14317         (check_SCRIPTS): Add ver_test_7.sh.
14318         (check_DATA): Add ver_test_7.syms.
14319         (ver_test_7.syms): New target.
14320
14321 2008-03-28  Ian Lance Taylor  <iant@google.com>
14322
14323         * layout.cc (Layout::layout): If we see an input section with a
14324         name that needs sorting, set the must_sort flag for the output
14325         section.
14326         (Layout::make_output_section): If the name of the output section
14327         indicates that it might require sorting, set the may_sort flag.
14328         * output.h (Output_section::may_sort_attached_input_sections): New
14329         function.
14330         (Output_section::set_may_sort_attached_input_sections): New
14331         function.
14332         (Output_section::must_sort_attached_input_sections): New
14333         function.
14334         (Output_section::set_must_sort_attached_input_sections): New
14335         function.
14336         (class Output_section): Declare Input_section_sort_entry.  Define
14337         Input_section_sort_compare.  Declare
14338         sort_attached_input_sections.  Add new fields:
14339         may_sort_attached_input_sections_,
14340         must_sort_attached_input_sections_,
14341         attached_input_sections_are_sorted_.
14342         * output.cc (Output_section::Output_section): Initialize new
14343         fields.
14344         (Output_section::add_input_section): Add an entry to
14345         input_sections_ if may_sort or must_sort are true.
14346         (Output_section::set_final_data_size): Call
14347         sort_attached_input_sections if necessary.
14348         (Output_section::Input_section_sort_entry): Define new class.
14349         (Output_section::Input_section_sort_compare::operator()): New
14350         function.
14351         (Output_section::sort_attached_input_sections): New function.
14352         * configure.ac: Check whether the compiler supports constructor
14353         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14354         * testsuite/initpri1.c: New file.
14355         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14356         CONSTRUCTOR_PRIORITY.
14357         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14358         (initpri1_LDFLAGS): New variable.
14359         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14360
14361 2008-03-27  Ian Lance Taylor  <iant@google.com>
14362
14363         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14364         * testsuite/common_test_1.c: New file.
14365         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14366         (common_test_1_SOURCES): New variable.
14367         (common_test_1_DEPENDENCIES): New variable.
14368         (common_test_1_LDFLAGS): New variable.
14369
14370         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14371         and commons_ correctly when NAME/VERSION does not override
14372         NAME/NULL.
14373         * testsuite/ver_test_6.c: New file.
14374         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14375         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14376         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14377
14378 2008-03-26  Ian Lance Taylor  <iant@google.com>
14379
14380         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14381         of an undefined symbol from a version script.
14382         * testsuite/Makefile.am (ver_test_5.so): New target.
14383         (ver_test_5.o): New target.
14384         (check_SCRIPTS): Add ver_test_5.sh.
14385         (check_DATA): Add ver_test_5.syms.
14386         (ver_test_5.syms): New target.
14387         * testsuite/ver_test_5.cc: New file.
14388         * testsuite/ver_test_5.script: New file.
14389         * testsuite/ver_test_5.sh: New file.
14390         * Makefile.in, testsuite/Makefile.in: Rebuild.
14391
14392         PR gold/5986
14393         Fix problems building gold with gcc 4.3.0.
14394         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14395         (gold_error_at_location, gold_warning_at_location): Use it.
14396         * configure.ac: Check whether we can compile and use a template
14397         function with a printf attribute.
14398         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14399         when jumping over bytes.
14400         * object.cc: Instantiate Object::read_section_data.
14401         * debug.h: Include <cstring>
14402         * dwarf_reader.cc: Include <algorithm>
14403         * main.cc: Include <cstring>.
14404         * options.cc: Include <cstring>.
14405         * output.cc: Include <cstring>.
14406         * script.cc: Include <cstring>.
14407         * script.h: Include <string>.
14408         * symtab.cc: Include <cstring> and <algorithm>.
14409         * target-select.cc: Include <cstring>.
14410         * version.cc: Include <string>.
14411         * testsuite/testmain.cc: Include <cstdlib>.
14412         * configure, config.in: Rebuild.
14413
14414 2008-03-25  Ian Lance Taylor  <iant@google.com>
14415
14416         * options.cc: Include "../bfd/bfdver.h".
14417         (options::help): Print bug reporting address.
14418
14419         * version.cc (print_version): Adjust output for current value of
14420         BFD_VERSION_STRING.
14421
14422         * NEWS: New file.
14423
14424         * options.cc (options::help): Print list of supported targets.
14425         * target-select.h: Include <vector>.
14426         (class Target_selector): Make machine_, size_, and is_big_endian_
14427         fields const.  Add bfd_name_ and instantiated_target_ fields.
14428         (Target_selector::Target_selector): Add bfd_name parameter.
14429         (Target_selector::recognize): Make non-virtual, call
14430         do_recognize.
14431         (Target_selector::recognize_by_name): Make non-virtual, call
14432         do_recognize_by_name.
14433         (Target_selector::supported_names): New function.
14434         (Target_selector::bfd_name): New function.
14435         (Target_selector::do_instantiate_target): New pure virtual
14436         function.
14437         (Target_selector::do_recognize): New virtual function.
14438         (Target_selector::do_recognize_by_name): New virtual function.
14439         (Target_selector::instantiate_target): New private function.
14440         (supported_target_names): Declare.
14441         * target-select.cc (Target_selector::Target_selector): Update for
14442         new parameter and fields.
14443         (select_target_by_name): Check that the name matches before
14444         calling recognize_by_name.
14445         (supported_target_names): New function.
14446         * i386.cc (class Target_selector_i386): Update Target_selector
14447         constructor call.  Remove recognize and recognize_by_name.  Add
14448         do_instantiate_target.
14449         * x86_64.cc (class Target_selector_x86_64): Likewise.
14450         * testsuite/testfile.cc (class Target_selector_test): Update for
14451         changes to Target_selector.
14452
14453         * README: Rewrite, with some notes on unsupported features.
14454
14455 2008-03-24  Cary Coutant  <ccoutant@google.com>
14456
14457         * i386.cc (Target_i386::Got_type): New enum declaration.
14458         (Target_i386::Scan::local): Updated callers of Output_data_got
14459         member functions.
14460         (Target_i386::Scan::global): Likewise.
14461         (Target_i386::Relocate::relocate): Likewise.
14462         (Target_i386::Relocate::relocate_tls): Likewise.
14463         * object.h (Got_offset_list): New class.
14464         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14465         (Sized_relobj::local_got_offset): Likewise.
14466         (Sized_relobj::set_local_got_offset): Likewise.
14467         (Sized_relobj::local_has_tls_got_offset): Removed.
14468         (Sized_relobj::local_tls_got_offset): Removed.
14469         (Sized_relobj::set_local_tls_got_offset): Removed.
14470         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14471         * output.cc (Output_data_got::add_global): Added got_type parameter.
14472         (Output_data_got::add_global_with_rel): Likewise.
14473         (Output_data_got::add_global_with_rela): Likewise.
14474         (Output_data_got::add_global_pair_with_rel): New function.
14475         (Output_data_got::add_global_pair_with_rela): New function.
14476         (Output_data_got::add_local): Added got_type parameter.
14477         (Output_data_got::add_local_with_rel): Likewise.
14478         (Output_data_got::add_local_with_rela): Likewise.
14479         (Output_data_got::add_local_pair_with_rel): New function.
14480         (Output_data_got::add_local_pair_with_rela): New function.
14481         (Output_data_got::add_global_tls): Removed.
14482         (Output_data_got::add_global_tls_with_rel): Removed.
14483         (Output_data_got::add_global_tls_with_rela): Removed.
14484         (Output_data_got::add_local_tls): Removed.
14485         (Output_data_got::add_local_tls_with_rel): Removed.
14486         (Output_data_got::add_local_tls_with_rela): Removed.
14487         * output.h (Output_data_got::add_global): Added got_type parameter.
14488         (Output_data_got::add_global_with_rel): Likewise.
14489         (Output_data_got::add_global_with_rela): Likewise.
14490         (Output_data_got::add_global_pair_with_rel): New function.
14491         (Output_data_got::add_global_pair_with_rela): New function.
14492         (Output_data_got::add_local): Added got_type parameter.
14493         (Output_data_got::add_local_with_rel): Likewise.
14494         (Output_data_got::add_local_with_rela): Likewise.
14495         (Output_data_got::add_local_pair_with_rel): New function.
14496         (Output_data_got::add_local_pair_with_rela): New function.
14497         (Output_data_got::add_global_tls): Removed.
14498         (Output_data_got::add_global_tls_with_rel): Removed.
14499         (Output_data_got::add_global_tls_with_rela): Removed.
14500         (Output_data_got::add_local_tls): Removed.
14501         (Output_data_got::add_local_tls_with_rel): Removed.
14502         (Output_data_got::add_local_tls_with_rela): Removed.
14503         * resolve.cc (Symbol::override_base_with_special): Removed
14504         reference to has_got_offset_ field.
14505         * symtab.cc (Symbol::init_fields): Replaced initialization
14506         of got_offset_ with got_offsets_.  Removed initialization
14507         of has_got_offset_
14508         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14509         (Symbol::got_offset): Likewise.
14510         (Symbol::set_got_offset): Likewise.
14511         (Symbol::has_tls_got_offset): Removed.
14512         (Symbol::tls_got_offset): Removed.
14513         (Symbol::set_tls_got_offset): Removed.
14514         (Symbol::got_offset_): Removed.
14515         (Symbol::tls_mod_got_offset_): Removed.
14516         (Symbol::tls_pair_got_offset_): Removed.
14517         (Symbol::got_offsets_): New field.
14518         (Symbol::has_got_offset): Removed.
14519         (Symbol::has_tls_mod_got_offset): Removed.
14520         (Symbol::has_tls_pair_got_offset): Removed.
14521         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14522         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14523         member functions.
14524         (Target_x86_64::Scan::global): Likewise.
14525         (Target_x86_64::Relocate::relocate): Likewise.
14526         (Target_x86_64::Relocate::relocate_tls): Likewise.
14527
14528 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14529
14530         * yyscript.y: Fix spelling error in comment.
14531
14532 2008-03-24  Ian Lance Taylor  <iant@google.com>
14533
14534         * options.h (class General_options): Define build_id option.
14535         * layout.h (class Layout): Declare write_build_id, create_note,
14536         create_build_id.  Add build_id_note_ member.
14537         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14538         "libiberty.h", "md5.h", "sha1.h".
14539         (Layout::Layout): Initialize eh_frame_data_,
14540         eh_frame_hdr_section_, and build_id_note_.
14541         (Layout::finalize): Call create_build_id.
14542         (Layout::create_note): New function, broken out of
14543         Layout::create_gold_note.
14544         (Layout::create_gold_note): Call create_note.
14545         (Layout::create_build_id): New function.
14546         (Layout::write_build_id): New function.
14547         (Close_task_runner::run): Call write_build_id.
14548
14549         * x86_64.cc: Correct license to GPLv3.
14550
14551 2008-03-23  Ian Lance Taylor  <iant@google.com>
14552
14553         * options.cc: Include "demangle.h".
14554         (parse_optional_string): New function.
14555         (parse_long_option): Handle takes_optional_argument.
14556         (parse_short_option): Update dash_z initializer.  Handle
14557         takes_optional_argument.
14558         (General_options::General_options): Initialize do_demangle_.
14559         (General_options::finalize): Set do_demangle_.  Handle demangling
14560         style.
14561         * options.h (parse_optional_string): Declare.
14562         (struct One_option): Add optional_arg field.  Update constructor.
14563         Update call constructor calls.  Add takes_optional_argument
14564         function.
14565         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14566         (DEFINE_optional_string): Define.
14567         (General_options::demangle): Change from DEFINE_bool to
14568         DEFINE_optional_string.
14569         (General_options::no_demangle): New function.
14570         (General_options::do_demangle): New function.
14571         (General_options::set_do_demangle): New function.
14572         (General_options::execstack_status_): Move definition to end of
14573         class definition.
14574         (General_options::static_): Likewise.
14575         (General_options::do_demangle_): New field.
14576         * object.cc (big_endian>::get_symbol_location_info): Call
14577         Options::do_demangle, not Options::demangle.
14578         * symtab.cc (demangle): Likewise.
14579
14580 2008-03-22  Ian Lance Taylor  <iant@google.com>
14581
14582         * gold.h: Include <cstddef> and <sys/types.h>
14583         * options.h: Include <cstring>.
14584
14585 2008-03-21  Ian Lance Taylor  <iant@google.com>
14586
14587         * Added source code to GNU binutils.
14588 \f
14589 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14590
14591 Copying and distribution of this file, with or without modification,
14592 are permitted in any medium without royalty provided the copyright
14593 notice and this notice are preserved.
14594
14595 Local Variables:
14596 mode: change-log
14597 left-margin: 8
14598 fill-column: 74
14599 version-control: never
14600 End: