* powerpc.cc (class Powerpc_relobj): Move some member functions.
[external/binutils.git] / gold / ChangeLog
1 2013-03-06  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (class Powerpc_relobj): Move some member functions.
4         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
5         all callers.  Handle folded sections.
6         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
7         to Powerpc_relobj.
8         (Global_symbol_visitor_opd::operator()): Likewise.
9
10 2013-03-04  Alan Modra  <amodra@gmail.com>
11
12         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
13         * testsuite/Makefile.in: Regenerate.
14
15 2013-03-01  Cary Coutant  <ccoutant@google.com>
16
17         Add dwp support for v2 DWARF package file format.
18         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
19         tu_length parameter.  Adjust all callers.
20         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
21         * dwp.cc: Include dwarf.h.
22         (Section_bounds): New struct type.
23         (Unit_set): New struct type.
24         (Dwo_file::Dwo_file): Initialize new data member.
25         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
26         Combine and rename to...
27         (Dwo_file::read_unit_index): ...this.
28         (Dwo_file::sized_read_compunit_index)
29         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
30         (Dwo_file::sized_read_unit_index): ...this.
31         (Dwo_file::copy_section): Remove section_name, is_str_offsets
32         parameters; add section_id parameter.
33         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
34         (Dwo_file::add_unit_set): ...this.
35         (Dwo_file::shndx_map_): Remove.
36         (Dwo_file::sect_offsets_): New data member.
37         (Dwp_output_file::Dwp_output_file): Initialize new data members.
38         (Dwp_output_file::add_section): Rename to...
39         (Dwp_output_file::add_contribution): ...this.
40         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
41         (Dwp_output_file::add_tu_set): Likewise.
42         (Dwp_output_file::Contribution): New type.
43         (Dwp_output_file::Section::contributions): New data member.
44         (Dwp_output_file::Cu_or_tu_set): Remove.
45         (Dwp_output_file::Section::Section): New ctor.
46         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
47         (Dwp_output_file::Dwp_index::Section_table): New type.
48         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
49         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
50         parameter.
51         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
52         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
53         (Dwp_output_file::Dwp_index::section_table): New member function.
54         (Dwp_output_file::Dwp_index::section_table_end): New member function.
55         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
56         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
57         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
58         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
59         (Dwp_output_file::Dwp_index::section_table_): New data member.
60         (Dwp_output_file::Dwp_index::section_mask_): New data member.
61         (Dwp_output_file::add_output_section): New member function.
62         (Dwp_output_file::write_new_section): New member function.
63         (Dwp_output_file::write_contributions): New member function.
64         (Dwp_output_file::section_id_map_): New data member.
65         (class Dwo_id_info_reader): Remove.
66         (class Unit_reader): New class.
67         (get_dwarf_section_name): New function.
68         (Dwo_file::read_executable): Adjust initializations of class data.
69         (Dwo_file::read): Add support for v2 package file format.
70         (Dwo_file::read_unit_index): Likewise.
71         (Dwo_file::sized_read_unit_index): Likewise.
72         (Dwo_file::copy_section): Likewise.
73         (Dwo_file::add_unit_set): Likewise.
74         (Dwp_output_file::add_output_section): Likewise.
75         (Dwp_output_file::add_contribution): Likewise.
76         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
77         for empty slot.
78         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
79         file format.
80         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
81         slot.
82         (Dwp_output_file::initialize): Remove unused function.
83         (Dwp_output_file::finalize): Add support for v2 package file format.
84         (Dwp_output_file::write_index): Likewise.
85         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
86         function prototype.
87
88 2013-03-01  Cary Coutant  <ccoutant@google.com>
89
90         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
91         function into class definition in header file.
92         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
93         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
94         New function.
95         (Dwarf_info_reader::check_buffer): Move here from .cc file.
96
97 2013-02-28  Alan Modra  <amodra@gmail.com>
98
99         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
100         * target.cc (Target::do_plt_fde_location): New function.
101         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
102         accessor function, and constructor param.
103         (struct Post_fde, Post_fdes): Declare.
104         (Cie::write): Add post_fdes param.
105         * ehframe.cc (Fde::write): Use plt_fde_location.
106         (struct Post_fde): Define.
107         (Cie::write): Stash FDEs added post merge mapping.
108         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
109         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
110         (Eh_frame::do_sized_write): Arrange to write post map FDES after
111         other FDEs.
112         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
113         (Target_powerpc::has_glink): New function.
114         (Target_powerpc::do_relax): Add eh_frame info for stubs.
115         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
116         glink_eh_frame_fde_32, default_fde): New data.
117         (Stub_table::eh_frame_added_): New var.
118         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
119         Make const.
120         (Stub_table::add_eh_frame): New function.
121         (Output_data_glink::add_eh_frame): New function.
122         (Target_powerpc::make_glink_section): Call add_eh_frame.
123
124 2013-02-15  Ian Lance Taylor  <iant@google.com>
125
126         * options.h (DEFINE_uint64_alias): Define.
127         (class General_options): Add -Ttext-segment as an alias for
128         -Ttext.
129
130 2013-02-15  Alan Modra  <amodra@gmail.com>
131
132         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
133         (Stub_table::do_write): ..here, two places.
134         (Stub_table::plt_call_size): Use it here too.
135
136 2013-02-11  Ian Lance Taylor  <iant@google.com>
137
138         * descriptors.cc (Descriptors::close_all): New function.
139         * descriptors.h (class Descriptors): Declare close_all.
140         (close_all_descriptors): New inline function.
141         * plugin.cc: Include "descriptors.h".
142         (Plugin_manager::cleanup): Call close_all_descriptors.
143
144 2013-02-06  Alan Modra  <amodra@gmail.com>
145
146         * README: Update coding style link.
147
148 2013-01-28  Cary Coutant  <ccoutant@google.com>
149
150         * dwp.cc (File_list): New typedef.
151         (Dwo_name_info_reader): New class.
152         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
153         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
154         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
155         (Dwo_file::read_executable): New function.
156         (Dwo_file::read): Move common setup code to ...
157         (Dwo_file::make_object): ... here.
158         (dwp_options): Add --exec/-e.
159         (usage): Likewise.
160         (main): Likewise.
161
162 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
163
164         * layout.cc (Layout::layout): Check for option text_reorder.
165         (Layout::make_output_section): Ditto.
166         * options.h (text_reorder): New option.
167         * output.cc (Input_section_sort_compare): Remove special ordering
168         of section names.
169         (Output_section::
170          Input_section_sort_section_name_special_ordering_compare::
171          operator()): New function.
172         (Output_section::sort_attached_input_sections): Use new sort function
173         for .text.
174         * output.h (Input_section_sort_section_name_special_ordering_compare):
175         New struct.
176         * testsuite/Makefile.am (text_section_grouping): Test option
177         --no-text-reorder
178         * testsuite/Makefile.in: Regenerate.
179         * testsuite/text_section_grouping.sh: Check order of functions without
180         default text reordering.
181
182 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
183
184         * options.h (General_options): Change default to true for new_dtags.
185
186 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
187
188         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
189         when enable_new_dtags is false.  Only add DT_RUNPATH when
190         enable_new_dtags is true.
191
192 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
193
194         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
195         used in declaration and definition consistent.
196         (Target_powerpc::symval_for_branch): Ditto.
197
198 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
199
200         * testsuite/plugin_final_layout.cc: Fix comment.
201
202 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
203
204         * layout.cc (Layout::layout): Do not do default sorting for
205         text sections when section ordering is specified.
206         (make_output_section): Ditto.
207         * testsuite/plugin_final_layout.cc: Name the function sections
208         to catch reordering issues.
209
210 2013-01-15  Alan Modra  <amodra@gmail.com>
211
212         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
213         plt-thread-safe.
214
215 2013-01-15  Alan Modra  <amodra@gmail.com>
216
217         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
218         * testsuite/Makefile.in: Regenerate.
219
220 2013-01-14  Alan Modra  <amodra@gmail.com>
221
222         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
223         * testsuite/Makefile.in: Regenerate.
224
225 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
226
227         PR bfd/14430
228         Fix mingw gold build with plugins enabled
229         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
230         * configure.ac: Export DLOPEN_LIBS and add headers check.
231         * plugin.cc: Handle non-dlfcn case.
232         * Makefile.in: Regenerate.
233         * config.in: Regenerate.
234         * configure: Regenerate.
235         * testsuite/Makefile.in: Regenerate.
236
237 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
238
239         * output.h (sort_attached_input_sections): Change to be public.
240         * script-sections.cc
241         (Output_section_definition::set_section_addresses): Sort
242         attached input sections according to section order before linker
243         script assigns section addresses.
244         (Orphan_output_section::set_section_addresses): Sort
245         attached input sections according to section order before linker
246         script assigns section addresses.
247         * Makefile.am (final_layout.sh): Use a simple linker script to
248         check if section ordering still works.
249         * Makefile.in: Regenerate.
250
251 2013-01-09  Ben Cheng  <bccheng@google.com>
252
253         * arm.cc (Target_arm::attributes_accept_div): New function.
254         (Target_arm::attributes_forbid_div): New function.
255         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
256         attribute using the same new functions as what bfd/elf32_arm.c
257         does.
258
259 2013-01-07  Cary Coutant  <ccoutant@google.com>
260
261         PR gold/14993
262         * output.cc (Output_section::add_input_section): For incremental
263         updates, don't track input sections that are allocated from patch
264         space.
265
266 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
267             Ian Lance Taylor  <iant@google.com>
268
269         PR gold/14897
270         * configure.ac (--enable-ld): Removed.
271         (install_as_default): Set to yes only for --enable-gold=default
272         or --disable-ld.
273         * configure: Regenerated.
274
275 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
276
277         * options.h (General_options): Add -fuse-ld= for GCC linker
278         option compatibility.
279
280 2013-01-04  Cary Coutant  <ccoutant@google.com>
281
282         * configure.ac: Fix typo restoring CXXFLAGS.
283         * configure: Regenerate.
284
285 2013-01-04  Cary Coutant  <ccoutant@google.com>
286
287         * testsuite/Makefile.am (CXXLINK_S): New macro.
288         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
289         * testsuite/Makefile.in: Regenerate.
290
291 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
292
293         * version.cc (print_version): Update copyright year to 2013.
294
295 2012-12-20  Ian Lance Taylor  <iant@google.com>
296
297         * layout.cc (Layout::special_ordering_of_input_section): New
298         function.
299         (Layout::layout): If input section requires special ordering, must
300         sort input sections.
301         (Layout::make_output_section): May sort .text input sections.
302         (Layout::is_section_name_prefix_grouped): Remove.
303         * layout.h (class Layout): Declare
304         special_ordering_of_input_section.  Don't declare
305         is_section_name_prefix_grouped.
306         * output.cc (Output_section::add_input_section): Revert last
307         change.
308         (Output_section::Input_section_sort::match_file_name): Don't crash
309         if called on output section data.
310         (Output_section::Input_section_sort_compare): Sort based on
311         special ordering.
312         (Output_section::Input_section_sort_section_order_index_compare):
313         Revert last patch.
314         (Output_section::sort_attached_input_sections): Likewise.
315
316 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
317
318         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
319         * layout.h (Layout::is_section_name_prefix_grouped): New function.
320         * output.cc (Output_section::add_input_section): Check if section
321         name contains special prefix.  Keep input sections to sort such
322         sections.
323         (Output_section::Input_section_sort_section_order_index_compare
324          ::operator()): Group sections according to prefixes.
325         (Output_section::sort_attached_input_sections): Add condition to
326         Input_section_entry constructor call.
327         * testsuite/Makefile.am (text_section_grouping): New test.
328         * testsuite/Makefile.in: Regenerate.
329         * testsuite/text_section_grouping.cc: New file.
330         * testsuite/text_section_grouping.sh: New file.
331
332 2012-12-17  Nick Clifton  <nickc@redhat.com>
333
334         * Makefile.am: Add copyright notice.
335         * NEWS: Likewise.
336         * README: Likewise.
337         * configure.ac: Likewise.
338         * ftruncate.c: Likewise.
339         * Makefile.in: Regenerate.
340
341 2012-12-14  Cary Coutant  <ccoutant@google.com>
342
343         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
344         --no-as-needed flag.
345         (exception_separate_shared_12_test): Likewise.
346         (incremental_copy_test): Likewise.
347         * testsuite/Makefile.in: Regenerate.
348
349 2012-12-14  Cary Coutant  <ccoutant@google.com>
350
351         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
352         (Dwp_output_file::Dwp_index::enter_set): Add assert.
353
354 2012-12-12  Alan Modra  <amodra@gmail.com>
355
356         * powerpc.cc (class Track_tls): New.
357         (class Relocate, class Scan): Inherit Track_tls.
358         (Target_powerpc::Scan::local, global): Track tls optimization
359         and avoid creating plt entry for __tls_get_addr if all uses
360         are optimized away.
361         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
362
363 2012-12-12  Alan Modra  <amodra@gmail.com>
364
365         * options.h (General_options): Add --toc-sort/--no-toc-sort.
366         Replace no_toc_optimize with toc_optimize.
367         * output.h (Output_section::input_sections): Provide non-const variant.
368         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
369         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
370         accessors.
371         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
372         (class Sort_toc_sections): New.
373         (Target_powerpc::do_finalize_sections): Sort toc sections.
374         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
375
376 2012-12-10  Roland McGrath  <mcgrathr@google.com>
377
378         * testsuite/binary_unittest.cc (read_all): New function.
379         (Sized_binary_test): Use it instead of ::read.
380         * fileread.cc (do_read): Don't assume pread always reads the whole
381         amount in a single call.
382
383 2012-12-10  Alan Modra  <amodra@gmail.com>
384
385         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
386         Set EM_PPC64 or EM_PPC here.
387         (Target_selector_powerpc::do_recognize): Delete.
388
389 2012-12-10  Alan Modra  <amodra@gmail.com>
390
391         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
392         stub_table_.
393         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
394
395 2012-12-07  Roland McGrath  <mcgrathr@google.com>
396
397         * testsuite/binary_unittest.cc (Sized_binary_test):
398         Use open_descriptor rather than ::open.
399
400 2012-12-07  Alan Modra  <amodra@gmail.com>
401
402         * powerpc.cc (Stub_table::do_write): Delete redundant Address
403         typedef and invalid_address constant.
404         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
405         instantiate constants.
406
407 2012-12-06  Roland McGrath  <mcgrathr@google.com>
408
409         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
410         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
411         * aclocal.m4: Regenerate.
412         * configure: Regenerate.
413         * Makefile.in: Regenerate.
414         * testsuite/Makefile.in: Regenerate.
415
416 2012-12-07  Alan Modra  <amodra@gmail.com>
417
418         * options.h (General_options): Add no_toc_optimize.
419         * powerpc.cc (ok_lo_toc_insn): New function.
420         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
421
422 2012-12-06  Alan Modra  <amodra@gmail.com>
423
424         * options.h (General_options): Add plt_align, plt_static_chain,
425         plt_thread_safe.  Update stub_group_size help text.
426         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
427         for new plt_thread_safe_ var.
428         (use_plt_offset): Correct comments.
429         (Target_powerpc::do_relax): Look for thread creation symbols to
430         determine default plt_thread_safe value.  Clear plt call stubs
431         as well as branch stubs each iteration.
432         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
433         insn constants.
434         (l, hi, ha, write_insn): Move earlier.
435         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
436         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
437         plt stubs too.
438         (Stub_table::update_size): Adjust.
439         (Stub_table::prev_size, set_prev_size): Delete.
440         (Stub_table::stub_align): Let --plt-align affect result.
441         (Stub_table::plt_call_size): Calculate sizes for various stubs.
442         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
443         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
444         (Stub_table::do_write): Support more stub variants.
445
446 2012-12-04  Alan Modra  <amodra@gmail.com>
447
448         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
449         (Target_powerpc::do_define_standard_symbols): New function.
450
451 2012-12-03  Alan Modra  <amodra@gmail.com>
452
453         * output.h: Formatting, whitespace.
454
455 2012-12-03  Alan Modra  <amodra@gmail.com>
456
457         * layout.h (Layout::get_executable_sections): Declare.
458         * layout.cc (Layout::get_executable_sections): New function.
459         * arm.cc (Target_arm::group_sections): Use it.
460         (Arm_output_section::group_sections): Delete now redundant test.
461         * output.cc (Output_reloc::Output_reloc): Add is_relative.
462         param to handle relative relocs.
463         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
464         (Output_data_reloc::add_absolute): Adjust.
465         (Output_data_reloc::add_relative): New function.
466         (Output_data::reset_data_size): New function.
467         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
468         (Output_section::set_addralign): New function.
469         (Output_section::checkpoint_set_addralign): New function.
470         (Output_section::clear_section_offsets_need_adjustment): New function.
471         (Output_section::input_sections): Make public.
472         * powerpc.cc (class Output_data_brlt_powerpc): New.
473         (class Stub_table, class Stub_control): New.
474         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
475         stub_table_, set_stub_table, stub_table): New vectors and accessor
476         functions.
477         (Target_powerpc::do_may_relax, do_relax, push_branch,
478         new_stub_table, stub_tables, brlt_section, group_sections,
479         add_branch_lookup_table, find_branch_lookup_table,
480         write_branch_lookup_table, make_brlt_section): New functions.
481         (Target_powerpc::struct Sort_sections, class Branch_info): New.
482         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
483         branch_info_): New vars.
484         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
485         make call stubs here.
486         (Output_data_glink): Remove all call stub handling from this class.
487         (Target_powerpc::Scan::local, global): Save interesting branch
488         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
489         (Target_powerpc::do_finalize_sections): Only make reg save/restore
490         functions on final link.
491         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
492         Handle long branch destinations too.
493         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
494         do_plt_address_for_local): Adjust lookup of plt call stubs.
495
496 2012-11-30  Alan Modra  <amodra@gmail.com>
497
498         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
499         relocs against protected symbols when building 32-bit shared libs.
500
501 2012-11-30  Alan Modra  <amodra@gmail.com>
502
503         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
504         param.  Call got_section() to make .got.  Update all callers
505         and their callers and so on.
506
507 2012-11-30  Alan Modra  <amodra@gmail.com>
508
509         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
510         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
511         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
512         value if it already exists.
513
514 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
515
516         PR gold/14858
517         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
518
519 2012-11-14  Roland McGrath  <mcgrathr@google.com>
520
521         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
522         than bfc instruction for data sandboxing.
523
524 2012-11-08  Alan Modra  <amodra@gmail.com>
525
526         * po/POTFILES.in: Regenerate.
527
528 2012-11-05  Alan Modra  <amodra@gmail.com>
529
530         * configure.ac: Apply 2012-09-10 change to config.in here.
531         * configure: Regenerate.
532
533 2012-11-05  Alan Modra  <amodra@gmail.com>
534
535         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
536         (struct Opd_ent): Use "Address" rather than "Offset".
537         (Output_data_got_powerpc::got_base_offset): Return Valtype.
538         (Target_powerpc::got_section): Make public.
539         (Target_powerpc::scan_relocs): Move code setting symbols..
540         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
541         Create _SDA_BASE_ only when referenced.
542
543 2012-11-02  Roland McGrath  <mcgrathr@google.com>
544
545         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
546         from last change.
547
548 2012-11-01  Roland McGrath  <mcgrathr@google.com>
549
550         * target.h (Sized_target::relocate_relocs): Use Elf_Off
551         for offset_in_output_section parameter.
552         (Sized_target::relocate_special_relocatable): Likewise.
553         * arm.cc (Target_arm::relocate_relocs): Likewise.
554         (Target_arm::relocate_special_relocatable): Likewise.
555         * i386.cc (Target_i386::relocate_relocs): Likewise.
556         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
557         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
558         * target-reloc.h (relocate_relocs): Likewise.
559         * testsuite/testfile.cc (Target_test): Likewise.
560         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
561         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
562
563         * system.h: Move inclusion of <clocale> to after <libintl.h> in
564         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
565
566         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
567         parameter, which is unused in the [!F_SETFD] case.
568
569         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
570         SYMNDX to off_t before comparing it to this->data_size().
571         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
572         * incremental.cc (Output_section_incremental_inputs::do_write):
573         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
574
575         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
576
577 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
578
579         * gold.cc (Target_arm::do_adjust_elf_header): Add the
580         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
581         in EABI_VER5.
582
583 2012-10-29  Cary Coutant  <ccoutant@google.com>
584
585         * dwp.cc (usage): Add file and exit status parameters;
586         add --help and --version options.
587         (print_version): New function.
588         (main): Add --help and --version options.
589
590 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
591
592         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
593         final_layout_sequence.txt.
594         * testsuite/Makefile.in: Regenerated.
595
596 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
597
598         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
599         COMPILE generated by automake.
600         (LINK1): Likewise.
601         (CXXCOMPILE1): Likewise.
602         (CXXLINK1): Likewise.
603         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
604         (LINK): Likewise.
605         (CXXCOMPILE): Likewise.
606         (CXXLINK): Likewise.
607         * testsuite/Makefile.in: Regenerated.
608
609 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
610
611         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
612         on bad fwrite return.
613
614 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
615
616         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
617         on val.
618
619 2012-10-23  Cary Coutant  <ccoutant@google.com>
620
621         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
622         * testsuite/Makefile.in: Regenerate.
623         * testsuite/dwp_test.h: New source file.
624         * testsuite/dwp_test_1.cc: New source file.
625         * testsuite/dwp_test_1.s: New source file.
626         * testsuite/dwp_test_1.sh: New source file.
627         * testsuite/dwp_test_1b.cc: New source file.
628         * testsuite/dwp_test_1b.s: New source file.
629         * testsuite/dwp_test_2.cc: New source file.
630         * testsuite/dwp_test_2.s: New source file.
631         * testsuite/dwp_test_2.sh: New source file.
632         * testsuite/dwp_test_main.cc: New source file.
633         * testsuite/dwp_test_main.s: New source file.
634
635 2012-10-23  Cary Coutant  <ccoutant@google.com>
636
637         * dwp.h: New header file.
638         * dwp.cc: New source file.
639         * gold.h: Move shared declarations to system.h.
640         * system.h: New header file.
641         * Makefile.am: Add dwp.
642         * Makefile.in: Regenerate.
643
644 2012-10-23  Cary Coutant  <ccoutant@google.com>
645
646         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
647         Dwarf_info_reader::read_from_pointer.
648         (Dwarf_pubnames_table::read_header): Likewise.
649         (Dwarf_pubnames_table::next_name): Likewise.
650         (Dwarf_die::read_attributes): Likewise.
651         (Dwarf_die::skip_attributes): Likewise.
652         (Dwarf_info_reader::read_from_pointer): New function template.
653         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
654         (Dwarf_pubnames_table): Likewise.
655         (Dwarf_info_reader::read_from_pointer): New function template.
656         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
657         Dwarf_pubnames_table ctor.
658
659 2012-10-23  Cary Coutant  <ccoutant@google.com>
660
661         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
662         abbrev_shndx.
663         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
664         abbrev_shndx_.
665         (Dwarf_info_reader::set_abbrev_shndx): New method.
666         (Dwarf_info_reader::abbrev_shndx_): New data member.
667
668 2012-10-23  Cary Coutant  <ccoutant@google.com>
669
670         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
671         from object, not parameters.
672         (Dwarf_info_reader::parse): Likewise.
673         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
674         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
675         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
676         methods.
677
678 2012-10-23  Cary Coutant  <ccoutant@google.com>
679
680         * fileread.cc (Input_file::Input_file): New constructor.
681         * fileread.h (class Input_file): Add new constructor.
682
683 2012-10-18  Alan Modra  <amodra@gmail.com>
684
685         PR gold/14727
686         * object.cc (Relobj::is_section_name_included): Also match
687         .sdata personality section.
688
689 2012-10-18  Alan Modra  <amodra@gmail.com>
690
691         * target-reloc.h (class Default_comdat_behavior): New, package up..
692         (get_comdat_behaviour): ..this.
693         (relocate_section): Add Relocate_comdat_behavior template arg,
694         adjust code to suit.
695         * arm.cc (Target_arm::relocate_section): Adjust to suit.
696         (Target_arm::scan_reloc_section): Likewise.
697         * i386.cc (Target_i386::relocate_section): Likewise.
698         * sparc.cc (Target_sparc::relocate_section): Likewise.
699         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
700         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
701         * powerpc.cc (class Relocate_comdat_behavior): New.
702         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
703         gold::relocate_section with new template arg.
704
705 2012-10-18  Alan Modra  <amodra@gmail.com>
706
707         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
708         dynamic relocs for GOT_TPREL got entries, without symbol if
709         resolving locally.
710         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
711         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
712         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
713
714 2012-10-17  Alan Modra  <amodra@gmail.com>
715
716         PR gold/14726
717         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
718
719 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
720
721         * layout.cc (Layout::include_section): Keep sections marked
722         SHF_EXCLUDE when doing relocatable links.
723
724 2012-10-16  Alan Modra  <amodra@gmail.com>
725
726         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
727         (Target_powerpc::do_finalize_sections): Call it.
728         (Output_data_save_res): New class and supporting functions.
729         (Target_powerpc::symval_for_branch): Only look up .opd entry for
730         normal symbols defined in object files.
731
732 2012-10-12  Alan Modra  <amodra@gmail.com>
733
734         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
735         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
736         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
737         section if scan_opd_relocs not yet called.
738         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
739
740 2012-10-12  Alan Modra  <amodra@gmail.com>
741
742         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
743         add_local_ifunc_entry): Revert last change.
744         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
745
746 2012-10-05  Alan Modra  <amodra@gmail.com>
747
748         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
749         do_plt_address_for_global): New functions.
750         (Output_data_got_powerpc::do_write): Don't segfault when linking
751         statically.
752         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
753         add_local_ifunc_entry): Return true on adding entry..
754         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
755         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
756         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
757         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
758         set up symbols here.
759         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
760         syms here.  Do so even when no .iplt.  Don't segfault when linking
761         statically.
762         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
763         new variants without reloc param.
764         (Glink_sym_ent::Glink_sym_ent): Likewise.
765         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
766         reloc when refs will resolve to plt call stub.
767         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
768         R_PPC_PLTREL24 to resolve locally.
769         (Target_powerpc::Scan::global): Correct ifunc handling.
770         (Target_powerpc::Relocate::relocate): Correct local sym glink
771         lookup.  Don't destroy "value" when we have a plt call stub,
772         and when checking plt call validity.
773         (Target_powerpc::do_dynsym_value): Simplify.
774
775 2012-10-05  Alan Modra  <amodra@gmail.com>
776
777         * i386.cc (Output_data_plt_i386::address_for_global,
778         address_for_local): Add plt offset to returned value.  Adjust uses.
779         * sparc.cc (Output_data_plt_sparc::address_for_global,
780         address_for_local): Likewise.
781         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
782         address_for_local): Likewise.
783         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
784         address_for_local): Likewise.
785         * target.h (Target::plt_address_for_global, plt_address_for_local):
786         Update comment.
787         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
788         (Output_data_got::Got_entry::write): Nor here.
789         * output.h: Comment fix.
790
791 2012-10-02  Jiong Wang  <jiwang@tilera.com>
792
793         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
794         global_offset_table_ value for larget got.
795         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
796
797 2012-09-29  Alan Modra  <amodra@gmail.com>
798
799         * powerpc.cc (Target_powerpc::iplt_): New output section.
800         (Target_powerpc::iplt_section, make_iplt_section,
801         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
802         (Target_powerpc::make_plt_entry): Handle ifunc syms.
803         Target_powerpc::plt_entry_count): Count iplt entries too.
804         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
805         reloc section in constructor.  New params.
806         (Target_powerpc::make_plt_section): Create reloc section here instead.
807         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
808         functions.
809         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
810         (Output_data_glink::add_entry, find_entry): New functions to
811         deal with local syms.
812         (Glink_sym_ent): Add support for local syms.
813         (Output_data_glink::do_write): Handle ifunc plt entries.
814         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
815         (Target_powerpc::Scan::local, global): Handle ifunc syms.
816         (Target_powerpc::Relocate::relocate): Likewise.
817         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
818
819 2012-09-25  Alan Modra  <amodra@gmail.com>
820
821         * object.h (Sized_relobj_file::adjust_local_symbol,
822         do_adjust_local_symbol): New functions.
823         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
824         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
825         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
826         and irregular opd entry spacing.
827         (Powerpc_relobj::do_read_relocs): Add opd size checks.
828         (Global_symbol_visitor_opd): New functor.
829         (Target_powerpc::do_finalize_sections): Omit global symbols defined
830         on deleted opd entries.
831
832 2012-09-15  Jiong Wang  <jiwang@tilera.com>
833
834         * tilegx.cc: New file.
835         * Makefile.am (TARGETSOURCES): Add tilegx.cc
836         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
837         * configure.tgt: Add entries for tilegx*.
838         * configure.ac: Likewise.
839         * Makefile.in: Rebuild.
840         * configure: Likewise.
841         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
842         tilegx.
843
844 2012-09-13  Alan Modra  <amodra@gmail.com>
845
846         * target-reloc.h (scan_relocs): Call scan.local for relocs
847         against symbols in discarded sections.  Pass is_discarded
848         param.
849         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
850         Add is_discarded param.
851         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
852         is_discarded to flag opd entry as discarded.  Don't emit dyn
853         relocs on such entries.
854         (Target_powerpc::Scan::global): Similarly detect and handle
855         such opd entries.
856         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
857         opd_ent_.  Update all uses.
858         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
859         (Target_powerpc::relocate_section): Zero out discarded opd
860         entry relocs.
861
862 2012-09-12  Ian Lance Taylor  <iant@google.com>
863
864         PR gold/14570
865         * output.cc: Rename Output_data_got template parameter from size
866         to got_size for all functions.  Compile all variants of
867         Output_data_got.
868         (Output_data_got::Got_entry::write): Correct use of size for
869         symbol value.  Use local_is_tls rather than casting to
870         Sized_relobj_file.
871         * object.h (class Object): Add local_is_tls and do_local_is_tls.
872         (class Sized_relobj_file): Add do_local_is_tls.
873         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
874
875 2012-09-11  Alan Modra  <amodra@gmail.com>
876
877         PR gold/14566
878         * layout.cc (Layout::set_segment_offsets): When using
879         common-page-size alignment, ensure we are on a new max-page-size
880         page.
881         * output.cc (Output_segment::set_section_addresses): Use
882         abi_pagesize, not common_pagesize for relro boundary.
883         (Output_segment::set_offset): Likewise.
884
885 2012-09-11  Alan Modra  <amodra@gmail.com>
886
887         * output.h (Output_data_got::add_global_tls, add_local_tls,
888         add_local_tls_pair): New functions.
889         (Output_data_got::add_local_pair_with_rel): Remove second
890         reloc param.  Expand comment.
891         (Output_data_got::Got_entry): Rename use_plt_offset_ to
892         use_plt_or_tls_offset_, similarly for constructor param.
893         (Output_data_got::Got_entry::write): Add got_index param.
894         * output.cc (Output_data_got::add_global_tls, add_local_tls,
895         add_local_tls_pair): New functions.
896         (Output_data_got::Got_entry::write): Handle tls symbols
897         with use_plt_or_tls_offset_ set specially.
898         (Output_data_got::add_local_pair_with_rel): Only one reloc.
899         (Output_data_got::do_write): Replace iterator with index, pass
900         index to entry write function.
901         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
902         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
903         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
904         call.
905         * i386.cc (Target_i386::Scan::local): Likewise.
906         * sparc.cc (Target_sparc::Scan::local): Likewise.
907         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
908         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
909         do_tls_offset_for_global): New functions.
910         (Target_powerpc::Scan::local): Correct TLS relocations and got
911         entry values.
912         (Target_powerpc::Scan::global): Don't emit unnecessary
913         dynamic relocations on TLS GOT entries.
914
915 2012-09-10  Matthias Klose  <doko@ubuntu.com>
916
917         * config.in: Disable sanity check for kfreebsd.
918
919 2012-09-10  Sterling Augustine  <saugustine@google.com>
920
921         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
922         (Gdb_index::pubtypes_read): New parameter.
923         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
924         to calls.
925         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
926         pubtypes_object_.
927
928 2012-09-09  Alan Modra  <amodra@gmail.com>
929
930         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
931         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
932         * gc.h (gc_process_relocs): Call target gc_add_reference.
933         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
934         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
935         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
936         unnecessary cast.
937         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
938         to cater for when we don't need code offset.  Update use.
939         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
940         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
941         set_opd_valid): New functions.
942         (Target_powerpc::do_gc_add_reference): New function.
943         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
944         stashed refs.
945         (Target_powerpc::do_gc_mark_symbol): New function.
946
947 2012-09-06  Cary Coutant  <ccoutant@google.com>
948
949         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
950         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
951         (Dwarf_die::skip_attributes): Likewise.
952         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
953         * testsuite/gdb_index_test.cc (inline_func_1): New function.
954         (main): Call it.
955         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
956
957 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
958
959         * testsuite/script_test_3.t: Add .got.plt output section
960         statement.
961         * testsuite/script_test_4.t: Likewise.
962
963 2012-09-05  Alan Modra  <amodra@gmail.com>
964
965         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
966         update all uses and lose "enum" when using type.
967
968 2012-09-05  Alan Modra  <amodra@gmail.com>
969
970         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
971         * configure: Regenerate.
972         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
973         (plugin_final_layout.stdout): Likewise.
974         (memory_test): Set page sizes to 0x1000.
975         * testsuite/Makefile.in: Regenerate.
976         * testsuite/discard_locals_test.sh: Add FIXME comment.
977         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
978         * testsuite/pr14265.t: Add .got output section statement.
979         * testsuite/script_test_2.t: Likewise.
980         * testsuite/script_test_3.t: Likewise.
981         * testsuite/script_test_4.t: Likewise.
982         * testsuite/script_test_5.t: Likewise.
983         * testsuite/script_test_6.t: Likewise.
984         * testsuite/script_test_7.t: Likewise.
985         * testsuite/script_test_9.t: Likewise.
986
987 2012-09-05  Alan Modra  <amodra@gmail.com>
988
989         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
990         (Powerpc_relocate_functions::Status): New typedef.
991         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
992         (Target_powerpc::Scan::local): Handle REL64.
993         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
994         for REL32 and REL64.
995         (Target_powerpc::symval_for_branch): New function, extracted from..
996         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
997         checks.  Report overflow errors.
998
999 2012-09-05  Alan Modra  <amodra@gmail.com>
1000
1001         * object.h (Sized_relobj_file::emit_relocs): Delete.
1002         (Sized_relobj_file::emit_relocs_reltype): Delete.
1003         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1004         relocate_relocs for --emit-relocs.
1005         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1006         * output.h: Update comment.
1007         (Output_segment::first_section): New function.
1008         (Output_segment::first_section_load_address): Use first_section.
1009         * output.cc (Output_segment::first_section): New function extracted..
1010         (Output_segment::first_section_load_address): ..from here.  Delete.
1011         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1012         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1013         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1014         adjust call to target.h function.
1015         * i386.cc (Target_i386): Likewise.
1016         * sparc.cc (Target_sparc): Likewise.
1017         * x86_64.cc (Target_x86_64): Likewise.
1018         * powerpc.cc (Target_powerpc): Likewise.
1019         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1020         first tls section has section symbol for optimised local dynamic
1021         output relocs.
1022         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1023         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1024         optimised tls code.
1025         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1026         Rename to relocate_relocs.  Update error message.
1027
1028 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1029
1030         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1031         --just-symbols.
1032
1033 2012-08-31  Alan Modra  <amodra@gmail.com>
1034
1035         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1036         (Powerpc_relobj::toc_base_offset): New stub function.
1037         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1038         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1039         (Target_powerpc::Relocate::enum skip_tls): New.
1040         (Target_powerpc::call_tls_get_addr_): New var.
1041         (Target_powerpc::is_branch_reloc): Move to file scope.
1042         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1043         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1044         New functions.
1045         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1046         (powerpc_info): Correct common_pagesize for ppc64.
1047         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1048         (Powerpc_relocate_functions): Add overflow check enums and functions.
1049         Add non-shift version of rela, rela_ua.  Delete all rel public
1050         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1051         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1052         addr16_ha3, addr14 functions.
1053         (Output_data_got_powerpc::add_constant_pair): New function.
1054         (Output_data_got_powerpc::got_base_offset): Likewise.
1055         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1056         (instruction constants): Sort, add some more.
1057         (Output_data_glink::do_write): Add and use Address typedef.  Use
1058         object->toc_base_offset() stub for 64-bit.
1059         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1060         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1061         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1062         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1063         Always treat .opd relocs as against locally defined symbol.
1064         Correct condition for RELATIVE relocs.
1065         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1066         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1067         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1068         calculations.  Handle TLS relocs, and more.  Add overflow
1069         checking and adjust for Powerpc_relocate_functions changes.
1070         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1071         Reinstate --emit-relocs code with FIXME.
1072
1073 2012-08-30  Alan Modra  <amodra@gmail.com>
1074
1075         * layout.cc (Layout::set_segment_offsets): Set p_align to
1076         abi_pagesize, not common_pagesize.
1077         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1078         to determine whether file header can go in segment.
1079
1080 2012-08-30  Alan Modra  <amodra@gmail.com>
1081
1082         * output.h (Output_reloc::Output_reloc <output section>): Add
1083         is_relative param.  Adjust calls.
1084         (Output_reloc::add_output_section_relative): New functions.
1085         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1086         is_relative.
1087         (Output_reloc::symbol_value): Handle SECTION_CODE.
1088
1089 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1090
1091         * gold.cc (queue_middle_tasks): Call layout again when unique
1092         segments for sections is desired.
1093         * layout.cc (Layout::Layout): Initialize new members.
1094         (Layout::get_output_section_flags): New function.
1095         (Layout::choose_output_section): Call get_output_section_flags.
1096         (Layout::layout): Make output section for mapping to a unique segment.
1097         (Layout::insert_section_segment_map): New function.
1098         (Layout::attach_allocated_section_to_segment): Make unique segment for
1099         output sections marked so.
1100         (Layout::segment_precedes): Check for unique segments when sorting.
1101         * layout.h (Layout::Unique_segment_info): New struct.
1102         (Layout::Section_segment_map): New typedef.
1103         (Layout::insert_section_segment_map): New function.
1104         (Layout::get_output_section_flags): New function.
1105         (Layout::is_unique_segment_for_sections_specified): New function.
1106         (Layout::set_unique_segment_for_sections_specified): New function.
1107         (Layout::unique_segment_for_sections_specified_): New member.
1108         (Layout::section_segment_map_): New member.
1109         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1110         Rename is_gc_pass_one to is_pass_one.
1111         Rename is_gc_pass_two to is_pass_two.
1112         Rename is_gc_or_icf to is_two_pass.
1113         Check for which pass based on whether symbols data is present.
1114         Make it two pass when unique segments for sections is desired.
1115         * output.cc (Output_section::Output_section): Initialize new
1116         members.
1117         * output.h (Output_section::is_unique_segment): New function.
1118         (Output_section::set_is_unique_segment): New function.
1119         (Output_section::is_unique_segment_): New member.
1120         (Output_section::extra_segment_flags): New function.
1121         (Output_section::set_extra_segment_flags): New function.
1122         (Output_section::extra_segment_flags_): New member.
1123         (Output_section::segment_alignment): New function.
1124         (Output_section::set_segment_alignment): New function.
1125         (Output_section::segment_alignment_): New member.
1126         (Output_segment::Output_segment): Initialize is_unique_segment_.
1127         (Output_segment::is_unique_segment): New function.
1128         (Output_segment::set_is_unique_segment): New function.
1129         (Output_segment::is_unique_segment_): New member.
1130         * plugin.cc (allow_unique_segment_for_sections): New function.
1131         (unique_segment_for_sections): New function.
1132         (Plugin::load): Add new functions to transfer vector.
1133         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1134         * Makefile.in: Regenerate.
1135         * testsuite/plugin_final_layout.sh: Check if unique segment
1136         functionality works.
1137         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1138         are available.
1139         (allow_unique_segment_for_sections): New global.
1140         (unique_segment_for_sections): New global.
1141         (claim_file_hook): Call allow_unique_segment_for_sections.
1142         (all_symbols_read_hook): Call unique_segment_for_sections.
1143
1144 2012-08-22  Cary Coutant  <ccoutant@google.com>
1145
1146         * layout.cc (Layout::include_section): Don't assert on GROUP
1147         sections with --emit-relocs.
1148
1149 2012-08-21  Cary Coutant  <ccoutant@google.com>
1150
1151         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1152         if --export-dynamic-symbol names an undef symbol.
1153
1154 2012-08-18  Alan Modra  <amodra@gmail.com>
1155
1156         * powerpc.cc: Formatting and white space.
1157         (Powerpc_relobj): Rename got2_section_ to special_.
1158         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1159         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1160         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1161         (Target_powerpc): Add Address typedef and invalid_address.  Use
1162         throughout.
1163         (Target_powerpc::is_branch_reloc): New function.
1164         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1165         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1166         for dst_mask, value and addend.
1167         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1168         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1169         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1170         uint16_t for 24-bit offset.  Use get_output_section_offset and
1171         check return.
1172         (Target_powerpc::Scan::local): Handle more relocs.
1173         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1174         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1175         Plug in toc restoring insn after plt calls.  Translate branches
1176         to function descriptor symbols to corresponding entry point.
1177         (Target_powerpc::relocate_for_relocatable): Check return from
1178         get_output_section_offset.
1179         * symtab.h: Comment typo.
1180
1181 2012-08-14  Ian Lance Taylor  <iant@google.com>
1182
1183         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1184         unsupported_relocal_local to call unsupported_reloc_global.
1185
1186 2012-08-14  Nick Clifton  <nickc@redhat.com>
1187
1188         PR ld/14265
1189         * script-sections.cc (Sections_element::output_section_name): Add
1190         keep return parameter.
1191         (Output_section_element::match_name): Add keep return parameter.
1192         Return the value of the keep_ member.
1193         * script-sections.h (class Output_section): Update
1194         output_section_name prototype.
1195         * layout.cc (Layout::keep_input_section): New public member
1196         function.
1197         (Layout::choose_output_section): Pass keep parameter to
1198         output_section_name.
1199         * layout.h (class Layout): Add keep_input_section.
1200         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1201         sections.
1202         * testsuite/Makefile.am: Add a test.
1203         * testsuite/Makefile.in: Regenerate.
1204         * testsuite/pr14265.c: Source file for the test.
1205         * testsuite/pr14265.t: Linker script for the test.
1206         * testsuite/pr14265.sh: Shell script for the test.
1207
1208 2012-08-14  Alan Modra  <amodra@gmail.com>
1209
1210         * target.h (Target::output_section_name): New function.
1211         (Target::do_output_section_name): New function.
1212         * layout.cc (Layout::choose_output_section): Call the above.
1213         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1214
1215 2012-08-14  Alan Modra  <amodra@gmail.com>
1216
1217         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1218         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1219         for replace_constant call.
1220         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1221         (Output_data_glink::do_print_to_mapfile): New function.
1222         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1223         (Target_powerpc::Relocate::relocate): Likewise.
1224
1225 2012-08-14  Alan Modra  <amodra@gmail.com>
1226
1227         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1228         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1229         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1230         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1231         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1232         here.
1233         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1234         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1235         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1236         here.
1237         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1238         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1239
1240 2012-08-12  Alan Modra  <amodra@gmail.com>
1241
1242         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1243         (glink insn constants): Use uint32_t.
1244         (Output_data_glink::add_entry): Use insert, not [] operator.
1245
1246 2012-08-11  Alan Modra  <amodra@gmail.com>
1247
1248         * object.h (Sized_relobj_file::find_shdr): New function.
1249         (Sized_relobj_file::find_special_sections): New function.
1250         * object.cc (Sized_relobj_file::find_shdr): New function.
1251         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1252         (Sized_relobj_file::find_special_sections): New function, split out..
1253         (Sized_relobj_file::do_read_symbols): ..from here.
1254         * output.h (Output_data_got::replace_constant): New function.
1255         (Output_data_got::num_entries): New function.
1256         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1257         (Output_data_got::got_offset): Protected rather than private.
1258         (Output_data_got::replace_got_entry): New function.
1259         * output.cc (Output_data_got::replace_got_entry): New function.
1260         * powerpc.cc (class Powerpc_relobj): New.
1261         (class Powerpc_relocate_functions): Delete all psymval variants or
1262         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1263         Implement _ha functions using corresponding _hi function.
1264         (Powerpc_relobj::find_special_sections): New function.
1265         (Target_powerpc::do_make_elf_object): New function.
1266         (class Output_data_got_powerpc): New.
1267         (class Output_data_glink): New.
1268         (class Powerpc_scan_relocatable_reloc): New.
1269         Many more changes througout file.
1270
1271 2012-08-09  Nick Clifton  <nickc@redhat.com>
1272
1273         * po/vi.po: Updated Vietnamese translation.
1274
1275 2012-08-07  Ian Lance Taylor  <iant@google.com>
1276
1277         * layout.cc (Layout::add_target_dynamic_tags): If
1278         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1279         plt_rel.
1280
1281 2012-07-30  Nick Clifton  <nickc@redhat.com>
1282
1283         * po/gold.pot: Updated template.
1284         * po/es.po: Updated Spanish translation.
1285
1286 2012-07-18  Cary Coutant  <ccoutant@google.com>
1287
1288         PR gold/14344
1289         * configure.ac: Add check for -gpubnames support.
1290         * configure: Regenerate.
1291         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1292         support; force -gno-pubnames.
1293         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1294         support.
1295         (gdb_index_test_4): New test.
1296         * testsuite/Makefile.in: Regenerate.
1297         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1298         * testsuite/gdb_index_test_2.sh: Likewise.
1299         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1300         * testsuite/gdb_index_test_4.sh: New script.
1301         * testsuite/gdb_index_test_comm.sh: New script with common code;
1302         don't look for space after colon.
1303
1304 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1305
1306         * gold.cc (queue_middle_tasks): Update function order only after
1307         deferred objects due to plugins are processed.
1308
1309 2012-07-11  Ian Lance Taylor  <iant@google.com>
1310
1311         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1312         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1313         (Target_arm::scan_reloc_for_stub): Likewise.
1314         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1315         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1316         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1317         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1318         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1319
1320 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1321             Ian Lance Taylor  <iant@google.com>
1322
1323         PR gold/14309
1324         * configure.ac: Test whether std::tr1::hash<off_t> works.
1325         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1326         needed.
1327         * output.h (class Output_fill): Add virtual destructor.
1328         * configure, config.in: Rebuild.
1329
1330 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1331
1332         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1333
1334 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1335
1336         * plugin.cc (Plugin::load): Handle position independent executables.
1337
1338 2012-06-06  Cary Coutant  <ccoutant@google.com>
1339
1340         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1341         add .debug_macro.
1342         (lines_only_debug_sections): Likewise.
1343         (gdb_fast_lookup_sections): New static array.
1344         (is_gdb_debug_section): Rename formal parameter.
1345         (is_lines_only_debug_section): Likewise.
1346         (is_gdb_fast_lookup_section): New function.
1347         (Layout::include_section): Check for ".zdebug_" prefix; pass
1348         section name suffix to is_gdb_debug_section, et al.; check for
1349         fast-lookup sections when building .gdb_index.
1350         * options.h (--strip-debug-gdb): Update GDB version number.
1351
1352 2012-06-06  Cary Coutant  <ccoutant@google.com>
1353
1354         * configure.ac: Add check for fallocate.
1355         * configure: Regenerate.
1356         * config.in: Regenerate.
1357
1358         * options.h (class General_options): Add --mmap-output-file and
1359         --posix-fallocate options.
1360         * output.cc: (posix_fallocate): Remove; replace with...
1361         (gold_fallocate): New function.
1362         (Output_file::map_no_anonymous): Call gold_fallocate.
1363         (Output_file::map): Check --mmap-output-file option.
1364
1365 2012-06-05  Jing Yu  <jingyu@google.com>
1366
1367         * gold.h (textdomain): Add do {} to empty while(0).
1368         (bindtextdomain): Likewise.
1369
1370 2012-06-04  Cary Coutant  <ccoutant@google.com>
1371
1372         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1373         has_dynsym_index.
1374
1375 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1376
1377         * symtab.cc (Symbol_table::define_special_symbol):
1378         Initialize *poldsym to prevent uninitialized variable errors.
1379
1380 2012-05-23  Cary Coutant  <ccoutant@google.com>
1381
1382         * layout.cc (Layout::section_name_mapping): Add rules to handle
1383         exact match on .data.rel.ro.local or .data.rel.ro.
1384         (Layout::output_section_name): Check for exact matches.
1385
1386 2012-05-23  Cary Coutant  <ccoutant@google.com>
1387
1388         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1389         more carefully.
1390
1391 2012-05-22  Cary Coutant  <ccoutant@google.com>
1392
1393         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1394         object before exporting symbol.
1395
1396 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1397
1398         * testsuite/tls_test.cc: Include "config.h" first.
1399         * testsuite/tls_test_c.c: Likewise.
1400
1401 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1402             Nick Clifton  <nickc@redhat.com>
1403
1404         PR 14072
1405         * configure.in: Add check that sysdep.h has been included before
1406         any system header files.
1407         * configure: Regenerate.
1408         * config.in: Regenerate.
1409
1410 2012-05-14  Cary Coutant  <ccoutant@google.com>
1411
1412         * layout.cc (Layout::make_output_section): Mark .tdata section
1413         as RELRO.
1414         * testsuite/relro_test.cc: Add a TLS variable.
1415
1416 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1417
1418         PR gold/14091
1419         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1420         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1421         R_X86_64_64.
1422
1423 2012-05-08  Cary Coutant  <ccoutant@google.com>
1424
1425         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1426         (lines_only_debug_sections): Likewise.
1427
1428 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1429
1430         * nacl.cc: New file.
1431         * nacl.h: New file.
1432         * Makefile.am (CCFILES, HFILES): Add them.
1433         * Makefile.in: Regenerate.
1434         * i386.cc (Output_data_plt_i386_nacl): New class.
1435         (Output_data_plt_i386_nacl_exec): New class.
1436         (Output_data_plt_i386_nacl_dyn): New class.
1437         (Target_i386_nacl): New class.
1438         (Target_selector_i386_nacl): New class.
1439         (target_selector_i386): Use it instead of Target_selector_i386.
1440         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1441         (Target_x86_64_nacl): New class.
1442         (Target_selector_x86_64_nacl): New class.
1443         (target_selector_x86_64, target_selector_x32): Use it instead of
1444         Target_selector_x86_64.
1445         * arm.cc (Output_data_plt_arm_nacl): New class.
1446         (Target_arm_nacl): New class.
1447         (Target_selector_arm_nacl): New class.
1448         (target_selector_arm, target_selector_armbe): Use it instead of
1449         Target_selector_arm.
1450
1451         * target-select.cc (select_target): Take new Input_file* and off_t
1452         arguments, pass them on to recognize method of selector.
1453         * object.cc (make_elf_sized_object): Update caller.
1454         * parameters.cc (parameters_force_valid_target): Likewise.
1455         * incremental.cc (make_sized_incremental_binary): Likewise.
1456         * target-select.h: Update decl.
1457         (Target_selector::recognize): Take new Input_file* argument,
1458         pass it on to do_recognize.
1459         (Target_selector::do_recognize): Take new Input_file* argument.
1460         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1461         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1462         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1463         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1464
1465         * target.h (Target::Target_info): New members isolate_execinstr
1466         and rosegment_gap.
1467         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1468         * arm.cc (Target_arm::arm_info): Update initializer.
1469         * i386.cc (Target_i386::i386_info): Likewise.
1470         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1471         * sparc.cc (Target_sparc::sparc_info): Likewise.
1472         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1473         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1474         * layout.cc (Layout::attach_allocated_section_to_segment):
1475         Take new const Target* argument.  If target->isolate_execinstr(), act
1476         like --rosegment.
1477         (Layout::find_first_load_seg): Take new const Target* argument;
1478         if target->isolate_execinstr(), reject PF_X segments.
1479         (Layout::relaxation_loop_body): Update caller.
1480         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1481         reset file offset to zero when we hit LOAD_SEG, and then do a second
1482         loop over the segments before LOAD_SEG to reassign offsets after
1483         addresses have been determined.  Handle target->rosegment_gap().
1484         (Layout::attach_section_to_segment): Take new const Target* argument;
1485         pass it to attach_allocated_section_to_segment.
1486         (Layout::make_output_section): Update caller.
1487         (Layout::attach_sections_to_segments): Take new const Target* argument;
1488         pass it to attach_section_to_segment.
1489         * gold.cc (queue_middle_tasks): Update caller.
1490         * layout.h (Layout): Update method decls with new arguments.
1491
1492         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1493         Target_info pointer to use.
1494         (Target_arm::do_make_data_plt): New virtual method.
1495         (Target_arm::make_data_plt): New method that calls it.
1496         (Target_arm::make_plt_entry): Use it.
1497         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1498         for the section alignment.
1499         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1500         method.
1501         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1502         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1503         method.
1504         (Output_data_plt_arm::get_plt_entry_size): Call it.
1505         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1506         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1507         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1508         method.
1509         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1510         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1511         method instead of sizeof(plt_entry).
1512         (Output_data_plt_arm::add_entry): Likewise.
1513         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1514         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1515         than static method.
1516         (Target_arm::plt_entry_size): Likewise.
1517         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1518         Move to ...
1519         (Output_data_plt_arm_standard): ... here, new class.
1520         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1521         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1522         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1523
1524         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1525         Take additional argument for the PLT entry size.
1526         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1527         Use get_plt_entry_size method rather than plt_entry_size variable.
1528         (Output_data_plt_x86_64::reserve_slot): Likewise.
1529         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1530         (Output_data_plt_x86_64::add_entry): Likewise.
1531         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1532         (Output_data_plt_x86_64::address_for_global): Likewise.
1533         (Output_data_plt_x86_64::address_for_local): Likewise.
1534         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1535         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1536         Make method non-static.
1537         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1538         method.
1539         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1540         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1541         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1542         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1543         virtual method.
1544         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1545         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1546         virtual method.
1547         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1548         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1549         virtual method.
1550         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1551         (Output_data_plt_x86_64::plt_entry_size)
1552         (Output_data_plt_x86_64::first_plt_entry)
1553         (Output_data_plt_x86_64::plt_entry)
1554         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1555         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1556         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1557         (Output_data_plt_x86_64_standard): ... here, new class.
1558         (Target_x86_64::Target_x86_64): Take optional argument for the
1559         Target_info pointer to use.
1560         (Target_x86_64::do_make_data_plt): New virtual method.
1561         (Target_x86_64::make_data_plt): New method to call it.
1562         (Target_x86_64::init_got_plt_for_update): Use that.
1563         Call this->plt_->add_eh_frame method here.
1564         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1565         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1566         rather than static method.
1567         (Target_x86_64::plt_entry_size): Likewise.
1568         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1569         rather than plt_entry_size variable.  Move guts of PLT filling to...
1570         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1571         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1572         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1573
1574         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1575         additional argument for the section alignment.
1576         Don't do add_eh_frame_for_plt here.
1577         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1578         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1579         variable.
1580         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1581         method.
1582         (Output_data_plt_i386::get_plt_entry_size): Call it.
1583         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1584         (Output_data_plt_i386::add_eh_frame): New method to call it.
1585         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1586         method.
1587         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1588         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1589         method.
1590         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1591         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1592         method instead of plt_entry_size.
1593         (Output_data_plt_i386::plt_entry_size)
1594         (Output_data_plt_i386::plt_eh_frame_fde_size)
1595         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1596         (Output_data_plt_i386_standard): ... here, new class.
1597         (Output_data_plt_i386_exec): New class.
1598         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1599         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1600         (Output_data_plt_i386::exec_plt_entry): Move to ...
1601         (Output_data_plt_i386_exec::plt_entry): ... here.
1602         (Output_data_plt_i386_dyn): New class.
1603         (Output_data_plt_i386::first_plt_entry): Move to ...
1604         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1605         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1606         (Output_data_plt_i386_dyn::plt_entry): ... here.
1607         (Target_i386::Target_i386): Take optional argument for the Target_info
1608         pointer to use.
1609         (Target_i386::do_make_data_plt): New virtual method.
1610         (Target_i386::make_data_plt): New method to call it.
1611         (Target_i386::make_plt_section): Use that.
1612         Call this->plt_->add_eh_frame method here.
1613         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1614         rather than plt_entry_size variable.
1615         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1616         (Output_data_plt_i386::address_for_local): Likewise.
1617         (Output_data_plt_i386::do_write): Likewise.
1618         Move guts of PLT filling to...
1619         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1620         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1621         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1622         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1623
1624 2012-05-01  Cary Coutant  <ccoutant@google.com>
1625
1626         * dwarf_reader.cc (Dwarf_die::read_attributes)
1627         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1628         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1629         * reduced_debug_output.cc
1630         (Output_reduced_debug_info_section::get_die_end): Remove
1631         DW_FORM_GNU_ref_index.  Add default case.
1632
1633 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1634
1635         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1636         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1637         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1638         DW_AT_high_pc as offset from DW_AT_low_pc.
1639
1640         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1641         * testsuite/Makefile.in: Regenerate.
1642         * testsuite/gdb_index_test_3.c: New test source file.
1643         * testsuite/gdb_index_test_3.sh: New test source file.
1644
1645 2012-04-25  Ian Lance Taylor  <iant@google.com>
1646
1647         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1648         pointer.
1649         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1650         as a class, not a struct.
1651         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1652         (Target_arm::apply_cortex_a8_workaround): Likewise.
1653         * gc.h: Declare Reloc_types as a struct, not a class.
1654         * object.h: Declare Symbols_data as a struct.
1655         * reloc.h: Declare Read_relocs_data as a struct.
1656         * target.h: Declare Relocate_info as a struct.
1657
1658 2012-04-24  David S. Miller  <davem@davemloft.net>
1659
1660         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1661         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1662         and R_SPARC_WPLT30.
1663
1664 2012-04-24  Cary Coutant  <ccoutant@google.com>
1665
1666         * incremental-dump.cc (find_input_containing_global): Replace
1667         magic number with symbolic constant.
1668         (dump_incremental_inputs): Update version number.
1669         * incremental.cc (Output_section_incremental_inputs): Update version
1670         number; import symbolic constants from Incremental_inputs_reader.
1671         (Incremental_inputs::create_data_sections): Align relocations
1672         section correctly for 64-bit targets.
1673         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1674         constants; add padding.
1675         (Output_section_incremental_inputs::write_header): Add assert for
1676         header_size.
1677         (Output_section_incremental_inputs::write_input_files): Add assert
1678         for input_entry_size.
1679         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1680         add assert for object_info_size, input_section_entry_size,
1681         global_sym_entry_size.
1682         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1683         for data structure sizes; use them.
1684         (Incremental_input_entry_reader): Import symbolic constants from
1685         Incremental_inputs_reader; use them.
1686
1687 2012-04-23  David S. Miller  <davem@davemloft.net>
1688
1689         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1690         and elf_flags_set_.
1691         (Target_sparc::Target_sparc): Initialize new fields.
1692         (Target_sparc::do_make_elf_object): New function.
1693         (Target_sparc::do_adjust_elf_header): New function.
1694
1695 2012-04-23  Cary Coutant  <ccoutant@google.com>
1696
1697         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1698         CU range table of gdb index.
1699
1700 2012-04-20  David S. Miller  <davem@davemloft.net>
1701
1702         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1703         instead of false.
1704
1705 2012-04-16  David S. Miller  <davem@davemloft.net>
1706
1707         * sparc.cc (Target_sparc::got_address): New function.
1708         (Sparc_relocate_functions::gdop_hix22): New function.
1709         (Sparc_relocate_functions::gdop_lox10): New function.
1710         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1711         relocs.
1712         (Target_sparc::Scan::local): Likewise if the global symbol is not
1713         preemptible and is not IFUNC.
1714         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1715         transformations for local and non-preemptible non-IFUNC global
1716         symbols.
1717
1718         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1719         writing out 64-bit part of ranges.
1720
1721         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1722         -fpic and -fpie respectively.
1723         * Makefile.in: Regenerate.
1724
1725         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1726         (Target_sparc::Target_sparc): Initialize new field.
1727         (Target_sparc::do_plt_section_for_global): New function.
1728         (Target_sparc::do_plt_section_for_local): New function.
1729         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1730         (Target_sparc::make_plt_section): New function, broken out of
1731         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1732         (Target_sparc::make_plt_entry): Call make_plt_section.
1733         (Target_sparc::make_local_ifunc_plt_entry): New function.
1734         (Target_sparc::rela_ifunc_section): New function.
1735         (Target_sparc::plt_section): Remove const.
1736         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1737         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1738         and ifunc_count_ fields.
1739         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1740         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1741         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1742         (Output_data_plt_sparc::rela_ifunc): New function.
1743         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1744         (Output_data_plt_sparc::has_ifunc_section): New function.
1745         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1746         (Output_data_plt_sparc::address_for_global): New function.
1747         (Output_data_plt_sparc::address_for_local): New function.
1748         (Output_data_plt_sparc::plt_index_to_offset): New function.
1749         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1750         and entry_count.
1751         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1752         entry_count.
1753         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1754         R_SPARC_JMP_IREL to switch.
1755         (Target_sparc::Scan::check_non_pic): Likewise.
1756         (Target_sparc::Scan::local): Handle IFUNC symbols.
1757         (Target_sparc::Scan::local): Likewise.
1758         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1759         and plt_address_for_local.
1760         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1761         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1762
1763         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1764         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1765         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1766         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1767         global relocs too.
1768         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1769         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1770         calls.
1771         * sparc.cc (Target_sparc::Scan::global): Likewise.
1772         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1773
1774 2012-04-16  Cary Coutant  <ccoutant@google.com>
1775
1776         * archive.cc (Library_base::should_include_member): Check for
1777         --export-dynamic-symbol.
1778         * options.h (class General_options): Add --export-dynamic-symbol.
1779         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1780         --export-dynamic-symbol.
1781         (Symbol_table::gc_mark_undef_symbols): Likewise.
1782         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1783
1784 2012-04-12  David S. Miller  <davem@davemloft.net>
1785
1786         * sparc.cc (Reloc::wdisp10): New relocation method.
1787         (Reloc::h34): Likewise.
1788         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1789         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1790         R_SPARC_WDISP10.
1791         (Target_sparc::Scan::local): Likewise.
1792         (Target_sparc::Scan::global): Likewise.
1793         (Target_sparc::Relocate::relocate): Likewise.
1794
1795 2012-04-09  Cary Coutant  <ccoutant@google.com>
1796
1797         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1798         low_pc == 0.
1799
1800 2012-04-06  Ian Lance Taylor  <iant@google.com>
1801
1802         * timer.cc: #include <unistd.h>.
1803
1804 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1805
1806         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1807         * config.in: Regenerate.
1808         * configure: Regenerate.
1809
1810 2012-04-05  Nick Clifton  <nickc@redhat.com>
1811
1812         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1813         (AM_LC_MESSAGES): Add.
1814         * aclocal.m4: Regenerate.
1815         * config.in: Regenerate.
1816         * configure: Regenerate.
1817
1818 2012-03-21  Cary Coutant  <ccoutant@google.com>
1819
1820         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1821         * Makefile.in: Regenerate.
1822         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1823         (Sized_elf_reloc_mapper::symbol_section): New function.
1824         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1825         (make_elf_reloc_mapper): New function.
1826         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1827         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1828         (Dwarf_abbrev_table::do_get_abbrev): New function.
1829         (Dwarf_ranges_table::read_ranges_table): New function.
1830         (Dwarf_ranges_table::read_range_list): New function.
1831         (Dwarf_pubnames_table::read_section): New function.
1832         (Dwarf_pubnames_table::read_header): New function.
1833         (Dwarf_pubnames_table::next_name): New function.
1834         (Dwarf_die::Dwarf_die): New function.
1835         (Dwarf_die::read_attributes): New function.
1836         (Dwarf_die::skip_attributes): New function.
1837         (Dwarf_die::set_name): New function.
1838         (Dwarf_die::set_linkage_name): New function.
1839         (Dwarf_die::attribute): New function.
1840         (Dwarf_die::string_attribute): New function.
1841         (Dwarf_die::int_attribute): New function.
1842         (Dwarf_die::uint_attribute): New function.
1843         (Dwarf_die::ref_attribute): New function.
1844         (Dwarf_die::child_offset): New function.
1845         (Dwarf_die::sibling_offset): New function.
1846         (Dwarf_info_reader::check_buffer): New function.
1847         (Dwarf_info_reader::parse): New function.
1848         (Dwarf_info_reader::do_parse): New function.
1849         (Dwarf_info_reader::do_read_string_table): New function.
1850         (Dwarf_info_reader::lookup_reloc): New function.
1851         (Dwarf_info_reader::get_string): New function.
1852         (Dwarf_info_reader::visit_compilation_unit): New function.
1853         (Dwarf_info_reader::visit_type_unit): New function.
1854         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1855         Sized_elf_reloc_mapper.
1856         (Sized_dwarf_line_info::symbol_section): Remove function.
1857         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1858         (Sized_dwarf_line_info::read_line_mappings): Remove object
1859         parameter, adjust callers.
1860         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1861         * dwarf_reader.h: Include <sys/types.h>.
1862         (class Track_relocs): Remove forward declaration.
1863         (class Elf_reloc_mapper): New class.
1864         (class Sized_elf_reloc_mapper): New class.
1865         (class Dwarf_abbrev_table): New class.
1866         (class Dwarf_range_list): New class.
1867         (class Dwarf_ranges_table): New class.
1868         (class Dwarf_pubnames_table): New class.
1869         (class Dwarf_die): New class.
1870         (class Dwarf_info_reader): New class.
1871         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1872         (Sized_dwarf_line_info::symbol_section): Remove member function.
1873         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1874         base class.
1875         * gdb-index.cc: New source file.
1876         * gdb-index.h: New source file.
1877         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1878         and .debug_types sections, call Layout::add_to_gdb_index.
1879         (Sized_relobj_incr::do_section_name): Implement.
1880         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1881         return type; Implement.
1882         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1883         return type.
1884         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1885         parameter list and return type.
1886         (Sized_incr_dynobj::do_section_contents): Likewise.
1887         * layout.cc: Include gdb-index.h.
1888         (Layout::Layout): Initialize gdb_index_data_.
1889         (Layout::init_fixed_output_section): Check for .gdb_index section.
1890         (Layout::add_to_gdb_index): New function. Instantiate.
1891         * layout.h: Add forward declaration for class Gdb_index.
1892         (Layout::add_to_gdb_index): New member function.
1893         (Layout::gdb_index_data_): New data member.
1894         * main.cc: Include gdb-index.h.
1895         (main): Print statistics for gdb index.
1896         * object.cc (Object::section_contents): Move code into
1897         do_section_contents.
1898         (need_decompressed_section): Check for sections needed when building
1899         gdb index.
1900         (build_compressed_section_map): Likewise.
1901         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1902         gdb index.
1903         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1904         sections; call Layout::add_to_gdb_index.
1905         (Sized_relobj_file::do_decompressed_section_contents): Call
1906         do_section_contents directly.
1907         * object.h (Object::do_section_contents): Adjust parameter list and
1908         return type.
1909         (Object::do_decompressed_section_contents): Call do_section_contents
1910         directly.
1911         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1912         return type.
1913         * options.h (class General_options): Add --gdb-index option.
1914         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1915         list and return type.
1916         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1917         * reloc.h (Track_relocs::checkpoint): New function.
1918         (Track_relocs::reset): New function.
1919
1920         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1921         New test cases.
1922         * testsuite/Makefile.in: Regenerate.
1923         * testsuite/gdb_index_test.cc: New test source file.
1924         * testsuite/gdb_index_test_1.sh: New test source file.
1925         * testsuite/gdb_index_test_2.sh: New test source file.
1926
1927 2012-03-19  Doug Kwan  <dougkwan@google.com>
1928
1929         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1930         (Target_arm::do_finalize_sections): Remove code which defines
1931         __exidx_start and __exidx_end.  Make symbol table parameter
1932         anonymous as it is not used.
1933         * gold.cc (queue_middle_tasks): Call target hook to define any
1934         target-specific symbols.
1935         * target.h (Target::define_standard_symbols): New method.
1936         (Target::do_define_standard_symbols): Same.
1937         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1938         * testsuite/Makefile.in: Regenerate.
1939         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1940         and __exidx_end.
1941         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1942         relocations are generated for __exidx_start and __exidx_end.
1943
1944 2012-03-16  Doug Kwan  <dougkwan@google.com>
1945
1946         * testsuite/Makefile.am: Disable test initpri3b.
1947         * testsuite/Makefile.in: Regenerate.
1948
1949 2012-03-15  Doug Kwan  <dougkwan@google.com>
1950
1951         * arm.cc (Target_arm::got_section): Make .got section read-only
1952         if -z now is given.
1953
1954 2012-03-15  Ian Lance Taylor  <iant@google.com>
1955
1956         PR gold/13850
1957         * layout.cc (Layout::make_output_section): Correctly mark
1958         SHT_INIT_ARRAY, et. al., as relro.
1959
1960 2012-03-14  Doug Kwan  <dougkwan@google.com>
1961
1962         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1963         dynamic relocations for protected symbols in shared objects.
1964
1965 2012-03-13  Ian Lance Taylor  <iant@google.com>
1966
1967         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1968         keep the larger alignment.
1969
1970 2012-03-12  Cary Coutant  <ccoutant@google.com>
1971
1972         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1973         handling of DW_LNE_define_file.
1974
1975 2012-03-12  Cary Coutant  <ccoutant@google.com>
1976
1977         * reduced_debug_output.cc
1978         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1979         codes to switch.
1980
1981 2012-02-29  Cary Coutant  <ccoutant@google.com>
1982
1983         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1984
1985 2012-02-29  Cary Coutant  <ccoutant@google.com>
1986
1987         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1988         Call Object::decompressed_section_contents.
1989         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1990         New dtor.
1991         (Sized_dwarf_line_info::buffer_start_): New data member.
1992         * merge.cc (Output_merge_data::do_add_input_section): Call
1993         Object::decompressed_section_contents.
1994         (Output_merge_string::do_add_input_section): Likewise.
1995         * object.cc (need_decompressed_section): New function.
1996         (build_compressed_section_map): Decompress sections needed later.
1997         (Sized_relobj_file::do_decompressed_section_contents): New function.
1998         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1999         * object.h (Object::decompressed_section_contents): New function.
2000         (Object::discard_decompressed_sections): New function.
2001         (Object::do_decompressed_section_contents): New function.
2002         (Object::do_discard_decompressed_sections): New function.
2003         (Compressed_section_info): New type.
2004         (Compressed_section_map): Include decompressed section contents.
2005         (Sized_relobj_file::do_decompressed_section_contents): New function.
2006         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2007
2008 2012-02-16  Cary Coutant  <ccoutant@google.com>
2009
2010         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2011         * testsuite/Makefile.in: Regenerate.
2012
2013 2012-02-14  Cary Coutant  <ccoutant@google.com>
2014
2015         * options.cc (General_options::finalize): Disallow -pie and -static.
2016
2017 2012-02-03  Doug Kwan  <dougkwan@google.com>
2018
2019         * arm.cc (Arm_relocate_functions::abs8,
2020         Arm_relocate_functions::abs16): Use
2021         Bits::has_signed_unsigned_overflow32.
2022         (Arm_relocate_functions::thm_abs8): Correct range of
2023         overflow check.
2024         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2025         in assertions.
2026
2027 2012-02-02  Doug Kwan  <dougkwan@google.com>
2028
2029         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2030         position independent outputs, not just shared objects.
2031
2032 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2033
2034         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2035         * configure: Regenerated.
2036
2037 2012-01-27  Ian Lance Taylor  <iant@google.com>
2038
2039         * reloc.h (Bits): New class with static functions, copied from
2040         namespace utils in arm.cc.
2041         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2042         instead.
2043
2044 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2045
2046         * incremental.cc (write_info_blocks): Correct relocation offset.
2047
2048 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2049
2050         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2051         (Relocate::tls_gd_to_le): Likewise.
2052
2053 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2054
2055         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2056
2057 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2058
2059         * configure.ac: Check if -mcmodel=medium works.
2060         * configure: Regenerated.
2061
2062 2012-01-24  Cary Coutant  <ccoutant@google.com>
2063
2064         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2065         definition and ...
2066         (read_unsigned_LEB_128_x): ... this new function.
2067         (read_signed_LEB_128): Replaced with inline definition and ...
2068         (read_signed_LEB_128_x): ... this new function.
2069         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2070         (read_unsigned_LEB_128): Add inline definition.
2071         (read_signed_LEB_128_x): New function.
2072         (read_signed_LEB_128): Add inline definition.
2073         * testsuite/Makefile.am (leb128_unittest): New unit test.
2074         * testsuite/Makefile.in: Regenerate.
2075         * testsuite/leb128_unittest.cc: New unit test.
2076
2077 2012-01-23  Ian Lance Taylor  <iant@google.com>
2078
2079         PR gold/13617
2080         * i386.cc (Target_i386::do_code_fill): When using a jmp
2081         instruction, pad with nop instructions.
2082         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2083
2084 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2085
2086         * x86_64.cc (gc_process_relocs): Add typename on types used in
2087         template.
2088         (scan_relocs): Likewise.
2089         (relocate_section): Likewise.
2090         (apply_relocation): Likewise.
2091
2092 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2093
2094         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2095         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2096         under x32.
2097
2098 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2099
2100         * x86_64.cc: Initial support for x32.
2101
2102 2012-01-03  Cary Coutant  <ccoutant@google.com>
2103
2104         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2105         Use abstract base class for GOT.
2106         * gold/output.h (class Output_data_got_base): New abstract base class.
2107         (class Output_data_got): Derive from new base class, adjust ctors.
2108         (Output_data_got::reserve_slot): Make virtual; rename to
2109         do_reserve_slot; Adjust callers.
2110         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2111         pointer to abstract base class.
2112         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2113
2114 2011-12-18  Ian Lance Taylor  <iant@google.com>
2115
2116         * object.h (Relobj::local_symbol_value): New function.
2117         (Relobj::local_plt_offset): New function.
2118         (Relobj::local_has_got_offset): New function.
2119         (Relobj::local_got_offset): New function.
2120         (Relobj::set_local_got_offset): New function.
2121         (Relobj::do_local_symbol_value): New pure virtual function.
2122         (Relobj::do_local_plt_offset): Likewise.
2123         (Relobj::do_local_has_got_offset): Likewise.
2124         (Relobj::do_local_got_offset): Likewise.
2125         (Relobj::do_set_local_got_offset): Likewise.
2126         (Sized_relobj::do_local_has_got_offset): Rename from
2127         local_has_got_offset.
2128         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2129         (Sized_relobj::do_set_local_got_offset): Rename from
2130         set_local_got_offset.
2131         (Sized_relobj_file::do_local_plt_offset): Rename from
2132         local_plt_offset.
2133         (Sized_relobj_file::do_local_symbol_value): New function.
2134         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2135         local_plt_offset.
2136         * output.cc (Output_data_got::Got_entry::write): Change object to
2137         Relobj.  Use local_symbol_value.
2138         (Output_data_got::add_global_with_rel): Change rel_dyn to
2139         Output_data_reloc_generic*.  Use add_global_generic.
2140         (Output_data_got::add_global_with_rela): Remove.  Change all
2141         callers to use add_global_with_rel.
2142         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2143         Output_data_reloc_generic*.  Use add_global_generic.
2144         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2145         callers to use add_global_pair_with_rel.
2146         (Output_data_got::add_local): Change object to Relobj*.
2147         (Output_data_got::add_local_plt): Likewise.
2148         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2149         change rel_dyn to Output_data_reloc_generic*.  Use
2150         add_local_generic.
2151         (Output_data_got::add_local_with_rela): Remove.  Change all
2152         callers to use all_local_with_rel.
2153         (Output_data_got::add_local_pair_with_rel): Change object to
2154         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2155         add_output_section_generic.
2156         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2157         callers to use add_local_pair_with_rel.
2158         (Output_data_got::reserve_local): Change object to Relobj*.
2159         * output.h: (class Output_data_reloc_generic): Add pure virtual
2160         declarations for add_global_generic, add_local_generic,
2161         add_output_section_generic.
2162         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2163         functions for Output_data_reloc_generic.  Update declarations for
2164         changes listed in output.cc.
2165         (class Output_data_got): Change template parameter to got_size.
2166         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2167         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2168         function.
2169         (Sized_relobj_incr::do_local_plt_offset): New function.
2170         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2171         add_global_generic.
2172
2173 2011-12-17  Cary Coutant  <ccoutant@google.com>
2174
2175         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2176         * resolve.cc (Symbol_table::resolve): Likewise.
2177         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2178         arrays.
2179         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2180
2181 2011-12-16  Ian Lance Taylor  <iant@google.com>
2182
2183         * output.h (Output_data_reloc_generic::add): Only call
2184         add_dynamic_reloc if this is a dynamic reloc section.
2185
2186 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2187
2188         PR gold/13505
2189         * target-reloc.h (apply_relocation): Replace <64, false> with
2190         <size, big_endian>.
2191
2192 2011-11-25  Nick Clifton  <nickc@redhat.com>
2193
2194         * po/it.po: New Italian translation.
2195
2196 2011-11-17  Sterling Augustine  <saugustine@google.com>
2197
2198         * script.cc (script_include_directive): Implement.
2199         (read_script_file): New local variables name and search_path. Update
2200         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2201         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2202         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2203
2204 2011-11-11  Sterling Augustine  <saugustine@google.com>
2205
2206         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2207         (file_or_sections_cmd): Likewise.
2208
2209 2011-11-11  Doug Kwan  <dougkwan@google.com>
2210
2211         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2212         if --just-symbols is given.
2213
2214 2011-11-10  Doug Kwan  <dougkwan@google.com>
2215
2216         PR gold/13362
2217         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2218         when processing data relocs.
2219         * reloc.h (Relocate_functions::rel_unaligned): New method.
2220         (Relocate_functions::pcrel_unaligned): Ditto.
2221         (Relocate_functions::rel32_unaligned): Ditto.
2222         (Relocate_functions::pcrel32_unaligned): Ditto.
2223
2224 2011-11-09  Doug Kwan  <dougkwan@google.com>
2225
2226         PR gold/13362
2227         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2228         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2229         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2230         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2231         (Relocate_functions::rel_unaligned): New.
2232         (Relocate_functions::rel32_unaligned): New.
2233         * target-reloc.h (relocate_for_relocatable): Add code to handle
2234         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2235         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2236         arm_unaligned_reloc_r): New targets.
2237         * testsuite/Makefile.in: Regenerate.
2238         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2239         linking.
2240
2241 2011-11-02  Ian Lance Taylor  <iant@google.com>
2242
2243         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2244         NATIVE_LINKER.
2245         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2246         * options.cc (General_options::finalize): Use library search path
2247         from configure script if specified.  If not native and no sysroot,
2248         only search TOOLLIBDIR.
2249         * options.h (Search_directory::Search_directory): Change name to
2250         const std::string&.
2251         (General_options::add_to_library_path_with_sysroot): Change arg to
2252         const std::string&.
2253         * configure, Makefile.in, config.in: Rebuild.
2254
2255 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2256
2257         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2258         we are working around the ARM1176 Erratum.
2259         * options.h (General_options::fix_arm1176): Add option.
2260         * testsuite/Makefile.am: Add testcases, and keep current ones
2261         working.
2262         * testsuite/Makefile.in: Regenerate.
2263         * testsuite/arm_fix_1176.s: New file.
2264         * testsuite/arm_fix_1176.sh: Likewise.
2265
2266 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2267
2268         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2269         may_use_blx_.
2270         (Target_arm::may_use_blx): Remove method.
2271         (Target_arm::set_may_use_blx): Likewise.
2272         (Target_arm::may_use_v4t_interworking): New method.
2273         (Target_arm::may_use_v5t_interworking): Likewise.
2274         (Target_arm::may_use_blx_): Remove member variable.
2275         (Arm_relocate_functions::arm_branch_common): Check for v5T
2276         interworking.
2277         (Arm_relocate_functions::thumb_branch_common): Likewise.
2278         (Reloc_stub::stub_type_for_reloc): Likewise.
2279         (Target_arm::do_finalize_sections): Correct interworking checks.
2280         * testsuite/Makefile.am: Add new tests.
2281         * testsuite/Makefile.in: Regenerate.
2282         * testsuite/arm_farcall_arm_arm.s: New test.
2283         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2284         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2285         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2286         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2287         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2288         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2289         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2290
2291 2011-10-31  Cary Coutant  <ccoutant@google.com>
2292
2293         PR gold/13023
2294         * expression.cc (Expression::eval_with_dot): Add
2295         is_section_dot_assignment parameter.
2296         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2297         absolute and assigning to dot within a section.
2298         * script-sections.cc
2299         (Output_section_element_assignment::set_section_addresses): Pass
2300         dot_section to set_if_absolute.
2301         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2302         as is_section_dot_assignment flag to eval_with_dot.
2303         (Output_section_element_dot_assignment::set_section_addresses):
2304         Likewise.
2305         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2306         parameter.  Also set value if relative to dot_section; set the
2307         symbol's output_section.
2308         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2309         parameter.  Adjust all callers.
2310         (Expression::eval_maybe_dot): Likewise.
2311         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2312         Adjust all callers.
2313         * testsuite/script_test_2.t: Test assignment of an absolute value
2314         to dot within an output section element.
2315
2316 2011-10-31  Cary Coutant  <ccoutant@google.com>
2317
2318         * options.h (class General_options): Add --[no-]gnu-unique options.
2319         * symtab.cc (Symbol_table::sized_write_globals): Convert
2320         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2321
2322 2011-10-31  Cary Coutant  <ccoutant@google.com>
2323
2324         PR gold/13359
2325         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2326         unnecessary assertion.
2327         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2328
2329 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2330
2331         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2332         gc_mark_symbol.
2333         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2334         gc_mark_symbol.
2335         Change to just keep the section associated with symbol.
2336         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2337         they are externally visible and --export-dynamic is turned on.
2338         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2339
2340 2011-10-19  Ian Lance Taylor  <iant@google.com>
2341
2342         PR gold/13163
2343         * script-sections.cc
2344         (Output_section_element_dot_assignment::needs_output_section): New
2345         function.
2346
2347 2011-10-19  Ian Lance Taylor  <iant@google.com>
2348
2349         PR gold/13204
2350         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2351         --section-start option was seen.
2352         * options.h (General_options::any_section_start): New function.
2353
2354 2011-10-18  David S. Miller  <davem@davemloft.net>
2355
2356         PR binutils/13301
2357         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2358         member to track relocation locations that have moved during TLS
2359         reloc optimizations.
2360         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2361         (Target_sparc::Relocate::relocate): Adjust view down by 4
2362         bytes if it matches reloc_adjust_addr_.
2363         (Target_sparc::Relocate::relocate_tls): Always move the
2364         __tls_get_addr call delay slot instruction forward 4 bytes when
2365         performing relaxation.
2366
2367 2011-10-18  Cary Coutant  <ccoutant@google.com>
2368
2369         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2370         (Output_file::map_no_anonymous): Check for non-zero
2371         return code from posix_fallocate.
2372
2373 2011-10-17  Cary Coutant  <ccoutant@google.com>
2374
2375         PR gold/13245
2376         * plugin.cc (is_visible_from_outside): Check for symbols
2377         referenced from dynamic objects.
2378         * resolve.cc (Symbol_table::resolve): Don't count references
2379         from dynamic objects as references from real ELF files.
2380         * testsuite/plugin_test_2.sh: Adjust expected result.
2381
2382 2011-10-17  Cary Coutant  <ccoutant@google.com>
2383
2384         * gold.cc: Include timer.h.
2385         (queue_middle_tasks): Stamp time.
2386         (queue_final_tasks): Likewise.
2387         * main.cc (main): Store timer in parameters.  Print timers
2388         for each pass.
2389         * parameters.cc (Parameters::Parameters): Initialize timer_.
2390         (Parameters::set_timer): New function.
2391         (set_parameters_timer): New function.
2392         * parameters.h (Parameters::set_timer): New function.
2393         (Parameters::timer): New function.
2394         (Parameters::timer_): New data member.
2395         (set_parameters_timer): New function.
2396         * timer.cc (Timer::stamp): New function.
2397         (Timer::get_pass_time): New function.
2398         * timer.h (Timer::stamp): New function.
2399         (Timer::get_pass_time): New function.
2400         (Timer::pass_times_): New data member.
2401
2402 2011-10-17  Cary Coutant  <ccoutant@google.com>
2403
2404         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2405         task for members of lib groups.
2406
2407 2011-10-17  Cary Coutant  <ccoutant@google.com>
2408
2409         PR gold/13288
2410         * fileread.cc (File_read::find_view): Add assert.
2411         (File_read::make_view): Move bounds check (replace with assert)...
2412         (File_read::find_or_make_view): ... to here.
2413
2414 2011-10-12  Cary Coutant  <ccoutant@google.com>
2415
2416         * output.cc (Output_file::open_base_file): Handle case where
2417         ::read returns less than requested size.
2418
2419 2011-10-10  Cary Coutant  <ccoutant@google.com>
2420
2421         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2422         Initialize defined_count_.
2423         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2424         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2425         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2426         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2427         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2428         * incremental.h (Sized_relobj_incr::defined_count_): New data
2429         member.
2430         (Sized_incr_dynobj::defined_count_): New data member.
2431         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2432         Return zeroes instead of internal error.
2433
2434 2011-10-10  Cary Coutant  <ccoutant@google.com>
2435
2436         PR gold/13249
2437         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2438         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2439         * output.h (class Output_reloc): Add use_plt_offset flag.
2440         (Output_reloc::type_): Adjust size of bit field.
2441         (Output_reloc::use_plt_offset_): New bit field.
2442         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2443         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2444         flag.  Adjust all callers.
2445         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2446         creating RELATIVE relocations.
2447
2448 2011-10-10  Nick Clifton  <nickc@redhat.com>
2449
2450         * po/es.po: Updated Spanish translation.
2451         * po/fi.po: Updated Finnish translation.
2452
2453 2011-10-03   Diego Novillo  <dnovillo@google.com>
2454
2455         * options.cc (parse_uint): Fix dereference of RETVAL.
2456
2457 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2458
2459         * layout.h (section_order_map_): New member.
2460         (get_section_order_map): New member function.
2461         * output.cc (Output_section::add_input_section): Check for patterns
2462         only when --section-ordering-file is specified.
2463         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2464         output_sections have been formed.
2465         * layout.cc (Layout_Layout): Initialize section_order_map_.
2466         * plugin.cc (update_section_order): Store order in order_map. Do not
2467         update the order.
2468         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2469         * testsuite/Makefile.in: Regenerate.
2470         * testsuite/plugin_section_order.c: New file.
2471         * testsuite/plugin_final_layout.cc: New file.
2472         * testsuite/plugin_final_layout.sh: New file.
2473
2474 2011-09-29  Cary Coutant  <ccoutant@google.com>
2475
2476         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2477         Check for NULL.
2478         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2479         symbols during incremental update.
2480         (Symbol_table::add_from_dynobj): Likewise.
2481
2482 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2483             Ian Lance Taylor  <iant@google.com>
2484
2485         * symtab.cc (Symbol_table::define_special_symbol): Always
2486         canonicalize version string.
2487
2488 2011-09-26  Cary Coutant  <ccoutant@google.com>
2489
2490         * gold.cc (queue_initial_tasks): Move option checks ...
2491         * options.cc (General_options::finalize): ... to here. Disable
2492         some options; make others fatal.
2493
2494 2011-09-26  Cary Coutant  <ccoutant@google.com>
2495
2496         gcc PR lto/47247
2497         * plugin.cc (get_symbols_v2): New function.
2498         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2499         (is_referenced_from_outside): New function.
2500         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2501         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2502         (get_symbols): Pass version parameter.
2503         (get_symbols_v2): New function.
2504         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2505         parameter.
2506         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2507         (onload): Add LDPT_GET_SYMBOLS_V2.
2508         (all_symbols_read_hook): Use get_symbols_v2; check for
2509         LDPR_PREVAILING_DEF_IRONLY_EXP.
2510         * testsuite/plugin_test_3.sh: Update expected results.
2511
2512 2011-09-23  Simon Baldwin  <simonb@google.com>
2513
2514         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2515         configuration options.
2516         * configure: Regenerate.
2517         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2518         * Makefile.in: Regenerate.
2519         * testsuite/Makefile.in: Regenerate.
2520
2521 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2522
2523         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2524
2525 2011-09-19  Cary Coutant  <ccoutant@google.com>
2526
2527         * incremental.cc (can_incremental_update): Fix typo in comment.
2528         * incremental.h (can_incremental_update): Likewise.
2529
2530 2011-09-18  Cary Coutant  <ccoutant@google.com>
2531
2532         * incremental.cc (can_incremental_update): New function.
2533         * incremental.h (can_incremental_update): New function.
2534         * layout.cc (Layout::init_fixed_output_section): Call it.
2535         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2536         * object.cc (Sized_relobj_file::do_layout): Call
2537         can_incremental_update.
2538
2539 2011-09-13  Cary Coutant  <ccoutant@google.com>
2540
2541         * configure.ac: Check for glibc support for gnu_indirect_function
2542         support with static linking, setting automake conditional
2543         IFUNC_STATIC.
2544         * Makefile.in: Regenerate.
2545         * configure: Regenerate.
2546
2547         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2548         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2549         for IFUNC_STATIC.
2550         * testsuite/Makefile.in: Regenerate.
2551
2552 2011-09-13  Cary Coutant  <ccoutant@google.com>
2553
2554         * incremental.cc (Sized_relobj_incr::do_layout): Call
2555         report_comdat_group for kept comdat sections.
2556         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2557         * testsuite/Makefile.in: Regenerate.
2558         * testsuite/incr_comdat_test_1.cc: New source file.
2559         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2560         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2561         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2562
2563 2011-09-13  Ian Lance Taylor  <iant@google.com>
2564
2565         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2566         variable external_symbols_offset.
2567
2568 2011-09-12  Ian Lance Taylor  <iant@google.com>
2569
2570         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2571         triggered if object has no symbols.
2572
2573 2011-09-09  David S. Miller  <davem@davemloft.net>
2574
2575         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2576         (Output_fill_debug_line::do_write): Likewise.
2577
2578 2011-08-29  Cary Coutant  <ccoutant@google.com>
2579
2580         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2581         casts to match formatting specs.
2582         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2583
2584 2011-08-26  Cary Coutant  <ccoutant@google.com>
2585
2586         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2587         remaining hole size when allocating.
2588         (Layout::make_output_section): Set fill methods for debug sections.
2589         * layout.h (Free_list::Free_list_node): Move from private to
2590         public.
2591         (Free_list::set_min_hole_size): New function.
2592         (Free_list::begin, Free_list::end): New functions.
2593         (Free_list::min_hole_): New data member.
2594         * output.cc: Include dwarf.h.
2595         (Output_fill_debug_info::do_minimum_hole_size): New function.
2596         (Output_fill_debug_info::do_write): New function.
2597         (Output_fill_debug_line::do_minimum_hole_size): New function.
2598         (Output_fill_debug_line::do_write): New function.
2599         (Output_section::Output_section): Initialize new data member.
2600         (Output_section::set_final_data_size): Ensure patch space is larger
2601         than minimum hole size.
2602         (Output_section::do_write): Fill holes in debug sections.
2603         * output.h (Output_fill): New class.
2604         (Output_fill_debug_info): New class.
2605         (Output_fill_debug_line): New class.
2606         (Output_section::set_free_space_fill): New function.
2607         (Output_section::free_space_fill_): New data member.
2608         * testsuite/Makefile.am (incremental_test_3): Add
2609         --incremental-patch option.
2610         (incremental_test_4): Likewise.
2611         (incremental_test_5): Likewise.
2612         (incremental_test_6): Likewise.
2613         (incremental_copy_test): Likewise.
2614         (incremental_common_test_1): Likewise.
2615         * testsuite/Makefile.in: Regenerate.
2616
2617 2011-08-26  Nick Clifton  <nickc@redhat.com>
2618
2619         * po/es.po: Updated Spanish translation.
2620
2621 2011-08-01  Cary Coutant  <ccoutant@google.com>
2622
2623         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2624         * gold/testsuite/Makefile.in: Regenerate.
2625         * gold/testsuite/justsyms_exec.c: New source file.
2626         * gold/testsuite/justsyms_lib.c: New source file.
2627
2628 2011-08-01  Cary Coutant  <ccoutant@google.com>
2629
2630         * layout.cc (Layout::set_segment_offsets): Don't realign text
2631         segment if -Ttext was specified.
2632         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2633         file type.
2634         * object.h (Sized_relobj_file::e_type): New function.
2635         (Sized_relobj_file::e_type_): New data member.
2636         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2637         base address for ET_EXEC files.
2638         * target.cc (Target::do_make_elf_object_implementation): Allow
2639         ET_EXEC files with --just-symbols option.
2640
2641 2011-07-28  Cary Coutant  <ccoutant@google.com>
2642
2643         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2644         Add thread_number parameter.
2645         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2646         * workqueue-threads.cc
2647         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2648         current thread if its thread number is greater than desired thread
2649         count.
2650         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2651         Add thread_number parameter.
2652         (Workqueue::should_cancel_thread): Likewise.
2653         (Workqueue::find_runnable_or_wait): Pass thread_number to
2654         should_cancel_thread.
2655         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2656         parameter.
2657
2658 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2659
2660         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2661         only after checking if it cannot be forced local.
2662         * symtab.h (is_externally_visible): Check if the symbol is not forced
2663         local.
2664
2665 2011-07-15  Ian Lance Taylor  <iant@google.com>
2666
2667         * options.h (class General_options): Add --print-output-format.
2668         Move -EL next to -EB, for  better --help output.
2669         * target-select.cc: Include <cstdio>, "options.h", and
2670         "parameters.h".
2671         (Target_selector::do_target_bfd_name): New function.
2672         (print_output_format): New function.
2673         * target-select.h (class Target_selector): Update declarations.
2674         (Target_selector::target_bfd_name): New function.
2675         (print_output_format): Declare.
2676         * main.cc: Include "target-select.h".
2677         (main): Handle --print-output-format.
2678         * gold.cc: Include "target-select.h".
2679         (queue_initial_tasks): Handle --print-output-format when there are
2680         no input files.
2681         * parameters.cc (parameters_force_valid_target): Give a better
2682         error message if -EB/-EL does not match target.
2683         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2684         function.
2685
2686 2011-07-15  Ian Lance Taylor  <iant@google.com>
2687
2688         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2689         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2690         (Output_data_plt_i386::do_write): Write address of .dynamic
2691         section to first entry in .got.plt section.
2692         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2693         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2694         Initialize layout_.
2695         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2696         section to first entry in .got.plt section.
2697         * layout.h (Layout::dynamic_section): New function.
2698
2699 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2700
2701         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2702         to claim_file call.
2703         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2704         input_section_position_, and input_section_glob_.
2705         (read_layout_from_file): Call function section_ordering_specified.
2706         * layout.h (is_section_ordering_specified): New function.
2707         (section_ordering_specified): New function.
2708         (section_ordering_specified_): New boolean member.
2709         * main.cc(main): Call load_plugins after layout object is defined.
2710         * output.cc (Output_section::add_input_section): Use
2711         function section_ordering_specified to check if section ordering is
2712         needed.
2713         * output.cc (Output_section::add_relaxed_input_section): Use
2714         function section_ordering_specified to check if section ordering is
2715         needed.
2716         (Output_section::update_section_layout): New function.
2717         (Output_section::sort_attached_input_sections): Check if input section
2718         must be reordered.
2719         * output.h (Output_section::update_section_layout): New function.
2720         * plugin.cc (get_section_count): New function.
2721         (get_section_type): New function.
2722         (get_section_name): New function.
2723         (get_section_contents): New function.
2724         (update_section_order): New function.
2725         (allow_section_ordering): New function.
2726         (Plugin::load): Add the new interfaces to the transfer vector.
2727         (Plugin_manager::load_plugins): New parameter.
2728         (Plugin_manager::all_symbols_read): New parameter.
2729         (Plugin_manager::claim_file): New parameter. Save the elf object for
2730         unclaimed objects.
2731         (Plugin_manager::get_elf_object): New function.
2732         (Plugin_manager::get_view): Change to directly use the bool to check
2733         if get_view is called from claim_file_hook.
2734         * plugin.h (input_objects): New function
2735         (Plugin__manager::load_plugins): New parameter.
2736         (Plugin_manager::claim_file): New parameter.
2737         (Plugin_manager::get_elf_object): New function.
2738         (Plugin_manager::in_claim_file_handler): New function.
2739         (Plugin_manager::in_claim_file_handler_): New member.
2740         (layout): New function.
2741         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2742         handler with an extra parameter. Make the elf object before calling
2743         claim_file handler.
2744         * testsuite/plugin_test.c (get_section_count): New function pointer.
2745         (get_section_type): New function pointer.
2746         (get_section_name): New function pointer.
2747         (get_section_contents): New function pointer.
2748         (update_section_order): New function pointer.
2749         (allow_section_ordering): New function pointer.
2750         (onload): Check if the new interfaces exist.
2751
2752 2011-07-13  Ian Lance Taylor  <iant@google.com>
2753
2754         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2755         relro section.
2756         * x86_64.cc (Target_x86_64::got_section): Likewise.
2757         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2758         (relro_now_test_SOURCES): New variable.
2759         (relro_now_test_DEPENDENCIES): New variable.
2760         (relro_now_test_LDFLAGS): New variable.
2761         (relro_now_test_LDADD): New variable.
2762         (relro_now_test.so): New target.
2763         * testsuite/Makefile.in: Rebuild.
2764
2765 2011-07-12  Ian Lance Taylor  <iant@google.com>
2766
2767         PR gold/12980
2768         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2769         GLOB_DAT relocation rather than a RELATIVE relocation for a
2770         protected symbol when creating a shared library.
2771         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2772         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2773         * testsuite/protected_main_1.cc (main): Test that protected
2774         function has same address.
2775
2776 2011-07-11  Ian Lance Taylor  <iant@google.com>
2777
2778         PR gold/12979
2779         * options.h (class General_options): Add -Bgroup.
2780         * options.cc (General_options::finalize): If -Bgroup is set,
2781         default to --unresolved-symbols=report-all.
2782         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2783         * target-reloc.h (issue_undefined_symbol_error): Handle
2784         --unresolved-symbols=report-all.
2785
2786 2011-07-08  Ian Lance Taylor  <iant@google.com>
2787
2788         PR gold/11985
2789         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2790         if linker script discards key sections.
2791         (Layout::create_dynamic_symtab): Likewise.
2792         (Layout::assign_local_dynsym_offsets): Likewise.
2793         (Layout::sized_create_version_sections): Likewise.
2794         (Layout::create_interp): Likewise.
2795         (Layout::finish_dynamic_section): Likewise.
2796         (Layout::set_dynamic_symbol_size): Likewise.
2797
2798 2011-07-08  Ian Lance Taylor  <iant@google.com>
2799
2800         PR gold/12386
2801         * options.h (class General_options): Add --unresolved-symbols.
2802         * target-reloc.h (issue_undefined_symbol_error): Check
2803         --unresolved-symbols.  Add comments.
2804
2805 2011-07-08  Ian Lance Taylor  <iant@google.com>
2806
2807         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2808         expression more complex.
2809
2810 2011-07-08  Ian Lance Taylor  <iant@google.com>
2811
2812         PR gold/11317
2813         * target-reloc.h (issue_undefined_symbol_error): New inline
2814         function, broken out of relocate_section.
2815         (relocate_section): Call issue_undefined_symbol_error.
2816         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2817         there is no TLS segment if we are about to issue an undefined
2818         symbol error.
2819         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2820
2821 2011-07-08  Ian Lance Taylor  <iant@google.com>
2822
2823         PR gold/12279
2824         * resolve.cc (Symbol_table::should_override): Add fromtype
2825         parameter.  Change all callers.  Give error when linking together
2826         TLS and non-TLS symbol.
2827         (Symbol_table::should_override_with_special): Add fromtype
2828         parameter.  Change all callers.
2829         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2830         there is no TLS segment if we have reported some errors.
2831         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2832
2833 2011-07-08  Ian Lance Taylor  <iant@google.com>
2834
2835         PR gold/12372
2836         * target.h (Target::plt_address_for_global): New function.
2837         (Target::plt_address_for_local): New function.
2838         (Target::plt_section_for_global): Remove.
2839         (Target::plt_section_for_local): Remove.
2840         (Target::do_plt_address_for_global): New virtual function.
2841         (Target::do_plt_address_for_local): New virtual function.
2842         (Target::do_plt_section_for_global): Remove.
2843         (Target::do_plt_section_for_local): Remove.
2844         (Target::register_global_plt_entry): Add Symbol_table and Layout
2845         parameters.
2846         * output.cc (Output_data_got::Got_entry::write): Use
2847         plt_address_for_global and plt_address_for_local.
2848         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2849         address of output section.
2850         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2851         got_irelative_, and irelative_count_ fields.  Update
2852         declarations.
2853         (Output_data_plt_i386::has_irelative_section): New function.
2854         (Output_data_plt_i386::entry_count): Add irelative_count_.
2855         (Output_data_plt_i386::set_final_data_size): Likewise.
2856         (class Target_i386): Add got_irelative_ and rel_irelative_
2857         fields.  Update declarations.
2858         (Target_i386::Target_i386): Initialize new fields.
2859         (Target_i386::do_plt_address_for_global): New function replacing
2860         do_plt_section_for_global.
2861         (Target_i386::do_plt_address_for_local): New function replacing
2862         do_plt_section_for_local.
2863         (Target_i386::got_section): Create got_irelative_.
2864         (Target_i386::rel_irelative_section): New function.
2865         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2866         fields.  Don't define __rel_iplt_{start,end}.
2867         (Output_data_plt_i386::add_entry): Add symtab and layout
2868         parameters.  Change all callers.  Use different PLT and GOT for
2869         IFUNC symbols.
2870         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2871         layout parameters.  Change all callers.  Use different PLT and
2872         GOT.
2873         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2874         (Output_data_plt_i386::rel_irelative): New function.
2875         (Output_data_plt_i386::address_for_global): New function.
2876         (Output_data_plt_i386::address_for_local): New function.
2877         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2878         IRELATIVE GOT when changing IFUNC GOT entries.
2879         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2880         reloc.
2881         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2882         if we didn't create an IRELATIVE GOT.
2883         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2884         plt_address_for_local.
2885         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2886         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2887         got_irelative_, and irelative_count_ fields.  Update
2888         declarations.
2889         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2890         Initialize new fields.  Remove symtab parameter.  Change all
2891         callers.
2892         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2893         irelative_count_.
2894         (Output_data_plt_x86_64::has_irelative_section): New function.
2895         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2896         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2897         fields.  Update declarations.
2898         (Target_x86_64::Target_x86_64): Initialize new fields.
2899         (Target_x86_64::do_plt_address_for_global): New function replacing
2900         do_plt_section_for_global.
2901         (Target_x86_64::do_plt_address_for_local): New function replacing
2902         do_plt_section_for_local.
2903         (Target_x86_64::got_section): Create got_irelative_.
2904         (Target_x86_64::rela_irelative_section): New function.
2905         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2906         all callers.  Don't create __rel_iplt_{start,end}.
2907         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2908         parameters.  Change all callers.  Use different PLT and GOT for
2909         IFUNC symbols.
2910         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2911         layout parameters.  Change all callers.  Use different PLT and
2912         GOT.
2913         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2914         parameters.  Change all callers.  Use different PLT and GOT for
2915         IFUNC symbols.
2916         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2917         (Output_data_plt_x86_64::rela_irelative): New function.
2918         (Output_data_plt_x86_64::address_for_global): New function.
2919         (Output_data_plt_x86_64::address_for_local): New function.
2920         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2921         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2922         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2923         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2924         parameters.
2925         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2926         reloc.
2927         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2928         symbols if we didn't create an IRELATIVE GOT.
2929         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2930         plt_address_for_local.
2931         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2932         * testsuite/ifuncvar1.c: New test file.
2933         * testsuite/ifuncvar2.c: New test file.
2934         * testsuite/ifuncvar3.c: New test file.
2935         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2936         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2937         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2938         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2939         * testsuite/Makefile.in: Rebuild.
2940
2941 2011-07-07  Cary Coutant  <ccoutant@google.com>
2942
2943         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2944         (two_file_test_1_ndebug.o): Likewise.
2945         (two_file_test_1b_ndebug.o): Likewise.
2946         (two_file_test_2_ndebug.o): Likewise.
2947         (two_file_test_main_ndebug.o): Likewise.
2948         (incremental_test_2): Link with no-debug versions.
2949
2950 2011-07-06  Cary Coutant  <ccoutant@google.com>
2951
2952         * gold/incremental.cc
2953         (Output_section_incremental_inputs::write_info_blocks): Check for
2954         hidden and internal symbols.
2955
2956 2011-07-06  Cary Coutant  <ccoutant@google.com>
2957
2958         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2959         Check disposition for startup file.
2960         (Incremental_inputs::report_command_line): Ignore
2961         --incremental-startup-unchanged option.
2962         * options.cc (General_options::parse_incremental_startup_unchanged):
2963         New function.
2964         (General_options::General_options): Initialize new data member.
2965         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2966         (General_options): Add --incremental-startup-unchanged option.
2967         (General_options::incremental_startup_disposition): New function.
2968         (General_options::incremental_startup_disposition_): New data member.
2969
2970 2011-07-06  Cary Coutant  <ccoutant@google.com>
2971
2972         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2973         input file index to Script_info ctor.
2974         (Sized_incremental_binary::do_file_has_changed): Find the
2975         command-line argument for files named in scripts.
2976         * incremental.h (Script_info::Script_info): New ctor
2977         with input file index.
2978         (Script_info::input_file_index): New function.
2979         (Script_info::input_file_index_): New data member.
2980         (Incremental_binary::get_library): Add const.
2981         (Incremental_binary::get_script_info): Add const.
2982         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2983         * testsuite/Makefile.am (incremental_test_5): New test case.
2984         (incremental_test_6): New test case.
2985         * testsuite/Makefile.in: Regenerate.
2986
2987 2011-07-06  Cary Coutant  <ccoutant@google.com>
2988
2989         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2990         debug output when command lines differ.
2991
2992 2011-07-06  Cary Coutant  <ccoutant@google.com>
2993
2994         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2995         --incremental-patch option.
2996         * layout.cc (Free_list::allocate): Extend allocation beyond original
2997         end if enabled.
2998         (Layout::make_output_section): Mark sections that should get
2999         patch space.
3000         * options.cc (parse_percent): New function.
3001         * options.h (parse_percent): New function.
3002         (DEFINE_percent): New macro.
3003         (General_options): Add --incremental-patch option.
3004         * output.cc (Output_section::Output_section): Initialize new data
3005         members.
3006         (Output_section::add_input_section): Print section name when out
3007         of patch space.
3008         (Output_section::add_output_section_data): Likewise.
3009         (Output_section::set_final_data_size): Add patch space when
3010         doing --incremental-full.
3011         (Output_section::do_reset_address_and_file_offset): Remove patch
3012         space.
3013         (Output_segment::set_section_list_addresses): Print debug output
3014         only if --incremental-update.
3015         * output.h (Output_section::set_is_patch_space_allowed): New function.
3016         (Output_section::is_patch_space_allowed_): New data member.
3017         (Output_section::patch_space_): New data member.
3018         * parameters.cc (Parameters::incremental_full): New function.
3019         * parameters.h (Parameters::incremental_full): New function
3020         * testsuite/Makefile.am (incremental_test_2): Add test for
3021         --incremental-patch option.
3022         * testsuite/Makefile.in: Regenerate.
3023         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3024         (t18): Remove function body.
3025
3026 2011-07-05  Doug Kwan  <dougkwan@google.com>
3027
3028         PR gold/12771
3029         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3030         Arm_Address type for relocation result.
3031         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3032         overflow check.
3033         (Arm_relocate_functions::abs32): Use unaligned access.
3034         (Arm_relocate_functions::rel32): Ditto.
3035         (Arm_relocate_functions::prel31): Ditto.
3036         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3037         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3038         static data relocations.
3039         * testsuite/Makefile.in: Regnerate.
3040         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3041
3042 2011-07-05  Ian Lance Taylor  <iant@google.com>
3043
3044         PR gold/12392
3045         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3046         symbols if necessary.
3047         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3048
3049 2011-07-05  Ian Lance Taylor  <iant@google.com>
3050
3051         PR gold/12952
3052         * resolve.cc (Symbol::override_base_with_special): Simply override
3053         version with special symbol version, ignoring previous version.
3054
3055 2011-07-05  Ian Lance Taylor  <iant@google.com>
3056
3057         * object.cc (Sized_relobj_file::include_section_group): Add
3058         information to comment about signature location.
3059
3060 2011-07-02  Ian Lance Taylor  <iant@google.com>
3061
3062         PR gold/12957
3063         * options.h (class General_options): Add -f and -F.
3064         * options.cc (General_options::finalize): Fatal error if -f/-F
3065         are used without -shared.
3066         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3067
3068 2011-07-02  Ian Lance Taylor  <iant@google.com>
3069
3070         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3071
3072 2011-07-01  Ian Lance Taylor  <iant@google.com>
3073
3074         PR gold/12525
3075         PR gold/12952
3076         * resolve.cc (Symbol::override_base_with_special): Don't override
3077         the version if the overriding symbol has a different name.
3078         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3079         all callers.  If we give an error about an undefined version,
3080         define the base version if necessary.
3081         * dynobj.h (class Versions): Update declaration.
3082         * testsuite/weak_alias_test_5.cc: New file.
3083         * testsuite/weak_alias_test.script: New file.
3084         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3085         and versioned_alias have the right value, and call t2.
3086         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3087         weak_alias_test_5.so.
3088         (weak_alias_test_LDADD): Likewise.
3089         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3090         * testsuite/Makefile.in: Rebuild.
3091
3092 2011-07-01  Ian Lance Taylor  <iant@google.com>
3093
3094         PR gold/12525
3095         * options.h (class General_options): Support -z notext.
3096         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3097         -Wl,-z,notext.
3098         (two_file_shared_nonpic.so): Likewise.
3099         (two_file_shared_mixed.so): Likewise.
3100         (two_file_shared_mixed_1.so): Likewise.
3101         (weak_undef_lib_nonpic.so): Likewise.
3102         (alt/weak_undef_lib_nonpic.so): Likewise.
3103         (tls_test_shared_nonpic.so): Likewise.
3104         * testsuite/Makefile.in: Rebuild.
3105
3106 2011-07-01  Ian Lance Taylor  <iant@google.com>
3107
3108         PR gold/12525
3109         * configure.ac: Test whether static linking works, setting
3110         the automake conditional HAVE_STATIC.
3111         * testsuite/Makefile.am: Disable tests using -static if
3112         HAVE_STATIC is not true.
3113         * configure, testsuite/Makefile.in: Rebuild.
3114
3115 2011-07-01  Ian Lance Taylor  <iant@google.com>
3116
3117         PR gold/12525
3118         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3119         Assert if we see DW_EH_PE_indirect.
3120         * target.h (Target::ehframe_datarel_base): New function.
3121         (Target::do_ehframe_datarel_base): New target function.
3122         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3123         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3124         function.
3125
3126 2011-07-01  Ian Lance Taylor  <iant@google.com>
3127
3128         PR gold/12571
3129         * options.h (class General_options): Add
3130         --ld-generated-unwind-info.
3131         * ehframe.cc (Fde::write): Add address parameter.  Change all
3132         callers.  If associated with PLT, fill in address and size.
3133         (Cie::set_output_offset): Only add merge mapping if there is an
3134         object.
3135         (Cie::write): Add address parameter.  Change all callers.
3136         (Eh_frame::add_ehframe_for_plt): New function.
3137         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3138         input_offset_ fields into union u_, with new plt field.
3139         (Fde::Fde): Adjust for new union field.
3140         (Fde::Fde) [Output_data version]: New constructor.
3141         (Fde::add_mapping): Only add merge mapping if there is an object.
3142         (class Cie): Update declarations.
3143         (class Eh_frame): Declare add_ehframe_for_plt.
3144         * layout.cc (Layout::layout_eh_frame): Break out code into
3145         make_eh_frame_section, and call it.
3146         (Layout::make_eh_frame_section): New function.
3147         (Layout::add_eh_frame_for_plt): New function.
3148         * layout.h (class Layout): Update declarations.
3149         * merge.cc (Merge_map::add_mapping): Add assertion.
3150         * i386.cc: Include "dwarf.h".
3151         (class Output_data_plt_i386): Make first_plt_entry,
3152         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3153         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3154         and plt_eh_frame_fde.
3155         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3156         boundary.  Call add_eh_frame_for_plt if appropriate.
3157         * x86_64.cc: Include "dwarf.h".
3158         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3159         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3160         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3161         and plt_eh_frame_fde.
3162         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3163         appropriate.
3164
3165 2011-06-29  Ian Lance Taylor  <iant@google.com>
3166
3167         PR gold/12629
3168         * object.cc (Sized_relobj_file::layout_section): Change shdr
3169         parameter to be const.
3170         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3171         out of do_layout.
3172         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3173         appropriate.  Call layout_eh_frame_section.
3174         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3175         sections.
3176         * object.h (class Sized_relobj_file): Update declarations.
3177
3178 2011-06-29  Ian Lance Taylor  <iant@google.com>
3179
3180         PR gold/12652
3181         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3182         modifier.
3183         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3184
3185 2011-06-29  Ian Lance Taylor  <iant@google.com>
3186
3187         PR gold/12675
3188         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3189         SHT_X86_64_UNWIND.
3190         * layout.cc (Layout::layout_eh_frame): Likewise.
3191
3192 2011-06-29  Ian Lance Taylor  <iant@google.com>
3193
3194         PR gold/12695
3195         * layout.cc (Layout::symtab_section_shndx): New function.
3196         * layout.h (class Layout): Declare symtab_section_shndx.
3197         * output.cc (Output_section::write_header): Call it.
3198
3199 2011-06-29  Ian Lance Taylor  <iant@google.com>
3200
3201         PR gold/12818
3202         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3203         symbols which are not used in a relocation.
3204
3205 2011-06-28  Ian Lance Taylor  <iant@google.com>
3206
3207         PR gold/12898
3208         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3209         script create indistinguishable segments.
3210         (Layout::set_segment_offsets): Use stable_sort when sorting
3211         segments.  Pass this to Compare_segments constructor.
3212         * layout.h (class Layout): Make segment_precedes non-static.
3213         (class Compare_segments): Change from struct to class.  Add
3214         layout_ field.  Add constructor.
3215         * script-sections.cc
3216         (Script_sections::attach_sections_using_phdrs_clause): Rename
3217         local orphan to is_orphan.  Don't report failure to put empty
3218         section in segment.  On attachment failure, report name of
3219         section, and attach to first PT_LOAD segment.
3220
3221 2011-06-28  Ian Lance Taylor  <iant@google.com>
3222
3223         PR gold/12934
3224         * target-select.cc (Target_selector::Target_selector): Add
3225         emulation parameter.  Change all callers.
3226         (select_target_by_bfd_name): Rename from select_target_by_name.
3227         Change all callers.
3228         (select_target_by_emulation): New function.
3229         (supported_emulation_names): New function.
3230         * target-select.h (class Target_selector): Add emulation_ field.
3231         Update declarations.
3232         (Target_selector::recognize_by_bfd_name): Rename from
3233         recognize_by_name.  Change all callers.
3234         (Target_selector::supported_bfd_names): Rename from
3235         supported_names.  Change all callers.
3236         (Target_selector::recognize_by_emulation): New function.
3237         (Target_selector::supported_emulations): New function.
3238         (Target_selector::emulation): New function.
3239         (Target_selector::do_recognize_by_bfd_name): Rename from
3240         do_recognize_by_name.  Change all callers.
3241         (Target_selector::do_supported_bfd_names): Rename from
3242         do_supported_names.  Change all callers.
3243         (Target_selector::do_recognize_by_emulation): New function.
3244         (Target_selector::do_supported_emulations): New function.
3245         (select_target_by_bfd_name): Change name in declaration.
3246         (select_target_by_emulation): Declare.
3247         (supported_emulation_names): Declare.
3248         * parameters.cc (parameters_force_valid_target): Try to find
3249         target based on emulation from -m option.
3250         * options.h (class General_options): Change doc string for -m.
3251         * options.cc (help): Print emulations.
3252         (General_options::parse_V): Likewise.
3253         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3254         Add emulation parameter.  Change all callers.
3255
3256 2011-06-28  Ian Lance Taylor  <iant@google.com>
3257
3258         * target.h (class Target): Add osabi_ field.
3259         (Target::osabi): New function.
3260         (Target::set_osabi): New function.
3261         (Target::Target): Initialize osabi_.
3262         (Target::do_adjust_elf_header): Make pure virtual.
3263         (Sized_target::do_adjust_elf_header): Declare.
3264         * target.cc (Sized_target::do_adjust_elf_header): New function.
3265         (class Sized_target): Instantiate all versions.
3266         * freebsd.h (class Target_freebsd): Remove.
3267         (Target_selector_freebsd::do_recognize): Call set_osabi on
3268         Target.
3269         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3270         (Target_selector_freebsd::set_osabi): Remove.
3271         * i386.cc (class Target_i386): Inherit from Sized_target rather
3272         than Target_freebsd.
3273         * x86_64.cc (class Target_x86_64): Likewise.
3274
3275 2011-06-28  Ian Lance Taylor  <iant@google.com>
3276
3277         * target.h (Target::can_check_for_function_pointers): Rewrite.
3278         Make non-virtual.
3279         (Target::can_icf_inline_merge_sections): Likewise.
3280         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3281         (Target::Target_info): Add can_icf_inline_merge_sections field.
3282         (Target::do_can_check_for_function_pointers): New virtual
3283         function.
3284         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3285         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3286         from can_check_for_function_pointers, move in file.
3287         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3288         section_may_have_icf_unsafe_poineters, move in file.
3289         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3290         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3291         Rename from can_check_for_function_pointers, move in file.
3292         (Target_i386::can_icf_inline_merge_sections): Remove.
3293         (Target_i386::i386_info): Initialize
3294         can_icf_inline_merge_sections.
3295         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3296         Initialize can_icf_inline_merge_sections.
3297         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3298         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3299         Rename from can_check_for_function_pointers, move in file.
3300         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3301         (Target_x86_64::x86_64_info): Initialize
3302         can_icf_inline_merge_sections.
3303         * testsuite/testfile.cc (Target_test::test_target_info):
3304         Likewise.
3305         * icf.cc (get_section_contents): Correct formatting.
3306
3307 2011-06-27  Ian Lance Taylor  <iant@google.com>
3308
3309         * symtab.cc (Symbol::versioned_name): New function.
3310         (Symbol_table::add_to_final_symtab): Use versioned_name when
3311         appropriate.
3312         (Symbol_table::sized_write_symbol): Likewise.
3313         * symtab.h (class Symbol): Declare versioned_name.
3314         * stringpool.h (class Stringpool_template): Add variant of add
3315         which takes a std::basic_string.
3316         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3317         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3318         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3319         (ver_test_12.o): New target.
3320         * testsuite/Makefile.in: Rebuild.
3321
3322 2011-06-27  Doug Kwan  <dougkwan@google.com>
3323
3324         * arm.cc (Arm_relocate_functions::thm_jump8,
3325         Arm_relocate_functions::thm_jump11): Use a wider signed
3326         type to compute offset.
3327         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3328         arm_thm_jump8.
3329         * testsuite/Makefile.in: Regenerate.
3330         * testsuite/arm_branch_in_range.sh: Check test results of
3331         arm_thm_jump11 and arm_thm_jump8.
3332         * testsuite/arm_thm_jump11.s: New test source file.
3333         * testsuite/arm_thm_jump11.t: New linker script.
3334         * testsuite/arm_thm_jump8.s: New test source file.
3335         * testsuite/arm_thm_jump8.t: New linker script.
3336
3337 2011-06-24  Ian Lance Taylor  <iant@google.com>
3338
3339         * layout.cc: Include "object.h".
3340         (ctors_sections_in_init_array): New static variable.
3341         (Layout::is_ctors_in_init_array): New function.
3342         (Layout::layout): Add entry to ctors_sections_in_init_array if
3343         appropriate.
3344         * layout.h (class Layout): Declare is_ctors_in_init_array.
3345         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3346         is_ctors_reverse_view is set.
3347         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3348         all callers.  Set is_ctors_reverse_view field of View_size.
3349         (Sized_relobj_file::reverse_words): New function.
3350         * object.h (Sized_relobj_file::View_size): Add
3351         is_ctors_reverse_view field.
3352         (class Sized_relobj_file): Update declarations.
3353         * testsuite/initpri3.c: New test.
3354         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3355         initpri3b.
3356         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3357         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3358         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3359         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3360         * testsuite/Makefile.in: Rebuild.
3361
3362 2011-06-24  Cary Coutant  <ccoutant@google.com>
3363
3364         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3365         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3366         (debug_msg_cdebug.err): New targets.
3367         * testsuite/Makefile.in: Regenerate.
3368         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3369         Fix checks for link with shared library.
3370
3371 2011-06-24  Doug Kwan  <dougkwan@google.com>
3372
3373         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3374         skip empty text sections.
3375         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3376
3377 2011-06-22  Ian Lance Taylor  <iant@google.com>
3378
3379         PR gold/12910
3380         * options.h (class General_options): Add --ctors-in-init-array.
3381         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3382         friends as SHT_PROGBITS for merging sections.
3383         (Layout::layout): Remove special handling of .init_array and
3384         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3385         and .dtors if ctors_in_init_array.
3386         (Layout::make_output_section): Force correct section types for
3387         .init_array and friends.  Don't sort if doing relocatable link,
3388         Don't sort .ctors and .dtors if ctors_in_init_array.
3389         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3390         (Layout::output_section_name): Add relobj parameter.  Change all
3391         callers.  Handle .ctors. and .dtors. in code rather than table.
3392         Handle .ctors and .dtors if ctors_in_init_array.
3393         (Layout::match_file_name): New function, moved from output.cc.
3394         * layout.h (class Layout): Update declarations.
3395         * output.cc: Include "layout.h".
3396         (Input_section_sort_entry::get_priority): New function.
3397         (Input_section_sort_entry::match_file_name): Just call
3398         Layout::match_file_name.
3399         (Output_section::Input_section_sort_init_fini_compare::operator()):
3400         Handle .ctors and .dtors.  Sort by explicit priority rather than
3401         by name.
3402         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3403         * testsuite/initpri2.c: New test.
3404         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3405         (check_PROGRAMS): Add initpri2.
3406         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3407         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3408         * configure, testsuite/Makefile.in: Rebuild.
3409
3410 2011-06-19  Ian Lance Taylor  <iant@google.com>
3411
3412         PR gold/12880
3413         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3414         .interp section to a PT_INTERP segment even if we have seen a
3415         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3416         clause in a linker script.
3417         (Layout::finalize): Don't create a .interp section if we've
3418         already create a PT_INTERP segment.
3419         (Layout::create_interp): Always call choose_output_section (revert
3420         patch of 2011-06-17).  Don't create PT_INTERP segment.
3421         * script-sections.cc
3422         (Script_sections::create_note_and_tls_segments): Add a .interp
3423         section to a PT_INTERP segment even if we have seen a
3424         --dynamic-linker option.
3425
3426 2011-06-18  Ian Lance Taylor  <iant@google.com>
3427
3428         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3429         merely because a non-PT_LOAD segment has a dynamic reloc.
3430
3431 2011-06-18  Ian Lance Taylor  <iant@google.com>
3432
3433         * layout.cc (Layout::finish_dynamic_section): Don't create
3434         DT_FLAGS entry if not needed.
3435
3436 2011-06-18  Ian Lance Taylor  <iant@google.com>
3437
3438         PR gold/12745
3439         * layout.cc (Layout::layout_eh_frame): Correct handling of
3440         writable .eh_frame section.
3441
3442 2011-06-17  Ian Lance Taylor  <iant@google.com>
3443
3444         PR gold/12893
3445         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3446         symbol is redefined with the exact same object and value.
3447
3448 2011-06-17  Ian Lance Taylor  <iant@google.com>
3449
3450         PR gold/12880
3451         * layout.h (class Layout): Add interp_segment_ field.
3452         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3453         (Layout::attach_allocated_section_to_segment): If making shared
3454         library, put .interp section in PT_INTERP segment.
3455         (Layout::finalize): Also call create_interp if -dynamic-linker
3456         option was used.
3457         (Layout::create_interp): Assert that there is no PT_INTERP
3458         segment.  If not using a SECTIONS clause, use make_output_section.
3459         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3460         * script-sections.cc
3461         (Script_sections::create_note_and_tls_segments): If making shared
3462         library, put .interp section in PT_INTERP segment.
3463
3464 2011-06-17  Ian Lance Taylor  <iant@google.com>
3465
3466         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3467         when making a shared library.
3468
3469 2011-06-17  Ian Lance Taylor  <iant@google.com>
3470
3471         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3472         parameter.  Change all callers.  Don't issue warning about PC32
3473         against locally defined symbol.
3474
3475 2011-06-16  Ian Lance Taylor  <iant@google.com>
3476
3477         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3478         occurs in same object.
3479
3480 2011-06-14  Alan Modra  <amodra@gmail.com>
3481
3482         * po/POTFILES.in: Regenerate.
3483
3484 2011-06-09  Ian Lance Taylor  <iant@google.com>
3485
3486         * script-sections.cc
3487         (Orphan_output_section::set_section_addresses): For a relocatable
3488         link set address to 0.
3489
3490 2011-06-09  Cary Coutant  <ccoutant@google.com>
3491
3492         PR gold/12804
3493         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3494         used with --compress-debug-sections.
3495         * gold/object.cc (Sized_relobj_file::do_layout): Report
3496         uncompressed size of compressed input sections.
3497
3498 2011-06-08  Cary Coutant  <ccoutant@google.com>
3499
3500         PR gold/12804
3501         * testsuite/two_file_test_2_v1.cc: Change initialization of
3502         v2 to keep it in .data.
3503
3504 2011-06-07  Cary Coutant  <ccoutant@google.com>
3505
3506         * common.cc (Symbol_table::do_allocate_commons_list): Call
3507         gold_fallback.
3508         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3509         (Errors::fallback): New function.
3510         (gold_fallback): New function.
3511         * errors.h (Errors::fallback): New function.
3512         * gold.cc (gold_exit): Change status parameter to enum; adjust
3513         all callers.
3514         (queue_initial_tasks): Call gold_fallback.
3515         * gold.h: Include cstdlib.
3516         (Exit_status): New enum type.
3517         (gold_exit): Change status parameter to enum.
3518         (gold_fallback): New function.
3519         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3520         (Layout::create_symtab_sections): Likewise.
3521         (Layout::create_shdrs): Likewise.
3522         * main.cc (main): Adjust call to gold_exit.
3523         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3524         (Output_data_got::add_got_entry_pair): Likewise.
3525         (Output_section::add_input_section): Likewise.
3526         (Output_section::add_output_section_data): Likewise.
3527         (Output_segment::set_section_list_addresses): Likewise.
3528         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3529
3530 2011-06-07  Cary Coutant  <ccoutant@google.com>
3531
3532         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3533         for incremental links.
3534         * output.cc (Output_segment::set_section_list_addresses): Remove
3535         FIXME and test for TLS or BSS.
3536
3537 2011-06-07  Cary Coutant  <ccoutant@google.com>
3538
3539         * testsuite/Makefile.am: Add incremental_copy_test,
3540         incremental_common_test_1.
3541         * testsuite/Makefile.in: Regenerate.
3542         * testsuite/common_test_1_v1.c: New source file.
3543         * testsuite/common_test_1_v2.c: New source file.
3544         * testsuite/copy_test_v1.cc: New source file.
3545
3546 2011-06-07  Cary Coutant  <ccoutant@google.com>
3547
3548         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3549         update, allocate common from bss section's free list.
3550         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3551         linker-defined symbols.
3552         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3553         Skip GOT and PLT entries that are no longer referenced.
3554         (Output_section_incremental_inputs::write_info_blocks): Mark
3555         linker-defined symbols.
3556         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3557         * output.cc (Output_section::allocate): New function.
3558         * output.h (Output_section::allocate): New function.
3559         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3560         linker-defined symbols.
3561         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3562         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3563         (Symbol::init_base_output_data): Likewise.
3564         (Symbol::init_base_output_segment): Likewise.
3565         (Symbol::init_base_constant): Likewise.
3566         (Sized_symbol::init_output_data): Likewise.
3567         (Sized_symbol::init_output_segment): Likewise.
3568         (Sized_symbol::init_constant): Likewise.
3569         (Symbol_table::do_define_in_output_data): Likewise.
3570         (Symbol_table::do_define_in_output_segment): Likewise.
3571         (Symbol_table::do_define_as_constant): Likewise.
3572         * symtab.h (Symbol::is_predefined): New function.
3573         (Symbol::init_base_output_data): Add is_predefined parameter.
3574         (Symbol::init_base_output_segment): Likewise.
3575         (Symbol::init_base_constant): Likewise.
3576         (Symbol::is_predefined_): New data member.
3577         (Sized_symbol::init_output_data): Add is_predefined parameter.
3578         (Sized_symbol::init_output_segment): Likewise.
3579         (Sized_symbol::init_constant): Likewise.
3580         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3581
3582 2011-06-07  Cary Coutant  <ccoutant@google.com>
3583
3584         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3585         instead of emit_copy_reloc.
3586         (Copy_relocs::emit_copy_reloc): Refactor.
3587         (Copy_relocs::make_copy_reloc): New function.
3588         (Copy_relocs::add_copy_reloc): Remove.
3589         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3590         section.
3591         (Copy_relocs::make_copy_reloc): New function.
3592         (Copy_relocs::add_copy_reloc): Remove.
3593         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3594         unchanged input files.
3595         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3596         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3597         Reserve BSS space for COPY relocations.
3598         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3599         (Output_section_incremental_inputs::write_info_blocks): Record
3600         whether a symbol is copied from a shared object.
3601         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3602         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3603         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3604         (Incremental_input_entry_reader::get_output_symbol_index): Add
3605         is_copy parameter.
3606         (Incremental_binary::emit_copy_relocs): New function.
3607         (Incremental_binary::do_emit_copy_relocs): New function.
3608         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3609         new data member.
3610         (Sized_incremental_binary::add_copy_reloc): New function.
3611         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3612         (Sized_incremental_binary::Copy_reloc): New struct.
3613         (Sized_incremental_binary::Copy_relocs): New typedef.
3614         (Sized_incremental_binary::copy_relocs_): New data member.
3615         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3616         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3617         * target.h (Sized_target::emit_copy_reloc): New function.
3618         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3619
3620 2011-06-02  Cary Coutant  <ccoutant@google.com>
3621
3622         PR gold/12163
3623         * gold/archive.cc (Archive::Archive): Initialize new data member.
3624         (Archive::include_all_members): Return if archive has already been
3625         included.
3626         * gold/archive.h (Archive::include_all_members_): New data member.
3627
3628 2011-06-02  Nick Clifton  <nickc@redhat.com>
3629
3630         * dynobj.h: Fix spelling mistake in comment.
3631         * output.cc: Likewise.
3632
3633 2011-05-31  Doug Kwan  <dougkwan@google.com>
3634             Asier Llano
3635
3636         PR gold/12826
3637         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3638         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3639         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3640         redundant arm_exidx_test.so.
3641         * testsuite/Makefile.in: Regenerate.
3642         (check_SCRIPTS): Add pr12826.sh
3643         (check_DATA): Add pr12826.stdout
3644         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3645         * testsuite/pr12826.sh: New file.
3646         * testsuite/pr12826_1.s: Ditto.
3647         * testsuite/pr12826_1.s: Ditto.
3648
3649 2011-05-30  Ian Lance Taylor  <iant@google.com>
3650
3651         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3652         sections.
3653
3654 2011-05-29  Ian Lance Taylor  <iant@google.com>
3655
3656         PR gold/12804
3657         * testsuite/Makefile.am: Use different file name for two_file_test
3658         temporary file for each incremental test.
3659         * testsuite/Makefile.in: Rebuild.
3660
3661 2011-05-29  Ian Lance Taylor  <iant@google.com>
3662
3663         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3664         binary input file is empty.
3665
3666 2011-05-27  Ian Lance Taylor  <iant@google.com>
3667
3668         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3669         (ver_test_9.so): Likewise.
3670         * testsuite/Makefile.in: Rebuild.
3671
3672 2011-05-26 Cary Coutant  <ccoutant@google.com>
3673
3674         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3675         * incremental.cc (Incremental_inputs::report_input_section): Fix
3676         comment, indentation.
3677         (Incremental_inputs::report_comdat_group): New function.
3678         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3679         of data for incremental input file entry.
3680         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3681         group count, COMDAT group signatures.
3682         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3683         an unchanged input file.
3684         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3685         Initialize new data member.
3686         (Incremental_object_entry::add_comdat_group): New function.
3687         (Incremental_object_entry::get_comdat_group_count): New function.
3688         (Incremental_object_entry::get_comdat_signature_key): New function.
3689         (Incremental_object_entry::groups_): New data member.
3690         (Incremental_inputs::report_comdat_group): New function.
3691         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3692         data for incremental input file entry.
3693         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3694         (Incremental_input_entry_reader::get_input_section): Adjust size of
3695         data for incremental input file entry.
3696         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3697         (Incremental_input_entry_reader::get_comdat_group_signature): New
3698         function.
3699         * object.cc (Sized_relobj::include_section_group): Report kept
3700         COMDAT groups for incremental links.
3701
3702 2011-05-24  David Meyer  <pdox@google.com>
3703
3704         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3705         with name parameter.  Add found_name parameter.
3706         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3707         * dirsearch.h (class Dirsearch): Update declaration.
3708
3709 2011-05-24  Ian Lance Taylor  <iant@google.com>
3710
3711         * archive.cc (Library_base::should_include_member): Pull in object
3712         from archive if it defines the entry symbol.
3713         * parameters.cc (Parameters::entry): New function.
3714         * parameters.h (class Parameters): Declare entry.
3715         * output.h (class Output_file_header): Remove entry_ field.
3716         * output.cc (Output_file_header::Output_file_header): Remove entry
3717         parameter.  Change all callers.
3718         (Output_file_header::entry): Use parameters->entry.
3719         * gold.cc (queue_middle_tasks): Likewise.
3720         * plugin.cc (Plugin_hook::run): Likewise.
3721
3722 2011-05-24 Cary Coutant  <ccoutant@google.com>
3723
3724         * gold.cc (queue_initial_tasks): Pass incremental base filename
3725         to Output_file::open_base_file; don't print error message.
3726         * incremental-dump.cc (main): Adjust call to
3727         Output_file::open_for_modification.
3728         * incremental-dump.cc (main): Likewise.
3729         * incremental.cc (Incremental_inputs::report_command_line):
3730         Ignore --incremental-base option when comparing command lines.
3731         Ignore parameter when given as separate argument.
3732         * options.h (class General_options): Add --incremental-base.
3733         * output.cc (Output_file::Output_file):
3734         (Output_file::open_base_file): Add base_name and writable parameters;
3735         read base file into new file; print error message here.
3736         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3737         callers.
3738         * output.h (Output_file::open_for_modification): Rename to...
3739         (Output_file::open_base_file): ...this; add base_name and
3740         writable parameters; adjust all callers.
3741         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3742         callers.
3743         * testsuite/Makefile.am (incremental_test_4): Test
3744         --incremental-base.
3745         * testsuite/Makefile.in: Regenerate.
3746
3747 2011-05-24 Cary Coutant  <ccoutant@google.com>
3748
3749         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3750         incremental_test_4.
3751         * testsuite/Makefile.in: Regenerate.
3752         * testsuite/two_file_test_1_v1.cc: New test source file.
3753         * testsuite/two_file_test_1b_v1.cc: New test source file.
3754         * testsuite/two_file_test_2_v1.cc: New test source file.
3755
3756 2011-05-24 Cary Coutant  <ccoutant@google.com>
3757
3758         * dynobj.h (Dynobj::do_dynobj): New function.
3759         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3760         flag and soname for shared objects.
3761         * incremental.cc (Incremental_inputs::report_object): Make
3762         either Incremental_object_entry or Incremental_dynobj_entry; add
3763         soname to string table.
3764         (Incremental_inputs::report_input_section): Add assertion.
3765         (Output_section_incremental_inputs::set_final_data_size): Adjust
3766         type of input file entry for shared libraries; adjust size of
3767         shared library info entry.
3768         (Output_section_incremental_inputs::write_input_files): Write
3769         as_needed flag for shared libraries.
3770         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3771         of input file entry for shared libraries; write soname.
3772         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3773         soname from incremental info.
3774         * incremental.h (enum Incremental_input_flags): Add
3775         INCREMENTAL_INPUT_AS_NEEDED.
3776         (Incremental_input_entry::Incremental_input_entry): Initialize new
3777         data member.
3778         (Incremental_input_entry::set_as_needed): New function.
3779         (Incremental_input_entry::as_needed): New function.
3780         (Incremental_input_entry::do_dynobj_entry): New function.
3781         (Incremental_input_entry::as_needed_): New data member.
3782         (Incremental_object_entry::Incremental_object_entry): Don't check
3783         for shared library.
3784         (Incremental_object_entry::do_type): Likewise.
3785         (class Incremental_dynobj_entry): New class.
3786         (Incremental_input_entry_reader::as_needed): New function.
3787         (Incremental_input_entry_reader::get_soname): New function.
3788         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3789         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3790         size of shared library info entry.
3791         * layout.cc (Layout::finish_dynamic_section): Don't test for
3792         incremental link when adding DT_NEEDED entries.
3793         * object.h (Object::Object): Initialize new data member.
3794         (Object::dynobj): New function.
3795         (Object::set_as_needed): New function.
3796         (Object::as_needed): New function.
3797         (Object::do_dynobj): New function.
3798         (Object::as_needed_): New data member.
3799
3800 2011-05-24 Cary Coutant  <ccoutant@google.com>
3801
3802         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3803         info; adjust display of GOT entries.
3804         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3805         vector of input objects; remove file_status_.
3806         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3807         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3808         got_plt reader; call target hooks to reserve GOT entries.
3809         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3810         of input file info header and GOT info entry.
3811         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3812         relocation info.
3813         (Got_plt_view_info::got_descriptor): Remove.
3814         (Got_plt_view_info::sym_index): New data member.
3815         (Got_plt_view_info::input_index): New data member.
3816         (Local_got_offset_visitor::visit): Write input file index.
3817         (Global_got_offset_visitor::visit): Write 0 for input file index.
3818         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3819         with sym_index and input_index.
3820         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3821         incremental info GOT entry; replace got_descriptor with input_index.
3822         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3823         map from input file index to object.
3824         (Sized_relobj_incr::do_layout): Replace direct data member reference
3825         with accessor function.
3826         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3827         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3828         Adjust size of input file info header.
3829         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3830         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3831         (Incremental_input_entry_reader::get_input_section): Adjust size of
3832         input file info header.
3833         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3834         of incremental info GOT entry.
3835         (Incremental_got_plt_reader::get_got_desc): Remove.
3836         (Incremental_got_plt_reader::get_got_symndx): New function.
3837         (Incremental_got_plt_reader::get_got_input_index): New function.
3838         (Sized_incremental_binary::Sized_incremental_binary): Remove
3839         file_status_; add input_objects_.
3840         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3841         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3842         (Sized_incremental_binary::file_is_unchanged): Remove.
3843         (Sized_incremental_binary::set_input_object): New function.
3844         (Sized_incremental_binary::input_object): New function.
3845         (Sized_incremental_binary::file_status_): Remove.
3846         (Sized_incremental_binary::input_objects_): New data member.
3847         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3848         references.
3849         (Sized_relobj_incr::invalid_address): Move to base class.
3850         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3851         class.
3852         (Sized_relobj_incr::do_output_section_offset): Likewise.
3853         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3854         (Sized_relobj_incr::section_offsets_): Likewise.
3855         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3856         function.
3857         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3858         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3859         with accessor function.
3860         (Sized_relobj_file::do_layout): Likewise.
3861         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3862         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3863         (Sized_relobj_file::compute_final_local_value): Replace refs to
3864         section_offsets_ with accessor function.
3865         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3866         * object.h (Relobj::Relobj): Initialize new data members.
3867         (Relobj::add_dyn_reloc): New function.
3868         (Relobj::first_dyn_reloc): New function.
3869         (Relobj::dyn_reloc_count): New function.
3870         (Relobj::first_dyn_reloc_): New data member.
3871         (Relobj::dyn_reloc_count_): New data member.
3872         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3873         references.
3874         (Sized_relobj::Address): New typedef.
3875         (Sized_relobj::invalid_address): Move here from child class.
3876         (Sized_relobj::Sized_relobj): Initialize new data members.
3877         (Sized_relobj::sized_relobj): New function.
3878         (Sized_relobj::is_output_section_offset_invalid): Move here from
3879         child class.
3880         (Sized_relobj::get_output_section_offset): Likewise.
3881         (Sized_relobj::local_has_got_offset): Likewise.
3882         (Sized_relobj::local_got_offset): Likewise.
3883         (Sized_relobj::set_local_got_offset): Likewise.
3884         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3885         (Sized_relobj::clear_got_offsets): New function.
3886         (Sized_relobj::section_offsets): Move here from child class.
3887         (Sized_relobj::do_output_section_offset): Likewise.
3888         (Sized_relobj::do_set_section_offset): Likewise.
3889         (Sized_relobj::Local_got_offsets): Likewise.
3890         (Sized_relobj::local_got_offsets_): Likewise.
3891         (Sized_relobj::section_offsets_): Likewise.
3892         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3893         references.
3894         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3895         class.
3896         (Sized_relobj_file::sized_relobj): New function
3897         (Sized_relobj_file::local_has_got_offset): Move to base class.
3898         (Sized_relobj_file::local_got_offset): Likewise.
3899         (Sized_relobj_file::set_local_got_offset): Likewise.
3900         (Sized_relobj_file::get_output_section_offset): Likewise.
3901         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3902         (Sized_relobj_file::do_output_section_offset): Likewise.
3903         (Sized_relobj_file::do_set_section_offset): Likewise.
3904         (Sized_relobj_file::Local_got_offsets): Likewise.
3905         (Sized_relobj_file::local_got_offsets_): Likewise.
3906         (Sized_relobj_file::section_offsets_): Likewise.
3907         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3908         (all constructors).
3909         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3910         (Output_reloc::get_symbol_index): Likewise.
3911         (Output_reloc::local_section_offset): Likewise.
3912         (Output_reloc::get_address): Likewise.
3913         (Output_reloc::symbol_value): Likewise.
3914         (Output_data_got::reserve_slot): Move to class definition.
3915         (Output_data_got::reserve_local): New function.
3916         (Output_data_got::reserve_slot_for_global): Remove.
3917         (Output_data_got::reserve_global): New function.
3918         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3919         (all constructors, two instantiations).
3920         (Output_reloc::get_relobj): New function (two instantiations).
3921         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3922         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3923         (Output_data_reloc::add_global): Adjust type of relobj.
3924         (Output_data_reloc::add_global_relative): Likewise.
3925         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3926         (Output_data_reloc::add_local): Likewise.
3927         (Output_data_reloc::add_local_relative): Likewise.
3928         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3929         (Output_data_reloc::add_local_section): Likewise.
3930         (Output_data_reloc::add_output_section): Likewise.
3931         (Output_data_reloc::add_absolute): Likewise.
3932         (Output_data_reloc::add_target_specific): Likewise.
3933         (Output_data_got::reserve_slot): Move definition here.
3934         (Output_data_got::reserve_local): New function.
3935         (Output_data_got::reserve_global): New function.
3936         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3937         section_offsets_ with accessor function.
3938         (Sized_relobj_file::write_sections): Likewise.
3939         (Sized_relobj_file::do_relocate_sections): Likewise.
3940         * target.h (Sized_target::reserve_local_got_entry): New function.
3941         (Sized_target::reserve_global_got_entry): New function.
3942         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3943         (Target_x86_64::reserve_global_got_entry): New function.
3944         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3945
3946 2011-05-23 Cary Coutant  <ccoutant@google.com>
3947
3948         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3949         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3950         bit when checking got_type.
3951         * incremental.cc (Sized_incremental_binary::setup_readers):
3952         Store symbol table and string table locations; initialize bit vector
3953         of file status flags.
3954         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3955         unchanged files.
3956         (Sized_incremental_binary::do_process_got_plt): New function.
3957         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3958         (Output_section_incremental_inputs::set_final_data_size): Record
3959         file index for each input file.
3960         (Output_section_incremental_inputs::write_got_plt): Store file index
3961         instead of input entry offset for each GOT entry.
3962         * incremental.h
3963         (Incremental_input_entry::Incremental_input_entry): Initialize new
3964         data member.
3965         (Incremental_input_entry::set_offset): Store file index.
3966         (Incremental_input_entry::get_file_index): New function.
3967         (Incremental_input_entry::file_index_): New data member.
3968         (Incremental_binary::process_got_plt): New function.
3969         (Incremental_binary::do_process_got_plt): New function.
3970         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3971         data members.
3972         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3973         (Sized_incremental_binary::set_file_is_unchanged): New function.
3974         (Sized_incremental_binary::file_is_unchanged): New function.
3975         (Sized_incremental_binary::do_process_got_plt): New function.
3976         (Sized_incremental_binary::file_status_): New data member.
3977         (Sized_incremental_binary::main_symtab_loc_): New data member.
3978         (Sized_incremental_binary::main_strtab_loc_): New data member.
3979         * output.cc (Output_data_got::Got_entry::write): Add case
3980         RESERVED_CODE.
3981         (Output_data_got::add_global): Call add_got_entry.
3982         (Output_data_got::add_global_plt): Likewise.
3983         (Output_data_got::add_global_with_rel): Likewise.
3984         (Output_data_got::add_global_with_rela): Likewise.
3985         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3986         (Output_data_got::add_global_pair_with_rela): Likewise.
3987         (Output_data_got::add_local): Call add_got_entry.
3988         (Output_data_got::add_local_plt): Likewise.
3989         (Output_data_got::add_local_with_rel): Likewise.
3990         (Output_data_got::add_local_with_rela): Likewise.
3991         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3992         (Output_data_got::add_local_pair_with_rela): Likewise.
3993         (Output_data_got::reserve_slot): New function.
3994         (Output_data_got::reserve_slot_for_global): New function.
3995         (Output_data_got::add_got_entry): New function.
3996         (Output_data_got::add_got_entry_pair): New function.
3997         (Output_section::add_output_section_data): Edit FIXME.
3998         * output.h
3999         (Output_section_data_build::Output_section_data_build): New
4000         constructor with size parameter.
4001         (Output_data_space::Output_data_space): Likewise.
4002         (Output_data_got::Output_data_got): Initialize new data member; new
4003         constructor with size parameter.
4004         (Output_data_got::add_constant): Call add_got_entry.
4005         (Output_data_got::reserve_slot): New function.
4006         (Output_data_got::reserve_slot_for_global): New function.
4007         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4008         (Output_data_got::add_got_entry): New function.
4009         (Output_data_got::add_got_entry_pair): New function.
4010         (Output_data_got::free_list_): New data member.
4011         * target.h (Sized_target::init_got_plt_for_update): New function.
4012         (Sized_target::register_global_plt_entry): New function.
4013         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4014         Initialize new data member; call init; add constructor with PLT count.
4015         (Output_data_plt_x86_64::init): New function.
4016         (Output_data_plt_x86_64::add_relocation): New function.
4017         (Output_data_plt_x86_64::reserve_slot): New function.
4018         (Output_data_plt_x86_64::free_list_): New data member.
4019         (Target_x86_64::init_got_plt_for_update): New function.
4020         (Target_x86_64::register_global_plt_entry): New function.
4021         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4022         incremental updates.
4023         (Output_data_plt_x86_64::add_relocation): New function.
4024         * testsuite/object_unittest.cc (Object_test): Set default options.
4025
4026 2011-05-16  Ian Lance Taylor  <iant@google.com>
4027
4028         * options.h (class General_options): Make -i a synonym for -r.
4029
4030 2011-05-16  Ian Lance Taylor  <iant@google.com>
4031
4032         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4033
4034 2011-05-10 Cary Coutant  <ccoutant@google.com>
4035
4036         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4037         strip_all (-s).
4038
4039 2011-05-06  Ian Lance Taylor  <iant@google.com>
4040
4041         * layout.cc (Layout::layout): If the output section flags change,
4042         update the ordering.
4043
4044 2011-04-25 Cary Coutant  <ccoutant@google.com>
4045
4046         * incremental-dump.cc (dump_incremental_inputs): Print local
4047         symbol info for each input file.
4048         * incremental.cc
4049         (Output_section_incremental_inputs::set_final_data_size): Add local
4050         symbol info to input file entries in incremental info.
4051         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4052         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4053         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4054         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4055         implementation.
4056         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4057         (Sized_incr_relobj::do_relocate): Write the local symbols.
4058         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4059         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4060         Adjust size of input file header.
4061         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4062         (Incremental_inputs_reader::get_local_symbol_count): New function.
4063         (Incremental_inputs_reader::get_input_section): Adjust size of input
4064         file header.
4065         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4066         (Sized_incr_relobj::This): New typedef.
4067         (Sized_incr_relobj::sym_size): New const data member.
4068         (Sized_incr_relobj::Local_symbol): New struct.
4069         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4070         (Sized_incr_relobj::do_local_symbol_offset): New function.
4071         (Sized_incr_relobj::local_symbol_count_): New data member.
4072         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4073         (Sized_incr_relobj::local_symbol_index_): New data member.
4074         (Sized_incr_relobj::local_symbol_offset_): New data member.
4075         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4076         (Sized_incr_relobj::local_symbols_): New data member.
4077         * object.h (Relobj::output_local_symbol_count): New function.
4078         (Relobj::local_symbol_offset): New function.
4079         (Relobj::do_output_local_symbol_count): New function.
4080         (Relobj::do_local_symbol_offset): New function.
4081         (Sized_relobj::do_output_local_symbol_count): New function.
4082         (Sized_relobj::do_local_symbol_offset): New function.
4083
4084 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4085
4086         * descriptors.cc (set_close_on_exec): New function.
4087         (Descriptors::open): Use set_close_on_exec.
4088         * output.cc (S_ISLNK): Define if not defined.
4089
4090 2011-04-22 Cary Coutant  <ccoutant@google.com>
4091
4092         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4093         global symbol map.
4094         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4095         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4096         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4097         relocations.
4098         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4099         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4100         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4101         * incremental.h
4102         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4103         function.
4104         (Incremental_binary::apply_incremental_relocs): New function.
4105         (Incremental_binary::do_apply_incremental_relocs): New function.
4106         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4107         data member.
4108         (Sized_incremental_binary::add_global_symbol): New function.
4109         (Sized_incremental_binary::global_symbol): New function.
4110         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4111         (Sized_incremental_binary::symbol_map_): New data member.
4112         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4113         * target.h (Sized_target::apply_relocation): New function.
4114         * target-reloc.h (apply_relocation): New function.
4115         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4116
4117 2011-04-22  Doug Kwan  <dougkwan@google.com>
4118
4119         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4120         flag of a SHT_ARM_EXIDX section.
4121         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4122         * testsuite/Makefile.in: Regenerate.
4123         * testsuite/arm_exidx_test.s: New file.
4124         * testsuite/arm_exidx_test.sh: Same.
4125
4126 2011-04-20 Cary Coutant  <ccoutant@google.com>
4127
4128         PR gold/12689
4129         * archive.h (Incremental_archive_entry::Archive_member):
4130         Initialize arg_serial_ (second constructor).
4131
4132 2011-04-17  Ian Lance Taylor  <iant@google.com>
4133
4134         * object.cc (Relocate_info::location): Simplify location string.
4135         * errors.cc (Errors::error_at_location): Don't print program
4136         name.
4137         (Errors::warning_at_location): Likewise.
4138         (Errors::undefined_symbol): Likewise.
4139         * testsuite/debug_msg.sh: Update accordingly.
4140
4141 2011-04-14 Cary Coutant  <ccoutant@google.com>
4142
4143         * gold/layout.cc (Layout::symtab_section_offset): New function.
4144         * gold/layout.h (Layout::symtab_section_offset): New function.
4145         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4146
4147 2011-04-12  Ian Lance Taylor  <iant@google.com>
4148
4149         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4150         with MREMAP_MAYMOVE.
4151         * output.h (class Output_file): Add map_is_allocated_ field.
4152         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4153         not available, provide stubs.  If mremap is not available, #define
4154         it to gold_mremap.
4155         (MREMAP_MAYMOVE): Define if not defined.
4156         (Output_file::Output_file): Initialize map_is_allocated_.
4157         (Output_file::resize): Check map_is_allocated_.
4158         (Output_file::map_anonymous): If mmap fails, use malloc.
4159         (Output_file::unmap): Don't do anything for an anonymous map.
4160         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4161         is not available, provide stubs.
4162         (File_read::View::~View): Use free rather than delete[].
4163         (File_read::make_view): Use malloc rather than new[].  If mmap
4164         fails, use malloc.
4165         (File_read::find_or_make_view): Use malloc rather than new[].
4166         * gold.h: Remove HAVE_REMAP code.
4167         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4168         exists.  Rename mremap to gold_mremap.  If mmap is not available
4169         don't do anything.
4170         * configure, config.in: Rebuild.
4171
4172 2011-04-11  Ian Lance Taylor  <iant@google.com>
4173
4174         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4175         initialize local variable v.
4176
4177 2011-04-11  Cary Coutant  <ccoutant@google.com>
4178
4179         * archive.cc (Archive::include_member): Adjust call to
4180         report_object.
4181         (Add_archive_symbols::run): Track argument serial numbers.
4182         (Lib_group::include_member): Likewise.
4183         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4184         * archive.h (Incremental_archive_entry::Archive_member):
4185         Initialize arg_serial_.
4186         (Archive_member::arg_serial_): New data member.
4187         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4188         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4189         incremental link.
4190         (Sized_dynobj::do_for_all_local_got_entries): New function.
4191         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4192         function.
4193         * fileread.cc (get_mtime): New function.
4194         * fileread.h (get_mtime): New function.
4195         * gold.cc (queue_initial_tasks): Check for incremental update.
4196         (process_incremental_input): New function.
4197         (queue_middle_tasks): Don't force valid target for incremental
4198         update.
4199         * incremental-dump.cc (find_input_containing_global): Adjust
4200         size of symbol info entry.
4201         (dump_incremental_inputs): Dump argument serial number and
4202         in_system_directory flag; bias shndx by 1; print symbol names
4203         when dumping per-file symbol lists; use new symbol info readers.
4204         * incremental.cc
4205         (Output_section_incremental_inputs:update_data_size): New function.
4206         (Sized_incremental_binary::setup_readers): Setup input readers
4207         for each input file; build maps for files added from libraries
4208         and scripts.
4209         (Sized_incremental_binary::check_input_args): New function.
4210         (Sized_incremental_binary::do_check_inputs): Build map of argument
4211         serial numbers to input arguments.
4212         (Sized_incremental_binary::do_file_has_changed): Rename
4213         do_file_is_unchanged to this; compare file modification times.
4214         (Sized_incremental_binary::do_init_layout): New function.
4215         (Sized_incremental_binary::do_reserve_layout): New function.
4216         (Sized_incremental_binary::do_get_input_reader): Remove.
4217         (Sized_incremental_binary::get_symtab_view): New function.
4218         (Incremental_checker::can_incrementally_link_output_file): Remove.
4219         (Incremental_inputs::report_command_line): Exclude --debug options.
4220         (Incremental_inputs::report_archive_begin): Add parameter; track
4221         argument serial numbers; don't put input file entry for archive
4222         before archive members.
4223         (Incremental_inputs::report_archive_end): Put input file entry
4224         for archive after archive members.
4225         (Incremental_inputs::report_object): Add parameter; track argument
4226         serial numbers and in_system_directory flag.
4227         (Incremental_inputs::report_script): Add parameter; track argument
4228         serial numbers.
4229         (Output_section_incremental_inputs::set_final_data_size): Adjust
4230         size of symbol info entry; check for forwarding symbols.
4231         (Output_section_incremental_inputs::write_input_files): Write
4232         in_system_directory flag and argument serial number.
4233         (Output_section_incremental_inputs::write_info_blocks): Map section
4234         indices between incremental info and original input file; store
4235         input section index for each symbol.
4236         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4237         change operator() to visit().
4238         (class Global_got_offset_visitor): Likewise.
4239         (class Global_symbol_visitor_got_plt):
4240         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4241         classes.
4242         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4243         (Sized_incr_relobj::do_read_symbols): New function.
4244         (Sized_incr_relobj::do_layout): New function.
4245         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4246         (Sized_incr_relobj::do_add_symbols): New function.
4247         (Sized_incr_relobj::do_should_include_member): New function.
4248         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4249         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4250         (Sized_incr_relobj::do_section_size): New function.
4251         (Sized_incr_relobj::do_section_name): New function.
4252         (Sized_incr_relobj::do_section_contents): New function.
4253         (Sized_incr_relobj::do_section_flags): New function.
4254         (Sized_incr_relobj::do_section_entsize): New function.
4255         (Sized_incr_relobj::do_section_address): New function.
4256         (Sized_incr_relobj::do_section_type): New function.
4257         (Sized_incr_relobj::do_section_link): New function.
4258         (Sized_incr_relobj::do_section_info): New function.
4259         (Sized_incr_relobj::do_section_addralign): New function.
4260         (Sized_incr_relobj::do_initialize_xindex): New function.
4261         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4262         (Sized_incr_relobj::do_read_relocs): New function.
4263         (Sized_incr_relobj::do_gc_process_relocs): New function.
4264         (Sized_incr_relobj::do_scan_relocs): New function.
4265         (Sized_incr_relobj::do_count_local_symbols): New function.
4266         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4267         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4268         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4269         (Sized_incr_relobj::do_relocate): New function.
4270         (Sized_incr_relobj::do_set_section_offset): New function.
4271         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4272         (Sized_incr_dynobj::do_read_symbols): New function.
4273         (Sized_incr_dynobj::do_layout): New function.
4274         (Sized_incr_dynobj::do_add_symbols): New function.
4275         (Sized_incr_dynobj::do_should_include_member): New function.
4276         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4277         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4278         (Sized_incr_dynobj::do_section_size): New function.
4279         (Sized_incr_dynobj::do_section_name): New function.
4280         (Sized_incr_dynobj::do_section_contents): New function.
4281         (Sized_incr_dynobj::do_section_flags): New function.
4282         (Sized_incr_dynobj::do_section_entsize): New function.
4283         (Sized_incr_dynobj::do_section_address): New function.
4284         (Sized_incr_dynobj::do_section_type): New function.
4285         (Sized_incr_dynobj::do_section_link): New function.
4286         (Sized_incr_dynobj::do_section_info): New function.
4287         (Sized_incr_dynobj::do_section_addralign): New function.
4288         (Sized_incr_dynobj::do_initialize_xindex): New function.
4289         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4290         (make_sized_incremental_object): New function.
4291         (Incremental_library::copy_unused_symbols): New function.
4292         (Incremental_library::do_for_all_unused_symbols): New function.
4293         * incremental.h (enum Incremental_input_flags): New type.
4294         (class Incremental_checker): Remove.
4295         (Incremental_input_entry::Incremental_input_entry): Add argument
4296         serial number.
4297         (Incremental_input_entry::arg_serial): New function.
4298         (Incremental_input_entry::set_is_in_system_directory): New function.
4299         (Incremental_input_entry::is_in_system_directory): New function.
4300         (Incremental_input_entry::arg_serial_): New data member.
4301         (Incremental_input_entry::is_in_system_directory_): New data member.
4302         (class Script_info): Move here from script.h.
4303         (Script_info::Script_info): Add filename parameter.
4304         (Script_info::filename): New function.
4305         (Script_info::filename_): New data member.
4306         (Incremental_script_entry::Incremental_script_entry): Add argument
4307         serial number.
4308         (Incremental_object_entry::Incremental_object_entry): Likewise.
4309         (Incremental_object_entry::add_input_section): Build list of input
4310         sections with map to original shndx.
4311         (Incremental_object_entry::get_input_section_index): New function.
4312         (Incremental_object_entry::shndx_): New data member.
4313         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4314         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4315         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4316         serial number.
4317         (Incremental_inputs::report_archive_begin): Likewise.
4318         (Incremental_inputs::report_object): Likewise.
4319         (Incremental_inputs::report_script): Likewise.
4320         (class Incremental_global_symbol_reader): New class.
4321         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4322         and store flags and input file type.
4323         (Incremental_input_entry_reader::arg_serial): New function.
4324         (Incremental_input_entry_reader::type): Extract type from flags.
4325         (Incremental_input_entry_reader::is_in_system_directory): New function.
4326         (Incremental_input_entry_reader::get_input_section_count): Call
4327         accessor function for type.
4328         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4329         function for type; adjust size of global symbol entry.
4330         (Incremental_input_entry_reader::get_global_symbol_count): Call
4331         accessor function for type.
4332         (Incremental_input_entry_reader::get_object_count): Likewise.
4333         (Incremental_input_entry_reader::get_object_offset): Likewise.
4334         (Incremental_input_entry_reader::get_member_count): Likewise.
4335         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4336         (Incremental_input_entry_reader::get_member_offset): Likewise.
4337         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4338         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4339         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4340         (Incremental_input_entry_reader::get_global_symbol_reader): New
4341         function.
4342         (Incremental_input_entry_reader::get_output_symbol_index): New
4343         function.
4344         (Incremental_input_entry_reader::type_): Remove.
4345         (Incremental_input_entry_reader::flags_): New data member.
4346         (Incremental_inputs_reader::input_file_offset): New function.
4347         (Incremental_inputs_reader::input_file_index): New function.
4348         (Incremental_inputs_reader::input_file): Call input_file_offset.
4349         (Incremental_inputs_reader::input_file_at_offset): New function.
4350         (Incremental_relocs_reader::get_r_type): Reformat.
4351         (Incremental_relocs_reader::get_r_shndx): Reformat.
4352         (Incremental_relocs_reader::get_r_offset): Reformat.
4353         (Incremental_relocs_reader::data): New function.
4354         (Incremental_binary::Incremental_binary): Initialize new data members.
4355         (Incremental_binary::check_inputs): Add cmdline parameter.
4356         (Incremental_binary::file_is_unchanged): Remove.
4357         (Input_reader::arg_serial): New function.
4358         (Input_reader::get_unused_symbol_count): New function.
4359         (Input_reader::get_unused_symbol): New function.
4360         (Input_reader::do_arg_serial): New function.
4361         (Input_reader::do_get_unused_symbol_count): New function.
4362         (Input_reader::do_get_unused_symbol): New function.
4363         (Incremental_binary::input_file_count): New function.
4364         (Incremental_binary::get_input_reader): Change signature to use
4365         index instead of filename.
4366         (Incremental_binary::file_has_changed): New function.
4367         (Incremental_binary::get_input_argument): New function.
4368         (Incremental_binary::get_library): New function.
4369         (Incremental_binary::get_script_info): New function.
4370         (Incremental_binary::init_layout): New function.
4371         (Incremental_binary::reserve_layout): New function.
4372         (Incremental_binary::output_file): New function.
4373         (Incremental_binary::do_check_inputs): New function.
4374         (Incremental_binary::do_file_is_unchanged): Remove.
4375         (Incremental_binary::do_file_has_changed): New function.
4376         (Incremental_binary::do_init_layout): New function.
4377         (Incremental_binary::do_reserve_layout): New function.
4378         (Incremental_binary::do_input_file_count): New function.
4379         (Incremental_binary::do_get_input_reader): Change signature.
4380         (Incremental_binary::input_args_map_): New data member.
4381         (Incremental_binary::library_map_): New data member.
4382         (Incremental_binary::script_map_): New data member.
4383         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4384         new data members.
4385         (Sized_incremental_binary::output_section): New function.
4386         (Sized_incremental_binary::inputs_reader): Add const.
4387         (Sized_incremental_binary::symtab_reader): Add const.
4388         (Sized_incremental_binary::relocs_reader): Add const.
4389         (Sized_incremental_binary::got_plt_reader): Add const.
4390         (Sized_incremental_binary::get_symtab_view): New function.
4391         (Sized_incremental_binary::Inputs_reader): New typedef.
4392         (Sized_incremental_binary::Input_entry_reader): New typedef.
4393         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4394         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4395         (Sized_incremental_binary::do_file_has_changed): New function.
4396         (Sized_incremental_binary::do_init_layout): New function.
4397         (Sized_incremental_binary::do_reserve_layout): New function.
4398         (Sized_input_reader::Inputs_reader): Remove.
4399         (Sized_input_reader::Input_entry_reader): Remove.
4400         (Sized_input_reader::do_arg_serial): New function.
4401         (Sized_input_reader::do_get_unused_symbol_count): New function.
4402         (Sized_input_reader::do_get_unused_symbol): New function.
4403         (Sized_incremental_binary::do_input_file_count): New function.
4404         (Sized_incremental_binary::do_get_input_reader): Change signature;
4405         use index instead of filename.
4406         (Sized_incremental_binary::section_map_): New data member.
4407         (Sized_incremental_binary::input_entry_readers_): New data member.
4408         (class Sized_incr_relobj): New class.
4409         (class Sized_incr_dynobj): New class.
4410         (make_sized_incremental_object): New function.
4411         (class Incremental_library): New class.
4412         * layout.cc (Free_list::num_lists): New static data member.
4413         (Free_list::num_nodes): New static data member.
4414         (Free_list::num_removes): New static data member.
4415         (Free_list::num_remove_visits): New static data member.
4416         (Free_list::num_allocates): New static data member.
4417         (Free_list::num_allocate_visits): New static data member.
4418         (Free_list::init): New function.
4419         (Free_list::remove): New function.
4420         (Free_list::allocate): New function.
4421         (Free_list::dump): New function.
4422         (Free_list::print_stats): New function.
4423         (Layout_task_runner::run): Resize output file for incremental updates.
4424         (Layout::Layout): Initialize new data members.
4425         (Layout::set_incremental_base): New function.
4426         (Layout::init_fixed_output_section): New function.
4427         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4428         incremental updates.
4429         (Layout::create_gold_note): Do not create gold note section for
4430         incremental updates.
4431         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4432         for incremental updates.
4433         (Layout::set_section_offsets): For incremental updates, allocate space
4434         from free list.
4435         (Layout::create_symtab_sections): Layout with offsets relative to
4436         start of section; for incremental updates, allocate space from free
4437         list.
4438         (Layout::create_shdrs): For incremental updates, allocate space from
4439         free list.
4440         (Layout::finish_dynamic_section): For incremental updates, do not
4441         check --as-needed (fixed in subsequent patch).
4442         * layout.h (class Free_list): New class.
4443         (Layout::set_incremental_base): New function.
4444         (Layout::incremental_base): New function.
4445         (Layout::init_fixed_output_section): New function.
4446         (Layout::allocate): New function.
4447         (Layout::incremental_base_): New data member.
4448         (Layout::free_list_): New data member.
4449         * main.cc (main): Print Free_list statistics.
4450         * object.cc (Relobj::finalize_incremental_relocs): Add
4451         clear_counts parameter; clear counts only when clear_counts is set.
4452         (Sized_relobj::Sized_relobj): Initialize new base class.
4453         (Sized_relobj::do_layout): Don't report special sections.
4454         (Sized_relobj::do_for_all_local_got_entries): New function.
4455         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4456         symtab_off to all symbol table offsets.
4457         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4458         * object.h (class Got_offset_list): Move to top of file.
4459         (Object::Object): Allow case where input_file == NULL.
4460         (Object::~Object): Likewise.
4461         (Object::input_file): Assert that input_file != NULL.
4462         (Object::lock): Allow case where input_file == NULL.
4463         (Object::unlock): Likewise.
4464         (Object::is_locked): Likewise.
4465         (Object::token): Likewise.
4466         (Object::release): Likewise.
4467         (Object::is_incremental): New function.
4468         (Object::get_mtime): New function.
4469         (Object::for_all_local_got_entries): New function.
4470         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4471         (Object::set_is_in_system_directory): New function.
4472         (Object::is_in_system_directory): New function.
4473         (Object::do_is_incremental): New function.
4474         (Object::do_get_mtime): New function.
4475         (Object::do_for_all_local_got_entries): New function.
4476         (Object::is_in_system_directory_): New data member.
4477         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4478         (class Sized_relobj_base): New class.
4479         (class Sized_relobj): Derive from Sized_relobj_base.
4480         (class Sized_relobj::Symbols): Redeclare from base class.
4481         (class Sized_relobj::local_got_offset_list): Remove.
4482         (class Sized_relobj::Output_sections): Redeclare from base class.
4483         (class Sized_relobj::do_for_all_local_got_entries): New function.
4484         (class Sized_relobj::write_local_symbols): Add offset parameter.
4485         (class Sized_relobj::local_symbol_offset_): Update comment.
4486         (class Sized_relobj::local_dynsym_offset_): Update comment.
4487         * options.cc (Input_arguments::add_file): Remove const.
4488         * options.h (Input_file_argument::Input_file_argument):
4489         Initialize arg_serial_ (all constructors).
4490         (Input_file_argument::set_arg_serial): New function.
4491         (Input_file_argument::arg_serial): New function.
4492         (Input_file_argument::arg_serial_): New data member.
4493         (Input_arguments::Input_arguments): Initialize file_count_.
4494         (Input_arguments::add_file): Remove const.
4495         (Input_arguments::number_of_input_files): New function.
4496         (Input_arguments::file_count_): New data member.
4497         (Command_line::number_of_input_files): Call
4498         Input_arguments::number_of_input_files.
4499         * output.cc (Output_segment_headers::Output_segment_headers):
4500         Set current size.
4501         (Output_section::Input_section::current_data_size): New function.
4502         (Output_section::Output_section): Initialize new data members.
4503         (Output_section::add_input_section): Don't do merge sections for
4504         an incremental link; allocate space from free list for an
4505         incremental update.
4506         (Output_section::add_output_section_data): Allocate space from
4507         free list for an incremental update.
4508         (Output_section::update_data_size): New function.
4509         (Output_section::set_fixed_layout): New function.
4510         (Output_section::reserve): New function.
4511         (Output_segment::set_section_addresses): Remove const.
4512         (Output_segment::set_section_list_addresses): Remove const; allocate
4513         space from free list for an incremental update.
4514         (Output_segment::set_offset): Adjust size of RELRO segment for an
4515         incremental update.
4516         * output.h (Output_data::current_data_size): Move here from
4517         child classes.
4518         (Output_data::pre_finalize_data_size): New function.
4519         (Output_data::update_data_size): New function.
4520         (Output_section_headers::update_data_size): new function.
4521         (Output_section_data_build::current_data_size): Move to Output_data.
4522         (Output_data_strtab::update_data_size): New function.
4523         (Output_section::current_data_size): Move to Output_data.
4524         (Output_section::set_fixed_layout): New function.
4525         (Output_section::has_fixed_layout): New function.
4526         (Output_section::reserve): New function.
4527         (Output_section::update_data_size): New function.
4528         (Output_section::has_fixed_layout_): New data member.
4529         (Output_section::free_list_): New data member.
4530         (Output_segment::set_section_addresses): Remove const.
4531         (Output_segment::set_section_list_addresses): Remove const.
4532         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4533         New function.
4534         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4535         New function.
4536         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4537         parameter when calling Add_symbols constructor; store argument
4538         serial number for members of a lib group.
4539         (Add_symbols::locks): Allow case where token == NULL.
4540         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4541         (Read_member::~Read_member): New function.
4542         (Read_member::is_runnable): New function.
4543         (Read_member::locks): New function.
4544         (Read_member::run): New function.
4545         (Check_script::~Check_script): New function.
4546         (Check_script::is_runnable): New function.
4547         (Check_script::locks): New function.
4548         (Check_script::run): New function.
4549         (Check_library::~Check_library): New function.
4550         (Check_library::is_runnable): New function.
4551         (Check_library::locks): New function.
4552         (Check_library::run): New function.
4553         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4554         (Add_symbols::library_): New data member.
4555         (class Read_member): New class.
4556         (class Check_script): New class.
4557         (class Check_library): New class.
4558         * reloc.cc (Read_relocs::is_runnable): Allow case where
4559         token == NULL.
4560         (Read_relocs::locks): Likewise.
4561         (Scan_relocs::locks): Likewise.
4562         (Relocate_task::locks): Likewise.
4563         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4564         to clear counters.
4565         (Sized_relobj::incremental_relocs_scan): Fix comment.
4566         (Sized_relobj::do_relocate): Pass output file offset to
4567         write_local_symbols.
4568         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4569         from class declaration.
4570         * script.cc (read_input_script): Allocate Script_info; pass
4571         argument serial number to report_script.
4572         * script.h (class Script_info): Move to incremental.h.
4573         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4574         * symtab.h (Symbol_table::add_from_incrobj): New function.
4575         (Symbol_table::set_file_offset): New function.
4576
4577 2011-04-05  Cary Coutant  <ccoutant@google.com>
4578
4579         * incremental-dump.cc (dump_incremental_inputs): Change signature
4580         to take a Sized_incremental_binary; change caller.  Use readers
4581         in Sized_incremental_binary.
4582         * incremental.cc
4583         (Sized_incremental_binary::find_incremental_inputs_sections):
4584         Rename do_find_incremental_inputs_sections to this.
4585         (Sized_incremental_binary::setup_readers): New function.
4586         (Sized_incremental_binary::do_check_inputs): Check
4587         has_incremental_info_ flag; move setup code to setup_readers;
4588         use input readers.
4589         (Sized_incremental_binary::do_file_is_unchanged): New function.
4590         (Sized_incremental_binary::do_get_input_reader): New function.
4591         * incremental.h (class Incremental_binary): Move to end of file.
4592         (Incremental_binary::file_is_unchanged): New function.
4593         (Incremental_binary::do_file_is_unchanged): New function.
4594         (Incremental_binary::Input_reader): New class.
4595         (Incremental_binary::get_input_reader): New function.
4596         (class Sized_incremental_binary): Move to end of file.
4597         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4598         input section reader classes.
4599         (Sized_incremental_binary::has_incremental_info): New function.
4600         (Sized_incremental_binary::inputs_reader): New function.
4601         (Sized_incremental_binary::symtab_reader): New function.
4602         (Sized_incremental_binary::relocs_reader): New function.
4603         (Sized_incremental_binary::got_plt_reader): New function.
4604         (Sized_incremental_binary::do_file_is_unchanged): New function.
4605         (Sized_incremental_binary::Sized_input_reader): New class.
4606         (Sized_incremental_binary::get_input_reader): New function.
4607         (Sized_incremental_binary::find_incremental_inputs_sections):
4608         Rename do_find_incremental_inputs_sections to this.
4609         (Sized_incremental_binary::setup_readers): New function.
4610         (Sized_incremental_binary::has_incremental_info_): New data member.
4611         (Sized_incremental_binary::inputs_reader_): New data member.
4612         (Sized_incremental_binary::symtab_reader_): New data member.
4613         (Sized_incremental_binary::relocs_reader_): New data member.
4614         (Sized_incremental_binary::got_plt_reader_): New data member.
4615         (Sized_incremental_binary::current_input_file_): New data member.
4616
4617 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4618
4619         PR gold/12640
4620         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4621         violation.
4622
4623 2011-03-30  Cary Coutant  <ccoutant@google.com>
4624
4625         * archive.cc (Archive::include_member): Adjust call to report_object.
4626         (Add_archive_symbols::run): Add script_info to call to
4627         report_archive_begin.
4628         (Lib_group::include_member): Adjust call to report_object.
4629         (Add_lib_group_symbols::run): Adjust call to report_object.
4630         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4631         blocks.  Add object count for script input files.
4632         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4633         script_info parameter; change all callers.
4634         (Incremental_inputs::report_object): Add script_info parameter;
4635         change all callers.
4636         (Incremental_inputs::report_script): Store backpointer to
4637         incremental info entry.
4638         (Output_section_incremental_inputs::set_final_data_size): Record
4639         additional information for scripts.
4640         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4641         * incremental.h (Incremental_script_entry::add_object): New function.
4642         (Incremental_script_entry::get_object_count): New function.
4643         (Incremental_script_entry::get_object): New function.
4644         (Incremental_script_entry::objects_): New data member; adjust
4645         constructor.
4646         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4647         (Incremental_inputs::report_object): Add script_info parameter.
4648         (Incremental_inputs_reader::get_object_count): New function.
4649         (Incremental_inputs_reader::get_object_offset): New function.
4650         * options.cc (Input_arguments::add_file): Return reference to
4651         new input argument.
4652         * options.h (Input_argument::set_script_info): New function.
4653         (Input_argument::script_info): New function.
4654         (Input_argument::script_info_): New data member; adjust all
4655         constructors.
4656         (Input_file_group::add_file): Return reference to new input argument.
4657         (Input_file_lib::add_file): Likewise.
4658         (Input_arguments::add_file): Likewise.
4659         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4660         * script.cc (Parser_closure::Parser_closure): Add script_info
4661         parameter; adjust all callers.
4662         (Parser_closure::script_info): New function.
4663         (Parser_closure::script_info_): New data member.
4664         (read_input_script): Report scripts earlier to incremental info.
4665         (script_add_file): Set script_info in Input_argument.
4666         (script_add_library): Likewise.
4667         * script.h (Script_options::Script_info): Rewrite class.
4668
4669 2011-03-29  Cary Coutant  <ccoutant@google.com>
4670
4671         * archive.cc (Library_base::should_include_member): Move
4672         method here from class Archive.
4673         (Archive::Archive): Initialize base class.
4674         (Archive::should_include_member): Move to base class.
4675         (Archive::do_for_all_unused_symbols): New function.
4676         (Add_archive_symbols::run): Remove redundant access to
4677         incremental_inputs.
4678         (Lib_group::Lib_group): Initialize base class.
4679         (Lib_group::do_filename): New function.
4680         (Lib_group::include_member): Pass pointer to Lib_group to
4681         report_object.
4682         (Lib_group::do_for_all_unused_symbols): New function.
4683         (Add_lib_group_symbols::run): Report archive information for
4684         incremental links.
4685         * archive.h (class Library_base): New base class.
4686         (class Archive): Derive from Library_base.
4687         (Archive::filename): Move to base class.
4688         (Archive::set_incremental_info): Likewise.
4689         (Archive::incremental_info): Likewise.
4690         (Archive::Should_include): Likewise.
4691         (Archive::should_include_member): Likewise.
4692         (Archive::Armap_entry): Remove.
4693         (Archive::Unused_symbol_iterator): Remove.
4694         (Archive::unused_symbols_begin): Remove.
4695         (Archive::unused_symbols_end): Remove.
4696         (Archive::do_filename): New function.
4697         (Archive::do_get_mtime): New function.
4698         (Archive::do_for_all_unused_symbols): New function.
4699         (Archive::task_): Move to base class.
4700         (Archive::incremental_info_): Likewise.
4701         (class Lib_group): Derive from Library_base.
4702         (Lib_group::do_filename): New function.
4703         (Lib_group::do_get_mtime): New function.
4704         (Lib_group::do_for_all_unused_symbols): New function.
4705         (Lib_group::task_): Move to base class.
4706         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4707         function.
4708         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4709         function.
4710         * incremental.cc (Incremental_inputs::report_archive_begin):
4711         Use Library_base; call library's get_mtime; add incremental inputs
4712         entry before members.
4713         (class Unused_symbol_visitor): New class.
4714         (Incremental_inputs::report_archive_end): Use Library_base; use
4715         visitor class to record unused symbols; don't add incremental inputs
4716         entry after members.
4717         (Incremental_inputs::report_object): Use Library_base.
4718         * incremental.h
4719         (Incremental_archive_entry::Incremental_archive_entry): Remove
4720         unused Archive parameter.
4721         (Incremental_inputs::report_archive_begin): Use Library_base.
4722         (Incremental_inputs::report_archive_end): Likewise.
4723         (Incremental_inputs::report_object): Likewise.
4724         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4725         function.
4726         * object.h (Object::for_all_global_symbols): New function.
4727         (Object::do_for_all_global_symbols): New function.
4728         (Sized_relobj::do_for_all_global_symbols): New function.
4729         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4730         function.
4731         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4732         function.
4733
4734 2011-03-27  Ian Lance Taylor  <iant@google.com>
4735
4736         * archive.cc (Archive::interpret_header): Return -1 if something
4737         goes wrong.  Change callers accordingly.
4738
4739 2011-03-25  Cary Coutant  <ccoutant@google.com>
4740
4741         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4742         * testsuite/Makefile.in: Regenerate.
4743
4744 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4745
4746         * plugin.cc (get_view): New.
4747         (Plugin::load): Pass get_view to the plugin.
4748         (Plugin_manager::get_view): New.
4749
4750 2011-03-21  Ian Lance Taylor  <iant@google.com>
4751
4752         * testsuite/final_layout.sh: Rewrite to not use dc.
4753         * testsuite/relro_test.sh: Fail if dc is not present.
4754
4755 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4756
4757         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4758         Change == to -eq.
4759         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4760         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4761         Change == to -eq.
4762         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4763         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4764
4765 2011-03-14  Ian Lance Taylor  <iant@google.com>
4766
4767         * script-sections.cc (Sort_output_sections::script_compare):
4768         Rename from is_before, change return type.
4769         (Sort_output_sections::operator()): Adjust accordingly.
4770
4771 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4772
4773         PR gold/12572
4774         * testsuite/odr_violation2.cc: Add comment to make all error line
4775         numbers double digits.
4776         * testsuite/debug_msg.sh: Adjust expected errors.
4777
4778 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4779
4780         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4781         but mark earlier ones as non-canonical
4782         (offset_to_iterator): Update search target and example
4783         (do_addr2line): Return extra lines in a vector*
4784         (format_file_lineno): Extract from do_addr2line
4785         (one_addr2line): Add vector* out-param
4786         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4787         when a lineno entry appeared last for its instruction
4788         (Dwarf_line_info): Add vector* out-param
4789         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4790         * symtab.cc (Odr_violation_compare): Include the lineno in the
4791         comparison again.
4792         (linenos_from_loc): New. Combine the canonical line for an
4793         address with its other lines.
4794         (True_if_intersect): New. Helper functor to make
4795         std::set_intersection a query.
4796         (detect_odr_violations): Compare sets of lines instead of just
4797         one line for each function. This became less deterministic, but
4798         has fewer false positives.
4799         * symtab.h: Declarations.
4800         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4801         mix an optimized and non-optimized object in the same binary
4802         (odr_violation2.so): Same.
4803         * testsuite/Makefile.in: Regenerate from Makefile.am.
4804         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4805         * testsuite/debug_msg.sh: Update line numbers and add
4806         assertions.
4807         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4808         non-optimized context.
4809         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4810         isn't inlined, and use OdrDerived in an optimized context.
4811         * testsuite/odr_header1.h: Defines OdrDerived, where
4812         optimization will change the
4813         first-instruction-in-the-destructor's file and line number.
4814         * testsuite/odr_header2.h: Defines OdrBase.
4815
4816 2011-03-09  Ian Lance Taylor  <iant@google.com>
4817
4818         * fileread.cc (File_read::clear_views): Don't delete the whole
4819         file view.
4820
4821 2011-03-08  Ian Lance Taylor  <iant@google.com>
4822
4823         PR gold/12525
4824         * fileread.cc: #include <climits>.
4825         (GOLD_IOV_MAX): Define.
4826         (File_read::read_multiple): Limit number of entries by iov_max.
4827         * fileread.h (class File_read): Always set max_readv_entries to
4828         128.
4829
4830 2011-03-07  Ian Lance Taylor  <iant@google.com>
4831
4832         PR gold/12525
4833         * options.h (class General_options): Add -dy and -dn.
4834
4835 2011-03-02  Cary Coutant  <ccoutant@google.com>
4836
4837         * testsuite/script_test_9.t: Add TLS segment.
4838
4839 2011-03-02  Simon Baldwin  <simonb@google.com>
4840
4841         * configure.ac: Add check for gnu_indirect_function support in
4842         the toolchain building binutils.
4843         * configure: Rebuild.
4844
4845 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4846
4847         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4848         plugin only symbols.
4849         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4850         in plugin files as not needed in the symbol table.
4851
4852 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4853
4854         * output.cc (Output_section::add_input_section): Delay fill
4855         generation for section ordering.
4856
4857 2011-02-09  Ian Lance Taylor  <iant@google.com>
4858
4859         PR gold/12316
4860         * object.h (class Sized_relobj): Remove clear_local_symbols.
4861         * reloc.cc (Sized_relobj::do_relocate): Don't call
4862         clear_local_symbols.
4863
4864 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4865
4866         * plugin.cc (is_visible_from_outside): Return true for symbols
4867         in the -u option.
4868
4869 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4870
4871         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4872         filename.
4873
4874 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4875
4876         * icf.h (is_section_foldable_candidate): Change type of parameter
4877         to std::string.
4878         * icf.cc (Icf::find_identical_sections): Change type of local variable
4879         section_name to be std::string.
4880         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4881
4882 2011-01-25  Ian Lance Taylor  <iant@google.com>
4883
4884         * script.cc (script_add_extern): Rewrite to use
4885         add_symbol_reference.
4886
4887 2011-01-25  Doug Kwan  <dougkwan@google.com>
4888
4889         * icf.cc (get_section_contents): Always lock section's object.
4890
4891 2011-01-24  Ian Lance Taylor  <iant@google.com>
4892
4893         * options.h (class General_options): Accept
4894         --no-detect-odr-violations.
4895
4896 2011-01-24  Ian Lance Taylor  <iant@google.com>
4897
4898         * version.cc (version_string): Bump to 1.11.
4899
4900 2011-01-24  Ian Lance Taylor  <iant@google.com>
4901
4902         * plugin.cc (class Plugin_rescan): Define new class.
4903         (Plugin_manager::claim_file): Set any_claimed_.
4904         (Plugin_manager::save_archive): New function.
4905         (Plugin_manager::save_input_group): New function.
4906         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4907         necessary.
4908         (Plugin_manager::new_undefined_symbol): New function.
4909         (Plugin_manager::rescan): New function.
4910         (Plugin_manager::rescannable_defines): New function.
4911         (Plugin_manager::add_input_file): Set any_added_.
4912         * plugin.h (class Plugin_manager): define new fields rescannable_,
4913         undefined_symbols_, any_claimed_, and any_added_.  Declare
4914         Plugin_rescan as friend.  Declare new functions.
4915         (Plugin_manager::Rescannable): Define type.
4916         (Plugin_manager::Rescannable_list): Define type.
4917         (Plugin_manager::Undefined_symbol_list): Define type.
4918         (Plugin_manager::Plugin_manager): Initialize new fields.
4919         * archive.cc (Archive::defines_symbol): New function.
4920         (Add_archive_symbols::run): Pass archive to plugins if any.
4921         * archive.h (class Archive): Declare defines_symbol.
4922         * readsyms.cc (Input_group::~Input_group): New function.
4923         (Finish_group::run): Pass input_group to plugins if any.
4924         * readsyms.h (class Input_group): Declare destructor.
4925         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4926         any.
4927
4928 2011-01-10  Ian Lance Taylor  <iant@google.com>
4929
4930         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4931         section as relro.
4932         (Layout::set_segment_offsets): Reset increase_relro before calling
4933         set_section_addresses a second time.
4934
4935 2011-01-04  Cary Coutant  <ccoutant@google.com>
4936
4937         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4938         sections before NOBITS sections.
4939
4940 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4941
4942         * version.cc (print_version): Update copyright to 2011.
4943
4944 2010-12-23  Cary Coutant  <ccoutant@google.com>
4945
4946         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4947         of OS to this->add.  Add OD parameter to second form of the function.
4948
4949 2010-12-20  Ian Lance Taylor  <iant@google.com>
4950
4951         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4952         second of two consecutive entries with same offset.
4953
4954 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4955
4956         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4957         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4958         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4959         to avoid unneeded links against $(LDADD).
4960         * testsuite/Makefile.in: Regenerate.
4961
4962 2010-12-15  Ian Lance Taylor  <iant@google.com>
4963
4964         PR gold/12324
4965         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4966         for R_X86_64_32 and R_X86_64_PC32.
4967         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4968         ver_matching_def_pic.o.
4969         (ver_matching_def_pic.o): New target.
4970
4971 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4972
4973         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4974         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4975         Move definition before File_read::View member definitions.
4976         (File_read::View::~View): Initialize and hold lock before
4977         updating current_mapped_bytes.
4978
4979 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4980
4981         * dwarf_reader.cc: Remove outdated comment.
4982         * gold-threads.cc: Fix typo in error message.
4983         * archive.cc: Fix typos in comments.
4984         * archive.h: Likewise.
4985         * arm-reloc-property.cc: Likewise.
4986         * arm-reloc-property.h: Likewise.
4987         * arm-reloc.def: Likewise.
4988         * arm.cc: Likewise.
4989         * attributes.h: Likewise.
4990         * cref.cc: Likewise.
4991         * ehframe.cc: Likewise.
4992         * fileread.h: Likewise.
4993         * gold.h: Likewise.
4994         * i386.cc: Likewise.
4995         * icf.cc: Likewise.
4996         * incremental.h: Likewise.
4997         * int_encoding.cc: Likewise.
4998         * layout.h: Likewise.
4999         * main.cc: Likewise.
5000         * merge.h: Likewise.
5001         * object.cc: Likewise.
5002         * object.h: Likewise.
5003         * options.cc: Likewise.
5004         * readsyms.cc: Likewise.
5005         * reduced_debug_output.cc: Likewise.
5006         * reloc.cc: Likewise.
5007         * script-sections.cc: Likewise.
5008         * sparc.cc: Likewise.
5009         * symtab.h: Likewise.
5010         * target-reloc.h: Likewise.
5011         * target.cc: Likewise.
5012         * target.h: Likewise.
5013         * timer.cc: Likewise.
5014         * timer.h: Likewise.
5015         * x86_64.cc: Likewise.
5016
5017 2010-12-09  Cary Coutant  <ccoutant@google.com>
5018
5019         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5020         stack.
5021         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5022         parameter; change all callers.
5023         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5024         * options.h (warn_execstack): New option.
5025
5026 2010-12-07  Doug Kwan  <dougkwan@google.com>
5027
5028         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5029         like function call relocations.
5030
5031 2010-12-07  Ian Lance Taylor  <iant@google.com>
5032
5033         * archive.cc (Archive::get_elf_object_for_member): Permit
5034         punconfigured to be NULL.
5035         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5036         (Archive::include_member): Pass NULL to get_elf_object_for_member
5037         if we searched for the archive and this is the first included
5038         object.
5039
5040 2010-12-01  Ian Lance Taylor  <iant@google.com>
5041
5042         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5043         track_relocs_type_ field.
5044         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5045         Set track_relocs_type_.
5046         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5047         contents when using RELA relocs.
5048         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5049         reloc_map_.
5050         * reloc.cc (Track_relocs::next_addend): New function.
5051         * reloc.h (class Track_relocs): Declare next_addend.
5052
5053 2010-12-01  Ian Lance Taylor  <iant@google.com>
5054
5055         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5056         virtual destructor.
5057
5058 2010-12-01  Ian Lance Taylor  <iant@google.com>
5059
5060         * README: Update compilers known to work and fail.
5061
5062 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5063
5064         * configure.in: For --enable-gold, handle value `default' instead of
5065         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5066         not the default.
5067         * configure: Regenerate.
5068
5069 2010-11-18  Doug Kwan  <dougkwan@google.com>
5070
5071         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5072         and right_alignment to be zero.  Store result alignment only if it is
5073         greater than existing alignment.
5074
5075 2010-11-16  Cary Coutant  <ccoutant@google.com>
5076
5077         PR gold/12220
5078         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5079         Check for ".zdebug_line".
5080
5081 2010-11-16  Doug Kwan  <dougkwan@google.com>
5082             Cary Coutant  <ccoutant@google.com>
5083
5084         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5085         by reference; adjust all callers.
5086         * output.cc (Output_segment::set_section_addresses): Adjust references
5087         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5088         list is empty.
5089         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5090         end at page boundary.
5091
5092 2010-11-16  Cary Coutant  <ccoutant@google.com>
5093
5094         PR gold/12220
5095         * layout.cc (Layout::choose_output_section): Transform names of
5096         compressed sections even when using a script with a SECTIONS clause.
5097         (Layout::output_section_name): Remove code to transform
5098         compressed debug section names.
5099         * output.cc (Output_section::add_input_section): Use uncompressed
5100         section size when tracking input sections.
5101
5102 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5103
5104         * symtab.h (Symbol::NON_PIC_REF): Remove.
5105         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5106         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5107         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5108         (Symbol::use_plt_offset): Take a flags argument and pass it
5109         directly to needs_dynamic_reloc.  Restrict check for undefined
5110         weak symbols to function calls.
5111         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5112         (Target_arm::Scan::global): Use it.
5113         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5114         (Target_arm::Relocate::relocate): Likewise.
5115         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5116         parameter with an r_type parameter.  Use get_reference_flags
5117         to get the flags.
5118         (Target_arm::Relocate::relocate): Update accordingly.
5119         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5120         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5121         (Target_i386::Scan::global): Likewise.
5122         (Target_i386::Relocate::relocate): Likewise.
5123         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5124         parameter with an r_type parameter.  Use get_reference_flags
5125         to get the flags.
5126         (Target_i386::Relocate::relocate): Update accordingly.
5127         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5128         (Target_powerpc::Scan::global): Use it.
5129         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5130         (Target_powerpc::Relocate::relocate): Likewise.
5131         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5132         (Target_sparc::Scan::global): Use it.
5133         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5134         (Target_sparc::Relocate::relocate): Likewise.
5135         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5136         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5137         (Target_x86_64::Scan::global): Likewise.
5138         (Target_x86_64::Relocate::relocate): Likewise.
5139
5140 2010-11-08  Doug Kwan  <dougkwan@google.com>
5141             Cary Coutant  <ccoutant@google.com>
5142
5143         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5144         (Arm_exidx_merge_section::section_contents_): New data member.
5145         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5146         (Arm_input_section::~Arm_input_section): De-allocate memory.
5147         (Arm_input_section::original_contents_): New data member.
5148         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5149         in parameters instead of calling Object::section_contents without
5150         locking.
5151         (Arm_output_section::group_section): New parameter TASK.  Pass it
5152         to callees that need locking objects.
5153         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5154         to lock EXIDX input sections.  Fix a formatting issue.  Call
5155         Arm_exidx_merged_section::build_contents to create merged section
5156         contents.
5157         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5158         to lock object of stub table owner.
5159         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5160         TEXT_SIZE to initialize data member TEXT_SIZE_.
5161         (Arm_exidx_input_section::addralign): Fix typo in comment.
5162         (Arm_exidx_input_section::text_size): New method.
5163         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5164         that require locking objects.  Lock objects before scanning for stubs
5165         and updating local symbols.
5166         (Arm_input_section<big_endian>::init): Copy contents of original
5167         input section.
5168         (Arm_input_section<big_endian>::do_write): Use saved contents of
5169         original input section instead of calling Object::section_contents
5170         without locking.
5171         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5172         size without calling Object::section_size().
5173         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5174         for size.  Allocate a buffer for merged EXIDX entries.
5175         (Arm_exidx_merged_section::build_contents): New method.
5176         (Arm_exidx_merged_section::do_write): Move merge section contents
5177         building code to Arm_exidx_merged_section::build_contetns.  Write
5178         out contetns in buffer instead of building it on the fly.
5179         (Arm_relobj::make_exidx_input_section): Also pass text section size
5180         to Arm_exidx_input_section constructor.
5181         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5182         (Arm_dynobj::do_read_symbols): Fix memory leak.
5183         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5184         * target.h: (class Task): Add forward declaration.
5185         (Target::relax): Add new parameter TASK and pass it to
5186         Target::do_relax().
5187         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5188
5189 2010-11-05  Cary Coutant  <ccoutant@google.com>
5190
5191         PR gold/10708
5192         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5193         object when reading from the file.
5194         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5195         second layout pass.
5196         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5197         when reading section contents.
5198         (get_section_contents): Likewise.
5199         (icf::find_identical_sections): Likewise.
5200         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5201         object when reading from the file.
5202         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5203         the object when doing deferred section layout.
5204
5205 2010-11-03  Nick Clifton  <nickc@redhat.com>
5206
5207         PR gold/12001
5208         * script.h (class Symbol_assignment: name): New member.  Returns
5209         the name of the symbol.
5210         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5211         Returns true if the given symbol name is on the list of
5212         assignments wating to be processed.
5213         * archive.cc (should_incldue_member): If the symbol is undefined,
5214         check to see if it is on the list of symbols pending assignment.
5215
5216 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5217
5218         * script-sections.cc (Script_sections::find_memory_region): Check
5219         for a NULL output section pointer.
5220
5221 2010-10-29  Doug Kwan  <dougkwan@google.com>
5222
5223         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5224         Output_section::add_relaxed_input_section.
5225         * output.cc (Output_section::add_relaxed_input_section): Add new
5226         arguments LAYOUT and NAME.  Set section order index.
5227         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5228         Copy section order index.
5229         * output.h (Output_section::add_relaxed_input_section): Add new
5230         arguments LAYOUT and NAME.
5231
5232 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5233
5234         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5235         NATIVE_OR_CROSS_LINKER.
5236         * testsuite/Makefile.in: Regenerate.
5237
5238 2010-10-20  Doug Kwan  <dougkwan@google.com>
5239
5240         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5241         without SHF_LINK_ORDER flags.
5242         * layout.cc (Layout::choose_output_section): Do not filter
5243         SHF_LINK_ORDER flag in a relocatable link.
5244
5245 2010-10-17  Cary Coutant  <ccoutant@google.com>
5246
5247         * output.h (Output_segment::set_section_addresses): Change function
5248         signature.  Update all callers.
5249         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5250         sections.
5251         (Output_segment::set_section_addresses): Align after last TLS
5252         section.  Add padding before last relro section instead of after.
5253
5254 2010-10-17  Doug Kwan  <dougkwan@google.com>
5255
5256         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5257         GOT output section to be writable.
5258
5259 2010-10-14  Cary Coutant  <ccoutant@google.com>
5260
5261         * debug.h (DEBUG_INCREMENTAL): New flag.
5262         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5263         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5264         mode.
5265         * incremental.cc (report_command_line): Ignore all forms of
5266         --incremental.
5267         * layout.cc (Layout::Layout): Check parameters for incremental link
5268         mode.
5269         * options.cc (General_options::parse_incremental): New function.
5270         (General_options::parse_no_incremental): New function.
5271         (General_options::parse_incremental_full): New function.
5272         (General_options::parse_incremental_update): New function.
5273         (General_options::incremental_mode_): New data member.
5274         (General_options::finalize): Check incremental_mode_.
5275         * options.h (General_options): Update help text for --incremental.
5276         Add --no-incremental, --incremental-full, --incremental-update.
5277         (General_options::Incremental_mode): New enum type.
5278         (General_options::incremental_mode): New function.
5279         (General_options::incremental_mode_): New data member.
5280         * parameters.cc (Parameters::incremental_mode_): New data member.
5281         (Parameters::set_options): Set incremental_mode_.
5282         (Parameters::set_incremental_full): New function.
5283         (Parameters::incremental): New function.
5284         (Parameters::incremental_update): New function.
5285         (set_parameters_incremental_full): New function.
5286         * parameters.h (Parameters::set_incremental_full): New function.
5287         (Parameters::incremental): New function.
5288         (Parameters::incremental_update): New function.
5289         (Parameters::incremental_mode_): New data member.
5290         (set_parameters_incremental_full): New function.
5291         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5292         incremental link mode.
5293         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5294         (Sized_relobj::do_relocate_sections): Likewise.
5295         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5296         option.
5297         * testsuite/Makefile.in: Regenerate.
5298         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5299
5300 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5301
5302         * script-sections.h (class Script_sections): Make
5303         Sections_elements typedef public.
5304         * script-sections.cc (class Sort_output_sections): Add elements_
5305         field.  Add constructor which sets it; change all callers.
5306         (Sort_output_sections::is_before): New function.
5307         (Sort_output_sections::operator()): Call is_before.
5308         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5309         conditional.
5310         * testsuite/script_test_10.sh: New test. Test script section
5311         order.
5312         * testsuite/script_test_10.t: Likewise.
5313         * testsuite/script_test_10.s: Likewise.
5314         * testsuite/Makefile.am: Wrap the cross linker tests and the
5315         common tests into NATIVE_OR_CROSS_LINKER.
5316         (check_SCRIPTS): Add script_test_10.sh.
5317         (check_DATA): Add script_test_10.stdout.
5318         (script_test_10.o, script_test_10): New targets.
5319         (script_test_10.stdout): New target.
5320         * configure, testsuite/Makefile.in: Regenerate.
5321
5322 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5323
5324         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5325         error for the deprecated relocations.
5326         (Target_arm::Scan::global): Likewise.
5327         (Target_arm::Relocate::relocate): Likewise.
5328
5329 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5330
5331         * fileread.cc (Input_file::find_file): Initialize *found_name
5332         and *namep when using the fallback search for case 4.
5333
5334 2010-10-11  Cary Coutant  <ccoutant@google.com>
5335
5336         * options.h (class General_options): Redefine -z lazy as an alias for
5337         the negation of -z now.
5338
5339 2010-10-11  Ian Lance Taylor  <iant@google.com>
5340
5341         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5342         binding.
5343
5344 2010-10-06  Nick Clifton  <nickc@redhat.com>
5345
5346         * script-sections.cc(class Memory_region): Remove
5347         current_lma_offset_ field.  Rename current_vma_offset_ to
5348         current_offset_.  Add last_section_ field.
5349         (Memory_region::get_current_vma_address): Rename to
5350         get_current_address.
5351         (Memory_region::get_current_lma_address): Delete.
5352         (Memory_region::increment_vma_offset): Rename to
5353         increment_offset.
5354         (Memory_region::increment_lma_offset): Delete.
5355         (Memory_region::attributes_compatible): New method.  Returns
5356         true if the provided section is compatible with the region.
5357         (Memory_region::get_last_section): New method.  Returns the last
5358         section to use the region.
5359         (Memory_region::set_last_section): New method.  Stores the last
5360         section to use the region.
5361         (Script_sections::block_in_region): New method.  Returns true if
5362         a block of memory is contained within a region.
5363         (Script_sections::find_memory_region): New method.  Locates a
5364         memory region to be used to set a VMA or LMA address.
5365         (Output_section_definition::set_section_addresses): Add code to
5366         check for addresses set by memory regions.
5367         (Output_segment::set_section_addresses): Remove memory region
5368         walking code.
5369         (Script_sections::create_segment): Add a warning if a header
5370         segment is created outside of any region.
5371         * script-sections.h (class Script_sections): Add prototypes for
5372         find_memory_region and block_in_region methods.
5373         * testsuite/memory_test.s: Use .long instead of .word.
5374         * testsuite/memory_test.t: Add some more output sections.
5375         * testsuite/memory_test.sh: Update expected output.
5376
5377 2010-10-02  Doug Kwan  <dougkwan@google.com>
5378
5379         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5380         defintion to symtab.h
5381         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5382         declaration to defintion.
5383
5384 2010-10-01  Nick Clifton  <nickc@redhat.com>
5385
5386         * expression.cc (eval): Replace dummy argument with NULL.
5387         (eval_maybe_dot): Check for a NULL result section pointer.
5388         (Symbol_expression::value): Likewise.
5389         (Dot_expression::value): Likewise.
5390         (BINARY_EXPRESSION): Likewise.
5391         (Max_expression::value): Likewise.
5392         (Min_expression::value): Likewise.
5393         (Absolute_expression::value): Likewise.
5394         (Addr_expression::value_from_output_section): Likewise.
5395         (Loaddddr_expression::value_from_output_section): Likewise.
5396         (Segment_start_expression::value): Likewise.
5397         * script-sections.cc
5398         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5399         argument with NULL.
5400         (Sections_elememt_dot_assignment::set_section_addresses):
5401         Likewise.
5402         (Output_data_expression::do_write_to_buffer): Likewise.
5403         (Output_section_definition::finalize_symbols): Likewise.
5404         (Output_section_definition::set_section_addresses): Likewise.
5405
5406 2010-09-30  Doug Kwan  <dougkwan@google.com>
5407
5408         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5409
5410 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5411
5412         * target.h (Target::can_icf_inline_merge_sections): New virtual
5413         function.
5414         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5415         virtual function.
5416         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5417         virtual function.
5418         * icf.cc (get_section_contents): Inline merge sections only when
5419         target allows it.
5420
5421 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5422
5423         * configure: Regenerate.
5424
5425 2010-09-17  Ian Lance Taylor  <iant@google.com>
5426
5427         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5428         * testsuite/Makefile.am (memory_test.o): New target.
5429         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5430         memory_test.t.
5431         * testsuite/Makefile.in: Rebuild.
5432
5433 2010-09-17  Doug Kwan  <dougkwan@google.com>
5434
5435         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5436         defintion if relocation uses GOT entries of the symbol.
5437         * testsuite/icf_safe_test.sh: Fix test.
5438         * testsuite/icf_safe_so_test.sh: Fix test.
5439
5440 2010-09-16  Cary Coutant  <ccoutant@google.com>
5441
5442         * script_sections.cc (class Memory_region): Remove "NULL" from
5443         vector initializations.
5444
5445 2010-09-15  Cary Coutant  <ccoutant@google.com>
5446
5447         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5448         Resolve forwarding symbols.
5449
5450 2010-09-15  Doug Kwan  <dougkwan@google.com>
5451
5452         * gold/testsuite/script_test_3.t: Add ARM special sections.
5453         * gold/testsuite/script_test_4.t: Same.
5454         * gold/testsuite/script_test_5.t: Same.
5455         * gold/testsuite/script_test_6.t: Same.
5456         * gold/testsuite/script_test_7.t: Same.
5457         * gold/testsuite/script_test_7.t: Same.
5458         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5459
5460 2010-09-14  Cary Coutant  <ccoutant@google.com>
5461
5462         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5463         (Target_x86_64::Relocate::relocate_tls): Replace check for
5464         saw_tls_block_reloc_ with test for executable section.
5465
5466 2010-09-12  Cary Coutant  <ccoutant@google.com>
5467
5468         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5469         position-independent executables to shared libraries need dynamic
5470         relocations.
5471         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5472         position-independent executables.
5473         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5474         * testsuite/Makefile.in: Regenerate.
5475
5476 2010-09-10  Nick Clifton  <nickc@redhat.com>
5477
5478         PR gold/11997
5479         * testsuite/memory_test.t: Discard any sections that are not
5480         needed.
5481
5482 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5483
5484         PR gold/11996
5485         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5486         "This::" to work around a bug in gcc 4.2.
5487
5488         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5489
5490 2010-09-09  Rafael Espindola  <espindola@google.com>
5491
5492         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5493         sections with different PF_X flags in the same segment.
5494         (Layout::find_first_load_seg): Search all segments to find the first
5495         one.
5496         * options.h (rosegment): New.
5497
5498 2010-09-08  Rafael Espindola  <espindola@google.com>
5499
5500         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5501
5502 2010-09-08  Doug Kwan  <dougkwan@google.com>
5503
5504         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5505         (Arm_relobj::do_relocate_sections): Add new parameter for output
5506         file to match the parent.
5507         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5508         of local symbols instead of input values.  Update code to track
5509         changes in gold::relocate_section.
5510         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5511         (Sized_relobj::compute_final_local_value_internal): New methods.
5512         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5513         body into private version of Sized_relobj::compute_final_local_value.
5514         Call the inline method.
5515         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5516         merged symbol value if there is one.
5517         (Symbol_value::has_output_value): New method defintiion.
5518         (Sized_relobj::Compute_final_local_value_status): New enum type.
5519         (Sized_relobj::compute_final_local_value): New methods.
5520         (Sized_relobj::compute_final_local_value_internal): New methods.
5521         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5522         and arm_cortex_a8.sh.
5523         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5524         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5525         New tests.
5526         * Makefile.in: Regenerate.
5527         * testsuite/arm_bl_out_of_range.s: Update test.
5528         * testsuite/thumb_bl_out_of_range.s: Ditto.
5529         * testsuite/thumb_blx_out_of_range.s: Ditto.
5530         * testsuite/arm_branch_out_of_range.sh: New file.
5531         * testsuite/arm_cortex_a8.sh: Ditto.
5532         * testsuite/arm_cortex_a8_b.s: Ditto.
5533         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5534         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5535         * testsuite/arm_cortex_a8_bl.s: Ditto.
5536         * testsuite/arm_cortex_a8_blx.s: Ditto.
5537         * testsuite/arm_cortex_a8_local.s: Ditto.
5538         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5539         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5540
5541 2010-09-08  Rafael Espindola  <espindola@google.com>
5542
5543         * Makefile.am (memory_test.stdout): Run readelf with -W.
5544         * Makefile.in: Regenerate.
5545         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5546         64 bit output.
5547
5548 2010-09-08  Rafael Espindola  <espindola@google.com>
5549
5550         * script-sections.cc (Script_sections::add_memory_region): Convert
5551         field precision to int.
5552         * script.cc (script_set_section_region, script_set_section_region):
5553         Convert field precision to int.
5554
5555 2010-09-08  Rafael Espindola  <espindola@google.com>
5556
5557         * arm.cc (do_finalize_sections): Create the __exidx_start and
5558         __exdix_end symbols even when the section is missing.
5559
5560 2010-09-08  Nick Clifton  <nickc@redhat.com>
5561
5562         * README: Remove claim that MEMORY is not supported.
5563         * expression.cc (script_exp_function_origin)
5564         (script_exp_function_length): Move from here to ...
5565         * script.cc: ... here.
5566         (script_set_section_region, script_add_memory)
5567         (script_parse_memory_attr, script_include_directive): New
5568         functions.
5569         * script-sections.cc
5570         (class Memory_region): New class.
5571         (class Output_section_definition): Add set_memory_region,
5572         set_section_vma, set_section_lma and get_section_name methods.
5573         (class Script_Sections): Add add_memory_region,
5574         find_memory_region, find_memory_region_origin,
5575         find_memory_region_length and set_memory_region methods.
5576         Have set_section_addresses method walk the list of set memory
5577         regions.
5578         Extend the print methos to display memory regions.
5579         * script-sections.h: Add prototypes for new methods.
5580         Add enum for MEMORY region attributes.
5581         * yyscript.y: Add support for parsing MEMORY regions.
5582         * script-c.h: Add prototypes for new functions.
5583         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5584         * testsuite/Makefile.in: Regenerate.
5585         * testsuite/memory_test.sh: New script.
5586         * testsuite/memory_test.s: New assembler source file.
5587         * testsuite/memory_test.t: New linker script.
5588
5589 2010-08-27  Doug Kwan  <dougkwan@google.com>
5590
5591         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5592         reference override an existing dynamic weak reference.
5593         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5594         * testsuite/Makefile.in: Regenerate.
5595         * testsuite/dyn_weak_ref.sh: New file.
5596         * testsuite/dyn_weak_ref_1.c: Ditto.
5597         * testsuite/dyn_weak_ref_2.c: Ditto.
5598
5599 2010-08-27  Ian Lance Taylor  <iant@google.com>
5600
5601         * incremental.h (class Incremental_input_entry): Add virtual
5602         destructor.
5603
5604 2010-08-27  Ian Lance Taylor  <iant@google.com>
5605
5606         * testsuite/start_lib_test_3.c: Mark t3 as used.
5607
5608 2010-08-27  Nick Clifton  <nickc@redhat.com>
5609
5610         * options.cc (version_script): Fix small typo in previous
5611         whitespace tidyup.
5612
5613 2010-08-25  Nick Clifton  <nickc@redhat.com>
5614
5615         * archive.cc: Formatting fixes: Remove whitespace between
5616         typename and following asterisk.  Remove whitespace between
5617         function name and opening parenthesis.
5618         * archive.h: Likewise.
5619         * arm.cc: Likewise.
5620         * attributes.cc: Likewise.
5621         * attributes.h: Likewise.
5622         * common.cc: Likewise.
5623         * copy-relocs.cc: Likewise.
5624         * dirsearch.h: Likewise.
5625         * dynobj.cc: Likewise.
5626         * ehframe.cc: Likewise.
5627         * ehframe.h: Likewise.
5628         * expression.cc: Likewise.
5629         * fileread.cc: Likewise.
5630         * fileread.h: Likewise.
5631         * gc.h: Likewise.
5632         * gold-threads.cc: Likewise.
5633         * gold.cc: Likewise.
5634         * i386.cc: Likewise.
5635         * icf.h: Likewise.
5636         * incremental-dump.cc: Likewise.
5637         * incremental.cc: Likewise.
5638         * layout.cc: Likewise.
5639         * layout.h: Likewise.
5640         * main.cc: Likewise.
5641         * merge.cc: Likewise.
5642         * merge.h: Likewise.
5643         * object.cc: Likewise.
5644         * object.h: Likewise.
5645         * options.cc: Likewise.
5646         * options.h: Likewise.
5647         * output.cc: Likewise.
5648         * output.h: Likewise.
5649         * plugin.cc: Likewise.
5650         * plugin.h: Likewise.
5651         * powerpc.cc: Likewise.
5652         * reloc.cc: Likewise.
5653         * script-c.h: Likewise.
5654         * script-sections.cc: Likewise.
5655         * script.cc: Likewise.
5656         * stringpool.cc: Likewise.
5657         * symtab.cc: Likewise.
5658         * symtab.h: Likewise.
5659         * target.cc: Likewise.
5660         * timer.cc: Likewise.
5661         * timer.h: Likewise.
5662         * version.cc: Likewise.
5663         * x86_64.cc: Likewise.
5664
5665 2010-08-24  Nick Clifton  <nickc@redhat.com>
5666
5667         PR 11899
5668         * layout.cc (segment_precedes): Sort segments by their physical
5669         addresses, if they have been set.
5670
5671 2010-08-23  Cary Coutant  <ccoutant@google.com>
5672
5673         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5674         symbols data.
5675         (Lib_group::include_member): Unlock object after deleting its
5676         symbols data.
5677         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5678         the bug fixed here.
5679
5680 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5681             Cary Coutant  <ccoutant@google.com>
5682
5683         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5684         constructor, and set_blocker.
5685         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5686         readsyms_blocker_.
5687         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5688         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5689         * testsuite/Makefile.am (start_lib_test): New test case.
5690         * testsuite/Makefile.in: Regenerate.
5691         * testsuite/start_lib_test_main.c: New file.
5692         * testsuite/start_lib_test_1.c: New file.
5693         * testsuite/start_lib_test_2.c: New file.
5694         * testsuite/start_lib_test_3.c: New file.
5695
5696 2010-08-19  Ian Lance Taylor  <iant@google.com>
5697
5698         * Makefile.in: Rebuild with automake 1.11.1.
5699         * aclocal.m4: Likewise.
5700         * testsuite/Makefile.in: Likewise.
5701
5702 2010-08-19  Ian Lance Taylor  <iant@google.com>
5703
5704         PR 10893
5705         * i386.cc (class Output_data_plt_i386): Update declarations.
5706         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5707         local_ifuncs_ fields.
5708         (Target_i386::do_plt_section_for_global): New function.
5709         (Target_i386::do_plt_section_for_local): New function.
5710         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5711         parameter; change all callers.  Initialize global_ifuncs_ and
5712         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5713         __rel_iplt_end.
5714         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5715         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5716         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5717         symbols.
5718         (Target_i386::make_plt_section): New function, broken out of
5719         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5720         (Target_i386::make_plt_entry): Call make_plt_section.
5721         (Target_i386::make_local_ifunc_plt_entry): New function.
5722         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5723         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5724         R_386_IRELATIVE to switch.
5725         (Target_i386::Scan::global): Likewise.
5726         (Target_i386::Relocate::relocate): Likewise.
5727         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5728         switch.
5729         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5730         (Target_x86_64::do_plt_section_for_global): New function.
5731         (Target_x86_64::do_plt_section_for_local): New function.
5732         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5733         parameter; change all callers.  If doing a static link define
5734         __rela_iplt_start and __rela_iplt_end.
5735         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5736         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5737         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5738         to point to .plt.
5739         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5740         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5741         switch.
5742         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5743         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5744         R_X86_64_IRELATIVE to switch.
5745         (Target_x86_64::Scan::global): Likewise.
5746         (Target_x86_64::Relocate::relocate): Likewise.
5747         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5748         switch.
5749         * target.h (class Target): Add plt_section_for_global and
5750         plt_section_for_local functions.  Add do_plt_section_for_global
5751         and do_plt_section_for_local virtual functions.
5752         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5753         clarifying comments.
5754         (Symbol::use_plt_offset): Handle IFUNC symbol.
5755         * object.cc (Sized_relobj::Sized_relobj): Initialize
5756         local_plt_offsets_.
5757         (Sized_relobj::local_has_plt_offset): New function.
5758         (Sized_relobj::local_plt_offset): New function.
5759         (Sized_relobj::set_local_plt_offset): New function.
5760         (Sized_relobj::do_count): Handle IFUNC symbol.
5761         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5762         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5763         is_ifunc_symbol functions.
5764         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5765         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5766         local_plt_offsets_ field.
5767         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5768         * output.h (class Output_section_data): Add non-const
5769         output_section function.
5770         (class Output_data_got): Update declarations.
5771         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5772         Add use_plt_offset parameter to global and local constructors.
5773         Change all callers.  Change local_sym_index_ field to 31 bits.
5774         Change GSYM_CODE and CONSTANT_CODE accordingly.
5775         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5776         doing a static link don't set sh_link field.
5777         (Output_data_got::Got_entry::write): Use PLT offset if
5778         appropriate.
5779         (Output_data_got::add_global_plt): New function.
5780         (Output_data_got::add_local_plt): New function.
5781         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5782         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5783         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5784         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5785         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5786         IFUNC conditional.
5787         * testsuite/ifunc-sel.h: New file.
5788         * testsuite/ifuncmain1.c: New file.
5789         * testsuite/ifuncmain1vis.c: New file.
5790         * testsuite/ifuncmod1.c: New file.
5791         * testsuite/ifuncdep2.c: New file.
5792         * testsuite/ifuncmain2.c: New file.
5793         * testsuite/ifuncmain3.c: New file.
5794         * testsuite/ifuncmod3.c: New file.
5795         * testsuite/ifuncmain4.c: New file.
5796         * testsuite/ifuncmain5.c: New file.
5797         * testsuite/ifuncmod5.c: New file.
5798         * testsuite/ifuncmain6pie.c: New file.
5799         * testsuite/ifuncmod6.c: New file.
5800         * testsuite/ifuncmain7.c: New file.
5801         * configure, testsuite/Makefile.in: Rebuild.
5802
5803 2010-08-18  Ian Lance Taylor  <iant@google.com>
5804
5805         * incremental.cc
5806         (Output_section_incremental_inputs::write_input_files): Add cast
5807         to avoid signed/unsigned comparison warning.
5808         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5809
5810 2010-08-12  Cary Coutant  <ccoutant@google.com>
5811
5812         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5813
5814 2010-08-13  Ian Lance Taylor  <iant@google.com>
5815
5816         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5817
5818 2010-08-12  Cary Coutant  <ccoutant@google.com>
5819             Doug Kwan  <dougkwan@google.com>
5820
5821         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5822         defintion overrides non-weak undef, remember that the original undef
5823         is not weak.
5824         * symtab.cc (Symbol_table::sized_write_global): For undef without
5825         an original weak binding, set binding to global in output.
5826         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5827         * testsuite/Makefile.in: Regenerate.
5828         * testsuite/strong_ref_weak_def.sh: New file.
5829         * testsuite/strong_ref_weak_def_1.c: Ditto.
5830         * testsuite/strong_ref_weak_def_2.c: Ditto.
5831
5832 2010-08-12  Cary Coutant  <ccoutant@google.com>
5833
5834         * testsuite/incremental_test.sh: Rewrite.
5835         * testsuite/incremental_test_1.c: Rewrite.
5836         * testsuite/incremental_test_2.c: Rewrite.
5837
5838 2010-08-12  Cary Coutant  <ccoutant@google.com>
5839
5840         * arm.cc (Target_arm::got_size): Add const.
5841         (Target_arm::got_entry_count): New function.
5842         (Target_arm::plt_entry_count): New function.
5843         (Target_arm::first_plt_entry_offset): New function.
5844         (Target_arm::plt_entry_size): New function.
5845         (Output_data_plt_arm::entry_count): New function.
5846         (Output_data_plt_arm::first_plt_entry_offset): New function.
5847         (Output_data_plt_arm::get_plt_entry_size): New function.
5848         * i386.cc (Target_i386::got_size): Add const.
5849         (Target_i386::got_entry_count): New function.
5850         (Target_i386::plt_entry_count): New function.
5851         (Target_i386::first_plt_entry_offset): New function.
5852         (Target_i386::plt_entry_size): New function.
5853         (Output_data_plt_i386::entry_count): New function.
5854         (Output_data_plt_i386::first_plt_entry_offset): New function.
5855         (Output_data_plt_i386::get_plt_entry_size): New function.
5856         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5857         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5858         * incremental.cc: Include target.h.
5859         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5860         parameter.  Adjust all callers.  Find incremental_got_plt section.
5861         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5862         section.
5863         (Output_section_incremental_inputs::set_final_data_size): Calculate
5864         size of incremental_got_plt section.
5865         (Output_section_incremental_inputs::do_write): Write the
5866         incremental_got_plt section.
5867         (Got_plt_view_info): New struct.
5868         (Local_got_offset_visitor): New class.
5869         (Global_got_offset_visitor): New class.
5870         (Global_symbol_visitor_got_plt): New class.
5871         (Output_section_incremental_inputs::write_got_plt): New function.
5872         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5873         Add parameter.  Adjust all callers.
5874         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5875         (Incremental_inputs::got_plt_section): New function.
5876         (Incremental_inputs::got_plt_section_): New data member.
5877         (Incremental_got_plt_reader): New class.
5878         * layout.cc (Layout::create_incremental_info_sections): Add the
5879         incremental_got_plt section.
5880         * object.h (Got_offset_list::get_list): New function.
5881         (Got offset_list::for_all_got_offsets): New function.
5882         (Sized_relobj::local_got_offset_list): New function.
5883         * powerpc.cc (Target_powerpc::got_size): Add const.
5884         (Target_powerpc::got_entry_count): New function.
5885         (Target_powerpc::plt_entry_count): New function.
5886         (Target_powerpc::first_plt_entry_offset): New function.
5887         (Target_powerpc::plt_entry_size): New function.
5888         (Output_data_plt_powerpc::entry_count): New function.
5889         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5890         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5891         * sparc.cc (Target_sparc::got_size): Add const.
5892         (Target_sparc::got_entry_count): New function.
5893         (Target_sparc::plt_entry_count): New function.
5894         (Target_sparc::first_plt_entry_offset): New function.
5895         (Target_sparc::plt_entry_size): New function.
5896         (Output_data_plt_sparc::entry_count): New function.
5897         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5898         (Output_data_plt_sparc::get_plt_entry_size): New function.
5899         * symtab.h (Symbol::got_offset_list): New function.
5900         (Symbol_table::for_all_symbols): New function.
5901         * target.h (Sized_target::got_entry_count): New function.
5902         (Sized_target::plt_entry_count): New function.
5903         (Sized_target::plt_entry_size): New function.
5904         * x86_64.cc (Target_x86_64::got_size): Add const.
5905         (Target_x86_64::got_entry_count): New function.
5906         (Target_x86_64::plt_entry_count): New function.
5907         (Target_x86_64::first_plt_entry_offset): New function.
5908         (Target_x86_64::plt_entry_size): New function.
5909         (Output_data_plt_x86_64::entry_count): New function.
5910         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5911         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5912
5913 2010-08-12  Cary Coutant  <ccoutant@google.com>
5914
5915         * archive.cc: Include incremental.h.
5916         (Archive::Archive): Initialize incremental_info_.
5917         (Archive::include_member): Record archive members in incremental info.
5918         (Add_archive_symbols::run): Record begin and end of an archive in
5919         incremental info.
5920         (Lib_group::include_member): Record objects in incremental info.
5921         * archive.h (Incremental_archive_entry): Forward declaration.
5922         (Archive::set_incremental_info): New member function.
5923         (Archive::incremental_info): New member function.
5924         (Archive::Unused_symbol_iterator): New class.
5925         (Archive::unused_symbols_begin): New member function.
5926         (Archive::unused_symbols_end): New member function.
5927         (Archive::incremental_info_): New data member.
5928         * incremental-dump.cc (find_input_containing_global): New function.
5929         (dump_incremental_inputs): Dump new incremental info sections.
5930         * incremental.cc: Include symtab.h.
5931         (Output_section_incremental_inputs): New class.
5932         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5933         new incremental info sections.
5934         (Sized_incremental_binary::do_check_inputs): Likewise.
5935         (Incremental_inputs::report_archive): Remove.
5936         (Incremental_inputs::report_archive_begin): New function.
5937         (Incremental_inputs::report_archive_end): New function.
5938         (Incremental_inputs::report_object): New function.
5939         (Incremental_inputs::finalize_inputs): Remove.
5940         (Incremental_inputs::report_input_section): New function.
5941         (Incremental_inputs::report_script): Rewrite.
5942         (Incremental_inputs::finalize): Do nothing but finalize string table.
5943         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5944         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5945         (Incremental_inputs::create_data_sections): New function.
5946         (Incremental_inputs::relocs_entsize): New function.
5947         (Output_section_incremental_inputs::set_final_data_size): New function.
5948         (Output_section_incremental_inputs::do_write): New function.
5949         (Output_section_incremental_inputs::write_header): New function.
5950         (Output_section_incremental_inputs::write_input_files): New function.
5951         (Output_section_incremental_inputs::write_info_blocks): New function.
5952         (Output_section_incremental_inputs::write_symtab): New function.
5953         * incremental.h (Incremental_script_entry): Forward declaration.
5954         (Incremental_object_entry): Forward declaration.
5955         (Incremental_archive_entry): Forward declaration.
5956         (Incremental_inputs): Forward declaration.
5957         (Incremental_inputs_header_data): Remove.
5958         (Incremental_inputs_header): Remove.
5959         (Incremental_inputs_header_write): Remove.
5960         (Incremental_inputs_entry_data): Remove.
5961         (Incremental_inputs_entry): Remove.
5962         (Incremental_inputs_entry_write): Remove.
5963         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5964         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5965         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5966         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5967         Likewise.
5968         (Incremental_input_entry): New class.
5969         (Incremental_script_entry): New class.
5970         (Incremental_object_entry): New class.
5971         (Incremental_archive_entry): New class.
5972         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5973         (Incremental_inputs::report_inputs): Remove.
5974         (Incremental_inputs::report_archive): Remove.
5975         (Incremental_inputs::report_archive_begin): New function.
5976         (Incremental_inputs::report_archive_end): New function.
5977         (Incremental_inputs::report_object): Change prototype.
5978         (Incremental_inputs::report_input_section): New function.
5979         (Incremental_inputs::report_script): Change prototype.
5980         (Incremental_inputs::get_reloc_count): New function.
5981         (Incremental_inputs::set_reloc_count): New function.
5982         (Incremental_inputs::create_data_sections): New function.
5983         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5984         (Incremental_inputs::inputs_section): New function.
5985         (Incremental_inputs::symtab_section): New function.
5986         (Incremental_inputs::relocs_section): New function.
5987         (Incremental_inputs::get_stringpool): Add const.
5988         (Incremental_inputs::command_line): Add const.
5989         (Incremental_inputs::inputs): Remove.
5990         (Incremental_inputs::command_line_key): New function.
5991         (Incremental_inputs::input_file_count): New function.
5992         (Incremental_inputs::input_files): New function.
5993         (Incremental_inputs::relocs_entsize): New function.
5994         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5995         (Incremental_inputs::finalize_inputs): Remove.
5996         (Incremental_inputs::Input_info): Remove.
5997         (Incremental_inputs::lock_): Remove.
5998         (Incremental_inputs::inputs_): Change type.
5999         (Incremental_inputs::inputs_map_): Remove.
6000         (Incremental_inputs::current_object_entry_): New data member.
6001         (Incremental_inputs::inputs_section_): New data member.
6002         (Incremental_inputs::symtab_section_): New data member.
6003         (Incremental_inputs::relocs_section_): New data member.
6004         (Incremental_inputs::reloc_count_): New data member.
6005         (Incremental_inputs_reader): New class.
6006         (Incremental_symtab_reader): New class.
6007         (Incremental_relocs_reader): New class.
6008         * layout.cc (Layout::finalize): Move finalization of incremental info
6009         and creation of incremental info sections to follow finalization of
6010         symbol table.  Set offsets for postprocessing sections.
6011         (Layout::create_incremental_info_sections): Call
6012         Incremental_inputs::create_data_sections.  Add incremental symtab
6013         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6014         sections to layout after input sections.
6015         * layout.h (struct Timespec): Forward declaration.
6016         (Layout::incremental_inputs): Add const.
6017         (Layout::create_incremental_info_sections): Add parameter.
6018         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6019         * object.cc: Include incremental.h.
6020         (Relobj::finalize_incremental_relocs): New function.
6021         (Sized_relobj::do_layout): Record input sections in incremental info.
6022         * object.h (Object::output_section): New function.
6023         (Object::output_section_offset): Moved from Relobj.
6024         (Object::get_incremental_reloc_base): New function.
6025         (Object::get_incremental_reloc_count): New function.
6026         (Object::do_output_section): New function.
6027         (Object::do_output_section_offset): Moved from Relobj.
6028         (Object::do_get_incremental_reloc_base): New function.
6029         (Object::do_get_incremental_reloc_count): New function.
6030         (Object::Object): Initialize new data members.
6031         (Relobj::output_section): Renamed do_output_section and moved to
6032         protected.
6033         (Relobj::output_section_offset): Moved to Object.
6034         (Relobj::do_get_incremental_reloc_base): New function.
6035         (Relobj::do_get_incremental_reloc_count): New function.
6036         (Relobj::allocate_incremental_reloc_counts): New function.
6037         (Relobj::count_incremental_reloc): New function.
6038         (Relobj::finalize_incremental_relocs): New function.
6039         (Relobj::next_incremental_reloc_index): New function.
6040         (Relobj::reloc_counts_): New data member.
6041         (Relobj::reloc_bases_): New data member.
6042         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6043         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6044         (Sized_relobj::incremental_relocs_scan): New function.
6045         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6046         (Sized_relobj::incremental_relocs_write): New function.
6047         (Sized_relobj::incremental_relocs_write_reltype): New function.
6048         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6049         incremental link.
6050         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6051         archives and object files elsewhere.
6052         (Add_symbols::run): Report object files here.
6053         (Finish_group::run): Report end of archive at end of group.
6054         * reloc.cc: Include layout.h, incremental.h.
6055         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6056         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6057         (Sized_relobj::incremental_relocs_scan): New function.
6058         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6059         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6060         (Sized_relobj::incremental_relocs_write): New function.
6061         (Sized_relobj::incremental_relocs_write_reltype): New function.
6062         * script.cc (read_input_script): Rewrite test for incremental link.
6063         Change call to Incremental_inputs::report_script.
6064         * symtab.h (Symbol_table::first_global_index): New function.
6065         (Symbol_table::output_count): New function.
6066
6067 2010-08-12  Doug Kwan  <dougkwan@google.com>
6068
6069         * arm.cc (Target_arm::merge_object_attributes): Check command line
6070         options --no-wchar-size-warning and --no-enum-size-warning.
6071         * options.h (General_options): Add ld-compatible options
6072         --no-enum-size-warning and --no-wchar-size-warning.
6073
6074 2010-08-04  Ian Lance Taylor  <iant@google.com>
6075
6076         * x86_64.cc (Target_x86_64::Scan::local): Use
6077         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6078         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6079         (Target_x86_64::Scan::global): Likewise.
6080         (Target_x86_64::Relocate::relocate): Likewise.
6081         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6082         Likewise.
6083
6084 2010-08-03  Cary Coutant  <ccoutant@google.com>
6085
6086         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6087         to reserve space in merged_strings vector. Keep total input size
6088         for stats.
6089         (Output_merge_string::do_print_merge_stats): Print total input size.
6090         * merge.h (Output_merge_string): Add input_size_ field.
6091         * stringpool.cc (Stringpool_template::string_length): Move
6092         implementations out of Stringpool_template class and place in
6093         stringpool.h.
6094         * stringpool.h (string_length): Move out of Stringpool_template.
6095
6096 2010-08-03  Ian Lance Taylor  <iant@google.com>
6097
6098         PR 11712
6099         * layout.cc (relaxation_loop_body): If address of load segment is
6100         set, adjust address to include headers if possible.
6101
6102 2010-08-03  Ian Lance Taylor  <iant@google.com>
6103
6104         * version.cc (version_string): Bump to 1.10.
6105
6106 2010-08-03  Ian Lance Taylor  <iant@google.com>
6107
6108         PR 11805
6109         * layout.h (enum Output_section_order): Define.
6110         (class Layout): Update declarations.
6111         * layout.cc (Layout::get_output_section): Add order parameter.
6112         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6113         is_first_non_relro parameters.  Change all callers.
6114         (Layout::choose_output_section): Likewise.
6115         (Layout::add_output_section_data): Likewise.
6116         (Layout::make_output_section): Likewise.  Set order.
6117         (Layout::default_section_order): New function.
6118         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6119         * output.cc (Output_section::Output_section): Initialize order_.
6120         Don't initialize deleted fields.
6121         (Output_segment::Output_segment): Don't initialize deleted
6122         fields.
6123         (Output_segment::add_output_section_to_load): New function
6124         replacing add_output_section.  Change all callers to call this or
6125         add_output_section_to_nonload.
6126         (Output_segment::add_output_section_to_nonload): New function.
6127         (Output_segment::remove_output_section): Rewrite.
6128         (Output_segment::add_initial_output_data): Likewise.
6129         (Output_segment::has_any_data_sections): Likewise.
6130         (Output_segment::is_first_section_relro): Likewise.
6131         (Output_segment::maximum_alignment): Likewise.
6132         (Output_segment::has_dynamic_reloc): New function replacing
6133         dynamic_reloc_count.  Change all callers.
6134         (Output_segment::has_dynamic_reloc_list): New function replacing
6135         dynamic_reloc_count_list.  Change all callers.
6136         (Output_segment::set_section_addresses): Rewrite.
6137         (Output_segment::set_offset): Rewrite.
6138         (Output_segment::find_first_and_last_list): Remove.
6139         (Output_segment::set_tls_offsets): Rewrite.
6140         (Output_segment::first_section_load_address): Likewise.
6141         (Output_segment::output_section_count): Likewise.
6142         (Output_segment::section_with_lowest_load_address): Likewise.
6143         (Output_segment::write_section_headers): Likewise.
6144         (Output_segment::print_sections_to_map): Likewise.
6145         * output.h (class Output_data): Remove dynamic_reloc_count_
6146         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6147         (Output_data::add_dynamic_reloc): Rewrite.
6148         (Output_data::has_dynamic_reloc): New function.
6149         (Output_data::dynamic_reloc_count): Remove.
6150         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6151         is_last_relro_, is_first_non_relro_, is_interp_,
6152         is_dynamic_linker_section_ fields.  Add order and set_order
6153         functions.  Remove is_relro_local, set_is_relro_local,
6154         is_last_relro, set_is_last_relro, is_first_non_relro,
6155         set_is_first_non_relro functions, is_interp, set_is_interp,
6156         is_dynamic_linker_section, and set_is_dynamic_linker_section
6157         functions.
6158         (class Output_segment): Change Output_data_list from std::list to
6159         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6160         output_bss_ fields.  Update declarations.
6161
6162 2010-08-02  Ian Lance Taylor  <iant@google.com>
6163
6164         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6165         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6166         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6167
6168 2010-08-02  Ian Lance Taylor  <iant@google.com>
6169
6170         PR 11855
6171         * script.cc (Script_options::Script_options): Initialize
6172         symbol_definitions_ and symbol_references_.
6173         (Script_options::add_symbol_assignment): Update
6174         symbol_definitions_ and symbol_references_.
6175         (Script_options::add_symbol_reference): New function.
6176         (script_symbol): New function.
6177         * script.h (class Script_options): Add symbol_definitions_ and
6178         symbol_references_ fields.
6179         (Script_options::referenced_const_iterator): New type.
6180         (Script_options::referenced_begin): New function.
6181         (Script_options::referenced_end): New function.
6182         (Script_options::is_referenced): New function.
6183         (Script_options::any_unreferenced): New function.
6184         * script-c.h (script_symbol): Declare.
6185         * yyscript.y (exp): Call script_symbol.
6186         * symtab.cc: Include "script.h".
6187         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6188         Change all callers.  Check symbols referenced by scripts.
6189         (Symbol_table::add_undefined_symbols_from_command_line): Add
6190         layout parameter.  Change all callers.
6191         (Symbol_table::do_add_undefined_symbols_from_command_line):
6192         Likewise.  Break out loop body.  Check symbols referenced by
6193         scripts.
6194         (Symbol_table::add_undefined_symbol_from_command_line): New
6195         function broken out of
6196         do_add_undefined_symbols_from_command_line.
6197         * symtab.h (class Symbol_table): Update declarations.
6198         * archive.cc: Include "layout.h".
6199         (Archive::should_include_member): Add layout parameter.  Change
6200         all callers.  Check for symbol mentioned in expression.
6201         * archive.h (class Archive): Update declaration.
6202         * object.cc (Sized_relobj::do_should_include_member): Add layout
6203         parameter.
6204         * object.h (Object::should_include_member): Add layout parameter.
6205         Change all callers.
6206         (Object::do_should_include_member): Add layout parameter.
6207         (class Sized_relobj): Update declaration.
6208         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6209         parameter.
6210         * dynobj.h (class Sized_dynobj): Update declaration.
6211         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6212         layout parameter.
6213         * plugin.h (class Sized_pluginobj): Update declaration.
6214
6215 2010-08-02  Ian Lance Taylor  <iant@google.com>
6216
6217         PR 11866
6218         * output.cc (Output_segment::set_offset): Search for the first and
6219         last sections rather than assuming that the list is in order.
6220         (Output_segment::find_first_and_last_list): New function.
6221         * output.h (class Output_segment): Update declarations.
6222         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6223         (relro_strip_test_SOURCES): New variable.
6224         (relro_strip_test_DEPENDENCIES): New variable.
6225         (relro_strip_test_LDFLAGS): New variable.
6226         (relro_strip_test_LDADD): New variable.
6227         (relro_strip_test.so): New target.
6228
6229 2010-08-02  Ian Lance Taylor  <iant@google.com>
6230
6231         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6232         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6233         (Target_i386::got_tlsdesc_section): New function.
6234         (Target_i386::got_section): Create space for GOT entries for
6235         TLSDESC relocations.
6236         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6237         R_386_TLS_GOTDESC.
6238         (Target_i386::Scan::global): Likewise.
6239         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6240         using TLSDESC GOT.
6241         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6242         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6243         (Target_x86_64::got_tlsdesc_section): New function.
6244         (Target_x86_64::got_section): Create space for GOT entries for
6245         TLSDESC relocations.
6246         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6247         R_386_TLS_GOTDESC.
6248         (Target_x86_64::Scan::global): Likewise.
6249         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6250         using TLSDESC GOT.
6251
6252 2010-08-02  Ian Lance Taylor  <iant@google.com>
6253
6254         * testsuite/final_layout.sh: Use dc to convert from hex to
6255         decimal.
6256
6257 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6258
6259         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6260         paramter to the call to gold::gc_process_relocs.
6261         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6262         paramter to the call to gold::gc_process_relocs.
6263         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6264         parameter to the call to gold::gc_process_relocs.
6265         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6266         template parameter to the call to gold::gc_process_relocs.
6267         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6268         paramter to the call to gold::gc_process_relocs.
6269         * gc.h (get_embedded_addend_size): New function.
6270         (gc_process_relocs): Save the size of the reloc for use by ICF.
6271         * icf.cc (get_section_contents): Get the addend from the text section
6272         for SHT_REL relocation sections.
6273         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6274         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6275         * int_encoding.h (read_from_pointer): New overloaded function.
6276         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6277         * testsuite/icf_sht_rel_addend_test.sh: New file.
6278         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6279         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6280
6281 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6282
6283         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6284         * Makefile.in: Regenerate.
6285         * testsuite/Makefile.in: Regenerate.
6286
6287 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6288
6289         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6290         * gold/testsuite/debug_msg.cc: Likewise.
6291         * gold/testsuite/odr_violation1.cc
6292         * gold/testsuite/odr_violation2.cc
6293
6294 2010-07-21  Cary Coutant  <ccoutant@google.com>
6295
6296         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6297         string, and length fields.
6298         (Output_merge_string::Merged_strings_list): New type.
6299         (Output_merge_string::Merged_strings_lists): New typedef.
6300         (Output_merge_string): Replace merged_strings_ with
6301         merged_strings_lists_.
6302         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6303         Merged_strings_list per input object and section.  Don't store pointer
6304         to the string.  Don't store length with each merged string entry.
6305         (Output_merge_string::finalize_merged_data): Loop over list of merged
6306         strings lists.  Recompute length of each merged string.
6307
6308 2010-07-15  Cary Coutant  <ccoutant@google.com>
6309
6310         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6311         here.
6312
6313 2010-07-14  Ian Lance Taylor  <iant@google.com>
6314
6315         * descriptors.cc (Descriptors::open): Report correct name in error
6316         message.
6317
6318 2010-07-13  Doug Kwan  <dougkwan@google.com>
6319
6320         * arm.cc (Arm_input_section::Arm_input_section): For a
6321         SHT_ARM_EXIDX section, always keeps the input sections.
6322         (Arm_input_section::set_exidx_section_link): New method.
6323         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6324         has_errors_ to false.
6325         (Arm_exidx_input_section::has_errors,
6326         Arm_exidx_input_section::set_has_errors): New methods.
6327         (Arm_exidx_input_section::has_errors_): New data member.
6328         (Arm_relobj::get_exidx_shndx_list): New method.
6329         (Arm_output_section::append_text_sections_to_list): Do not skip
6330         section without SHF_EXECINSTR.
6331         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6332         errors.
6333         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6334         section header.  Make error messages more verbose.  Check for
6335         a non-executable section linked to an EXIDX section.
6336         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6337         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6338         check that there is no deferred EXIDX section if we exit early.
6339         Instead of not making an EXIDX section in case of an error, make one
6340         and set the has_errors flag of it.
6341         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6342         in a relocatable link.
6343         (Target_arm::do_relax): Look for the EXIDX output section instead of
6344         assuming that it is called .ARM.exidx.
6345         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6346         section list.  Do not check for SHF_EXECINSTR section flags but
6347         skip any input section with errors.
6348         * output.cc (Output_section::Output_section): Initialize
6349         always_keeps_input_sections_ to false.
6350         (Output_section::add_input_section): Check for
6351         always_keeps_input_sections_.
6352         *  output.h (Output_section::always_keeps_input_sections,
6353         Output_section::set_always_keeps_input_sections): New methods.
6354         (Output_section::always_keeps_input_sections): New data member.
6355
6356 2010-07-13  Rafael Espindola  <espindola@google.com>
6357
6358         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6359         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6360
6361 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6362             Ian Lance Taylor  <iant@google.com>
6363
6364         * output.h (Output_section_lookup_maps::add_merge_section):
6365         Correct check of whether value was inserted.
6366         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6367         (Output_section_lookup_maps::add_relaxed_input_section):
6368         Likewise.
6369         * arm.cc (Target_arm::got_section): Remove used local os.
6370         * i386.cc (Target_i386::got_section): Likewise.
6371         * x86_64.cc (Target_x86_64::got_section): Likewise.
6372         * sparc.cc (Target_sparc::got_section): Likewise.
6373         (Target_sparc::relocate): Remove unused local have_got_offset.
6374         * powerpc.cc (Target_powerpc::relocate): Likewise.
6375
6376 2010-07-13  Ian Lance Taylor  <iant@google.com>
6377
6378         * compressed_output.cc (zlib_decompress): Fix signature in
6379         !HAVE_ZLIB_H case.
6380
6381         * archive.cc (Archive::include_member): Unlock an external member
6382         of a thin archive.  Don't bother to delete an object we know is
6383         NULL.
6384
6385 2010-07-12  Cary Coutant  <ccoutant@google.com>
6386
6387         * compressed_output.cc (zlib_decompress): New function.
6388         (get_uncompressed_size): New function.
6389         (decompress_input_section): New function.
6390         * compressed_output.h (get_uncompressed_size): New function.
6391         (decompress_input_section): New function.
6392         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6393         Handle compressed debug sections.
6394         * layout.cc (is_compressed_debug_section): New function.
6395         (Layout::output_section_name): Map compressed section names to
6396         canonical names.
6397         * layout.h (is_compressed_debug_section): New function.
6398         (is_debug_info_section): Recognize compressed debug sections.
6399         * merge.cc: Include compressed_output.h.
6400         (Output_merge_data::do_add_input_section): Handle compressed
6401         debug sections.
6402         (Output_merge_string::do_add_input_section): Handle compressed
6403         debug sections.
6404         * object.cc: Include compressed_output.h.
6405         (Sized_relobj::Sized_relobj): Initialize new data members.
6406         (build_compressed_section_map): New function.
6407         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6408         * object.h (Object::section_is_compressed): New method.
6409         (Object::do_section_is_compressed): New method.
6410         (Sized_relobj::Compressed_section_map): New type.
6411         (Sized_relobj::do_section_is_compressed): New method.
6412         (Sized_relobj::compressed_sections_): New data member.
6413         * output.cc (Output_section::add_input_section): Handle compressed
6414         debug sections.
6415         * reloc.cc: Include compressed_output.h.
6416         (Sized_relobj::write_sections): Handle compressed debug sections.
6417
6418 2010-07-08  Cary Coutant  <ccoutant@google.com>
6419
6420         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6421         weak when resolving to a dynamic def.
6422         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6423         for weak undef/dynamic def cases. Adjust callers.
6424         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6425         undef_binding_weak_.
6426         (Symbol_table::sized_write_globals): Adjust symbol binding.
6427         (Symbol_table::sized_write_symbol): Add binding parameter.
6428         * symtab.h (Symbol::set_undef_binding): New method.
6429         (Symbol::is_undef_binding_weak): New method.
6430         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6431         (Symbol_table::should_override): Add new parameter.
6432         (Symbol_table::sized_write_symbol): Add new parameter.
6433
6434         * testsuite/weak_undef_file1.cc: Add new test case.
6435         * testsuite/weak_undef_file2.cc: Fix header comment.
6436         * testsuite/weak_undef_test.cc: Add new test case.
6437
6438 2010-06-29  Doug Kwan  <dougkwan@google.com>
6439
6440         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6441         Initialize USE_SYMBOL_.
6442         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6443         definition.
6444         (Arm_reloc_property::uses_symbol_): New data member declaration.
6445         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6446         uses symbol value and symbol is undefined but not weakly undefined.
6447
6448 2010-06-28  Rafael Espindola  <espindola@google.com>
6449
6450         * plugin.cc (Plugin::load): Use dlerror.
6451
6452 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6453
6454         * symtab.cc (detect_odr_violations): When reporting an ODR
6455         violation, report an object where the symbol is defined.
6456
6457 2010-06-25  Doug Kwan  <dougkwan@google.com>
6458
6459         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6460         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6461         definition.
6462         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6463         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6464         target hook to detect function points.
6465         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6466         * icf.h (Icf::check_section_for_function_pointers): Change type of
6467         parameter SECTION_NAME to const reference to std::string.  Use
6468         target hook to determine if section may have unsafe pointers.
6469         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6470         method definition.
6471
6472 2010-06-21  Rafael Espindola  <espindola@google.com>
6473
6474         * fileread.cc (Input_file::find_fie): New
6475         (Input_file::open): Use Input_file::find_fie.
6476         * fileread.h (Input_file::find_fie): New
6477         * plugin.cc (set_extra_library_path): New.
6478         (Plugin::load): Add set_extra_library_path to the transfer vector.
6479         (Plugin_manager::set_extra_library_path): New.
6480         (Plugin_manager::add_input_file): Use the extra search path if set.
6481         (set_extra_library_path(): New.
6482         * plugin.h (Plugin_manager): Add set_extra_library_path and
6483         extra_search_path_.
6484
6485 2010-06-19  Cary Coutant  <ccoutant@google.com>
6486
6487         * layout.cc (gdb_sections): Add .debug_types.
6488         (lines_only_debug_sections): Likewise.
6489
6490 2010-06-18  Rafael Espindola  <espindola@google.com>
6491
6492         * plugin.cc (add_input_file,add_input_library)
6493         (Plugin_manager::add_input_file): Make filename arguments const.
6494         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6495         const.
6496
6497 2010-06-16  Doug Kwan  <dougkwan@google.com>
6498
6499         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6500         .ARM.attributes section if we have not merged any input
6501         attributes sections.
6502
6503 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6504
6505         * arm.cc: Allow combining objects with no EABI version
6506         information.
6507
6508 2010-06-15  Rafael Espindola  <espindola@google.com>
6509
6510         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6511
6512 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6513
6514         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6515         (struct iovec): Correct !HAVE_READV definition.
6516
6517 2010-06-10  Cary Coutant  <ccoutant@google.com>
6518
6519         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6520         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6521         reloc sections.
6522         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6523
6524         PR 11683
6525         * symtab.h (Symbol::is_placeholder): New member function.
6526         * target-reloc.h (relocate_section): Check for placeholder symbols.
6527
6528         * testsuite/Makefile.am (plugin_test_8): New test.
6529         (plugin_test_9): New test.
6530         * testsuite/Makefile.in: Regenerate.
6531
6532 2010-06-09  Nick Clifton  <nickc@redhat.com>
6533
6534         * yyscript.y (input_list_element): Allow strings prefixed with
6535         the '-' character.  Treat these as libraries.
6536         * script.cc (script_add_library): New function.  Adds a library
6537         specified by "-l<name>" found in an input script.
6538         * script-c.h: Add prototype for script_add_library.
6539
6540 2010-06-07  Doug Kwan  <dougkwan@google.com>
6541
6542         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6543         Restrict stub-group size to be within long conditional branch
6544         range when working around cortex-A8 erratum.
6545
6546 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6547
6548         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6549         #ifdef typo.
6550
6551 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6552
6553         PR gold/11658
6554         * output.cc
6555         (Output_section::Input_section_sort_entry::compare_section_ordering):
6556         Change to return non-zero correctly.
6557         (Output_section::Input_section_sort_section_order_index_compare
6558         ::operator()): Change to fix ambiguity in comparisons.
6559
6560 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6561
6562         * gold.h (is_wildcard_string): New function.
6563         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6564         (Layout::layout_eh_frame): Ditto.
6565         (Layout::find_section_order_index): New method.
6566         (Layout::read_layout_from_file): New method.
6567         * layout.h (Layout::find_section_order_index): New method.
6568         (Layout::read_layout_from_file): New method.
6569         (Layout::input_section_position_): New private member.
6570         (Layout::input_section_glob_): New private member.
6571         * main.cc (main): Call read_layout_from_file here.
6572         * options.h (--section-ordering-file): New option.
6573         * output.cc (Output_section::input_section_order_specified_): New
6574         member.
6575         (Output_section::Output_section): Initialize new member.
6576         (Output_section::add_input_section): Add new parameter.
6577         Keep input sections when --section-ordering-file is used.
6578         (Output_section::set_final_data_size): Sort input sections when
6579         section ordering file is specified.
6580         (Output_section::Input_section_sort_entry): Add new parameter.
6581         Check sorting type.
6582         (Output_section::Input_section_sort_entry::compare_section_ordering):
6583         New method.
6584         (Output_section::Input_section_sort_compare::operator()): Change to
6585         consider section_order_index.
6586         (Output_section::Input_section_sort_init_fini_compare::operator()):
6587         Change to consider section_order_index.
6588         (Output_section::Input_section_sort_section_order_index_compare
6589         ::operator()): New method.
6590         (Output_section::sort_attached_input_sections): Change to sort
6591         according to section order when specified.
6592         (Output_section::add_input_section<32, true>): Add new parameter.
6593         (Output_section::add_input_section<64, true>): Add new parameter.
6594         (Output_section::add_input_section<32, false>): Add new parameter.
6595         (Output_section::add_input_section<64, false>): Add new parameter.
6596         * output.h (Output_section::add_input_section): Add new parameter.
6597         (Output_section::input_section_order_specified): New
6598         method.
6599         (Output_section::set_input_section_order_specified): New method.
6600         (Input_section::Input_section): Initialize section_order_index_.
6601         (Input_section::section_order_index): New method.
6602         (Input_section::set_section_order_index): New method.
6603         (Input_section::section_order_index_): New member.
6604         (Input_section::Input_section_sort_section_order_index_compare): New
6605         struct.
6606         (Output_section::input_section_order_specified_): New member.
6607         * script-sections.cc (is_wildcard_string): Delete and move modified
6608         method to gold.h.
6609         (Output_section_element_input::Output_section_element_input): Modify
6610         call to is_wildcard_string.
6611         (Output_section_element_input::Input_section_pattern
6612         ::Input_section_pattern): Ditto.
6613         (Output_section_element_input::Output_section_element_input): Ditto.
6614         * testsuite/Makefile.am (final_layout): New test case.
6615         * testsuite/Makefile.in: Regenerate.
6616         * testsuite/final_layout.cc: New file.
6617         * testsuite/final_layout.sh: New file.
6618
6619 2010-06-01  Rafael Espindola  <espindola@google.com>
6620
6621         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6622
6623 2010-06-01  Rafael Espindola  <espindola@google.com>
6624
6625         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6626         visibility of symbols.
6627
6628 2010-05-27  Doug Kwan  <dougkwan@google.com>
6629
6630         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6631         from start of output section instead of address for a local symbol
6632         in a merged or relaxed section when doing a relocatable link.
6633
6634 2010-05-26  Rafael Espindola  <espindola@google.com>
6635
6636         PR 11604
6637         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6638         adding sections the garbage collector removed.
6639         * gold/testsuite/Makefile.am: Add test.
6640         * gold/testsuite/Makefile.in: Regenerate.
6641         * gold/testsuite/plugin_test_7.sh: New.
6642         * gold/testsuite/plugin_test_7_1.c: New.
6643         * gold/testsuite/plugin_test_7_2.c: New.
6644
6645 2010-05-26  Rafael Espindola  <espindola@google.com>
6646
6647         * script-sections.cc (Output_section_definition::set_section_addresses):
6648         Check for --section-start.
6649
6650 2010-05-26  Doug Kwan  <dougkwan@google.com>
6651
6652         * arm.cc (Arm_scan_relocatable_relocs): New class.
6653         (Target_arm::relocate_special_relocatable): New method.
6654         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6655         (Arm_relocate_functions::thumb_branch_common): Same.
6656         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6657         instead of Default_scan_relocatable_relocs.
6658         * target-reloc.h (relocate_for_relocatable): Let target handle
6659         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6660         * target.h (Sized_target::relocate_special_relocatable): New method.
6661
6662 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6663
6664         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6665
6666 2010-05-23  Doug Kwan  <dougkwan@google.com>
6667
6668         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6669         instead of a cast.
6670         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6671         with a direct branch, not a conditional branch, to a stub.
6672         * merge.cc (Output_merge_base::record_input_section): New method
6673         defintion.
6674         (Output_merge_data::do_add_input_section): Record input section if
6675         keeps-input-sections flag is set.
6676         (Output_merge_string::do_add_input_section): Ditto.
6677         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6678         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6679         INPUT_SECTIONS_.
6680         (Output_merge_base::keeps_input_sections,
6681         Output_merge_base::set_keeps_input_sections,
6682         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6683         method definitions.
6684         (Output_merge_base::Input_sections): New type declaration.
6685         (Output_merge_base::input_sections_begin,
6686         Output_merge_base::input_sections_end,
6687         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6688         (Output_merge_base::bool keeps_input_sections_,
6689         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6690         Output_merge_base::input_sections_): New data members.
6691         (Output_merge_data::do_set_keeps_input_sections): New method
6692         defintion.
6693         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6694         * output.cc (Output_section::Input_section::relobj): Move method
6695         defintion from class declaration to here and handle merge sections.
6696         (Output_section::Input_section::shndx): Ditto.
6697         (Output_section::Output_section): Remove initializations of removed
6698         data members and initialize new data member LOOKUP_MAPS_.
6699         (Output_section::add_input_section): Set keeps-input-sections flag
6700         for a newly created merge output section as appropriate.  Adjust code
6701         to use Output_section_lookup_maps class.
6702         (Output_section::add_relaxed_input_section): Adjst code for lookup
6703         maps code refactoring.
6704         (Output_section::add_merge_input_section): Add a new parameter
6705         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6706         class.  If adding input section to a newly created merge output
6707         section fails, remove the new merge section.
6708         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6709         Adjust code for use of the Output_section_lookup_maps class.
6710         (Output_section::find_merge_section): Ditto.
6711         (Output_section::build_lookup_maps): New method defintion.
6712         (Output_section::find_relaxed_input_section): Adjust code to use
6713         Output_section_lookup_maps class.
6714         (Output_section::get_input_sections): Export merge sections.  Adjust
6715         code to use Output_section_lookup_maps class.
6716         (Output_section:::add_script_input_section): Adjust code to use
6717         Output_section_lookup_maps class.  Update lookup maps for merge
6718         sections also.
6719         (Output_section::discard_states): Use Output_section_lookup_maps.
6720         (Output_section::restore_states): Same.
6721         * output.h (Merge_section_properties): Move class defintion out of
6722         Output_section.
6723         (Output_section_lookup_maps): New class.
6724         (Output_section::Input_section::is_merge_section): New method
6725         defintion.
6726         (Output_section::Input_section::relobj): Move defintion out of class
6727         defintion.  Declare method only.
6728         (Output_section::Input_section::shndx): Ditto.
6729         (Output_section::Input_section::output_merge_base): New method defintion.
6730         (Output_section::Input_section::u2_.pomb): New union field.
6731         (Output_section::Merge_section_by_properties_map,
6732         Output_section::Output_section_data_by_input_section_map,
6733         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6734         Remove types.
6735         (Output_section::add_merge_input_section): Add new parameter
6736         KEEPS_INPUT_SECTIONS.
6737         (Output_section::build_lookup_maps): New method declaration.
6738         (Output_section::merge_section_map_,
6739         Output_section::merge_section_by_properties_map_,
6740         Output_section::relaxed_input_section_map_,
6741         Output_section::is_relaxed_input_section_map_valid_): Remove data
6742         members.
6743         (Output_section::lookup_maps_): New data member.
6744
6745 2010-05-21  Doug Kwan  <dougkwan@google.com>
6746
6747         PR gold/11619
6748         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6749         avoid a compilation error.
6750
6751 2010-05-19  Rafael Espindola  <espindola@google.com>
6752
6753         * script-sections.cc (Output_section_definition::allocate_to_segment):
6754         Update the phdrs_list even when the output section is NULL.
6755         * testsuite/Makefile.am: Add test.
6756         * testsuite/Makefile.in: Regenerate.
6757         * testsuite/script_test_9.cc: New.
6758         * testsuite/script_test_9.sh: New.
6759         * testsuite/script_test_9.t: New.
6760
6761 2010-05-19  Doug Kwan  <dougkwan@google.com>
6762
6763         * arm.cc (Arm_input_section::original_size): New method.
6764         (Arm_input_section::do_addralign): Add a cast.
6765         (Arm_input_section::do_output_offset): Remove static cast.
6766         (Arm_input_section::original_addralign,
6767          Arm_input_section::original_size_): Change type to uint32_t.
6768         (Arm_input_section::init): Add safe casts for section alignment
6769         and size.
6770         (Arm_input_section::set_final_data_size): Do not set address and
6771         offset of stub table.
6772         (Arm_output_section::fix_exidx_coverage): Change use of of
6773         Output_section::Simple_input_section to that of
6774         Output_section::Input_section.
6775         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6776         except for the first pass.
6777         * output.cc (Output_section::get_input_sections): Change type of
6778         input_sections to std::list<Input_section>.
6779         (Output_section::add_script_input_section): Rename from
6780         Output_section::add_simple_input_section.  Change type of SIS
6781         parameter from Simple_input_section to Input_section.
6782         * output.h (Output_section::Simple_input_section): Remove class.
6783         (Output_section::Input_section): Change class visibility to public.
6784         (Output_section::Input_section::addralign): Use stored alignments
6785         for special input sections if set.
6786         (Output_section::Input_section::set_addralign): New method.
6787         (Output_section::get_input_sections): Change parameter type from
6788         list of Simple_input_section to list of Input_section.
6789         (Output_section::add_script_input_section): Rename from
6790         Output_section::add_simple_input_section. Change first parameter's
6791         type from Simple_input_section to Input_section and remove the
6792         second and third parameters.
6793         * script-sections.cc (Input_section::Input_section_list): Change
6794         type to list of Output_section::Input_section/
6795         (Input_section_info::Input_section_info): Change parameter type of
6796         INPUT_SECTION to Output_section::Input_section.
6797         (Input_section_info::input_section): Change return type.
6798         (Input_section_info::input_section_): Change type to
6799         Output_section::Input_section.
6800         (Output_section_element_input::set_section_addresses): Adjust code
6801         to use Output_section::Input_section instead of
6802         Output_section::Simple_input_section.  Adjust code for renaming
6803         of Output_section::add_simple_input_section.
6804         (Orphan_output_section::set_section_addresses): Ditto.
6805
6806 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6807
6808         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6809         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6810
6811 2010-05-18  Rafael Espindola  <espindola@google.com>
6812
6813         * options.cc (General_options::finalize): Handle -nostdlib.
6814         * options.h (nostdlib): New option.
6815         * script.cc (script_add_search_dir): Handle -nostdlib.
6816
6817 2010-05-12  Doug Kwan  <dougkwan@google.com>
6818
6819         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6820         attributes section only if there no attributes section after merging.
6821         (Target_arm::merge_object_attributes): Move value of
6822         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6823         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6824         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6825         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6826         and arm_attr_merge_7.stdout.
6827         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6828         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6829         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6830         arm_attr_merge_7b.o): New rules.
6831         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6832         arm_attr_merge_7
6833         * testsuite/Makefile.in: Regenerate.
6834         * testsuite/arm_attr_merge.sh: New file.
6835         * testsuite/arm_attr_merge_[67][ab].s: Same.
6836
6837 2010-05-05  Nick Clifton  <nickc@redhat.com>
6838
6839         * po/es.po: Updated Spanish translation.
6840
6841 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6842
6843         * Makefile.am (install-exec-local): Properly install gold as
6844         default cross linker.
6845         * Makefile.in: Regenerated.
6846
6847 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6848             Nick Clifton  <nickc@redhat.com>
6849
6850         * configure.ac (install_as_default): Define and set to false
6851         unless --enable-gold or --enable-gold=both/gold has been
6852         specified.
6853         * configure: Regenerate.
6854
6855         * Makefile.am (install-exec-local): Install the executable as
6856         'ld.gold'.  If install_as_default is true then also install it as
6857         'ld'.
6858         * Makefile.in: Regenerated.
6859
6860 2010-04-24  Ian Lance Taylor  <iant@google.com>
6861
6862         * layout.cc (Layout::layout_reloc): In relocatable link don't
6863         combine reloc sections for grouped sections.
6864
6865 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6866
6867         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6868         sections that are not ordinary to icf.
6869         * icf.cc (get_section_contents): Handle relocation pointing to section
6870         with no object or shndx information.
6871         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6872         * testsuite/Makefile.in: Regenerate.
6873         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6874         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6875
6876 2010-04-22  Ian Lance Taylor  <iant@google.com>
6877
6878         * expression.cc (Expression::Expression_eval_info): Add
6879         result_alignment_pointer field.
6880         (Expression::eval_with_dot): Add result_alignment_pointer
6881         parameter.  Change all callers.
6882         (Expression::eval_maybe_dot): Likewise.
6883         (class Binary_expression): Add alignment_pointer parameter to
6884         left_value and right_value.  Change all callers.
6885         (BINARY_EXPRESSION): Set result alignment.
6886         (class Trinary_expression): Add alignment_pointer parameter to
6887         arg2_value and arg3_value.  Change all callers.
6888         (Trinary_cond::value): Set result alignment.
6889         (Max_expression::value, Min_expression::value): Likewise.
6890         (Align_expression::value): Likewise.
6891         * script-sections.cc (class Sections_element): Add dot_alignment
6892         parameter to set_section_addresses virtual function.  Update
6893         instantiations.
6894         (class Output_section_element): Likewise.
6895         (Script_sections::create_segments): Add dot_alignment parameter.
6896         Change all callers.
6897         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6898         (Script_sections::set_phdrs_clause_addresses): Likewise.
6899         * script-sections.h: Update declarations.
6900         * script.h: Update declarations.
6901         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6902         min_p_align.
6903         * testsuite/script_test_3.t: Set large alignment.
6904         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6905         segment has expected alignment.
6906
6907 2010-04-22  Nick Clifton  <nickc@redhat.com>
6908
6909         * po/gold.pot: Updated by the Translation project.
6910         * po/vi.po: Updated Vietnamese translation.
6911
6912 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6913
6914         * testsuite/Makefile.am (check_PROGRAMS): Add
6915         icf_virtual_function_folding_test.
6916         * testsuite/Makefile.in: Regenerated.
6917
6918 2010-04-15  Andrew Haley  <aph@redhat.com>
6919
6920         * options.h (merge_exidx_entries): New option.
6921         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6922         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6923         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6924         (Target_arm::merge_exidx_entries): New function.
6925         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6926         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6927         to Arm_exidx_fixup constructor.
6928         Add new arg, merge_exidx_entries.
6929         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6930         Arm_output_section::fix_exidx_coverage.
6931
6932 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6933
6934         * icf.cc (get_section_contents): Check for preemptible functions.
6935         Ignore addend when appropriate.
6936         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6937         section folded.
6938         (add_from_relobj): Check for section folded.
6939         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6940         * symtab.h (should_add_dynsym_entry): Add new parameter.
6941         * target-reloc.h (scan_relocs): Check for section folded.
6942         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6943         Check reloc types for function pointers in shared objects.
6944         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6945         case.
6946         (icf_preemptible_functions_test): New test case.
6947         (icf_string_merge_test): New test case.
6948         * testsuite.Makefile.in: Regenerate.
6949         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6950         bar_glob.  Refactor code.
6951         * testsuite/icf_preemptible_functions_test.cc: New file.
6952         * testsuite/icf_preemptible_functions_test.sh: New file.
6953         * testsuite/icf_string_merge_test.cc: New file.
6954         * testsuite/icf_string_merge_test.sh: New file.
6955         * testsuite/icf_virtual_function_folding_test.cc: New file.
6956         * testsuite/icf_virtual_function_folding_test.sh: New file.
6957
6958 2010-04-14  Doug Kwan  <dougkwan@google.com>
6959
6960         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6961         for local symbol recounting if we remove a section due to ICF.
6962         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6963         there are no regular objects in input.
6964
6965 2010-04-13  Doug Kwan  <dougkwan@google.com>
6966
6967         * arm.cc (Arm_input_section::set_final_data_size): Compute
6968         accurate final data size instead of using current data size.
6969
6970 2010-04-09  Doug Kwan  <dougkwan@google.com>
6971
6972         * layout.cc (Layout::choose_output_section): Handle script section
6973         types.
6974         (Layout::make_output_section_for_script): Add section type parameter.
6975         Handle script section types.
6976         * layout.h (Layout::make_output_section_for_script): Add section
6977         type parameter.
6978         * output.cc (Output_section::Output_section): Initialize data member
6979         is_noload_.
6980         (Output_section::do_reset_address_and_file_offset): Do not set address
6981         to 0 if section is a NOLOAD section.
6982         * output.h (Output_section::is_noload): New method.
6983         (Output_section::set_is_noload): Ditto.
6984         (Output_section::is_noload_): New data member.
6985         * script-c.h (Script_section_type): New enum type.
6986         (struct Parser_output_section_header): Add new file section_type.
6987         * script-sections.cc (Sections_element::output_section_name): Add
6988         parameter for returning script section type.
6989         (Output_section_definition::output_section_name): Ditto.
6990         (Output_section_definition::section_type)P; New method.
6991         (Output_section_definiton::script_section_type_name): Ditto.
6992         (Output_section_definition::script_section_type_): New data member.
6993         (Output_section_definition::Output_section_definition): Initialize
6994         data member Output_section_definition::script_section_type_.
6995         (Output_section_definition::create_sections): Pass script section type
6996         to Layout::make_output_section_for_script.
6997         (Output_section_definition::output_section_name): Return script
6998         section type to caller.
6999         (Output_section_definition::set_section_address): Do not advance
7000         dot value and load address if section type is NOLOAD.  Set address
7001         of NOLOAD sections regardless of section flags.
7002         (Output_section_definition::print): Print section type if it is
7003         not SCRIPT_SECTION_TYPE_NONE.
7004         (Output_section_definition::section_type): New method.
7005         (Output_section_definition::script_section_type_name): Ditto.
7006         (Script_sections::output_section_name): Add new parameter
7007         PSECTION_TYPE for returning script section type.  Pass it to
7008         section elements.  Handle discard sections.
7009         (Sort_output_sections::operator()): Handle NOLOAD sections.
7010         * script-sections.h (Script_sections::Section_type): New enum type.
7011         (Script_sections::output_section_name): Add a new parameter for
7012         returning script section type.
7013         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7014         INFO and NOLOAD.
7015         * yyscript.y (union): Add new field SECTION_TYPE.
7016         (COPY, DSECT, INFO, NOLOAD): New tokens.
7017         (opt_address_and_section_type): Change type to output_section_header.
7018         (section_type): New non-terminal
7019         (section_header): Handle section type.
7020         (opt_address_and_section_type): Return section type value.
7021
7022 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7023
7024         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7025         * testsuite/plugin_common_test_2.c (foo): Likewise.
7026
7027 2010-04-08  Doug Kwan  <dougkwan@google.com>
7028
7029         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7030         Output_merge_data.
7031         * output.cc (Output_section::add_merge_input_section): Simplify
7032         code and return status of Output_merge_base::add_input_section.
7033         Update merge section map only if Output_merge_base::add_input_section
7034         returns true.
7035
7036 2010-04-07  Doug Kwan  <dougkwan@google.com>
7037
7038         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7039         if section is marked as containing instructions but has no mapping
7040         symbols.
7041         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7042         correct section index.
7043         (Arm_relobj::find_linked_text_section): Ditto.
7044
7045 2010-04-07  Cary Coutant  <ccoutant@google.com>
7046
7047         * archive.cc (include_member): Destroy Read_symbols_data object before
7048         releasing file.
7049         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7050         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7051         (Read_symbols_data::~Read_symbols_data) New destructor.
7052         (Section_relocs::Section_relocs) New constructor.
7053         (Section_relocs::~Section_relocs) New destructor.
7054         (Read_relocs_data::Read_relocs_data) New constructor.
7055         (Read_relocs_data::~Read_relocs_data) New destructor.
7056         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7057         pointers to NULL after deleting.
7058
7059 2010-04-07  Doug Kwan  <dougkwan@google.com>
7060
7061         * arm.cc: Replace "endianity" with "endianness" in comments.
7062         (Arm_exidx_cantunwind): Ditto.
7063         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7064         (Arm_relobj::merge_flags_and_attributes): New method.
7065         (Arm_relobj::merge_flags_and_attributes_): New data member.
7066         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7067         (Arm_relobj::scan_sections_for_stubs): Ditto.
7068         (Arm_relobj::do_read_symbols): Check to see if we really want to
7069         merge processor-specific flags and attributes.  Exit early if
7070         an object is empty except for section names and the undefined symbol.
7071         (Target_arm::do_finalize_sections): Move check for ELF format to
7072         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7073         attributes from a regular object only when we have determined that
7074         it is aapropriate.  Do not create an .ARM.attributes section in
7075         output if there is no regular input object.
7076         (Target_arm::merge_processor_specific_flags): Check
7077         --warn-mismatch before printing any error.
7078         (Target_arm::merge_object_attributes): Ditto.
7079         * gold.cc (queue_middle_tasks): Handle the case in which there is
7080         no regular object in input.
7081         * options.cc (General_options::parse_EB): New method.
7082         (General_options::parse_EL): Same.
7083         (General_options::General_options): Initialize endianness_.
7084         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7085         New options.
7086         (General_options::Endianness): New enum.
7087         (General_options::endianness): New method.
7088         (General_options::endianness_): New data member.
7089         * parameters.cc (Parameters::set_options): Check target endianness.
7090         (Parameters::set_target_once): Ditto.
7091         (Parameters::check_target_endianness): New method.
7092         (parameters_force_valid_target): If either -EL or -EB is specified,
7093         use it to define endianness of default target.
7094         * parameters.h (Parameters::check_target_endianness): New method
7095         declaration.
7096         * target.h (class Target): Change "endianity" to "endianness"
7097         in comments.
7098
7099 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7100
7101         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7102         * configure: Regenerate.
7103         * Makefile.in: Regenerate.
7104         * testsuite/Makefile.in: Regenerate.
7105
7106 2010-04-06  Cary Coutant  <ccoutant@google.com>
7107
7108         gcc PR lto/42757
7109         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7110         prevailing definitions of common symbols.
7111         * testsuite/plugin_test_6.sh: New test case.
7112         * testsuite/plugin_common_test_1.c: New test case.
7113         * testsuite/plugin_common_test_2.c: New test case.
7114         * testsuite/Makefile.am (plugin_test_6): New test case.
7115         * testsuite/Makefile.in: Regenerate.
7116
7117 2010-04-06  Nick Clifton  <nickc@redhat.com>
7118
7119         * po/vi.po: New Vietnamese translation.
7120
7121 2010-03-30  Doug Kwan  <dougkwan@google.com>
7122
7123         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7124
7125 2010-03-25  Doug Kwan  <dougkwan@google.com>
7126
7127         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7128         to avoid a conversion warning on a 32-bit host.
7129
7130 2010-03-24  Ian Lance Taylor  <iant@google.com>
7131
7132         * testsuite/script_test_3.t: Add a TLS segment.
7133         * testsuite/Makefile.am (check_PROGRAMS): Add
7134         tls_phdrs_script_test.
7135         (tls_phdrs_script_test_SOURCES): Define.
7136         (tls_phdrs_script_test_DEPENDENCIES): Define.
7137         (tls_phdrs_script_test_LDFLAGS): Define.
7138         (tls_phdrs_script_test_LDADD): Define.
7139         * testsuite/Makefile.in: Rebuild.
7140
7141 2010-03-23  Cary Coutant  <ccoutant@google.com>
7142
7143         * fileread.cc (find_or_make_view): Fix comment.
7144
7145 2010-03-23  Ian Lance Taylor  <iant@google.com>
7146
7147         * script-sections.cc (class Orphan_section_placement): Define
7148         PLACE_TLS and PLACE_TLS_BSS.
7149         (Orphan_section_placement::Orphan_section_placement): Initialize
7150         new places.
7151         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7152         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7153         (tls_script_test_SOURCES): Define.
7154         (tls_script_test_DEPENDENCIES): Define.
7155         (tls_script_test_LDFLAGS): Define.
7156         (tls_script_test_LDADD): Define.
7157         * testsuite/Makefile.in: Rebuild.
7158
7159 2010-03-22  Doug Kwan  <dougkwan@google.com>
7160
7161         * arm.cc (Arm_relocate_functions::abs8,
7162         Arm_relocate_functions::abs16): Use correct check for overflow
7163         specified in the ARM ELF specs.
7164         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7165         target of a BLX instruction specially.
7166         (Reloc_stub::stub_type_for_reloc): Ditto.
7167         (Relocate::relocate): Use symbolic names instead of numeric relocation
7168         codes to report error.
7169         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7170         workaround.
7171         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7172         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7173         thumb2_blx_out_of_range.stdout
7174         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7175         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7176         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7177         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7178         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7179         thumb2_blx_in_range, thumb2_blx_in_range.o,
7180         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7181         thumb2_blx_out_of_range.o): New rules.
7182         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7183         thumb2_blx_in_range and thumb2_blx_out_of_range.
7184         * testsuite/Makefile.in: Regenerate.
7185         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7186         * testsuite/thumb_blx_in_range.s: New file.
7187         * testsuite/thumb_blx_out_of_range.s: New file.
7188
7189 2010-03-22  Rafael Espindola  <espindola@google.com>
7190
7191         * archive.cc (Should_include): Move to archive.h.
7192         (should_include_member): Make it a member of Archive.
7193         (Lib_group): New.
7194         (Add_lib_group_symbols): New.
7195         * archive.h: Include options.h.
7196         (Archive_member): Moved from Archive.
7197         (Should_include): Moved from archive.cc.
7198         (Lib_group): New.
7199         (Add_lib_group_symbols): New.
7200         * dynobj.cc (do_should_include_member): New.
7201         * dynobj.h (do_should_include_member): New.
7202         * gold.cc (queue_initial_tasks): Update call to queue.
7203         * main.cc (main): Print lib group stats.
7204         * object.cc (do_should_include_member): New.
7205         * object.h: Include archive.h.
7206         (Object::should_include_member): New.
7207         (Object::do_should_include_member): New.
7208         (Sized_relobj::do_should_include_member): New.
7209         * options.cc (General_options::parse_start_lib): New.
7210         (General_options::parse_end_lib): New.
7211         (Input_arguments::add_file): Handle lib groups.
7212         (Input_arguments::start_group): Check we are not in a lib.
7213         (Input_arguments::start_lib): New.
7214         (Input_arguments::end_lib): New.
7215         * options.h (General_options): Add start_lib and end_lib.
7216         (Input_argument::lib_): New.
7217         (Input_argument::lib): New.
7218         (Input_argument::is_lib): New.
7219         (Input_file_lib): New.
7220         (Input_arguments::in_lib_): New.
7221         (Input_arguments::in_lib): New.
7222         (Input_arguments::start_lib): New.
7223         (Input_arguments::end_lib_): New.
7224         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7225         in unused members as preempted.
7226         (Sized_pluginobj::do_should_include_member): New.
7227         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7228         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7229         return the blocker.
7230         (Read_symbols::do_whole_lib_group): New.
7231         (Read_symbols::do_lib_group): New.
7232         (Read_symbols::do_read_symbols): Handle lib groups.
7233         (Read_symbols::get_name): Handle lib groups.
7234         * readsyms.h (Read_symbols): Add an archive member pointer.
7235         (Read_symbols::do_whole_lib_group): New.
7236         (Read_symbols::do_lib_group): New.
7237         (Read_symbols::member_): New.
7238         * script.cc (read_input_script): Update call to queue_soon.
7239
7240 2010-03-19  Doug Kwan  <dougkwan@google.com>
7241
7242         * arm.cc (Stub_table::Stub_table): Initialize new data members
7243         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7244         (Stub_table::add_reloc_stub): Assign stub offset and update
7245         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7246         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7247         New data members.
7248         (Stub_table::update_data_size_and_addralign): Use
7249         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7250         instead of going over all reloc stubs.
7251         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7252         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7253         Stringpool_template::offset_ to size of Stringpool_char.
7254         (Stringpool_template::new_key_offset): Remove code to initialize
7255         Stringpool_template::offset_.
7256         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7257         Stringpool_template::offset_ to zero.
7258
7259 2010-03-15  Doug Kwan  <dougkwan@google.com>
7260
7261         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7262         offset_.
7263         (Stringpool_template::new_key_offset): New method.
7264         (Stringpool_template::add_string): Assign offsets when adding new
7265         strings.
7266         (Stringpool_template::set_string_offsets): Do not set string offsets
7267         when not optimizing.
7268         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7269         member size_.
7270         (Chunked_vector::clear): Clear size_.
7271         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7272         (Chunked_vector::size): Return size_.
7273         (Chunked_vector::push_back): Use size_ to find insert position.
7274         (Chunked_vector::size_): New data member.
7275         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7276         (Stringpool_template::new_key_offset): New method declaration.
7277         (Stringpool_template::offset_): New data member.
7278
7279 2010-03-15   Rafael Espindola  <espindola@google.com>
7280
7281         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7282         Add_symbols' constructor.
7283         * readsyms.h (Add_symbols): Remove the input_group member.
7284
7285 2010-03-10  Ian Lance Taylor  <iant@google.com>
7286
7287         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7288         target to ask whether a reference to a symbol requires a stack
7289         split.
7290         * target.h (Target::is_call_to_non_split): New function.
7291         (Target::do_is_call_to_non_split): Declare virtual function.
7292         * target.cc: Include "symtab.h".
7293         (Target::do_is_call_to_non_split): New function.
7294         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7295
7296 2010-03-10  Cary Coutant  <ccoutant@google.com>
7297
7298         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7299         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7300         (File_read::open[2]): Add whole_file_view_ to list of views.
7301         (File_read::make_view): Remove test of whole_file_view_.
7302         (File_read::find_or_make_view): Create whole_file_view_ if
7303         necessary.
7304         (File_read::clear_views): Replace bool parameter with enum;
7305         adjust all callers.  Don't delete views with permanent data;
7306         do delete cached views and views from archives if
7307         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7308         if clearing the corresponding view.
7309         * fileread.h (File_read::Clear_views_mode): New enum.
7310         (File_read::View::is_permanent_view): New method.
7311         (File_read::clear_views): Replace bool parameter
7312         with enum; adjust all callers.
7313         * options.h (General_options): Change keep_files_mapped option;
7314         add map_whole_files.
7315         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7316         releasing the file.
7317         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7318         the file.
7319
7320 2010-03-10  David S. Miller  <davem@davemloft.net>
7321
7322         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7323
7324 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7325
7326         * icf.cc (get_section_contents): Add '@' marker after processing the
7327         merge reloc.
7328
7329 2010-03-08  Doug Kwan  <dougkwan@google.com>
7330
7331         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7332         due to a conversion warning.
7333         (Arm_relobj::update_output_local_symbol_count): Check for local
7334         symbol with unset output index.
7335
7336 2010-03-05  Ian Lance Taylor  <iant@google.com>
7337
7338         * options.h (class General_options): Add --spare-dynamic-tags.
7339         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7340         --spare-dynamic-tags.
7341
7342 2010-03-05  Ian Lance Taylor  <iant@google.com>
7343
7344         * incremental.cc: Include "libiberty.h".
7345
7346 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7347
7348         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7349         function, is_info_ member.
7350         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7351         (Versions::Versions): Update caller.
7352         (Versions::define_base_version): Likewise.
7353         (Versions::add_def): Likewise.
7354
7355 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7356
7357         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7358         (Scan::possible_function_pointer_reloc): New function.
7359         (Scan::local_reloc_may_be_function_pointer): Change to call
7360         possible_function_pointer_reloc.
7361         (Scan::global_reloc_may_be_function_pointer): Ditto.
7362         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7363         relocations in ".data.rel.ro._ZTV" section.
7364         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7365         * testsuite/icf_safe_so_test.cc: Ditto.
7366         * testsuite/icf_safe_test.cc: Ditto.
7367         * testsuite/icf_safe_test.sh: Ditto.
7368
7369 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7370             Ian Lance Taylor  <iant@google.com>
7371
7372         * target-reloc.h (relocate_section): Check the symbol table index
7373         for -1U before setting the local symbol index.
7374         (scan_relocatable_relocs): If copying the relocation, record that
7375         the local symbol is required.
7376         * object.h (Symbol_value::is_output_symtab_index_set): New
7377         function.
7378         (Symbol_value::may_be_discarded_from_output_symtab): New
7379         function.
7380         (Symbol_value::has_output_symtab_entry): New function.
7381         (Symbol_value::needs_output_symtab_entry): Remove.
7382         (Symbol_value::output_symtab_index): Make sure the symbol index is
7383         set.
7384         (Symbol_value::set_output_symtab_index): Make sure the symbol
7385         index is not set.  Make sure the new index is valid.
7386         (Symbol_value::set_must_have_output_symtab_entry): New function.
7387         (Symbol_value::has_output_dynsym_entry): New function.
7388         (Symbol_value::set_output_dynsym_index): Make sure the new index
7389         is valid.
7390         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7391         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7392         local symbol if permitted.
7393         (Sized_relobj::do_finalize_local_symbols): Call
7394         is_output_symtab_index_set rather than needs_output_symtab_entry.
7395         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7396         rather than needs_output_symtab_entry.  Call
7397         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7398         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7399         is_output_symtab_index_set rather than needs_output_symtab_entry.
7400         * testsuite/discard_locals_relocatable_test.c: New file.
7401         * testsuite/discard_locals_test.sh: Test -r.
7402         * testsuite/Makefile.am (check_DATA): Add
7403         discard_locals_relocatable_test1.syms,
7404         discard_local_relocatable_test2.syms.
7405         (MOSTLYCLEANFILES): Likewise.  Also add
7406         discard_locals_relocatable_test1.lout and
7407         discard_locals_relocatable_test2.out.
7408         (discard_locals_relocatable_test1.syms): New target.
7409         (discard_locals_relocatable_test.o): New target.
7410         (discard_locals_relocatable_test1.out): New target.
7411         (discard_locals_relocatable_test2.syms): New target.
7412         (discard_locals_relocatable_test2.out): New target.
7413         (various): Add missing ../ld-new dependencies.
7414         * testsuite/Makefile.in: Rebuild.
7415
7416 2010-03-03  Nick Clifton  <nickc@redhat.com>
7417
7418         * po/fi.po: New Finnish translation.
7419
7420 2010-03-01  Doug Kwan  <dougkwan@google.com>
7421
7422         * layout.cc (Layout::Layout): Force section types of .init_array*,
7423         .preinit_array* and .fini_array* sections.
7424         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7425         Fix check of return value of std::string::find.().
7426         (Output_section::Input_section_sort_compare::operator()): Remove
7427         comment about .init_array.
7428         (Output_section::Input_section_sort_init_fini_compare::operator()):
7429         New method.
7430         (Output_section::sort_attached_input_sections): Handle .init_array
7431         and .fini_array specially.
7432         * output.h (Output_section::Inut_section_sort_compare): Update
7433         comment.
7434         (Output_section::Input_section_sort_init_fini_compare): New struct.
7435
7436 2010-02-26  Doug Kwan  <dougkwan@google.com>
7437
7438         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7439         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7440         * testsuite/debug_msg.sh: Avoid matching source line number for
7441         use of global variable undef_int.
7442
7443 2010-02-26  Doug Kwan  <dougkwan@google.com>
7444
7445         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7446         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7447         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7448         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7449         * options.cc (General_options::General_options): Initialize member
7450         fix_v4bx_.
7451         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7452         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7453         and rm_no_fix_v4bx.stdout
7454         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7455         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7456         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7457         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7458         and arm_no_fix_v4bx.
7459         * Makefile.in: Regenerate.
7460         * testsuite/arm_fix_v4bx.s: New file.
7461         * testsuite/arm_fix_v4bx.sh: Ditto.
7462
7463 2010-02-24  Doug Kwan  <dougkwan@google.com>
7464
7465         * arm.cc (Target_arm::got_section): Make the .got section the first
7466         non RELRO section in the data segment.
7467         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7468         suffixes of section names.
7469
7470 2010-02-24  Doug Kwan  <dougkwan@google.com>
7471
7472         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7473         flags and attributes merging if an input file is a binary file.
7474         * fileread.cc (Input_file::open): Record format of original file.
7475         * fileread.h (Input_file::Format): New enum type.
7476         (Input_file::Input_file): Initialize data member format_.
7477         (Input_file::format): New method definition.
7478         (Input_file::format_):: New data member.
7479
7480 2010-02-24  Doug Kwan  <dougkwan@google.com>
7481
7482         * arm.cc (Arm_output_data_got): New class.
7483         (ARM_TCB_SIZE): New constant
7484         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7485         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7486         If user uses a script with a SECTIONS clause, issue only a warning
7487         for a misplaced EXIDX input section.  Otherwise, issue an error.
7488         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7489         garbage collection.
7490         (Target_arm::got_mode_index_entry): Handle static linking.
7491         (Target_arm::Scan::local): Ditto.
7492         (Target_arm::Scan::global): Ditto.
7493         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7494         all incorrectly implemented relocations.
7495         (Target_arm::fix_exidx_coverage): Pass layout to
7496         Arm_output_section::fix_exidx_coverage.
7497         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7498         from ".ARM.exidx." and ".ARM.extab.".
7499
7500 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7501
7502         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7503         section if it does not already exist.
7504         * attributes.cc (Attributes_section_data::Attributes_section_data):
7505         Don't crash if size is zero.
7506
7507 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7508             Ian Lance Taylor  <iant@google.com>
7509
7510         * gold.cc (queue_middle_tasks): If no input files were opened,
7511         exit.
7512         * workqueue.h (Task_function::Task_function): Assert that there is
7513         a blocker.
7514
7515 2010-02-22  Doug Kwan  <dougkwan@google.com>
7516
7517         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7518         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7519         types to avoid warnings due to different uint64_t implementations
7520         on different hosts.
7521
7522 2010-02-21  Doug Kwan  <dougkwan@google.com>
7523
7524         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7525         handling of the maximum backward branch offset.
7526         (Arm_relocate_functions::thumb_branch_common): Ditto.
7527         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7528         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7529         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7530         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7531         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7532         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7533         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7534         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7535         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7536         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7537         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7538         thumb2_bl_out_of_range.o): New rules.
7539         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7540         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7541         thumb2_bl_out_of_range
7542         * testsuite/Makefile.in: Regenerate.
7543         * testsuite/arm_bl_in_range.s: New file.
7544         * testsuite/arm_bl_out_of_range.s: Ditto.
7545         * testsuite/arm_branch_in_range.sh: Ditto.
7546         * testsuite/arm_branch_range.t: Ditto.
7547         * testsuite/thumb2_branch_range.t: Ditto.
7548         * testsuite/thumb_bl_in_range.s: Ditto.
7549         * testsuite/thumb_bl_out_of_range.s: Ditto.
7550         * testsuite/thumb_branch_range.t: Ditto.
7551
7552 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7553
7554         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7555         Add reloc offset information.
7556         * icf.cc (get_section_contents): Change iterators to point to the new
7557         vectors. Add reloc offset information to the contents.
7558         * icf.h (Icf::Sections_reachable_info): New typedef.
7559         (Icf::Sections_reachable_list): New typedef.
7560         (Icf::Offset_info): New typedef.
7561         (Icf::Reloc_info): New struct typedef.
7562         (Icf::Reloc_info_list): New typedef.
7563         (Icf::symbol_reloc_list): Delete method.
7564         (Icf::addend_reloc_list): Delete method.
7565         (Icf::section_reloc_list): Delete method.
7566         (Icf::reloc_info_list): New method.
7567         (Icf::reloc_info_list_): New member.
7568
7569 2010-02-19  Doug Kwan  <dougkwan@google.com>
7570
7571         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7572         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7573         * arm.cc (Arm_relocation_functions): New forward declaration.
7574         (Target_arm::Target_arm): Initialize new data members
7575         got_mod_index_offset_ and tls_base_symbol_defined_.
7576         (Target_arm::Relocate::relocate_tls): New method.
7577         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7578          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7579         New methods.
7580         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7581         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7582         (Target_arm::got_mod_index_offset_,
7583         Target_arm::tls_base_symbol_defined_): New data members.
7584         (Target_arm::Scan::local, Target::Scan::global,
7585         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7586         relocations.
7587
7588 2010-02-18  Doug Kwan  <dougkwan@google.com>
7589
7590         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7591         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7592         text section as a parameter becuase some broken tools may not set
7593         the link in section header.
7594         (Target_arm::has_got_section): New method.
7595         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7596         without any mapping symbol as data only.  Remove warning.
7597         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7598         link in its section header, try to discover the link by inspecting the
7599         REL31 relocation at the beginning of the section.
7600         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7601         in error message.
7602         (Target_arm::Scan::global): Treat any reference to the symbol
7603         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7604
7605 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7606
7607         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7608         (Scan::global_reloc_may_be_function_pointer): New function.
7609         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7610         (Scan::global_reloc_may_be_function_pointer): New function.
7611         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7612         (Scan::global_reloc_may_be_function_pointer): New function.
7613         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7614         (Scan::global_reloc_may_be_function_pointer): New function.
7615         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7616         (Scan::global_reloc_may_be_function_pointer): New function.
7617         (Scan::possible_function_pointer_reloc): New function.
7618         (Target_x86_64::can_check_for_function_pointers): New function.
7619         * gc.h (gc_process_relocs): Scan relocation types to determine if
7620         function pointers were taken for targets that support it.
7621         * icf.cc (Icf::find_identical_sections): Include functions for
7622         folding in safe ICF whose pointer is not taken.
7623         * icf.h (Secn_fptr_taken_set): New typedef.
7624         (fptr_section_id_): New member.
7625         (section_has_function_pointers): New function.
7626         (set_section_has_function_pointers): New function.
7627         (check_section_for_function_pointers): New function.
7628         * options.h: Fix comment for safe ICF option.
7629         * target.h (can_check_for_function_pointers): New function.
7630         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7631         Modify icf_safe_test for X86-64.
7632         * testsuite/Makefile.in: Regenerate.
7633         * testsuite/icf_safe_so_test.cc: New file.
7634         * testsuite/icf_safe_so_test.sh: New file.
7635         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7636         (main): Change to take pointer to function kept_func_3.
7637         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7638         folding is done correctly for X86-64.
7639
7640 2010-02-12  David S. Miller  <davem@davemloft.net>
7641
7642         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7643         is_symbolless parameter.
7644         (Output_reloc<SHT_REL>::is_symbolless): New.
7645         (Output_reloc<SHT_REL>::is_symbolless_): New.
7646         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7647         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7648         (Output_reloc<SHT_RELA>::is_symbolless): New.
7649         (Output_data_reloc::add_global): Handle is_symbolless.
7650         (Output_data_reloc::add_global_relative): Likewise.
7651         (Output_data_reloc::add_local): Likewise.
7652         (Output_data_reloc::add_local_relative): Likewise.
7653         (Output_data_reloc::add_symbolless_global_addend): New.
7654         (Output_data_reloc::add_symbolless_local_addend): New.
7655         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7656         is_symbolless.
7657         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7658         instead of ->is_relative_
7659         (Output_reloc::write): Likewise.
7660         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7661         (Output_reloc::write_rel): Simplify.
7662
7663         * sparc.cc (Target_sparc::Scan::local): Use
7664         ->add_symbolless_local_addend as needed.
7665         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7666         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7667         based upon relocation offset.
7668
7669 2010-02-11  Doug Kwan  <dougkwan@google.com>
7670
7671         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7672         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7673         beginning of function.
7674         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7675         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7676         parameter is_32bit in calls to should_apply_static_reloc.
7677         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7678         (check_DATA): Add arm_abs_global.stdout.
7679         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7680         arm_abs_global.stdout): New rules.
7681         (MOSTLLYCLEANFILES): Add arm_abs_global
7682         * Makefile.in: Regenerate.
7683         * testsuite/arm_abs_global.s: New file.
7684         * testsuite/arm_abs_global.sh: Ditto.
7685         * testsuite/arm_abs_lib.s: Ditto.
7686
7687 2010-02-11  Ian Lance Taylor  <iant@google.com>
7688
7689         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7690         Read_relocs task.
7691         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7692         Allocate_commons_task first.
7693         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7694         task, rather than symtab_lock_.
7695         (Gc_process_relocs::~Gc_process_relocs): New function.
7696         (Gc_process_relocs::is_runnable): Check this_blocker_.
7697         (Gc_process_relocs::locks): Use next_blocker_ rather than
7698         blocker_.
7699         (Scan_relocs::~Scan_relocs): New function.
7700         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7701         symtab_lock_.
7702         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7703         next_blocker_.
7704         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7705         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7706         constructor accordingly.
7707         (class Gc_process_relocs): Likewise.
7708         (class Scan_relocs): Likewise.
7709         * common.h (class Allocate_commons_task): Remove symtab_lock_
7710         field, and corresponding constructor parameter.
7711         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7712         symtab_lock_.
7713         (Allocate_commons_task::locks): Likewise.
7714
7715 2010-02-11  Ian Lance Taylor  <iant@google.com>
7716
7717         * gold-threads.h (class Once): Define.
7718         (class Initialize_lock): Rewrite as child of Once.
7719         * gold-threads.cc (class Once_initialize): Define.
7720         (once_pointer_control): New static variable.
7721         (once_pointer, once_arg): New static variables.
7722         (c_run_once): New static function.
7723         (Once::Once, Once::run_once, Once::internal_run): New functions.
7724         (class Initialize_lock_once): Remove.
7725         (initialize_lock_control): Remove.
7726         (initialize_lock_pointer): Remove.
7727         (initialize_lock_once): Remove.
7728         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7729         (Initialize_lock::initialize): Rewrite.
7730         (Initialize_lock::do_run_once): New function.
7731         * archive.cc (Archive::interpret_header): Only clear name if it is
7732         not already empty.
7733         * fileread.cc: Include "gold-threads.h"
7734         (file_counts_lock): New static variable.
7735         (file_counts_initialize_lock): Likewise.
7736         (File_read::release): Only increment counts when using --stats.
7737         Use a lock around the increment.
7738         * parameters.cc (class Set_parameters_target_once): Define.
7739         (set_parameters_target_once): New static variable.
7740         (Parameters::Parameters): Move here from parameters.h.
7741         (Parameters::set_target): Rewrite.
7742         (Parameters::set_target_once): New function.
7743         (Parameters::clear_target): Move here and rewrite.
7744         * parameters.h (class Parameters): Update declarations.  Add
7745         set_parameters_target_once_ field.
7746         (Parameters::Parameters): Move to parameters.cc.
7747         (Parameters::clear_target): Likewise.
7748         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7749         task.
7750         (Start_group::~Start_group): New function.
7751         (Start_group::is_runnable): New function.
7752         (Start_group::locks, Start_group::run): New functions.
7753         (Finish_group::run): Change saw_undefined to size_t.
7754         * readsyms.h (class Start_group): Define.
7755         (class Finish_group): Change saw_undefined_ field to size_t.
7756         (Finish_group::Finish_group): Remove saw_undefined and
7757         this_blocker parameters.  Change all callers.
7758         (Finish_group::set_saw_undefined): New function.
7759         (Finish_group::set_blocker): New function.
7760         * symtab.h (class Symbol_table): Change saw_undefined to return
7761         size_t.  Change saw_undefined_ field to size_t.
7762         * target-select.cc (Set_target_once::do_run_once): New function.
7763         (Target_selector::Target_selector): Initialize set_target_once_
7764         field.  Don't initialize lock_ and initialize_lock_ fields.
7765         (Target_selector::instantiate_target): Rewrite.
7766         (Target_selector::set_target): New function.
7767         * target-select.h (class Set_target_once): Define.
7768         (class Target_selector): Update declarations.  Make
7769         Set_target_once a friend.  Remove lock_ and initialize_lock_
7770         fields.  Add set_target_once_ field.
7771
7772 2010-02-10  Ian Lance Taylor  <iant@google.com>
7773
7774         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7775         queueing any tasks.
7776         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7777         (queue_middle_tasks): Add all blockers before queueing any tasks.
7778         (queue_final_tasks): Likewise.
7779         * token.h (Task_token::add_blockers): New function.
7780         * object.h (Input_objects::number_of_relobjs): New function.
7781
7782 2010-02-10  Ian Lance Taylor  <iant@google.com>
7783
7784         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7785         shared, not if not position independent.
7786         * x86_64.cc (Relocate::relocate_tls): Likewise.
7787         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7788         (tls_pie_pic_test): New target.
7789         * testsuite/Makefile.in: Rebuild.
7790
7791         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7792         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7793         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7794         * testsuite/Makefile.in: Rebuild.
7795
7796 2010-02-09  David S. Miller  <davem@davemloft.net>
7797
7798         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7799         R_SPARC_RELATIVE using ->add_local_relative().
7800         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7801
7802         * output.h (Output_data_dynamic::add_section_size): New method
7803         that takes two Output_data objects.
7804         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7805         entry param.  Handle it in initializers.
7806         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7807         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7808         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7809         arg.
7810         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7811         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7812         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7813         for dynrel_includes_plt.
7814         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7815         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7816         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7817         before .rela.plt
7818         (Target_sparc::do_finalize_sections): Update to pass true for
7819         dynrel_includes_plt.
7820         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7821         output before .rela.plt
7822         (Target_powerpc::do_finalize_sections): Update to pass true for
7823         dynrel_includes_plt when 32-bit.
7824
7825 2010-02-08  Doug Kwan  <dougkwan@google.com>
7826
7827         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7828         method.
7829         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7830         Arm_relobj::scan_section_for_cortex_a8_stubs,
7831         Arm_relobj::do_relocation_section): Instead of calling
7832         Output_section::output_address, use faster
7833         Arm_relobj::simple_input_section_output_address.
7834
7835 2010-02-08  David S. Miller  <davem@davemloft.net>
7836
7837         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7838         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7839         relocation helper function.
7840
7841         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7842         just like R_SPARC_GOT{10,13,22}.
7843         (Target_sparc::Scan::local): Likewise.
7844         (Target_sparc::Relocate:relocate): Likewise.
7845
7846 2010-02-06  Ian Lance Taylor  <iant@google.com>
7847
7848         * configure.ac: Rewrite targetobjs duplicate removal code to use
7849         only shell constructs.
7850         * configure: Rebuild.
7851
7852 2010-02-05  Doug Kwan  <dougkwan@google.com>
7853
7854         PR 11247
7855         * arm.cc (Arm_relobj::section_is_scannable): New method.
7856         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7857         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7858
7859 2010-02-04  Doug Kwan  <dougkwan@google.com>
7860
7861         PR 11247
7862         * arm-reloc-property.cc (cstdio): Include.
7863         * configure.ac (targetobjs): Remove duplicates.
7864         * configure: Regenerate.
7865         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7866         big and little endian version for a given address size.
7867
7868 2010-02-03  Doug Kwan  <dougkwan@google.com>
7869
7870         * arm-reloc-property.cc
7871         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7872         definition.
7873         * arm-reloc-property.h
7874         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7875         New method definition.
7876         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7877         declaration.
7878         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7879         overflow to N.
7880         (GOT_PREL): Change implemented to Y.
7881         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7882         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7883         (Arm_relocate_functions::movw_abs_nc): Remove method.
7884         (Arm_relocate_functions::movt_abs): Ditto.
7885         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7886         (Arm_relocate_functions::thm_movt_abs): Ditto.
7887         (Arm_relocate_functions::movw_rel_nc): Ditto.
7888         (Arm_relocate_functions::movw_rel): Ditto.
7889         (Arm_relocate_functions::movt_rel): Ditto.
7890         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7891         (Arm_relocate_functions:thm_movw_rel): Ditto.
7892         (Arm_relocate_functions:thm_movt_rel): Ditto.
7893         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7894         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7895         New method definitions.
7896         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7897         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7898         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7899         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7900         (Target_arm::Relocate::relocate): Check for non-static or
7901         unimplemented relocation code and exit early.  Change calls to
7902         Target_arm::reloc_uses_thumb_bit and
7903         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7904         instead.  Refactor code to handle similar relocations to increase
7905         code sharing.  Remove check for unsupported relocation code in switch
7906         statement.
7907         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7908         relocation property table to find out size.  Change error message to
7909         print out the name of a relocation code instead of the numeric value.
7910         (Target_arm::scan_reloc_for_stub): Use relocation property table
7911         instead of calling Target_arm::reloc_uses_thumb_bit().
7912
7913 2010-02-02  Doug Kwan  <dougkwan@google.com>
7914
7915         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7916         types of relaxed input section.
7917
7918 2010-02-02  Doug Kwan  <dougkwan@google.com>
7919
7920         * Makefile.am (HFILES): Add arm-reloc-property.h.
7921         (DEFFILES): New.
7922         (TARGETSOURCES): Add arm-reloc-property.cc
7923         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7924         (libgold_a_SOURCES): $(DEFFILES)
7925         * Makefile.in: Regenerate.
7926         * arm-reloc-property.cc: New file.
7927         * arm-reloc-property.h: New file.
7928         * arm-reloc.def: New file.
7929         * arm.cc: Update comments.
7930         (arm-reloc-property.h): New included header.
7931         (arm_reloc_property_table): New global variable.
7932         (Target_arm::do_select_as_default_target): New method definition.
7933         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7934         arm-reloc-property to targ_extra_obj.
7935         * parameters.cc (set_parameters_target): Call
7936         Target::select_as_default_target().
7937         * target.h (Target::select_as_default_target): New method definition.
7938         (Target::do_select_as_default_target): Same.
7939
7940 2010-02-01  Doug Kwan  <dougkwan@google.com>
7941
7942         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7943         first_output_text_section_.
7944         (Arm_exidx_fixup::first_output_text_section): New method definition.
7945         (Arm_exidx_fixup::first_output_text_section_): New data member.
7946         (Arm_exidx_fixup::process_exidx_section): Record the first text
7947         output section seen.
7948         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7949         and entsize in output section header.
7950
7951 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7952
7953         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7954         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7955         (Arm_relocate_functions::thm_alu11): New Method.
7956         (Arm_relocate_functions::thm_pc8): New Method.
7957         (Arm_relocate_functions::thm_pc12): New Method.
7958         (Target_arm::Scan::local): Handle the relocations.
7959         (Target_arm::Scan::global): Likewise.
7960         (Target_arm::Relocate::relocate): Likewise.
7961         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7962
7963 2010-01-29  Doug Kwan  <dougkwan@google.com>
7964
7965         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7966         of relocation types as ld.
7967
7968 2010-01-29  Doug Kwan  <dougkwan@google.com>
7969
7970         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7971         to public.
7972         (Arm_relocate_functions::thumb_branch_common): Ditto.
7973         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7974         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7975         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7976         Arm_relocate_functions::jump24): Remove.
7977         (Target_arm::Relocate::relocate): Adjust code to call
7978         Arm_relocation_functions::arm_branch_common and
7979         Arm_relocation_functions::thumb_branch_common instead of their removed
7980         wrappers.  Merge switch-cases together to reduce source code size.
7981
7982 2010-01-29  Doug Kwan  <dougkwan@google.com>
7983
7984         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7985         output_local_symbol_count_needs_update_.
7986         (Arm_relobj::output_local_symbol_count_needs_update,
7987          Arm_relobj::set_output_local_symbol_count_needs_update,
7988          Arm_relobj::update_output_local_symbol_count): New methods.
7989         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7990         member.
7991         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7992         of pointed function as in a R_ARM_PREL31 relocation.
7993         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7994         for output local symbol count updating.
7995         (Target_arm::do_relax): Update output local symbol counts in objects
7996         if necessary.
7997         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7998
7999 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8000
8001         * arm.cc: Added support for the ARM relocations:
8002         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8003         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8004         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8005         movw_prel_nc).
8006         (Arm_relocate_functions::movw_rel): New method.
8007         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8008         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8009         thm_movw_prel_nc).
8010         (Arm_relocate_functions::thm_movw_rel): New method.
8011         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8012         thm_movt_prel).
8013         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8014         relocations.
8015         (Target_arm::Scan::global): Likewise.
8016         (Target_arm::Relocate::relocate): Likewise.
8017         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8018         Likewise.
8019
8020 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8021
8022         * arm.cc: Added support for ARM group relocations.
8023         (Target_arm::reloc_needs_sym_origin): New method.
8024         (Arm_relocate_functions::calc_grp_kn): New method.
8025         (Arm_relocate_functions::calc_grp_residual): New method.
8026         (Arm_relocate_functions::calc_grp_gn): New method.
8027         (Arm_relocate_functions::arm_grp_alu): New Method.
8028         (Arm_relocate_functions::arm_grp_ldr): New Method.
8029         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8030         (Arm_relocate_functions::arm_grp_ldc): New Method.
8031         (Target_arm::Scan::local): Handle the ARM group relocations.
8032         (Target_arm::Scan::global): Likewise.
8033         (Target_arm::Relocate::relocate): Likewise.
8034         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8035         Likewise.
8036
8037 2010-01-26  Doug Kwan  <dougkwan@google.com>
8038
8039         * arm.cc (set): Include.
8040         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8041         pointer type.
8042         (Arm_output_section::Text_section_list): New type.
8043         (Arm_output_section::append_text_sections_to_list): New method.
8044         (Arm_output_section::fix_exidx_coverage): Ditto.
8045         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8046         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8047         Relobj::set_section_offset() instead of
8048         Sized_relobj::invalidate_section_offset().
8049         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8050         parameter for section headers. Ignore relocation sections for
8051         unallocated sections and EXIDX sections.
8052         (Target_arm::fix_exidx_coverage): New method.
8053         (Target_arm::output_section_address_less_than): New type.
8054         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8055         linked text section instead of the EXIDX section.
8056         (Arm_output_section::create_stub_group): Add an assertion to check
8057         that this is not an EXIDX output section.
8058         (Arm_output_section::append_text_sections_to_list): New method.
8059         (Arm_output_section::fix_exidx_coverage): Ditto.
8060         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8061         Arm_relobj::section_needs_reloc_stub_scanning.
8062         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8063         first pass.
8064         (Target_arm::fix_exidx_coverage): New method.
8065         * object.h (Relobj::set_output_section): New method.
8066         (Sized_relobj::invalidate_section_offset): Remove method.
8067         (Sized_relobj::do_invalidate_section_offset): Remove method.
8068         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8069
8070 2010-01-25  Doug Kwan  <dougkwan@google.com>
8071
8072         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8073         Fix warning due to signed and unsigned comparison on a 32-bit host.
8074
8075 2010-01-22  Doug Kwan  <dougkwan@google.com>
8076
8077         * arm.cc (Target_arm::do_relax): Record an output section for section
8078         offset adjustment it contains any stub table that has changed.
8079         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8080         offsets in an output section if necessary.
8081         * output.cc (Output_section::Output_section): Initialize
8082         section_offsets_need_adjustments_.
8083         (Output_section::add_input_section_for_script): Renamed to
8084         Output_section::add_simple_input_section.
8085         (Output_section::save_states): Add a comment.
8086         (Output_section::discard_states): New method defintion.
8087         (Output_section::adjust_section_offsets): Same.
8088         * output.h (Output_section::add_input_section_for_script): Renamed to
8089         Output_section::add_simple_input_section.
8090         (Output_section::discard_states): New method declaration.
8091         (Output_section::adjust_section_offsets): Same.
8092         (Output_section::section_offsets_need_adjustment,
8093         Output_section::set_section_offsets_need_adjustment): New method
8094         definitions.
8095         (Output_section::section_offsets_need_adjustment_): New data member.
8096         * script-sections.cc
8097         (Output_section_element_input::set_section_address): Adjust code for
8098         renaming of Output_section::add_input_section_for_script.
8099         (Orphan_output_section::set_section_address): Same.
8100
8101 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8102
8103         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8104         Fix_v4bx enum values .
8105         * gold/options.h (General_options): New option definitions.
8106         (General_options::fix_v4bx): New method.
8107         (General_options::Fix_v4bx): New enum.
8108         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8109         (General_options::parse_fix_v4bx_interworking): New method.
8110
8111 2010-01-22  Doug Kwan  <dougkwan@google.com>
8112
8113         * arm.cc (Arm_exidx_fixup): New class.
8114
8115 2010-01-21  Doug Kwan  <dougkwan@google.com>
8116
8117         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8118         classes.
8119         (Arm_exidx_section_offset_map): New type.
8120
8121 2010-01-21  Doug Kwan  <dougkwan@google.com>
8122
8123         * arm.cc (Arm_exidx_input_section): New class.
8124         (Arm_relobj::exidx_input_section_by_link,
8125         Arm_relobj::exidx_input_section_by_shndx,
8126         Arm_relobj::make_exidx_input_section): New methods.
8127         (read_arm_attributes_section): Remove.
8128         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8129         information about them.
8130         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8131         to here.
8132
8133 2010-01-20  Doug Kwan  <dougkwan@google.com>
8134
8135         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8136         Input_section_specifier to Section_id.
8137         (Target_arm::new_arm_input_section: Adjust code for change of key
8138         type.
8139         (Target_arm::find_arm_input_section): Ditto.
8140         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8141         (Section_id): Remove.
8142         (Garbage_collection::Section_id_hash): Remove.
8143         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8144         (Section_id): Remove.
8145         (Icf::Section_id_hash): Remove.
8146         * object.h (Section_id, Const_section_id, Section_id_hash,
8147         Const_section_id_hash): New type definitions.
8148         * output.cc (Output_section::add_relaxed_input_section): Change to
8149         use Const_section_id instead of Input_section_specifier as key type.
8150         (Output_section::add_merge_input_section): Ditto.
8151         (Output_section::build_relaxation_map): Change to use Section_id
8152         instead of Input_section_specifier as key type.
8153         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8154         Ditto.
8155         (Output_section::convert_input_sections_to_relaxed_sections): Change
8156         to use Const_section_id instead of Input_section_specifier as key type.
8157         (Output_section::find_merge_section): Ditto.
8158         (Output_section::find_relaxed_input_section): Ditto.
8159         * output.h (Input_section_specifier): Remove class.
8160         (Output_section::Output_section_data_by_input_section_map): Change
8161         key type to Const_section_id.
8162         (Output_section::Output_relaxed_input_section_by_input_section_map):
8163         Ditto.
8164         (Output_section::Relaxation_map): Change key type to Section_id.
8165
8166 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8167
8168         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8169         (class Arm_v4bx_stub): New class.
8170         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8171         (Stub_factory::make_arm_v4bx_stub): New method.
8172         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8173         (Stub_table::empty): Handle v4bx stubs.
8174         (Stub_table::add_arm_v4bx_stub): New method.
8175         (Stub_table::find_arm_v4bx_stub): New method.
8176         (Arm_relocate_functions::v4bx): New method.
8177         (Target_arm::fix_v4bx): New method.
8178         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8179         (Stub_table::relocate_stubs): Likewise.
8180         (Stub_table::do_write): Likewise.
8181         (Stub_table::update_data_size_and_addralign): Likewise.
8182         (Stub_table::finalize_stubs):  Likewise.
8183         (Target_arm::Scan::local): Likewise.
8184         (Target_arm::Scan::global): Likewise.
8185         (Target_arm::do_finalize_sections): Likewise.
8186         (Target_arm::Relocate::relocate): Likewise.
8187         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8188         Likewise.
8189         (Target_arm::scan_reloc_for_stub): Likewise.
8190         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8191
8192 2010-01-19  Ian Lance Taylor  <iant@google.com>
8193
8194         * output.cc (Output_section_headers::do_sized_write): Write large
8195         segment count to sh_info field.
8196         (Output_file_header::do_sized_write): For large segment count,
8197         write PN_XNUM to e_phnum field.
8198
8199 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8200
8201         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8202         (Arm_relocate_functions::thm_jump8): New function.
8203         (Arm_relocate_functions::thm_jump11): New function.
8204         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8205         R_ARM_THM_JUMP11.
8206         (Target_arm::Scan::global): Likewise.
8207         (Target_arm::Relocate::relocate): Likewise.
8208         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8209         Likewise.
8210
8211 2010-01-14  Doug Kwan  <dougkwan@google.com>
8212
8213         * arm.cc (map, utility): Include headers.
8214         (Target_arm::apply_cortex_a8_workaround): New method.
8215         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8216         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8217         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8218         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8219         the --[no-]fix-cortex-a8 command line options.
8220         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8221         (Target_arm::relocate_stub): Use addend in instruction template.
8222         * options.h (DEFINE_bool): Set the user-set flag.
8223         (General_options): Add --[no-]-fix-cortex options.
8224         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8225         : Update fast look-up map after conversion.
8226
8227 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8228
8229         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8230         in the first pass of do_layout.
8231
8232 2010-01-13  Doug Kwan  <dougkwan@google.com>
8233
8234         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8235         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8236         apparent compiler problem of not folding static constant integral
8237         data members of elfcpp::Elf_sizes<32>.
8238
8239 2010-01-13  Doug Kwan  <dougkwan@google.com>
8240
8241         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8242         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8243         Arm_relobj::scan_section_for_cortex_a8_erratum,
8244         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8245         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8246         sections to scan for relocation stubs into a new method
8247         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8248         relocation and Cortex-A8 stub scanning.
8249         (Target_arm::do_relax): Force stubs to be after stubbed sections
8250         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8251         the beginning of a new relaxation pass.  Update a comment.
8252         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8253
8254 2010-01-12  Ian Lance Taylor  <iant@google.com>
8255
8256         * target-reloc.h (visibility_error): New inline function.
8257         (relocate_section): Call visibility_error.
8258         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8259         (MOSTLYCLEANFILES): Likewise.
8260         (protected_4_pic.o, protected_3.err): New targets.
8261         * testsuite/protected_4.cc: New file.
8262
8263 2010-01-12  Doug Kwan  <dougkwan@google.com>
8264
8265         * arm.cc (Cortex_a8_reloc): New class.
8266         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8267         and cortex_a8_relocs_info_.
8268         (Target_arm::fix_cortex_a8): New method definition.
8269         (Target_arm::Cortex_a8_relocs_info): New type.
8270         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8271         New data member declarations.
8272         (Target_arm::scan_reloc_for_stub): Record information about
8273         relocations for THUMB branches that might be exempted from the
8274         Cortex-A8 workaround.
8275         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8276         at the beginning of a relaxation pass.
8277
8278 2010-01-12  Doug Kwan  <dougkwan@google.com>
8279
8280         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8281         (Arm_relobj::Mapping_symbol_position,
8282          Arm_reloj::Mapping_symbol_position_less,
8283          Arm_relobj::Mapping_symbols_info): New types.
8284         (Target_arm::is_mapping_symbol_name): New method definition.
8285         (Arm_relobj::do_count_local_symbols): Save information about mapping
8286         symbols.
8287
8288 2010-01-11  Doug Kwan  <dougkwan@google.com>
8289
8290         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8291         Arm_relocate_functions::thumb32_branch_upper,
8292         Arm_relocate_functions::thumb32_branch_lower,
8293         Arm_relocate_functions::thumb32_cond_branch_offset,
8294         Arm_relocate_functions::thumb32_cond_branch_upper,
8295         Arm_relocate_functions::thumb32_cond_branch_lower,
8296         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8297         branch offset encoding.
8298         (Arm_relocate_functions::thumb_branch_common): Use new branch
8299         offset encoding methods to avoid code duplication.
8300         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8301         (Stub_addend_reader::operator()): Use new branch encoding method
8302         to avoid code duplication.
8303
8304 2010-01-11  Doug Kwan  <dougkwan@google.com>
8305
8306         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8307         (Target_arm::do_finalize_sections): Define special EXIDX section
8308         symbols only if referenced.
8309         * gc.h (Garbage_collection::add_reference): New method.
8310         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8311         code duplication.
8312
8313 2010-01-11  Ian Lance Taylor  <iant@google.com>
8314
8315         * script.cc (Version_script_info::build_expression_list_lookup):
8316         Change complaing about duplicate wildcard match from error to
8317         warning.
8318
8319         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8320         of 2009-12-30.
8321         (Version_script_info::Version_script_info): Initialize globs_,
8322         default_version_, default_is_global_, and exact_.  Don't
8323         initialize globals_ or locals_.
8324         (Version_script_info::build_lookup_tables): Build local symbols
8325         first.
8326         (Version_script_info::unquote): New function.
8327         (Version_script_info::add_exact_match): New function.
8328         (Version_script_info::build_expression_list_lookup): Remove lookup
8329         parameter.  Add is_global parameter.  Change all callers.  Handle
8330         wildcard pattern specially.  Unquote pattern.  Call
8331         add_exact_match.
8332         (Version_script_info::get_name_to_match): New function.
8333         (Version_script_info::get_symbol_version): New function.
8334         (Version_script_info::get_symbol_version_helper): Remove.
8335         (Version_script_info::check_unmatched_names): Call unquote.
8336         * script.h (class Version_script_info): Change get_symbol_version
8337         to be non-inline and add is_global parameter; change all callers.
8338         Rewrite symbol_is_local.  Update declarations.  Define struct
8339         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8340         Remove globals_ and locals_ members.  Add exact_, globs_,
8341         default_version_, is_global_.
8342         (Version_script_info::Glob): Remove pattern, add expression and
8343         is_global.  Update constructor.  Change all callers.
8344         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8345         default version.
8346         (Versions::symbol_section_contents): If a symbol is undefined, or
8347         defined in a dynamic object, set the version index to
8348         VER_NDX_LOCAL.
8349         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8350         symbol_is_local.
8351         (Symbol_table::add_from_pluginobj): Likewise.
8352         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8353
8354 2010-01-11  Doug Kwan  <dougkwan@google.com>
8355
8356         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8357         (incremental_dump_LDADD): Add linking option for libintl.
8358         * Makefile.in: Regenerate.
8359
8360 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8361
8362         PR gold/11144
8363         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8364         instead of -Ds.
8365         * testsuite/Makefile.in: Regenerated.
8366
8367 2010-01-10  Doug Kwan  <dougkwan@google.com>
8368
8369         * options.h (DEFINE_var): Use parentheses around argument varname__
8370         in macro body to avoid any unintended subsequent substitutions.
8371
8372 2010-01-10  Ian Lance Taylor  <iant@google.com>
8373
8374         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8375         candidates before doing symbol resolution.
8376
8377         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8378         ODR candidates if only one is weak.
8379
8380 2010-01-08  Ian Lance Taylor  <iant@google.com>
8381
8382         * script.cc (Version_script_info::build_expression_list_lookup):
8383         Don't warn about ambiguous version, just record the ambiguity.
8384         (Version_script_info::get_symbol_version_helper): Give error if
8385         version is ambiguous.
8386
8387 2010-01-08  Doug Kwan  <dougkwan@google.com>
8388
8389         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8390         prev_data_size_ and prev_addralign_.  Remove initializer for
8391         deleted data member has_been_changed_.
8392         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8393         to determine if the table is empty.
8394         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8395         Remove.
8396         (Stub_table::add_reloc_stub): Define method in class definition
8397         instead of just declaring it there.
8398         (Stub_table::add_cortex_a8_stub): New method definition.
8399         (Stub_table::update_data_size_and_addralign): Ditto.
8400         (Stub_table::finalize_stubs): Ditto.
8401         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8402         (Stub_table::do_addralign_): Return address alignment in the
8403         (Stub_table::do_reset_address_and_file_offset): Define method in
8404         class definition instead of declaring it there.  Set current data
8405         size to be the data size of the previous pass.
8406         (Stub_table::set_final_data_size): Use current data size as the
8407         final data size.
8408         (Stub_table::relocate_stub): Change parameter type of stub from
8409         Reloc_stub pointer to Stub pointer.
8410         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8411         (Stub_table::Cortex_a8_stub_list): New typedef.
8412         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8413          Stub_table::prev_addralign_): New data member.
8414         (Arm_relobj::Arm_relobj): Initialize data member
8415         section_has_cortex_a8_workaround_.
8416         (Arm_relobj::section_has_cortex_a8_workaround,
8417          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8418          definitions.
8419         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8420         declarations.
8421         (Target_arm::relocate_stub): Change parameter type of stub from
8422         Reloc_stub pointer to Stub pointer.
8423         (Insn_template::size, Insn_template::alignment): Handle
8424         THUMB16_SPECIAL_TYPE.
8425         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8426          Stub_table::update_data_size_and_addralign,
8427          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8428         definitions.
8429         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8430         (Stub_table::do_write): Ditto.
8431         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8432
8433 2010-01-08  Ian Lance Taylor  <iant@google.com>
8434
8435         PR 11108
8436         * symtab.h (class Symbol): Remove fields is_target_special_ and
8437         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8438         (Symbol::is_defined_in_discarded_section): New function.
8439         (Symbol::set_is_defined_in_discarded_section): New function.
8440         (Symbol::has_plt_offset): Rewrite.
8441         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8442         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8443         Don't initialize is_target_special_ or has_plt_offset_.
8444         Initialize is_defined_in_discarded_section_.
8445         (Symbol_table::add_from_relobj): If appropriate, set
8446         is_defined_in_discarded_section.
8447         * resolve.cc (Symbol::override_base_with_special): Don't test
8448         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8449         * target-reloc.h (relocate_section): Do special handling for
8450         symbols defined in discarded sections for global symbols as well
8451         as local symbols.
8452
8453 2010-01-08  Ian Lance Taylor  <iant@google.com>
8454
8455         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8456         the SHT_SYMTAB case.
8457
8458 2010-01-08  Ian Lance Taylor  <iant@google.com>
8459
8460         * object.cc (Sized_relobj::do_layout): Don't get confused if
8461         layout_eh_frame returns NULL.
8462
8463 2010-01-08  Ian Lance Taylor  <iant@google.com>
8464
8465         PR 11084
8466         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8467         dynamic symbol table, use the normal symbol table.
8468         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8469         symbol table.
8470
8471 2010-01-08  Ian Lance Taylor  <iant@google.com>
8472
8473         PR 11072
8474         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8475         sections.
8476
8477 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8478
8479         * version.cc (print_version): Change to "Copyright 2010".
8480
8481 2010-01-08  Ian Lance Taylor  <iant@google.com>
8482
8483         PR 10287
8484         PR 11063
8485         * i386.cc (class Target_i386): Change return type of plt_section
8486         to be non-const.
8487         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8488         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8489         tls_desc_rel_ field.
8490         (Output_data_plt_i386::rel_tls_desc): New function.
8491         (Target_i386::rel_tls_desc_section): New function.
8492         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8493         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8494         R_386_TLS_DESC reloc in rel_tls_desc_section.
8495         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8496         Define struct Tlsdesc_info.
8497         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8498         (Target_x86_64::do_reloc_symbol_index): New function.
8499         (Target_x86_64::add_tlsdesc_info): New function.
8500         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8501         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8502         tlsdesc_rel_ field.
8503         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8504         all callers.
8505         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8506         (Target_x86_64::rela_tlsdesc_section): New function.
8507         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8508         handling.
8509         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8510         (Target_x86_64::do_reloc_addend): New function.
8511         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8512         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8513         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8514         (Output_reloc::type): New function.
8515         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8516         (Output_reloc::is_target_specific): New function.
8517         (Output_reloc::target_arg): New function.
8518         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8519         absolute relocs and target specific relocs.
8520         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8521         add_target_specific.
8522         (class Output_data_reloc) [SHT_RELA]: Likewise.
8523         * output.cc (Output_reloc::Output_reloc): Add four new versions
8524         for absolute relocs and target specific relocs.
8525         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8526         (Output_reloc::get_symbol_index): Likewise.
8527         (Output_reloc::local_section_offset): Check that local_sym_index_
8528         is not TARGET_CODE or 0.
8529         (Output_reloc::symbol_value): Likewise.
8530         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8531         reloc.
8532         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8533         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8534         functions.
8535         * layout.cc (add_target_dynamic_tags): Use output section for
8536         DT_PLTRELSZ and DT_JMPREL.
8537
8538 2010-01-07  Ian Lance Taylor  <iant@google.com>
8539
8540         PR 11061
8541         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8542         function.
8543         (class Output_data_reloc_generic): Define.
8544         (class Output_data_reloc_base): Change base class to
8545         Output_data_reloc_generic.  Change add() method to call
8546         bump_relative_reloc_count for a relative reloc.  Remove
8547         sort_relocs_ field.
8548         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8549         to sort_relocs().
8550         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8551         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8552         appropriate.
8553         * layout.h (class Layout): Update declaration.
8554
8555 2010-01-07  Ian Lance Taylor  <iant@google.com>
8556
8557         * output.h (class Output_data): Add const version of
8558         output_section and do_output_section.
8559         (class Output_section_data): Add const version of
8560         do_output_section.
8561         (class Output_section): Likewise.
8562         * layout.cc (Layout::add_target_dynamic_tags): New function.
8563         * layout.h (class Layout): Update declarations.
8564         * arm.cc (Target_arm::do_finalize_sections): Use
8565         add_target_dynamic_tags.
8566         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8567         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8568         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8569         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8570
8571 2010-01-07  Ian Lance Taylor  <iant@google.com>
8572
8573         PR 11042
8574         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8575         object as needed.
8576
8577 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8578             Ian Lance Taylor  <iant@google.com>
8579
8580         PR 11019
8581         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8582         Xindex::read_symtab_xindex.
8583
8584 2010-01-07  Doug Kwan  <dougkwan@google.com>
8585
8586         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8587         (Insn_template::thumb16_bcond_insn): New method declaration.
8588         (Insn_template): Fix spelling.
8589         (Stub::thumb16_special): New method declaration.
8590         (Stub::do_write): Define virtual method which was previously pure
8591         virtual.
8592         (Stub::do_thumb16_special): New method declaration.
8593         (Stub::do_fixed_endian_write): New template member.
8594         (Reloc_stub::do_write): Remove.
8595         (Reloc_stub::do_fixed_endian_write): Remove.
8596         (Cortex_a8_stub): New class definition.
8597         (Stub_factory::make_cortex_a8_stub): New method definition.
8598         (Stub_factory::Stub_factory): Add missing static storage class
8599         qualifier for elf32_arm_stub_a8_veneer_blx.
8600
8601 2010-01-07  Ian Lance Taylor  <iant@google.com>
8602
8603         PR 10980
8604         * options.h (class General_options): Add --warn-unresolved-symbols
8605         and --error-unresolved-symbols.
8606         * errors.cc (Errors::undefined_symbol): Implement
8607         --warn-unresolved-symbols.
8608
8609         * options.h (class General_options): Add -z text and -z textoff.
8610         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8611
8612 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8613
8614         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8615         (Garbage_collection::cident_sections): New function.
8616         (Garbage_collection::add_cident_section): New function.
8617         (Garbage_collection::cident_sections_): New member.
8618         (gc_process_relocs): Add references to sections whose names are C
8619         identifiers.
8620         * gold.h (cident_section_start_prefix): New constant.
8621         (cident_section_stop_prefix): New constant.
8622         (is_cident): New function.
8623         * layout.cc (Layout::define_section_symbols): Replace string constants
8624         with the newly defined constants.
8625         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8626         C identifiers.
8627         * testsuite/Makefile.am: Add gc_orphan_section_test.
8628         * testsuite/Makefile.in: Regenerate.
8629         * testsuite/gc_orphan_section_test.cc: New file.
8630         * testsuite/gc_orphan_section_test.sh: New file.
8631
8632 2010-01-06  Ian Lance Taylor  <iant@google.com>
8633
8634         PR 10980
8635         * options.h (class General_options): Add --warn-shared-textrel.
8636         * layout.cc (Layout::finish_dynamic_section): Implement
8637         --warn-shared-textrel.
8638
8639         PR 10980
8640         * options.h (class General_options): Add --warn-multiple-gp.
8641
8642 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8643
8644         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8645         $(THREADSLIB) and $(LIBDL).
8646         * Makefile.in: Rebuild.
8647
8648 2010-01-06  Ian Lance Taylor  <iant@google.com>
8649
8650         PR 10980
8651         * options.cc (General_options::parse_section_start): New function.
8652         (General_options::section_start): New function.
8653         (General_options::General_options): Initialize all members.
8654         * options.h: Include <map>
8655         (class General_options): Add --section-start.  Add section_starts_
8656         member.
8657         * layout.cc (Layout::attach_allocated_section_to_segment): If
8658         --section-start was used, set the address of the segment.  Remove
8659         local sort_sections.
8660         (Layout::relaxation_loop_body): If the address of the load segment
8661         has been set by --section-start, don't use it.
8662         * output.h (Output_segment::update_flags_for_output_section): New
8663         function.
8664         * output.cc (Output_segment::add_output_section): Call
8665         update_flags_for_output_section.
8666
8667 2010-01-05  Ian Lance Taylor  <iant@google.com>
8668
8669         PR 10980
8670         * options.h (class General_options): Add --undefined-version.
8671         * script.cc (struct Version_expression): Add was_matched_by_symbol
8672         field.
8673         (Version_script_info::matched_symbol): New function.
8674         (Version_script_info::get_symbol_version_helper): Call
8675         matched_symbol.
8676         (Version_script_info::check_unmatched_names): New function.
8677         * script.h (class Version_script_info): Update declarations.
8678         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8679
8680         * options.h (class General_options): Use DEFINE_bool_alias for
8681         allow_multiple_definition.
8682         * resolve.cc (Symbol_table::should_override): Don't test
8683         allow_multiple_definition.
8684
8685         PR 10980
8686         * options.h (class General_options): Add --cref.
8687         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8688         until after printing cref table.
8689         * cref.cc: Include "symtab.h".
8690         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8691         (Cref_table_compare::operator()): New function.
8692         (Cref_inputs::gather_cref): New function.
8693         (filecol): New static const.
8694         (Cref_inputs::print_cref): New function.
8695         (Cref::print_cref): New function.
8696         * cref.h: Include <cstdio>.
8697         (class Cref): Update declarations.
8698         * mapfile.h (Mapfile::file): New function.
8699         * object.h (class Object): Define Symbols.  Declare virtual
8700         do_get_global_symbols.
8701         (Object::get_global_symbols): New function.
8702         * object.cc (Input_objects::add_object): Pass object to cref_ if
8703         --cref.
8704         (Input_objects::archive_start): Likewise.
8705         (Input_objects::archive_stop): Likewise.
8706         (Input_objects::print_cref): New function.
8707         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8708         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8709         --cref.
8710         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8711         function.
8712         * plugin.h (class Sized_pluginobj): Update declarations.
8713
8714 2010-01-05  Ian Lance Taylor  <iant@google.com>
8715
8716         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8717         to is_default_version.  Rename insdef to insdefault.
8718         (Symbol_table::add_from_relobj): Rename def to is_default_version
8719         and local to is_forced_local.
8720         (Symbol_table::add_from_pluginobj): Likewise.
8721         (Symbol_table::add_from_dynobj): Likewise.
8722         (Symbol_table::define_special_symbol): Rename insdef to
8723         insdefault.
8724
8725 2010-01-04  Ian Lance Taylor  <iant@google.com>
8726
8727         PR 10980
8728         * options.h (class General_options): Add
8729         --allow-multiple-definition and -z muldefs.
8730         * resolve.cc (Symbol_table::should_override): Don't warn about a
8731         multiple symbol definition if --allow-multiple-definition or -z
8732         muldefs.
8733
8734         PR 10980
8735         * options.h (class General_options): Add --add-needed and
8736         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8737         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8738         error if --copy-dt-needed-entries aka --add-needed is used and
8739         would cause a change in behaviour.
8740
8741         PR 10980
8742         * options.h (class General_options): Add -G as a short version of
8743         --shared.  Add no-op options -assert, -g, and -i.
8744
8745 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8746
8747         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8748         check for .text or .gnu.linkonce.t sections.
8749         * icf.cc (Icf::find_identical_sections): Ditto.
8750         Change the detection for mangled function name within the section
8751         name.
8752         * icf.h (is_section_foldable_candidate): New function.
8753
8754 2009-12-30  Ian Lance Taylor  <iant@google.com>
8755
8756         PR 10980
8757         * options.h (class General_options): Permit two dashes with
8758         --retain-symbols-file.
8759
8760 2009-12-30  Ian Lance Taylor  <iant@google.com>
8761
8762         PR 10979
8763         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8764         don't put the file header and segment headers in the text
8765         segment.
8766
8767         PR 10979
8768         * common.cc (Sort_commons::operator()): Stabilize sort when both
8769         entries are NULL.
8770         (Symbol_table::do_allocate_commons_list): When allocating common
8771         symbols, skip a symbol which is no longer common.
8772         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8773         an object before checking its type.
8774         * testsuite/common_test_2.c: New file.
8775         * testsuite/common_test_3.c: New file.
8776         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8777         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8778         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8779         (common_test_2_pic.o, common_test_2.so): New targets.
8780         (common_test_3_pic.o, common_test_3.so): New targets.
8781         * testsuite/Makefile.in: Rebuild.
8782
8783         PR 10979
8784         * script.cc (read_input_script): If we see a new SECTIONS clause,
8785         and we have added an input section, give an error.
8786         * layout.h (class Layout): Add have_added_input_section function.
8787         Add have_added_input_section_ field.
8788         * layout.cc (Layout::Layout): Initialize
8789         have_added_input_section_.
8790         (Layout::layout): Set have_added_input_section_.
8791         (Layout::layout_eh_frame): Likewise.
8792
8793 2009-12-30  Ian Lance Taylor  <iant@google.com>
8794
8795         PR 10931
8796         * options.h (class General_options): Add --sort-common option.
8797         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8798         * common.cc (Sort_common): Add sort_order parameter to
8799         constructor.  Add sort_order_ field.
8800         (Sort_commons::operator): Check sort_order_.
8801         (Symbol_table::allocate_commons): Determine the sort order.
8802         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8803         Change all callers.
8804         (Symbol_table::do_allocate_commons_list): Likewise.
8805
8806 2009-12-30  Ian Lance Taylor  <iant@google.com>
8807
8808         PR 10916
8809         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8810         symbols from this object, don't change the visibility of an
8811         undefined symbol.
8812         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8813
8814 2009-12-30  Ian Lance Taylor  <iant@google.com>
8815
8816         PR 10861
8817         * script.h (class Version_script_info): Define Language enum.
8818         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8819         new fields globals_, locals_, and is_finalized_.
8820         * script.cc: Various formatting fixes.
8821         (class Parser_closure): Change language_stack_ from a vector of
8822         std::string to one of Version_script_info::Language.  Adjust all
8823         uses accordingly.
8824         (class Lazy_demangler): Remove.
8825         (struct Version_expression): Change language from std::string to
8826         Version_script_info::Language.
8827         (Version_script_info::Version_script_info): New function.
8828         (Version_script_info::~Version_script_info): Don't call clear.
8829         (Version_script_info::finalize): New function.
8830         (Version_script_info::build_lookup_tables): New function.
8831         (Version_script_info::build_expression_list_lookup): New
8832         function.
8833         (Version_script_info::get_symbol_version_helper): Rewrite to use
8834         lookup tables.
8835         (Version_script_info::print_expression_list): Adjust to use
8836         Version_script_info::Language.
8837         (script_push_lex_into_version_mode): Check that the version script
8838         has not been finalized.
8839         (version_script_push_lang): Change language string to
8840         Version_script_info::Language.
8841         * options.cc (Command_line::version_script): New function.
8842         * options.h (class General_options): Add finalize_dynamic_list
8843         function.  Change version_script from declaration to definition.
8844         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8845         * testsuite/version_script.map: Remove duplicate def of foo.
8846         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8847         version_script.map.
8848         * testsuite/Makefile.in: Rebuild.
8849
8850 2009-12-30  Ian Lance Taylor  <iant@google.com>
8851
8852         PR 10843
8853         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8854         if the input symbol index is 0, make the output symbol index 0.
8855
8856 2009-12-30  Ian Lance Taylor  <iant@google.com>
8857
8858         PR 10670
8859         * options.h (class General_options): Add -x/--discard-all.
8860         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8861         --discard-all.  If the local symbol needs a dynamic entry, check
8862         that before handling --discard-locals.
8863
8864 2009-12-30  Ian Lance Taylor  <iant@google.com>
8865
8866         PR 10450
8867         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8868         flags to PF_R.
8869         (Output_segment::add_output_section): Don't change the flags if
8870         the type is PT_TLS.
8871
8872         PR 10450
8873         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8874         GNU hash table if they need a dynamic value.  Otherwise, don't add
8875         them if they are defined in a dynamic object or are forced local.
8876
8877 2009-12-29  Ian Lance Taylor  <iant@google.com>
8878
8879         PR 10450
8880         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8881         .gnu.hash table for a 32-bit target.
8882
8883         PR 10450
8884         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8885         regular and a dynamic object only needs a dynamic symbol table
8886         entry if it is externally visible.
8887
8888         PR 10450
8889         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8890         constructor.  Add global_offset_table_ field.
8891         (Target_i386::got_section): Set global_offset_table_.
8892         (Target_i386::do_finalize_sections): Set global_offset_table_
8893         size.
8894         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8895         in constructor.  Add global_offset_table_ field.
8896         (Target_x86_64::got_section): Set global_offset_table_.
8897         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8898         size.
8899
8900         * layout.cc (Layout::Layout): Initialize increase_relro_.
8901         (Layout::get_output_section): Add is_relro, is_last_relro, and
8902         is_first_non_relro parameters.  Change all callers.
8903         (Layout::choose_output_section): Likewise.
8904         (Layout::add_output_section_data): Likewise.
8905         (Layout::make_output_section): Likewise.
8906         (Layout::set_segment_offsets): Clear increase_relro when using a
8907         linker script.
8908         * layout.h (class Layout): Add increase_relro method.  Add
8909         increase_relro_ field.  Update declarations.
8910         * output.cc (Output_section::Output_section): Initialize
8911         is_last_relro_ and is_first_non_relro_.
8912         (Output_segment::add_output_section): Group relro sections is
8913         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8914         (Output_segment::maximum_alignment): Remove relro handling.
8915         (Output_segment::set_section_addresses): Add increase_relro
8916         parameter.  Change all callers.  Add initial alignment to align
8917         relro sections on separate page.  Remove old relro handling.
8918         (Output_segment::set_section_list_addresses): Remove in_relro
8919         parameter.  Change all callers.
8920         (Output_segment::set_offset): Add increase parameter.  Change all
8921         callers.  Remove old relro handling.
8922         * output.h (class Output_section): Add new methods: is_last_relro,
8923         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8924         Add is_last_relro_ and is_first_non_relro_ fields.
8925         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8926         Create separate .got.plt section.  Call increase_relro.
8927         * x86_64.cc (Target_x86_64::got_section): Likewise.
8928         * testsuite/relro_script_test.t: Add .got.plt.
8929
8930         PR 10450
8931         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8932         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8933         (Layout::finalize): Call set_dynamic_symbol_size.
8934         (Layout::set_dynamic_symbol_size): New function.
8935         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8936         set_dynamic_symbol_size.
8937
8938         PR 10450
8939         * output.h (class Output_section): Add is_entsize_zero_ field.
8940         * output.cc (Output_section::Output_section): Initialize
8941         is_entsize_zero_.
8942         (Output_section::set_entsize): If two different entsizes are
8943         requested, force it to zero.
8944         (Output_section::add_input_section): Set flags for .debug_str
8945         before updating section flags.  Set entsize.
8946         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8947         and SHF_STRING if all input sections have those flags.
8948
8949 2009-12-29   Rafael Espindola  <espindola@google.com>
8950
8951         * main.cc (main): Fix the sys time reporting.
8952         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8953         reporting.
8954
8955 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8956
8957         * options.cc (General_options::parse_version): Allow -v to exit
8958         without an error if there is nothing to link.
8959
8960 2009-12-29  Ian Lance Taylor  <iant@google.com>
8961
8962         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8963         using a version of gcc before 4.1.
8964         * configure: Rebuild.
8965
8966 2009-12-28  Chris Demetriou  <cgd@google.com>
8967
8968         * attributes.cc (Output_attributes_section_data::do_write): Use
8969         std::vector::front rather than std::vector::data.
8970
8971 2009-12-28  Ian Lance Taylor  <iant@google.com>
8972
8973         * symtab.h (class Symbol_table): Add enum Defined.
8974         * resolve.cc (Symbol_table::should_override): Add defined
8975         parameter.  Change all callers.  Test whether object is NULL
8976         before calling a method on it.
8977         (Symbol_table::report_resolve_problem): Add defined parameter.
8978         Change all callers.
8979         (Symbol_table::should_override_with_special): Likewise.
8980         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8981         parameter.  Change all callers.
8982         (Symbol_table::do_define_in_output_data): Likewise.
8983         (Symbol_table::define_in_output_segment): Likewise.
8984         (Symbol_table::do_define_in_output_segment): Likewise.
8985         (Symbol_table::define_as_constant): Likewise.
8986         (Symbol_table::do_define_as_constant): Likewise.
8987         * script.h (class Symbol_assignment): Add is_defsym parameter to
8988         constructor; change all callers.
8989         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8990         parameter.  Change all callers.  Add is_defsym_ field.
8991         (class Parser_closure): Add parsing_defsym parameter to
8992         constructor; change all callers.  Add parsing_defsym accessor
8993         function.  Add parsing_defsym_ field.
8994
8995 2009-12-28  Ian Lance Taylor  <iant@google.com>
8996
8997         * gold.cc (queue_middle_tasks): Fix formatting.
8998         * object.cc (Relobj::is_section_name_included): Likewise.
8999
9000 2009-12-23  Ian Lance Taylor  <iant@google.com>
9001
9002         * i386.cc (Target_i386::do_calls_non_split): Recognize
9003         -fsplit-stack prologue for a function with a static chain.
9004         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9005         -fsplit-stack prologue when using %r11.
9006
9007 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9008
9009         * options.cc (General_options::parse_version): Make -v continue and do
9010         the link like GNU ld does.
9011
9012 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9013
9014         * Makefile.am (CCFILES): Add timer.cc.
9015         (HFILES): Add timer.h.
9016         * configure.ac: Check for sysconf and times.
9017         * main.cc: include timer.h.
9018         (main): Use Timer instead of get_run_time.
9019         * timer.cc: New.
9020         * timer.h: New.
9021         * workqueue.cc: include timer.h.
9022         (Workqueue::find_and_run_task):
9023         Report user, sys and wall time.
9024         * Makefile.in: Regenerate.
9025         * config.in: Regenerate.
9026         * configure: Regenerate.
9027
9028 2009-12-16  Doug Kwan  <dougkwan@google.com>
9029
9030         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9031         sections.
9032         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9033         relaxed input sections.
9034         * output.cc (Output_section::find_relaxed_input_section): Change
9035         return type to Output_relaxed_input_section pointer.  Adjust code
9036         for new type of relaxed_input_section_map_.
9037         * output.h (Output_section::find_relaxed_input_section): Change
9038         return type to Output_relaxed_input_section pointer.
9039         (Output_section::Output_relaxed_input_section_by_input_section_map):
9040         New type.
9041         (Output_section::relaxed_input_section_map_): Change type to
9042         Output_section::Output_relaxed_input_section_by_input_section_map.
9043         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9044         input section.
9045
9046 2009-12-15  Ian Lance Taylor  <iant@google.com>
9047
9048         * layout.cc (Layout::create_shstrtab): Only write out after input
9049         sections if we are compressing debug sections.
9050
9051 2009-12-15  Ian Lance Taylor  <iant@google.com>
9052
9053         * archive.cc (Archive::add_symbols): Only look up a symbol without
9054         a version if there is, in fact, a version.
9055
9056 2009-12-14  Ian Lance Taylor  <iant@google.com>
9057
9058         Revert -Wshadow changes, all changes from:
9059         2009-12-11  Doug Kwan  <dougkwan@google.com>
9060         2009-12-11  Nick Clifton  <nickc@redhat.com>
9061         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9062
9063 2009-12-11  Doug Kwan  <dougkwan@google.com>
9064
9065         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9066         due to -Wshadow.
9067         * attributes.cc (Object_attribute::size): Ditto.
9068         (Attributes_section_data::size): Ditto.
9069         (Attributes_section_data::Attributes_section_data): Ditto.
9070         (Output_attributes_section_data::do_write): Ditto.
9071         * attributes.h (Object_attribute::set_type): Ditto.
9072         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9073
9074 2009-12-11  Nick Clifton  <nickc@redhat.com>
9075
9076         * archive.cc: Fix shadowed variable warnings.
9077         * arm.cc: Likewise.
9078         * compressed_output.cc: Likewise.
9079         * compressed_output.h: Likewise.
9080         * configure: Likewise.
9081         * dwarf_reader.cc: Likewise.
9082         * dynobj.cc: Likewise.
9083         * dynobj.h: Likewise.
9084         * ehframe.cc: Likewise.
9085         * ehframe.h: Likewise.
9086         * errors.cc: Likewise.
9087         * expression.cc: Likewise.
9088         * fileread.cc: Likewise.
9089         * fileread.h: Likewise.
9090         * freebsd.h: Likewise.
9091         * i386.cc: Likewise.
9092         * icf.cc: Likewise.
9093         * incremental.h: Likewise.
9094         * layout.cc: Likewise.
9095         * layout.h: Likewise.
9096         * mapfile.cc: Likewise.
9097         * merge.cc: Likewise.
9098         * merge.h: Likewise.
9099         * object.cc: Likewise.
9100         * object.h: Likewise.
9101         * options.h: Likewise.
9102         * output.cc: Likewise.
9103         * output.h: Likewise.
9104         * parameters.cc: Likewise.
9105         * plugin.cc: Likewise.
9106         * powerpc.cc: Likewise.
9107         * reduced_debug_output.cc: Likewise.
9108         * reduced_debug_output.h: Likewise.
9109         * reloc.cc: Likewise.
9110         * reloc.h: Likewise.
9111         * resolve.cc: Likewise.
9112         * script-sections.cc: Likewise.
9113         * script.cc: Likewise.
9114         * script.h: Likewise.
9115         * sparc.cc: Likewise.
9116         * symtab.cc: Likewise.
9117         * symtab.h: Likewise.
9118         * target-select.cc: Likewise.
9119         * target-select.h: Likewise.
9120         * token.h: Likewise.
9121         * workqueue.cc: Likewise.
9122         * workqueue.h: Likewise.
9123         * x86_64.cc: Likewise.
9124
9125 2009-12-10  Doug Kwan  <dougkwan@google.com>
9126
9127         * arm.cc (attributes.h): New include.
9128         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9129         (Arm_relobj::~Arm_relobj): Delete object pointed by
9130         attributes_section_data_.
9131         (Arm_relobj::attributes_section_data): New method definition.
9132         (Arm_relobj::attributes_section_data_): New data member declaration.
9133         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9134         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9135         attributes_section_data_.
9136         (Arm_dynobj::attributes_section_data): New method definition.
9137         (Arm_dynobj::attributes_section_data_): New data member declaration.
9138         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9139         initialization value of may_use_blx_ to false.
9140         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9141         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9142         object attributes to compute results instead of hard-coding.
9143         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9144         Target_arm::get_secondary_compatible_arch,
9145         Target_arm::set_secondary_compatible_arch
9146         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9147         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9148         New method declarations.
9149         (Target_arm::get_aeabi_object_attribute): New method definition.
9150         (Target_arm::attributes_section_data_): New data member declaration.
9151         (read_arm_attributes_section): New template definition.
9152         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9153         (Arm_dynobj::do_read_symbols): Ditto.
9154         (Target_arm::do_finalize_sections): Merge attributes sections from
9155         input.  Check for BLX use after attributes section merging.
9156         Fix __exidx_start and __exidx_end visibility.  Create an
9157         .ARM.attributes section if necessary.
9158         (Target_arm::get_secondary_compatible_arch,
9159         Target_arm::set_secondary_compatible_arch,
9160         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9161         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9162         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9163         New method definitions.
9164
9165 2009-12-09  Ian Lance Taylor  <iant@google.com>
9166
9167         * plugin.cc (Plugin::load): Don't cast from void* to a function
9168         pointer.
9169
9170 2009-12-09  Ian Lance Taylor  <iant@google.com>
9171
9172         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9173         information fields.
9174
9175 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9176
9177         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9178         Replace two_file_shared_1.so with two_file_shared_2.so.
9179         * testsuite/Makefile.in: Regenerated.
9180
9181 2009-12-08  Doug Kwan  <dougkwan@google.com>
9182
9183         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9184         (HFILES): Add attributes.h and int_encoding.h.
9185         * Makefile.in: Regenerate.
9186         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9187         function definitions to int_encoding.cc
9188         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9189         prototypes to int_encoding.h
9190         * reduced_debug_output.cc (int_encoding.h): New include.
9191         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9192         function definitions to int_encoding.cc
9193         (insert_into_vector, read_from_pointer): Move template definitions to
9194         int_encoding.h
9195         * attributes.cc: New file.
9196         * attributes.h: New file.
9197         * int_encoding.cc: New file.
9198         * int_encoding.h: New file.
9199
9200 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9201
9202         PR gold/11055
9203         * incremental-dump.cc (dump_incremental_inputs): New.
9204         (main): Use dump_incremental_inputs.
9205
9206 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9207
9208         PR gold/10893
9209         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9210         checking elfcpp::STT_FUNC.
9211         (Target_i386::Relocate::relocate): Likewise.
9212         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9213
9214         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9215         symbols from shared libraries into normal FUNC symbols.
9216
9217         * symtab.h (Symbol): Add is_func and use it.
9218
9219 2009-12-05  Doug Kwan  <dougkwan@google.com>
9220
9221         * arm.cc (Target_arm::arm_info): Initialize new fields
9222         attributes_section and attributes_vendor.
9223         * i386.cc (Target_i386::i386_info): Same.
9224         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9225         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9226         fields attributes_section and attributes_vendor.
9227         * sparc.cc (Target_sparc::sparc_info): Same.
9228         * target.h (Target::attributes_section, Target::attributes_vendor,
9229         Target::is_attributes_section, Target::attribute_arg_type,
9230         Target::attributes_order): New method definitions.
9231         (Target::Target_info::attributes_section,
9232         Target::Target_info::attributes_vendor): New fields.
9233         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9234         virtual method definitions.
9235         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9236         attributes_section and attributes_vendor.
9237         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9238
9239 2009-12-05  Doug Kwan  <dougkwan@google.com>
9240
9241         * arm.cc: Update comments about interworking and stub generation.
9242         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9243         considered as non-PIC.
9244         (Arm_relocate_functions::base_abs): Fix formatting.
9245         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9246         of function to use GOT entry address instead of offset.
9247         (Target_arm::Scan::global): Issue an error if a symbol would need a
9248         PLT does not get one because it is untyped.  Remove code to create
9249         dynamic symbols for relative branches.
9250         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9251         takes unsigned integer instead of boolean.
9252
9253 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9254
9255         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9256         (two_file_test_LDADD): Likewise.
9257         (common_test_1_LDADD): Likewise.
9258         (exception_test_LDADD) Likewise.
9259         (weak_test_LDADD): Likewise.
9260         (many_sections_test_LDADD): Likewise.
9261         (initpri1_LDADD): Likewise.
9262         (script_test_1_LDADD): Likewise.
9263         (script_test_2_LDADD): Likewise.
9264         (justsyms_LDADD): Likewise.
9265         (binary_test_LDADD): Likewise.
9266         (large_LDADD): Likewise.
9267         * testsuite/Makefile.in: Regenerated.
9268
9269 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9270
9271         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9272         (Symbol_table::override_with_special): Likewise.
9273         (Symbol_table::add_from_object): Likewise.
9274
9275 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9276
9277         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9278         Don't set the data_offset twice.
9279
9280 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9281
9282         * testsuite/Makefile.in: Regenerate.
9283
9284 2009-12-03  Doug Kwan  <dougkwan@google.com>
9285
9286         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9287         (Target_arm::do_finalize_sections): Add parameter for symbol table
9288         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9289         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9290         parameter for symbol table pointer.
9291         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9292         an additional parameter for a pointer to symbol table.
9293         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9294         parameter for a symbol table pointer.
9295         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9296         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9297         Ditto.
9298         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9299         parameter for a symbol table pointer.
9300
9301 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9302
9303         * incremental.cc (Incremental_inputs_header)
9304         (Incremental_inputs_header_write, Incremental_inputs_entry)
9305         (Incremental_inputs_entry_write): Move ...
9306         * incremental.h (Incremental_inputs_header)
9307         (Incremental_inputs_header_write, Incremental_inputs_entry)
9308         (Incremental_inputs_entry_write): here.
9309
9310 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9311
9312         * incremental.cc (make_sized_incremental_binary): Set the target.
9313         Error if it is incompatible.
9314         * output.h (Output_file): Add filename method.
9315
9316 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9317
9318         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9319         from the get_* methods.
9320
9321 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9322
9323         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9324         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9325         Write 0 for the data_offset of scripts.
9326
9327 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9328
9329         * testsuite/Makefile.am: Add the incremental_test.sh test.
9330         * testsuite/incremental_test.sh: New.
9331         * testsuite/incremental_test_1.c: New.
9332         * testsuite/incremental_test_2.c: New.
9333
9334 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9335
9336         * incremental-dump.cc (main): Fix typos.
9337
9338 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9339
9340         PR gold/11025
9341         * incremental-dump.cc (main): Use llu to print 64 bit values.
9342
9343 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9344             H.J. Lu  <hongjiu.lu@intel.com>
9345
9346         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9347         $(LIBDL).
9348         (incremental_dump_LDADD): Likewise.
9349         * Makefile.in: Regenerated.
9350
9351 2009-11-25  Doug Kwan  <dougkwan@google.com>
9352
9353         Revert:
9354
9355         2009-11-25  Doug Kwan  <dougkwan@google.com>
9356
9357                 * arm.cc (Target_arm::Target_arm): Move method definition
9358                 outside of class definition.  Add code to handle
9359                 --target1-rel, --target1-abs and --target2= options.
9360                 (Target_arm::get_reloc_reloc_type): Change method to be
9361                 non-static and const.
9362                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9363                 New data member declaration.
9364                 (Target_arm::Scan::local, Target_arm::Scan::global,
9365                 Target_arm::Relocate::relocate,
9366                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9367                 Adjust call to Target_arm::get_real_reloc_type.
9368                 (Target_arm::get_real_reloc_type): Use command line options
9369                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9370                 * options.h (--target1-rel, --target1-abs, --target2): New
9371                 ARM-only options.
9372
9373 2009-11-25  Doug Kwan  <dougkwan@google.com>
9374
9375         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9376         class definition.  Add code to handle --target1-rel, --target1-abs
9377         and --target2= options.
9378         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9379         and const.
9380         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9381         member declaration.
9382         (Target_arm::Scan::local, Target_arm::Scan::global,
9383         Target_arm::Relocate::relocate,
9384         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9385         call to Target_arm::get_real_reloc_type.
9386         (Target_arm::get_real_reloc_type): Use command line options to
9387         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9388         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9389         options.
9390
9391 2009-11-25  Doug Kwan  <dougkwan@google.com>
9392
9393         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9394         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9395         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9396         formatting.
9397         (Arm_relocate_functions::thm_call): Replace body with a call to
9398         Arm_relocate_functions::thumb_branch_common.
9399         (Arm_relocate_functions::thm_jump24,
9400         Arm_relocate_functions::thm_xpc22): New method definitions.
9401         (Arm_relocate_functions::thumb_branch_common): New method definition.
9402         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9403         operator.
9404         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9405         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9406
9407 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9408
9409         * Makefile.am: Build incremental-dump
9410         * Makefile.in: Regenerate.
9411         * incremental-dump.cc: New.
9412         * incremental.cc (Incremental_inputs_header_data,
9413         Incremental_inputs_entry_data): Move to incremental.h
9414         * incremental.h: (Incremental_inputs_header_data,
9415         Incremental_inputs_entry_data): Move from incremental.cc
9416
9417 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9418
9419         * incremental.cc (Incremental_inputs_header,
9420         Incremental_inputs_header_write, Incremental_inputs_entry,
9421         Incremental_inputs_entry_write): Add a typedef with the data type.
9422
9423 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9424
9425         * incremental.cc (Incremental_inputs_header,
9426         Incremental_inputs_header_write, Incremental_inputs_entry,
9427         Incremental_inputs_entry_write): Update comment about which
9428         type has the filed descriptions.
9429
9430 2009-11-15  Doug Kwan  <dougkwan@google.com>
9431
9432         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9433         (Arm_relocate_functions::arm_branch_common): Change method defintion
9434         in class definition to a method declaration and update list of formal
9435         parameters.
9436         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9437         Arm_relocation_functions::jump24): Adjust call to
9438         Arm_relocate_functions::arm_branch_common.  Update list of formal
9439         parameters.
9440         (Arm_relocate_functions::xpc25): New method definition.
9441         (Arm_relocate_functions::arm_branch_common): Move method defintion
9442         out from class definition.  Use stubs for mode-switching and extending
9443         branch ranges.
9444         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9445         specially.  Change code to enable use of stubs in ARM branches.
9446
9447 2009-11-10  Doug Kwan  <dougkwan@google.com>
9448
9449         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9450         in method declaration.
9451         (Target_arm::relocate_stub): New method declaration.
9452         (Target_arm::default_target): Change to return a pointer instead of
9453         a const reference.
9454         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9455         Target_arm::default_target.
9456         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9457         method definition.
9458         (Target_arm::relocate_section): Adjust view.
9459         (Target_arm::relocate_stub): New method definition.
9460
9461 2009-11-10  Doug Kwan  <dougkwan@google.com>
9462
9463         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9464         a format warning.
9465         * incremental.cc (open_incremental_binary): Initialized local
9466         variables to avoid warnings.
9467         * object.cc (make_elf_object): Ditto.
9468         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9469         a format warning.
9470
9471 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9472
9473         PR gold/10930
9474         * testsuite/plugin_test.c: Include "config.h".
9475
9476 2009-11-09  Doug Kwan  <dougkwan@google.com>
9477
9478         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9479         (arm_symbol_value): Remove.
9480         (Arm_relocate_functions::arm_branch_common,
9481         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9482         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9483         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9484         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9485         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9486         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9487         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9488         Arm_relocate_functions::thm_mobw_abs_nc,
9489         Arm_relocate_functions::thm_mov_abs,
9490         Arm_relocate_functions::movw_prel_nc,
9491         Arm_relocate_functions::thm_movt_abs,
9492         Arm_relocate_functions::movt_prel,
9493         Arm_relocate_functions::thm_movw_prel_nc,
9494         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9495         (Target_arm::Relocate::relocate): Only decompose address into two
9496         parts if relocation type uses the thumb-bit and pass the actual
9497         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9498         calls to methods in Arm_relocate_functions for this change.
9499
9500 2009-11-08  Ian Lance Taylor  <iant@google.com>
9501
9502         PR 10925
9503         * reloc.cc: Instantiate
9504         Sized_relobj::initialize_input_to_output_maps and
9505         Sized_relobj:free_input_to_output_maps.
9506
9507 2009-11-06  Ian Lance Taylor  <iant@google.com>
9508
9509         PR 10876
9510         * defstd.cc (in_segment): Set only_if_ref true for "end".
9511
9512 2009-11-06  Doug Kwan  <dougkwan@google.com>
9513
9514         * arm.cc (class Reloc_stub): Correct a comment.
9515         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9516         (Target_arm::scan_section_for_stubs): New method declaration.
9517         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9518         Change methods from private to protected.
9519         (Target_arm::do_may_relax): New method definition.
9520         (Target_arm::do_relax, Target_arm::group_sections,
9521         Target_arm::scan_reloc_for_stub,
9522         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9523         (Target_arm::arm_input_section_map_): New data member declaration.
9524         (Target_arm::scan_reloc_for_stub,
9525         Target_arm::scan_reloc_section_for_stubs,
9526         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9527         Target_arm::do_relax): New method definitions.
9528
9529 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9530
9531         * configure.ac: Check for (struct stat)::st_mtim
9532         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9533         * config.in: Regenerate.
9534         * configure: Regenerate.
9535
9536 2009-11-05  Ian Lance Taylor  <iant@google.com>
9537
9538         PR 10910
9539         * output.cc (Output_segment::add_output_section): Add missing
9540         return statement.
9541
9542 2009-11-04  Ian Lance Taylor  <iant@google.com>
9543
9544         PR 10880
9545         * object.h (class Object): Add is_needed and set_is_needed
9546         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9547         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9548         defined in a dynamic object and referenced by a regular object,
9549         set is_needed for the dynamic object.
9550         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9551         if the file is marked with as_needed and it is not needed.
9552
9553 2009-11-04  Ian Lance Taylor  <iant@google.com>
9554
9555         PR 10887
9556         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9557         tags if data is discarded by linker script.
9558         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9559         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9560         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9561         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9562
9563 2009-11-04  Ian Lance Taylor  <iant@google.com>
9564
9565         * layout.cc (Layout::get_output_section): Add is_interp and
9566         is_dynamic_linker_section parameters.  Change all callers.
9567         (Layout::choose_output_section): Likewise.
9568         (Layout::make_output_section): Likewise.
9569         (Layout::add_output_section_data): Add is_dynamic_linker_section
9570         parameter.  Change all callers.
9571         * layout.h (class Layout): Update declarations.
9572         * output.h (class Output_section): Add is_interp, set_is_interp,
9573         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9574         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9575         generate_code_fills_at_write_ to a bitfield.
9576         * output.cc (Output_section::Output_sections): Initialize new
9577         fields.
9578         (Output_segment::add_output_section): Add do_sort parameter.
9579         Change all callers.
9580
9581 2009-11-03  Ian Lance Taylor  <iant@google.com>
9582
9583         PR 10860
9584         * options.h (class General_options): Add --warn-common.
9585         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9586         merging two common symbols.
9587         (Symbol_table::should_override): Handle --warn-common when merging
9588         a common symbol with a defined symbol.  Use report_resolve_problem
9589         for multiple definitions.
9590         (Symbol_table::report_resolve_problem): New function.
9591         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9592
9593 2009-11-03  Doug Kwan  <dougkwan@google.com>
9594
9595         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9596         stub_factory_.
9597         (Target_arm::stub_factory): New method definition.
9598         (Target_arm::new_arm_input_section,
9599         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9600         Target_arm::reloc_uses_thumb_bit): New method declarations.
9601         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9602         New type definitions.
9603         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9604         member declarations.
9605         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9606         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9607         New method definitions.
9608
9609 2009-11-03  Ian Lance Taylor  <iant@google.com>
9610
9611         * options.h (class General_options): Add --warn_constructors.
9612
9613 2009-11-03  Ian Lance Taylor  <iant@google.com>
9614
9615         PR 10893
9616         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9617         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9618
9619 2009-11-03  Ian Lance Taylor  <iant@google.com>
9620
9621         PR 10895
9622         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9623         --msgid-bugs-address.
9624         (install-pdf): New target.
9625         (install-data_yes): Look up one directory to find mkinstalldirs.
9626
9627 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9628
9629         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9630         tree.
9631
9632 2009-10-30  Doug Kwan  <dougkwan@google.com>
9633
9634         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9635
9636 2009-10-30  Doug Kwan  <dougkwan@google.com>
9637
9638         * arm.cc (Stub_addend_reader): New struct template definition
9639         and partial specializations.
9640         (Stub_addend_reader::operator()): New method definition for a
9641         partially specialized template.
9642
9643 2009-10-30  Doug Kwan  <dougkwan@google.com>
9644
9645         * arm.cc (Arm_relobj::processor_specific_flags): New method
9646         definition.
9647         (Arm_relobj::do_read_symbols): New method declaration.
9648         (Arm_relobj::processor_specific_flags_): New data member declaration.
9649         (Arm_dynobj): New class definition.
9650         (Target_arm::do_finalize_sections): Add input_objects parameter.
9651         (Target_arm::do_adjust_elf_header): New method declaration.
9652         (Target_arm::are_eabi_versions_compatible,
9653         (Target_arm::merge_processor_specific_flags): New method declaration.
9654         (Target_arm::do_make_elf_object): New overloaded method definitions
9655         and declaration.
9656         (Arm_relobj::do_read_symbols): New method definition.
9657         (Arm_dynobj::do_read_symbols): Ditto.
9658         (Target_arm::do_finalize_sections): Add input_objects parameters.
9659         Merge processor-specific flags from all input objects.
9660         (Target_arm::are_eabi_versions_compatible,
9661         Target_arm::merge_processor_specific_flags,
9662         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9663         New method definitions.
9664         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9665         Input_objects pointer type parameter.
9666         * layout.cc (Layout::finalize): Pass input objects to target's.
9667         finalize_sections function.
9668         * output.cc (Output_file_header::do_sized_write): Set ELF file
9669         header's processor-specific flags.
9670         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9671         Input_objects pointer type parameter.
9672         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9673         * target.h (Input_objects): New forward class declaration.
9674         (Target::processor_specific_flags,
9675         Target::are_processor_specific_flags_sect): New method definitions.
9676         (Target::finalize_sections): Add input_objects parameter.
9677         (Target::Target): Initialize processor_specific_flags_ and
9678         are_processor_specific_flags_set_.
9679         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9680         parameter.
9681         (Target::set_processor_specific_flags): New method definition.
9682         (Target::processor_specific_flags_,
9683         Target::are_processor_specific_flags_set_): New data member
9684         declarations.
9685         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9686         Input_objects pointer type parameter.
9687
9688 2009-10-30  Doug Kwan  <dougkwan@google.com>
9689
9690         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9691
9692 2009-10-28  Ian Lance Taylor  <iant@google.com>
9693
9694         * object.h (class Relobj): Drop options parameter from
9695         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9696         do_scan_relocs, do_relocate.  Change all callers.
9697         (class Sized_relobj): Drop options parameters from
9698         do_gc_process_relocs, do_scan_relocs, do_relocate,
9699         do_relocate_sections, relocate_sections, emit_relocs_scan,
9700         emit_relocs_scan_reltype.  Change all callers.
9701         (struct Relocate_info): Remove options field and all references to
9702         it.
9703         * reloc.h (class Read_relocs): Remove options constructor
9704         parameter and options_ field.  Change all callers.
9705         (class Gc_process_relocs, class Scan_relocs): Likewise.
9706         (class Relocate_task): Likewise.
9707         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9708         all callers.
9709         (scan_relocatable_relocs): Likewise.
9710         * target.h (class Sized_target): Remove options parameter from
9711         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9712         all callers.
9713         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9714         callers.
9715         * arm.cc: Update functions to remove options parameters.
9716         * i386.cc: Likewise.
9717         * powerpc.cc: Likewise.
9718         * sparc.cc: Likewise.
9719         * x86_64.cc: Likewise.
9720         * testsuite/testfile.cc: Likewise.
9721
9722 2009-10-28  Doug Kwan  <dougkwan@google.com>
9723
9724         * arm.cc (Arm_relobj): New class definition.
9725         (Arm_relobj::scan_sections_for_stubs,
9726         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9727         New method definitions.
9728
9729 2009-10-28  Cary Coutant  <ccoutant@google.com>
9730
9731         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9732         (Plugin::cleanup_done_): New member.
9733         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9734         (Plugin_manager::cleanup_done_): Remove.
9735         (Plugin_manager::add_input_file): Edit error message.
9736         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9737         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9738
9739 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9740
9741         * fileread.cc: (File_read::View::~View): Use the new
9742         data_ownership_ filed.
9743         (File_read::~File_read): Dispose the new whole_file_view_.
9744         (File_read::open): Mmap the whole file if needed.
9745         (File_read::open): Use whole_file_view_ instead of contents_.
9746         (File_read::find_view): Use whole_file_view_ if applicable.
9747         (File_read::do_read): Use whole_file_view_ instead of contents_.
9748         (File_read::make_view): Use whole_file_view_ instead of contents_,
9749         update File_read::View::View call.
9750         (File_read::find_or_make_view): Update File_read::View::View
9751         call.
9752         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9753         remove contents_
9754         (File_read::View::Data_ownership): New enum.
9755         (File_read::View::View): Replace bool mapped_ with Data_ownership
9756         argument.
9757         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9758         (File_read::View::data_ownership_): New field.
9759         (File_read::contents_): Remove (replaced by whole_file_view_).
9760         (File_read::whole_file_view_): New field.
9761         * options.h (class General_options): Add --keep-files-mapped.
9762
9763 2009-10-27  Cary Coutant  <ccoutant@google.com>
9764
9765         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9766         * testsuite/Makefile.am (plugin_test_5): New test case.
9767         * testsuite/Makefile.in: Regenerate.
9768
9769 2009-10-25  Doug Kwan  <dougkwan@google.com>
9770
9771         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9772         from private to protected to allow access by child class.
9773         (Sized_relobj::do_relocate_sections): New method declaration.
9774         (Sized_relobj::relocate_sections): Virtualize.
9775         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9776         Sized_relobj::relocate_sections.  Instantiate template explicitly
9777         for different target sizes and endianity.
9778
9779 2009-10-24  Doug Kwan  <dougkwan@google.com>
9780
9781         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9782         (Arm_input_section::as_arm_input_section): New method.
9783         (Arm_output_section): New class definition.
9784         (Arm_output_section::create_stub_group,
9785         Arm_output_section::group_sections): New method definitions.
9786
9787 2009-10-22  Doug Kwan  <dougkwan@google.com>
9788
9789         * arm.cc (Arm_input_section): New class definition.
9790         (Arm_input_section::init, Arm_input_section:do_write,
9791         Arm_input_section::set_final_data_size,
9792         Arm_input_section::do_reset_address_and_file_offset): New method
9793         definitions.
9794
9795 2009-10-21  Doug Kwan  <dougkwan@google.com>
9796
9797         * arm.cc (Stub_table, Arm_input_section): New forward class
9798         declarations.
9799         (Stub_table): New class defintion.
9800         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9801         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9802         New method definition.
9803
9804 2009-10-21  Doug Kwan  <dougkwan@google.com>
9805
9806         * arm.cc: Update copyright comments.
9807         (Target_arm): New forward class template declaration.
9808         (Arm_address): New type.
9809         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9810         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9811         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9812         constants.
9813         (Insn_template): Same.
9814         (DEF_STUBS): New macro.
9815         (Stub_type): New enum type.
9816         (Stub_template): New class definition.
9817         (Stub): Same.
9818         (Reloc_stub): Same.
9819         (Stub_factory): Same.
9820         (Target_arm::Target_arm): Initialize may_use_blx_ and
9821         should_force_pic_veneer_.
9822         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9823         Target_arm::should_force_pic_veneer,
9824         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9825         Target_arm::using_thumb_only, Target_arm:;default_target): New
9826         method defintions.
9827         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9828         New data member declarations.
9829         (Insn_template::size, Insn_template::alignment): New method defintions.
9830         (Stub_template::Stub_template): New method definition.
9831         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9832         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9833         (Stub_factory::Stub_factory): New method definition.
9834         * gold.h (string_hash): New template.
9835         * output.h (Input_section_specifier::hash_value): Use
9836         gold::string_hash.
9837         (Input_section_specifier::string_hash): Remove.
9838         * stringpool.cc (Stringpool_template::string_hash): Use
9839         gold::string_hash.
9840
9841 2009-10-20  Doug Kwan  <dougkwan@google.com>
9842
9843         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9844         symbols of relaxed input sections.
9845         * output.h (Output_section::find_relaxed_input_section): Make
9846         method public.
9847
9848 2009-10-16  Doug Kwan  <dougkwan@google.com>
9849
9850         * dynobj.cc (Versions::Versions): Initialize version_script_.
9851         Only insert base version symbol definition for a shared object
9852         if version script defines any version versions.
9853         (Versions::define_base_version): New method definition.
9854         (Versions::add_def): Check that base version is not needed.
9855         (Versions::add_need): Define base version lazily.
9856         * dynobj.h (Versions::define_base_version): New method declaration.
9857         (Versions::needs_base_version_): New data member declaration.
9858         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9859         (check_DATA): Add no_version_test.stdout.
9860         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9861         New make rules.
9862         * testsuite/Makefile.in: Regenerate.
9863         * testsuite/no_version_test.c: New file.
9864         * testsuite/no_version_test.sh: Ditto.
9865
9866 2009-10-16  Doug Kwan  <dougkwan@google.com>
9867
9868         * expression.cc (class Segment_start_expression): New class definition.
9869         (Segment_start_expression::value): New method definition.
9870         (script_exp_function_segment_start): Return a new
9871         Segment_start_expression.
9872         * gold/script-c.h (script_saw_segment_start_expression): New function
9873         prototype.
9874         * script-sections.cc (Script_sections::Script_sections): Initialize
9875         SAW_SEGMENT_START_EXPRESSION_ to false.
9876         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9877         and -Tbbs options to specify section addresses if given in
9878         command line and no SEGMENT_START expression is seen in a script.
9879         * script-sections.h (Script_sections::saw_segment_start_expression,
9880         Script_sections::set_saw_segment_start_expression): New method
9881         definition.
9882         (Script_sections::saw_segment_start_expression_): New data member
9883         declaration.
9884         * script.cc (script_saw_segment_start_expression): New function.
9885         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9886         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9887         script_test_7.sh and script_test_8.sh.
9888         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9889         script_test_8.stdout.
9890         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9891         (script_test_6, script_test_6.stdout, script_test_7,
9892         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9893         * Makefile.in: Regenerate.
9894         * testsuite/script_test_6.sh: New file.
9895         * testsuite/script_test_6.t: Same.
9896         * testsuite/script_test_7.sh: Same.
9897         * testsuite/script_test_7.t: Same.
9898         * testsuite/script_test_8.sh: Same.
9899
9900 2009-10-16  Doug Kwan  <dougkwan@google.com>
9901
9902         * output.cc (Output_segment::set_section_list_address): Cast
9903         expressions to unsigned long long type to avoid format warnings.
9904
9905 2009-10-15  Ian Lance Taylor  <iant@google.com>
9906
9907         * script.cc (Script_options::add_symbol_assignment): Always add a
9908         dot assignment to script_sections_.
9909         * script-sections.cc (Script_sections::add_dot_assignment):
9910         Initialize if necessary.
9911
9912         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9913         program headers with no load segment if there is a linker script.
9914
9915         * layout.cc (Layout::set_segment_offsets): Align the file offset
9916         to the segment aligment for -N or -n with no load segment.
9917         * output.cc (Output_segment::add_output_section): Don't crash if
9918         the first section is a TLS section.
9919         (Output_segment::set_section_list_addresses): Print an error
9920         message if the address moves backward in a linker script.
9921         * script-sections.cc
9922         (Output_section_element_input::set_section_addresses): Don't
9923         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9924         (Orphan_output_section::set_section_addresses): Likewise.
9925
9926 2009-10-15  Doug Kwan  <dougkwan@google.com>
9927
9928         * layout.cc (Layout::finish_dynamic_section): Generate tags
9929         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9930         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9931         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9932
9933 2009-10-14  Ian Lance Taylor  <iant@google.com>
9934
9935         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9936         fields.
9937         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9938         data_shdr fields of relinfo.
9939         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9940         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9941         R_386_TLS_LDO_32, adjust based on section flags.
9942         (Target_i386::Relocate::fix_up_ldo): Remove.
9943
9944 2009-10-13  Ian Lance Taylor  <iant@google.com>
9945
9946         Add support for -pie.
9947         * options.h (class General_options): Add -pie and
9948         --pic-executable.
9949         (General_options::output_is_position_independent): Test -pie.
9950         (General_options::output_is_executable): Return true if not shared
9951         and not relocatable.
9952         (General_options::output_is_pie): Remove.
9953         * options.cc (General_options::finalize): Reject incompatible uses
9954         of -pie.
9955         * gold.cc (queue_middle_tasks): A -pie link is not static.
9956         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9957         * symtab.cc (Symbol::final_value_is_known): Return false if
9958         output_is_position_independent.
9959         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9960         output_is_position_independent.
9961         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9962         output_is_position_independent.
9963         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9964         output_is_position_independent.
9965         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9966         two_file_pie_test.
9967         (basic_pie_test.o, basic_pie_test): New targets.
9968         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9969         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9970         (two_file_pie_test): New target.
9971         * testsuite/Makefile.in: Rebuild.
9972         * README: Remove note saying that -pie is not supported.
9973
9974 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9975
9976         * options.h (class General_options): Add -init and -fini.
9977         * layout.cc (Layout::finish_dynamic_section): Emit
9978         given init and fini functions.
9979
9980 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9981
9982         * gc.h (gc_process_relocs): Check if icf is enabled using new
9983         function.
9984         * gold.cc (queue_initial_tasks): Likewise.
9985         (queue_middle_tasks): Likewise.
9986         * object.cc (do_layout): Likewise.
9987         * symtab.cc (is_section_folded): Likewise.
9988         * main.cc (main): Likewise.
9989         * reloc.cc (Read_relocs::run): Likewise.
9990         (Sized_relobj::do_scan_relocs): Likewise.
9991         * icf.cc (is_function_ctor_or_dtor): New function.
9992         (Icf::find_identical_sections): Check if function is ctor or dtor when
9993         safe icf is chosen.
9994         * options.h (General_options::icf): Change option to be an enum.
9995         (Icf_status): New enum.
9996         (icf_enabled): New method.
9997         (icf_safe_folding): New method.
9998         (set_icf_status): New method.
9999         (icf_status_): New variable.
10000         * (options.cc) (General_options::finalize): Set icf_status_.
10001         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10002         icf_test and icf_keep_unique_test to use the --icf enum flag.
10003         * testsuite/icf_safe_test.sh: New file.
10004         * testsuite/icf_safe_test.cc: New file.
10005
10006 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10007
10008         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10009         includes to gc.h and icf.h.
10010         * arm.cc: Include gc.h.
10011         * gold.cc: Likewise.
10012         * i386.cc: Likewise.
10013         * powerpc.cc: Likewise.
10014         * sparc.cc: Likewise.
10015         * x86_64.cc: Likewise.
10016         * gc.h: Include icf.h.
10017
10018 2009-10-11  Ian Lance Taylor  <iant@google.com>
10019
10020         * plugin.cc: Include "gold.h" before other header files.
10021
10022 2009-10-10  Chris Demetriou  <cgd@google.com>
10023
10024         * options.h (Input_file_argument::Input_file_type): New enum.
10025         (Input_file_argument::is_lib_): Replace with...
10026         (Input_file_argument::type_): New member.
10027         (Input_file_argument::Input_file_argument): Take Input_file_type
10028         'type' rather than boolean 'is_lib' as second argument.
10029         (Input_file_argument::is_lib): Use type_.
10030         (Input_file_argument::is_searched_file): New function.
10031         (Input_file_argument::may_need_search): Handle is_searched_file.
10032         * options.cc (General_options::parse_library): Support -l:filename.
10033         (General_options::parse_just_symbols): Update for Input_file_argument
10034         changes.
10035         (Command_line::process): Likewise.
10036         * archive.cc (Archive::get_file_and_offset): Likewise.
10037         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10038         * script.cc (read_script_file, script_add_file): Likewise.
10039         * fileread.cc (Input_file::Input_file): Likewise.
10040         (Input_file::will_search_for): Handle is_searched_file.
10041         (Input_file::open): Likewise.
10042         * readsyms.cc (Read_symbols::get_name): Likewise.
10043         * testsuite/Makefile.am (searched_file_test): New test.
10044         * testsuite/Makefile.in: Regenerate.
10045         * testsuite/searched_file_test.cc: New file.
10046         * testsuite/searched_file_test_lib.cc: New file.
10047
10048 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10049             Ian Lance Taylor  <iant@google.com>
10050
10051         * descriptor.cc: Include <cstdio> and "binary-io.h".
10052         (Descriptors::open): Open the files in binary mode always.
10053         * script.cc (Lex::get_token): Treat \r as whitespace.
10054
10055 2009-10-09  Ian Lance Taylor  <iant@google.com>
10056
10057         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10058
10059 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10060             Ian Lance Taylor  <iant@google.com>
10061
10062         * configure.ac: Check for readv function also.
10063         * fileread.cc (readv): Define if not HAVE_READV.
10064         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10065         does not exist.
10066         * config.in: Regenerate.
10067         * configure: Regenerate.
10068
10069 2009-10-09  Doug Kwan  <dougkwan@google.com>
10070
10071         * layout.cc (Layout::make_output_section): Call target hook to make
10072         ordinary output section.
10073         (Layout::finalize): Adjust parameter list of call the
10074         Target::may_relax().
10075         * layout.h (class Layout::section_list): New method.
10076         * merge.h (Output_merge_base::entsize): Change visibility to public.
10077         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10078         New methods.
10079         (Output_merge_string::do_is_string): New method.
10080         * object.cc (Sized_relobj::do_setup): renamed from
10081         Sized_relobj::set_up.
10082         * object.h (Sized_relobj::adjust_shndx,
10083         Sized_relobj::initializ_input_to_output_maps,
10084         Sized_relobj::free_input_to_output_maps): Change visibilities to
10085         protected.
10086         (Sized_relobj::setup): Virtualize.
10087         (Sized_relobj::do_setup): New method declaration.
10088         (Sized_relobj::invalidate_section_offset,
10089         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10090         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10091         * options.cc (parse_int): New function.
10092         * options.h (parse_int): New declaration.
10093         (DEFINE_int): New macro.
10094         (stub_group_size): New option.
10095         * output.cc (Output_section::Output_section): Initialize memebers
10096         merge_section_map_, merge_section_by_properties_map_,
10097         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10098         (Output_section::add_input_section): Handled deferred code-fill
10099         generation and remove an old comment.
10100         (Output_section::add_relaxed_input_section): New method definition.
10101         (Output_section::add_merge_input_section): Use merge section by
10102         properties map to speed to search.  Update merge section maps
10103         as appropriate.
10104         (Output_section::build_relaxation_map): New method definition.
10105         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10106         Same.
10107         (Output_section::relax_input_section): Renamed to
10108         Output_section::convert_input_sections_to_relaxed_sections and change
10109         interface to take a vector of pointers to relaxed sections.
10110         (Output_section::find_merge_section,
10111         Output_section::find_relaxed_input_section): New method definitions.
10112         (Output_section::is_input_address_mapped,
10113         Output_section::output_offset, Output_section::output_address):
10114         Use output section data maps to speed up searching.
10115         (Output_section::find_starting_output_address): Add comments.
10116         (Output_section::do_write,
10117         Output_section::write_to_postprocessing_buffer): Do code-fill
10118         generation as appropriate.
10119         (Output_section::get_input_sections): Invalidate relaxed input section
10120         map.
10121         (Output_section::restore_states): Adjust type of checkpoint .
10122         Invalidate relaxed input section map.
10123         * output.h (Output_merge_base): New class declaration.
10124         (Input_section_specifier): New class defintion.
10125         (class Output_relaxed_input_section) Change base class to
10126         Output_section_data_build.
10127         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10128         base class initializer.
10129         (Output_section::add_relaxed_input_section): New method declaration.
10130         (Output_section::Input_section): Change visibility to protected.
10131         (Output_section::Input_section::relobj,
10132         Output_section::Input_section::shndx): Handle relaxed input sections.
10133         Output_section::input_sections) Change visibility to protected.  Also
10134         define overload to return a non-const pointer.
10135         (Output_section::Merge_section_properties): New class defintion.
10136         (Output_section::Merge_section_by_properties_map,
10137         Output_section::Output_section_data_by_input_section_map,
10138         Output_section::Relaxation_map): New types.
10139         (Output_section::relax_input_section): Rename method to
10140         Output_section::convert_input_sections_to_relaxed_sections and change
10141         interface to take a vector of relaxed section pointers.
10142         (Output_section::find_merge_section,
10143         Output_section::find_relaxed_input_section,
10144         Output_section::build_relaxation_map,
10145         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10146         New method declarations.
10147         (Output_section::merge_section_map_
10148         Output_section::merge_section_by_properties_map_,
10149         Output_section::relaxed_input_section_map_,
10150         Output_section::is_relaxed_input_section_map_valid_,
10151         Output_section::generate_code_fills_at_write_): New data members.
10152         * script-sections.cc
10153         (Output_section_element_input::set_section_addresses): Call
10154         current_data_size and addralign methods of relaxed input sections.
10155         (Orphan_output_section::set_section_addresses): Call current_data_size
10156         and addralign methods of relaxed input sections.
10157         * symtab.cc (Symbol_table::compute_final_value): Extract template
10158         from the body of Symbol_table::sized_finalize_symbol.
10159         (Symbol_table::sized_finalized_symbol): Call
10160         Symbol_table::compute_final_value.
10161         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10162         (Symbol_table::compute_final_value): New templated method declaration.
10163         * target.cc (Target::do_make_output_section): New method defintion.
10164         * target.h (Target::make_output_section): New method declaration.
10165         (Target::relax): Add more parameters for input objects, symbol table
10166         and layout.  Adjust call to do_relax.
10167         (Target::do_make_output_section): New method declaration.
10168         (Target::do_relax): Add parameters for input objects, symbol table
10169         and layout.
10170
10171 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10172
10173         * pread.c: Include stdio.h.
10174
10175 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10176
10177         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10178         defined.
10179
10180 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10181
10182         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10183         Change read_shndx type to unsigned int.
10184         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10185         int.
10186         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10187         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10188         Change read_shndx type to unsigned int.
10189         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10190         int.
10191         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10192         * layout.cc (Layout::create_symtab_sections): Cast the result of
10193         local_symcount * symsize to off_t in the gold_assert.
10194
10195 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10196
10197         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10198         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10199         R_ARM_BASE_ABS.
10200         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10201         (Arm_relocate_functions::thm_abs5): New function.
10202         (Arm_relocate_functions::abs12): New function.
10203         (Arm_relocate_functions::abs16): New function.
10204         (Arm_relocate_functions::base_abs): New function.
10205         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10206         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10207         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10208         R_ARM_BASE_ABS.
10209         (Scan::global): Likewise.
10210         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10211         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10212         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10213         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10214         R_ARM_BASE_ABS.
10215
10216 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10217
10218         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10219         (Arm_relocate_functions::movt_prel): New function.
10220         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10221         (Arm_relocate_functions::thm_movt_prel): New function.
10222         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10223         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10224         (Scan::global, Relocate::relocate): Likewise.
10225         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10226
10227 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10228
10229         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10230         Incremental_checker.
10231         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10232         unsigned int.
10233         (class Incremental_inputs_header): New class.
10234         (Incremental_inputs_header_writer): Edit comment.
10235         (Incremental_inputs_entry): New class.
10236         (Incremental_inputs_entry_writer): Edit comment.
10237         (Sized_incremental_binary::do_find_incremental_inputs_section):
10238         Add *strtab_shndx parameter, fill it.
10239         (Sized_incremental_binary::do_check_inputs): New method.
10240         (Incremental_checker::can_incrementally_link_output_file): Use
10241         Sized_incremental_binary::check_inputs.
10242         (Incremental_inputs::report_command_line): Save command line in
10243         command_line_.
10244         * incremental.h:
10245         (Incremental_binary::find_incremental_inputs_section): New
10246         method.
10247         (Incremental_binary::do_find_incremental_inputs_section): Add
10248         strtab_shndx parameter.
10249         (Incremental_binary::do_check_inputs): New pure virtual method.
10250         (Sized_incremental_binary::do_check_inputs): Declare.
10251         (Incremental_checker::Incremental_checker): Add incremental_inputs
10252         parameter, use it to initialize incremental_inputs_.
10253         (Incremental_checker::incremental_inputs_): New field.
10254         (Incremental_checker::command_line): New method.
10255         (Incremental_checker::inputs): New method.
10256         (Incremental_checker::command_line_): New field.
10257
10258 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10259
10260         * incremental.cc: Include <cstdarg> and "target-select.h".
10261         (vexplain_no_incremental): New function.
10262         (explain_no_incremental): New function.
10263         (Incremental_binary::error): New method.
10264         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10265         method.
10266         (make_sized_incremental_binary): New function.
10267         (open_incremental_binary): New function.
10268         (can_incrementally_link_file): Add checks if output is ELF and has
10269         inputs section.
10270         * incremental.h: Include "elfcpp_file.h" and "output.h".
10271         (Incremental_binary): New class.
10272         (Sized_incremental_binary): New class.
10273         (open_incremental_binary): Declare.
10274         * object.cc (is_elf_object): Use
10275         elfcpp::Elf_recognizer::is_elf_file.
10276         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10277         * output.h (Output_file::filesize): New method.
10278
10279 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10280
10281         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10282         New function.
10283         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10284         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10285         function.
10286         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10287         function.
10288         (Arm_relocate_functions::movw_abs_nc): New function.
10289         (Arm_relocate_functions::movt_abs): New function.
10290         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10291         (Arm_relocate_functions::thm_movt_abs): New function.
10292         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10293         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10294         (Scan::global): Likewise.
10295         (Relocate::relocate): Likewise.
10296         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10297
10298 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10299
10300         * arm.cc (Arm_relocate_functions::got_prel) New function.
10301         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10302         (Relocate::relocate): Likewise.
10303         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10304
10305 2009-10-06  Ian Lance Taylor  <iant@google.com>
10306
10307         * options.h (class General_options): Define
10308         split_stack_adjust_size parameter.
10309         * object.h (class Object): Add uses_split_stack_ and
10310         has_no_split_stack_ fields.  Add uses_split_stack and
10311         has_no_split_stack accessor functions.  Declare
10312         handle_split_stack_section.
10313         (class Reloc_symbol_changes): Define.
10314         (class Sized_relobj): Define Function_offsets.  Declare
10315         split_stack_adjust, split_stack_adjust_reltype, and
10316         find_functions.
10317         * object.cc (Object::handle_split_stack_section): New function.
10318         (Sized_relobj::do_layout): Call handle_split_stack_section.
10319         * dynobj.cc (Sized_dynobj::do_layout): Call
10320         handle_split_stack_section.
10321         * reloc.cc (Sized_relobj::relocate_sections): Call
10322         split_stack_adjust for executable sections in split_stack
10323         objects.  Pass reloc_map to relocate_section.
10324         (Sized_relobj::split_stack_adjust): New function.
10325         (Sized_relobj::split_stack_adjust_reltype): New function.
10326         (Sized_relobj::find_functions): New function.
10327         * target-reloc.h: Include "object.h".
10328         (relocate_section): Add reloc_symbol_changes parameter.  Change
10329         all callers.
10330         * target.h (class Target): Add calls_non_split method.  Declare
10331         do_calls_non_split virtual method.  Declare match_view and
10332         set_view_to_nop.
10333         * target.cc: Include "elfcpp.h".
10334         (Target::do_calls_non_split): New function.
10335         (Target::match_view): New function.
10336         (Target::set_view_to_nop): New function.
10337         * gold.cc (queue_middle_tasks): Give an error if mixing
10338         split-stack and non-split-stack objects with -r.
10339         * i386.cc (Target_i386::relocate_section): Add
10340         reloc_symbol_changes parameter.
10341         (Target_i386::do_calls_non_split): New function.
10342         * x86_64.cc (Target_x86_64::relocate_section): Add
10343         reloc_symbol_changes parameter.
10344         (Target_x86_64::do_calls_non_split): New function.
10345         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10346         parameter.
10347         * powerpc.cc (Target_powerpc::relocate_section): Add
10348         reloc_symbol_changes parameter.
10349         * sparc.cc (Target_sparc::relocate_section): Add
10350         reloc_symbol_changes parameter.
10351         * configure.ac: Call AM_CONDITIONAL for the default target.
10352         * configure: Rebuild.
10353         * testsuite/Makefile.am (TEST_AS): New variable.
10354         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10355         (check_DATA): Add split_i386 and split_x86_64 files.
10356         (SPLIT_DEFSYMS): Define.
10357         (split_i386_[1234n].o): New targets.
10358         (split_i386_[124]): New targets.
10359         (split_i386_[1234r].stdout): New targets.
10360         (split_x86_64_[1234n].o): New targets.
10361         (split_x86_64_[124]): New targets.
10362         (split_x86_64_[1234r].stdout): New targets.
10363         (MOSTLYCLEANFILES): Add new executables.
10364         * testsuite/split_i386.sh: New file.
10365         * testsuite/split_x86_64.sh: New file.
10366         * testsuite/split_i386_1.s: New file.
10367         * testsuite/split_i386_2.s: New file.
10368         * testsuite/split_i386_3.s: New file.
10369         * testsuite/split_i386_4.s: New file.
10370         * testsuite/split_i386_n.s: New file.
10371         * testsuite/split_x86_64_1.s: New file.
10372         * testsuite/split_x86_64_2.s: New file.
10373         * testsuite/split_x86_64_3.s: New file.
10374         * testsuite/split_x86_64_4.s: New file.
10375         * testsuite/split_x86_64_n.s: New file.
10376         * testsuite/testfile.cc (Target_test): Update relocation_section
10377         function.
10378         * testsuite/Makefile.in: Rebuild.
10379
10380 2009-10-06  Ian Lance Taylor  <iant@google.com>
10381
10382         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10383         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10384         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10385         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10386         the address on ldo_addrs_.
10387         (Target_i386::Relocate::fix_up_ldo): New function.
10388
10389 2009-10-06   Rafael Espindola  <espindola@google.com>
10390
10391         * plugin.cc (add_input_library): New.
10392         (Plugin::load): Add add_input_library to tv.
10393         (Plugin_manager::add_input_file): Add the is_lib argument.
10394         (add_input_file): Update call to Plugin_manager::add_input_file.
10395         (add_input_library): New.
10396         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10397
10398 2009-09-30  Doug Kwan  <dougkwan@google.com>
10399
10400         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10401         symbol and call Symbol::may_need_copy_reloc to determine if
10402         a copy reloc is needed.
10403         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10404         nocopyreloc is given in command line.
10405         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10406         given in command line.
10407         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10408         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10409         of the removed Target_i386::may_need_copy_reloc.
10410         * options.h (copyreloc): New option with default value false.
10411         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10412         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10413         instead of the removed Target_powerpc::may_need_copy_reloc.
10414         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10415         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10416         instead of the removed Target_sparc::may_need_copy_reloc.
10417         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10418         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10419         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10420         instead of the removed Target_x86_64::may_need_copy_reloc.
10421
10422 2009-09-30  Ian Lance Taylor  <iant@google.com>
10423
10424         * object.h (class Object): Remove target_ field, and target,
10425         sized_target, and set_target methods.
10426         (Object::sized_target): Remove.
10427         (class Sized_relobj): Update declarations.  Remove sized_target.
10428         * object.cc (Sized_relobj::setup): Remove target parameter.
10429         Change all callers.
10430         (Input_objects::add_object): Don't do anything with the target.
10431         (make_elf_sized_object): Add punconfigured parameter.  Change all
10432         callers.  Set or test parameter target.
10433         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10434         Change all callers.
10435         * parameters.cc (Parameters::set_target): Change parameter type to
10436         be non-const.
10437         (Parameters::default_target): Remove.
10438         (set_parameters_target): Change parameter type to be non-const.
10439         (parameters_force_valid_target): New function.
10440         (parameters_clear_target): New function.
10441         * parameters.h (class Parameters): Update declarations.  Remove
10442         default_target method.  Add sized_target and clear_target
10443         methods.  Change target_ to be non-const.
10444         (set_parameters_target): Update declaration.
10445         (parameters_force_valid_target): Declare.
10446         (parameters_clear_target): Declare.
10447         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10448         as NULL if we aren't searching.
10449         (Add_symbols::run): Don't check for compatible target.
10450         * fileread.cc (Input_file::open_binary): Call
10451         parameters_force_valid_target.
10452         * gold.cc (queue_middle_tasks): Likewise.
10453         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10454         set_target on object.
10455         * dynobj.h (class Sized_dynobj): Update declarations.
10456         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10457         make_elf_object returns NULL.
10458         (Archive::include_member): Don't check whether object target is
10459         compatible.
10460         * output.cc (Output_section::add_input_section): Get target from
10461         parameters.
10462         (Output_section::relax_input_section): Likewise.
10463         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10464         parameters.
10465         (Sized_relobj::do_scan_relocs): Likewise.
10466         (Sized_relobj::relocate_sections): Likewise.
10467         * resolve.cc (Symbol_table::resolve): Likewise.
10468         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10469         parameter.  Change all callers.
10470         (Symbol_table::add_from_object): Get target from parameters.
10471         (Symbol_table::add_from_relobj): Don't check object target.
10472         (Symbol_table::add_from_dynobj): Likewise.
10473         (Symbol_table::define_special_symbol): Get target from
10474         parameters.
10475         * symtab.h (class Symbol_table): Update declaration.
10476         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10477         parameter.  Change all callers.  Clear parameter target.
10478         (Binary_test): Test target here.
10479         * testsuite/object_unittest.cc (gold_testsuite): Remove
10480         target_test_pointer parameter.  Change all callers.
10481         (Object_test): Test target here.
10482
10483 2009-09-26  Ian Lance Taylor  <iant@google.com>
10484
10485         * testsuite/initpri1.c: Don't try to use constructor priorities if
10486         compiling with gcc before 4.3.
10487
10488 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10489
10490         * testsuite/retain_symbols_file_test.sh (check_present): Change
10491         output file name to retain_symbols_file_test.stdout.
10492         (check_absent): Likewise.
10493
10494 2009-09-18  Craig Silverstein  <csilvers@google.com>
10495
10496         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10497         * options.cc: Include <cerrno> and <fstream>.
10498         (General_options::finalize): Parse -retain-symbols-file tag.
10499         * options.h: New flag.
10500         (General_options): New method should_retain_symbol, new
10501         variable symbols_to_retain.
10502         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10503         should_retain_symbol map.
10504         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10505         * testsuite/Makefile.in: Regenerate.
10506         * testsuite/retain_symbols_file_test.sh: New file.
10507
10508 2009-09-18  Nick Clifton  <nickc@redhat.com>
10509
10510         * po/es.po: Updated Spanish translation.
10511
10512 2009-09-17  Doug Kwan  <dougkwan@google.com>
10513
10514         * debug.h (DEBUG_RELAXATION): New constant.
10515         (DEBUG_ALL): Add DEBUG_RELAXATION.
10516         (debug_string_to_enum): Add relaxation debug option.
10517         * layout.cc
10518         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10519         Layout::Relaxation_debug_check::read_sections,
10520         Layout::Relaxation_debug_check::read_sections): New method definitions.
10521         (Layout::Layout): Initialize data members
10522         record_output_section_data_from_scrips_,
10523         script_output_section_data_list_ and relaxation_debug_check_.
10524         (Layout::save_segments, Layout::restore_segments,
10525         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10526         Layout::relaxation_loop_body): New method definitions.
10527         (Layout::finalize): Support relaxation.  Move section layout code to
10528         Layout::relaxation_loop_body.
10529         (Layout::set_asection_address_from_script): Move code for orphan
10530         section placement out.
10531         (Layout::place_orphan_sections_in_script): New method definition.
10532         * layout.h (Output_segment_headers, Output_file_header):
10533         New forward class declarations.
10534         (Layout::~Layout): Define.
10535         (Layout::new_output_section_data_from_script): New method definition.
10536         (Layout::place_orphan_sections_in_script): New method declaration.
10537         (Layout::Segment_states): New type declaration.
10538         (Layout::save_segments, Layout::restore_segments,
10539         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10540         Layout::relaxation_loop_body): New method declarations.
10541         (Layout::Output_section_data_list): New type declaration.
10542         (Layout::Relaxation_debug_check): New class definition.
10543         (Layout::record_output_section_data_from_script_,
10544         Layout::script_output_section_data_list_, Layout::segment_states_,
10545         Layout::relaxation_debug_check_): New data members.
10546         * output.cc: (Output_section_headers::do_size): New method definition.
10547         (Output_section_headers::Output_section_headers): Move size
10548         computation to Output_section_headers::do_size.
10549         (Output_segment_headers::do_size): New method definition.
10550         (Output_file_header::Output_file_header): Move size computation to
10551         Output_file_header::do_size and call it.
10552         (Output_file_header::do_size): New method definition.
10553         (Output_data_group::Output_data_group): Adjust call to
10554         Output_section_data.
10555         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10556         (Output_symtab_xindex::do_write): Add array bound check.
10557         (Output_section::Input_section::print_to_mapfile): Handle
10558         RELAXED_INPUT_SECTION_CODE.
10559         (Output_section::Output_section): Initialize data member checkpoint_.
10560         (Output_section::~Output_section): Delete checkpoint object pointed
10561         by checkpoint_.
10562         (Output_section::add_input_section): Always add an Input_section if
10563         relaxing.
10564         (Output_section::add_merge_input_section): Add assert.
10565         (Output_section::relax_input_section): New method definition.
10566         (Output_section::set_final_data_size): Set load address to zero for
10567         an unallocated section.
10568         (Output_section::do_address_and_file_offset_have_reset_values):
10569         New method definition.
10570         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10571         Handle relaxed input section.
10572         (Output_section::sort_attached_input_sections): Checkpoint input
10573         section list lazily.
10574         (Output_section::get_input_sections): Change type of input_sections to
10575         list of Simple_input_section pointers.  Checkpoint input section list
10576         lazily.  Also handle relaxed input sections.
10577         (Output_section::add_input_section_for_script): Take a reference to
10578         a Simple_input_section object instead of Relobj pointer and section
10579         index as parameter.  Handle relaxed input sections.
10580         (Output_section::save_states, Output_section::restore_states): New
10581         method definitions.
10582         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10583         (Output_data::is_data_size_fixed): New method definition.
10584         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10585         if it is fixed.
10586         (Output_data::address_and_file_offset_have_reset_values): New method
10587         definition.
10588         (Output_data::do_address_and_file_offset_have_reset_values): New method
10589         definition.
10590         (Output_data::set_data_size): Check that data size is not fixed.
10591         (Output_data::fix_data_size): New method definition.
10592         (Output_data::is_data_size_fixed_): New data member.
10593         (Output_section_headers::set_final_data_size): New method definition.
10594         (Output_section_headers::do_size): New method declaration.
10595         (Output_segment_headers::set_final_data_size): New method definition.
10596         (Output_segment_headers::do_size): New method declaration.
10597         (Output_file_header::set_final_data_size)::New method definition.
10598         (Output_file_header::do_size)::New method declaration.
10599         (Output_section_data::Output_section_data): Add new parameter
10600         is_data_size_fixed and use it to fix data size.
10601         (Output_data_const::Output_data_const): Adjust call to base class
10602         constructor and fix data size.
10603         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10604         base class constructor and fix data size.
10605         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10606         base class constructor and fix data size.
10607         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10608         class constructor and fix data size.
10609         (Output_data_group::set_final_data_size): New method definition.
10610         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10611         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10612         class constructor and fix data size.
10613         (Output_relaxed_input_section): New class definition.
10614         (Output_section::Simple_input_section): New class definition.
10615         (Output_section::get_input_sections): Adjust parameter list.
10616         (Output_section::add_input_section_for_script): Same.
10617         (Output_section::save_states, Output_section::restore_states,
10618         Output_section::do_address_and_file_offset_have_reset_values,
10619         (Output_section::Input_section::Input_section): Handle
10620         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10621         Output_relaxed_input_section.
10622         (Output_section::Input_section::is_input_section,
10623         Output_section::Input_section::set_output_section): Handle relaxed
10624         input section.
10625         (Output_section::Input_section::is_relaxed_input_section,
10626         Output_section::Input_section::output_section_data,
10627         Output_section::Input_section::relaxed_input_section): New method
10628         definitions.
10629         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10630         value.
10631         (Output_section::Input_section::u1_): Update comments.
10632         (Output_section::Input_section::u2_): Add new union member poris.
10633         (Output_section::Checkpoint_output_section): New classs definition.
10634         (Output_section::relax_input_section): New method declaration.
10635         (Output_section::checkpoint_): New data member.
10636         (Output_segment): Update comments.
10637         (Output_segment::Output_segment): Un-privatize copy constructor.
10638         (Output_segment::operator=): Un-privatize.
10639         * script-sections.cc (Output_section_element::Input_section_list):
10640         Change element type to Output_section::Simple_input_section.
10641         (Output_section_element_dot_assignment::set_section_addresses):
10642         Register output section data for relaxation clean up.
10643         (Output_data_exression::Output_data_expression): Adjust call to base
10644         constructor to fix data size.
10645         (Output_section_element_data::set_section_addresses): Register
10646         Output_data_expression object for relaxation clean up.
10647         (struct Input_section_info): Replace Relobj pointer and section index
10648         pair with Output_section::Simple_input_section and Convert struct to a
10649         class.
10650         (Input_section_sorter::operator()): Adjust access to
10651         Input_section_info data member to use accessors.
10652         (Output_section_element_input::set_section_addresses): Use layout
10653         parameter.  Adjust code to use Output_section::Simple_input_section
10654         and Input_secction_info classes.  Register filler for relaxation
10655         clean up.
10656         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10657         and section index pair with Output_section::Simple_input_section
10658         class.  Adjust code accordingly.
10659         (Phdrs_element::release_segment): New method definition.
10660         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10661         segment list.
10662         (Script_sections::release_segments): New method definition.
10663         * gold/script-sections.h (Script_sections::release_segments): New
10664         method declaration.
10665         * gold/target.h (Target::may_relax, Target::relax,
10666         Target::do_may_relax, Target::do_relax): New method definitions.
10667
10668 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10669
10670         * arm.cc (has_signed_unsigned_overflow): New function.
10671         (Arm_relocate_functions::abs8): New function.
10672         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10673         (Target_arm::Scan::global): Likewise.
10674         (Target_arm::relocate::relocate): Likewise.
10675         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10676         Likewise.
10677
10678 2009-09-16  Cary Coutant  <ccoutant@google.com>
10679
10680         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10681         * testsuite/Makefile.in: Regenerate.
10682
10683 2009-09-11  Nick Clifton  <nickc@redhat.com>
10684
10685         * po/gold.pot: Updated by the Translation project.
10686
10687 2009-09-08  Cary Coutant  <ccoutant@google.com>
10688
10689         * output.cc (Output_file::open): Add execute permission to empty file.
10690         * testsuite/Makefile.am (permission_test): New test.
10691         * testsuite/Makefile.in: Regenerate.
10692
10693 2009-09-02  Ian Lance Taylor  <iant@google.com>
10694
10695         * output.cc (Output_file::resize): Call map_no_anonymous rather
10696         than map.
10697
10698 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10699
10700         * gold.cc: Include "incremental.h".
10701         (queue_initial_tasks): Call Incremental_checker methods.
10702         * incremental.cc: Include "output.h".
10703         (Incremental_checker::can_incrementally_link_output_file): New
10704         method.
10705         * incremental.h (Incremental_checker): New class.
10706
10707         * output.cc (Output_file::open_for_modification): New method.
10708         (Output_file::map_anonymous): Changed return type to bool.  Record
10709         map in base_ field.
10710         (Output_file::map_no_anonymous): New method, broken out of map.
10711         (Output_file::map): Use map_no_anonymous and map_anonymous.
10712         * output.h (class Output_file): Update declarations.
10713
10714 2009-08-24  Cary Coutant  <ccoutant@google.com>
10715
10716         * options.h (Command_line::Pre_options): New class.
10717         (Command_line::pre_options): New member.
10718         * options.cc (gold::options::ready_to_register): New variable.
10719         (One_option::register_option): Do nothing if not registering options.
10720         Assert if same short option registered twice.
10721         (General_options::General_options): Turn off option registration when
10722         done constructing.
10723         (Command_line::Pre_options::Pre_options): New constructor.
10724
10725 2009-08-24  Cary Coutant  <ccoutant@google.com>
10726
10727         * options.h (General_options::no_keep_memory): Remove incorrect
10728         short option.
10729
10730 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10731
10732         * Makefile.am (am__skiplex, am__skipyacc): New.
10733         * Makefile.in: Regenerate.
10734
10735 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10736
10737         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10738         (INCLUDES): ... this.
10739         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10740         (AM_CPPFLAGS): Renamed from ...
10741         (INCLUDE): ... this.
10742         * Makefile.in, testsuite/Makefile.in: Regenerate.
10743
10744         * Makefile.in: Regenerate.
10745         * aclocal.m4: Likewise.
10746         * config.in: Likewise.
10747         * configure: Likewise.
10748         * testsuite/Makefile.in: Likewise.
10749
10750         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10751         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10752         * Makefile.in: Regenerate.
10753         * testsuite/Makefile.in: Regenerate.
10754
10755 2009-08-19  Cary Coutant  <ccoutant@google.com>
10756
10757         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10758         symbols in shared libraries overridden by hidden or internal symbols
10759         in the main program.
10760
10761 2009-08-19  Chris Demetriou  <cgd@google.com>
10762
10763         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10764         checking source file names in error messages.
10765
10766 2009-08-18  Doug Kwan  <dougkwan@google.com>
10767
10768         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10769         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10770         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10771         an elfcpp::Ehdr as parameter.
10772         * object.cc (Object::set_target): Remove the version that looks up
10773         a target and sets it.
10774         (Sized_relobj::setup): Take a Target object instead of
10775         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10776         (make_elf_sized_object): Find target and ask target to
10777         make an ELF object.
10778         * object.h: (Object::set_target): Remove the version that looks up
10779         a target and sets it.
10780         (Sized_relobj::setup): Take a Target object instead of
10781         an elfcpp:Ehdr as parameter.
10782         * target.cc: Include dynobj.h.
10783         (Target::do_make_elf_object_implementation): New.
10784         (Target::do_make_elf_object): New.
10785         * target.h (Target::make_elf_object): New template declaration.
10786         (Target::do_make_elf_object): New method declarations.
10787         (Target::do_make_elf_object_implementation): New template declaration.
10788
10789 2009-08-14  Ian Lance Taylor  <iant@google.com>
10790
10791         * gold.h (FUNCTION_NAME): Define.
10792         (gold_unreachable): Use FUNCTION_NAME.
10793
10794 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10795
10796         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10797         symbol in the --keep-unique list is not found.
10798
10799 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10800
10801         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10802         been maked as --keep-unique.
10803         (Icf::unfold_section): New function.
10804         * icf.h (Icf::unfold_section): New function.
10805         * options.h (General_options::keep_unique): New option.
10806         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10807         * testsuite/Makefile.in: Regenerate.
10808         * testsuite/icf_keep_unique_test.sh: New file.
10809         * testsuite/icf_keep_unique_test.cc: New file.
10810
10811 2009-08-12  Cary Coutant  <ccoutant@google.com>
10812
10813         PR 10471
10814         * resolve.cc (Symbol_table::resolve): Check for references from
10815         dynamic objects to hidden and internal symbols.
10816         * testsuite/Makefile.am (hidden_test.sh): New test.
10817         * testsuite/Makefile.in: Regenerate.
10818         * testsuite/hidden_test.sh: New script.
10819         * testsuite/hidden_test_1.c: New test source.
10820         * testsuite/hidden_test_main.c: New test source.
10821
10822 2009-08-11  Doug Kwan  <dougkwan@google.com>
10823
10824         * arm.cc: Update comments.
10825         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10826         segment to locate the .ARM.exidx section if present.
10827
10828 2009-08-09  Doug Kwan  <dougkwan@google.com>
10829
10830         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10831         patch.
10832
10833 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10834         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10835         compiler warnings.
10836
10837 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10838
10839         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10840         valid tls_segment only for non-debug-section relocations.
10841         * testsuite/Makefile.am: Add gc_tls_test.
10842         * testsuite/Makefile.in: Regenerate.
10843         * testsuite/gc_tls_test.cc: New file.
10844         * testsuite/gc_tls_test.sh: New file.
10845
10846 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10847
10848         * icf.cc: New file.
10849         * icf.h: New file.
10850         * Makefile.am (CCFILES): Add icf.cc.
10851         (HFILES): Add icf.h
10852         * Makefile.in: Regenerate.
10853         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10854         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10855         section, symbol and addend information for the relocs.
10856         * gold.cc (queue_middle_tasks): Call identical code folding.
10857         * gold.h: Add defines for multimap.
10858         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10859         to the call of finalize_local_symbols.
10860         * main.cc (main): Create object of class Icf.
10861         * object.cc (Sized_relobj::do_layout): Allow this function to be
10862         called twice during icf.
10863         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10864         to sections marked as identical by icf.
10865         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10866         when available.
10867         (Sized_relobj::do_section_entsize): New function.
10868         * object.h (Object::section_entsize): New function.
10869         (Object::do_section_entsize): New pure virtual function.
10870         (Relobj::finalize_local_symbols): Add new parameter.
10871         (Relobj::do_section_entsize): New function.
10872         * options.h (General_options::icf): New option.
10873         (General_options::icf_iterations): New option.
10874         (General_options::print_icf_sections): New option.
10875         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10876         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10877         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10878         icf.
10879         * symtab.cc (Symbol_table::is_section_folded): New function.
10880         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10881         to sections marked as identical by icf.
10882         * symtab.h (Symbol_table::set_icf): New function.
10883         (Symbol_table::icf): New function.
10884         (Symbol_table::is_section_folded): New function.
10885         (Symbol_table::icf_): New data member.
10886         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10887         * testsuite/Makefile.am: Add commands to build icf_test.
10888         * testsuite/Makefile.in: Regenerate.
10889         * testsuite/icf_test.sh: New file.
10890         * testsuite/icf_test.cc: New file.
10891
10892 2009-07-24  Chris Demetriou  <cgd@google.com>
10893
10894         * layout.cc (is_compressible_debug_section): Fix incorrect
10895         comment about compressed section names.
10896
10897 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10898
10899         PR 10419
10900         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10901
10902 2009-07-16  Ian Lance Taylor  <iant@google.com>
10903
10904         PR 10400
10905         * layout.h: #include <map>.
10906         (class Kept_section): Change from struct to class.  Add accessors
10907         and setters.  Add section size to Comdat_group mapping.  Change
10908         Comdat_group to std::map.  Add is_comdat_ field.  Add
10909         linkonce_size field in union.
10910         (class Layout): Update declaration of find_or_add_kept_section.
10911         Don't declare find_kept_object.
10912         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10913         parameter.  Add object, shndx, is_comdat, and is_group_name
10914         parameters.  Change all callers.  Adjust for new Kept_section.
10915         (Layout::find_kept_object): Remove.
10916         * object.cc (Sized_relobj::include_section_group): Update use of
10917         Kept_section.  Rename secnum to shndx.  Only record
10918         Kept_comdat_section if sections are the same size.
10919         (Sized_relobj::include_linkonce_section): Update use of
10920         Kept_section.  Only record Kept_comdat_section if sections are the
10921         same size.  Set size of linkonce section.
10922         (Sized_relobj::map_to_kept_section): Update call to
10923         get_kept_comdat_section.
10924         * object.h (class Sized_relobj): Rename fields in
10925         Kept_comdat_section to drop trailing underscores; change object
10926         field to Relobj*.  Change Kept_comdat_section_table to store
10927         struct rather than pointer.
10928         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10929         Add kept_object and kept_shndx parameters.  Change all callers.
10930         (Sized_relobj::get_kept_comdat_section): Change return type to
10931         bool.  Add kept_object and kept_shndx parameters.  Change all
10932         callers.
10933         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10934         Layout::find_or_add_kept_section.
10935
10936 2009-07-09  Ian Lance Taylor  <iant@google.com>
10937
10938         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10939         Reserve space in the hash table.
10940
10941 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10942
10943         * fileread.cc (File_read::get_mtime): New method.
10944         * fileread.h (Timespec): New structure.
10945         (File_read::get_mtime): New method.
10946         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10947         Renamed from timestamp_nsec.
10948         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10949         Elf_Xword.
10950         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10951         timestamp_nsec.
10952         (Incremental_inputs::report_archive): Save mtime; style fix.
10953         (Incremental_inputs::report_obejct): Save mtime; style fix.
10954         (Incremental_inputs::report_script): Save mtime; style fix.
10955         (Incremental_inputs::finalize_inputs): Style fix.
10956         (Incremental_inputs::finalize): Style fix.
10957         (Incremental_inputs::create_input_section_data): Store inputs
10958         mtime.
10959         * incremental.h (Incremental_inputs::report_script): Add mtime
10960         argument.
10961         (Incremental_inputs::Input_info::Input_info): Intialize only one
10962         union member.
10963         (Incremental_inputs::Input_info::archive): Move to nameless
10964         union.
10965         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10966         (Incremental_inputs::Input_info::script): Move to nameless union.
10967         (Incremental_inputs::mtime): New field.
10968         * script.cc (read_input_script): Pass file mtime to
10969         Incremental_input.
10970         * script.h (Script_info::inputs): Style fix.
10971
10972 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10973
10974         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10975         instead of 32.
10976
10977 2009-06-24  Ian Lance Taylor  <iant@google.com>
10978
10979         PR 10156
10980         * layout.cc (Layout::choose_output_section): If we find an
10981         existing section, update the flags.
10982         (Layout::create_notes): New function, broken out of
10983         Layout::finalize.
10984         (Layout::finalize): Don't create note sections.
10985         (Layout::create_note): Don't crash if linker script discards
10986         section.
10987         (Layout::create_gold_note): Likewise.
10988         (Layout::create_build_id): Likewise.  Don't set
10989         after_input_sections on the section.
10990         (Layout::create_executable_stack_info): Remove target parameter.
10991         Change caller.
10992         * layout.h (class Layout): Declare create_notes.  Update
10993         declaration of create_executable_stack_info.
10994         * gold.cc (queue_middle_tasks): Call create_notes.
10995         * output.cc (Output_section::update_flags_for_input_section): Move
10996         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10997         invalid.
10998         * output.h (Output_data::mark_address_invalid): New function.
10999         (class Output_section): Only declare, not define,
11000         update_flags_for_input_section.  Remove set_flags.
11001
11002 2009-06-24  Ian Lance Taylor  <iant@google.com>
11003
11004         * script-sections.cc (Output_section_definition::
11005         set_section_addresses): Rename shadowing local load_address to
11006         laddr.
11007
11008 2009-06-24  Ian Lance Taylor  <iant@google.com>
11009
11010         PR 10244
11011         * reloc.cc (relocate_sections): Skip empty relocation sections.
11012
11013 2009-06-23  Ian Lance Taylor  <iant@google.com>
11014
11015         PR 10156
11016         * layout.cc (Layout::create_note): Use choose_output_section
11017         rather than make_output_section.
11018
11019 2009-06-23  Ian Lance Taylor  <iant@google.com>
11020
11021         PR 10237
11022         * options.cc (General_options::parse_V): Set printed_version_.
11023         (General_options::General_options): Initialize printed_version_.
11024         * options.h (class General_options): Add printed_version_ field.
11025         * gold.cc (queue_initial_tasks): If there are no input files,
11026         don't give a fatal error if we printed the version information.
11027         (queue_middle_tasks): If using -r with a shared object, give a
11028         fatal error rather than an ordinary error.
11029
11030 2009-06-23  Ian Lance Taylor  <iant@google.com>
11031
11032         PR 10219
11033         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11034         (Layout::make_output_section): Set have_stabstr_section_ if we see
11035         a .stab*str section.
11036         (Layout::finalize): Call link_stabs_sections.
11037         (Layout::link_stabs_sections): New file.
11038         * layout.h (class Layout): Add have_stabstr_section_ field.
11039         Declare link_stabs_sections.
11040
11041 2009-06-23  Doug Kwan  <dougkwan@google.com>
11042
11043         * Makefile.am (libgold_a_LIBADD): New.
11044         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11045         * Makefile.in: Regenerate.
11046         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11047         * configure: Regenerate.
11048         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11049         * fileread.cc: Include sys/state.h
11050         * gold.h: Declare memmem and strndup if found missing.
11051         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11052
11053 2009-06-23  Ian Lance Taylor  <iant@google.com>
11054
11055         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11056         * configure: Rebuild.
11057
11058 2009-06-23  Ian Lance Taylor  <iant@google.com>
11059
11060         PR 10147
11061         * object.cc (Object::section_contents): Don't try to get a view if
11062         the section has length zero.
11063         (Object::handle_gnu_warning_section): If the section is empty, use
11064         the name of the section as the warning.
11065
11066 2009-06-23  Ian Lance Taylor  <iant@google.com>
11067
11068         PR 10133
11069         * stringpool.h (class Stringpool_template): Add optimize_ field.
11070         (Stringpool_template::set_optimize): New function.
11071         * stringpool.cc (Stringpool_template::Stringpool_template):
11072         Initialize optimize_ field.
11073         (Stringpool_template::set_string_offsets): Test local optimize
11074         fild rather than parameter.
11075         * layout.cc (Layout::Layout): Call set_optimize on the section
11076         name stringpool.
11077
11078 2009-06-22  Ian Lance Taylor  <iant@google.com>
11079
11080         PR 10030
11081         * yyscript.y: Parse TARGET.
11082         * script.cc (script_set_target): New function.
11083         * script-c.h (script_set_target): Declare.
11084         * options.cc (General_options::string_to_object_format): Rename
11085         from string_to_object_format in anonymous namespace.  Change
11086         callers.
11087         * options.h (class General_options): Declare
11088         string_to_object_format.
11089
11090 2009-06-22  Ian Lance Taylor  <iant@google.com>
11091
11092         * script-sections.cc (Script_sections::create_segments): Don't put
11093         program headers in a PT_LOAD segment if -n or -N.
11094
11095 2009-06-22  Ian Lance Taylor  <iant@google.com>
11096
11097         PR 10141
11098         * options.h (class General_options): Add -z lazy and -z now.  Sort
11099         -z options into alphabetical order.
11100         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11101
11102 2009-06-21  Ian Lance Taylor  <iant@google.com>
11103
11104         * layout.cc (Layout::make_output_section): Call
11105         Target::new_output_section.
11106         (Layout::attach_allocated_section_to_segment): Put large section
11107         sections in a separate load segment with the large segment flag
11108         set.
11109         (Layout::segment_precedes): Sort large data segments after other
11110         load segments.
11111         (align_file_offset): New static function.
11112         (Layout::set_segment_offsets): Use align_file_offset.
11113         * output.h (class Output_section): Add is_small_section_ and
11114         is_large_section_ fields.
11115         (Output_section::is_small_section): New function.
11116         (Output_section::set_is_small_section):  New function.
11117         (Output_section::is_large_section): New function.
11118         (Output_section::set_is_large_section): New function.
11119         (Output_section::is_large_data_section): New function.
11120         (class Output_segment): Add is_large_data_segment_ field.
11121         (Output_segment::is_large_data_segment): New function.
11122         (Output_segment::set_is_large_data_segment): New function.
11123         * output.cc (Output_section::Output_section): Initialize new
11124         fields.
11125         (Output_segment::Output_segment): Likewise.
11126         (Output_segment::add_output_section): Add assertion that large
11127         data sections always go in large data segments.  Force small data
11128         sections to the end of the list of data sections.  Force small BSS
11129         sections to the start of the list of BSS sections.  For large BSS
11130         sections to the end of the list of BSS sections.
11131         * symtab.h (class Symbol): Declare is_common_shndx.
11132         (Symbol::is_defined): Check Symbol::is_common_shndx.
11133         (Symbol::is_common): Likewise.
11134         (class Symbol_table): Define enum Commons_section_type.  Update
11135         declarations.  Add small_commons_ and large_commons_ fields.
11136         * symtab.cc (Symbol::is_common_shndx): New function.
11137         (Symbol_table::Symbol_table): Initialize new fields.
11138         (Symbol_table::add_from_object): Put small and large common
11139         symbols in the right list.
11140         (Symbol_table::sized_finalized_symbol): Check
11141         Symbol::is_common_shndx.
11142         (Symbol_table::sized_write_globals): Likewise.
11143         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11144         common symbol lists.  Don't call do_allocate_commons_list if the
11145         list is empty.
11146         (Symbol_table::do_allocate_commons_list): Remove is_tls
11147         parameter.  Add comons_section_type parameter.  Change all
11148         callers.  Handle small and large common symbols.
11149         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11150         Symbol::is_common_shndx.
11151         * resolve.cc (symbol_to_bits): Likewise.
11152         * target.h (Target::small_common_shndx): New function.
11153         (Target::small_common_section_flags): New function.
11154         (Target::large_common_shndx): New function.
11155         (Target::large_common_section_flags): New function.
11156         (Target::new_output_section): New function.
11157         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11158         small_common_section_flags, and large_common_section_flags
11159         fields.
11160         (Target::do_new_output_section): New virtual function.
11161         * arm.cc (Target_arm::arm_info): Initialize new fields.
11162         * i386.cc (Target_i386::i386_info): Likewise.
11163         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11164         Likewise.
11165         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11166         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11167         (Target_x86_64::do_new_output_section): New function.
11168         * configure.ac: Define conditional MCMODEL_MEDIUM.
11169         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11170         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11171         (large_LDFLAGS): Define.
11172         * testsuite/large.c: New file.
11173         * testsuite/testfile.cc (Target_test::test_target_info):
11174         Initialize new fields.
11175         * configure, testsuite/Makefile.in: Rebuild.
11176
11177 2009-06-05  Doug Kwan  <dougkwan@google.com>
11178
11179         * Makefile.am (CCFILES): Add target.cc.
11180         * Makefile.in: Regenerate.
11181         * i386.cc (class Target_i386): Define new virtual method to
11182         override do_is_local_label_name in parent.
11183         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11184         local symbols if --discard-locals or -X is given.
11185         * options.h (class General_options): Declare new options
11186         '--discard-locals' and '-X' for discarding locals.
11187         * target.h (class Target): Define new methods is_local_label_name.
11188         Declare new virtual method do_is_local_label_name.
11189         * target.cc: New file.
11190         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11191         (check_SCRIPTS): Add discard_locals_test.sh.
11192         (check_DATA): Add discard_local_tests.syms.
11193         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11194         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11195         * testsuite/Makefile.in: Regenerate.
11196         * testsuite/discard_locals_test.c: New file.
11197         * testsuite/discard_locals_test.sh: Same.
11198
11199 2009-06-05  Doug Kwan  <dougkwan@google.com>
11200
11201         * object.cc (Sized_relobj::Sized_relobj): Initialize
11202         discarded_eh_frame_shndx_ to -1U.
11203         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11204         section.
11205         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11206         a discarded .eh_frame section.
11207         (Sized_relobj::do_finalize_local_symbols): Ditto.
11208         * object.h (class Sized_relobj): Declare new member
11209         discarded_eh_frame_shndx_.
11210         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11211         (local_labels_test.o, local_labels_test): New rules.
11212         * testsuite/Makefile.in: Regenerate.
11213
11214 2009-06-04  Doug Kwan  <dougkwan@google.com>
11215
11216         * layout.cc (Layout::section_name_mapping): Add mapping for
11217         special ARM sections.
11218
11219 2009-06-03  Doug Kwan  <dougkwan@google.com>
11220
11221         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11222         (utils::has_overflow): Same.
11223
11224 2009-06-03  Ian Lance Taylor  <iant@google.com>
11225
11226         * layout.cc (Layout::section_name_mapping): New array, replacing
11227         Layout::linkonce_mapping.
11228         (Layout::section_name_mapping_count): New variable, replacing
11229         Layout::linkonce_mapping_count.
11230         (Layout::linkonce_output_name): Remove.
11231         (Layout::output_section_name): Rewrite.
11232         * layout.h (class Layout): Rename Linkonce_mapping to
11233         Section_name_mapping, linkonce_mapping to section_name_mapping,
11234         linkonce_mapping_count to section_name_mapping_count.  Don't
11235         declare linkonce_output_name.
11236
11237 2009-06-03  Doug Kwan  <dougkwan@google.com>
11238
11239         * gold/arm.cc (namespace utils): New.
11240         (Target_arm::reloc_is_non_pic): Define new method.
11241         (class Arm_relocate_functions): New.
11242         (Target_arm::Relocate::relocate): Handle relocation types used by
11243         Android.
11244
11245 2009-06-03  Ian Lance Taylor  <iant@google.com>
11246
11247         * arm.cc (Target_arm::scan::global): Use || instead of |.
11248
11249 2009-06-02  Doug Kwan  <dougkwan@google.com>
11250
11251         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11252         issued_non_pic_error_.
11253         (class Target_arm::Scan): Declare new method check_non_pic.
11254         Define new method symbol_needs_plt_entry.
11255         Declare new data member issued_non_pic_error_.
11256         (class Target_arm::Relocate): Declare new method
11257         should_apply_static_reloc.
11258         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11259         (Target_arm::Scan::check_non_pic): Define new method.
11260         (Target_arm::Scan::local): Handle a small subset of reloc types used
11261         by Android.
11262         (Target_arm::Scan::local): Same.
11263         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11264
11265 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11266
11267         * incremental.cc (Incremental_inputs::report_command_line): Filter
11268         out --incremental-* options.
11269
11270 2009-05-29  Doug Kwan  <dougkwan@google.com>
11271
11272         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11273         template class.
11274         (class Target_arm): Update comment.
11275         (Target_arm::Target_arm): Initialize new data members GOT_,
11276         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11277         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11278         and Target_arm::rel_dyn_section.
11279         Declare new_enum Target_arm::Got_type.
11280         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11281         and DYNBSS_.
11282         Update commments for member do_dynsym_value.
11283         (Target_arm::got_size, Target_arm::plt_section,
11284         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11285         new methods inside class defintion.
11286         (Target_arm::got_section): Define new method.
11287         (Target_arm::rel_dyn_section): Same.
11288         (Output_data_plt_arm): New template class.
11289         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11290         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11291         (Output_data_plt_arm::add_entry): Same.
11292         (Output_data_plt_arm::first_plt_entry): Define new
11293         static data member for PLT instruction template.
11294         (Output_data_plt_arm::plt_entry): Same.
11295         (Output_data_plt_arm::do_write): Define new method.
11296         (Target_arm::make_plt_entry): Same.
11297         (Target_arm::do_finalize_sections): Same.
11298         (Target_arm::do_dynsym_value): Same.
11299
11300 2009-05-28  Doug Kwan  <dougkwan@google.com>
11301
11302         * Makefile.am (TARGETSOURCES): Add arm.cc.
11303         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11304         * Makefile.in: Regenerate.
11305         * arm.cc: New file.
11306         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11307
11308 2009-05-26  Doug Kwan  <dougkwan@google.com>
11309
11310         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11311         (General_options::check_excluded_libs): Strip off directories in
11312         archive name before matching like GNU ld does.
11313         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11314         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11315         (exclude_libs_test_LDFLAGS): Add linker option
11316         -Wl,--exclude-libs,libexclude_libs_test_3
11317         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11318         an explicit archive without using -l.
11319         (alt/libexclude_libs_test_3.a): New make rule.
11320         * testsuite/Makefile.in: Regenerate.
11321         * testsuite/exclude_libs_test.c : Declare lib3_default().
11322         (main): Call it.
11323         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11324         * exclude_libs_test_3.c: New file.
11325
11326 2009-05-26  Nick Clifton  <nickc@redhat.com>
11327
11328         * po/id.po: New Indonesian translation.
11329         * po/gold.pot: Updated template file.
11330
11331 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11332
11333         * testsuite/Makefile.am: Add -ffunction-sections to compile
11334         gc_comdat_test files.  Add -Wl,--gc-sections to build
11335         gc_comdat_test.
11336         * testsuite/Makefile.in: Regenerate.
11337         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11338
11339 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11340
11341         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11342         kept comdat section was garbage collected.
11343         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11344         * testsuite/Makefile.in: Regenerate.
11345         * testsuite/gc_comdat_test.sh: New file.
11346         * testsuite/gc_comdat_test_1.cc: New file.
11347         * testsuite/gc_comdat_test_2.cc: New file.
11348
11349 2009-05-19  Doug Kwan  <dougkwan@google.com>
11350
11351         * archive.cc (Archive::Archive): Move constructor from archive.h
11352         to here.  Initialize no_export_.
11353         (Archive::get_elf_object_for_member): Set no_export flag of object.
11354         * archive.h (Archive::Archive): Move constructor body to
11355         archive.cc.
11356         (Archive::no_export): New method.
11357         (Archive::no_export_): New field.
11358         * object.h (Object::Object): Initialize no_export_ to false.
11359         (Object::no_export, Object::set_no_export): New methods.
11360         (Object::no_export_): New field.
11361         * options.cc (General_options::parse_exclude_libs): New method.
11362         (General_options::check_excluded_libs) Same.
11363         * options.h (exclude_libs): New option.
11364         (General_options::check_excluded_libs): New method declaration.
11365         (General_options::excluded_libs_): New field.
11366         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11367         default or protected visibility if an object has no-export flag set.
11368         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11369         (check_SCRIPTS): Add exclude_libs_test.sh.
11370         (check_DATA): Add exclude_libs_test.syms.
11371         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11372         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11373         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11374         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11375         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11376         libexclude_libs_test_2.a): New rules.
11377         * testsuite/Makefile.in: Regenerate.
11378         * testsuite/exclude_libs_test.c: New file.
11379         * testsuite/exclude_libs_test.sh: Ditto.
11380         * testsuite/exclude_libs_test_1.c: Ditto.
11381         * testsuite/exclude_libs_test_2.c: Ditto.
11382
11383 2009-05-15  Ian Lance Taylor  <iant@google.com>
11384
11385         * configure.ac: Check for declarations for cases where libiberty.h
11386         checks HAVE_DECL_xxx.
11387         * configure, config.in: Rebuild.
11388
11389 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11390
11391         * gold.h (Incremental_argument_list): Remove (invalid) forward
11392         declaration.
11393         * incremental.cc (Incremental_inputs::report_achive): New method.
11394         (Incremental_inputs::report_object): New method.
11395         (Incremental_inputs::report_script): New method.
11396         (Incremental_inputs::finalize_inputs): New method.
11397         (Incremental_inputs::finalize): Call finalize_inputs().
11398         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11399         Create inputs entries.
11400         * incremental.h (Incremental_input_type): New enum.
11401         (Incremental_inputs::Incremental_input): Initialize new fields.
11402         (Incremental_inputs::report_inputs): New method.
11403         (Incremental_inputs::report_achive): New method.
11404         (Incremental_inputs::report_object): New method.
11405         (Incremental_inputs::report_script): New method.
11406         (Incremental_inputs::finalize_inputs): New method.
11407         (Incremental_inputs::Input_info): New struct.
11408         (Incremental_inputs::Input_info_map): New typedef.
11409         (Incremental_inputs::lock_): New field.
11410         (Incremental_inputs::Inputs_): New field.
11411         (Incremental_inputs::Inputs_map): New field.
11412         * main.cc (main): Call Incremental_input::report_inputs.
11413         * options.h (Input_argument_list): Typedef moved from
11414         Input_arguments.
11415         (Input_file_group::Files): Remove, use ::Input_argument_list.
11416         (Input_file_group::Input_argument_list): Remove, use
11417         ::Input_argument_list.
11418         * plugin.cc (Plugin_manager::add_input_file): Add error in
11419         incremental build.
11420         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11421         functions.
11422         * script.cc (read_input_script): Call
11423         Incremental_input::report_script.
11424         * script.h (Script_info): New class.
11425
11426 2009-04-27  Ian Lance Taylor  <iant@google.com>
11427
11428         * x86_64.cc (do_adjust_output_section): Set entsize to
11429         plt_entry_size.
11430
11431 2009-04-23  Elliott Hughes  <enh@google.com>
11432
11433         * output.cc (Output_file::close): After short writes, continue
11434         writing from the correct offset in the buffer being written.
11435
11436 2009-04-23  Chris Demetriou  <cgd@google.com>
11437
11438         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11439         * configure: Regenerate.
11440         * config.in: Regenerate.
11441         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11442         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11443
11444 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11445
11446         * incremental.cc (Incremental_inputs_header_data): Renamed from
11447         Incremental_input_header_data.
11448         (Incremental_inputs_header_data::data_size): New field.
11449         (Incremental_inputs_header_data::put_input_file_count): Renamed
11450         from input_file_count.
11451         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11452         from command_line_offset.
11453         (Incremental_inputs_header_data::put_reserved): Renamed from
11454         put_reserved.
11455         (Incremental_inputs_entry_data): Renamed from
11456         Incremental_input_entry_data.
11457         (Incremental_inputs_entry_data::data_size): New field.
11458         (Incremental_inputs::report_command_line): New method.
11459         (Incremental_inputs::finalize): New method.
11460         (Incremental_inputs::create_incremental_inputs_data): New method.
11461         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11462         * incremental.h: New file.
11463         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11464         (Layout::finalize): Create incremental inputs section in
11465         incremental builds.
11466         (Layout::create_incremental_info_sections): New method.
11467         * layout.h (Layout::incremental_inputs): New method.
11468         (Layout::create_incremental_info_sections): New method.
11469         (Layout::incremental_inputs_): New field.
11470         * main.cc (main): Notify Incremental_input of the command line.
11471
11472 2009-04-01  Ian Lance Taylor  <iant@google.com>
11473             Mikolaj Zalewski  <mikolajz@google.com>
11474
11475         * gold.h (reserve_unordered_map): Define, three versions, one for
11476         each version of Unordered_map.
11477         * layout.cc (Layout::Layout): Remove options parameter.  Add
11478         number_of_input_files parameter.  Don't initialize options_.
11479         Initialize number_of_input_files_ and resized_signatures_.  Move
11480         sections_are_attached_.
11481         (Layout::layout_group): Reserve space for group_signatures_.
11482         (Layout::find_or_add_kept_section): Change name parameter to be a
11483         reference.  Resize signatures_ map when it gets large enough.
11484         (Layout::layout_eh_frame): Use parameters->options() instead of
11485         this->options_.
11486         (Layout::make_output_section): Likewise.
11487         (Layout::attach_allocated_section_to_segment): Likewise.
11488         (Layout::finalize, Layout::create_executable_stack): Likewise.
11489         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11490         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11491         * layout.h (class Layout): Update declarations.  Remove options_
11492         field.  Add number_of_input_files_ and resized_signatures_
11493         fields.  Move sections_are_attached_ field.
11494         * main.cc (main): Pass number of input files to Layout
11495         constructor.  Don't pass options.
11496
11497 2009-03-30  Ian Lance Taylor  <iant@google.com>
11498
11499         * ffsll.c (ffsll): Correct implementation.
11500
11501 2009-03-27  Ian Lance Taylor  <iant@google.com>
11502
11503         * ffsll.c: New file.
11504         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11505         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11506         * ftruncate.c (ftruncate): Declare before definition.
11507         * mremap.c (mremap): Likewise.
11508         * pread.c (pread): Likewise.
11509         * configure, Makefile.in, config.in: Rebuild.
11510
11511         * mremap.c: New file.
11512         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11513         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11514         (mremap): Declare if HAVE_MREMAP is not defined.
11515         * configure, Makefile.in, config.in: Rebuild.
11516
11517 2009-03-27  Cary Coutant  <ccoutant@google.com>
11518
11519         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11520         position independent.
11521         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11522         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11523
11524 2009-03-24  Cary Coutant  <ccoutant@google.com>
11525
11526         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11527         an executable.
11528         (needs_dynamic_reloc): Likewise.
11529
11530 2009-03-24  Ian Lance Taylor  <iant@google.com>
11531
11532         * yyscript.y (file_cmd): Recognize EXTERN.
11533         (extern_name_list, extern_name_list_body): New nonterminals.
11534         * script.cc (script_add_extern): Define.
11535         * script-c.h (script_add_extern): Declare.
11536
11537 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11538
11539         * object.cc (is_elf_object): Define.
11540         * object.h (is_elf_object): Declare.
11541         * archive.cc (Archive::get_elf_object_for_member): Call
11542         is_elf_object.
11543         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11544
11545 2009-03-24  Elliott Hughes  <enh@google.com>
11546
11547         * output.cc (Output_file::map_anonymous): Define.
11548         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11549         try an anonymous one.  Report the size if the mmap fails.
11550         * output.h (class Output_file): Declare map_anonymous.
11551
11552 2009-03-24  Ian Lance Taylor  <iant@google.com>
11553
11554         * target-select.cc (instantiate_target): Don't acquire the lock if
11555         the instantiated_target_ field has already been set.
11556
11557 2009-03-23  Ian Lance Taylor  <iant@google.com>
11558
11559         * gold-threads.h (class Initialize_lock): Define.
11560         * gold-threads.cc (class Initialize_lock_once): Define.
11561         (initialize_lock_control): New static variable.
11562         (initialize_lock_pointer): New static variable.
11563         (initialize_lock_once): New static function.
11564         (Initialize_lock::Initialize_lock): Define.
11565         (Initialize_lock::initialize): Define.
11566         * target-select.h: Include "gold-threads.h".
11567         (class Target_selector): Add lock_ and initialize_lock_ fields.
11568         Don't define instantiate_target, just declare it.
11569         * target-select.cc (Target_selector::Target_selector): Initialize
11570         new fields.
11571         (Target_selector::instantiate_target): Define.
11572         * descriptors.h: Include "gold-threads.h".
11573         (class Descriptors): Add initialize_lock_ field.
11574         * descriptors.cc (Descriptors::Descriptors): Initialize new
11575         field.
11576         (Descriptors::open): Use initialize_lock_ field
11577         * errors.h (class Errors): Add initialize_lock_ field.
11578         * errors.cc (Errors::Errors): Initialize new field.
11579         (Errors::initialize_lock): Use initialize_lock_ field.
11580         * powerpc.cc (class Target_selector_powerpc): Remove
11581         instantiated_target_ field.  In do_recognize call
11582         instantiate_target rather than do_instantiate_target.  In
11583         do_instantiate_target just allocate a new target.
11584         * sparc.cc (class Target_selector_sparc): Likewise.
11585
11586         * freebsd.h: New file.
11587         * i386.cc: Include "freebsd.h".
11588         (Target_i386): Derive from Target_freebsd rather than
11589         Sized_target.
11590         (Target_selector_i386): Derive from Target_selector_freebsd rather
11591         than Target_selector.
11592         * x86_64.cc: Include "freebsd.h".
11593         (Target_x86_64): Derive from Target_freebsd rather than
11594         Sized_target.
11595         (Target_selector_x86_64): Derive from Target_selector_freebsd
11596         rather than Target_selector.
11597         * target.h (class Target): Add adjust_elf_header and
11598         do_adjust_elf_header.
11599         * output.cc (Output_file_header:: do_sized_write): Call target
11600         adjust_elf_header routine.
11601         * configure.tgt: Set targ_osabi.
11602         * configure.ac: Define GOLD_DEFAULT_OSABI.
11603         * parameters.cc (Parameters::default_target): Pass
11604         GOLD_DEFAULT_OSABI to select_target.
11605         * target-select.h (class Target_selector): Make instantiate_target
11606         protected rather than private.
11607         * Makefile.am (HFILES): Add freebsd.h.
11608         * configure, Makefile.in, config.in: Rebuild.
11609
11610         * merge.cc (do_add_input_section): Correct pend value.  Change
11611         message about last entry not being null terminated from error to
11612         warning.
11613
11614 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11615
11616         * incremental.cc: New file.
11617         * Makefile.am (CCFILES): Add incremental.cc.
11618         * Makefile.in: Rebuild.
11619
11620 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11621
11622         * layout.cc (Layout::output_section_name): Preserve names
11623         of '.note.' sections.
11624
11625 2009-03-19  Ian Lance Taylor  <iant@google.com>
11626
11627         * descriptors.cc (Descriptors::open): Check that the options are
11628         valid before using them.
11629
11630 2009-03-18  Ian Lance Taylor  <iant@google.com>
11631
11632         * script-sections.h: Include <list>.
11633         (class Script_sections): Change Sections_elements from std::vector
11634         to std::list.  Typedef public Elements_iterator.  Add
11635         orphan_section_placement_, data_segment_align_start_, and
11636         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11637         field.
11638         * script-sections.cc (class Orphan_section_placement): New class.
11639         (class Sections_element): Add virtual functions is_relro and
11640         orphan_section_init.  Remove virtual function place_orphan_here.
11641         (class Output_section_definition): Add is_relro and
11642         orphan_section_init.  Remove place_orphan_here.
11643         (class Orphan_output_section): Likewise.
11644         (Script_sections::Script_sections): Update for field changes.
11645         (Script_sections::data_segment_align): Set saw_data_segment_align_
11646         and data_segment_align_start_, not data_segment_align_index.
11647         (Script_sections::data_segment_relro_end): Check
11648         saw_data_segment_align_.  Use data_segment_align_start_ rather
11649         than data_segment_align_index_.
11650         (Script_sections::place_orphan): Rewrite to use
11651         Orphan_section_placement.
11652
11653 2009-03-17  Ian Lance Taylor  <iant@google.com>
11654
11655         * archive.cc (Archive::add_symbols): Check for a version attached
11656         to the symbol name in the archive map.
11657         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11658         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11659         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11660         (ver_test_11.a): New target.
11661         * testsuite/Makefile.in: Rebuild.
11662
11663         * configure.ac: Check for chsize and posix_fallocate.  Replace
11664         ftruncate.
11665         * ftruncate.c: New file, from gnulib.
11666         * output.cc (posix_fallocate): Define dummy version if not
11667         HAVE_POSIX_FALLOCATE.
11668         (Output_file::map): Call posix_fallocate rather than lseek and
11669         write.
11670         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11671         * configure, Makefile.in, config.in: Rebuild.
11672
11673 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11674
11675         * layout.h (Layout::create_note): Add section_name parameter.
11676         * layout.cc (Layout::create_note): Likewise.
11677         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11678
11679 2009-03-17  Ian Lance Taylor  <iant@google.com>
11680
11681         * descriptors.cc: Include "options.h".
11682         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11683         (Descriptors::open): Always use O_CLOEXEC when opening a new
11684         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11685         then set FD_CLOEXEC.
11686
11687         * sparc.cc (class Target_sparc): Add has_got_section.
11688         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11689         make sure we have a GOT section.
11690
11691         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11692         (Target_sparc::Scan::local): Likewise.
11693         (Target_sparc::Scan::global): Likewise.
11694         (Target_sparc::Relocate::relocate): Likewise.
11695         (Target_sparc::Relocate::relocate_tls): Likewise.
11696
11697         * symtab.cc (Symbol_table::define_default_version): New function,
11698         broken out of add_from_object.
11699         (Symbol_table::add_from_object): Call define_default_version.
11700         (Symbol_table::define_special_symbol): Add resolve_oldsym
11701         parameter.  Change all callers.  If the version for a symbol comes
11702         from a version script, resolve it with the symbol with the same
11703         name with no version.  Also add the symbol without a version if
11704         appropriate.
11705         (do_define_in_output_data): If resolving with oldsym, don't delete
11706         sym.
11707         (do_define_in_output_segment): Likewise.
11708         (do_define_as_constant): Likewise.
11709         * symtab.h (class Symbol_table): Update declarations.
11710
11711 2009-03-13  Ian Lance Taylor  <iant@google.com>
11712
11713         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11714         (Read_symbols::requeue): New function.
11715         (Read_symbols::do_read_symbols): If make_elf_object fails because
11716         the target type is not configured, and the file was searched for,
11717         issue a warning and retry with the next directory.
11718         (Add_symbols::run): If the file has an incompatible format, and
11719         it was searched for, requeue the Read_symbols task.  On error,
11720         release the object.
11721         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11722         dirindex parameter to constructor.  Change all callers.  Declare
11723         incompatible_warning and requeue.
11724         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11725         input_argument_ and input_group_ fields.  Add them to
11726         constructor.  Change all callers.
11727         (class Read_script): Add dirindex_ field.  Add it to constructor.
11728         Change all callers.
11729         * archive.cc (Archive::setup): Remove input_objects parameter.
11730         Change all callers.
11731         (Archive::get_file_and_offset): Likewise.
11732         (Archive::read_all_symbols): Likewise.
11733         (Archive::read_symbols): Likewise.
11734         (Archive::get_elf_object_for_member): Remove input_objects
11735         parameter.  Add punconfigured parameter.  Change all callers.
11736         (Archive::add_symbols): Change return type to bool.  Check return
11737         value of include_member.
11738         (Archive::include_all_members): Likewise.
11739         (Archive::include_member): Change return type to bool.  Return
11740         false if first included object has incompatible target.  Set
11741         included_member_ field.
11742         (Add_archive_symbols::run): If add_symbols returns false, requeue
11743         Read_symbols task.
11744         * archive.h (class Archive): Add included_member_ field.
11745         Initialize it in constructor.  Add input_file and searched_for
11746         methods.  Update declarations.
11747         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11748         input_argument_ fields.  Add them to constructor.  Change all
11749         callers.
11750         * script.cc: Include "target-select.h".
11751         (class Parser_closure): Add skip_on_incompatible_target_ and
11752         found_incompatible_target_ fields.  Add
11753         skip_on_incompatible_target parameter to constructor.  Change all
11754         callers.  Add methods skip_on_incompatible_target,
11755         clear_skip_on_incompatible_target, found_incompatible_target, and
11756         set_found_incompatible_target.
11757         (read_input_script): Add dirindex parameter.  Change all callers.
11758         If parser finds an incompatible target, requeue Read_symbols
11759         task.
11760         (script_set_symbol): Clear skip_on_incompatible_target in
11761         closure.
11762         (script_add_assertion, script_parse_option): Likewise.
11763         (script_start_sections, script_add_phdr): Likewise.
11764         (script_check_output_format): New function.
11765         * script.h (read_input_script): Update declaration.
11766         * script-c.h (script_check_output_format): Declare.
11767         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11768         (ignore_cmd): Remove OUTPUT_FORMAT.
11769         * fileread.cc (Input_file::Input_file): Add explicit this.
11770         (Input_file::will_search_for): New function.
11771         (Input_file::open): Add pindex parameter.  Change all callers.
11772         * fileread.h (class Input_file): Add input_file_argument method.
11773         Declare will_search_for.  Update declarations.
11774         * object.cc (make_elf_object): Add punconfigured parameter.
11775         Change all callers.
11776         * object.h (class Object): Make input_file public.  Add
11777         searched_for method.
11778         (make_elf_object): Update declaration.
11779         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11780         restart search.
11781         * dirsearch.h (class Dirsearch): Update declaration.
11782         * options.h (class General_options): Add --warn-search-mismatch.
11783         * parameters.cc (Parameters::is_compatible_target): New function.
11784         * parameters.h (class Parameters): Declare is_compatible_target.
11785         * workqueue.cc (Workqueue::add_blocker): New function.
11786         * workqueue.h (class Workqueue): Declare add_blocker.
11787
11788         * fileread.cc (Input_file::open): Remove options parameter.
11789         Change all callers.
11790         (Input_file::open_binary): Likewise.
11791         * script.cc (read_input_script): Likewise.
11792         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11793         options parameter from constructor.  Change all callers.
11794         (class Read_script): Likewise.
11795         * fileread.h (class Input_file): Update declarations.
11796         * script.h (read_input_script): Update declaration.
11797
11798 2009-03-10  Nick Clifton  <nickc@redhat.com>
11799
11800         * po/es.po: New Spanish translation.
11801
11802 2009-03-06  Cary Coutant  <ccoutant@google.com>
11803
11804         * options.cc (parse_short_option): Keep dash_z from registering itself.
11805
11806 2009-03-03  Ian Lance Taylor  <iant@google.com>
11807
11808         PR 9918
11809         * target-reloc.h (relocate_section): Pass output_section to
11810         relocate.
11811         * i386.cc (Target_i386::should_apply_static_reloc): Add
11812         output_section parameter.  Change all callers.
11813         (Target_i386::Relocate::relocate): Add output_section parameter.
11814         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11815         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11816         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11817         * testsuite/two_file_shared.sh: New script.
11818         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11819         (check_DATA): Add two_file_shared.dbg.
11820         (two_file_shared.dbg): New target.
11821         * testsuite/Makefile.in: Rebuild.
11822
11823 2009-03-01  Ian Lance Taylor  <iant@google.com>
11824
11825         * configure.ac: Check for byteswap.h.
11826         * configure: Rebuild.
11827         * config.in: Rebuild.
11828
11829 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11830
11831         * layout.cc (Layout::find_or_add_kept_section): New function.
11832         (Layout::add_comdat): Removed.
11833         * layout.h (struct Kept_section): Move out of class Layout.
11834         Remove trailing underscores from field names.  Add group_sections
11835         field.  Rename group_ field to is_group.  Change all uses.
11836         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11837         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11838         comdat_groups_ field.
11839         (Sized_relobj::include_section_group): Use
11840         find_or_add_kept_section and Kept_section::group_sections.
11841         (Sized_relobj::include_linkonce_section): Likewise.
11842         * object.cc (class Sized_relobj): Don't define Comdat_group or
11843         Comdat_group_table.  Remove find_comdat_group and
11844         add_comdat_group.  Remove comdat_groups_ field.
11845         * plugin.cc (include_comdat_group): Use
11846         Layout::find_or_add_kept_section.
11847
11848 2009-02-28  Ian Lance Taylor  <iant@google.com>
11849
11850         * README: --gc-sections and map files are now supported.  Document
11851         some build requirements.
11852
11853         PR 6992
11854         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11855         relocatable link set the value of the section symbol to zero.
11856         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11857         relocatable link don't include the section address in the local
11858         symbol value.
11859
11860 2009-02-27  Ian Lance Taylor  <iant@google.com>
11861
11862         PR 6811
11863         * options.h (class Search_directory): Add is_system_directory.
11864         (class General_options): Declare is_in_system_directory.
11865         * options.cc (get_relative_sysroot): Make static.
11866         (get_default_sysroot): Make static.
11867         (General_optoins::is_in_system_directory): New function.
11868         * fileread.cc (Input_file::is_in_system_directory): New function.
11869         * fileread.h (class Input_file): Declare is_in_system_directory.
11870         * object.h (class Object): Add is_in_system_directory.
11871         (class Input_objects): Remove system_library_directory_ field.
11872         * object.cc (Input_objects::add_object): Don't set
11873         system_library_directory_.
11874         (input_objects::found_in_system_library_directory): Remove.
11875         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11876         parameter.  Change all callers.
11877         (Symbol_table::sized_write_globals): Likewise.
11878         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11879         Call Object::is_in_system_directory.
11880         * symtab.h (class Symbol_table): Update declarations.
11881
11882         PR 5990
11883         * descriptors.h (Open_descriptor): Add is_on_stack field.
11884         * descriptors.cc (Descriptors::open): If the descriptor is on the
11885         top of the stack, remove it.  Initialize is_on_stack field.
11886         (Descriptors::release): Only add pod to stack if it is not on the
11887         stack already.
11888         (Descriptors::close_some_descriptor): Clear stack_next and
11889         is_on_stack fields.
11890
11891         PR 7091
11892         * output.cc (Output_section::find_starting_output_address): Rename
11893         from starting_output_address; add PADDR parameter; change return
11894         type.
11895         * output.h (class Output_section): Declare
11896         find_starting_output_address instead of starting_output_address.
11897         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11898         section symbol for which we can't find a merge section.
11899
11900         PR 9836
11901         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11902         hidden or internal, force the symbol to be local.
11903         * resolve.cc (Symbol::override_visibility): Define.
11904         (Symbol::override_base): Use override_visibility.
11905         (Symbol_table::resolve): Likewise.
11906         (Symbol::override_base_with_special): Likewise.
11907         (Symbol_table::override_with_special): If the visibility is hidden
11908         or internal, force the symbol to be local.
11909         * symtab.h (class Symbol): Add set_visibility and
11910         override_visibility.
11911         * testsuite/ver_test_1.sh: New file.
11912         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11913         (check_DATA): Add ver_test_1.syms.
11914         (ver_test_1.syms): New target.
11915         * testsuite/Makefile.in: Rebuild.
11916
11917 2009-02-25  Cary Coutant  <ccoutant@google.com>
11918
11919         * layout.cc (Layout::choose_output_section): Don't rename sections
11920         when using a linker script that has a SECTIONS clause.
11921         * Makefile.in: Regenerate.
11922
11923         * testsuite/Makefile.am (script_test_5.sh): New test case.
11924         * testsuite/Makefile.in: Regenerate.
11925         * testsuite/script_test_5.cc: New file.
11926         * testsuite/script_test_5.sh: New file.
11927         * testsuite/script_test_5.t: New file.
11928
11929 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11930
11931         * archive.cc (Archive::include_member): Update calls to add_symbols.
11932         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11933         the Layout argument.
11934         * dynobj.h (do_add_symbols): Add the Layout argument.
11935         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11936         Layout argument.
11937         * object.h (Object::add_symbols): Add the Layout argument.
11938         (Object::do_add_symbols): Add the Layout argument.
11939         (Sized_relobj::do_add_symbols): Add the Layout argument.
11940         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11941         Unify the two versions.
11942         (Add_plugin_symbols): Remove.
11943         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11944         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11945         (Add_plugin_symbols): Remove.
11946         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11947         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11948         (Add_symbols::run): Make it work with Pulginobj.
11949
11950 2009-02-06  Ian Lance Taylor  <iant@google.com>
11951
11952         * object.cc (Sized_relobj::do_layout): Make info message start
11953         with lower case letter.
11954
11955 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11956
11957         * binary.cc: Fix file comment.
11958
11959         * options.h (enum Incremental_disposition): Define.
11960         (class General_options): Add new options: --incremental,
11961         --incremental_changed, --incremental_unchanged,
11962         --incremental_unknown.  Add incremental_disposition_ and
11963         implicit_incremental_ fields.
11964         (General_options::incremental_disposition): New function.
11965         (class Position_dependent_options): Add incremental_disposition
11966         option.
11967         (Position_dependent_options::copy_from_options): Set incremental
11968         dispositions.
11969         * options.cc (General_options::parse_incremental_changed): New
11970         function.
11971         (General_options::parse_incremental_unchanged): New function.
11972         (General_options::parse_incremental_unknown): New function.
11973         (General_options::General_options): Initialize new fields
11974         incremental_disposition_ and implicit_incremental_.
11975         (General_options::finalize): Check for uasge of --incremental-*
11976         without --incremental.
11977
11978 2009-02-06  Chris Demetriou  <cgd@google.com>
11979
11980         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11981         pointer and to report location as the file name associated with
11982         the symbol.
11983         (gold_undefined_symbol_at_location): New function to replace the
11984         old gold_undefined_symbol functionality.
11985         * target-reloc.h (relocate_section): Update to use
11986         gold_undefined_symbol_at_location.
11987         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11988         Call gold_undefined_symbol function rather than gold_error.
11989         * errors.h (Errors::undefined_symbol): Take location as a
11990         string, rather than calculating it from a relocation.
11991         * errors.cc (Errors::fatal): Print "fatal error:" before the
11992         formatted message.
11993         (Errors::error, Errors::error_at_location): Print "error: "
11994         before the formatted message.
11995         (Errors::undefined_symbol): Take location as a string, rather
11996         than calculating it from a relocation.
11997         (gold_undefined_symbol_at_location): New function akin to
11998         old gold_undefined_symbol, calculates location from relocation.
11999         (gold_undefined_symbol): Change to take only a Symbol pointer
12000         and to report location as the file name associated with the symbol.
12001         * testsuite/debug_msg.sh: Update for changed error messages.
12002         * testsuite/undef_symbol.sh: Likewise.
12003
12004 2009-02-04  Duncan Sands  <baldrick@free.fr>
12005
12006         PR 9812
12007         * reduced_debug_output.h
12008         (Output_reduced_debug_abbrev_section::failed): Use format for
12009         gold_warning.
12010         (Output_reduced_debug_info_section::faild): Likewise.
12011
12012 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12013
12014         * script.cc (Lazy_demangler): New class.
12015         (Version_script_info::get_symbol_version_helper): Demangle a
12016         symbol only once.
12017
12018 2009-01-29  Cary Coutant  <ccoutant@google.com>
12019
12020         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12021         to __tls_get_addr.
12022         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12023
12024 2009-01-28  Ian Lance Taylor  <iant@google.com>
12025
12026         * version.cc (version_string): Bump to 1.9.
12027
12028         * gold.h: Include <cstring> and <stdint.h>.
12029         * version.cc: Include <cstdio>.
12030         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12031         warning.
12032         * reduced_debug_output.cc (insert_into_vector): Rename from
12033         Insert_into_vector; change all callers.  Use Swap_unaligned to
12034         avoid aliasing issue; remove union since it is unnecessary.
12035
12036 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12037
12038         * Makefile.am (CCFILES): Add gc.cc.
12039         (HFILES): Add gc.h.
12040         * Makefile.in: Regenerate.
12041         * gold.cc (Gc_runner): New class.
12042         (queue_initial_tasks): Call garbage collection related tasks
12043         when corresponding options are invoked.
12044         (queue_middle_gc_tasks): New function.
12045         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12046         processed early before laying out sections during garbage collection.
12047         * gold.h (queue_middle_gc_tasks): New function.
12048         (is_prefix_of): Move from "layout.cc".
12049         * i386.cc (Target_i386::gc_process_relocs): New function.
12050         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12051         * main.cc (main): Create object of class "Garbage_collection".
12052         * object.cc (Relobj::copy_symbols_data): New function.
12053         (Relobj::is_section_name_included): New function.
12054         (Sized_relobj::do_layout): Allow this function to be called twice
12055         during garbage collection and defer layout of section during the
12056         first call.
12057         * object.h (Relobj::get_symbols_data): New function.
12058         (Relobj::is_section_name_included): New function.
12059         (Relobj::copy_symbols_data): New function.
12060         (Relobj::set_symbols_data): New function.
12061         (Relobj::get_relocs_data): New function.
12062         (Relobj::set_relocs_data): New function.
12063         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12064         (Relobj::gc_process_relocs): New function.
12065         (Relobj::do_gc_process_relocs): New pure virtual function.
12066         (Relobj::sd_): New data member.
12067         (Sized_relobj::is_output_section_offset_invalid): New function.
12068         (Sized_relobj::do_gc_process_relocs): New function.
12069         * options.h (General_options::gc_sections): Modify to not be a no-op.
12070         (General_options::print_gc_sections): New option.
12071         * plugin.cc (Plugin_finish::run): Remove function call to
12072         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12073         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12074         * reloc.cc (Read_relocs::run): Add task to process relocs and
12075         determine unreferenced sections when doing garbage collection.
12076         (Gc_process_relocs): New class.
12077         (Sized_relobj::do_gc_process_relocs): New function.
12078         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12079         sections that are garbage collected.
12080         * reloc.h (Gc_process_relocs): New class.
12081         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12082         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12083         symbols whose corresponding sections are garbage collected.
12084         (Symbol_table::Symbol_table): Add new parameter for the garbage
12085         collection object.
12086         (Symbol_table::gc_mark_undef_symbols): New function.
12087         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12088         (Symbol_table::gc_mark_dyn_syms): New function.
12089         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12090         as garbage.
12091         (Symbol_table::add_from_object): Likewise.
12092         (Symbol_table::add_from_relobj): When building shared objects, do not
12093         treat externally visible symbols as garbage.
12094         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12095         table information for static and relocatable links.
12096         * symtab.h (Symbol_table::set_gc): New function.
12097         (Symbol_table::gc): New function.
12098         (Symbol_table::gc_mark_undef_symbols): New function.
12099         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12100         (Symbol_table::gc_mark_dyn_syms): New function.
12101         (Symbol_table::gc_): New data member.
12102         * target.h (Sized_target::gc_process_relocs): New pure virtual
12103         function.
12104         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12105         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12106
12107 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12108
12109         * options.h (General_options::gc_sections): Define as a no-op for now.
12110         (General_options::no_keep_memory): Ditto.
12111         (General_options::Bshareable): Define.
12112         * options.cc (General_options::finalize): Honor -Bshareable.
12113
12114 2009-01-20  Andreas Schwab  <schwab@suse.de>
12115
12116         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12117         read the value in the contents, since we don't use it.  Use the
12118         template endianness when writing.
12119         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12120
12121 2009-01-19  Andreas Schwab  <schwab@suse.de>
12122
12123         * configure.tgt (powerpc64-*): Fix targ_obj.
12124
12125 2009-01-15  Ian Lance Taylor  <iant@google.com>
12126
12127         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12128         local symbols when stripping all symbols.
12129
12130 2009-01-14  Cary Coutant  <ccoutant@google.com>
12131
12132         * output.cc (Output_reloc): Add explicit instantiations.
12133
12134 2009-01-14  Cary Coutant  <ccoutant@google.com>
12135
12136         * archive.cc (Archive::get_elf_object_for_member): Remove call
12137         to File_read::claim_for_plugin.
12138         * descriptors.cc (Descriptors::open): Remove reference to
12139         is_claimed.
12140         (Descriptors::claim_for_plugin): Remove.
12141         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12142         (Descriptors::is_claimed): Remove.
12143         (claim_descriptor_for_plugin): Remove.
12144         * fileread.cc (File_read::claim_for_plugin): Remove.
12145         * fileread.h (File_read::claim_for_plugin): Remove.
12146         (File_read::descriptor): Reopen descriptor if necessary.
12147         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12148         (Plugin_manager::all_symbols_read): Add task parameter. Change
12149         all callers.
12150         (Plugin_manager::get_input_file): New function.
12151         (Plugin_manager::release_input_file): New function.
12152         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12153         corresponding data member.
12154         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12155         and pass to base constructor. Change all callers.
12156         (get_input_file, release_input_file): New functions.
12157         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12158         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12159         (Plugin_manager::all_symbols_read): Add task parameter.
12160         (Plugin_manager::get_input_file): New function.
12161         (Plugin_manager::release_input_file): New function.
12162         (Plugin_manager::task_): New data member.
12163         (Pluginobj::Pluginobj): Add filesize parameter.
12164         (Pluginobj::filename): New function.
12165         (Pluginobj::descriptor): New function.
12166         (Pluginobj::filesize): New function.
12167         (Pluginobj::filesize_): New data member.
12168         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12169         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12170         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12171
12172         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12173         with archive libraries.
12174         * testsuite/Makefile.in: Regenerate.
12175         * testsuite/plugin_test.c (struct sym_info): New type.
12176         (get_input_file, release_input_file): New static variables.
12177         (onload): Capture new transfer vector entries.
12178         (claim_file_hook): Stop reading at end of file according to filesize.
12179         Factor out parsing of readelf output into separate function.
12180         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12181         APIs and get the source file name from the symbol table.  Convert
12182         source file name to corresponding object file name.  Print info
12183         message when adding new input files.
12184         (parse_readelf_line): New function.
12185         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12186         * testsuite/plugin_test_2.sh: Likewise.
12187         * testsuite/plugin_test_3.sh: Likewise.
12188         * testsuite/plugin_test_4.sh: New test case.
12189
12190 2009-01-07  Ian Lance Taylor  <iant@google.com>
12191
12192         * version.cc (version_string): Bump to 1.8.
12193
12194 2008-12-23  Cary Coutant  <ccoutant@google.com>
12195
12196         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12197         * plugin.cc (Plugin_manager::finish): Rename as
12198         layout_deferred_objects.  Move cleanup to separate function.
12199         (Plugin_manager::cleanup): New function.
12200         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12201         separately.
12202         * plugin.h (Plugin_manager::finish): Rename as
12203         layout_deferred_objects.
12204         (Plugin_manager::cleanup): New function.
12205         (Plugin_manager::cleanup_done): New field.
12206
12207 2008-12-23  Cary Coutant  <ccoutant@google.com>
12208
12209         * plugin.cc (is_visible_from_outside): New function.
12210         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12211         so we don't return "IR only" status for exported symbols or -r links.
12212
12213         * testsuite/Makefile.am (plugin_test_3): New test case.
12214         * testsuite/Makefile.in: Regenerate.
12215         * testsuite/plugin_test_3.sh: New file.
12216
12217 2008-12-22  Cary Coutant  <ccoutant@google.com>
12218
12219         * object.cc (Sized_relobj::layout_section): New function.
12220         (Sized_relobj::do_layout): Defer layout of input sections until after
12221         plugin has provided replacement files.
12222         (Sized_relobj::do_layout_deferred_sections): New function.
12223         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12224         (Relobj::layout_deferred_sections): New function.
12225         (Relobj::do_layout_deferred_sections): New function.
12226         (Sized_relobj::do_layout_deferred_sections): New function.
12227         (Sized_relobj::layout_section): New function.
12228         (Sized_relobj::Deferred_layout): New structure.
12229         (Sized_relobj::deferred_layout_): New field.
12230         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12231         Change all callers.  Layout deferred sections.
12232         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12233         references.
12234         (Plugin_hook::run): Move code from do_plugin_hook inline.
12235         (Plugin_hook::do_plugin_hook): Remove.
12236         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12237         (Plugin_manager::finish): Renamed, was cleanup.
12238         (Plugin_manager::should_defer_layout): New function.
12239         (Plugin_manager::add_deferred_layout_object): New function.
12240         (Plugin_manager::Deferred_layout_list): New type.
12241         (Plugin_manager::deferred_layout_objects_): New field.
12242         (Plugin_hook::do_plugin_hook): Remove.
12243
12244 2008-12-17  Ian Lance Taylor  <iant@google.com>
12245
12246         * options.h (class General_options): Add --no case for
12247         --export-dynamic.
12248
12249 2008-12-16  Cary Coutant  <ccoutant@google.com>
12250
12251         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12252         vector.
12253         (Plugin_manager::claim_file): Create plugin object even if
12254         plugin did not call the add_symbols callback.
12255         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12256         asking for more symbols than were added.
12257         * testsuite/Makefile.am (plugin_test_1): Add test case with
12258         no global symbols.
12259         (empty.syms): New target.
12260         * testsuite/Makefile.in: Regenerate.
12261         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12262         message. Don't call add_symbols if no globals.
12263         (all_symbols_read_hook): Don't provide replacement for empty
12264         claimed file.
12265
12266 2008-12-12  Ian Lance Taylor  <iant@google.com>
12267
12268         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12269         r_type == 0 for a local symbol with r_sym == 0.
12270         (scan_relocatable_relocs): Pass r_sym to
12271         local_non_section_strategy.
12272         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12273         r_sym parameter.
12274
12275         * configure.ac: Update test for TLS descriptors: they are
12276         supported as of glibc 2.9.
12277         * configure: Rebuild.
12278
12279 2008-12-11  Ian Lance Taylor  <iant@google.com>
12280
12281         PR 7091
12282         * target-reloc.h (Default_scan_relocatable_relocs): For each
12283         function, map r_type == 0 to RELOC_DISCARD.
12284
12285 2008-12-10  Cary Coutant  <ccoutant@google.com>
12286
12287         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12288         object to override a kept COMDAT group from a plugin object.
12289
12290 2008-12-09  Ian Lance Taylor  <iant@google.com>
12291
12292         PR 7088
12293         * yyscript.y (file_cmd): Handle INPUT.
12294
12295         * testsuite/initpri1.c: Change all declarations to be full
12296         prototypes by adding void, to avoid compiler warnings.
12297
12298 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12299
12300         * options.cc (General_options::parse_plugin_opt): New.
12301         (General_options::add_plugin): The argument now is just the filename.
12302         (General_options::add_plugin_option): New.
12303         * options.h (plugin_opt): New.
12304         (add_plugin): Change argument name.
12305         (add_plugin_option): New.
12306         * plugin.cc (Plugin::load): Don't parse the plugin option.
12307         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12308         (Plugin::add_option): New.
12309         (Plugin::args_): Change type.
12310         (Plugin::filename_): New.
12311         (Plugin_manager::add_plugin_option): New.
12312         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12313         * testsuite/Makefile.in: Regenerate.
12314
12315 2008-12-05  Cary Coutant  <ccoutant@google.com>
12316
12317         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12318         Handle --strip-lto-sections option.
12319         * options.h (strip_lto_sections): New option.
12320
12321 2008-12-01  Cary Coutant  <ccoutant@google.com>
12322
12323         * plugin.cc (ld_plugin_message): Change format parameter to const.
12324         Fix mismatch between new[] and delete.
12325
12326 2008-11-14  Cary Coutant  <ccoutant@google.com>
12327
12328         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12329         instead of -1U.
12330
12331 2008-11-05  Craig Silverstein  <csilvers@google.com>
12332
12333         * options.cc (General_options::parse_dynamic_list): New function.
12334         * options.h (General_options): New flags dynamic_list,
12335         dynamic_list_data, dynamic_list_cpp_new, and
12336         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12337         (General_options::in_dynamic_list): New function.
12338         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12339         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12340         (Lex::can_continue_name): Likewise.
12341         (yylex): Likewise.
12342         (read_script_file): New parameter script_options.
12343         (read_dynamic_list): New function.
12344         (Script_options::define_dynamic_list): New function.
12345         (dynamic_list_keyword_parsecodes): New variable.
12346         (dynamic_list_keywords): New variable.
12347         * script.h (Script_options::define_dynamic_list): New function
12348         prototype.
12349         (read_dynamic_list): New function prototype.
12350         * symtab.cc (strprefix): New macro.
12351         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12352         dynamic_list_data, dynamic_list_cpp_new, and
12353         dynamic_list_cpp_typeinfo.
12354         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12355         (dynamic_list_expr): New rule.
12356         (dynamic_list_nodes): Likewise.
12357         (dynamic_list_node): Likewise.
12358         * testsuite/Makefile.am (dynamic_list): New test.
12359         * testsuite/Makefile.in: Regenerated.
12360         * testsuite/dynamic_list.t: New file.
12361         * testsuite/dynamic_list.sh: New file.
12362
12363 2008-11-05  Craig Silverstein  <csilvers@google.com>
12364
12365         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12366         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12367         (t11_last): Likewise.
12368         * testsuite/ver_test_6.c (main): Likewise.
12369
12370 2008-10-07  Cary Coutant  <ccoutant@google.com>
12371
12372         * options.c (General_options::finalize): Add check for -static and
12373         -shared.
12374         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12375         is not empty.
12376
12377 2008-10-02  Cary Coutant  <ccoutant@google.com>
12378
12379         * plugin.cc (make_sized_plugin_object): Fix conditional
12380         compilation to work when not all targets are enabled.
12381
12382 2008-09-29  Cary Coutant  <ccoutant@google.com>
12383
12384         * archive.cc (Archive::get_file_and_offset): Use filename instead
12385         of name to get library path.
12386         (Archive::include_member): Unlock external member of a thin archive.
12387
12388         * testsuite/Makefile.am (TEST_AR): New variable.
12389         (thin_archive_test_1): New test.
12390         (thin_archive_test_2): New test.
12391         * testsuite/Makefile.in: Regenerate.
12392         * testsuite/thin_archive_main.cc: New file.
12393         * testsuite/thin_archive_test_1.cc: New file.
12394         * testsuite/thin_archive_test_2.cc: New file.
12395         * testsuite/thin_archive_test_3.cc: New file.
12396         * testsuite/thin_archive_test_4.cc: New file.
12397
12398 2008-09-29  Cary Coutant  <ccoutant@google.com>
12399
12400         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12401         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12402         instead of -1U.
12403         (Sized_relobj::do_finalize_local_symbols): Likewise.
12404         (Sized_relobj::map_to_kept_section): Likewise.
12405         * object.h (Sized_relobj::invalid_address): New constant.
12406         (Sized_relobj::do_output_section_offset): Check for invalid_address
12407         and return -1ULL.
12408         * output.cc (Output_reloc::local_section_offset): Use constant
12409         invalid_address instead of -1U.
12410         (Output_reloc::get_address): Likewise.
12411         (Output_section::output_address): Change -1U to -1ULL.
12412         * output.h (Output_reloc::invalid_address): New constant.
12413         * reloc.cc (Sized_relobj::write_sections): Use constant
12414         invalid_address instead of -1U.
12415         (Sized_relobj::relocate_sections): Likewise.
12416         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12417         values for merge sections.
12418         * target-reloc.h (relocate_for_relocatable): Use constant
12419         invalid_address instead of -1U.
12420
12421 2008-09-19  Cary Coutant  <ccoutant@google.com>
12422
12423         Add plugin functionality for link-time optimization (LTO).
12424         * configure.ac (plugins): Add --enable-plugins option.
12425         * configure: Regenerate.
12426         * config.in: Regenerate.
12427         * Makefile.am (LIBDL): New variable.
12428         (CCFILES): Add plugin.cc.
12429         (HFILES): Add plugin.h.
12430         (ldadd_var): Add LIBDL.
12431         * Makefile.in: Regenerate.
12432
12433         * archive.cc: Include "plugin.h".
12434         (Archive::setup): Don't preread archive symbols when using a plugin.
12435         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12436         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12437         files.
12438         (Archive::include_member): Add symbols from plugin objects.
12439         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12440         * descriptors.cc (Descriptors::open): Check for file descriptors
12441         abandoned by plugins.
12442         (Descriptors::claim_for_plugin): New function.
12443         * descriptors.h (Descriptors::claim_for_plugin): New function.
12444         (Open_descriptor::is_claimed): New field.
12445         (claim_descriptor_for_plugin): New function.
12446         * fileread.cc (File_read::claim_for_plugin): New function.
12447         * fileread.h (File_read::claim_for_plugin): New function.
12448         (File_read::descriptor): New function.
12449         * gold.cc: Include "plugin.h".
12450         (queue_initial_tasks): Add task to call plugin hooks for generating
12451         new object files.
12452         * main.cc: Include "plugin.h".
12453         (main): Load plugin libraries.
12454         * object.h (Pluginobj): Declare.
12455         (Object::pluginobj): New function.
12456         (Object::do_pluginobj): New function.
12457         (Object::set_target): New function.
12458         * options.cc: Include "plugin.h".
12459         (General_options::parse_plugin): New function.
12460         (General_options::General_options): Initialize plugins_ field.
12461         (General_options::add_plugin): New function.
12462         * options.h (Plugin_manager): Declare.
12463         (General_options): Add --plugin option.
12464         (General_options::has_plugins): New function.
12465         (General_options::plugins): New function.
12466         (General_options::add_plugin): New function.
12467         (General_options::plugins_): New field.
12468         * plugin.cc: New file.
12469         * plugin.h: New file.
12470         * readsyms.cc: Include "plugin.h".
12471         (Read_symbols::do_read_symbols): Check for archive before checking
12472         for ELF file.  Call plugin hooks to claim files.
12473         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12474         from a real object file; force override when processing replacement
12475         files.
12476         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12477         (Symbol::init_base_object): Likewise.
12478         (Symbol::init_base_output_data): Likewise.
12479         (Symbol::init_base_output_segment): Likewise.
12480         (Symbol::init_base_constant): Likewise.
12481         (Symbol::init_base_undefined): Likewise.
12482         (Symbol::output_section): Assert that object is not a plugin.
12483         (Symbol_table::add_from_pluginobj): New function.
12484         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12485         undefined.
12486         (Symbol_table::sized_write_globals): Likewise.
12487         (Symbol_table::add_from_pluginobj): Instantiate template.
12488         * symtab.h (Sized_pluginobj): Declare.
12489         (Symbol::in_real_elf): New function.
12490         (Symbol::set_in_real_elf): New function.
12491         (Symbol::in_real_elf_): New field.
12492         (Symbol_table::add_from_pluginobj): New function.
12493
12494         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12495         (LIBDL): New variable.
12496         (LDADD): Add LIBDL.
12497         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12498         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12499         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12500         (MOSTLYCLEANFILES): Likewise.
12501         * testsuite/Makefile.in: Regenerate.
12502         * testsuite/plugin_test.c: New file.
12503         * testsuite/plugin_test_1.sh: New file.
12504         * testsuite/plugin_test_2.sh: New file.
12505
12506 2008-09-16  Ian Lance Taylor  <iant@google.com>
12507
12508         * target-reloc.h (relocate_section): Check whether a symbol is
12509         defined by the ABI before reporting an undefined symbol error.
12510         * target.h (Target::is_defined_by_abi): Make parameter const.
12511         (Target::do_is_defined_by_abi): Likewise.
12512         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12513         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12514         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12515         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12516         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12517         * testsuite/Makefile.in: Rebuild.
12518
12519         * fileread.cc (make_view): Add casts to avoid warning.
12520
12521 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12522
12523         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12524         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12525
12526 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12527
12528         * options.h (General_options::output_is_executable): New.
12529         (General_options::output_is_pie): New.
12530         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12531         for shared libraries.
12532         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12533
12534 2008-09-11  Chris Demetriou  <cgd@google.com>
12535
12536         * options.h (origin): New -z option.
12537         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12538         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12539         in DT_FLAGS_1.
12540
12541 2008-09-05  Cary Coutant  <ccoutant@google.com>
12542
12543         * fileread.cc (File_read::make_view): Add check for attempt to map
12544         beyond end of file.
12545
12546 2008-09-05  Cary Coutant  <ccoutant@google.com>
12547
12548         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12549         explicit instantiations.
12550
12551 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12552
12553         PR gold/6858
12554         * options.cc (General_options::finalize): Allow undefined symbols
12555         in shlibs if linking -shared.
12556
12557         PR gold/6859
12558         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12559         symbols as not needing a dynsym entry.
12560
12561 2008-08-20  Craig Silverstein  <csilvers@google.com>
12562
12563         * fileread.cc (File_read::open): Do not lock the file unless it
12564         was successfully opened.
12565
12566 2008-08-14  Cary Coutant  <ccoutant@google.com>
12567
12568         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12569         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12570         * testsuite/tls_test.cc (struct int128): 128-bit struct
12571         for testing TLS relocs with non-zero addend.
12572         (v12): New TLS variable.
12573         (t12): New test.
12574         (t_last): Add check for v12.
12575         * testsuite/tls_test.h (t12): New function.
12576         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12577
12578 2008-08-13  Ian Lance Taylor  <iant@google.com>
12579
12580         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12581         set tls_segment_ or relro_segment_.
12582         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12583         when appropriate.
12584         * output.h (Output_section::clear_is_relro): New function.
12585         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12586         sections specially even when output_data_ is empty.
12587         (Output_segment::maximum_alignment): When first section is relro,
12588         only force alignment for PT_LOAD segments.
12589         * script.cc (script_data_segment_align): New function.
12590         (script_data_segment_relro_end): New function.
12591         * script-c.h (script_data_segment_align): Declare.
12592         (script_data_segment_relro_end): Declare.
12593         * script-sections.h (class Script_sections): Declare
12594         data_segment_align and data_segment_relro_end.  Add fields
12595         segment_align_index_ and saw_relro_end_.
12596         * script-sections.cc (class Sections_element): Add set_is_relro
12597         virtual function.  Add new bool* parameter to place_orphan_here.
12598         Add get_output_section virtual function.
12599         (class Output_section_definition): Add set_is_relro.  Add new
12600         bool* parameter to place_orphan_here.  Add get_output_section.
12601         Add is_relro_ field.
12602         (Output_section_definition::Output_section_definition): Initialize
12603         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12604         and is_relro_ fields.
12605         (Output_section_definition::place_orphan_here): Add is_relro
12606         parameter.
12607         (Output_section_definition::set_section_addresses): Set relro for
12608         output section.
12609         (Output_section_definition::alternate_constraint): Likewise.
12610         (class Orphan_output_section): Add new bool* parameter to
12611         place_orphan_here.  Add get_output_section.
12612         (Orphan_output_section::place_orphan_here): Add is_relro
12613         parameter.
12614         (Script_sections::Script_sections): Initialize
12615         data_segment_align_index_ and saw_relro_end_.
12616         (Script_sections::data_segment_align): New function.
12617         (Script_sections::data_segment_relro_end): New function.
12618         (Script_sections::place_orphan): Set or clear is_relro.
12619         (Script_sections::set_section_addresses): Force alignment of first
12620         TLS section.
12621         * yyscript.y (exp): Call script_data_segment_align and
12622         script_data_segment_relro_end.
12623         * testsuite/relro_script_test.t: New file.
12624         * testsuite/relro_test.cc (using_script): Declare.
12625         (t1, t2): Test using_script.
12626         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12627         (relro_script_test_SOURCES): Define.
12628         (relro_script_test_DEPENDENCIES): Define.
12629         (relro_script_test_LDFLAGS): Define.
12630         (relro_script_test_LDADD): Define.
12631         (relro_script_test.so): New target.
12632         * testsuite/Makefile.in: Rebuild.
12633
12634 2008-08-06  Cary Coutant <ccoutant@google.com>
12635
12636         * archive.cc (Archive::total_archives, Archive::total_members)
12637         (Archive::total_members_loaded): New variables.
12638         (Archive::setup): Add parameter.  Add option to preread
12639         archive symbols.
12640         (Archive::read_armap): Add counter.
12641         (Archive::get_file_and_offset): New function.
12642         (Archive::get_elf_object_for_member): New function.
12643         (Archive::read_all_symbols): New function.
12644         (Archive::read_symbols): New function.
12645         (Archive::add_symbols): Add counters.
12646         (Archive::include_all_members): Use armap to find members if it's
12647         already built.
12648         (Archive::include_member): Skip reading symbols if already read.
12649         Factored code into Archive::get_file_and_offset and
12650         Archive::get_elf_object_for_member.  Changed call to
12651         Mapfile::report_include_archive_member.
12652         (Archive::print_stats): New function.
12653         * archive.h: Declare Object and Read_symbols_data classes.
12654         (Archive::Archive): Add initializers for new members.
12655         (Archive::setup): Add parameter.
12656         (Archive::print_stats): New function.
12657         (Archive::total_archives, Archive::total_members)
12658         (Archive::total_members_loaded): New variables.
12659         (Archive::get_file_and_offset): New function.
12660         (Archive::get_elf_object_for_member): New function.
12661         (Archive::read_all_symbols): New function.
12662         (Archive::read_symbols): New function.
12663         (Archive::Archive_member): New class.
12664         (Archive::members_): New member.
12665         (Archive::num_members_): New member.
12666         * main.cc: Include archive.h.
12667         (main): Call Archive::print_stats.
12668         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12669         archive parameter; member_name is now the fully-decorated name.
12670         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12671         * options.h: (General_options): Add --preread-archive-symbols option.
12672         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12673         Archive::setup.
12674
12675 2008-08-04  Ian Lance Taylor  <iant@google.com>
12676
12677         * symtab.h (Symbol::use_plt_offset): New function.
12678         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12679         * powerpc.cc (Relocate::relocate): Likewise.
12680         * sparc.cc (Relocate::relocate): Likewise.
12681         * x86_64.cc (Relocate::relocate): Likewise.
12682         * testsuite/weak_plt.sh: New test.
12683         * testsuite/weak_plt_main.cc: New test.
12684         * testsuite/weak_plt_shared.cc: New test.
12685         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12686         (check_PROGRAMS): Add weak_plt.
12687         (check_DATA): Add weak_plt_shared.so.
12688         (weak_plt_main_pic.o, weak_plt): New targets.
12689         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12690         * testsuite/Makefile.in: Rebuild.
12691
12692         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12693         gcctestdir/ld.
12694         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12695         * testsuite/Makefile.in: Rebuild.
12696
12697 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12698
12699         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12700         * Makefile.in: Regenerate.
12701         * po/POTFILES.in: Regenerate.
12702
12703 2008-07-29  Ian Lance Taylor  <iant@google.com>
12704
12705         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12706         symbols before other symbols.
12707         * testsuite/script_test_2.cc (test_addr): Declare.
12708         (test_addr_alias): Declare.
12709         (main): Check that test_addr and test_addr_alias have the right
12710         values.
12711         * testsuite/script_test_2.t: Define test_addr_alias and
12712         test_addr.
12713
12714 2008-07-24  Ian Lance Taylor  <iant@google.com>
12715
12716         PR 5990
12717         * descriptors.cc: New file.
12718         * descriptors.h: New file.
12719         * gold-threads.h (class Hold_optional_lock): New class.
12720         * fileread.cc: Include "descriptors.h".
12721         (File_read::~File_read): Release descriptor rather than closing
12722         it.
12723         (File_read::open) [file]: Call open_descriptor rather than open.
12724         Set is_descriptor_opened_.
12725         (File_read::open) [memory]: Assert that descriptor is not open.
12726         (File_read::reopen_descriptor): New function.
12727         (File_read::release): Release descriptor.
12728         (File_read::do_read): Make non-const.  Reopen descriptor.
12729         (File_read::read): Make non-const.
12730         (File_read::make_view): Reopen descriptor.
12731         (File_read::do_readv): Likewise.
12732         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12733         Update declarations.
12734         * layout.cc: Include "descriptors.h".
12735         (Layout::create_build_id): Use open_descriptor rather than open.
12736         * output.cc: Include "descriptors.h".
12737         (Output_file::open): Use open_descriptor rather than open.
12738         * archive.cc (Archive::const_iterator): Change Archive to be
12739         non-const.
12740         (Archive::begin, Archive::end): Make non-const.
12741         (Archive::count_members): Likewise.
12742         * archive.h (class Archive): Update declarations.
12743         * object.h (Object::read): Make non-const.
12744         * Makefile.am (CCFILES): Add descriptors.cc.
12745         (HFILES): Add descriptors.h.
12746         * Makefile.in: Rebuild.
12747
12748         PR 6716
12749         * gold.h: Always include <clocale>.  Add Solaris workarounds
12750         following code in binutils/sysdep.h.
12751
12752         PR 6048
12753         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12754         this->eh_frame_hdr_ is NULL before using it.
12755
12756         * dynobj.cc (Versions::Versions): Update comment.
12757
12758         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12759         the base version name.
12760
12761         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12762         array size plus one.
12763         (Stringpool_template::set_string_offsets): Subtract one from key
12764         before using it as an array index.
12765         (Stringpool_template::get_offset_with_length): Likewise.
12766         (Stringpool_template::write_to_buffer): Likewise.
12767         * stringpool.h (Stringpool_template::get_offset_from_key):
12768         Likewise.
12769
12770 2008-07-23  Ian Lance Taylor  <iant@google.com>
12771
12772         PR 6658
12773         * object.h (Merged_symbol_value::value): Do our best to handle a
12774         negative addend.
12775
12776         PR 6647
12777         * script.cc (Version_script_info::get_versions): Don't add empty
12778         version tag to return value.
12779         (Version_script_info::get_symbol_version_helper): Change return
12780         type to bool.  Add pversion parameter.  Change all callers.
12781         (script_register_vers_node): Don't require a non-NULL tag.
12782         * script.h (class Version_script_info): Update declarations.
12783         (Version_script_info::get_symbol_version): Change return type to
12784         bool.  Add version parameter.  Change all callers.
12785         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12786         handling.  Handle an empty version from a version script.
12787         (Symbol_table::define_special_symbol): Likewise.
12788         * testsuite/ver_test_10.script: New file.
12789         * testsuite/ver_test_10.sh: New file.
12790         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12791         (check_DATA): Add ver_test_10.syms.
12792         (ver_test_10.syms, ver_test_10.so): New target.
12793         * testsuite/Makefile.in: Rebuild.
12794
12795 2008-07-23  Simon Baldwin  <simonb@google.com>
12796
12797         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12798         to zero for undefined symbols from dynamic libraries.
12799
12800 2008-07-23  Ian Lance Taylor  <iant@google.com>
12801
12802         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12803         Change all callers.
12804         * symtab.h (class Symbol_table): Update declaration.
12805         * testsuite/ver_test_9.cc: New file.
12806         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12807         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12808         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12809         (ver_test_9.so, ver_test_9.o): New targets.
12810         * testsuite/Makefile.in: Rebuild.
12811
12812 2008-07-22  Ian Lance Taylor  <iant@google.com>
12813
12814         * options.h (class General_options): Define --check-sections.
12815         * layout.cc (Layout::set_segment_offsets): Handle
12816         --check-sections.
12817
12818         * options.h (class General_options): Define -n/--nmagic and
12819         -N/--omagic.
12820         * options.cc (General_options::finalize): For -n/--nmagic or
12821         -N/--omagic, set -static.
12822         * layout.cc (Layout::attach_allocated_section_to_segment): If
12823         -N/--omagic, don't put read-only and read-write sections in
12824         different segments.
12825         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12826         finding a read-only segment.
12827         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12828         don't set the minimum segment alignment to the common page size,
12829         and don't set the file offset to the address modulo the page size.
12830         * script-sections.cc (Script_sections::create_segments): If
12831         -n/--omagic, don't put read-only and read-write sections in
12832         different segments.
12833
12834         * cref.cc: New file.
12835         * cref.h: New file.
12836         * options.h (class General_options): Add --print-symbol-counts.
12837         * main.cc (main): Issue defined symbol report if requested.
12838         * archive.cc (Archive::interpret_header): Make into a const member
12839         function.
12840         (Archive::add_symbols): Call Input_objects::archive_start and
12841         archive_stop.
12842         (Archive::const_iterator): Define new class.
12843         (Archive::begin, Archive::end): New functions.
12844         (Archive::include_all_members): Rewrite to use iterator.
12845         (Archive::count_members): New function.
12846         * archive.h (class Archive): Update declarations.
12847         (Archive::filename): New function.
12848         * object.cc: Include "cref.h".
12849         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12850         (Sized_relobj::do_get_global_symbol_counts): New function.
12851         (Input_objects::add_object): Add object to cross-referencer.
12852         (Input_objects::archive_start): New function.
12853         (Input_objects::archive_stop): New function.
12854         (Input_objects::print_symbol_counts): New function.
12855         * object.h: Declare Cref and Archive.
12856         (Object::get_global_symbol_counts): New function.
12857         (Object::do_get_global_symbol_counts): New pure virtual function.
12858         (class Sized_relobj): Add defined_count_ field.  Update
12859         declarations.
12860         (class Input_objects): Add cref_ field.  Update constructor.
12861         Update declarations.
12862         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12863         defined_count_.
12864         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12865         symbol counts.
12866         (Sized_dynobj::do_get_global_symbol_counts): New function.
12867         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12868         defined_count_.  Update declarations.  Define Symbols typedef.
12869         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12870         parameter.  Change all callers.
12871         (Symbol_table::add_from_dynobj): Add sympointers and defined
12872         parameters.  Change all callers.
12873         * symtab.h (class Symbol_table): Update declarations.
12874         * Makefile.am (CCFILES): Add cref.cc.
12875         (HFILES): Add cref.h.
12876         * Makefile.in: Rebuild.
12877
12878 2008-07-22  Simon Baldwin  <simonb@google.com>
12879
12880         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12881         to zero when writing undefined symbols.
12882
12883 2008-07-22  Ian Lance Taylor  <iant@google.com>
12884
12885         * output.cc (Output_section::add_input_section): Don't try to
12886         merge empty merge sections.
12887
12888 2008-07-21  Craig Silverstein  <csilvers@google.com>
12889
12890         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12891         Include symbol version in error message.
12892
12893 2008-07-20  Chris Demetriou  <cgd@google.com>
12894
12895         * configure.ac (gold_cv_c_random_seed): New configured variable.
12896         (RANDOM_SEED_CFLAGS): New substituted variable.
12897         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12898         * configure: Rebuild.
12899         * Makefile.in: Likewise.
12900         * testsuite/Makefile.in: Likewise.
12901
12902 2008-07-18  Ian Lance Taylor  <iant@google.com>
12903
12904         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12905         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12906         * testsuite/ver_test_main.cc (main): Call t4.
12907         (t4, t4_2a): Define.
12908         * testsuite/ver_test_2.cc (t4_2): Define.
12909         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12910         * testsuite/ver_test_4.cc (t4_2a): Define.
12911         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12912         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12913
12914 2008-07-17  Ian Lance Taylor  <iant@google.com>
12915
12916         * dynobj.cc (Versions::add_def): If we give an error about a
12917         missing version, go ahead and create the version anyhow.
12918
12919 2008-07-10  Ian Lance Taylor  <iant@google.com>
12920
12921         Handle output sections with more than 0x7fffffff bytes.
12922         * object.h (class Relobj): Change map_to_output_ to
12923         output_sections_, and just keep a section pointer.  Change all
12924         uses.  Move comdat group support to Sized_relobj.
12925         (Relobj::is_section_specially_mapped): Remove.
12926         (Relobj::output_section): Remove poff parameter.  Change all
12927         callers.
12928         (Relobj::output_section_offset): New function.
12929         (Relobj::set_section_offset): Rewrite.
12930         (Relobj::map_to_output): Remove.
12931         (Relobj::output_sections): New function.
12932         (Relobj::do_output_section_offset): New pure virtual function.
12933         (Relobj::do_set_section_offset): Likewise.
12934         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12935         group support from Relobj.  Update declarations.
12936         (Sized_relobj::get_output_section_offset): New function.
12937         (Sized_relobj::do_output_section_offset): New function.
12938         (Sized_relobj::do_set_section_offset): New function.
12939         * object.cc (Relobj::output_section_address): Remove.
12940         (Sized_relobj::Sized_relobj): Initialize new fields.
12941         (Sized_relobj::include_section_group): Cast find_kept_object to
12942         Sized_relobj.
12943         (Sized_relobj::include_linkonce_section): Likewise.
12944         (Sized_relobj::do_layout): Use separate arrays for output section
12945         and output offset.
12946         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12947         output_sections.
12948         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12949         output_sections and section_offsets.
12950         (Sized_relobj::write_local_symbols): Likewise.
12951         (map_to_kept_section): Compute output address directly.
12952         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12953         output_sections and section_offsets.
12954         (Sized_relobj::write_sections): Likewise.
12955         (Sized_relobj::relocate_sections): Likewise.
12956         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12957         * output.h (class Output_reloc): Update declarations.  Change
12958         u2_.relobj to Sized_relobj*.
12959         (class Output_data_reloc): Change add functions to use
12960         Sized_relobj*.
12961         * output.cc (Output_reloc::Output_reloc): Change relobj to
12962         Sized_relobj*.
12963         (Output_reloc::local_section_offset): Change return type to
12964         Elf_Addr.  Use get_output_section_offset.
12965         (Output_reloc::get_address): Likewise.
12966         (Output_section::is_input_address_mapped): Don't call
12967         is_section_specially_mapped.
12968         (Output_section::output_offset): Likewise.
12969         (Output_section::output_address): Likewise.
12970         (Output_section::starting_output_address): Likewise.
12971         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12972         parameter to Sized_relobj*.
12973         (Copy_relocs::need_copy_reloc): Likewise.
12974         (Copy_relocs::save): Likewise.
12975         * copy-relocs.h (class Copy_relocs): Update declarations.
12976         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12977         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12978         * target-reloc.h (relocate_for_relocatable): Change
12979         offset_in_output_section type to Elf_Addr.  Change code that uses
12980         it as well.
12981         * layout.cc (Layout::layout): Always set *off.
12982         * mapfile.cc (Mapfile::print_input_section): Use
12983         output_section_offset.
12984         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12985         Sized_relobj*.
12986         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12987         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12988         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12989
12990 2008-07-03  Ian Lance Taylor  <iant@google.com>
12991
12992         * layout.cc (Layout::include_section): Do not discard unrecognized
12993         SHT_STRTAB sections.
12994
12995 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12996
12997         * script.cc (Lex::can_continue_name): Make '?' allowable in
12998         version-script names.
12999         * testsuite/version_script.map: Change glob pattern to use '?'
13000
13001 2008-06-30  Manish Singh  <yosh@gimp.org>
13002
13003         PR 6585
13004         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13005         Correct typo.
13006
13007 2008-06-30  Ian Lance Taylor  <iant@google.com>
13008
13009         PR 6660
13010         PR 6682
13011         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13012         versions]: Don't try to read the value in the contents, since we
13013         don't use it.  Use the template endianness when writing.
13014
13015 2008-06-25  Cary Coutant  <ccoutant@google.com>
13016
13017         * fileread.cc (File_read::make_view): Assert on zero-length view.
13018         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13019         symbol table when there are no symbols to read.
13020
13021 2008-06-23  Craig Silverstein  <csilvers@google.com>
13022
13023         * version.cc (version_string): Bump to 1.7
13024
13025 2008-06-18  Craig Silverstein  <csilvers@google.com>
13026
13027         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13028         constant 0xFFFF to type Valtype.
13029         (Powerpc_relocate_functions::rel16_ha): Likewise.
13030
13031 2008-06-17  Ian Lance Taylor  <iant@google.com>
13032
13033         * output.h (Output_section::Input_section): Initialize p2align_ to
13034         zero for Output_section_data constructors.
13035         (Output_section::Input_section::addralign): If not an input
13036         section, return the alignment of the Output_section_data.
13037         * testsuite/copy_test.cc: New file.
13038         * testsuite/copy_test_1.cc: New file.
13039         * testsuite/copy_test_2.cc: New file.
13040         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13041         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13042         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13043         (copy_test_1_pic.o, copy_test_1.so): New targets.
13044         (copy_test_2_pic.o, copy_test_2.so): New targets.
13045         * testsuite/Makefile.in: Rebuild.
13046
13047         * script-sections.cc (Script_sections::place_orphan): Initialize
13048         local variable exact.
13049
13050 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13051
13052         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13053
13054 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13055             David S. Miller  <davem@davemloft.net>
13056
13057         * powerpc.cc: New file.
13058         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13059         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13060         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13061         * Makefile.in: Rebuild.
13062
13063 2008-06-09  Ian Lance Taylor  <iant@google.com>
13064
13065         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13066         <exception>.
13067         (throwing, orig_terminate): New static variables.
13068         (terminate_handler): New static function.
13069         (t2): Set terminate handler.
13070
13071 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13072
13073         PR 6584
13074         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13075         alignment.
13076
13077 2008-05-30  Cary Coutant  <ccoutant@google.com>
13078
13079         * archive.cc (Archive::include_all_members) Correct to step
13080         over symbol table and extended name table in thin archives.
13081
13082 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13083
13084         PR 6407
13085         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13086         calculation.
13087
13088 2008-05-28  Caleb Howe  <cshowe@google.com>
13089
13090         * reduced_debug_output.cc: New file.
13091         * reduced_debug_output.h: New file.
13092         * options.h (class General_options): Add --strip-debug-non-line.
13093         * options.cc (General_options::finalize): Add strip_debug_non_line
13094         to the strip heirarchy.
13095         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13096         fields.
13097         * layout.cc: Include "reduced_debug_output.h".
13098         (Layout::Layout): Initialize new fields.
13099         (line_only_debug_sections): New static array.
13100         (is_lines_only_debug_sections): New static inline function.
13101         (Layout::include_section): Handle --strip-debug-non-line.
13102         (Layout::make_output_section): If --strip-debug-non-line, build
13103         new output sections for .debug_abbrev and .debug_info.
13104         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13105         gold.  Warn about possible overflow.
13106         (read_signed_LEB_128): Likewise.
13107         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13108         (read_signed_LEB_128): Declare.
13109         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13110         (HFILES): Add reduced_debug_output.h.
13111         * Makefile.in: Rebuild.
13112
13113 2008-05-21  Ian Lance Taylor  <iant@google.com>
13114
13115         * mapfile.cc: New file.
13116         * mapfile.h: New file.
13117         * options.h (class General_options): Add -M/--print-map and -Map.
13118         * options.cc (General_options::finalize): Make -M equivalent to
13119         -Map -.
13120         * main.cc: Include <cstdio> and "mapfile.h".
13121         (main): Open mapfile if requested.
13122         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13123         constructor.  Change caller.
13124         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13125         (queue_middle_tasks): Likewise.
13126         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13127         declarations.
13128         * archive.cc: Include "mapfile.h".
13129         (Archive::add_symbols): Add mapfile parameter.  Change all
13130         callers.  Pass mapfile, symbol, and reason to include_member.
13131         (Archive::include_all_members): Add mapfile parameter.  Change all
13132         callers.
13133         (Archive::include_member): Add mapfile, sym, and why parameters.
13134         Change all callers.  Report inclusion to map file.
13135         * archive.h: Include "fileread.h".
13136         (class Archive): Update declarations.
13137         (Archive::file): New const method.
13138         (class Add_archive_symbols): Add mapfile_ field.  Update
13139         constructor.  Change all callers.
13140         * readsyms.h (class Read_symbols): Likewise.
13141         (class Finish_group): Likewise.
13142         (class Read_script): Likewise.
13143         * common.cc: Include "mapfile.h".
13144         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13145         all callers.
13146         (Symbol_table::do_allocate_commons): Likewise.
13147         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13148         symbol allocation to mapfile.
13149         * common.h (class Allocate_commons_task): Add mapfile_ field.
13150         Update constructor.  Change all callers.
13151         * symtab.h (class Symbol_table): Update declarations.
13152         * layout.cc: Include "mapfile.h".
13153         (Layout_task_runner::run): Print information to mapfile.
13154         (Layout::create_gold_note): Change Output_data_fixed_space to
13155         Output_data_zero_fill.
13156         (Layout::create_build_id): Likewise.
13157         (Layout::print_to_mapfile): New function.
13158         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13159         constructor.  Change caller.
13160         (class Layout): Declare print_to_mapfile.
13161         * output.cc (Output_section::Input_section::print_to_mapfile): New
13162         function.
13163         (Output_section::add_input_section): If producing a map, always
13164         add to input_sections_ list.
13165         (Output_section::do_print_to_mapfile): New function.
13166         (Output_segment::print_sections_to_mapfile): New function.
13167         (Output_segment::print_section_list_to_mapfile): New function.
13168         * output.h: Include "mapfile.h".
13169         (Output_data::print_to_mapfile): New function.
13170         (Output_data::do_print_to_mapfile): New virtual function.
13171         (Output_segment_headers::do_print_to_mapfile): New function.
13172         (Output_file_header::do_print_to_mapfile): New function.
13173         (Output_data_const::do_print_to_mapfile): New function.
13174         (class Output_data_const_buffer): Add map_name_ field.  Update
13175         constructor.  Change all callers.  Add do_print_to_mapfile
13176         function.
13177         (class Output_data_fixed_space): Likewise.
13178         (class Output_data_space): Likewise.
13179         (class Output_data_zero_fill): New class.
13180         (Output_data_strtab::do_print_to_mapfile): New function.
13181         (Output_data_reloc_base::do_print_to_mapfile): New function.
13182         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13183         (Output_data_group::do_print_to_mapfile): New function.
13184         (Output_data_got::do_print_to_mapfile): New function.
13185         (Output_data_dynamic::do_print_to_mapfile): New function.
13186         (Output_symtab_xindex::do_print_to_mapfile): New function.
13187         (class Output_section): Declare do_print_to_mapflie.  Declare
13188         print_to_mapfile in Input_section.
13189         (class Output_segment): Declare new functions.
13190         * object.h (Sized_relobj::symbol_count): New function.
13191         * script-sections.cc
13192         (Output_section_element_dot_assignment::set_section_addresses):
13193         Change Output_data_fixed_space to Output_data_zero_fill.
13194         (Output_data_expression::do_print_to_mapfile): New function.
13195         * script.cc (read_input_script): Add mapfile parameter.  Change
13196         all callers.
13197         * script.h (read_input_script): Update declaration.
13198         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13199         (Eh_frame::do_print_to_mapfile): New function.
13200         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13201         (Output_merge_string::do_print_to_mapfile): New function.
13202         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13203         function.
13204         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13205         function.
13206         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13207         function.
13208         * Makefile.am (CCFILES): Add mapfile.cc.
13209         (HFILES): Add mapfile.h.
13210         * Makefile.in: Rebuild.
13211
13212 2008-05-19  Ian Lance Taylor  <iant@google.com>
13213
13214         * options.h (class General_options): Add -z relro.
13215         * layout.cc (Layout::Layout): Initialize relro_segment_.
13216         (Layout::add_output_section_data): Return the output section.
13217         (Layout::make_output_section): Rcognize relro sections and mark
13218         them appropriately.
13219         (Layout::attach_allocated_section_to_segment): Put relro sections
13220         in a PT_GNU_RELRO segment.
13221         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13222         section as relro.
13223         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13224         PT_TLS segments.
13225         (Layout::linkonce_mapping): Map d.rel.ro.local to
13226         .data.rel.ro.local.
13227         (Layout::output_section_name): Us .data.rel.ro.local for any
13228         section which begins with that.
13229         * layout.h (class Layout): Update add_output_section_data
13230         declaration.  Add relro_segment_ field.
13231         * output.cc (Output_section::Output_section): Initialize is_relro_
13232         and is_relro_local_ fields.
13233         (Output_segment::add_output_section): Group relro sections.
13234         (Output_segment::is_first_section_relro): New function.
13235         (Output_segment::maximum_alignment): If there is a relro section,
13236         align the segment to the common page size.
13237         (Output_segment::set_section_addresses): Track whether we are
13238         looking at relro sections.  If the last section is a relro
13239         section, align to the common page size.
13240         (Output_segment::set_section_list_addresses): Add in_relro
13241         parameter.  Change all callers.  Align to the page size when
13242         moving from relro to non-relro section.
13243         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13244         segment.
13245         * output.h (class Output_section): Add is_relro_ and
13246         is_relro_local_ fields.
13247         (Output_section::is_relro): New function.
13248         (Output_section::set_is_relro): New function.
13249         (Output_section::is_relro_local): New function.
13250         (Output_section::set_is_relro_local): New function.
13251         (class Output_segment): Update declarations.
13252         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13253         * sparc.cc (Target_sparc::got_section): Likewise.
13254         * x86_64.cc (Target_x86_64::got_section): Likewise.
13255         * testsuite/relro_test_main.cc: New file.
13256         * testsuite/relro_test.cc: New file.
13257         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13258         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13259         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13260         (relro_test.so, relro_test_pic.o): New targets.
13261         * testsuite/Makefile.in: Rebuild.
13262
13263 2008-05-16  Ian Lance Taylor  <iant@google.com>
13264
13265         * output.cc (Output_segment::add_output_section): Remove front
13266         parameter.
13267         * output.h (class Output_segment): Remove
13268         add_initial_output_section and overloaded add_output_section.
13269         Update declaration of remaining add_output_section.
13270         * layout.cc (Layout::create_interp): Call add_output_section
13271         rather than add_initial_output_section.
13272         (Layout::finish_dynamic_section): Likewise.
13273
13274         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13275         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13276         know the dynamic type.
13277         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13278         field.  Initialize it in constructor.
13279         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13280         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13281         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13282         reloc.
13283
13284         * output.cc (Output_reloc::get_address): Change return type to
13285         Elf_Addr.
13286         * output.h (class Output_reloc): Update get_address declaration.
13287         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13288         for section addresses.
13289
13290 2008-05-09  Ian Lance Taylor  <iant@google.com>
13291
13292         PR 6493
13293         * gold.cc (gold_nomem): Use return value of write.
13294
13295 2008-05-08  Ian Lance Taylor  <iant@google.com>
13296
13297         * symtab.c (Symbol::init_base_output_data): Add version
13298         parameter.  Change all callers.
13299         (Symbol::init_base_output_segment): Likewise.
13300         (Symbol::init_base_constant): Likewise.
13301         (Symbol::init_base_undefined): Likewise.
13302         (Sized_symbol::init_output_data): Likewise.
13303         (Sized_symbol::init_output_segment): Likewise.
13304         (Sized_symbol::init_constant): Likewise.
13305         (Sized_symbol::init_undefined): Likewise.
13306         (Symbol_table::do_define_in_output_data): If the new symbol has a
13307         version, mark it as the default.
13308         (Symbol_table::do_define_in_output_segment): Likewise.
13309         (Symbol_table::do_define_as_constant): Likewise.
13310         * symtab.h (class Symbol): Update declarations.
13311         (class Sized_symbol): Likewise.
13312         * resolve.cc (Symbol::override_version): New function.
13313         (Symbol::override_base): Call override_version.
13314         (Symbol::override_base_with_special): Likewise.
13315         * testsuite/ver_script_8.script: New file.
13316         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13317         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13318         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13319         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13320
13321 2008-05-06  Ian Lance Taylor  <iant@google.com>
13322
13323         PR 6049
13324         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13325         functions.
13326         (class General_options): Remove existing --undefined, and add
13327         --no-undefined instead.  Add new --undefined as synonym for -u.
13328         * archive.cc (Archive::add_symbols): Check whether symbol was
13329         named with -u.
13330         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13331         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13332         all uses.  Add IS_UNDEFINED.  Update declarations to split
13333         different versions of init_base.  Declare init_base_undefined.
13334         (Symbol::is_defined): Handle IS_UNDEFINED.
13335         (Symbol::is_undefined): Likewise.
13336         (Symbol::is_weak_undefined): Call is_undefined.
13337         (Symbol::is_absolute): Handle IS_CONSTANT.
13338         (class Sized_symbol): Update declarations to split different
13339         versions of init.  Declare init_undefined.
13340         (class Symbol_table): Declare new functions.
13341         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13342         Change all callers.
13343         (Symbol::init_base_output_data): Likewise.
13344         (Symbol::init_base_output_segment): Likewise.
13345         (Symbol::init_base_constant): Likewise.
13346         (Symbol::init_base_undefined): New function.
13347         (Sized_symbol::init_object): Rename from init.  Change all
13348         callers.
13349         (Sized_symbol::init_output_data): Likewise.
13350         (Sized_symbol::init_output_segment): Likewise.
13351         (Sized_symbol::init_constant): Likewise.
13352         (Sized_symbol::init_undefined): New function.
13353         (Symbol_table::add_undefined_symbols_from_command_line): New
13354         function.
13355         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13356         function.
13357         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13358         (Symbol::output_section): Likewise.
13359         (Symbol::set_output_section): Likewise.
13360         (Symbol_table::sized_finalize_symbol): Likewise.
13361         (Symbol_table::sized_write_globals): Likewise.
13362         * resolve.cc (Symbol_table::should_override): Likewise.
13363         (Symbol::override_base_with_special): Likewise.
13364
13365         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13366         symbol, change it to have default visibility.
13367         * testsuite/protected_1.cc: New file.
13368         * testsuite/protected_2.cc: New file.
13369         * testsuite/protected_3.cc: New file.
13370         * testsuite/protected_main_1.cc: New file.
13371         * testsuite/protected_main_2.cc: New file.
13372         * testsuite/protected_main_3.cc: New file.
13373         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13374         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13375         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13376         (protected_1.so): New target.
13377         (protected_1_pic.o, protected_2_pic.o): New targets.
13378         (protected_3_pic.o): New target.
13379         (check_PROGRAMS): Add protected_2.
13380         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13381         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13382         * testsuite/Makefile.in: Rebuild.
13383
13384         * options.h (DEFINE_var): Add set_user_set_##varname__.
13385         (DEFINE_bool_alias): New macro.
13386         (class General_options): Define -Bstatic using DEFINE_bool_alias
13387         rather than DEFINE_special.  Add --undefined as an alias for -z
13388         defs.
13389         * options.cc (General_options::parse_Bstatic): Remove.
13390
13391         * options.h (class General_options): Add --fatal-warnings.
13392         * main.cc (main): Implement --fatal-warnings.
13393         * errors.h (Errors::warning_count): New function.
13394
13395         * options.h (class General_options): Add -Bsymbolic-functions.
13396         * symtab.h (Symbol::is_preemptible): Check for
13397         -Bsymbolic-functions.
13398
13399 2008-05-05  Ian Lance Taylor  <iant@google.com>
13400
13401         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13402         as noVARNAME rather than no-VARNAME.
13403         (class General_options): Add option -z combreloc.
13404         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13405         get_address.
13406         (Output_reloc::sort_before) [SHT_REL]: New function.
13407         (Output_reloc::sort_before) [SHT_RELA]: New function.
13408         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13409         Sort_relocs_comparison.
13410         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13411         parameter.  Change all callers.
13412         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13413         sort_relocs parameter.  Change all callers.
13414         * output.cc (Output_reloc::get_address): New function, broken out
13415         of write_rel.
13416         (Output_reloc::write_rel): Call it.
13417         (Output_reloc::compare): New function.
13418         (Output_data_reloc_base::do_write): Optionally sort relocs.
13419
13420         * configure.ac: If targ_extra_obj is set, link it in.
13421         * configure.tgt: Initialize all variables.
13422         (x86_64*): Set targ_extra_obj and targ_extra_size.
13423         * configure: Rebuild.
13424
13425         * object.cc (Sized_relobj::include_section_group): Adjust section
13426         indexes read from group data.  Build vector to pass to
13427         layout_group.
13428         * layout.cc (Layout::layout_group): Add flags and shndxes
13429         parameters.  Remove contents parameter.  Change caller.  Update
13430         explicit instantiations.
13431         * layout.h (class Layout): Update layout_group declaration.
13432         * output.cc (Output_data_group::Output_data_group): Add flags and
13433         input_shndxes parameters.  Remove contents parameter.  Change
13434         caller.
13435         (Output_data_group::do_write): Change input_sections_ to
13436         input_shndxes_.
13437         * output.h (class Output_data_group): Update constructor
13438         declaration.  Rename input_sections_ to input_shndxes_.
13439         * testsuite/many_sections_test.cc: Add template.
13440
13441 2008-04-30  Cary Coutant  <ccoutant@google.com>
13442
13443         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13444
13445         * layout.cc (Layout::include_section): Refactored check for debug
13446         info section.
13447         (Layout::add_comdat): Add new parameters.  Change type
13448         of signature parameter.  Add object and shndx to signatures table.
13449         (Layout::find_kept_object): New function.
13450         * layout.h: Include <cstring>.
13451         (Layout::is_debug_info_section): New function.
13452         (Layout::add_comdat): Add new parameters.
13453         (Layout::find_kept_object): New function.
13454         (Layout::Kept_section): New struct.
13455         (Layout::Signatures): Change type of map range.
13456         * object.cc (Relobj::output_section_address): New function.
13457         (Sized_relobj::include_section_group): Add new parameters.  Change
13458         calls to Layout::add_comdat.  Change to build table of kept comdat
13459         groups and table mapping discarded sections to kept sections.
13460         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13461         (Sized_relobj::do_layout): Change calls to include_section_group and
13462         include_linkonce_section.
13463         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13464         value to zero when section is discarded.
13465         (Sized_relobj::map_to_kept_section): New function.
13466         * object.h (Relobj::output_section_address): New function.
13467         (Relobj::Comdat_group): New type.
13468         (Relobj::find_comdat_group): New function.
13469         (Relobj::Comdat_group_table): New type.
13470         (Relobj::Kept_comdat_section): New type.
13471         (Relobj::Kept_comdat_section_table): New type.
13472         (Relobj::add_comdat_group): New function.
13473         (Relobj::set_kept_comdat_section): New function.
13474         (Relobj::get_kept_comdat_section): New function.
13475         (Relobj::comdat_groups_): New field.
13476         (Relobj::kept_comdat_sections_): New field.
13477         (Symbol_value::input_value): Update comment.
13478         (Sized_relobj::map_to_kept_section) New function.
13479         (Sized_relobj::include_linkonce_section): Add new parameter.
13480         * target-reloc.h (Comdat_behavior): New type.
13481         (get_comdat_behavior): New function.
13482         (relocate_section): Add code to map a discarded section to the
13483         corresponding kept section when applying a relocation.
13484
13485 2008-04-30  Craig Silverstein  <csilvers@google.com>
13486
13487         * dwarf_reader.cc (next_generation_count): New static var.
13488         (Addr2line_cache_entry): New struct.
13489         (addr2line_cache): New static var.
13490         (Dwarf_line_info::one_addr2line): Added caching.
13491         (Dwarf_line_info::clear_addr2line_cache): New function.
13492         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13493         cache-size parameter.
13494         (Dwarf_line_info::one_addr2line_cache): New function.
13495         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13496         new cache-size argument to one_addr2line(), and clear cache.
13497
13498 2008-04-28  Cary Coutant  <ccoutant@google.com>
13499
13500         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13501         R_386_PC8 relocations.
13502
13503 2008-04-23  Ian Lance Taylor  <iant@google.com>
13504
13505         * object.cc (Sized_relobj::include_section_group): Check for
13506         invalid section group.
13507
13508         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13509         header size.
13510
13511         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13512         than read for file header.
13513         * archive.cc (Archive::include_member): Likewise.
13514
13515 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13516
13517         * aclocal.m4: Regenerate.
13518         * configure: Regenerate.
13519
13520 2008-04-19  Ian Lance Taylor  <iant@google.com>
13521
13522         * version.cc (version_string): Bump to 1.6.
13523
13524         * testsuite/Makefile.am (many_sections_r_test): New target.
13525         (many_sections_r_test_SOURCES): Remove.
13526         (many_sections_r_test_DEPENDENCIES): Remove.
13527         (many_sections_r_test_LDFLAGS): Remove.
13528         (many_sections_r_test_LDADD): Remove.
13529
13530         * object.cc (Sized_relobj::do_add_symbols): Always pass
13531         local_symbol_count_ to add_from_relobj.
13532
13533         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13534         every thousand variables.
13535         * testsuite/Makefile.in: Rebuild.
13536
13537         * object.cc (Xindex::initialize_symtab_xindex): New function.
13538         (Xindex::read_symtab_xindex): New function.
13539         (Xindex::sym_xindex_to_shndx): New function.
13540         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13541         available.
13542         (Sized_relobj::do_initialize_xindex): New function.
13543         (Sized_relobj::do_read_symbols): Adjust section links.
13544         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13545         parameter.  Change all callers.
13546         (Sized_relobj::include_section_group): Adjust section links and
13547         symbol section indexes.
13548         (Sized_relobj::do_layout): Adjust section links.
13549         (Sized_relobj::do_count_local_symbols): Adjust section links and
13550         symbol section indexes.
13551         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13552         ordinary and special symbols.
13553         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13554         dynsym_xindex parameters.  Change all callers.  Adjust section
13555         links.  Use SHN_XINDEX when needed.
13556         (Sized_relobj::get_symbol_location_info): Adjust section links.
13557         Don't get fooled by special symbols.
13558         * object.h (class Xindex): Define.
13559         (class Object): Add xindex_ parameter.  Declare virtual functoin
13560         do_initialize_xindex.
13561         (Object::adjust_sym_shndx): New function.
13562         (Object::set_xindex): New protected function.
13563         (class Symbol_value): Add is_ordinary_shndx_ field.
13564         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13565         (Symbol_value::value): Assert ordinary section.
13566         (Symbol_value::initialize_input_to_output_map): Likewise.
13567         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13568         Change all callers.
13569         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13570         all callers.
13571         (class Sized_relobj): Update declarations.
13572         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13573         parameter.  Change all callers.
13574         (Sized_relobj::adjust_shndx): New function.
13575         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13576         field.
13577         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13578         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13579         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13580         (Sized_dynobj::read_dynsym_section): Adjust section links.
13581         (Sized_dynobj::read_dynamic): Likewise.
13582         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13583         section links.
13584         (Sized_dynobj::do_initialize_xindex): New function.
13585         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13586         do_initialize_xindex.
13587         (Sized_dynobj::adjust_shndx): New function.
13588         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13589         dynsym_xindex_ fields.
13590         (Layout::finalize): Add a call to set_section_indexes before
13591         creating the symtab sections.
13592         (Layout::set_section_indexes): Don't do anything if the section
13593         already has a section index.
13594         (Layout::create_symtab_sections): Add shnum parameter.  Change
13595         caller.  Create .symtab_shndx section if needed.
13596         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13597         caller.
13598         (Layout::allocated_output_section_count): New function.
13599         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13600         needed.
13601         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13602         fields.  Update declarations.
13603         (Layout::symtab_xindex): New function.
13604         (Layout::dynsym_xindex): New function.
13605         (class Write_symbols_task): Add layout_ field.
13606         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13607         Change caller.
13608         * output.cc (Output_section_headers::Output_section_headers): Add
13609         shstrtab_section parameter.  Change all callers.
13610         (Output_section_headers::do_sized_write): Store overflow values
13611         for section count and section string table section index in
13612         section header zero.
13613         (Output_file_header::do_sized_write): Check for overflow of
13614         section count and section string table section index.
13615         (Output_symtab_xindex::do_write): New function.
13616         (Output_symtab_xindex::endian_do_write): New function.
13617         * output.h (class Output_section_headers): Add shstrtab_section_.
13618         Update declarations.
13619         (class Output_symtab_xindex): Define.
13620         (Output_section::has_out_shndx): New function.
13621         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13622         field.
13623         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13624         Change all callers.
13625         (Sized_symbol::init): Likewise.
13626         (Symbol::output_section): Check for ordinary symbol.
13627         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13628         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13629         callers.
13630         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13631         Change all callers.  Simplify handling of symbols from sections
13632         not included in the link.
13633         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13634         distinction.
13635         (Weak_alias_sorter::operator()): Assert that symbols are
13636         ordinary.
13637         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13638         distinction.
13639         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13640         parameters.  Change all callers.
13641         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13642         symbol distinction.  Use SHN_XINDEX when needed.
13643         (Symbol_table::write_section_symbol): Add symtab_xindex
13644         parameter.  Change all callers.
13645         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13646         SHN_XINDEX when needed.
13647         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13648         declarations.
13649         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13650         (Symbol::is_defined): Check is_ordinary.
13651         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13652         (Symbol::is_absolute, Symbol::is_common): Likewise.
13653         (class Sized_symbol): Update declarations.
13654         (class Symbol_table): Update declarations.
13655         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13656         parameters.  Change all callers.
13657         (Sized_symbol::override): Likewise.
13658         (Symbol_table::override): Likewise.
13659         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13660         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13661         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13662         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13663         to be in an ordinary section.
13664         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13665         object and is_ordinary parameters.  Change all callers.
13666         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13667         Change all callers.  Don't add undefined or non-ordinary symbols
13668         to reloc_map_.
13669         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13670         Change all callers.
13671         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13672         declarations.
13673         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13674         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13675         (Sized_relobj::relocate_sections): Likewise.
13676         * target-reloc.h (scan_relocs): Adjust section symbol index.
13677         (scan_relocatable_relocs): Likewise.
13678         * i386.cc (Scan::local): Check for ordinary symbols.
13679         * sparc.cc (Scan::local): Likewise.
13680         * x86_64.cc (Scan::local): Likewise.
13681         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13682         to symbol_section_and_value.
13683         * testsuite/many_sections_test.cc: New file.
13684         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13685         (check_PROGRAMS): Add many_sections_test.
13686         (many_sections_test_SOURCES): Define.
13687         (many_sections_test_DEPENDENCIES): Define.
13688         (many_sections_test_LDFLAGS): Define.
13689         (BUILT_SOURCES): Add many_sections_define.h.
13690         (many_sections_define.h): New target.
13691         (BUILT_SOURCES): Add many_sections_check.h.
13692         (many_sections_check.h): New target.
13693         (check_PROGRAMS): Add many_sections_r_test.
13694         (many_sections_r_test_SOURCES): Define.
13695         (many_sections_r_test_DEPENDENCIES): Define.
13696         (many_sections_r_test_LDFLAGS): Define.
13697         (many_sections_r_test_LDADD): Define.
13698         (many_sections_r_test.o): New target.
13699         * testsuite/Makefile.in: Rebuild.
13700
13701 2008-04-17  Cary Coutant  <ccoutant@google.com>
13702
13703         * errors.cc (Errors::info): New function.
13704         (gold_info): New function.
13705         * errors.h (Errors::info): New function.
13706         * gold.h (gold_info): New function.
13707         * object.cc (Input_objects::add_object): Print trace output.
13708         * options.cc (options::parse_set): New function.
13709         (General_options::parse_wrap): Deleted.
13710         (General_options::General_options): Deleted initializer.
13711         * options.h (options::String_set): New typedef.
13712         (options::parse_set): New function.
13713         (DEFINE_set): New macro.
13714         (General_options::wrap): Changed to use DEFINE_set. Changed
13715         callers of any_wrap_symbols and is_wrap_symbol.
13716         (General_options::trace, General_options::trace_symbol):
13717         New options.
13718         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13719         (General_options::wrap_symbols_): Deleted.
13720         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13721
13722 2008-04-17  David S. Miller  <davem@davemloft.net>
13723
13724         * options.cc (General_options::parse_V): New function.
13725         * options.h: Add entries for -V and -Qy.
13726
13727 2008-04-17  Ian Lance Taylor  <iant@google.com>
13728
13729         * common.cc (Symbol_table::allocate_commons): Remove options
13730         parameter.  Change caller.
13731         (Symbol_table::do_allocate_commons): Remove options parameter.
13732         Change caller.  Just call do_allocate_commons_list twice.
13733         (Symbol_table::do_allocate_commons_list): New function, broken out
13734         of do_allocate_commons.
13735         * common.h (class Allocate_commons_task): Remove options_ field.
13736         Update constructor.
13737         * symtab.cc (Symbol_table::Symbol_table): Initialize
13738         tls_commons_.
13739         (Symbol_table::add_from_object): Put TLS common symbols on
13740         tls_commons_ list.
13741         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13742         which are IN_OUTPUT_DATA.
13743         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13744         allocate_commons and do_allocate_commons declarations.  Declare
13745         do_allocate_commons_list.
13746         * gold.cc (queue_middle_tasks): Update creation of
13747         Allocate_commons_task to not pass options.
13748         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13749         (TLS_TEST_C_FLAGS): New variable.
13750         (tls_test_c_pic.o): New target.
13751         (tls_test_shared.so): Link in tls_test_c_pic.o.
13752         (tls_test_c_pic_ie.o): New target.
13753         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13754         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13755         (tls_test_c.o): New target.
13756         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13757         (tls_pic_test_LDADD): Likewise.
13758         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13759         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13760         (tls_test_c_gnu2.o): New target.
13761         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13762         tls_test_c_gnu2.o.
13763         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13764         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13765         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13766         * testsuite/tls_test.cc: Include "config.h".
13767         (t_last): Call t11_last.
13768         * testsuite/tls_test.h (t11, t11_last): Declare.
13769         * testsuite/tls_test_c.c: New file.
13770         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13771         * configure.ac: Check for OpenMP support.
13772         * configure, config.in, Makefile.in: Rebuild.
13773         * testsuite/Makefile.in: Rebuild.
13774
13775 2008-04-16  Cary Coutant  <ccoutant@google.com>
13776
13777         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13778         (Target_i386::tls_base_symbol_defined_): New field.
13779         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13780         (Target_i386::Scan::global): Likewise.
13781         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13782         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13783         (Target_x86_64::tls_base_symbol_defined_): New field.
13784         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13785         (Target_x86_64::Scan::global): Likewise.
13786
13787 2008-04-16  Cary Coutant  <ccoutant@google.com>
13788
13789         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13790         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13791         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13792         building shared libraries.
13793         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13794         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13795         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13796         * testsuite/Makefile.in: Rebuild.
13797         * testsuite/weak_undef.h: New file.
13798         * testsuite/weak_undef_file1.cc: Add extra test cases.
13799         * testsuite/weak_undef_file2.cc: Likewise.
13800         * testsuite/weak_undef_test.cc: Likewise.
13801
13802 2008-04-16  David S. Miller  <davem@davemloft.net>
13803
13804         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13805         Add issued_non_pic_error_ field.  Declare check_non_pic.
13806         (Target_sparc::Scan::check_non_pic): New function.
13807         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13808         (Target_sparc::Scan::global): Likewise.
13809
13810         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13811         * configure: Rebuild.
13812
13813         * options.h (DEFINE_enable): New macro.
13814         (new_dtags): New enable option.
13815         (initfirst, interpose, loadfltr, nodefaultlib,
13816         nodelete, nodlopen, nodump): New -z options.
13817         * layout.cc (Layout:finish_dynamic_section): If new
13818         dtags enabled, emit DT_RUNPATH.  Also, emit a
13819         DT_FLAGS_1 containing any specified -z flags.
13820
13821 2008-04-16  Ian Lance Taylor  <iant@google.com>
13822
13823         * copy-relocs.cc: New file.
13824         * copy-relocs.h: New file.
13825         * reloc.cc: Remove Copy_relocs code.
13826         * reloc.h: Likewise.
13827         * reloc-types.h (struct Reloc_types) [both versions]: Add
13828         get_reloc_addend_noerror.
13829         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13830         variants of add_global which take an addend which must be zero.
13831         * i386.cc: Include "copy-relocs.h".
13832         (class Target_i386): Change type of copy_relocs_ to variable,
13833         update initializer.
13834         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13835         Change all callers.
13836         (Target_i386::do_finalize_sections): Change handling of
13837         copy_relocs_.
13838         * sparc.cc: Include "copy-relocs.h".
13839         (class Target_sparc): Change type of copy_relocs_ to variable,
13840         update initializer.
13841         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13842         Change all callers.
13843         (Target_sparc::do_finalize_sections): Change handling of
13844         copy_relocs_.
13845         * x86_64.cc: Include "copy-relocs.h".
13846         (class Target_x86_64): Change type of copy_relocs_ to variable,
13847         update initializer.
13848         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13849         class.  Change all callers.
13850         (Target_x86_64::do_finalize_sections): Change handling of
13851         copy_relocs_.
13852         * Makefile.am (CCFILES): Add copy-relocs.cc.
13853         (HFILES): Add copy-relocs.h.
13854
13855         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13856
13857         * testsuite/script_test_4.sh: Permit leading zeroes.
13858
13859 2008-04-15  Ian Lance Taylor  <iant@google.com>
13860
13861         * script-sections.cc (Script_sections::create_segments): Use
13862         header_size_adjustment even when there is enough room for the
13863         headers.
13864         * testsuite/script_test_4.sh: New file.
13865         * testsuite/script_test_4.t: New file.
13866         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13867         (check_DATA): Add script_test_4.stdout.
13868         (MOSTLYCLEANFILES): Likewise.
13869         (script_test_4): New target.
13870         (script_test_4.stdout): New target.
13871         * testsuite/Makefile.in: Rebuild.
13872
13873         * sparc.cc: Add definitions for Output_data_plt_sparc class
13874         constants.
13875
13876 2008-04-14  David S. Miller  <davem@davemloft.net>
13877
13878         * sparc.cc: New file.
13879         * Makefile.am (TARGETSOURCES): Add sparc.cc
13880         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13881         * configure.tgt: Document targ_extra_size and
13882         targ_extra_big_endian.  Add entries for sparc-* and
13883         sparc64-*.
13884         * configure.ac: Handle targ_extra_size and
13885         targ_extra_big_endian.
13886         * Makefile.in: Rebuild.
13887         * configure: Likewise.
13888         * po/POTFILES.in: Likewise.
13889         * po/gold.pot: Likewise.
13890
13891 2008-04-14  Ian Lance Taylor  <iant@google.com>
13892
13893         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13894         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13895         in the name/type/flags to section mapping.  Don't call
13896         allocate_output_section.
13897         (Layout::choose_output_section): Change parameter from adjust_name
13898         to is_input_section.  Don't permit input sections after sections
13899         are attached to segments.  Don't call allocate_output_section.
13900         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13901         not write_enable_output_section.
13902         (Layout::make_output_section): Don't push to
13903         unattached_section_list_ nor call attach_to_segment.  Call
13904         attach_section_to_segment if sections are attached.
13905         (Layout::attach_sections_to_segments): New function.
13906         (Layout::attach_section_to_segment): New function.
13907         (Layout::attach_allocated_section_to_segment): Rename from
13908         attach_to_segment.  Remove flags parameter.
13909         (Layout::allocate_output_section): Remove function.
13910         (Layout::write_enable_output_section): Remove function.
13911         * layout.h (class Layout): Update for above changes.  Add new
13912         field sections_are_attached_.
13913         * output.h (Output_section::update_flags_for_input_section): New
13914         function.
13915         * output.cc (Output_section::add_input_section): Call
13916         update_flags_for_input_section.
13917         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13918
13919 2008-04-11  Cary Coutant  <ccoutant@google.com>
13920
13921         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13922         thought unnecessary.
13923         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13924
13925 2008-04-11  Ian Lance Taylor  <iant@google.com>
13926
13927         * output.h (class Output_section_data): Remove inline definition
13928         of set_addralign.
13929         * output.cc (Output_section_data::set_addralign): New function.
13930
13931 2008-04-11  Cary Coutant  <ccoutant@google.com>
13932
13933         Add support for TLS descriptors for i386 and x86_64.
13934         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13935         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13936         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13937         GOT_TYPE_TLS_DESC.
13938         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13939         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13940         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13941         relocations.
13942         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13943         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13944         Fix problem with initial-exec relocations.
13945         (Target_i386::Relocate::relocate_tls): Likewise.
13946         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13947         relaxation.
13948         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13949         support for section-plus-offset dynamic table entries.
13950         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13951         (Output_data_dynamic::Dynamic_entry): Add support for
13952         section-plus-offset dynamic table entries.
13953         (Output_data_dynamic::Classification): Likewise.
13954         (Output_data_dynamic::classification_): Renamed offset_.
13955         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13956         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13957         (Target_x86_64::make_plt_section): New function.
13958         (Target_x86_64::reserve_tlsdesc_entries): New function.
13959         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13960         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13961         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13962         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13963         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13964         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13965         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13966         add extra PLT entry for TLS descriptors.
13967         (Output_data_plt_x86_64::got_): New field.
13968         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13969         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13970         fields.
13971         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13972         descriptors.
13973         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13974         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13975         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13976         R_386_TLS_DESC_CALL relocations.
13977         (Target_x86_64::Scan::global): Likewise.
13978         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13979         for TLS descriptors.
13980         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13981         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13982         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13983         GD-to-IE relaxation.
13984         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13985         and TLS_DESCRIPTORS.
13986         * Makefile.in: Rebuild.
13987         * configure: Rebuild.
13988         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13989         (tls_test_shared2.so): New target.
13990         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13991         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13992         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13993         (tls_shared_gd_to_ie_test_LDADD): New variable.
13994         (tls_shared_gnu2_gd_to_ie_test): New target.
13995         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13996         New targets.
13997         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13998         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13999         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14000         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14001         (tls_shared_gnu2_test): New target.
14002         (tls_test_gnu2_shared.so): New target.
14003         (tls_shared_gnu2_test_SOURCES): New variable.
14004         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14005         (tls_shared_gnu2_test_LDFLAGS): New variable.
14006         (tls_shared_gnu2_test_LDADD): New variable.
14007         * testsuite/Makefile.in: Rebuild.
14008         * testsuite/Makefile.
14009
14010 2008-04-11  Ian Lance Taylor  <iant@google.com>
14011
14012         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14013         justsyms.t.
14014         * testsuite/Makefile.in: Rebuild.
14015
14016         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14017         long.
14018         * testsuite/script_test_2.cc (main): Adjust test.
14019
14020 2008-04-11  David S. Miller  <davem@davemloft.net>
14021             Ian Lance Taylor  <iant@google.com>
14022
14023         * options.h (General_options): Add entries for '-Y' and
14024         '-relax'.
14025         * options.cc (General_options:finalize): If -Y was used, add those
14026         entries to the library path instead of the default "/lib" and
14027         "/usr/lib".
14028
14029 2008-04-11  David S. Miller  <davem@davemloft.net>
14030
14031         * testsuite/justsyms.t: Start at 0x100.
14032         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14033         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14034         long.
14035         * testsuite/script_test_2.cc: Adjust string and section length
14036         checks.
14037
14038 2008-04-09  Ian Lance Taylor  <iant@google.com>
14039
14040         PR gold/5996
14041         * script-sections.cc (Sections_element::allocate_to_segment): Add
14042         orphan parameter.
14043         (Output_section_definition::allocate_to_segment): Likewise.
14044         (Orphan_output_section::allocate_to_segment): Likewise.
14045         (Script_sections::attach_sections_using_phdrs_clause): Don't
14046         propagate non-PT_LOAD segments to orphan sections.
14047         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14048         readelf rather than objdump.
14049         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14050         .interp section and PT_INTERP segment are the same size.
14051         * testsuite/Makefile.in: Rebuild.
14052
14053         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14054         aliases for symbols defined in the same object.
14055         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14056         (weak_alias_test_SOURCES): New variable.
14057         (weak_alias_test_DEPENDENCIES): New variable.
14058         (weak_alias_test_LDFLAGS): New variable.
14059         (weak_alias_test_LDADD): New variable.
14060         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14061         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14062         (weak_alias_test_3.o): New target.
14063         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14064         * testsuite/weak_alias_test_main.cc: New file.
14065         * testsuite/weak_alias_test_1.cc: New file.
14066         * testsuite/weak_alias_test_2.cc: New file.
14067         * testsuite/weak_alias_test_3.cc: New file.
14068
14069 2008-04-08  Ian Lance Taylor  <iant@google.com>
14070
14071         * options.h (class General_options): Add --noinhibit-exec option.
14072         * main.cc (main): Check --noinhibit-exec.
14073
14074         * options.h (class General_options): Define --wrap as a special
14075         option.  Add wrap_symbols_ field.
14076         (General_options::any_wrap_symbols): New function.
14077         (General_options::is_wrap_symbol): New function.
14078         * options.cc (General_options::parse_wrap): New function.
14079         (General_options::General_options): Initialize wrap_symbols_.
14080         * symtab.cc (Symbol_table::wrap_symbol): New function.
14081         (Symbol_table::add_from_object): Handle --wrap.
14082         * symtab.h (class Symbol_table): Declare wrap_symbol.
14083         * target.h (Target::wrap_char): New function.
14084         (Target::Target_info): Add wrap_char field.
14085         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14086         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14087         * testsuite/testfile.cc (Target_test::test_target_info):
14088         Likewise.
14089
14090         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14091         there is one.
14092
14093         * layout.h (class Layout): Add added_eh_frame_data_ field.
14094         * layout.cc (Layout::Layout): Initialize new field.
14095         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14096         output section until we find a section we merged successfully.
14097         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14098         that the size be non-zero.
14099
14100         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14101         qualifier.
14102
14103 2008-04-08  Craig Silverstein  <csilvers@google.com>
14104
14105         * configure.ac: Export new conditional variable HAVE_ZLIB.
14106         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14107         on HAVE_ZLIB.
14108         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14109         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14110
14111 2008-04-07  Ian Lance Taylor  <iant@google.com>
14112
14113         * version.cc (version_string): Set to "1.5".
14114
14115         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14116         Add issued_non_pic_error_ field.  Declare check_non_pic.
14117         (Target_x86_64::Scan::check_non_pic): New function.
14118         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14119         (Target_x86_64::Scan::global): Likewise.
14120
14121         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14122         addend parameter.  Change caller.  Handle merge sections.
14123         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14124         Address to Addend.  Don't add in the result of
14125         local_section_offset, pass down the addend and use the returned
14126         value.
14127         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14128         Update declarations of local_section_offset and symbol_value.
14129         * testsuite/two_file_test_1.cc (t18): New function.
14130         * testsuite/two_file_test_2.cc (f18): New function.
14131         * testsuite/two_file_test_main.cc (main): Call t18.
14132         * testsuite/two_file_test.h (t18, f18): Declare.
14133
14134         * configure.ac: Don't test for objdump, c++filt, or readelf.
14135         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14136         conditionals.
14137         (TEST_READELF): New variable.
14138         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14139         (check_PROGRAMS): Add two_file_strip_test.
14140         (two_file_strip_test): New target.
14141         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14142         (two_file_same_shared_strip_test_SOURCES): New variable.
14143         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14144         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14145         (two_file_same_shared_strip_test_LDADD): New variable.
14146         (two_file_shared_strip.so): New target.
14147         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14148         (ver_test_5.syms, ver_test_7.syms): Likewise.
14149         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14150         (strip_test_3.stdout): Use TEST_OBJDUMP.
14151         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14152
14153 2008-04-04  Cary Coutant  <ccoutant@google.com>
14154
14155         * symtab.h (Symbol::is_weak_undefined): New function.
14156         (Symbol::is_strong_undefined): New function.
14157         (Symbol::is_absolute): New function.
14158         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14159         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14160         absolute symbols.
14161         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14162         (weak_undef_test): New target.
14163         * testsuite/Makefile.in: Rebuild.
14164         * testsuite/weak_undef_file1.cc: New file.
14165         * testsuite/weak_undef_file2.cc: New file.
14166         * testsuite/weak_undef_test.cc: New file.
14167
14168 2008-04-03  Craig Silverstein  <csilvers@google.com>
14169
14170         * compressed_output.h (class Output_compressed_section): Use
14171         unsigned buffer.
14172         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14173         add zlib header.
14174         (zlib_compressed_suffix): Removed.
14175         (Output_compressed_section::set_final_data_size): Use unsigned
14176         buffers.
14177         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14178         Fix linker invocation.
14179         (flagstest_o_specialfile_and_compress_debug_sections):
14180         Likewise.
14181         * testsuite/Makefile.in: Regenerated.
14182
14183 2008-04-02  David S. Miller  <davem@davemloft.net>
14184
14185         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14186         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14187
14188 2008-04-02  Craig Silverstein  <csilvers@google.com>
14189
14190         * TODO: New file.
14191
14192 2008-04-02  Ian Lance Taylor  <iant@google.com>
14193
14194         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14195         parameters.  Update for new key type to views_.  Change all
14196         callers.
14197         (File_read::read): Adjust for byteshift in returned view.
14198         (File_read::add_view): New function, broken out of
14199         find_and_make_view.
14200         (File_read::make_view): New function, broken out of
14201         find_and_make_view.
14202         (File_read::find_or_make_view): Add offset and aligned
14203         parameters.  Rewrite accordingly.  Change all callers.
14204         (File_read::get_view): Add offset and aligned parameters.  Adjust
14205         for byteshift in return value.
14206         (File_read::get_lasting_view): Likewise.
14207         * fileread.h (class File_read): Update declarations.
14208         (class File_read::View): Add byteshift_ field.  Add byteshift to
14209         constructor.  Add byteshift method.
14210         * archive.h (Archive::clear_uncached_views): New function.
14211         (Archive::get_view): Add aligned parameter.  Change all callers.
14212         * object.h (Object::get_view): Add aligned parameter.  Change all
14213         callers.
14214         (Object::get_lasting_view): Likewise.
14215
14216         * fileread.cc (File_read::release): Don't call clear_views if
14217         there are multiple objects.
14218         * fileread.h (File_read::clear_uncached_views): New function.
14219         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14220         on the archive.
14221
14222 2008-03-31  Cary Coutant  <ccoutant@google.com>
14223
14224         Add thin archive support.
14225         * archive.cc (Archive::armagt): New const.
14226         (Archive::setup): Remove task parameter and calls to unlock.
14227         (Archive::unlock_nested_archives): New function.
14228         (Archive::read_header): Add nested_off parameter. Change
14229         all callers.
14230         (Archive::interpret_header): Likewise.
14231         (Archive::include_all_members): Change to handle thin
14232         archives.
14233         (Archive::include_member): Likewise.
14234         * archive.h (Archive::Archive): Add new parameters and
14235         initializers.
14236         (Archive::armagt): New const.
14237         (Archive::setup): Remove task parameter.
14238         (Archive::unlock_nested_archives): New function.
14239         (Archive::read_header): Add nested_off parameter.
14240         (Archive::interpret_header): Likewise.
14241         (Archive::Nested_archive_table): New typedef.
14242         (Archive::is_thin_archive_): New field.
14243         (Archive::nested_archives_): New field.
14244         (Archive::options_): New field.
14245         (Archive::dirpath_): New field.
14246         (Archive::task_): New field.
14247         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14248         for thin archives.  Pass additional parameters to
14249         Archive::Archive.  Unlock the archive file after calling
14250         Archive::setup.
14251
14252 2008-03-29  Ian Lance Taylor  <iant@google.com>
14253
14254         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14255         version symbol to be local.
14256         * testsuite/ver_test_4.sh: New file.
14257         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14258         (check_DATA): Add ver_test_4.syms.
14259         (ver_test_4.syms): New target.
14260         * testsuite/Makefile.in: Rebuild.
14261
14262         * output.cc
14263         (Output_section::Input_section_sort_entry::has_priority): New
14264         function.
14265         (Output_section::Input_section_sort_entry::match_file_name): New
14266         function.
14267         (Output_section::Input_section_sort_entry::match_section_name):
14268         Remove.
14269         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14270         Remove.
14271         (Output_section::Input_section_sort_entry::match_section_file):
14272         Remove.
14273         (Output_section::Input_section_sort_compare::operator()): Rewrite
14274         using new Input_section_sort_entry functions.  Sort crtbegin and
14275         crtend first.  Sort sections with no priority before sections with
14276         a priority.
14277         * testsuite/initpri1.c (d3): Check j != 4.
14278         (cd5): New constructor/destructor function.
14279         (main): Check j != 2.
14280
14281         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14282         new symbol when resolving, don't call set_is_default.
14283         * testsuite/ver_test_7.cc: New file.
14284         * testsuite/ver_test_7.sh: New file.
14285         * testsuite/Makefile.am (ver_test_7.so): New target.
14286         (ver_test_7.o): New target.
14287         (check_SCRIPTS): Add ver_test_7.sh.
14288         (check_DATA): Add ver_test_7.syms.
14289         (ver_test_7.syms): New target.
14290
14291 2008-03-28  Ian Lance Taylor  <iant@google.com>
14292
14293         * layout.cc (Layout::layout): If we see an input section with a
14294         name that needs sorting, set the must_sort flag for the output
14295         section.
14296         (Layout::make_output_section): If the name of the output section
14297         indicates that it might require sorting, set the may_sort flag.
14298         * output.h (Output_section::may_sort_attached_input_sections): New
14299         function.
14300         (Output_section::set_may_sort_attached_input_sections): New
14301         function.
14302         (Output_section::must_sort_attached_input_sections): New
14303         function.
14304         (Output_section::set_must_sort_attached_input_sections): New
14305         function.
14306         (class Output_section): Declare Input_section_sort_entry.  Define
14307         Input_section_sort_compare.  Declare
14308         sort_attached_input_sections.  Add new fields:
14309         may_sort_attached_input_sections_,
14310         must_sort_attached_input_sections_,
14311         attached_input_sections_are_sorted_.
14312         * output.cc (Output_section::Output_section): Initialize new
14313         fields.
14314         (Output_section::add_input_section): Add an entry to
14315         input_sections_ if may_sort or must_sort are true.
14316         (Output_section::set_final_data_size): Call
14317         sort_attached_input_sections if necessary.
14318         (Output_section::Input_section_sort_entry): Define new class.
14319         (Output_section::Input_section_sort_compare::operator()): New
14320         function.
14321         (Output_section::sort_attached_input_sections): New function.
14322         * configure.ac: Check whether the compiler supports constructor
14323         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14324         * testsuite/initpri1.c: New file.
14325         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14326         CONSTRUCTOR_PRIORITY.
14327         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14328         (initpri1_LDFLAGS): New variable.
14329         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14330
14331 2008-03-27  Ian Lance Taylor  <iant@google.com>
14332
14333         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14334         * testsuite/common_test_1.c: New file.
14335         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14336         (common_test_1_SOURCES): New variable.
14337         (common_test_1_DEPENDENCIES): New variable.
14338         (common_test_1_LDFLAGS): New variable.
14339
14340         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14341         and commons_ correctly when NAME/VERSION does not override
14342         NAME/NULL.
14343         * testsuite/ver_test_6.c: New file.
14344         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14345         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14346         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14347
14348 2008-03-26  Ian Lance Taylor  <iant@google.com>
14349
14350         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14351         of an undefined symbol from a version script.
14352         * testsuite/Makefile.am (ver_test_5.so): New target.
14353         (ver_test_5.o): New target.
14354         (check_SCRIPTS): Add ver_test_5.sh.
14355         (check_DATA): Add ver_test_5.syms.
14356         (ver_test_5.syms): New target.
14357         * testsuite/ver_test_5.cc: New file.
14358         * testsuite/ver_test_5.script: New file.
14359         * testsuite/ver_test_5.sh: New file.
14360         * Makefile.in, testsuite/Makefile.in: Rebuild.
14361
14362         PR gold/5986
14363         Fix problems building gold with gcc 4.3.0.
14364         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14365         (gold_error_at_location, gold_warning_at_location): Use it.
14366         * configure.ac: Check whether we can compile and use a template
14367         function with a printf attribute.
14368         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14369         when jumping over bytes.
14370         * object.cc: Instantiate Object::read_section_data.
14371         * debug.h: Include <cstring>
14372         * dwarf_reader.cc: Include <algorithm>
14373         * main.cc: Include <cstring>.
14374         * options.cc: Include <cstring>.
14375         * output.cc: Include <cstring>.
14376         * script.cc: Include <cstring>.
14377         * script.h: Include <string>.
14378         * symtab.cc: Include <cstring> and <algorithm>.
14379         * target-select.cc: Include <cstring>.
14380         * version.cc: Include <string>.
14381         * testsuite/testmain.cc: Include <cstdlib>.
14382         * configure, config.in: Rebuild.
14383
14384 2008-03-25  Ian Lance Taylor  <iant@google.com>
14385
14386         * options.cc: Include "../bfd/bfdver.h".
14387         (options::help): Print bug reporting address.
14388
14389         * version.cc (print_version): Adjust output for current value of
14390         BFD_VERSION_STRING.
14391
14392         * NEWS: New file.
14393
14394         * options.cc (options::help): Print list of supported targets.
14395         * target-select.h: Include <vector>.
14396         (class Target_selector): Make machine_, size_, and is_big_endian_
14397         fields const.  Add bfd_name_ and instantiated_target_ fields.
14398         (Target_selector::Target_selector): Add bfd_name parameter.
14399         (Target_selector::recognize): Make non-virtual, call
14400         do_recognize.
14401         (Target_selector::recognize_by_name): Make non-virtual, call
14402         do_recognize_by_name.
14403         (Target_selector::supported_names): New function.
14404         (Target_selector::bfd_name): New function.
14405         (Target_selector::do_instantiate_target): New pure virtual
14406         function.
14407         (Target_selector::do_recognize): New virtual function.
14408         (Target_selector::do_recognize_by_name): New virtual function.
14409         (Target_selector::instantiate_target): New private function.
14410         (supported_target_names): Declare.
14411         * target-select.cc (Target_selector::Target_selector): Update for
14412         new parameter and fields.
14413         (select_target_by_name): Check that the name matches before
14414         calling recognize_by_name.
14415         (supported_target_names): New function.
14416         * i386.cc (class Target_selector_i386): Update Target_selector
14417         constructor call.  Remove recognize and recognize_by_name.  Add
14418         do_instantiate_target.
14419         * x86_64.cc (class Target_selector_x86_64): Likewise.
14420         * testsuite/testfile.cc (class Target_selector_test): Update for
14421         changes to Target_selector.
14422
14423         * README: Rewrite, with some notes on unsupported features.
14424
14425 2008-03-24  Cary Coutant  <ccoutant@google.com>
14426
14427         * i386.cc (Target_i386::Got_type): New enum declaration.
14428         (Target_i386::Scan::local): Updated callers of Output_data_got
14429         member functions.
14430         (Target_i386::Scan::global): Likewise.
14431         (Target_i386::Relocate::relocate): Likewise.
14432         (Target_i386::Relocate::relocate_tls): Likewise.
14433         * object.h (Got_offset_list): New class.
14434         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14435         (Sized_relobj::local_got_offset): Likewise.
14436         (Sized_relobj::set_local_got_offset): Likewise.
14437         (Sized_relobj::local_has_tls_got_offset): Removed.
14438         (Sized_relobj::local_tls_got_offset): Removed.
14439         (Sized_relobj::set_local_tls_got_offset): Removed.
14440         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14441         * output.cc (Output_data_got::add_global): Added got_type parameter.
14442         (Output_data_got::add_global_with_rel): Likewise.
14443         (Output_data_got::add_global_with_rela): Likewise.
14444         (Output_data_got::add_global_pair_with_rel): New function.
14445         (Output_data_got::add_global_pair_with_rela): New function.
14446         (Output_data_got::add_local): Added got_type parameter.
14447         (Output_data_got::add_local_with_rel): Likewise.
14448         (Output_data_got::add_local_with_rela): Likewise.
14449         (Output_data_got::add_local_pair_with_rel): New function.
14450         (Output_data_got::add_local_pair_with_rela): New function.
14451         (Output_data_got::add_global_tls): Removed.
14452         (Output_data_got::add_global_tls_with_rel): Removed.
14453         (Output_data_got::add_global_tls_with_rela): Removed.
14454         (Output_data_got::add_local_tls): Removed.
14455         (Output_data_got::add_local_tls_with_rel): Removed.
14456         (Output_data_got::add_local_tls_with_rela): Removed.
14457         * output.h (Output_data_got::add_global): Added got_type parameter.
14458         (Output_data_got::add_global_with_rel): Likewise.
14459         (Output_data_got::add_global_with_rela): Likewise.
14460         (Output_data_got::add_global_pair_with_rel): New function.
14461         (Output_data_got::add_global_pair_with_rela): New function.
14462         (Output_data_got::add_local): Added got_type parameter.
14463         (Output_data_got::add_local_with_rel): Likewise.
14464         (Output_data_got::add_local_with_rela): Likewise.
14465         (Output_data_got::add_local_pair_with_rel): New function.
14466         (Output_data_got::add_local_pair_with_rela): New function.
14467         (Output_data_got::add_global_tls): Removed.
14468         (Output_data_got::add_global_tls_with_rel): Removed.
14469         (Output_data_got::add_global_tls_with_rela): Removed.
14470         (Output_data_got::add_local_tls): Removed.
14471         (Output_data_got::add_local_tls_with_rel): Removed.
14472         (Output_data_got::add_local_tls_with_rela): Removed.
14473         * resolve.cc (Symbol::override_base_with_special): Removed
14474         reference to has_got_offset_ field.
14475         * symtab.cc (Symbol::init_fields): Replaced initialization
14476         of got_offset_ with got_offsets_.  Removed initialization
14477         of has_got_offset_
14478         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14479         (Symbol::got_offset): Likewise.
14480         (Symbol::set_got_offset): Likewise.
14481         (Symbol::has_tls_got_offset): Removed.
14482         (Symbol::tls_got_offset): Removed.
14483         (Symbol::set_tls_got_offset): Removed.
14484         (Symbol::got_offset_): Removed.
14485         (Symbol::tls_mod_got_offset_): Removed.
14486         (Symbol::tls_pair_got_offset_): Removed.
14487         (Symbol::got_offsets_): New field.
14488         (Symbol::has_got_offset): Removed.
14489         (Symbol::has_tls_mod_got_offset): Removed.
14490         (Symbol::has_tls_pair_got_offset): Removed.
14491         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14492         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14493         member functions.
14494         (Target_x86_64::Scan::global): Likewise.
14495         (Target_x86_64::Relocate::relocate): Likewise.
14496         (Target_x86_64::Relocate::relocate_tls): Likewise.
14497
14498 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14499
14500         * yyscript.y: Fix spelling error in comment.
14501
14502 2008-03-24  Ian Lance Taylor  <iant@google.com>
14503
14504         * options.h (class General_options): Define build_id option.
14505         * layout.h (class Layout): Declare write_build_id, create_note,
14506         create_build_id.  Add build_id_note_ member.
14507         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14508         "libiberty.h", "md5.h", "sha1.h".
14509         (Layout::Layout): Initialize eh_frame_data_,
14510         eh_frame_hdr_section_, and build_id_note_.
14511         (Layout::finalize): Call create_build_id.
14512         (Layout::create_note): New function, broken out of
14513         Layout::create_gold_note.
14514         (Layout::create_gold_note): Call create_note.
14515         (Layout::create_build_id): New function.
14516         (Layout::write_build_id): New function.
14517         (Close_task_runner::run): Call write_build_id.
14518
14519         * x86_64.cc: Correct license to GPLv3.
14520
14521 2008-03-23  Ian Lance Taylor  <iant@google.com>
14522
14523         * options.cc: Include "demangle.h".
14524         (parse_optional_string): New function.
14525         (parse_long_option): Handle takes_optional_argument.
14526         (parse_short_option): Update dash_z initializer.  Handle
14527         takes_optional_argument.
14528         (General_options::General_options): Initialize do_demangle_.
14529         (General_options::finalize): Set do_demangle_.  Handle demangling
14530         style.
14531         * options.h (parse_optional_string): Declare.
14532         (struct One_option): Add optional_arg field.  Update constructor.
14533         Update call constructor calls.  Add takes_optional_argument
14534         function.
14535         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14536         (DEFINE_optional_string): Define.
14537         (General_options::demangle): Change from DEFINE_bool to
14538         DEFINE_optional_string.
14539         (General_options::no_demangle): New function.
14540         (General_options::do_demangle): New function.
14541         (General_options::set_do_demangle): New function.
14542         (General_options::execstack_status_): Move definition to end of
14543         class definition.
14544         (General_options::static_): Likewise.
14545         (General_options::do_demangle_): New field.
14546         * object.cc (big_endian>::get_symbol_location_info): Call
14547         Options::do_demangle, not Options::demangle.
14548         * symtab.cc (demangle): Likewise.
14549
14550 2008-03-22  Ian Lance Taylor  <iant@google.com>
14551
14552         * gold.h: Include <cstddef> and <sys/types.h>
14553         * options.h: Include <cstring>.
14554
14555 2008-03-21  Ian Lance Taylor  <iant@google.com>
14556
14557         * Added source code to GNU binutils.
14558 \f
14559 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14560
14561 Copying and distribution of this file, with or without modification,
14562 are permitted in any medium without royalty provided the copyright
14563 notice and this notice are preserved.
14564
14565 Local Variables:
14566 mode: change-log
14567 left-margin: 8
14568 fill-column: 74
14569 version-control: never
14570 End: