* gold.cc (queue_middle_tasks): Move detect_odr_violations..
[external/binutils.git] / gold / ChangeLog
1 2013-03-11  Alan Modra  <amodra@gmail.com>
2
3         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
4         * layout.cc (Layout_task_runner::run): ..to here.
5         * symtab.h (struct Symbol_location): Extract from..
6         (class Symbol_table): ..here.
7         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
8         * target.h (class Target): Add function_location and
9         do_function_location functions.
10         (class Sized_target): Add do_function_location.
11         * object.h (class Sized_relobj_file): Move find_shdr..
12         (class Object): ..to here.
13         * object.cc: Likewise.  Update to suit.  Instantiate.
14         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
15         * powerpc.cc (class Powerpc_dynobj): New.
16         (Target_powerpc::do_function_location): New function.
17         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
18         (Powerpc_dynobj::do_read_symbols): New function.
19         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
20
21 2013-03-08  Ian Lance Taylor  <iant@google.com>
22
23         * options.cc (General_options::string_to_object_format): Accept
24         "default".
25
26 2013-03-08  Alan Modra  <amodra@gmail.com>
27
28         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
29         pointer to Post_fde.
30         (struct Post_fde): Move definition to here..
31         * ehframe.cc (struct Post_fde): ..from here.
32         (Cie::write): Don't alloc Post_fde.
33         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
34
35 2013-03-07  Alan Modra  <amodra@gmail.com>
36
37         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
38         relocation referencing .LC0.
39         * testsuite/discard_locals_test.sh: Remove FIXMEs.
40
41 2013-03-07  Alan Modra  <amodra@gmail.com>
42
43         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
44         always_inline.  Add assembly for powerpc to avoid GOT.
45
46 2013-03-07  Alan Modra  <amodra@gmail.com>
47
48         * testsuite/script_test_10.sh: Don't test .bss section
49         header number.
50
51 2013-03-06  Alan Modra  <amodra@gmail.com>
52
53         * powerpc.cc (class Powerpc_relobj): Move some member functions.
54         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
55         all callers.  Handle folded sections.
56         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
57         to Powerpc_relobj.
58         (Global_symbol_visitor_opd::operator()): Likewise.
59
60 2013-03-04  Alan Modra  <amodra@gmail.com>
61
62         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
63         * testsuite/Makefile.in: Regenerate.
64
65 2013-03-01  Cary Coutant  <ccoutant@google.com>
66
67         Add dwp support for v2 DWARF package file format.
68         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
69         tu_length parameter.  Adjust all callers.
70         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
71         * dwp.cc: Include dwarf.h.
72         (Section_bounds): New struct type.
73         (Unit_set): New struct type.
74         (Dwo_file::Dwo_file): Initialize new data member.
75         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
76         Combine and rename to...
77         (Dwo_file::read_unit_index): ...this.
78         (Dwo_file::sized_read_compunit_index)
79         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
80         (Dwo_file::sized_read_unit_index): ...this.
81         (Dwo_file::copy_section): Remove section_name, is_str_offsets
82         parameters; add section_id parameter.
83         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
84         (Dwo_file::add_unit_set): ...this.
85         (Dwo_file::shndx_map_): Remove.
86         (Dwo_file::sect_offsets_): New data member.
87         (Dwp_output_file::Dwp_output_file): Initialize new data members.
88         (Dwp_output_file::add_section): Rename to...
89         (Dwp_output_file::add_contribution): ...this.
90         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
91         (Dwp_output_file::add_tu_set): Likewise.
92         (Dwp_output_file::Contribution): New type.
93         (Dwp_output_file::Section::contributions): New data member.
94         (Dwp_output_file::Cu_or_tu_set): Remove.
95         (Dwp_output_file::Section::Section): New ctor.
96         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
97         (Dwp_output_file::Dwp_index::Section_table): New type.
98         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
99         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
100         parameter.
101         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
102         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
103         (Dwp_output_file::Dwp_index::section_table): New member function.
104         (Dwp_output_file::Dwp_index::section_table_end): New member function.
105         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
106         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
107         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
108         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
109         (Dwp_output_file::Dwp_index::section_table_): New data member.
110         (Dwp_output_file::Dwp_index::section_mask_): New data member.
111         (Dwp_output_file::add_output_section): New member function.
112         (Dwp_output_file::write_new_section): New member function.
113         (Dwp_output_file::write_contributions): New member function.
114         (Dwp_output_file::section_id_map_): New data member.
115         (class Dwo_id_info_reader): Remove.
116         (class Unit_reader): New class.
117         (get_dwarf_section_name): New function.
118         (Dwo_file::read_executable): Adjust initializations of class data.
119         (Dwo_file::read): Add support for v2 package file format.
120         (Dwo_file::read_unit_index): Likewise.
121         (Dwo_file::sized_read_unit_index): Likewise.
122         (Dwo_file::copy_section): Likewise.
123         (Dwo_file::add_unit_set): Likewise.
124         (Dwp_output_file::add_output_section): Likewise.
125         (Dwp_output_file::add_contribution): Likewise.
126         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
127         for empty slot.
128         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
129         file format.
130         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
131         slot.
132         (Dwp_output_file::initialize): Remove unused function.
133         (Dwp_output_file::finalize): Add support for v2 package file format.
134         (Dwp_output_file::write_index): Likewise.
135         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
136         function prototype.
137
138 2013-03-01  Cary Coutant  <ccoutant@google.com>
139
140         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
141         function into class definition in header file.
142         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
143         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
144         New function.
145         (Dwarf_info_reader::check_buffer): Move here from .cc file.
146
147 2013-02-28  Alan Modra  <amodra@gmail.com>
148
149         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
150         * target.cc (Target::do_plt_fde_location): New function.
151         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
152         accessor function, and constructor param.
153         (struct Post_fde, Post_fdes): Declare.
154         (Cie::write): Add post_fdes param.
155         * ehframe.cc (Fde::write): Use plt_fde_location.
156         (struct Post_fde): Define.
157         (Cie::write): Stash FDEs added post merge mapping.
158         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
159         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
160         (Eh_frame::do_sized_write): Arrange to write post map FDES after
161         other FDEs.
162         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
163         (Target_powerpc::has_glink): New function.
164         (Target_powerpc::do_relax): Add eh_frame info for stubs.
165         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
166         glink_eh_frame_fde_32, default_fde): New data.
167         (Stub_table::eh_frame_added_): New var.
168         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
169         Make const.
170         (Stub_table::add_eh_frame): New function.
171         (Output_data_glink::add_eh_frame): New function.
172         (Target_powerpc::make_glink_section): Call add_eh_frame.
173
174 2013-02-15  Ian Lance Taylor  <iant@google.com>
175
176         * options.h (DEFINE_uint64_alias): Define.
177         (class General_options): Add -Ttext-segment as an alias for
178         -Ttext.
179
180 2013-02-15  Alan Modra  <amodra@gmail.com>
181
182         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
183         (Stub_table::do_write): ..here, two places.
184         (Stub_table::plt_call_size): Use it here too.
185
186 2013-02-11  Ian Lance Taylor  <iant@google.com>
187
188         * descriptors.cc (Descriptors::close_all): New function.
189         * descriptors.h (class Descriptors): Declare close_all.
190         (close_all_descriptors): New inline function.
191         * plugin.cc: Include "descriptors.h".
192         (Plugin_manager::cleanup): Call close_all_descriptors.
193
194 2013-02-06  Alan Modra  <amodra@gmail.com>
195
196         * README: Update coding style link.
197
198 2013-01-28  Cary Coutant  <ccoutant@google.com>
199
200         * dwp.cc (File_list): New typedef.
201         (Dwo_name_info_reader): New class.
202         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
203         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
204         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
205         (Dwo_file::read_executable): New function.
206         (Dwo_file::read): Move common setup code to ...
207         (Dwo_file::make_object): ... here.
208         (dwp_options): Add --exec/-e.
209         (usage): Likewise.
210         (main): Likewise.
211
212 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
213
214         * layout.cc (Layout::layout): Check for option text_reorder.
215         (Layout::make_output_section): Ditto.
216         * options.h (text_reorder): New option.
217         * output.cc (Input_section_sort_compare): Remove special ordering
218         of section names.
219         (Output_section::
220          Input_section_sort_section_name_special_ordering_compare::
221          operator()): New function.
222         (Output_section::sort_attached_input_sections): Use new sort function
223         for .text.
224         * output.h (Input_section_sort_section_name_special_ordering_compare):
225         New struct.
226         * testsuite/Makefile.am (text_section_grouping): Test option
227         --no-text-reorder
228         * testsuite/Makefile.in: Regenerate.
229         * testsuite/text_section_grouping.sh: Check order of functions without
230         default text reordering.
231
232 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
233
234         * options.h (General_options): Change default to true for new_dtags.
235
236 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
237
238         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
239         when enable_new_dtags is false.  Only add DT_RUNPATH when
240         enable_new_dtags is true.
241
242 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
243
244         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
245         used in declaration and definition consistent.
246         (Target_powerpc::symval_for_branch): Ditto.
247
248 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
249
250         * testsuite/plugin_final_layout.cc: Fix comment.
251
252 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
253
254         * layout.cc (Layout::layout): Do not do default sorting for
255         text sections when section ordering is specified.
256         (make_output_section): Ditto.
257         * testsuite/plugin_final_layout.cc: Name the function sections
258         to catch reordering issues.
259
260 2013-01-15  Alan Modra  <amodra@gmail.com>
261
262         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
263         plt-thread-safe.
264
265 2013-01-15  Alan Modra  <amodra@gmail.com>
266
267         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
268         * testsuite/Makefile.in: Regenerate.
269
270 2013-01-14  Alan Modra  <amodra@gmail.com>
271
272         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
273         * testsuite/Makefile.in: Regenerate.
274
275 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
276
277         PR bfd/14430
278         Fix mingw gold build with plugins enabled
279         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
280         * configure.ac: Export DLOPEN_LIBS and add headers check.
281         * plugin.cc: Handle non-dlfcn case.
282         * Makefile.in: Regenerate.
283         * config.in: Regenerate.
284         * configure: Regenerate.
285         * testsuite/Makefile.in: Regenerate.
286
287 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
288
289         * output.h (sort_attached_input_sections): Change to be public.
290         * script-sections.cc
291         (Output_section_definition::set_section_addresses): Sort
292         attached input sections according to section order before linker
293         script assigns section addresses.
294         (Orphan_output_section::set_section_addresses): Sort
295         attached input sections according to section order before linker
296         script assigns section addresses.
297         * Makefile.am (final_layout.sh): Use a simple linker script to
298         check if section ordering still works.
299         * Makefile.in: Regenerate.
300
301 2013-01-09  Ben Cheng  <bccheng@google.com>
302
303         * arm.cc (Target_arm::attributes_accept_div): New function.
304         (Target_arm::attributes_forbid_div): New function.
305         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
306         attribute using the same new functions as what bfd/elf32_arm.c
307         does.
308
309 2013-01-07  Cary Coutant  <ccoutant@google.com>
310
311         PR gold/14993
312         * output.cc (Output_section::add_input_section): For incremental
313         updates, don't track input sections that are allocated from patch
314         space.
315
316 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
317             Ian Lance Taylor  <iant@google.com>
318
319         PR gold/14897
320         * configure.ac (--enable-ld): Removed.
321         (install_as_default): Set to yes only for --enable-gold=default
322         or --disable-ld.
323         * configure: Regenerated.
324
325 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
326
327         * options.h (General_options): Add -fuse-ld= for GCC linker
328         option compatibility.
329
330 2013-01-04  Cary Coutant  <ccoutant@google.com>
331
332         * configure.ac: Fix typo restoring CXXFLAGS.
333         * configure: Regenerate.
334
335 2013-01-04  Cary Coutant  <ccoutant@google.com>
336
337         * testsuite/Makefile.am (CXXLINK_S): New macro.
338         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
339         * testsuite/Makefile.in: Regenerate.
340
341 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
342
343         * version.cc (print_version): Update copyright year to 2013.
344
345 2012-12-20  Ian Lance Taylor  <iant@google.com>
346
347         * layout.cc (Layout::special_ordering_of_input_section): New
348         function.
349         (Layout::layout): If input section requires special ordering, must
350         sort input sections.
351         (Layout::make_output_section): May sort .text input sections.
352         (Layout::is_section_name_prefix_grouped): Remove.
353         * layout.h (class Layout): Declare
354         special_ordering_of_input_section.  Don't declare
355         is_section_name_prefix_grouped.
356         * output.cc (Output_section::add_input_section): Revert last
357         change.
358         (Output_section::Input_section_sort::match_file_name): Don't crash
359         if called on output section data.
360         (Output_section::Input_section_sort_compare): Sort based on
361         special ordering.
362         (Output_section::Input_section_sort_section_order_index_compare):
363         Revert last patch.
364         (Output_section::sort_attached_input_sections): Likewise.
365
366 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
367
368         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
369         * layout.h (Layout::is_section_name_prefix_grouped): New function.
370         * output.cc (Output_section::add_input_section): Check if section
371         name contains special prefix.  Keep input sections to sort such
372         sections.
373         (Output_section::Input_section_sort_section_order_index_compare
374          ::operator()): Group sections according to prefixes.
375         (Output_section::sort_attached_input_sections): Add condition to
376         Input_section_entry constructor call.
377         * testsuite/Makefile.am (text_section_grouping): New test.
378         * testsuite/Makefile.in: Regenerate.
379         * testsuite/text_section_grouping.cc: New file.
380         * testsuite/text_section_grouping.sh: New file.
381
382 2012-12-17  Nick Clifton  <nickc@redhat.com>
383
384         * Makefile.am: Add copyright notice.
385         * NEWS: Likewise.
386         * README: Likewise.
387         * configure.ac: Likewise.
388         * ftruncate.c: Likewise.
389         * Makefile.in: Regenerate.
390
391 2012-12-14  Cary Coutant  <ccoutant@google.com>
392
393         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
394         --no-as-needed flag.
395         (exception_separate_shared_12_test): Likewise.
396         (incremental_copy_test): Likewise.
397         * testsuite/Makefile.in: Regenerate.
398
399 2012-12-14  Cary Coutant  <ccoutant@google.com>
400
401         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
402         (Dwp_output_file::Dwp_index::enter_set): Add assert.
403
404 2012-12-12  Alan Modra  <amodra@gmail.com>
405
406         * powerpc.cc (class Track_tls): New.
407         (class Relocate, class Scan): Inherit Track_tls.
408         (Target_powerpc::Scan::local, global): Track tls optimization
409         and avoid creating plt entry for __tls_get_addr if all uses
410         are optimized away.
411         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
412
413 2012-12-12  Alan Modra  <amodra@gmail.com>
414
415         * options.h (General_options): Add --toc-sort/--no-toc-sort.
416         Replace no_toc_optimize with toc_optimize.
417         * output.h (Output_section::input_sections): Provide non-const variant.
418         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
419         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
420         accessors.
421         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
422         (class Sort_toc_sections): New.
423         (Target_powerpc::do_finalize_sections): Sort toc sections.
424         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
425
426 2012-12-10  Roland McGrath  <mcgrathr@google.com>
427
428         * testsuite/binary_unittest.cc (read_all): New function.
429         (Sized_binary_test): Use it instead of ::read.
430         * fileread.cc (do_read): Don't assume pread always reads the whole
431         amount in a single call.
432
433 2012-12-10  Alan Modra  <amodra@gmail.com>
434
435         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
436         Set EM_PPC64 or EM_PPC here.
437         (Target_selector_powerpc::do_recognize): Delete.
438
439 2012-12-10  Alan Modra  <amodra@gmail.com>
440
441         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
442         stub_table_.
443         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
444
445 2012-12-07  Roland McGrath  <mcgrathr@google.com>
446
447         * testsuite/binary_unittest.cc (Sized_binary_test):
448         Use open_descriptor rather than ::open.
449
450 2012-12-07  Alan Modra  <amodra@gmail.com>
451
452         * powerpc.cc (Stub_table::do_write): Delete redundant Address
453         typedef and invalid_address constant.
454         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
455         instantiate constants.
456
457 2012-12-06  Roland McGrath  <mcgrathr@google.com>
458
459         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
460         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
461         * aclocal.m4: Regenerate.
462         * configure: Regenerate.
463         * Makefile.in: Regenerate.
464         * testsuite/Makefile.in: Regenerate.
465
466 2012-12-07  Alan Modra  <amodra@gmail.com>
467
468         * options.h (General_options): Add no_toc_optimize.
469         * powerpc.cc (ok_lo_toc_insn): New function.
470         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
471
472 2012-12-06  Alan Modra  <amodra@gmail.com>
473
474         * options.h (General_options): Add plt_align, plt_static_chain,
475         plt_thread_safe.  Update stub_group_size help text.
476         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
477         for new plt_thread_safe_ var.
478         (use_plt_offset): Correct comments.
479         (Target_powerpc::do_relax): Look for thread creation symbols to
480         determine default plt_thread_safe value.  Clear plt call stubs
481         as well as branch stubs each iteration.
482         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
483         insn constants.
484         (l, hi, ha, write_insn): Move earlier.
485         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
486         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
487         plt stubs too.
488         (Stub_table::update_size): Adjust.
489         (Stub_table::prev_size, set_prev_size): Delete.
490         (Stub_table::stub_align): Let --plt-align affect result.
491         (Stub_table::plt_call_size): Calculate sizes for various stubs.
492         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
493         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
494         (Stub_table::do_write): Support more stub variants.
495
496 2012-12-04  Alan Modra  <amodra@gmail.com>
497
498         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
499         (Target_powerpc::do_define_standard_symbols): New function.
500
501 2012-12-03  Alan Modra  <amodra@gmail.com>
502
503         * output.h: Formatting, whitespace.
504
505 2012-12-03  Alan Modra  <amodra@gmail.com>
506
507         * layout.h (Layout::get_executable_sections): Declare.
508         * layout.cc (Layout::get_executable_sections): New function.
509         * arm.cc (Target_arm::group_sections): Use it.
510         (Arm_output_section::group_sections): Delete now redundant test.
511         * output.cc (Output_reloc::Output_reloc): Add is_relative.
512         param to handle relative relocs.
513         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
514         (Output_data_reloc::add_absolute): Adjust.
515         (Output_data_reloc::add_relative): New function.
516         (Output_data::reset_data_size): New function.
517         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
518         (Output_section::set_addralign): New function.
519         (Output_section::checkpoint_set_addralign): New function.
520         (Output_section::clear_section_offsets_need_adjustment): New function.
521         (Output_section::input_sections): Make public.
522         * powerpc.cc (class Output_data_brlt_powerpc): New.
523         (class Stub_table, class Stub_control): New.
524         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
525         stub_table_, set_stub_table, stub_table): New vectors and accessor
526         functions.
527         (Target_powerpc::do_may_relax, do_relax, push_branch,
528         new_stub_table, stub_tables, brlt_section, group_sections,
529         add_branch_lookup_table, find_branch_lookup_table,
530         write_branch_lookup_table, make_brlt_section): New functions.
531         (Target_powerpc::struct Sort_sections, class Branch_info): New.
532         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
533         branch_info_): New vars.
534         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
535         make call stubs here.
536         (Output_data_glink): Remove all call stub handling from this class.
537         (Target_powerpc::Scan::local, global): Save interesting branch
538         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
539         (Target_powerpc::do_finalize_sections): Only make reg save/restore
540         functions on final link.
541         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
542         Handle long branch destinations too.
543         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
544         do_plt_address_for_local): Adjust lookup of plt call stubs.
545
546 2012-11-30  Alan Modra  <amodra@gmail.com>
547
548         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
549         relocs against protected symbols when building 32-bit shared libs.
550
551 2012-11-30  Alan Modra  <amodra@gmail.com>
552
553         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
554         param.  Call got_section() to make .got.  Update all callers
555         and their callers and so on.
556
557 2012-11-30  Alan Modra  <amodra@gmail.com>
558
559         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
560         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
561         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
562         value if it already exists.
563
564 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
565
566         PR gold/14858
567         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
568
569 2012-11-14  Roland McGrath  <mcgrathr@google.com>
570
571         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
572         than bfc instruction for data sandboxing.
573
574 2012-11-08  Alan Modra  <amodra@gmail.com>
575
576         * po/POTFILES.in: Regenerate.
577
578 2012-11-05  Alan Modra  <amodra@gmail.com>
579
580         * configure.ac: Apply 2012-09-10 change to config.in here.
581         * configure: Regenerate.
582
583 2012-11-05  Alan Modra  <amodra@gmail.com>
584
585         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
586         (struct Opd_ent): Use "Address" rather than "Offset".
587         (Output_data_got_powerpc::got_base_offset): Return Valtype.
588         (Target_powerpc::got_section): Make public.
589         (Target_powerpc::scan_relocs): Move code setting symbols..
590         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
591         Create _SDA_BASE_ only when referenced.
592
593 2012-11-02  Roland McGrath  <mcgrathr@google.com>
594
595         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
596         from last change.
597
598 2012-11-01  Roland McGrath  <mcgrathr@google.com>
599
600         * target.h (Sized_target::relocate_relocs): Use Elf_Off
601         for offset_in_output_section parameter.
602         (Sized_target::relocate_special_relocatable): Likewise.
603         * arm.cc (Target_arm::relocate_relocs): Likewise.
604         (Target_arm::relocate_special_relocatable): Likewise.
605         * i386.cc (Target_i386::relocate_relocs): Likewise.
606         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
607         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
608         * target-reloc.h (relocate_relocs): Likewise.
609         * testsuite/testfile.cc (Target_test): Likewise.
610         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
611         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
612
613         * system.h: Move inclusion of <clocale> to after <libintl.h> in
614         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
615
616         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
617         parameter, which is unused in the [!F_SETFD] case.
618
619         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
620         SYMNDX to off_t before comparing it to this->data_size().
621         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
622         * incremental.cc (Output_section_incremental_inputs::do_write):
623         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
624
625         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
626
627 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
628
629         * gold.cc (Target_arm::do_adjust_elf_header): Add the
630         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
631         in EABI_VER5.
632
633 2012-10-29  Cary Coutant  <ccoutant@google.com>
634
635         * dwp.cc (usage): Add file and exit status parameters;
636         add --help and --version options.
637         (print_version): New function.
638         (main): Add --help and --version options.
639
640 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
641
642         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
643         final_layout_sequence.txt.
644         * testsuite/Makefile.in: Regenerated.
645
646 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
647
648         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
649         COMPILE generated by automake.
650         (LINK1): Likewise.
651         (CXXCOMPILE1): Likewise.
652         (CXXLINK1): Likewise.
653         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
654         (LINK): Likewise.
655         (CXXCOMPILE): Likewise.
656         (CXXLINK): Likewise.
657         * testsuite/Makefile.in: Regenerated.
658
659 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
660
661         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
662         on bad fwrite return.
663
664 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
665
666         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
667         on val.
668
669 2012-10-23  Cary Coutant  <ccoutant@google.com>
670
671         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
672         * testsuite/Makefile.in: Regenerate.
673         * testsuite/dwp_test.h: New source file.
674         * testsuite/dwp_test_1.cc: New source file.
675         * testsuite/dwp_test_1.s: New source file.
676         * testsuite/dwp_test_1.sh: New source file.
677         * testsuite/dwp_test_1b.cc: New source file.
678         * testsuite/dwp_test_1b.s: New source file.
679         * testsuite/dwp_test_2.cc: New source file.
680         * testsuite/dwp_test_2.s: New source file.
681         * testsuite/dwp_test_2.sh: New source file.
682         * testsuite/dwp_test_main.cc: New source file.
683         * testsuite/dwp_test_main.s: New source file.
684
685 2012-10-23  Cary Coutant  <ccoutant@google.com>
686
687         * dwp.h: New header file.
688         * dwp.cc: New source file.
689         * gold.h: Move shared declarations to system.h.
690         * system.h: New header file.
691         * Makefile.am: Add dwp.
692         * Makefile.in: Regenerate.
693
694 2012-10-23  Cary Coutant  <ccoutant@google.com>
695
696         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
697         Dwarf_info_reader::read_from_pointer.
698         (Dwarf_pubnames_table::read_header): Likewise.
699         (Dwarf_pubnames_table::next_name): Likewise.
700         (Dwarf_die::read_attributes): Likewise.
701         (Dwarf_die::skip_attributes): Likewise.
702         (Dwarf_info_reader::read_from_pointer): New function template.
703         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
704         (Dwarf_pubnames_table): Likewise.
705         (Dwarf_info_reader::read_from_pointer): New function template.
706         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
707         Dwarf_pubnames_table ctor.
708
709 2012-10-23  Cary Coutant  <ccoutant@google.com>
710
711         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
712         abbrev_shndx.
713         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
714         abbrev_shndx_.
715         (Dwarf_info_reader::set_abbrev_shndx): New method.
716         (Dwarf_info_reader::abbrev_shndx_): New data member.
717
718 2012-10-23  Cary Coutant  <ccoutant@google.com>
719
720         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
721         from object, not parameters.
722         (Dwarf_info_reader::parse): Likewise.
723         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
724         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
725         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
726         methods.
727
728 2012-10-23  Cary Coutant  <ccoutant@google.com>
729
730         * fileread.cc (Input_file::Input_file): New constructor.
731         * fileread.h (class Input_file): Add new constructor.
732
733 2012-10-18  Alan Modra  <amodra@gmail.com>
734
735         PR gold/14727
736         * object.cc (Relobj::is_section_name_included): Also match
737         .sdata personality section.
738
739 2012-10-18  Alan Modra  <amodra@gmail.com>
740
741         * target-reloc.h (class Default_comdat_behavior): New, package up..
742         (get_comdat_behaviour): ..this.
743         (relocate_section): Add Relocate_comdat_behavior template arg,
744         adjust code to suit.
745         * arm.cc (Target_arm::relocate_section): Adjust to suit.
746         (Target_arm::scan_reloc_section): Likewise.
747         * i386.cc (Target_i386::relocate_section): Likewise.
748         * sparc.cc (Target_sparc::relocate_section): Likewise.
749         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
750         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
751         * powerpc.cc (class Relocate_comdat_behavior): New.
752         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
753         gold::relocate_section with new template arg.
754
755 2012-10-18  Alan Modra  <amodra@gmail.com>
756
757         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
758         dynamic relocs for GOT_TPREL got entries, without symbol if
759         resolving locally.
760         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
761         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
762         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
763
764 2012-10-17  Alan Modra  <amodra@gmail.com>
765
766         PR gold/14726
767         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
768
769 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
770
771         * layout.cc (Layout::include_section): Keep sections marked
772         SHF_EXCLUDE when doing relocatable links.
773
774 2012-10-16  Alan Modra  <amodra@gmail.com>
775
776         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
777         (Target_powerpc::do_finalize_sections): Call it.
778         (Output_data_save_res): New class and supporting functions.
779         (Target_powerpc::symval_for_branch): Only look up .opd entry for
780         normal symbols defined in object files.
781
782 2012-10-12  Alan Modra  <amodra@gmail.com>
783
784         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
785         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
786         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
787         section if scan_opd_relocs not yet called.
788         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
789
790 2012-10-12  Alan Modra  <amodra@gmail.com>
791
792         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
793         add_local_ifunc_entry): Revert last change.
794         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
795
796 2012-10-05  Alan Modra  <amodra@gmail.com>
797
798         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
799         do_plt_address_for_global): New functions.
800         (Output_data_got_powerpc::do_write): Don't segfault when linking
801         statically.
802         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
803         add_local_ifunc_entry): Return true on adding entry..
804         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
805         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
806         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
807         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
808         set up symbols here.
809         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
810         syms here.  Do so even when no .iplt.  Don't segfault when linking
811         statically.
812         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
813         new variants without reloc param.
814         (Glink_sym_ent::Glink_sym_ent): Likewise.
815         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
816         reloc when refs will resolve to plt call stub.
817         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
818         R_PPC_PLTREL24 to resolve locally.
819         (Target_powerpc::Scan::global): Correct ifunc handling.
820         (Target_powerpc::Relocate::relocate): Correct local sym glink
821         lookup.  Don't destroy "value" when we have a plt call stub,
822         and when checking plt call validity.
823         (Target_powerpc::do_dynsym_value): Simplify.
824
825 2012-10-05  Alan Modra  <amodra@gmail.com>
826
827         * i386.cc (Output_data_plt_i386::address_for_global,
828         address_for_local): Add plt offset to returned value.  Adjust uses.
829         * sparc.cc (Output_data_plt_sparc::address_for_global,
830         address_for_local): Likewise.
831         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
832         address_for_local): Likewise.
833         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
834         address_for_local): Likewise.
835         * target.h (Target::plt_address_for_global, plt_address_for_local):
836         Update comment.
837         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
838         (Output_data_got::Got_entry::write): Nor here.
839         * output.h: Comment fix.
840
841 2012-10-02  Jiong Wang  <jiwang@tilera.com>
842
843         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
844         global_offset_table_ value for larget got.
845         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
846
847 2012-09-29  Alan Modra  <amodra@gmail.com>
848
849         * powerpc.cc (Target_powerpc::iplt_): New output section.
850         (Target_powerpc::iplt_section, make_iplt_section,
851         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
852         (Target_powerpc::make_plt_entry): Handle ifunc syms.
853         Target_powerpc::plt_entry_count): Count iplt entries too.
854         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
855         reloc section in constructor.  New params.
856         (Target_powerpc::make_plt_section): Create reloc section here instead.
857         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
858         functions.
859         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
860         (Output_data_glink::add_entry, find_entry): New functions to
861         deal with local syms.
862         (Glink_sym_ent): Add support for local syms.
863         (Output_data_glink::do_write): Handle ifunc plt entries.
864         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
865         (Target_powerpc::Scan::local, global): Handle ifunc syms.
866         (Target_powerpc::Relocate::relocate): Likewise.
867         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
868
869 2012-09-25  Alan Modra  <amodra@gmail.com>
870
871         * object.h (Sized_relobj_file::adjust_local_symbol,
872         do_adjust_local_symbol): New functions.
873         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
874         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
875         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
876         and irregular opd entry spacing.
877         (Powerpc_relobj::do_read_relocs): Add opd size checks.
878         (Global_symbol_visitor_opd): New functor.
879         (Target_powerpc::do_finalize_sections): Omit global symbols defined
880         on deleted opd entries.
881
882 2012-09-15  Jiong Wang  <jiwang@tilera.com>
883
884         * tilegx.cc: New file.
885         * Makefile.am (TARGETSOURCES): Add tilegx.cc
886         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
887         * configure.tgt: Add entries for tilegx*.
888         * configure.ac: Likewise.
889         * Makefile.in: Rebuild.
890         * configure: Likewise.
891         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
892         tilegx.
893
894 2012-09-13  Alan Modra  <amodra@gmail.com>
895
896         * target-reloc.h (scan_relocs): Call scan.local for relocs
897         against symbols in discarded sections.  Pass is_discarded
898         param.
899         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
900         Add is_discarded param.
901         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
902         is_discarded to flag opd entry as discarded.  Don't emit dyn
903         relocs on such entries.
904         (Target_powerpc::Scan::global): Similarly detect and handle
905         such opd entries.
906         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
907         opd_ent_.  Update all uses.
908         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
909         (Target_powerpc::relocate_section): Zero out discarded opd
910         entry relocs.
911
912 2012-09-12  Ian Lance Taylor  <iant@google.com>
913
914         PR gold/14570
915         * output.cc: Rename Output_data_got template parameter from size
916         to got_size for all functions.  Compile all variants of
917         Output_data_got.
918         (Output_data_got::Got_entry::write): Correct use of size for
919         symbol value.  Use local_is_tls rather than casting to
920         Sized_relobj_file.
921         * object.h (class Object): Add local_is_tls and do_local_is_tls.
922         (class Sized_relobj_file): Add do_local_is_tls.
923         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
924
925 2012-09-11  Alan Modra  <amodra@gmail.com>
926
927         PR gold/14566
928         * layout.cc (Layout::set_segment_offsets): When using
929         common-page-size alignment, ensure we are on a new max-page-size
930         page.
931         * output.cc (Output_segment::set_section_addresses): Use
932         abi_pagesize, not common_pagesize for relro boundary.
933         (Output_segment::set_offset): Likewise.
934
935 2012-09-11  Alan Modra  <amodra@gmail.com>
936
937         * output.h (Output_data_got::add_global_tls, add_local_tls,
938         add_local_tls_pair): New functions.
939         (Output_data_got::add_local_pair_with_rel): Remove second
940         reloc param.  Expand comment.
941         (Output_data_got::Got_entry): Rename use_plt_offset_ to
942         use_plt_or_tls_offset_, similarly for constructor param.
943         (Output_data_got::Got_entry::write): Add got_index param.
944         * output.cc (Output_data_got::add_global_tls, add_local_tls,
945         add_local_tls_pair): New functions.
946         (Output_data_got::Got_entry::write): Handle tls symbols
947         with use_plt_or_tls_offset_ set specially.
948         (Output_data_got::add_local_pair_with_rel): Only one reloc.
949         (Output_data_got::do_write): Replace iterator with index, pass
950         index to entry write function.
951         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
952         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
953         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
954         call.
955         * i386.cc (Target_i386::Scan::local): Likewise.
956         * sparc.cc (Target_sparc::Scan::local): Likewise.
957         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
958         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
959         do_tls_offset_for_global): New functions.
960         (Target_powerpc::Scan::local): Correct TLS relocations and got
961         entry values.
962         (Target_powerpc::Scan::global): Don't emit unnecessary
963         dynamic relocations on TLS GOT entries.
964
965 2012-09-10  Matthias Klose  <doko@ubuntu.com>
966
967         * config.in: Disable sanity check for kfreebsd.
968
969 2012-09-10  Sterling Augustine  <saugustine@google.com>
970
971         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
972         (Gdb_index::pubtypes_read): New parameter.
973         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
974         to calls.
975         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
976         pubtypes_object_.
977
978 2012-09-09  Alan Modra  <amodra@gmail.com>
979
980         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
981         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
982         * gc.h (gc_process_relocs): Call target gc_add_reference.
983         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
984         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
985         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
986         unnecessary cast.
987         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
988         to cater for when we don't need code offset.  Update use.
989         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
990         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
991         set_opd_valid): New functions.
992         (Target_powerpc::do_gc_add_reference): New function.
993         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
994         stashed refs.
995         (Target_powerpc::do_gc_mark_symbol): New function.
996
997 2012-09-06  Cary Coutant  <ccoutant@google.com>
998
999         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1000         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1001         (Dwarf_die::skip_attributes): Likewise.
1002         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1003         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1004         (main): Call it.
1005         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1006
1007 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1008
1009         * testsuite/script_test_3.t: Add .got.plt output section
1010         statement.
1011         * testsuite/script_test_4.t: Likewise.
1012
1013 2012-09-05  Alan Modra  <amodra@gmail.com>
1014
1015         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1016         update all uses and lose "enum" when using type.
1017
1018 2012-09-05  Alan Modra  <amodra@gmail.com>
1019
1020         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1021         * configure: Regenerate.
1022         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1023         (plugin_final_layout.stdout): Likewise.
1024         (memory_test): Set page sizes to 0x1000.
1025         * testsuite/Makefile.in: Regenerate.
1026         * testsuite/discard_locals_test.sh: Add FIXME comment.
1027         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1028         * testsuite/pr14265.t: Add .got output section statement.
1029         * testsuite/script_test_2.t: Likewise.
1030         * testsuite/script_test_3.t: Likewise.
1031         * testsuite/script_test_4.t: Likewise.
1032         * testsuite/script_test_5.t: Likewise.
1033         * testsuite/script_test_6.t: Likewise.
1034         * testsuite/script_test_7.t: Likewise.
1035         * testsuite/script_test_9.t: Likewise.
1036
1037 2012-09-05  Alan Modra  <amodra@gmail.com>
1038
1039         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1040         (Powerpc_relocate_functions::Status): New typedef.
1041         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1042         (Target_powerpc::Scan::local): Handle REL64.
1043         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1044         for REL32 and REL64.
1045         (Target_powerpc::symval_for_branch): New function, extracted from..
1046         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1047         checks.  Report overflow errors.
1048
1049 2012-09-05  Alan Modra  <amodra@gmail.com>
1050
1051         * object.h (Sized_relobj_file::emit_relocs): Delete.
1052         (Sized_relobj_file::emit_relocs_reltype): Delete.
1053         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1054         relocate_relocs for --emit-relocs.
1055         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1056         * output.h: Update comment.
1057         (Output_segment::first_section): New function.
1058         (Output_segment::first_section_load_address): Use first_section.
1059         * output.cc (Output_segment::first_section): New function extracted..
1060         (Output_segment::first_section_load_address): ..from here.  Delete.
1061         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1062         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1063         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1064         adjust call to target.h function.
1065         * i386.cc (Target_i386): Likewise.
1066         * sparc.cc (Target_sparc): Likewise.
1067         * x86_64.cc (Target_x86_64): Likewise.
1068         * powerpc.cc (Target_powerpc): Likewise.
1069         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1070         first tls section has section symbol for optimised local dynamic
1071         output relocs.
1072         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1073         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1074         optimised tls code.
1075         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1076         Rename to relocate_relocs.  Update error message.
1077
1078 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1079
1080         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1081         --just-symbols.
1082
1083 2012-08-31  Alan Modra  <amodra@gmail.com>
1084
1085         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1086         (Powerpc_relobj::toc_base_offset): New stub function.
1087         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1088         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1089         (Target_powerpc::Relocate::enum skip_tls): New.
1090         (Target_powerpc::call_tls_get_addr_): New var.
1091         (Target_powerpc::is_branch_reloc): Move to file scope.
1092         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1093         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1094         New functions.
1095         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1096         (powerpc_info): Correct common_pagesize for ppc64.
1097         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1098         (Powerpc_relocate_functions): Add overflow check enums and functions.
1099         Add non-shift version of rela, rela_ua.  Delete all rel public
1100         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1101         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1102         addr16_ha3, addr14 functions.
1103         (Output_data_got_powerpc::add_constant_pair): New function.
1104         (Output_data_got_powerpc::got_base_offset): Likewise.
1105         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1106         (instruction constants): Sort, add some more.
1107         (Output_data_glink::do_write): Add and use Address typedef.  Use
1108         object->toc_base_offset() stub for 64-bit.
1109         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1110         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1111         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1112         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1113         Always treat .opd relocs as against locally defined symbol.
1114         Correct condition for RELATIVE relocs.
1115         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1116         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1117         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1118         calculations.  Handle TLS relocs, and more.  Add overflow
1119         checking and adjust for Powerpc_relocate_functions changes.
1120         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1121         Reinstate --emit-relocs code with FIXME.
1122
1123 2012-08-30  Alan Modra  <amodra@gmail.com>
1124
1125         * layout.cc (Layout::set_segment_offsets): Set p_align to
1126         abi_pagesize, not common_pagesize.
1127         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1128         to determine whether file header can go in segment.
1129
1130 2012-08-30  Alan Modra  <amodra@gmail.com>
1131
1132         * output.h (Output_reloc::Output_reloc <output section>): Add
1133         is_relative param.  Adjust calls.
1134         (Output_reloc::add_output_section_relative): New functions.
1135         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1136         is_relative.
1137         (Output_reloc::symbol_value): Handle SECTION_CODE.
1138
1139 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1140
1141         * gold.cc (queue_middle_tasks): Call layout again when unique
1142         segments for sections is desired.
1143         * layout.cc (Layout::Layout): Initialize new members.
1144         (Layout::get_output_section_flags): New function.
1145         (Layout::choose_output_section): Call get_output_section_flags.
1146         (Layout::layout): Make output section for mapping to a unique segment.
1147         (Layout::insert_section_segment_map): New function.
1148         (Layout::attach_allocated_section_to_segment): Make unique segment for
1149         output sections marked so.
1150         (Layout::segment_precedes): Check for unique segments when sorting.
1151         * layout.h (Layout::Unique_segment_info): New struct.
1152         (Layout::Section_segment_map): New typedef.
1153         (Layout::insert_section_segment_map): New function.
1154         (Layout::get_output_section_flags): New function.
1155         (Layout::is_unique_segment_for_sections_specified): New function.
1156         (Layout::set_unique_segment_for_sections_specified): New function.
1157         (Layout::unique_segment_for_sections_specified_): New member.
1158         (Layout::section_segment_map_): New member.
1159         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1160         Rename is_gc_pass_one to is_pass_one.
1161         Rename is_gc_pass_two to is_pass_two.
1162         Rename is_gc_or_icf to is_two_pass.
1163         Check for which pass based on whether symbols data is present.
1164         Make it two pass when unique segments for sections is desired.
1165         * output.cc (Output_section::Output_section): Initialize new
1166         members.
1167         * output.h (Output_section::is_unique_segment): New function.
1168         (Output_section::set_is_unique_segment): New function.
1169         (Output_section::is_unique_segment_): New member.
1170         (Output_section::extra_segment_flags): New function.
1171         (Output_section::set_extra_segment_flags): New function.
1172         (Output_section::extra_segment_flags_): New member.
1173         (Output_section::segment_alignment): New function.
1174         (Output_section::set_segment_alignment): New function.
1175         (Output_section::segment_alignment_): New member.
1176         (Output_segment::Output_segment): Initialize is_unique_segment_.
1177         (Output_segment::is_unique_segment): New function.
1178         (Output_segment::set_is_unique_segment): New function.
1179         (Output_segment::is_unique_segment_): New member.
1180         * plugin.cc (allow_unique_segment_for_sections): New function.
1181         (unique_segment_for_sections): New function.
1182         (Plugin::load): Add new functions to transfer vector.
1183         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1184         * Makefile.in: Regenerate.
1185         * testsuite/plugin_final_layout.sh: Check if unique segment
1186         functionality works.
1187         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1188         are available.
1189         (allow_unique_segment_for_sections): New global.
1190         (unique_segment_for_sections): New global.
1191         (claim_file_hook): Call allow_unique_segment_for_sections.
1192         (all_symbols_read_hook): Call unique_segment_for_sections.
1193
1194 2012-08-22  Cary Coutant  <ccoutant@google.com>
1195
1196         * layout.cc (Layout::include_section): Don't assert on GROUP
1197         sections with --emit-relocs.
1198
1199 2012-08-21  Cary Coutant  <ccoutant@google.com>
1200
1201         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1202         if --export-dynamic-symbol names an undef symbol.
1203
1204 2012-08-18  Alan Modra  <amodra@gmail.com>
1205
1206         * powerpc.cc: Formatting and white space.
1207         (Powerpc_relobj): Rename got2_section_ to special_.
1208         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1209         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1210         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1211         (Target_powerpc): Add Address typedef and invalid_address.  Use
1212         throughout.
1213         (Target_powerpc::is_branch_reloc): New function.
1214         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1215         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1216         for dst_mask, value and addend.
1217         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1218         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1219         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1220         uint16_t for 24-bit offset.  Use get_output_section_offset and
1221         check return.
1222         (Target_powerpc::Scan::local): Handle more relocs.
1223         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1224         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1225         Plug in toc restoring insn after plt calls.  Translate branches
1226         to function descriptor symbols to corresponding entry point.
1227         (Target_powerpc::relocate_for_relocatable): Check return from
1228         get_output_section_offset.
1229         * symtab.h: Comment typo.
1230
1231 2012-08-14  Ian Lance Taylor  <iant@google.com>
1232
1233         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1234         unsupported_relocal_local to call unsupported_reloc_global.
1235
1236 2012-08-14  Nick Clifton  <nickc@redhat.com>
1237
1238         PR ld/14265
1239         * script-sections.cc (Sections_element::output_section_name): Add
1240         keep return parameter.
1241         (Output_section_element::match_name): Add keep return parameter.
1242         Return the value of the keep_ member.
1243         * script-sections.h (class Output_section): Update
1244         output_section_name prototype.
1245         * layout.cc (Layout::keep_input_section): New public member
1246         function.
1247         (Layout::choose_output_section): Pass keep parameter to
1248         output_section_name.
1249         * layout.h (class Layout): Add keep_input_section.
1250         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1251         sections.
1252         * testsuite/Makefile.am: Add a test.
1253         * testsuite/Makefile.in: Regenerate.
1254         * testsuite/pr14265.c: Source file for the test.
1255         * testsuite/pr14265.t: Linker script for the test.
1256         * testsuite/pr14265.sh: Shell script for the test.
1257
1258 2012-08-14  Alan Modra  <amodra@gmail.com>
1259
1260         * target.h (Target::output_section_name): New function.
1261         (Target::do_output_section_name): New function.
1262         * layout.cc (Layout::choose_output_section): Call the above.
1263         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1264
1265 2012-08-14  Alan Modra  <amodra@gmail.com>
1266
1267         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1268         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1269         for replace_constant call.
1270         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1271         (Output_data_glink::do_print_to_mapfile): New function.
1272         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1273         (Target_powerpc::Relocate::relocate): Likewise.
1274
1275 2012-08-14  Alan Modra  <amodra@gmail.com>
1276
1277         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1278         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1279         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1280         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1281         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1282         here.
1283         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1284         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1285         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1286         here.
1287         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1288         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1289
1290 2012-08-12  Alan Modra  <amodra@gmail.com>
1291
1292         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1293         (glink insn constants): Use uint32_t.
1294         (Output_data_glink::add_entry): Use insert, not [] operator.
1295
1296 2012-08-11  Alan Modra  <amodra@gmail.com>
1297
1298         * object.h (Sized_relobj_file::find_shdr): New function.
1299         (Sized_relobj_file::find_special_sections): New function.
1300         * object.cc (Sized_relobj_file::find_shdr): New function.
1301         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1302         (Sized_relobj_file::find_special_sections): New function, split out..
1303         (Sized_relobj_file::do_read_symbols): ..from here.
1304         * output.h (Output_data_got::replace_constant): New function.
1305         (Output_data_got::num_entries): New function.
1306         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1307         (Output_data_got::got_offset): Protected rather than private.
1308         (Output_data_got::replace_got_entry): New function.
1309         * output.cc (Output_data_got::replace_got_entry): New function.
1310         * powerpc.cc (class Powerpc_relobj): New.
1311         (class Powerpc_relocate_functions): Delete all psymval variants or
1312         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1313         Implement _ha functions using corresponding _hi function.
1314         (Powerpc_relobj::find_special_sections): New function.
1315         (Target_powerpc::do_make_elf_object): New function.
1316         (class Output_data_got_powerpc): New.
1317         (class Output_data_glink): New.
1318         (class Powerpc_scan_relocatable_reloc): New.
1319         Many more changes througout file.
1320
1321 2012-08-09  Nick Clifton  <nickc@redhat.com>
1322
1323         * po/vi.po: Updated Vietnamese translation.
1324
1325 2012-08-07  Ian Lance Taylor  <iant@google.com>
1326
1327         * layout.cc (Layout::add_target_dynamic_tags): If
1328         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1329         plt_rel.
1330
1331 2012-07-30  Nick Clifton  <nickc@redhat.com>
1332
1333         * po/gold.pot: Updated template.
1334         * po/es.po: Updated Spanish translation.
1335
1336 2012-07-18  Cary Coutant  <ccoutant@google.com>
1337
1338         PR gold/14344
1339         * configure.ac: Add check for -gpubnames support.
1340         * configure: Regenerate.
1341         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1342         support; force -gno-pubnames.
1343         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1344         support.
1345         (gdb_index_test_4): New test.
1346         * testsuite/Makefile.in: Regenerate.
1347         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1348         * testsuite/gdb_index_test_2.sh: Likewise.
1349         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1350         * testsuite/gdb_index_test_4.sh: New script.
1351         * testsuite/gdb_index_test_comm.sh: New script with common code;
1352         don't look for space after colon.
1353
1354 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1355
1356         * gold.cc (queue_middle_tasks): Update function order only after
1357         deferred objects due to plugins are processed.
1358
1359 2012-07-11  Ian Lance Taylor  <iant@google.com>
1360
1361         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1362         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1363         (Target_arm::scan_reloc_for_stub): Likewise.
1364         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1365         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1366         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1367         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1368         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1369
1370 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1371             Ian Lance Taylor  <iant@google.com>
1372
1373         PR gold/14309
1374         * configure.ac: Test whether std::tr1::hash<off_t> works.
1375         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1376         needed.
1377         * output.h (class Output_fill): Add virtual destructor.
1378         * configure, config.in: Rebuild.
1379
1380 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1381
1382         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1383
1384 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1385
1386         * plugin.cc (Plugin::load): Handle position independent executables.
1387
1388 2012-06-06  Cary Coutant  <ccoutant@google.com>
1389
1390         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1391         add .debug_macro.
1392         (lines_only_debug_sections): Likewise.
1393         (gdb_fast_lookup_sections): New static array.
1394         (is_gdb_debug_section): Rename formal parameter.
1395         (is_lines_only_debug_section): Likewise.
1396         (is_gdb_fast_lookup_section): New function.
1397         (Layout::include_section): Check for ".zdebug_" prefix; pass
1398         section name suffix to is_gdb_debug_section, et al.; check for
1399         fast-lookup sections when building .gdb_index.
1400         * options.h (--strip-debug-gdb): Update GDB version number.
1401
1402 2012-06-06  Cary Coutant  <ccoutant@google.com>
1403
1404         * configure.ac: Add check for fallocate.
1405         * configure: Regenerate.
1406         * config.in: Regenerate.
1407
1408         * options.h (class General_options): Add --mmap-output-file and
1409         --posix-fallocate options.
1410         * output.cc: (posix_fallocate): Remove; replace with...
1411         (gold_fallocate): New function.
1412         (Output_file::map_no_anonymous): Call gold_fallocate.
1413         (Output_file::map): Check --mmap-output-file option.
1414
1415 2012-06-05  Jing Yu  <jingyu@google.com>
1416
1417         * gold.h (textdomain): Add do {} to empty while(0).
1418         (bindtextdomain): Likewise.
1419
1420 2012-06-04  Cary Coutant  <ccoutant@google.com>
1421
1422         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1423         has_dynsym_index.
1424
1425 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1426
1427         * symtab.cc (Symbol_table::define_special_symbol):
1428         Initialize *poldsym to prevent uninitialized variable errors.
1429
1430 2012-05-23  Cary Coutant  <ccoutant@google.com>
1431
1432         * layout.cc (Layout::section_name_mapping): Add rules to handle
1433         exact match on .data.rel.ro.local or .data.rel.ro.
1434         (Layout::output_section_name): Check for exact matches.
1435
1436 2012-05-23  Cary Coutant  <ccoutant@google.com>
1437
1438         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1439         more carefully.
1440
1441 2012-05-22  Cary Coutant  <ccoutant@google.com>
1442
1443         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1444         object before exporting symbol.
1445
1446 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1447
1448         * testsuite/tls_test.cc: Include "config.h" first.
1449         * testsuite/tls_test_c.c: Likewise.
1450
1451 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1452             Nick Clifton  <nickc@redhat.com>
1453
1454         PR 14072
1455         * configure.in: Add check that sysdep.h has been included before
1456         any system header files.
1457         * configure: Regenerate.
1458         * config.in: Regenerate.
1459
1460 2012-05-14  Cary Coutant  <ccoutant@google.com>
1461
1462         * layout.cc (Layout::make_output_section): Mark .tdata section
1463         as RELRO.
1464         * testsuite/relro_test.cc: Add a TLS variable.
1465
1466 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1467
1468         PR gold/14091
1469         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1470         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1471         R_X86_64_64.
1472
1473 2012-05-08  Cary Coutant  <ccoutant@google.com>
1474
1475         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1476         (lines_only_debug_sections): Likewise.
1477
1478 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1479
1480         * nacl.cc: New file.
1481         * nacl.h: New file.
1482         * Makefile.am (CCFILES, HFILES): Add them.
1483         * Makefile.in: Regenerate.
1484         * i386.cc (Output_data_plt_i386_nacl): New class.
1485         (Output_data_plt_i386_nacl_exec): New class.
1486         (Output_data_plt_i386_nacl_dyn): New class.
1487         (Target_i386_nacl): New class.
1488         (Target_selector_i386_nacl): New class.
1489         (target_selector_i386): Use it instead of Target_selector_i386.
1490         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1491         (Target_x86_64_nacl): New class.
1492         (Target_selector_x86_64_nacl): New class.
1493         (target_selector_x86_64, target_selector_x32): Use it instead of
1494         Target_selector_x86_64.
1495         * arm.cc (Output_data_plt_arm_nacl): New class.
1496         (Target_arm_nacl): New class.
1497         (Target_selector_arm_nacl): New class.
1498         (target_selector_arm, target_selector_armbe): Use it instead of
1499         Target_selector_arm.
1500
1501         * target-select.cc (select_target): Take new Input_file* and off_t
1502         arguments, pass them on to recognize method of selector.
1503         * object.cc (make_elf_sized_object): Update caller.
1504         * parameters.cc (parameters_force_valid_target): Likewise.
1505         * incremental.cc (make_sized_incremental_binary): Likewise.
1506         * target-select.h: Update decl.
1507         (Target_selector::recognize): Take new Input_file* argument,
1508         pass it on to do_recognize.
1509         (Target_selector::do_recognize): Take new Input_file* argument.
1510         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1511         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1512         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1513         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1514
1515         * target.h (Target::Target_info): New members isolate_execinstr
1516         and rosegment_gap.
1517         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1518         * arm.cc (Target_arm::arm_info): Update initializer.
1519         * i386.cc (Target_i386::i386_info): Likewise.
1520         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1521         * sparc.cc (Target_sparc::sparc_info): Likewise.
1522         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1523         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1524         * layout.cc (Layout::attach_allocated_section_to_segment):
1525         Take new const Target* argument.  If target->isolate_execinstr(), act
1526         like --rosegment.
1527         (Layout::find_first_load_seg): Take new const Target* argument;
1528         if target->isolate_execinstr(), reject PF_X segments.
1529         (Layout::relaxation_loop_body): Update caller.
1530         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1531         reset file offset to zero when we hit LOAD_SEG, and then do a second
1532         loop over the segments before LOAD_SEG to reassign offsets after
1533         addresses have been determined.  Handle target->rosegment_gap().
1534         (Layout::attach_section_to_segment): Take new const Target* argument;
1535         pass it to attach_allocated_section_to_segment.
1536         (Layout::make_output_section): Update caller.
1537         (Layout::attach_sections_to_segments): Take new const Target* argument;
1538         pass it to attach_section_to_segment.
1539         * gold.cc (queue_middle_tasks): Update caller.
1540         * layout.h (Layout): Update method decls with new arguments.
1541
1542         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1543         Target_info pointer to use.
1544         (Target_arm::do_make_data_plt): New virtual method.
1545         (Target_arm::make_data_plt): New method that calls it.
1546         (Target_arm::make_plt_entry): Use it.
1547         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1548         for the section alignment.
1549         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1550         method.
1551         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1552         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1553         method.
1554         (Output_data_plt_arm::get_plt_entry_size): Call it.
1555         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1556         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1557         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1558         method.
1559         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1560         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1561         method instead of sizeof(plt_entry).
1562         (Output_data_plt_arm::add_entry): Likewise.
1563         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1564         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1565         than static method.
1566         (Target_arm::plt_entry_size): Likewise.
1567         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1568         Move to ...
1569         (Output_data_plt_arm_standard): ... here, new class.
1570         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1571         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1572         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1573
1574         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1575         Take additional argument for the PLT entry size.
1576         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1577         Use get_plt_entry_size method rather than plt_entry_size variable.
1578         (Output_data_plt_x86_64::reserve_slot): Likewise.
1579         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1580         (Output_data_plt_x86_64::add_entry): Likewise.
1581         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1582         (Output_data_plt_x86_64::address_for_global): Likewise.
1583         (Output_data_plt_x86_64::address_for_local): Likewise.
1584         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1585         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1586         Make method non-static.
1587         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1588         method.
1589         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1590         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1591         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1592         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1593         virtual method.
1594         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1595         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1596         virtual method.
1597         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1598         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1599         virtual method.
1600         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1601         (Output_data_plt_x86_64::plt_entry_size)
1602         (Output_data_plt_x86_64::first_plt_entry)
1603         (Output_data_plt_x86_64::plt_entry)
1604         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1605         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1606         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1607         (Output_data_plt_x86_64_standard): ... here, new class.
1608         (Target_x86_64::Target_x86_64): Take optional argument for the
1609         Target_info pointer to use.
1610         (Target_x86_64::do_make_data_plt): New virtual method.
1611         (Target_x86_64::make_data_plt): New method to call it.
1612         (Target_x86_64::init_got_plt_for_update): Use that.
1613         Call this->plt_->add_eh_frame method here.
1614         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1615         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1616         rather than static method.
1617         (Target_x86_64::plt_entry_size): Likewise.
1618         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1619         rather than plt_entry_size variable.  Move guts of PLT filling to...
1620         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1621         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1622         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1623
1624         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1625         additional argument for the section alignment.
1626         Don't do add_eh_frame_for_plt here.
1627         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1628         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1629         variable.
1630         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1631         method.
1632         (Output_data_plt_i386::get_plt_entry_size): Call it.
1633         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1634         (Output_data_plt_i386::add_eh_frame): New method to call it.
1635         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1636         method.
1637         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1638         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1639         method.
1640         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1641         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1642         method instead of plt_entry_size.
1643         (Output_data_plt_i386::plt_entry_size)
1644         (Output_data_plt_i386::plt_eh_frame_fde_size)
1645         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1646         (Output_data_plt_i386_standard): ... here, new class.
1647         (Output_data_plt_i386_exec): New class.
1648         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1649         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1650         (Output_data_plt_i386::exec_plt_entry): Move to ...
1651         (Output_data_plt_i386_exec::plt_entry): ... here.
1652         (Output_data_plt_i386_dyn): New class.
1653         (Output_data_plt_i386::first_plt_entry): Move to ...
1654         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1655         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1656         (Output_data_plt_i386_dyn::plt_entry): ... here.
1657         (Target_i386::Target_i386): Take optional argument for the Target_info
1658         pointer to use.
1659         (Target_i386::do_make_data_plt): New virtual method.
1660         (Target_i386::make_data_plt): New method to call it.
1661         (Target_i386::make_plt_section): Use that.
1662         Call this->plt_->add_eh_frame method here.
1663         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1664         rather than plt_entry_size variable.
1665         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1666         (Output_data_plt_i386::address_for_local): Likewise.
1667         (Output_data_plt_i386::do_write): Likewise.
1668         Move guts of PLT filling to...
1669         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1670         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1671         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1672         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1673
1674 2012-05-01  Cary Coutant  <ccoutant@google.com>
1675
1676         * dwarf_reader.cc (Dwarf_die::read_attributes)
1677         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1678         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1679         * reduced_debug_output.cc
1680         (Output_reduced_debug_info_section::get_die_end): Remove
1681         DW_FORM_GNU_ref_index.  Add default case.
1682
1683 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1684
1685         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1686         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1687         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1688         DW_AT_high_pc as offset from DW_AT_low_pc.
1689
1690         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1691         * testsuite/Makefile.in: Regenerate.
1692         * testsuite/gdb_index_test_3.c: New test source file.
1693         * testsuite/gdb_index_test_3.sh: New test source file.
1694
1695 2012-04-25  Ian Lance Taylor  <iant@google.com>
1696
1697         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1698         pointer.
1699         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1700         as a class, not a struct.
1701         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1702         (Target_arm::apply_cortex_a8_workaround): Likewise.
1703         * gc.h: Declare Reloc_types as a struct, not a class.
1704         * object.h: Declare Symbols_data as a struct.
1705         * reloc.h: Declare Read_relocs_data as a struct.
1706         * target.h: Declare Relocate_info as a struct.
1707
1708 2012-04-24  David S. Miller  <davem@davemloft.net>
1709
1710         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1711         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1712         and R_SPARC_WPLT30.
1713
1714 2012-04-24  Cary Coutant  <ccoutant@google.com>
1715
1716         * incremental-dump.cc (find_input_containing_global): Replace
1717         magic number with symbolic constant.
1718         (dump_incremental_inputs): Update version number.
1719         * incremental.cc (Output_section_incremental_inputs): Update version
1720         number; import symbolic constants from Incremental_inputs_reader.
1721         (Incremental_inputs::create_data_sections): Align relocations
1722         section correctly for 64-bit targets.
1723         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1724         constants; add padding.
1725         (Output_section_incremental_inputs::write_header): Add assert for
1726         header_size.
1727         (Output_section_incremental_inputs::write_input_files): Add assert
1728         for input_entry_size.
1729         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1730         add assert for object_info_size, input_section_entry_size,
1731         global_sym_entry_size.
1732         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1733         for data structure sizes; use them.
1734         (Incremental_input_entry_reader): Import symbolic constants from
1735         Incremental_inputs_reader; use them.
1736
1737 2012-04-23  David S. Miller  <davem@davemloft.net>
1738
1739         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1740         and elf_flags_set_.
1741         (Target_sparc::Target_sparc): Initialize new fields.
1742         (Target_sparc::do_make_elf_object): New function.
1743         (Target_sparc::do_adjust_elf_header): New function.
1744
1745 2012-04-23  Cary Coutant  <ccoutant@google.com>
1746
1747         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1748         CU range table of gdb index.
1749
1750 2012-04-20  David S. Miller  <davem@davemloft.net>
1751
1752         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1753         instead of false.
1754
1755 2012-04-16  David S. Miller  <davem@davemloft.net>
1756
1757         * sparc.cc (Target_sparc::got_address): New function.
1758         (Sparc_relocate_functions::gdop_hix22): New function.
1759         (Sparc_relocate_functions::gdop_lox10): New function.
1760         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1761         relocs.
1762         (Target_sparc::Scan::local): Likewise if the global symbol is not
1763         preemptible and is not IFUNC.
1764         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1765         transformations for local and non-preemptible non-IFUNC global
1766         symbols.
1767
1768         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1769         writing out 64-bit part of ranges.
1770
1771         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1772         -fpic and -fpie respectively.
1773         * Makefile.in: Regenerate.
1774
1775         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1776         (Target_sparc::Target_sparc): Initialize new field.
1777         (Target_sparc::do_plt_section_for_global): New function.
1778         (Target_sparc::do_plt_section_for_local): New function.
1779         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1780         (Target_sparc::make_plt_section): New function, broken out of
1781         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1782         (Target_sparc::make_plt_entry): Call make_plt_section.
1783         (Target_sparc::make_local_ifunc_plt_entry): New function.
1784         (Target_sparc::rela_ifunc_section): New function.
1785         (Target_sparc::plt_section): Remove const.
1786         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1787         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1788         and ifunc_count_ fields.
1789         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1790         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1791         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1792         (Output_data_plt_sparc::rela_ifunc): New function.
1793         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1794         (Output_data_plt_sparc::has_ifunc_section): New function.
1795         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1796         (Output_data_plt_sparc::address_for_global): New function.
1797         (Output_data_plt_sparc::address_for_local): New function.
1798         (Output_data_plt_sparc::plt_index_to_offset): New function.
1799         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1800         and entry_count.
1801         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1802         entry_count.
1803         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1804         R_SPARC_JMP_IREL to switch.
1805         (Target_sparc::Scan::check_non_pic): Likewise.
1806         (Target_sparc::Scan::local): Handle IFUNC symbols.
1807         (Target_sparc::Scan::local): Likewise.
1808         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1809         and plt_address_for_local.
1810         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1811         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1812
1813         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1814         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1815         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1816         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1817         global relocs too.
1818         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1819         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1820         calls.
1821         * sparc.cc (Target_sparc::Scan::global): Likewise.
1822         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1823
1824 2012-04-16  Cary Coutant  <ccoutant@google.com>
1825
1826         * archive.cc (Library_base::should_include_member): Check for
1827         --export-dynamic-symbol.
1828         * options.h (class General_options): Add --export-dynamic-symbol.
1829         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1830         --export-dynamic-symbol.
1831         (Symbol_table::gc_mark_undef_symbols): Likewise.
1832         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1833
1834 2012-04-12  David S. Miller  <davem@davemloft.net>
1835
1836         * sparc.cc (Reloc::wdisp10): New relocation method.
1837         (Reloc::h34): Likewise.
1838         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1839         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1840         R_SPARC_WDISP10.
1841         (Target_sparc::Scan::local): Likewise.
1842         (Target_sparc::Scan::global): Likewise.
1843         (Target_sparc::Relocate::relocate): Likewise.
1844
1845 2012-04-09  Cary Coutant  <ccoutant@google.com>
1846
1847         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1848         low_pc == 0.
1849
1850 2012-04-06  Ian Lance Taylor  <iant@google.com>
1851
1852         * timer.cc: #include <unistd.h>.
1853
1854 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1855
1856         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1857         * config.in: Regenerate.
1858         * configure: Regenerate.
1859
1860 2012-04-05  Nick Clifton  <nickc@redhat.com>
1861
1862         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1863         (AM_LC_MESSAGES): Add.
1864         * aclocal.m4: Regenerate.
1865         * config.in: Regenerate.
1866         * configure: Regenerate.
1867
1868 2012-03-21  Cary Coutant  <ccoutant@google.com>
1869
1870         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1871         * Makefile.in: Regenerate.
1872         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1873         (Sized_elf_reloc_mapper::symbol_section): New function.
1874         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1875         (make_elf_reloc_mapper): New function.
1876         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1877         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1878         (Dwarf_abbrev_table::do_get_abbrev): New function.
1879         (Dwarf_ranges_table::read_ranges_table): New function.
1880         (Dwarf_ranges_table::read_range_list): New function.
1881         (Dwarf_pubnames_table::read_section): New function.
1882         (Dwarf_pubnames_table::read_header): New function.
1883         (Dwarf_pubnames_table::next_name): New function.
1884         (Dwarf_die::Dwarf_die): New function.
1885         (Dwarf_die::read_attributes): New function.
1886         (Dwarf_die::skip_attributes): New function.
1887         (Dwarf_die::set_name): New function.
1888         (Dwarf_die::set_linkage_name): New function.
1889         (Dwarf_die::attribute): New function.
1890         (Dwarf_die::string_attribute): New function.
1891         (Dwarf_die::int_attribute): New function.
1892         (Dwarf_die::uint_attribute): New function.
1893         (Dwarf_die::ref_attribute): New function.
1894         (Dwarf_die::child_offset): New function.
1895         (Dwarf_die::sibling_offset): New function.
1896         (Dwarf_info_reader::check_buffer): New function.
1897         (Dwarf_info_reader::parse): New function.
1898         (Dwarf_info_reader::do_parse): New function.
1899         (Dwarf_info_reader::do_read_string_table): New function.
1900         (Dwarf_info_reader::lookup_reloc): New function.
1901         (Dwarf_info_reader::get_string): New function.
1902         (Dwarf_info_reader::visit_compilation_unit): New function.
1903         (Dwarf_info_reader::visit_type_unit): New function.
1904         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1905         Sized_elf_reloc_mapper.
1906         (Sized_dwarf_line_info::symbol_section): Remove function.
1907         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1908         (Sized_dwarf_line_info::read_line_mappings): Remove object
1909         parameter, adjust callers.
1910         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1911         * dwarf_reader.h: Include <sys/types.h>.
1912         (class Track_relocs): Remove forward declaration.
1913         (class Elf_reloc_mapper): New class.
1914         (class Sized_elf_reloc_mapper): New class.
1915         (class Dwarf_abbrev_table): New class.
1916         (class Dwarf_range_list): New class.
1917         (class Dwarf_ranges_table): New class.
1918         (class Dwarf_pubnames_table): New class.
1919         (class Dwarf_die): New class.
1920         (class Dwarf_info_reader): New class.
1921         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1922         (Sized_dwarf_line_info::symbol_section): Remove member function.
1923         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1924         base class.
1925         * gdb-index.cc: New source file.
1926         * gdb-index.h: New source file.
1927         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1928         and .debug_types sections, call Layout::add_to_gdb_index.
1929         (Sized_relobj_incr::do_section_name): Implement.
1930         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1931         return type; Implement.
1932         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1933         return type.
1934         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1935         parameter list and return type.
1936         (Sized_incr_dynobj::do_section_contents): Likewise.
1937         * layout.cc: Include gdb-index.h.
1938         (Layout::Layout): Initialize gdb_index_data_.
1939         (Layout::init_fixed_output_section): Check for .gdb_index section.
1940         (Layout::add_to_gdb_index): New function. Instantiate.
1941         * layout.h: Add forward declaration for class Gdb_index.
1942         (Layout::add_to_gdb_index): New member function.
1943         (Layout::gdb_index_data_): New data member.
1944         * main.cc: Include gdb-index.h.
1945         (main): Print statistics for gdb index.
1946         * object.cc (Object::section_contents): Move code into
1947         do_section_contents.
1948         (need_decompressed_section): Check for sections needed when building
1949         gdb index.
1950         (build_compressed_section_map): Likewise.
1951         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1952         gdb index.
1953         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1954         sections; call Layout::add_to_gdb_index.
1955         (Sized_relobj_file::do_decompressed_section_contents): Call
1956         do_section_contents directly.
1957         * object.h (Object::do_section_contents): Adjust parameter list and
1958         return type.
1959         (Object::do_decompressed_section_contents): Call do_section_contents
1960         directly.
1961         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1962         return type.
1963         * options.h (class General_options): Add --gdb-index option.
1964         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1965         list and return type.
1966         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1967         * reloc.h (Track_relocs::checkpoint): New function.
1968         (Track_relocs::reset): New function.
1969
1970         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1971         New test cases.
1972         * testsuite/Makefile.in: Regenerate.
1973         * testsuite/gdb_index_test.cc: New test source file.
1974         * testsuite/gdb_index_test_1.sh: New test source file.
1975         * testsuite/gdb_index_test_2.sh: New test source file.
1976
1977 2012-03-19  Doug Kwan  <dougkwan@google.com>
1978
1979         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1980         (Target_arm::do_finalize_sections): Remove code which defines
1981         __exidx_start and __exidx_end.  Make symbol table parameter
1982         anonymous as it is not used.
1983         * gold.cc (queue_middle_tasks): Call target hook to define any
1984         target-specific symbols.
1985         * target.h (Target::define_standard_symbols): New method.
1986         (Target::do_define_standard_symbols): Same.
1987         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1988         * testsuite/Makefile.in: Regenerate.
1989         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1990         and __exidx_end.
1991         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1992         relocations are generated for __exidx_start and __exidx_end.
1993
1994 2012-03-16  Doug Kwan  <dougkwan@google.com>
1995
1996         * testsuite/Makefile.am: Disable test initpri3b.
1997         * testsuite/Makefile.in: Regenerate.
1998
1999 2012-03-15  Doug Kwan  <dougkwan@google.com>
2000
2001         * arm.cc (Target_arm::got_section): Make .got section read-only
2002         if -z now is given.
2003
2004 2012-03-15  Ian Lance Taylor  <iant@google.com>
2005
2006         PR gold/13850
2007         * layout.cc (Layout::make_output_section): Correctly mark
2008         SHT_INIT_ARRAY, et. al., as relro.
2009
2010 2012-03-14  Doug Kwan  <dougkwan@google.com>
2011
2012         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2013         dynamic relocations for protected symbols in shared objects.
2014
2015 2012-03-13  Ian Lance Taylor  <iant@google.com>
2016
2017         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2018         keep the larger alignment.
2019
2020 2012-03-12  Cary Coutant  <ccoutant@google.com>
2021
2022         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2023         handling of DW_LNE_define_file.
2024
2025 2012-03-12  Cary Coutant  <ccoutant@google.com>
2026
2027         * reduced_debug_output.cc
2028         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2029         codes to switch.
2030
2031 2012-02-29  Cary Coutant  <ccoutant@google.com>
2032
2033         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2034
2035 2012-02-29  Cary Coutant  <ccoutant@google.com>
2036
2037         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2038         Call Object::decompressed_section_contents.
2039         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2040         New dtor.
2041         (Sized_dwarf_line_info::buffer_start_): New data member.
2042         * merge.cc (Output_merge_data::do_add_input_section): Call
2043         Object::decompressed_section_contents.
2044         (Output_merge_string::do_add_input_section): Likewise.
2045         * object.cc (need_decompressed_section): New function.
2046         (build_compressed_section_map): Decompress sections needed later.
2047         (Sized_relobj_file::do_decompressed_section_contents): New function.
2048         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2049         * object.h (Object::decompressed_section_contents): New function.
2050         (Object::discard_decompressed_sections): New function.
2051         (Object::do_decompressed_section_contents): New function.
2052         (Object::do_discard_decompressed_sections): New function.
2053         (Compressed_section_info): New type.
2054         (Compressed_section_map): Include decompressed section contents.
2055         (Sized_relobj_file::do_decompressed_section_contents): New function.
2056         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2057
2058 2012-02-16  Cary Coutant  <ccoutant@google.com>
2059
2060         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2061         * testsuite/Makefile.in: Regenerate.
2062
2063 2012-02-14  Cary Coutant  <ccoutant@google.com>
2064
2065         * options.cc (General_options::finalize): Disallow -pie and -static.
2066
2067 2012-02-03  Doug Kwan  <dougkwan@google.com>
2068
2069         * arm.cc (Arm_relocate_functions::abs8,
2070         Arm_relocate_functions::abs16): Use
2071         Bits::has_signed_unsigned_overflow32.
2072         (Arm_relocate_functions::thm_abs8): Correct range of
2073         overflow check.
2074         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2075         in assertions.
2076
2077 2012-02-02  Doug Kwan  <dougkwan@google.com>
2078
2079         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2080         position independent outputs, not just shared objects.
2081
2082 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2083
2084         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2085         * configure: Regenerated.
2086
2087 2012-01-27  Ian Lance Taylor  <iant@google.com>
2088
2089         * reloc.h (Bits): New class with static functions, copied from
2090         namespace utils in arm.cc.
2091         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2092         instead.
2093
2094 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2095
2096         * incremental.cc (write_info_blocks): Correct relocation offset.
2097
2098 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2099
2100         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2101         (Relocate::tls_gd_to_le): Likewise.
2102
2103 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2104
2105         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2106
2107 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2108
2109         * configure.ac: Check if -mcmodel=medium works.
2110         * configure: Regenerated.
2111
2112 2012-01-24  Cary Coutant  <ccoutant@google.com>
2113
2114         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2115         definition and ...
2116         (read_unsigned_LEB_128_x): ... this new function.
2117         (read_signed_LEB_128): Replaced with inline definition and ...
2118         (read_signed_LEB_128_x): ... this new function.
2119         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2120         (read_unsigned_LEB_128): Add inline definition.
2121         (read_signed_LEB_128_x): New function.
2122         (read_signed_LEB_128): Add inline definition.
2123         * testsuite/Makefile.am (leb128_unittest): New unit test.
2124         * testsuite/Makefile.in: Regenerate.
2125         * testsuite/leb128_unittest.cc: New unit test.
2126
2127 2012-01-23  Ian Lance Taylor  <iant@google.com>
2128
2129         PR gold/13617
2130         * i386.cc (Target_i386::do_code_fill): When using a jmp
2131         instruction, pad with nop instructions.
2132         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2133
2134 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2135
2136         * x86_64.cc (gc_process_relocs): Add typename on types used in
2137         template.
2138         (scan_relocs): Likewise.
2139         (relocate_section): Likewise.
2140         (apply_relocation): Likewise.
2141
2142 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2143
2144         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2145         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2146         under x32.
2147
2148 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2149
2150         * x86_64.cc: Initial support for x32.
2151
2152 2012-01-03  Cary Coutant  <ccoutant@google.com>
2153
2154         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2155         Use abstract base class for GOT.
2156         * gold/output.h (class Output_data_got_base): New abstract base class.
2157         (class Output_data_got): Derive from new base class, adjust ctors.
2158         (Output_data_got::reserve_slot): Make virtual; rename to
2159         do_reserve_slot; Adjust callers.
2160         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2161         pointer to abstract base class.
2162         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2163
2164 2011-12-18  Ian Lance Taylor  <iant@google.com>
2165
2166         * object.h (Relobj::local_symbol_value): New function.
2167         (Relobj::local_plt_offset): New function.
2168         (Relobj::local_has_got_offset): New function.
2169         (Relobj::local_got_offset): New function.
2170         (Relobj::set_local_got_offset): New function.
2171         (Relobj::do_local_symbol_value): New pure virtual function.
2172         (Relobj::do_local_plt_offset): Likewise.
2173         (Relobj::do_local_has_got_offset): Likewise.
2174         (Relobj::do_local_got_offset): Likewise.
2175         (Relobj::do_set_local_got_offset): Likewise.
2176         (Sized_relobj::do_local_has_got_offset): Rename from
2177         local_has_got_offset.
2178         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2179         (Sized_relobj::do_set_local_got_offset): Rename from
2180         set_local_got_offset.
2181         (Sized_relobj_file::do_local_plt_offset): Rename from
2182         local_plt_offset.
2183         (Sized_relobj_file::do_local_symbol_value): New function.
2184         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2185         local_plt_offset.
2186         * output.cc (Output_data_got::Got_entry::write): Change object to
2187         Relobj.  Use local_symbol_value.
2188         (Output_data_got::add_global_with_rel): Change rel_dyn to
2189         Output_data_reloc_generic*.  Use add_global_generic.
2190         (Output_data_got::add_global_with_rela): Remove.  Change all
2191         callers to use add_global_with_rel.
2192         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2193         Output_data_reloc_generic*.  Use add_global_generic.
2194         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2195         callers to use add_global_pair_with_rel.
2196         (Output_data_got::add_local): Change object to Relobj*.
2197         (Output_data_got::add_local_plt): Likewise.
2198         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2199         change rel_dyn to Output_data_reloc_generic*.  Use
2200         add_local_generic.
2201         (Output_data_got::add_local_with_rela): Remove.  Change all
2202         callers to use all_local_with_rel.
2203         (Output_data_got::add_local_pair_with_rel): Change object to
2204         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2205         add_output_section_generic.
2206         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2207         callers to use add_local_pair_with_rel.
2208         (Output_data_got::reserve_local): Change object to Relobj*.
2209         * output.h: (class Output_data_reloc_generic): Add pure virtual
2210         declarations for add_global_generic, add_local_generic,
2211         add_output_section_generic.
2212         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2213         functions for Output_data_reloc_generic.  Update declarations for
2214         changes listed in output.cc.
2215         (class Output_data_got): Change template parameter to got_size.
2216         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2217         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2218         function.
2219         (Sized_relobj_incr::do_local_plt_offset): New function.
2220         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2221         add_global_generic.
2222
2223 2011-12-17  Cary Coutant  <ccoutant@google.com>
2224
2225         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2226         * resolve.cc (Symbol_table::resolve): Likewise.
2227         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2228         arrays.
2229         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2230
2231 2011-12-16  Ian Lance Taylor  <iant@google.com>
2232
2233         * output.h (Output_data_reloc_generic::add): Only call
2234         add_dynamic_reloc if this is a dynamic reloc section.
2235
2236 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2237
2238         PR gold/13505
2239         * target-reloc.h (apply_relocation): Replace <64, false> with
2240         <size, big_endian>.
2241
2242 2011-11-25  Nick Clifton  <nickc@redhat.com>
2243
2244         * po/it.po: New Italian translation.
2245
2246 2011-11-17  Sterling Augustine  <saugustine@google.com>
2247
2248         * script.cc (script_include_directive): Implement.
2249         (read_script_file): New local variables name and search_path. Update
2250         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2251         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2252         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2253
2254 2011-11-11  Sterling Augustine  <saugustine@google.com>
2255
2256         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2257         (file_or_sections_cmd): Likewise.
2258
2259 2011-11-11  Doug Kwan  <dougkwan@google.com>
2260
2261         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2262         if --just-symbols is given.
2263
2264 2011-11-10  Doug Kwan  <dougkwan@google.com>
2265
2266         PR gold/13362
2267         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2268         when processing data relocs.
2269         * reloc.h (Relocate_functions::rel_unaligned): New method.
2270         (Relocate_functions::pcrel_unaligned): Ditto.
2271         (Relocate_functions::rel32_unaligned): Ditto.
2272         (Relocate_functions::pcrel32_unaligned): Ditto.
2273
2274 2011-11-09  Doug Kwan  <dougkwan@google.com>
2275
2276         PR gold/13362
2277         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2278         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2279         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2280         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2281         (Relocate_functions::rel_unaligned): New.
2282         (Relocate_functions::rel32_unaligned): New.
2283         * target-reloc.h (relocate_for_relocatable): Add code to handle
2284         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2285         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2286         arm_unaligned_reloc_r): New targets.
2287         * testsuite/Makefile.in: Regenerate.
2288         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2289         linking.
2290
2291 2011-11-02  Ian Lance Taylor  <iant@google.com>
2292
2293         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2294         NATIVE_LINKER.
2295         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2296         * options.cc (General_options::finalize): Use library search path
2297         from configure script if specified.  If not native and no sysroot,
2298         only search TOOLLIBDIR.
2299         * options.h (Search_directory::Search_directory): Change name to
2300         const std::string&.
2301         (General_options::add_to_library_path_with_sysroot): Change arg to
2302         const std::string&.
2303         * configure, Makefile.in, config.in: Rebuild.
2304
2305 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2306
2307         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2308         we are working around the ARM1176 Erratum.
2309         * options.h (General_options::fix_arm1176): Add option.
2310         * testsuite/Makefile.am: Add testcases, and keep current ones
2311         working.
2312         * testsuite/Makefile.in: Regenerate.
2313         * testsuite/arm_fix_1176.s: New file.
2314         * testsuite/arm_fix_1176.sh: Likewise.
2315
2316 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2317
2318         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2319         may_use_blx_.
2320         (Target_arm::may_use_blx): Remove method.
2321         (Target_arm::set_may_use_blx): Likewise.
2322         (Target_arm::may_use_v4t_interworking): New method.
2323         (Target_arm::may_use_v5t_interworking): Likewise.
2324         (Target_arm::may_use_blx_): Remove member variable.
2325         (Arm_relocate_functions::arm_branch_common): Check for v5T
2326         interworking.
2327         (Arm_relocate_functions::thumb_branch_common): Likewise.
2328         (Reloc_stub::stub_type_for_reloc): Likewise.
2329         (Target_arm::do_finalize_sections): Correct interworking checks.
2330         * testsuite/Makefile.am: Add new tests.
2331         * testsuite/Makefile.in: Regenerate.
2332         * testsuite/arm_farcall_arm_arm.s: New test.
2333         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2334         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2335         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2336         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2337         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2338         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2339         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2340
2341 2011-10-31  Cary Coutant  <ccoutant@google.com>
2342
2343         PR gold/13023
2344         * expression.cc (Expression::eval_with_dot): Add
2345         is_section_dot_assignment parameter.
2346         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2347         absolute and assigning to dot within a section.
2348         * script-sections.cc
2349         (Output_section_element_assignment::set_section_addresses): Pass
2350         dot_section to set_if_absolute.
2351         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2352         as is_section_dot_assignment flag to eval_with_dot.
2353         (Output_section_element_dot_assignment::set_section_addresses):
2354         Likewise.
2355         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2356         parameter.  Also set value if relative to dot_section; set the
2357         symbol's output_section.
2358         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2359         parameter.  Adjust all callers.
2360         (Expression::eval_maybe_dot): Likewise.
2361         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2362         Adjust all callers.
2363         * testsuite/script_test_2.t: Test assignment of an absolute value
2364         to dot within an output section element.
2365
2366 2011-10-31  Cary Coutant  <ccoutant@google.com>
2367
2368         * options.h (class General_options): Add --[no-]gnu-unique options.
2369         * symtab.cc (Symbol_table::sized_write_globals): Convert
2370         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2371
2372 2011-10-31  Cary Coutant  <ccoutant@google.com>
2373
2374         PR gold/13359
2375         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2376         unnecessary assertion.
2377         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2378
2379 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2380
2381         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2382         gc_mark_symbol.
2383         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2384         gc_mark_symbol.
2385         Change to just keep the section associated with symbol.
2386         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2387         they are externally visible and --export-dynamic is turned on.
2388         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2389
2390 2011-10-19  Ian Lance Taylor  <iant@google.com>
2391
2392         PR gold/13163
2393         * script-sections.cc
2394         (Output_section_element_dot_assignment::needs_output_section): New
2395         function.
2396
2397 2011-10-19  Ian Lance Taylor  <iant@google.com>
2398
2399         PR gold/13204
2400         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2401         --section-start option was seen.
2402         * options.h (General_options::any_section_start): New function.
2403
2404 2011-10-18  David S. Miller  <davem@davemloft.net>
2405
2406         PR binutils/13301
2407         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2408         member to track relocation locations that have moved during TLS
2409         reloc optimizations.
2410         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2411         (Target_sparc::Relocate::relocate): Adjust view down by 4
2412         bytes if it matches reloc_adjust_addr_.
2413         (Target_sparc::Relocate::relocate_tls): Always move the
2414         __tls_get_addr call delay slot instruction forward 4 bytes when
2415         performing relaxation.
2416
2417 2011-10-18  Cary Coutant  <ccoutant@google.com>
2418
2419         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2420         (Output_file::map_no_anonymous): Check for non-zero
2421         return code from posix_fallocate.
2422
2423 2011-10-17  Cary Coutant  <ccoutant@google.com>
2424
2425         PR gold/13245
2426         * plugin.cc (is_visible_from_outside): Check for symbols
2427         referenced from dynamic objects.
2428         * resolve.cc (Symbol_table::resolve): Don't count references
2429         from dynamic objects as references from real ELF files.
2430         * testsuite/plugin_test_2.sh: Adjust expected result.
2431
2432 2011-10-17  Cary Coutant  <ccoutant@google.com>
2433
2434         * gold.cc: Include timer.h.
2435         (queue_middle_tasks): Stamp time.
2436         (queue_final_tasks): Likewise.
2437         * main.cc (main): Store timer in parameters.  Print timers
2438         for each pass.
2439         * parameters.cc (Parameters::Parameters): Initialize timer_.
2440         (Parameters::set_timer): New function.
2441         (set_parameters_timer): New function.
2442         * parameters.h (Parameters::set_timer): New function.
2443         (Parameters::timer): New function.
2444         (Parameters::timer_): New data member.
2445         (set_parameters_timer): New function.
2446         * timer.cc (Timer::stamp): New function.
2447         (Timer::get_pass_time): New function.
2448         * timer.h (Timer::stamp): New function.
2449         (Timer::get_pass_time): New function.
2450         (Timer::pass_times_): New data member.
2451
2452 2011-10-17  Cary Coutant  <ccoutant@google.com>
2453
2454         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2455         task for members of lib groups.
2456
2457 2011-10-17  Cary Coutant  <ccoutant@google.com>
2458
2459         PR gold/13288
2460         * fileread.cc (File_read::find_view): Add assert.
2461         (File_read::make_view): Move bounds check (replace with assert)...
2462         (File_read::find_or_make_view): ... to here.
2463
2464 2011-10-12  Cary Coutant  <ccoutant@google.com>
2465
2466         * output.cc (Output_file::open_base_file): Handle case where
2467         ::read returns less than requested size.
2468
2469 2011-10-10  Cary Coutant  <ccoutant@google.com>
2470
2471         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2472         Initialize defined_count_.
2473         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2474         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2475         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2476         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2477         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2478         * incremental.h (Sized_relobj_incr::defined_count_): New data
2479         member.
2480         (Sized_incr_dynobj::defined_count_): New data member.
2481         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2482         Return zeroes instead of internal error.
2483
2484 2011-10-10  Cary Coutant  <ccoutant@google.com>
2485
2486         PR gold/13249
2487         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2488         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2489         * output.h (class Output_reloc): Add use_plt_offset flag.
2490         (Output_reloc::type_): Adjust size of bit field.
2491         (Output_reloc::use_plt_offset_): New bit field.
2492         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2493         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2494         flag.  Adjust all callers.
2495         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2496         creating RELATIVE relocations.
2497
2498 2011-10-10  Nick Clifton  <nickc@redhat.com>
2499
2500         * po/es.po: Updated Spanish translation.
2501         * po/fi.po: Updated Finnish translation.
2502
2503 2011-10-03   Diego Novillo  <dnovillo@google.com>
2504
2505         * options.cc (parse_uint): Fix dereference of RETVAL.
2506
2507 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2508
2509         * layout.h (section_order_map_): New member.
2510         (get_section_order_map): New member function.
2511         * output.cc (Output_section::add_input_section): Check for patterns
2512         only when --section-ordering-file is specified.
2513         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2514         output_sections have been formed.
2515         * layout.cc (Layout_Layout): Initialize section_order_map_.
2516         * plugin.cc (update_section_order): Store order in order_map. Do not
2517         update the order.
2518         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2519         * testsuite/Makefile.in: Regenerate.
2520         * testsuite/plugin_section_order.c: New file.
2521         * testsuite/plugin_final_layout.cc: New file.
2522         * testsuite/plugin_final_layout.sh: New file.
2523
2524 2011-09-29  Cary Coutant  <ccoutant@google.com>
2525
2526         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2527         Check for NULL.
2528         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2529         symbols during incremental update.
2530         (Symbol_table::add_from_dynobj): Likewise.
2531
2532 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2533             Ian Lance Taylor  <iant@google.com>
2534
2535         * symtab.cc (Symbol_table::define_special_symbol): Always
2536         canonicalize version string.
2537
2538 2011-09-26  Cary Coutant  <ccoutant@google.com>
2539
2540         * gold.cc (queue_initial_tasks): Move option checks ...
2541         * options.cc (General_options::finalize): ... to here. Disable
2542         some options; make others fatal.
2543
2544 2011-09-26  Cary Coutant  <ccoutant@google.com>
2545
2546         gcc PR lto/47247
2547         * plugin.cc (get_symbols_v2): New function.
2548         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2549         (is_referenced_from_outside): New function.
2550         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2551         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2552         (get_symbols): Pass version parameter.
2553         (get_symbols_v2): New function.
2554         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2555         parameter.
2556         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2557         (onload): Add LDPT_GET_SYMBOLS_V2.
2558         (all_symbols_read_hook): Use get_symbols_v2; check for
2559         LDPR_PREVAILING_DEF_IRONLY_EXP.
2560         * testsuite/plugin_test_3.sh: Update expected results.
2561
2562 2011-09-23  Simon Baldwin  <simonb@google.com>
2563
2564         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2565         configuration options.
2566         * configure: Regenerate.
2567         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2568         * Makefile.in: Regenerate.
2569         * testsuite/Makefile.in: Regenerate.
2570
2571 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2572
2573         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2574
2575 2011-09-19  Cary Coutant  <ccoutant@google.com>
2576
2577         * incremental.cc (can_incremental_update): Fix typo in comment.
2578         * incremental.h (can_incremental_update): Likewise.
2579
2580 2011-09-18  Cary Coutant  <ccoutant@google.com>
2581
2582         * incremental.cc (can_incremental_update): New function.
2583         * incremental.h (can_incremental_update): New function.
2584         * layout.cc (Layout::init_fixed_output_section): Call it.
2585         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2586         * object.cc (Sized_relobj_file::do_layout): Call
2587         can_incremental_update.
2588
2589 2011-09-13  Cary Coutant  <ccoutant@google.com>
2590
2591         * configure.ac: Check for glibc support for gnu_indirect_function
2592         support with static linking, setting automake conditional
2593         IFUNC_STATIC.
2594         * Makefile.in: Regenerate.
2595         * configure: Regenerate.
2596
2597         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2598         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2599         for IFUNC_STATIC.
2600         * testsuite/Makefile.in: Regenerate.
2601
2602 2011-09-13  Cary Coutant  <ccoutant@google.com>
2603
2604         * incremental.cc (Sized_relobj_incr::do_layout): Call
2605         report_comdat_group for kept comdat sections.
2606         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2607         * testsuite/Makefile.in: Regenerate.
2608         * testsuite/incr_comdat_test_1.cc: New source file.
2609         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2610         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2611         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2612
2613 2011-09-13  Ian Lance Taylor  <iant@google.com>
2614
2615         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2616         variable external_symbols_offset.
2617
2618 2011-09-12  Ian Lance Taylor  <iant@google.com>
2619
2620         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2621         triggered if object has no symbols.
2622
2623 2011-09-09  David S. Miller  <davem@davemloft.net>
2624
2625         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2626         (Output_fill_debug_line::do_write): Likewise.
2627
2628 2011-08-29  Cary Coutant  <ccoutant@google.com>
2629
2630         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2631         casts to match formatting specs.
2632         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2633
2634 2011-08-26  Cary Coutant  <ccoutant@google.com>
2635
2636         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2637         remaining hole size when allocating.
2638         (Layout::make_output_section): Set fill methods for debug sections.
2639         * layout.h (Free_list::Free_list_node): Move from private to
2640         public.
2641         (Free_list::set_min_hole_size): New function.
2642         (Free_list::begin, Free_list::end): New functions.
2643         (Free_list::min_hole_): New data member.
2644         * output.cc: Include dwarf.h.
2645         (Output_fill_debug_info::do_minimum_hole_size): New function.
2646         (Output_fill_debug_info::do_write): New function.
2647         (Output_fill_debug_line::do_minimum_hole_size): New function.
2648         (Output_fill_debug_line::do_write): New function.
2649         (Output_section::Output_section): Initialize new data member.
2650         (Output_section::set_final_data_size): Ensure patch space is larger
2651         than minimum hole size.
2652         (Output_section::do_write): Fill holes in debug sections.
2653         * output.h (Output_fill): New class.
2654         (Output_fill_debug_info): New class.
2655         (Output_fill_debug_line): New class.
2656         (Output_section::set_free_space_fill): New function.
2657         (Output_section::free_space_fill_): New data member.
2658         * testsuite/Makefile.am (incremental_test_3): Add
2659         --incremental-patch option.
2660         (incremental_test_4): Likewise.
2661         (incremental_test_5): Likewise.
2662         (incremental_test_6): Likewise.
2663         (incremental_copy_test): Likewise.
2664         (incremental_common_test_1): Likewise.
2665         * testsuite/Makefile.in: Regenerate.
2666
2667 2011-08-26  Nick Clifton  <nickc@redhat.com>
2668
2669         * po/es.po: Updated Spanish translation.
2670
2671 2011-08-01  Cary Coutant  <ccoutant@google.com>
2672
2673         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2674         * gold/testsuite/Makefile.in: Regenerate.
2675         * gold/testsuite/justsyms_exec.c: New source file.
2676         * gold/testsuite/justsyms_lib.c: New source file.
2677
2678 2011-08-01  Cary Coutant  <ccoutant@google.com>
2679
2680         * layout.cc (Layout::set_segment_offsets): Don't realign text
2681         segment if -Ttext was specified.
2682         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2683         file type.
2684         * object.h (Sized_relobj_file::e_type): New function.
2685         (Sized_relobj_file::e_type_): New data member.
2686         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2687         base address for ET_EXEC files.
2688         * target.cc (Target::do_make_elf_object_implementation): Allow
2689         ET_EXEC files with --just-symbols option.
2690
2691 2011-07-28  Cary Coutant  <ccoutant@google.com>
2692
2693         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2694         Add thread_number parameter.
2695         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2696         * workqueue-threads.cc
2697         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2698         current thread if its thread number is greater than desired thread
2699         count.
2700         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2701         Add thread_number parameter.
2702         (Workqueue::should_cancel_thread): Likewise.
2703         (Workqueue::find_runnable_or_wait): Pass thread_number to
2704         should_cancel_thread.
2705         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2706         parameter.
2707
2708 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2709
2710         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2711         only after checking if it cannot be forced local.
2712         * symtab.h (is_externally_visible): Check if the symbol is not forced
2713         local.
2714
2715 2011-07-15  Ian Lance Taylor  <iant@google.com>
2716
2717         * options.h (class General_options): Add --print-output-format.
2718         Move -EL next to -EB, for  better --help output.
2719         * target-select.cc: Include <cstdio>, "options.h", and
2720         "parameters.h".
2721         (Target_selector::do_target_bfd_name): New function.
2722         (print_output_format): New function.
2723         * target-select.h (class Target_selector): Update declarations.
2724         (Target_selector::target_bfd_name): New function.
2725         (print_output_format): Declare.
2726         * main.cc: Include "target-select.h".
2727         (main): Handle --print-output-format.
2728         * gold.cc: Include "target-select.h".
2729         (queue_initial_tasks): Handle --print-output-format when there are
2730         no input files.
2731         * parameters.cc (parameters_force_valid_target): Give a better
2732         error message if -EB/-EL does not match target.
2733         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2734         function.
2735
2736 2011-07-15  Ian Lance Taylor  <iant@google.com>
2737
2738         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2739         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2740         (Output_data_plt_i386::do_write): Write address of .dynamic
2741         section to first entry in .got.plt section.
2742         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2743         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2744         Initialize layout_.
2745         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2746         section to first entry in .got.plt section.
2747         * layout.h (Layout::dynamic_section): New function.
2748
2749 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2750
2751         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2752         to claim_file call.
2753         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2754         input_section_position_, and input_section_glob_.
2755         (read_layout_from_file): Call function section_ordering_specified.
2756         * layout.h (is_section_ordering_specified): New function.
2757         (section_ordering_specified): New function.
2758         (section_ordering_specified_): New boolean member.
2759         * main.cc(main): Call load_plugins after layout object is defined.
2760         * output.cc (Output_section::add_input_section): Use
2761         function section_ordering_specified to check if section ordering is
2762         needed.
2763         * output.cc (Output_section::add_relaxed_input_section): Use
2764         function section_ordering_specified to check if section ordering is
2765         needed.
2766         (Output_section::update_section_layout): New function.
2767         (Output_section::sort_attached_input_sections): Check if input section
2768         must be reordered.
2769         * output.h (Output_section::update_section_layout): New function.
2770         * plugin.cc (get_section_count): New function.
2771         (get_section_type): New function.
2772         (get_section_name): New function.
2773         (get_section_contents): New function.
2774         (update_section_order): New function.
2775         (allow_section_ordering): New function.
2776         (Plugin::load): Add the new interfaces to the transfer vector.
2777         (Plugin_manager::load_plugins): New parameter.
2778         (Plugin_manager::all_symbols_read): New parameter.
2779         (Plugin_manager::claim_file): New parameter. Save the elf object for
2780         unclaimed objects.
2781         (Plugin_manager::get_elf_object): New function.
2782         (Plugin_manager::get_view): Change to directly use the bool to check
2783         if get_view is called from claim_file_hook.
2784         * plugin.h (input_objects): New function
2785         (Plugin__manager::load_plugins): New parameter.
2786         (Plugin_manager::claim_file): New parameter.
2787         (Plugin_manager::get_elf_object): New function.
2788         (Plugin_manager::in_claim_file_handler): New function.
2789         (Plugin_manager::in_claim_file_handler_): New member.
2790         (layout): New function.
2791         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2792         handler with an extra parameter. Make the elf object before calling
2793         claim_file handler.
2794         * testsuite/plugin_test.c (get_section_count): New function pointer.
2795         (get_section_type): New function pointer.
2796         (get_section_name): New function pointer.
2797         (get_section_contents): New function pointer.
2798         (update_section_order): New function pointer.
2799         (allow_section_ordering): New function pointer.
2800         (onload): Check if the new interfaces exist.
2801
2802 2011-07-13  Ian Lance Taylor  <iant@google.com>
2803
2804         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2805         relro section.
2806         * x86_64.cc (Target_x86_64::got_section): Likewise.
2807         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2808         (relro_now_test_SOURCES): New variable.
2809         (relro_now_test_DEPENDENCIES): New variable.
2810         (relro_now_test_LDFLAGS): New variable.
2811         (relro_now_test_LDADD): New variable.
2812         (relro_now_test.so): New target.
2813         * testsuite/Makefile.in: Rebuild.
2814
2815 2011-07-12  Ian Lance Taylor  <iant@google.com>
2816
2817         PR gold/12980
2818         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2819         GLOB_DAT relocation rather than a RELATIVE relocation for a
2820         protected symbol when creating a shared library.
2821         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2822         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2823         * testsuite/protected_main_1.cc (main): Test that protected
2824         function has same address.
2825
2826 2011-07-11  Ian Lance Taylor  <iant@google.com>
2827
2828         PR gold/12979
2829         * options.h (class General_options): Add -Bgroup.
2830         * options.cc (General_options::finalize): If -Bgroup is set,
2831         default to --unresolved-symbols=report-all.
2832         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2833         * target-reloc.h (issue_undefined_symbol_error): Handle
2834         --unresolved-symbols=report-all.
2835
2836 2011-07-08  Ian Lance Taylor  <iant@google.com>
2837
2838         PR gold/11985
2839         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2840         if linker script discards key sections.
2841         (Layout::create_dynamic_symtab): Likewise.
2842         (Layout::assign_local_dynsym_offsets): Likewise.
2843         (Layout::sized_create_version_sections): Likewise.
2844         (Layout::create_interp): Likewise.
2845         (Layout::finish_dynamic_section): Likewise.
2846         (Layout::set_dynamic_symbol_size): Likewise.
2847
2848 2011-07-08  Ian Lance Taylor  <iant@google.com>
2849
2850         PR gold/12386
2851         * options.h (class General_options): Add --unresolved-symbols.
2852         * target-reloc.h (issue_undefined_symbol_error): Check
2853         --unresolved-symbols.  Add comments.
2854
2855 2011-07-08  Ian Lance Taylor  <iant@google.com>
2856
2857         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2858         expression more complex.
2859
2860 2011-07-08  Ian Lance Taylor  <iant@google.com>
2861
2862         PR gold/11317
2863         * target-reloc.h (issue_undefined_symbol_error): New inline
2864         function, broken out of relocate_section.
2865         (relocate_section): Call issue_undefined_symbol_error.
2866         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2867         there is no TLS segment if we are about to issue an undefined
2868         symbol error.
2869         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2870
2871 2011-07-08  Ian Lance Taylor  <iant@google.com>
2872
2873         PR gold/12279
2874         * resolve.cc (Symbol_table::should_override): Add fromtype
2875         parameter.  Change all callers.  Give error when linking together
2876         TLS and non-TLS symbol.
2877         (Symbol_table::should_override_with_special): Add fromtype
2878         parameter.  Change all callers.
2879         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2880         there is no TLS segment if we have reported some errors.
2881         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2882
2883 2011-07-08  Ian Lance Taylor  <iant@google.com>
2884
2885         PR gold/12372
2886         * target.h (Target::plt_address_for_global): New function.
2887         (Target::plt_address_for_local): New function.
2888         (Target::plt_section_for_global): Remove.
2889         (Target::plt_section_for_local): Remove.
2890         (Target::do_plt_address_for_global): New virtual function.
2891         (Target::do_plt_address_for_local): New virtual function.
2892         (Target::do_plt_section_for_global): Remove.
2893         (Target::do_plt_section_for_local): Remove.
2894         (Target::register_global_plt_entry): Add Symbol_table and Layout
2895         parameters.
2896         * output.cc (Output_data_got::Got_entry::write): Use
2897         plt_address_for_global and plt_address_for_local.
2898         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2899         address of output section.
2900         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2901         got_irelative_, and irelative_count_ fields.  Update
2902         declarations.
2903         (Output_data_plt_i386::has_irelative_section): New function.
2904         (Output_data_plt_i386::entry_count): Add irelative_count_.
2905         (Output_data_plt_i386::set_final_data_size): Likewise.
2906         (class Target_i386): Add got_irelative_ and rel_irelative_
2907         fields.  Update declarations.
2908         (Target_i386::Target_i386): Initialize new fields.
2909         (Target_i386::do_plt_address_for_global): New function replacing
2910         do_plt_section_for_global.
2911         (Target_i386::do_plt_address_for_local): New function replacing
2912         do_plt_section_for_local.
2913         (Target_i386::got_section): Create got_irelative_.
2914         (Target_i386::rel_irelative_section): New function.
2915         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2916         fields.  Don't define __rel_iplt_{start,end}.
2917         (Output_data_plt_i386::add_entry): Add symtab and layout
2918         parameters.  Change all callers.  Use different PLT and GOT for
2919         IFUNC symbols.
2920         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2921         layout parameters.  Change all callers.  Use different PLT and
2922         GOT.
2923         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2924         (Output_data_plt_i386::rel_irelative): New function.
2925         (Output_data_plt_i386::address_for_global): New function.
2926         (Output_data_plt_i386::address_for_local): New function.
2927         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2928         IRELATIVE GOT when changing IFUNC GOT entries.
2929         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2930         reloc.
2931         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2932         if we didn't create an IRELATIVE GOT.
2933         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2934         plt_address_for_local.
2935         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2936         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2937         got_irelative_, and irelative_count_ fields.  Update
2938         declarations.
2939         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2940         Initialize new fields.  Remove symtab parameter.  Change all
2941         callers.
2942         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2943         irelative_count_.
2944         (Output_data_plt_x86_64::has_irelative_section): New function.
2945         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2946         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2947         fields.  Update declarations.
2948         (Target_x86_64::Target_x86_64): Initialize new fields.
2949         (Target_x86_64::do_plt_address_for_global): New function replacing
2950         do_plt_section_for_global.
2951         (Target_x86_64::do_plt_address_for_local): New function replacing
2952         do_plt_section_for_local.
2953         (Target_x86_64::got_section): Create got_irelative_.
2954         (Target_x86_64::rela_irelative_section): New function.
2955         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2956         all callers.  Don't create __rel_iplt_{start,end}.
2957         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2958         parameters.  Change all callers.  Use different PLT and GOT for
2959         IFUNC symbols.
2960         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2961         layout parameters.  Change all callers.  Use different PLT and
2962         GOT.
2963         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2964         parameters.  Change all callers.  Use different PLT and GOT for
2965         IFUNC symbols.
2966         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2967         (Output_data_plt_x86_64::rela_irelative): New function.
2968         (Output_data_plt_x86_64::address_for_global): New function.
2969         (Output_data_plt_x86_64::address_for_local): New function.
2970         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2971         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2972         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2973         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2974         parameters.
2975         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2976         reloc.
2977         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2978         symbols if we didn't create an IRELATIVE GOT.
2979         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2980         plt_address_for_local.
2981         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2982         * testsuite/ifuncvar1.c: New test file.
2983         * testsuite/ifuncvar2.c: New test file.
2984         * testsuite/ifuncvar3.c: New test file.
2985         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2986         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2987         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2988         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2989         * testsuite/Makefile.in: Rebuild.
2990
2991 2011-07-07  Cary Coutant  <ccoutant@google.com>
2992
2993         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2994         (two_file_test_1_ndebug.o): Likewise.
2995         (two_file_test_1b_ndebug.o): Likewise.
2996         (two_file_test_2_ndebug.o): Likewise.
2997         (two_file_test_main_ndebug.o): Likewise.
2998         (incremental_test_2): Link with no-debug versions.
2999
3000 2011-07-06  Cary Coutant  <ccoutant@google.com>
3001
3002         * gold/incremental.cc
3003         (Output_section_incremental_inputs::write_info_blocks): Check for
3004         hidden and internal symbols.
3005
3006 2011-07-06  Cary Coutant  <ccoutant@google.com>
3007
3008         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3009         Check disposition for startup file.
3010         (Incremental_inputs::report_command_line): Ignore
3011         --incremental-startup-unchanged option.
3012         * options.cc (General_options::parse_incremental_startup_unchanged):
3013         New function.
3014         (General_options::General_options): Initialize new data member.
3015         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3016         (General_options): Add --incremental-startup-unchanged option.
3017         (General_options::incremental_startup_disposition): New function.
3018         (General_options::incremental_startup_disposition_): New data member.
3019
3020 2011-07-06  Cary Coutant  <ccoutant@google.com>
3021
3022         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3023         input file index to Script_info ctor.
3024         (Sized_incremental_binary::do_file_has_changed): Find the
3025         command-line argument for files named in scripts.
3026         * incremental.h (Script_info::Script_info): New ctor
3027         with input file index.
3028         (Script_info::input_file_index): New function.
3029         (Script_info::input_file_index_): New data member.
3030         (Incremental_binary::get_library): Add const.
3031         (Incremental_binary::get_script_info): Add const.
3032         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3033         * testsuite/Makefile.am (incremental_test_5): New test case.
3034         (incremental_test_6): New test case.
3035         * testsuite/Makefile.in: Regenerate.
3036
3037 2011-07-06  Cary Coutant  <ccoutant@google.com>
3038
3039         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3040         debug output when command lines differ.
3041
3042 2011-07-06  Cary Coutant  <ccoutant@google.com>
3043
3044         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3045         --incremental-patch option.
3046         * layout.cc (Free_list::allocate): Extend allocation beyond original
3047         end if enabled.
3048         (Layout::make_output_section): Mark sections that should get
3049         patch space.
3050         * options.cc (parse_percent): New function.
3051         * options.h (parse_percent): New function.
3052         (DEFINE_percent): New macro.
3053         (General_options): Add --incremental-patch option.
3054         * output.cc (Output_section::Output_section): Initialize new data
3055         members.
3056         (Output_section::add_input_section): Print section name when out
3057         of patch space.
3058         (Output_section::add_output_section_data): Likewise.
3059         (Output_section::set_final_data_size): Add patch space when
3060         doing --incremental-full.
3061         (Output_section::do_reset_address_and_file_offset): Remove patch
3062         space.
3063         (Output_segment::set_section_list_addresses): Print debug output
3064         only if --incremental-update.
3065         * output.h (Output_section::set_is_patch_space_allowed): New function.
3066         (Output_section::is_patch_space_allowed_): New data member.
3067         (Output_section::patch_space_): New data member.
3068         * parameters.cc (Parameters::incremental_full): New function.
3069         * parameters.h (Parameters::incremental_full): New function
3070         * testsuite/Makefile.am (incremental_test_2): Add test for
3071         --incremental-patch option.
3072         * testsuite/Makefile.in: Regenerate.
3073         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3074         (t18): Remove function body.
3075
3076 2011-07-05  Doug Kwan  <dougkwan@google.com>
3077
3078         PR gold/12771
3079         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3080         Arm_Address type for relocation result.
3081         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3082         overflow check.
3083         (Arm_relocate_functions::abs32): Use unaligned access.
3084         (Arm_relocate_functions::rel32): Ditto.
3085         (Arm_relocate_functions::prel31): Ditto.
3086         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3087         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3088         static data relocations.
3089         * testsuite/Makefile.in: Regnerate.
3090         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3091
3092 2011-07-05  Ian Lance Taylor  <iant@google.com>
3093
3094         PR gold/12392
3095         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3096         symbols if necessary.
3097         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3098
3099 2011-07-05  Ian Lance Taylor  <iant@google.com>
3100
3101         PR gold/12952
3102         * resolve.cc (Symbol::override_base_with_special): Simply override
3103         version with special symbol version, ignoring previous version.
3104
3105 2011-07-05  Ian Lance Taylor  <iant@google.com>
3106
3107         * object.cc (Sized_relobj_file::include_section_group): Add
3108         information to comment about signature location.
3109
3110 2011-07-02  Ian Lance Taylor  <iant@google.com>
3111
3112         PR gold/12957
3113         * options.h (class General_options): Add -f and -F.
3114         * options.cc (General_options::finalize): Fatal error if -f/-F
3115         are used without -shared.
3116         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3117
3118 2011-07-02  Ian Lance Taylor  <iant@google.com>
3119
3120         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3121
3122 2011-07-01  Ian Lance Taylor  <iant@google.com>
3123
3124         PR gold/12525
3125         PR gold/12952
3126         * resolve.cc (Symbol::override_base_with_special): Don't override
3127         the version if the overriding symbol has a different name.
3128         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3129         all callers.  If we give an error about an undefined version,
3130         define the base version if necessary.
3131         * dynobj.h (class Versions): Update declaration.
3132         * testsuite/weak_alias_test_5.cc: New file.
3133         * testsuite/weak_alias_test.script: New file.
3134         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3135         and versioned_alias have the right value, and call t2.
3136         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3137         weak_alias_test_5.so.
3138         (weak_alias_test_LDADD): Likewise.
3139         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3140         * testsuite/Makefile.in: Rebuild.
3141
3142 2011-07-01  Ian Lance Taylor  <iant@google.com>
3143
3144         PR gold/12525
3145         * options.h (class General_options): Support -z notext.
3146         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3147         -Wl,-z,notext.
3148         (two_file_shared_nonpic.so): Likewise.
3149         (two_file_shared_mixed.so): Likewise.
3150         (two_file_shared_mixed_1.so): Likewise.
3151         (weak_undef_lib_nonpic.so): Likewise.
3152         (alt/weak_undef_lib_nonpic.so): Likewise.
3153         (tls_test_shared_nonpic.so): Likewise.
3154         * testsuite/Makefile.in: Rebuild.
3155
3156 2011-07-01  Ian Lance Taylor  <iant@google.com>
3157
3158         PR gold/12525
3159         * configure.ac: Test whether static linking works, setting
3160         the automake conditional HAVE_STATIC.
3161         * testsuite/Makefile.am: Disable tests using -static if
3162         HAVE_STATIC is not true.
3163         * configure, testsuite/Makefile.in: Rebuild.
3164
3165 2011-07-01  Ian Lance Taylor  <iant@google.com>
3166
3167         PR gold/12525
3168         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3169         Assert if we see DW_EH_PE_indirect.
3170         * target.h (Target::ehframe_datarel_base): New function.
3171         (Target::do_ehframe_datarel_base): New target function.
3172         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3173         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3174         function.
3175
3176 2011-07-01  Ian Lance Taylor  <iant@google.com>
3177
3178         PR gold/12571
3179         * options.h (class General_options): Add
3180         --ld-generated-unwind-info.
3181         * ehframe.cc (Fde::write): Add address parameter.  Change all
3182         callers.  If associated with PLT, fill in address and size.
3183         (Cie::set_output_offset): Only add merge mapping if there is an
3184         object.
3185         (Cie::write): Add address parameter.  Change all callers.
3186         (Eh_frame::add_ehframe_for_plt): New function.
3187         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3188         input_offset_ fields into union u_, with new plt field.
3189         (Fde::Fde): Adjust for new union field.
3190         (Fde::Fde) [Output_data version]: New constructor.
3191         (Fde::add_mapping): Only add merge mapping if there is an object.
3192         (class Cie): Update declarations.
3193         (class Eh_frame): Declare add_ehframe_for_plt.
3194         * layout.cc (Layout::layout_eh_frame): Break out code into
3195         make_eh_frame_section, and call it.
3196         (Layout::make_eh_frame_section): New function.
3197         (Layout::add_eh_frame_for_plt): New function.
3198         * layout.h (class Layout): Update declarations.
3199         * merge.cc (Merge_map::add_mapping): Add assertion.
3200         * i386.cc: Include "dwarf.h".
3201         (class Output_data_plt_i386): Make first_plt_entry,
3202         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3203         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3204         and plt_eh_frame_fde.
3205         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3206         boundary.  Call add_eh_frame_for_plt if appropriate.
3207         * x86_64.cc: Include "dwarf.h".
3208         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3209         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3210         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3211         and plt_eh_frame_fde.
3212         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3213         appropriate.
3214
3215 2011-06-29  Ian Lance Taylor  <iant@google.com>
3216
3217         PR gold/12629
3218         * object.cc (Sized_relobj_file::layout_section): Change shdr
3219         parameter to be const.
3220         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3221         out of do_layout.
3222         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3223         appropriate.  Call layout_eh_frame_section.
3224         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3225         sections.
3226         * object.h (class Sized_relobj_file): Update declarations.
3227
3228 2011-06-29  Ian Lance Taylor  <iant@google.com>
3229
3230         PR gold/12652
3231         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3232         modifier.
3233         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3234
3235 2011-06-29  Ian Lance Taylor  <iant@google.com>
3236
3237         PR gold/12675
3238         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3239         SHT_X86_64_UNWIND.
3240         * layout.cc (Layout::layout_eh_frame): Likewise.
3241
3242 2011-06-29  Ian Lance Taylor  <iant@google.com>
3243
3244         PR gold/12695
3245         * layout.cc (Layout::symtab_section_shndx): New function.
3246         * layout.h (class Layout): Declare symtab_section_shndx.
3247         * output.cc (Output_section::write_header): Call it.
3248
3249 2011-06-29  Ian Lance Taylor  <iant@google.com>
3250
3251         PR gold/12818
3252         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3253         symbols which are not used in a relocation.
3254
3255 2011-06-28  Ian Lance Taylor  <iant@google.com>
3256
3257         PR gold/12898
3258         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3259         script create indistinguishable segments.
3260         (Layout::set_segment_offsets): Use stable_sort when sorting
3261         segments.  Pass this to Compare_segments constructor.
3262         * layout.h (class Layout): Make segment_precedes non-static.
3263         (class Compare_segments): Change from struct to class.  Add
3264         layout_ field.  Add constructor.
3265         * script-sections.cc
3266         (Script_sections::attach_sections_using_phdrs_clause): Rename
3267         local orphan to is_orphan.  Don't report failure to put empty
3268         section in segment.  On attachment failure, report name of
3269         section, and attach to first PT_LOAD segment.
3270
3271 2011-06-28  Ian Lance Taylor  <iant@google.com>
3272
3273         PR gold/12934
3274         * target-select.cc (Target_selector::Target_selector): Add
3275         emulation parameter.  Change all callers.
3276         (select_target_by_bfd_name): Rename from select_target_by_name.
3277         Change all callers.
3278         (select_target_by_emulation): New function.
3279         (supported_emulation_names): New function.
3280         * target-select.h (class Target_selector): Add emulation_ field.
3281         Update declarations.
3282         (Target_selector::recognize_by_bfd_name): Rename from
3283         recognize_by_name.  Change all callers.
3284         (Target_selector::supported_bfd_names): Rename from
3285         supported_names.  Change all callers.
3286         (Target_selector::recognize_by_emulation): New function.
3287         (Target_selector::supported_emulations): New function.
3288         (Target_selector::emulation): New function.
3289         (Target_selector::do_recognize_by_bfd_name): Rename from
3290         do_recognize_by_name.  Change all callers.
3291         (Target_selector::do_supported_bfd_names): Rename from
3292         do_supported_names.  Change all callers.
3293         (Target_selector::do_recognize_by_emulation): New function.
3294         (Target_selector::do_supported_emulations): New function.
3295         (select_target_by_bfd_name): Change name in declaration.
3296         (select_target_by_emulation): Declare.
3297         (supported_emulation_names): Declare.
3298         * parameters.cc (parameters_force_valid_target): Try to find
3299         target based on emulation from -m option.
3300         * options.h (class General_options): Change doc string for -m.
3301         * options.cc (help): Print emulations.
3302         (General_options::parse_V): Likewise.
3303         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3304         Add emulation parameter.  Change all callers.
3305
3306 2011-06-28  Ian Lance Taylor  <iant@google.com>
3307
3308         * target.h (class Target): Add osabi_ field.
3309         (Target::osabi): New function.
3310         (Target::set_osabi): New function.
3311         (Target::Target): Initialize osabi_.
3312         (Target::do_adjust_elf_header): Make pure virtual.
3313         (Sized_target::do_adjust_elf_header): Declare.
3314         * target.cc (Sized_target::do_adjust_elf_header): New function.
3315         (class Sized_target): Instantiate all versions.
3316         * freebsd.h (class Target_freebsd): Remove.
3317         (Target_selector_freebsd::do_recognize): Call set_osabi on
3318         Target.
3319         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3320         (Target_selector_freebsd::set_osabi): Remove.
3321         * i386.cc (class Target_i386): Inherit from Sized_target rather
3322         than Target_freebsd.
3323         * x86_64.cc (class Target_x86_64): Likewise.
3324
3325 2011-06-28  Ian Lance Taylor  <iant@google.com>
3326
3327         * target.h (Target::can_check_for_function_pointers): Rewrite.
3328         Make non-virtual.
3329         (Target::can_icf_inline_merge_sections): Likewise.
3330         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3331         (Target::Target_info): Add can_icf_inline_merge_sections field.
3332         (Target::do_can_check_for_function_pointers): New virtual
3333         function.
3334         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3335         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3336         from can_check_for_function_pointers, move in file.
3337         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3338         section_may_have_icf_unsafe_poineters, move in file.
3339         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3340         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3341         Rename from can_check_for_function_pointers, move in file.
3342         (Target_i386::can_icf_inline_merge_sections): Remove.
3343         (Target_i386::i386_info): Initialize
3344         can_icf_inline_merge_sections.
3345         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3346         Initialize can_icf_inline_merge_sections.
3347         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3348         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3349         Rename from can_check_for_function_pointers, move in file.
3350         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3351         (Target_x86_64::x86_64_info): Initialize
3352         can_icf_inline_merge_sections.
3353         * testsuite/testfile.cc (Target_test::test_target_info):
3354         Likewise.
3355         * icf.cc (get_section_contents): Correct formatting.
3356
3357 2011-06-27  Ian Lance Taylor  <iant@google.com>
3358
3359         * symtab.cc (Symbol::versioned_name): New function.
3360         (Symbol_table::add_to_final_symtab): Use versioned_name when
3361         appropriate.
3362         (Symbol_table::sized_write_symbol): Likewise.
3363         * symtab.h (class Symbol): Declare versioned_name.
3364         * stringpool.h (class Stringpool_template): Add variant of add
3365         which takes a std::basic_string.
3366         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3367         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3368         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3369         (ver_test_12.o): New target.
3370         * testsuite/Makefile.in: Rebuild.
3371
3372 2011-06-27  Doug Kwan  <dougkwan@google.com>
3373
3374         * arm.cc (Arm_relocate_functions::thm_jump8,
3375         Arm_relocate_functions::thm_jump11): Use a wider signed
3376         type to compute offset.
3377         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3378         arm_thm_jump8.
3379         * testsuite/Makefile.in: Regenerate.
3380         * testsuite/arm_branch_in_range.sh: Check test results of
3381         arm_thm_jump11 and arm_thm_jump8.
3382         * testsuite/arm_thm_jump11.s: New test source file.
3383         * testsuite/arm_thm_jump11.t: New linker script.
3384         * testsuite/arm_thm_jump8.s: New test source file.
3385         * testsuite/arm_thm_jump8.t: New linker script.
3386
3387 2011-06-24  Ian Lance Taylor  <iant@google.com>
3388
3389         * layout.cc: Include "object.h".
3390         (ctors_sections_in_init_array): New static variable.
3391         (Layout::is_ctors_in_init_array): New function.
3392         (Layout::layout): Add entry to ctors_sections_in_init_array if
3393         appropriate.
3394         * layout.h (class Layout): Declare is_ctors_in_init_array.
3395         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3396         is_ctors_reverse_view is set.
3397         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3398         all callers.  Set is_ctors_reverse_view field of View_size.
3399         (Sized_relobj_file::reverse_words): New function.
3400         * object.h (Sized_relobj_file::View_size): Add
3401         is_ctors_reverse_view field.
3402         (class Sized_relobj_file): Update declarations.
3403         * testsuite/initpri3.c: New test.
3404         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3405         initpri3b.
3406         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3407         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3408         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3409         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3410         * testsuite/Makefile.in: Rebuild.
3411
3412 2011-06-24  Cary Coutant  <ccoutant@google.com>
3413
3414         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3415         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3416         (debug_msg_cdebug.err): New targets.
3417         * testsuite/Makefile.in: Regenerate.
3418         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3419         Fix checks for link with shared library.
3420
3421 2011-06-24  Doug Kwan  <dougkwan@google.com>
3422
3423         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3424         skip empty text sections.
3425         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3426
3427 2011-06-22  Ian Lance Taylor  <iant@google.com>
3428
3429         PR gold/12910
3430         * options.h (class General_options): Add --ctors-in-init-array.
3431         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3432         friends as SHT_PROGBITS for merging sections.
3433         (Layout::layout): Remove special handling of .init_array and
3434         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3435         and .dtors if ctors_in_init_array.
3436         (Layout::make_output_section): Force correct section types for
3437         .init_array and friends.  Don't sort if doing relocatable link,
3438         Don't sort .ctors and .dtors if ctors_in_init_array.
3439         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3440         (Layout::output_section_name): Add relobj parameter.  Change all
3441         callers.  Handle .ctors. and .dtors. in code rather than table.
3442         Handle .ctors and .dtors if ctors_in_init_array.
3443         (Layout::match_file_name): New function, moved from output.cc.
3444         * layout.h (class Layout): Update declarations.
3445         * output.cc: Include "layout.h".
3446         (Input_section_sort_entry::get_priority): New function.
3447         (Input_section_sort_entry::match_file_name): Just call
3448         Layout::match_file_name.
3449         (Output_section::Input_section_sort_init_fini_compare::operator()):
3450         Handle .ctors and .dtors.  Sort by explicit priority rather than
3451         by name.
3452         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3453         * testsuite/initpri2.c: New test.
3454         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3455         (check_PROGRAMS): Add initpri2.
3456         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3457         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3458         * configure, testsuite/Makefile.in: Rebuild.
3459
3460 2011-06-19  Ian Lance Taylor  <iant@google.com>
3461
3462         PR gold/12880
3463         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3464         .interp section to a PT_INTERP segment even if we have seen a
3465         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3466         clause in a linker script.
3467         (Layout::finalize): Don't create a .interp section if we've
3468         already create a PT_INTERP segment.
3469         (Layout::create_interp): Always call choose_output_section (revert
3470         patch of 2011-06-17).  Don't create PT_INTERP segment.
3471         * script-sections.cc
3472         (Script_sections::create_note_and_tls_segments): Add a .interp
3473         section to a PT_INTERP segment even if we have seen a
3474         --dynamic-linker option.
3475
3476 2011-06-18  Ian Lance Taylor  <iant@google.com>
3477
3478         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3479         merely because a non-PT_LOAD segment has a dynamic reloc.
3480
3481 2011-06-18  Ian Lance Taylor  <iant@google.com>
3482
3483         * layout.cc (Layout::finish_dynamic_section): Don't create
3484         DT_FLAGS entry if not needed.
3485
3486 2011-06-18  Ian Lance Taylor  <iant@google.com>
3487
3488         PR gold/12745
3489         * layout.cc (Layout::layout_eh_frame): Correct handling of
3490         writable .eh_frame section.
3491
3492 2011-06-17  Ian Lance Taylor  <iant@google.com>
3493
3494         PR gold/12893
3495         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3496         symbol is redefined with the exact same object and value.
3497
3498 2011-06-17  Ian Lance Taylor  <iant@google.com>
3499
3500         PR gold/12880
3501         * layout.h (class Layout): Add interp_segment_ field.
3502         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3503         (Layout::attach_allocated_section_to_segment): If making shared
3504         library, put .interp section in PT_INTERP segment.
3505         (Layout::finalize): Also call create_interp if -dynamic-linker
3506         option was used.
3507         (Layout::create_interp): Assert that there is no PT_INTERP
3508         segment.  If not using a SECTIONS clause, use make_output_section.
3509         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3510         * script-sections.cc
3511         (Script_sections::create_note_and_tls_segments): If making shared
3512         library, put .interp section in PT_INTERP segment.
3513
3514 2011-06-17  Ian Lance Taylor  <iant@google.com>
3515
3516         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3517         when making a shared library.
3518
3519 2011-06-17  Ian Lance Taylor  <iant@google.com>
3520
3521         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3522         parameter.  Change all callers.  Don't issue warning about PC32
3523         against locally defined symbol.
3524
3525 2011-06-16  Ian Lance Taylor  <iant@google.com>
3526
3527         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3528         occurs in same object.
3529
3530 2011-06-14  Alan Modra  <amodra@gmail.com>
3531
3532         * po/POTFILES.in: Regenerate.
3533
3534 2011-06-09  Ian Lance Taylor  <iant@google.com>
3535
3536         * script-sections.cc
3537         (Orphan_output_section::set_section_addresses): For a relocatable
3538         link set address to 0.
3539
3540 2011-06-09  Cary Coutant  <ccoutant@google.com>
3541
3542         PR gold/12804
3543         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3544         used with --compress-debug-sections.
3545         * gold/object.cc (Sized_relobj_file::do_layout): Report
3546         uncompressed size of compressed input sections.
3547
3548 2011-06-08  Cary Coutant  <ccoutant@google.com>
3549
3550         PR gold/12804
3551         * testsuite/two_file_test_2_v1.cc: Change initialization of
3552         v2 to keep it in .data.
3553
3554 2011-06-07  Cary Coutant  <ccoutant@google.com>
3555
3556         * common.cc (Symbol_table::do_allocate_commons_list): Call
3557         gold_fallback.
3558         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3559         (Errors::fallback): New function.
3560         (gold_fallback): New function.
3561         * errors.h (Errors::fallback): New function.
3562         * gold.cc (gold_exit): Change status parameter to enum; adjust
3563         all callers.
3564         (queue_initial_tasks): Call gold_fallback.
3565         * gold.h: Include cstdlib.
3566         (Exit_status): New enum type.
3567         (gold_exit): Change status parameter to enum.
3568         (gold_fallback): New function.
3569         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3570         (Layout::create_symtab_sections): Likewise.
3571         (Layout::create_shdrs): Likewise.
3572         * main.cc (main): Adjust call to gold_exit.
3573         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3574         (Output_data_got::add_got_entry_pair): Likewise.
3575         (Output_section::add_input_section): Likewise.
3576         (Output_section::add_output_section_data): Likewise.
3577         (Output_segment::set_section_list_addresses): Likewise.
3578         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3579
3580 2011-06-07  Cary Coutant  <ccoutant@google.com>
3581
3582         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3583         for incremental links.
3584         * output.cc (Output_segment::set_section_list_addresses): Remove
3585         FIXME and test for TLS or BSS.
3586
3587 2011-06-07  Cary Coutant  <ccoutant@google.com>
3588
3589         * testsuite/Makefile.am: Add incremental_copy_test,
3590         incremental_common_test_1.
3591         * testsuite/Makefile.in: Regenerate.
3592         * testsuite/common_test_1_v1.c: New source file.
3593         * testsuite/common_test_1_v2.c: New source file.
3594         * testsuite/copy_test_v1.cc: New source file.
3595
3596 2011-06-07  Cary Coutant  <ccoutant@google.com>
3597
3598         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3599         update, allocate common from bss section's free list.
3600         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3601         linker-defined symbols.
3602         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3603         Skip GOT and PLT entries that are no longer referenced.
3604         (Output_section_incremental_inputs::write_info_blocks): Mark
3605         linker-defined symbols.
3606         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3607         * output.cc (Output_section::allocate): New function.
3608         * output.h (Output_section::allocate): New function.
3609         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3610         linker-defined symbols.
3611         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3612         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3613         (Symbol::init_base_output_data): Likewise.
3614         (Symbol::init_base_output_segment): Likewise.
3615         (Symbol::init_base_constant): Likewise.
3616         (Sized_symbol::init_output_data): Likewise.
3617         (Sized_symbol::init_output_segment): Likewise.
3618         (Sized_symbol::init_constant): Likewise.
3619         (Symbol_table::do_define_in_output_data): Likewise.
3620         (Symbol_table::do_define_in_output_segment): Likewise.
3621         (Symbol_table::do_define_as_constant): Likewise.
3622         * symtab.h (Symbol::is_predefined): New function.
3623         (Symbol::init_base_output_data): Add is_predefined parameter.
3624         (Symbol::init_base_output_segment): Likewise.
3625         (Symbol::init_base_constant): Likewise.
3626         (Symbol::is_predefined_): New data member.
3627         (Sized_symbol::init_output_data): Add is_predefined parameter.
3628         (Sized_symbol::init_output_segment): Likewise.
3629         (Sized_symbol::init_constant): Likewise.
3630         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3631
3632 2011-06-07  Cary Coutant  <ccoutant@google.com>
3633
3634         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3635         instead of emit_copy_reloc.
3636         (Copy_relocs::emit_copy_reloc): Refactor.
3637         (Copy_relocs::make_copy_reloc): New function.
3638         (Copy_relocs::add_copy_reloc): Remove.
3639         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3640         section.
3641         (Copy_relocs::make_copy_reloc): New function.
3642         (Copy_relocs::add_copy_reloc): Remove.
3643         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3644         unchanged input files.
3645         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3646         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3647         Reserve BSS space for COPY relocations.
3648         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3649         (Output_section_incremental_inputs::write_info_blocks): Record
3650         whether a symbol is copied from a shared object.
3651         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3652         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3653         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3654         (Incremental_input_entry_reader::get_output_symbol_index): Add
3655         is_copy parameter.
3656         (Incremental_binary::emit_copy_relocs): New function.
3657         (Incremental_binary::do_emit_copy_relocs): New function.
3658         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3659         new data member.
3660         (Sized_incremental_binary::add_copy_reloc): New function.
3661         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3662         (Sized_incremental_binary::Copy_reloc): New struct.
3663         (Sized_incremental_binary::Copy_relocs): New typedef.
3664         (Sized_incremental_binary::copy_relocs_): New data member.
3665         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3666         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3667         * target.h (Sized_target::emit_copy_reloc): New function.
3668         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3669
3670 2011-06-02  Cary Coutant  <ccoutant@google.com>
3671
3672         PR gold/12163
3673         * gold/archive.cc (Archive::Archive): Initialize new data member.
3674         (Archive::include_all_members): Return if archive has already been
3675         included.
3676         * gold/archive.h (Archive::include_all_members_): New data member.
3677
3678 2011-06-02  Nick Clifton  <nickc@redhat.com>
3679
3680         * dynobj.h: Fix spelling mistake in comment.
3681         * output.cc: Likewise.
3682
3683 2011-05-31  Doug Kwan  <dougkwan@google.com>
3684             Asier Llano
3685
3686         PR gold/12826
3687         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3688         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3689         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3690         redundant arm_exidx_test.so.
3691         * testsuite/Makefile.in: Regenerate.
3692         (check_SCRIPTS): Add pr12826.sh
3693         (check_DATA): Add pr12826.stdout
3694         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3695         * testsuite/pr12826.sh: New file.
3696         * testsuite/pr12826_1.s: Ditto.
3697         * testsuite/pr12826_1.s: Ditto.
3698
3699 2011-05-30  Ian Lance Taylor  <iant@google.com>
3700
3701         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3702         sections.
3703
3704 2011-05-29  Ian Lance Taylor  <iant@google.com>
3705
3706         PR gold/12804
3707         * testsuite/Makefile.am: Use different file name for two_file_test
3708         temporary file for each incremental test.
3709         * testsuite/Makefile.in: Rebuild.
3710
3711 2011-05-29  Ian Lance Taylor  <iant@google.com>
3712
3713         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3714         binary input file is empty.
3715
3716 2011-05-27  Ian Lance Taylor  <iant@google.com>
3717
3718         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3719         (ver_test_9.so): Likewise.
3720         * testsuite/Makefile.in: Rebuild.
3721
3722 2011-05-26 Cary Coutant  <ccoutant@google.com>
3723
3724         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3725         * incremental.cc (Incremental_inputs::report_input_section): Fix
3726         comment, indentation.
3727         (Incremental_inputs::report_comdat_group): New function.
3728         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3729         of data for incremental input file entry.
3730         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3731         group count, COMDAT group signatures.
3732         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3733         an unchanged input file.
3734         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3735         Initialize new data member.
3736         (Incremental_object_entry::add_comdat_group): New function.
3737         (Incremental_object_entry::get_comdat_group_count): New function.
3738         (Incremental_object_entry::get_comdat_signature_key): New function.
3739         (Incremental_object_entry::groups_): New data member.
3740         (Incremental_inputs::report_comdat_group): New function.
3741         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3742         data for incremental input file entry.
3743         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3744         (Incremental_input_entry_reader::get_input_section): Adjust size of
3745         data for incremental input file entry.
3746         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3747         (Incremental_input_entry_reader::get_comdat_group_signature): New
3748         function.
3749         * object.cc (Sized_relobj::include_section_group): Report kept
3750         COMDAT groups for incremental links.
3751
3752 2011-05-24  David Meyer  <pdox@google.com>
3753
3754         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3755         with name parameter.  Add found_name parameter.
3756         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3757         * dirsearch.h (class Dirsearch): Update declaration.
3758
3759 2011-05-24  Ian Lance Taylor  <iant@google.com>
3760
3761         * archive.cc (Library_base::should_include_member): Pull in object
3762         from archive if it defines the entry symbol.
3763         * parameters.cc (Parameters::entry): New function.
3764         * parameters.h (class Parameters): Declare entry.
3765         * output.h (class Output_file_header): Remove entry_ field.
3766         * output.cc (Output_file_header::Output_file_header): Remove entry
3767         parameter.  Change all callers.
3768         (Output_file_header::entry): Use parameters->entry.
3769         * gold.cc (queue_middle_tasks): Likewise.
3770         * plugin.cc (Plugin_hook::run): Likewise.
3771
3772 2011-05-24 Cary Coutant  <ccoutant@google.com>
3773
3774         * gold.cc (queue_initial_tasks): Pass incremental base filename
3775         to Output_file::open_base_file; don't print error message.
3776         * incremental-dump.cc (main): Adjust call to
3777         Output_file::open_for_modification.
3778         * incremental-dump.cc (main): Likewise.
3779         * incremental.cc (Incremental_inputs::report_command_line):
3780         Ignore --incremental-base option when comparing command lines.
3781         Ignore parameter when given as separate argument.
3782         * options.h (class General_options): Add --incremental-base.
3783         * output.cc (Output_file::Output_file):
3784         (Output_file::open_base_file): Add base_name and writable parameters;
3785         read base file into new file; print error message here.
3786         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3787         callers.
3788         * output.h (Output_file::open_for_modification): Rename to...
3789         (Output_file::open_base_file): ...this; add base_name and
3790         writable parameters; adjust all callers.
3791         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3792         callers.
3793         * testsuite/Makefile.am (incremental_test_4): Test
3794         --incremental-base.
3795         * testsuite/Makefile.in: Regenerate.
3796
3797 2011-05-24 Cary Coutant  <ccoutant@google.com>
3798
3799         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3800         incremental_test_4.
3801         * testsuite/Makefile.in: Regenerate.
3802         * testsuite/two_file_test_1_v1.cc: New test source file.
3803         * testsuite/two_file_test_1b_v1.cc: New test source file.
3804         * testsuite/two_file_test_2_v1.cc: New test source file.
3805
3806 2011-05-24 Cary Coutant  <ccoutant@google.com>
3807
3808         * dynobj.h (Dynobj::do_dynobj): New function.
3809         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3810         flag and soname for shared objects.
3811         * incremental.cc (Incremental_inputs::report_object): Make
3812         either Incremental_object_entry or Incremental_dynobj_entry; add
3813         soname to string table.
3814         (Incremental_inputs::report_input_section): Add assertion.
3815         (Output_section_incremental_inputs::set_final_data_size): Adjust
3816         type of input file entry for shared libraries; adjust size of
3817         shared library info entry.
3818         (Output_section_incremental_inputs::write_input_files): Write
3819         as_needed flag for shared libraries.
3820         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3821         of input file entry for shared libraries; write soname.
3822         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3823         soname from incremental info.
3824         * incremental.h (enum Incremental_input_flags): Add
3825         INCREMENTAL_INPUT_AS_NEEDED.
3826         (Incremental_input_entry::Incremental_input_entry): Initialize new
3827         data member.
3828         (Incremental_input_entry::set_as_needed): New function.
3829         (Incremental_input_entry::as_needed): New function.
3830         (Incremental_input_entry::do_dynobj_entry): New function.
3831         (Incremental_input_entry::as_needed_): New data member.
3832         (Incremental_object_entry::Incremental_object_entry): Don't check
3833         for shared library.
3834         (Incremental_object_entry::do_type): Likewise.
3835         (class Incremental_dynobj_entry): New class.
3836         (Incremental_input_entry_reader::as_needed): New function.
3837         (Incremental_input_entry_reader::get_soname): New function.
3838         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3839         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3840         size of shared library info entry.
3841         * layout.cc (Layout::finish_dynamic_section): Don't test for
3842         incremental link when adding DT_NEEDED entries.
3843         * object.h (Object::Object): Initialize new data member.
3844         (Object::dynobj): New function.
3845         (Object::set_as_needed): New function.
3846         (Object::as_needed): New function.
3847         (Object::do_dynobj): New function.
3848         (Object::as_needed_): New data member.
3849
3850 2011-05-24 Cary Coutant  <ccoutant@google.com>
3851
3852         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3853         info; adjust display of GOT entries.
3854         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3855         vector of input objects; remove file_status_.
3856         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3857         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3858         got_plt reader; call target hooks to reserve GOT entries.
3859         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3860         of input file info header and GOT info entry.
3861         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3862         relocation info.
3863         (Got_plt_view_info::got_descriptor): Remove.
3864         (Got_plt_view_info::sym_index): New data member.
3865         (Got_plt_view_info::input_index): New data member.
3866         (Local_got_offset_visitor::visit): Write input file index.
3867         (Global_got_offset_visitor::visit): Write 0 for input file index.
3868         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3869         with sym_index and input_index.
3870         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3871         incremental info GOT entry; replace got_descriptor with input_index.
3872         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3873         map from input file index to object.
3874         (Sized_relobj_incr::do_layout): Replace direct data member reference
3875         with accessor function.
3876         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3877         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3878         Adjust size of input file info header.
3879         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3880         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3881         (Incremental_input_entry_reader::get_input_section): Adjust size of
3882         input file info header.
3883         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3884         of incremental info GOT entry.
3885         (Incremental_got_plt_reader::get_got_desc): Remove.
3886         (Incremental_got_plt_reader::get_got_symndx): New function.
3887         (Incremental_got_plt_reader::get_got_input_index): New function.
3888         (Sized_incremental_binary::Sized_incremental_binary): Remove
3889         file_status_; add input_objects_.
3890         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3891         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3892         (Sized_incremental_binary::file_is_unchanged): Remove.
3893         (Sized_incremental_binary::set_input_object): New function.
3894         (Sized_incremental_binary::input_object): New function.
3895         (Sized_incremental_binary::file_status_): Remove.
3896         (Sized_incremental_binary::input_objects_): New data member.
3897         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3898         references.
3899         (Sized_relobj_incr::invalid_address): Move to base class.
3900         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3901         class.
3902         (Sized_relobj_incr::do_output_section_offset): Likewise.
3903         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3904         (Sized_relobj_incr::section_offsets_): Likewise.
3905         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3906         function.
3907         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3908         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3909         with accessor function.
3910         (Sized_relobj_file::do_layout): Likewise.
3911         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3912         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3913         (Sized_relobj_file::compute_final_local_value): Replace refs to
3914         section_offsets_ with accessor function.
3915         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3916         * object.h (Relobj::Relobj): Initialize new data members.
3917         (Relobj::add_dyn_reloc): New function.
3918         (Relobj::first_dyn_reloc): New function.
3919         (Relobj::dyn_reloc_count): New function.
3920         (Relobj::first_dyn_reloc_): New data member.
3921         (Relobj::dyn_reloc_count_): New data member.
3922         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3923         references.
3924         (Sized_relobj::Address): New typedef.
3925         (Sized_relobj::invalid_address): Move here from child class.
3926         (Sized_relobj::Sized_relobj): Initialize new data members.
3927         (Sized_relobj::sized_relobj): New function.
3928         (Sized_relobj::is_output_section_offset_invalid): Move here from
3929         child class.
3930         (Sized_relobj::get_output_section_offset): Likewise.
3931         (Sized_relobj::local_has_got_offset): Likewise.
3932         (Sized_relobj::local_got_offset): Likewise.
3933         (Sized_relobj::set_local_got_offset): Likewise.
3934         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3935         (Sized_relobj::clear_got_offsets): New function.
3936         (Sized_relobj::section_offsets): Move here from child class.
3937         (Sized_relobj::do_output_section_offset): Likewise.
3938         (Sized_relobj::do_set_section_offset): Likewise.
3939         (Sized_relobj::Local_got_offsets): Likewise.
3940         (Sized_relobj::local_got_offsets_): Likewise.
3941         (Sized_relobj::section_offsets_): Likewise.
3942         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3943         references.
3944         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3945         class.
3946         (Sized_relobj_file::sized_relobj): New function
3947         (Sized_relobj_file::local_has_got_offset): Move to base class.
3948         (Sized_relobj_file::local_got_offset): Likewise.
3949         (Sized_relobj_file::set_local_got_offset): Likewise.
3950         (Sized_relobj_file::get_output_section_offset): Likewise.
3951         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3952         (Sized_relobj_file::do_output_section_offset): Likewise.
3953         (Sized_relobj_file::do_set_section_offset): Likewise.
3954         (Sized_relobj_file::Local_got_offsets): Likewise.
3955         (Sized_relobj_file::local_got_offsets_): Likewise.
3956         (Sized_relobj_file::section_offsets_): Likewise.
3957         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3958         (all constructors).
3959         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3960         (Output_reloc::get_symbol_index): Likewise.
3961         (Output_reloc::local_section_offset): Likewise.
3962         (Output_reloc::get_address): Likewise.
3963         (Output_reloc::symbol_value): Likewise.
3964         (Output_data_got::reserve_slot): Move to class definition.
3965         (Output_data_got::reserve_local): New function.
3966         (Output_data_got::reserve_slot_for_global): Remove.
3967         (Output_data_got::reserve_global): New function.
3968         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3969         (all constructors, two instantiations).
3970         (Output_reloc::get_relobj): New function (two instantiations).
3971         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3972         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3973         (Output_data_reloc::add_global): Adjust type of relobj.
3974         (Output_data_reloc::add_global_relative): Likewise.
3975         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3976         (Output_data_reloc::add_local): Likewise.
3977         (Output_data_reloc::add_local_relative): Likewise.
3978         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3979         (Output_data_reloc::add_local_section): Likewise.
3980         (Output_data_reloc::add_output_section): Likewise.
3981         (Output_data_reloc::add_absolute): Likewise.
3982         (Output_data_reloc::add_target_specific): Likewise.
3983         (Output_data_got::reserve_slot): Move definition here.
3984         (Output_data_got::reserve_local): New function.
3985         (Output_data_got::reserve_global): New function.
3986         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3987         section_offsets_ with accessor function.
3988         (Sized_relobj_file::write_sections): Likewise.
3989         (Sized_relobj_file::do_relocate_sections): Likewise.
3990         * target.h (Sized_target::reserve_local_got_entry): New function.
3991         (Sized_target::reserve_global_got_entry): New function.
3992         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3993         (Target_x86_64::reserve_global_got_entry): New function.
3994         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3995
3996 2011-05-23 Cary Coutant  <ccoutant@google.com>
3997
3998         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3999         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4000         bit when checking got_type.
4001         * incremental.cc (Sized_incremental_binary::setup_readers):
4002         Store symbol table and string table locations; initialize bit vector
4003         of file status flags.
4004         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4005         unchanged files.
4006         (Sized_incremental_binary::do_process_got_plt): New function.
4007         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4008         (Output_section_incremental_inputs::set_final_data_size): Record
4009         file index for each input file.
4010         (Output_section_incremental_inputs::write_got_plt): Store file index
4011         instead of input entry offset for each GOT entry.
4012         * incremental.h
4013         (Incremental_input_entry::Incremental_input_entry): Initialize new
4014         data member.
4015         (Incremental_input_entry::set_offset): Store file index.
4016         (Incremental_input_entry::get_file_index): New function.
4017         (Incremental_input_entry::file_index_): New data member.
4018         (Incremental_binary::process_got_plt): New function.
4019         (Incremental_binary::do_process_got_plt): New function.
4020         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4021         data members.
4022         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4023         (Sized_incremental_binary::set_file_is_unchanged): New function.
4024         (Sized_incremental_binary::file_is_unchanged): New function.
4025         (Sized_incremental_binary::do_process_got_plt): New function.
4026         (Sized_incremental_binary::file_status_): New data member.
4027         (Sized_incremental_binary::main_symtab_loc_): New data member.
4028         (Sized_incremental_binary::main_strtab_loc_): New data member.
4029         * output.cc (Output_data_got::Got_entry::write): Add case
4030         RESERVED_CODE.
4031         (Output_data_got::add_global): Call add_got_entry.
4032         (Output_data_got::add_global_plt): Likewise.
4033         (Output_data_got::add_global_with_rel): Likewise.
4034         (Output_data_got::add_global_with_rela): Likewise.
4035         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4036         (Output_data_got::add_global_pair_with_rela): Likewise.
4037         (Output_data_got::add_local): Call add_got_entry.
4038         (Output_data_got::add_local_plt): Likewise.
4039         (Output_data_got::add_local_with_rel): Likewise.
4040         (Output_data_got::add_local_with_rela): Likewise.
4041         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4042         (Output_data_got::add_local_pair_with_rela): Likewise.
4043         (Output_data_got::reserve_slot): New function.
4044         (Output_data_got::reserve_slot_for_global): New function.
4045         (Output_data_got::add_got_entry): New function.
4046         (Output_data_got::add_got_entry_pair): New function.
4047         (Output_section::add_output_section_data): Edit FIXME.
4048         * output.h
4049         (Output_section_data_build::Output_section_data_build): New
4050         constructor with size parameter.
4051         (Output_data_space::Output_data_space): Likewise.
4052         (Output_data_got::Output_data_got): Initialize new data member; new
4053         constructor with size parameter.
4054         (Output_data_got::add_constant): Call add_got_entry.
4055         (Output_data_got::reserve_slot): New function.
4056         (Output_data_got::reserve_slot_for_global): New function.
4057         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4058         (Output_data_got::add_got_entry): New function.
4059         (Output_data_got::add_got_entry_pair): New function.
4060         (Output_data_got::free_list_): New data member.
4061         * target.h (Sized_target::init_got_plt_for_update): New function.
4062         (Sized_target::register_global_plt_entry): New function.
4063         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4064         Initialize new data member; call init; add constructor with PLT count.
4065         (Output_data_plt_x86_64::init): New function.
4066         (Output_data_plt_x86_64::add_relocation): New function.
4067         (Output_data_plt_x86_64::reserve_slot): New function.
4068         (Output_data_plt_x86_64::free_list_): New data member.
4069         (Target_x86_64::init_got_plt_for_update): New function.
4070         (Target_x86_64::register_global_plt_entry): New function.
4071         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4072         incremental updates.
4073         (Output_data_plt_x86_64::add_relocation): New function.
4074         * testsuite/object_unittest.cc (Object_test): Set default options.
4075
4076 2011-05-16  Ian Lance Taylor  <iant@google.com>
4077
4078         * options.h (class General_options): Make -i a synonym for -r.
4079
4080 2011-05-16  Ian Lance Taylor  <iant@google.com>
4081
4082         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4083
4084 2011-05-10 Cary Coutant  <ccoutant@google.com>
4085
4086         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4087         strip_all (-s).
4088
4089 2011-05-06  Ian Lance Taylor  <iant@google.com>
4090
4091         * layout.cc (Layout::layout): If the output section flags change,
4092         update the ordering.
4093
4094 2011-04-25 Cary Coutant  <ccoutant@google.com>
4095
4096         * incremental-dump.cc (dump_incremental_inputs): Print local
4097         symbol info for each input file.
4098         * incremental.cc
4099         (Output_section_incremental_inputs::set_final_data_size): Add local
4100         symbol info to input file entries in incremental info.
4101         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4102         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4103         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4104         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4105         implementation.
4106         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4107         (Sized_incr_relobj::do_relocate): Write the local symbols.
4108         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4109         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4110         Adjust size of input file header.
4111         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4112         (Incremental_inputs_reader::get_local_symbol_count): New function.
4113         (Incremental_inputs_reader::get_input_section): Adjust size of input
4114         file header.
4115         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4116         (Sized_incr_relobj::This): New typedef.
4117         (Sized_incr_relobj::sym_size): New const data member.
4118         (Sized_incr_relobj::Local_symbol): New struct.
4119         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4120         (Sized_incr_relobj::do_local_symbol_offset): New function.
4121         (Sized_incr_relobj::local_symbol_count_): New data member.
4122         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4123         (Sized_incr_relobj::local_symbol_index_): New data member.
4124         (Sized_incr_relobj::local_symbol_offset_): New data member.
4125         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4126         (Sized_incr_relobj::local_symbols_): New data member.
4127         * object.h (Relobj::output_local_symbol_count): New function.
4128         (Relobj::local_symbol_offset): New function.
4129         (Relobj::do_output_local_symbol_count): New function.
4130         (Relobj::do_local_symbol_offset): New function.
4131         (Sized_relobj::do_output_local_symbol_count): New function.
4132         (Sized_relobj::do_local_symbol_offset): New function.
4133
4134 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4135
4136         * descriptors.cc (set_close_on_exec): New function.
4137         (Descriptors::open): Use set_close_on_exec.
4138         * output.cc (S_ISLNK): Define if not defined.
4139
4140 2011-04-22 Cary Coutant  <ccoutant@google.com>
4141
4142         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4143         global symbol map.
4144         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4145         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4146         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4147         relocations.
4148         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4149         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4150         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4151         * incremental.h
4152         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4153         function.
4154         (Incremental_binary::apply_incremental_relocs): New function.
4155         (Incremental_binary::do_apply_incremental_relocs): New function.
4156         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4157         data member.
4158         (Sized_incremental_binary::add_global_symbol): New function.
4159         (Sized_incremental_binary::global_symbol): New function.
4160         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4161         (Sized_incremental_binary::symbol_map_): New data member.
4162         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4163         * target.h (Sized_target::apply_relocation): New function.
4164         * target-reloc.h (apply_relocation): New function.
4165         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4166
4167 2011-04-22  Doug Kwan  <dougkwan@google.com>
4168
4169         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4170         flag of a SHT_ARM_EXIDX section.
4171         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4172         * testsuite/Makefile.in: Regenerate.
4173         * testsuite/arm_exidx_test.s: New file.
4174         * testsuite/arm_exidx_test.sh: Same.
4175
4176 2011-04-20 Cary Coutant  <ccoutant@google.com>
4177
4178         PR gold/12689
4179         * archive.h (Incremental_archive_entry::Archive_member):
4180         Initialize arg_serial_ (second constructor).
4181
4182 2011-04-17  Ian Lance Taylor  <iant@google.com>
4183
4184         * object.cc (Relocate_info::location): Simplify location string.
4185         * errors.cc (Errors::error_at_location): Don't print program
4186         name.
4187         (Errors::warning_at_location): Likewise.
4188         (Errors::undefined_symbol): Likewise.
4189         * testsuite/debug_msg.sh: Update accordingly.
4190
4191 2011-04-14 Cary Coutant  <ccoutant@google.com>
4192
4193         * gold/layout.cc (Layout::symtab_section_offset): New function.
4194         * gold/layout.h (Layout::symtab_section_offset): New function.
4195         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4196
4197 2011-04-12  Ian Lance Taylor  <iant@google.com>
4198
4199         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4200         with MREMAP_MAYMOVE.
4201         * output.h (class Output_file): Add map_is_allocated_ field.
4202         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4203         not available, provide stubs.  If mremap is not available, #define
4204         it to gold_mremap.
4205         (MREMAP_MAYMOVE): Define if not defined.
4206         (Output_file::Output_file): Initialize map_is_allocated_.
4207         (Output_file::resize): Check map_is_allocated_.
4208         (Output_file::map_anonymous): If mmap fails, use malloc.
4209         (Output_file::unmap): Don't do anything for an anonymous map.
4210         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4211         is not available, provide stubs.
4212         (File_read::View::~View): Use free rather than delete[].
4213         (File_read::make_view): Use malloc rather than new[].  If mmap
4214         fails, use malloc.
4215         (File_read::find_or_make_view): Use malloc rather than new[].
4216         * gold.h: Remove HAVE_REMAP code.
4217         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4218         exists.  Rename mremap to gold_mremap.  If mmap is not available
4219         don't do anything.
4220         * configure, config.in: Rebuild.
4221
4222 2011-04-11  Ian Lance Taylor  <iant@google.com>
4223
4224         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4225         initialize local variable v.
4226
4227 2011-04-11  Cary Coutant  <ccoutant@google.com>
4228
4229         * archive.cc (Archive::include_member): Adjust call to
4230         report_object.
4231         (Add_archive_symbols::run): Track argument serial numbers.
4232         (Lib_group::include_member): Likewise.
4233         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4234         * archive.h (Incremental_archive_entry::Archive_member):
4235         Initialize arg_serial_.
4236         (Archive_member::arg_serial_): New data member.
4237         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4238         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4239         incremental link.
4240         (Sized_dynobj::do_for_all_local_got_entries): New function.
4241         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4242         function.
4243         * fileread.cc (get_mtime): New function.
4244         * fileread.h (get_mtime): New function.
4245         * gold.cc (queue_initial_tasks): Check for incremental update.
4246         (process_incremental_input): New function.
4247         (queue_middle_tasks): Don't force valid target for incremental
4248         update.
4249         * incremental-dump.cc (find_input_containing_global): Adjust
4250         size of symbol info entry.
4251         (dump_incremental_inputs): Dump argument serial number and
4252         in_system_directory flag; bias shndx by 1; print symbol names
4253         when dumping per-file symbol lists; use new symbol info readers.
4254         * incremental.cc
4255         (Output_section_incremental_inputs:update_data_size): New function.
4256         (Sized_incremental_binary::setup_readers): Setup input readers
4257         for each input file; build maps for files added from libraries
4258         and scripts.
4259         (Sized_incremental_binary::check_input_args): New function.
4260         (Sized_incremental_binary::do_check_inputs): Build map of argument
4261         serial numbers to input arguments.
4262         (Sized_incremental_binary::do_file_has_changed): Rename
4263         do_file_is_unchanged to this; compare file modification times.
4264         (Sized_incremental_binary::do_init_layout): New function.
4265         (Sized_incremental_binary::do_reserve_layout): New function.
4266         (Sized_incremental_binary::do_get_input_reader): Remove.
4267         (Sized_incremental_binary::get_symtab_view): New function.
4268         (Incremental_checker::can_incrementally_link_output_file): Remove.
4269         (Incremental_inputs::report_command_line): Exclude --debug options.
4270         (Incremental_inputs::report_archive_begin): Add parameter; track
4271         argument serial numbers; don't put input file entry for archive
4272         before archive members.
4273         (Incremental_inputs::report_archive_end): Put input file entry
4274         for archive after archive members.
4275         (Incremental_inputs::report_object): Add parameter; track argument
4276         serial numbers and in_system_directory flag.
4277         (Incremental_inputs::report_script): Add parameter; track argument
4278         serial numbers.
4279         (Output_section_incremental_inputs::set_final_data_size): Adjust
4280         size of symbol info entry; check for forwarding symbols.
4281         (Output_section_incremental_inputs::write_input_files): Write
4282         in_system_directory flag and argument serial number.
4283         (Output_section_incremental_inputs::write_info_blocks): Map section
4284         indices between incremental info and original input file; store
4285         input section index for each symbol.
4286         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4287         change operator() to visit().
4288         (class Global_got_offset_visitor): Likewise.
4289         (class Global_symbol_visitor_got_plt):
4290         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4291         classes.
4292         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4293         (Sized_incr_relobj::do_read_symbols): New function.
4294         (Sized_incr_relobj::do_layout): New function.
4295         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4296         (Sized_incr_relobj::do_add_symbols): New function.
4297         (Sized_incr_relobj::do_should_include_member): New function.
4298         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4299         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4300         (Sized_incr_relobj::do_section_size): New function.
4301         (Sized_incr_relobj::do_section_name): New function.
4302         (Sized_incr_relobj::do_section_contents): New function.
4303         (Sized_incr_relobj::do_section_flags): New function.
4304         (Sized_incr_relobj::do_section_entsize): New function.
4305         (Sized_incr_relobj::do_section_address): New function.
4306         (Sized_incr_relobj::do_section_type): New function.
4307         (Sized_incr_relobj::do_section_link): New function.
4308         (Sized_incr_relobj::do_section_info): New function.
4309         (Sized_incr_relobj::do_section_addralign): New function.
4310         (Sized_incr_relobj::do_initialize_xindex): New function.
4311         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4312         (Sized_incr_relobj::do_read_relocs): New function.
4313         (Sized_incr_relobj::do_gc_process_relocs): New function.
4314         (Sized_incr_relobj::do_scan_relocs): New function.
4315         (Sized_incr_relobj::do_count_local_symbols): New function.
4316         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4317         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4318         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4319         (Sized_incr_relobj::do_relocate): New function.
4320         (Sized_incr_relobj::do_set_section_offset): New function.
4321         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4322         (Sized_incr_dynobj::do_read_symbols): New function.
4323         (Sized_incr_dynobj::do_layout): New function.
4324         (Sized_incr_dynobj::do_add_symbols): New function.
4325         (Sized_incr_dynobj::do_should_include_member): New function.
4326         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4327         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4328         (Sized_incr_dynobj::do_section_size): New function.
4329         (Sized_incr_dynobj::do_section_name): New function.
4330         (Sized_incr_dynobj::do_section_contents): New function.
4331         (Sized_incr_dynobj::do_section_flags): New function.
4332         (Sized_incr_dynobj::do_section_entsize): New function.
4333         (Sized_incr_dynobj::do_section_address): New function.
4334         (Sized_incr_dynobj::do_section_type): New function.
4335         (Sized_incr_dynobj::do_section_link): New function.
4336         (Sized_incr_dynobj::do_section_info): New function.
4337         (Sized_incr_dynobj::do_section_addralign): New function.
4338         (Sized_incr_dynobj::do_initialize_xindex): New function.
4339         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4340         (make_sized_incremental_object): New function.
4341         (Incremental_library::copy_unused_symbols): New function.
4342         (Incremental_library::do_for_all_unused_symbols): New function.
4343         * incremental.h (enum Incremental_input_flags): New type.
4344         (class Incremental_checker): Remove.
4345         (Incremental_input_entry::Incremental_input_entry): Add argument
4346         serial number.
4347         (Incremental_input_entry::arg_serial): New function.
4348         (Incremental_input_entry::set_is_in_system_directory): New function.
4349         (Incremental_input_entry::is_in_system_directory): New function.
4350         (Incremental_input_entry::arg_serial_): New data member.
4351         (Incremental_input_entry::is_in_system_directory_): New data member.
4352         (class Script_info): Move here from script.h.
4353         (Script_info::Script_info): Add filename parameter.
4354         (Script_info::filename): New function.
4355         (Script_info::filename_): New data member.
4356         (Incremental_script_entry::Incremental_script_entry): Add argument
4357         serial number.
4358         (Incremental_object_entry::Incremental_object_entry): Likewise.
4359         (Incremental_object_entry::add_input_section): Build list of input
4360         sections with map to original shndx.
4361         (Incremental_object_entry::get_input_section_index): New function.
4362         (Incremental_object_entry::shndx_): New data member.
4363         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4364         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4365         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4366         serial number.
4367         (Incremental_inputs::report_archive_begin): Likewise.
4368         (Incremental_inputs::report_object): Likewise.
4369         (Incremental_inputs::report_script): Likewise.
4370         (class Incremental_global_symbol_reader): New class.
4371         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4372         and store flags and input file type.
4373         (Incremental_input_entry_reader::arg_serial): New function.
4374         (Incremental_input_entry_reader::type): Extract type from flags.
4375         (Incremental_input_entry_reader::is_in_system_directory): New function.
4376         (Incremental_input_entry_reader::get_input_section_count): Call
4377         accessor function for type.
4378         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4379         function for type; adjust size of global symbol entry.
4380         (Incremental_input_entry_reader::get_global_symbol_count): Call
4381         accessor function for type.
4382         (Incremental_input_entry_reader::get_object_count): Likewise.
4383         (Incremental_input_entry_reader::get_object_offset): Likewise.
4384         (Incremental_input_entry_reader::get_member_count): Likewise.
4385         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4386         (Incremental_input_entry_reader::get_member_offset): Likewise.
4387         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4388         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4389         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4390         (Incremental_input_entry_reader::get_global_symbol_reader): New
4391         function.
4392         (Incremental_input_entry_reader::get_output_symbol_index): New
4393         function.
4394         (Incremental_input_entry_reader::type_): Remove.
4395         (Incremental_input_entry_reader::flags_): New data member.
4396         (Incremental_inputs_reader::input_file_offset): New function.
4397         (Incremental_inputs_reader::input_file_index): New function.
4398         (Incremental_inputs_reader::input_file): Call input_file_offset.
4399         (Incremental_inputs_reader::input_file_at_offset): New function.
4400         (Incremental_relocs_reader::get_r_type): Reformat.
4401         (Incremental_relocs_reader::get_r_shndx): Reformat.
4402         (Incremental_relocs_reader::get_r_offset): Reformat.
4403         (Incremental_relocs_reader::data): New function.
4404         (Incremental_binary::Incremental_binary): Initialize new data members.
4405         (Incremental_binary::check_inputs): Add cmdline parameter.
4406         (Incremental_binary::file_is_unchanged): Remove.
4407         (Input_reader::arg_serial): New function.
4408         (Input_reader::get_unused_symbol_count): New function.
4409         (Input_reader::get_unused_symbol): New function.
4410         (Input_reader::do_arg_serial): New function.
4411         (Input_reader::do_get_unused_symbol_count): New function.
4412         (Input_reader::do_get_unused_symbol): New function.
4413         (Incremental_binary::input_file_count): New function.
4414         (Incremental_binary::get_input_reader): Change signature to use
4415         index instead of filename.
4416         (Incremental_binary::file_has_changed): New function.
4417         (Incremental_binary::get_input_argument): New function.
4418         (Incremental_binary::get_library): New function.
4419         (Incremental_binary::get_script_info): New function.
4420         (Incremental_binary::init_layout): New function.
4421         (Incremental_binary::reserve_layout): New function.
4422         (Incremental_binary::output_file): New function.
4423         (Incremental_binary::do_check_inputs): New function.
4424         (Incremental_binary::do_file_is_unchanged): Remove.
4425         (Incremental_binary::do_file_has_changed): New function.
4426         (Incremental_binary::do_init_layout): New function.
4427         (Incremental_binary::do_reserve_layout): New function.
4428         (Incremental_binary::do_input_file_count): New function.
4429         (Incremental_binary::do_get_input_reader): Change signature.
4430         (Incremental_binary::input_args_map_): New data member.
4431         (Incremental_binary::library_map_): New data member.
4432         (Incremental_binary::script_map_): New data member.
4433         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4434         new data members.
4435         (Sized_incremental_binary::output_section): New function.
4436         (Sized_incremental_binary::inputs_reader): Add const.
4437         (Sized_incremental_binary::symtab_reader): Add const.
4438         (Sized_incremental_binary::relocs_reader): Add const.
4439         (Sized_incremental_binary::got_plt_reader): Add const.
4440         (Sized_incremental_binary::get_symtab_view): New function.
4441         (Sized_incremental_binary::Inputs_reader): New typedef.
4442         (Sized_incremental_binary::Input_entry_reader): New typedef.
4443         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4444         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4445         (Sized_incremental_binary::do_file_has_changed): New function.
4446         (Sized_incremental_binary::do_init_layout): New function.
4447         (Sized_incremental_binary::do_reserve_layout): New function.
4448         (Sized_input_reader::Inputs_reader): Remove.
4449         (Sized_input_reader::Input_entry_reader): Remove.
4450         (Sized_input_reader::do_arg_serial): New function.
4451         (Sized_input_reader::do_get_unused_symbol_count): New function.
4452         (Sized_input_reader::do_get_unused_symbol): New function.
4453         (Sized_incremental_binary::do_input_file_count): New function.
4454         (Sized_incremental_binary::do_get_input_reader): Change signature;
4455         use index instead of filename.
4456         (Sized_incremental_binary::section_map_): New data member.
4457         (Sized_incremental_binary::input_entry_readers_): New data member.
4458         (class Sized_incr_relobj): New class.
4459         (class Sized_incr_dynobj): New class.
4460         (make_sized_incremental_object): New function.
4461         (class Incremental_library): New class.
4462         * layout.cc (Free_list::num_lists): New static data member.
4463         (Free_list::num_nodes): New static data member.
4464         (Free_list::num_removes): New static data member.
4465         (Free_list::num_remove_visits): New static data member.
4466         (Free_list::num_allocates): New static data member.
4467         (Free_list::num_allocate_visits): New static data member.
4468         (Free_list::init): New function.
4469         (Free_list::remove): New function.
4470         (Free_list::allocate): New function.
4471         (Free_list::dump): New function.
4472         (Free_list::print_stats): New function.
4473         (Layout_task_runner::run): Resize output file for incremental updates.
4474         (Layout::Layout): Initialize new data members.
4475         (Layout::set_incremental_base): New function.
4476         (Layout::init_fixed_output_section): New function.
4477         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4478         incremental updates.
4479         (Layout::create_gold_note): Do not create gold note section for
4480         incremental updates.
4481         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4482         for incremental updates.
4483         (Layout::set_section_offsets): For incremental updates, allocate space
4484         from free list.
4485         (Layout::create_symtab_sections): Layout with offsets relative to
4486         start of section; for incremental updates, allocate space from free
4487         list.
4488         (Layout::create_shdrs): For incremental updates, allocate space from
4489         free list.
4490         (Layout::finish_dynamic_section): For incremental updates, do not
4491         check --as-needed (fixed in subsequent patch).
4492         * layout.h (class Free_list): New class.
4493         (Layout::set_incremental_base): New function.
4494         (Layout::incremental_base): New function.
4495         (Layout::init_fixed_output_section): New function.
4496         (Layout::allocate): New function.
4497         (Layout::incremental_base_): New data member.
4498         (Layout::free_list_): New data member.
4499         * main.cc (main): Print Free_list statistics.
4500         * object.cc (Relobj::finalize_incremental_relocs): Add
4501         clear_counts parameter; clear counts only when clear_counts is set.
4502         (Sized_relobj::Sized_relobj): Initialize new base class.
4503         (Sized_relobj::do_layout): Don't report special sections.
4504         (Sized_relobj::do_for_all_local_got_entries): New function.
4505         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4506         symtab_off to all symbol table offsets.
4507         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4508         * object.h (class Got_offset_list): Move to top of file.
4509         (Object::Object): Allow case where input_file == NULL.
4510         (Object::~Object): Likewise.
4511         (Object::input_file): Assert that input_file != NULL.
4512         (Object::lock): Allow case where input_file == NULL.
4513         (Object::unlock): Likewise.
4514         (Object::is_locked): Likewise.
4515         (Object::token): Likewise.
4516         (Object::release): Likewise.
4517         (Object::is_incremental): New function.
4518         (Object::get_mtime): New function.
4519         (Object::for_all_local_got_entries): New function.
4520         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4521         (Object::set_is_in_system_directory): New function.
4522         (Object::is_in_system_directory): New function.
4523         (Object::do_is_incremental): New function.
4524         (Object::do_get_mtime): New function.
4525         (Object::do_for_all_local_got_entries): New function.
4526         (Object::is_in_system_directory_): New data member.
4527         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4528         (class Sized_relobj_base): New class.
4529         (class Sized_relobj): Derive from Sized_relobj_base.
4530         (class Sized_relobj::Symbols): Redeclare from base class.
4531         (class Sized_relobj::local_got_offset_list): Remove.
4532         (class Sized_relobj::Output_sections): Redeclare from base class.
4533         (class Sized_relobj::do_for_all_local_got_entries): New function.
4534         (class Sized_relobj::write_local_symbols): Add offset parameter.
4535         (class Sized_relobj::local_symbol_offset_): Update comment.
4536         (class Sized_relobj::local_dynsym_offset_): Update comment.
4537         * options.cc (Input_arguments::add_file): Remove const.
4538         * options.h (Input_file_argument::Input_file_argument):
4539         Initialize arg_serial_ (all constructors).
4540         (Input_file_argument::set_arg_serial): New function.
4541         (Input_file_argument::arg_serial): New function.
4542         (Input_file_argument::arg_serial_): New data member.
4543         (Input_arguments::Input_arguments): Initialize file_count_.
4544         (Input_arguments::add_file): Remove const.
4545         (Input_arguments::number_of_input_files): New function.
4546         (Input_arguments::file_count_): New data member.
4547         (Command_line::number_of_input_files): Call
4548         Input_arguments::number_of_input_files.
4549         * output.cc (Output_segment_headers::Output_segment_headers):
4550         Set current size.
4551         (Output_section::Input_section::current_data_size): New function.
4552         (Output_section::Output_section): Initialize new data members.
4553         (Output_section::add_input_section): Don't do merge sections for
4554         an incremental link; allocate space from free list for an
4555         incremental update.
4556         (Output_section::add_output_section_data): Allocate space from
4557         free list for an incremental update.
4558         (Output_section::update_data_size): New function.
4559         (Output_section::set_fixed_layout): New function.
4560         (Output_section::reserve): New function.
4561         (Output_segment::set_section_addresses): Remove const.
4562         (Output_segment::set_section_list_addresses): Remove const; allocate
4563         space from free list for an incremental update.
4564         (Output_segment::set_offset): Adjust size of RELRO segment for an
4565         incremental update.
4566         * output.h (Output_data::current_data_size): Move here from
4567         child classes.
4568         (Output_data::pre_finalize_data_size): New function.
4569         (Output_data::update_data_size): New function.
4570         (Output_section_headers::update_data_size): new function.
4571         (Output_section_data_build::current_data_size): Move to Output_data.
4572         (Output_data_strtab::update_data_size): New function.
4573         (Output_section::current_data_size): Move to Output_data.
4574         (Output_section::set_fixed_layout): New function.
4575         (Output_section::has_fixed_layout): New function.
4576         (Output_section::reserve): New function.
4577         (Output_section::update_data_size): New function.
4578         (Output_section::has_fixed_layout_): New data member.
4579         (Output_section::free_list_): New data member.
4580         (Output_segment::set_section_addresses): Remove const.
4581         (Output_segment::set_section_list_addresses): Remove const.
4582         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4583         New function.
4584         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4585         New function.
4586         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4587         parameter when calling Add_symbols constructor; store argument
4588         serial number for members of a lib group.
4589         (Add_symbols::locks): Allow case where token == NULL.
4590         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4591         (Read_member::~Read_member): New function.
4592         (Read_member::is_runnable): New function.
4593         (Read_member::locks): New function.
4594         (Read_member::run): New function.
4595         (Check_script::~Check_script): New function.
4596         (Check_script::is_runnable): New function.
4597         (Check_script::locks): New function.
4598         (Check_script::run): New function.
4599         (Check_library::~Check_library): New function.
4600         (Check_library::is_runnable): New function.
4601         (Check_library::locks): New function.
4602         (Check_library::run): New function.
4603         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4604         (Add_symbols::library_): New data member.
4605         (class Read_member): New class.
4606         (class Check_script): New class.
4607         (class Check_library): New class.
4608         * reloc.cc (Read_relocs::is_runnable): Allow case where
4609         token == NULL.
4610         (Read_relocs::locks): Likewise.
4611         (Scan_relocs::locks): Likewise.
4612         (Relocate_task::locks): Likewise.
4613         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4614         to clear counters.
4615         (Sized_relobj::incremental_relocs_scan): Fix comment.
4616         (Sized_relobj::do_relocate): Pass output file offset to
4617         write_local_symbols.
4618         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4619         from class declaration.
4620         * script.cc (read_input_script): Allocate Script_info; pass
4621         argument serial number to report_script.
4622         * script.h (class Script_info): Move to incremental.h.
4623         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4624         * symtab.h (Symbol_table::add_from_incrobj): New function.
4625         (Symbol_table::set_file_offset): New function.
4626
4627 2011-04-05  Cary Coutant  <ccoutant@google.com>
4628
4629         * incremental-dump.cc (dump_incremental_inputs): Change signature
4630         to take a Sized_incremental_binary; change caller.  Use readers
4631         in Sized_incremental_binary.
4632         * incremental.cc
4633         (Sized_incremental_binary::find_incremental_inputs_sections):
4634         Rename do_find_incremental_inputs_sections to this.
4635         (Sized_incremental_binary::setup_readers): New function.
4636         (Sized_incremental_binary::do_check_inputs): Check
4637         has_incremental_info_ flag; move setup code to setup_readers;
4638         use input readers.
4639         (Sized_incremental_binary::do_file_is_unchanged): New function.
4640         (Sized_incremental_binary::do_get_input_reader): New function.
4641         * incremental.h (class Incremental_binary): Move to end of file.
4642         (Incremental_binary::file_is_unchanged): New function.
4643         (Incremental_binary::do_file_is_unchanged): New function.
4644         (Incremental_binary::Input_reader): New class.
4645         (Incremental_binary::get_input_reader): New function.
4646         (class Sized_incremental_binary): Move to end of file.
4647         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4648         input section reader classes.
4649         (Sized_incremental_binary::has_incremental_info): New function.
4650         (Sized_incremental_binary::inputs_reader): New function.
4651         (Sized_incremental_binary::symtab_reader): New function.
4652         (Sized_incremental_binary::relocs_reader): New function.
4653         (Sized_incremental_binary::got_plt_reader): New function.
4654         (Sized_incremental_binary::do_file_is_unchanged): New function.
4655         (Sized_incremental_binary::Sized_input_reader): New class.
4656         (Sized_incremental_binary::get_input_reader): New function.
4657         (Sized_incremental_binary::find_incremental_inputs_sections):
4658         Rename do_find_incremental_inputs_sections to this.
4659         (Sized_incremental_binary::setup_readers): New function.
4660         (Sized_incremental_binary::has_incremental_info_): New data member.
4661         (Sized_incremental_binary::inputs_reader_): New data member.
4662         (Sized_incremental_binary::symtab_reader_): New data member.
4663         (Sized_incremental_binary::relocs_reader_): New data member.
4664         (Sized_incremental_binary::got_plt_reader_): New data member.
4665         (Sized_incremental_binary::current_input_file_): New data member.
4666
4667 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4668
4669         PR gold/12640
4670         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4671         violation.
4672
4673 2011-03-30  Cary Coutant  <ccoutant@google.com>
4674
4675         * archive.cc (Archive::include_member): Adjust call to report_object.
4676         (Add_archive_symbols::run): Add script_info to call to
4677         report_archive_begin.
4678         (Lib_group::include_member): Adjust call to report_object.
4679         (Add_lib_group_symbols::run): Adjust call to report_object.
4680         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4681         blocks.  Add object count for script input files.
4682         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4683         script_info parameter; change all callers.
4684         (Incremental_inputs::report_object): Add script_info parameter;
4685         change all callers.
4686         (Incremental_inputs::report_script): Store backpointer to
4687         incremental info entry.
4688         (Output_section_incremental_inputs::set_final_data_size): Record
4689         additional information for scripts.
4690         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4691         * incremental.h (Incremental_script_entry::add_object): New function.
4692         (Incremental_script_entry::get_object_count): New function.
4693         (Incremental_script_entry::get_object): New function.
4694         (Incremental_script_entry::objects_): New data member; adjust
4695         constructor.
4696         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4697         (Incremental_inputs::report_object): Add script_info parameter.
4698         (Incremental_inputs_reader::get_object_count): New function.
4699         (Incremental_inputs_reader::get_object_offset): New function.
4700         * options.cc (Input_arguments::add_file): Return reference to
4701         new input argument.
4702         * options.h (Input_argument::set_script_info): New function.
4703         (Input_argument::script_info): New function.
4704         (Input_argument::script_info_): New data member; adjust all
4705         constructors.
4706         (Input_file_group::add_file): Return reference to new input argument.
4707         (Input_file_lib::add_file): Likewise.
4708         (Input_arguments::add_file): Likewise.
4709         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4710         * script.cc (Parser_closure::Parser_closure): Add script_info
4711         parameter; adjust all callers.
4712         (Parser_closure::script_info): New function.
4713         (Parser_closure::script_info_): New data member.
4714         (read_input_script): Report scripts earlier to incremental info.
4715         (script_add_file): Set script_info in Input_argument.
4716         (script_add_library): Likewise.
4717         * script.h (Script_options::Script_info): Rewrite class.
4718
4719 2011-03-29  Cary Coutant  <ccoutant@google.com>
4720
4721         * archive.cc (Library_base::should_include_member): Move
4722         method here from class Archive.
4723         (Archive::Archive): Initialize base class.
4724         (Archive::should_include_member): Move to base class.
4725         (Archive::do_for_all_unused_symbols): New function.
4726         (Add_archive_symbols::run): Remove redundant access to
4727         incremental_inputs.
4728         (Lib_group::Lib_group): Initialize base class.
4729         (Lib_group::do_filename): New function.
4730         (Lib_group::include_member): Pass pointer to Lib_group to
4731         report_object.
4732         (Lib_group::do_for_all_unused_symbols): New function.
4733         (Add_lib_group_symbols::run): Report archive information for
4734         incremental links.
4735         * archive.h (class Library_base): New base class.
4736         (class Archive): Derive from Library_base.
4737         (Archive::filename): Move to base class.
4738         (Archive::set_incremental_info): Likewise.
4739         (Archive::incremental_info): Likewise.
4740         (Archive::Should_include): Likewise.
4741         (Archive::should_include_member): Likewise.
4742         (Archive::Armap_entry): Remove.
4743         (Archive::Unused_symbol_iterator): Remove.
4744         (Archive::unused_symbols_begin): Remove.
4745         (Archive::unused_symbols_end): Remove.
4746         (Archive::do_filename): New function.
4747         (Archive::do_get_mtime): New function.
4748         (Archive::do_for_all_unused_symbols): New function.
4749         (Archive::task_): Move to base class.
4750         (Archive::incremental_info_): Likewise.
4751         (class Lib_group): Derive from Library_base.
4752         (Lib_group::do_filename): New function.
4753         (Lib_group::do_get_mtime): New function.
4754         (Lib_group::do_for_all_unused_symbols): New function.
4755         (Lib_group::task_): Move to base class.
4756         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4757         function.
4758         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4759         function.
4760         * incremental.cc (Incremental_inputs::report_archive_begin):
4761         Use Library_base; call library's get_mtime; add incremental inputs
4762         entry before members.
4763         (class Unused_symbol_visitor): New class.
4764         (Incremental_inputs::report_archive_end): Use Library_base; use
4765         visitor class to record unused symbols; don't add incremental inputs
4766         entry after members.
4767         (Incremental_inputs::report_object): Use Library_base.
4768         * incremental.h
4769         (Incremental_archive_entry::Incremental_archive_entry): Remove
4770         unused Archive parameter.
4771         (Incremental_inputs::report_archive_begin): Use Library_base.
4772         (Incremental_inputs::report_archive_end): Likewise.
4773         (Incremental_inputs::report_object): Likewise.
4774         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4775         function.
4776         * object.h (Object::for_all_global_symbols): New function.
4777         (Object::do_for_all_global_symbols): New function.
4778         (Sized_relobj::do_for_all_global_symbols): New function.
4779         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4780         function.
4781         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4782         function.
4783
4784 2011-03-27  Ian Lance Taylor  <iant@google.com>
4785
4786         * archive.cc (Archive::interpret_header): Return -1 if something
4787         goes wrong.  Change callers accordingly.
4788
4789 2011-03-25  Cary Coutant  <ccoutant@google.com>
4790
4791         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4792         * testsuite/Makefile.in: Regenerate.
4793
4794 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4795
4796         * plugin.cc (get_view): New.
4797         (Plugin::load): Pass get_view to the plugin.
4798         (Plugin_manager::get_view): New.
4799
4800 2011-03-21  Ian Lance Taylor  <iant@google.com>
4801
4802         * testsuite/final_layout.sh: Rewrite to not use dc.
4803         * testsuite/relro_test.sh: Fail if dc is not present.
4804
4805 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4806
4807         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4808         Change == to -eq.
4809         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4810         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4811         Change == to -eq.
4812         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4813         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4814
4815 2011-03-14  Ian Lance Taylor  <iant@google.com>
4816
4817         * script-sections.cc (Sort_output_sections::script_compare):
4818         Rename from is_before, change return type.
4819         (Sort_output_sections::operator()): Adjust accordingly.
4820
4821 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4822
4823         PR gold/12572
4824         * testsuite/odr_violation2.cc: Add comment to make all error line
4825         numbers double digits.
4826         * testsuite/debug_msg.sh: Adjust expected errors.
4827
4828 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4829
4830         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4831         but mark earlier ones as non-canonical
4832         (offset_to_iterator): Update search target and example
4833         (do_addr2line): Return extra lines in a vector*
4834         (format_file_lineno): Extract from do_addr2line
4835         (one_addr2line): Add vector* out-param
4836         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4837         when a lineno entry appeared last for its instruction
4838         (Dwarf_line_info): Add vector* out-param
4839         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4840         * symtab.cc (Odr_violation_compare): Include the lineno in the
4841         comparison again.
4842         (linenos_from_loc): New. Combine the canonical line for an
4843         address with its other lines.
4844         (True_if_intersect): New. Helper functor to make
4845         std::set_intersection a query.
4846         (detect_odr_violations): Compare sets of lines instead of just
4847         one line for each function. This became less deterministic, but
4848         has fewer false positives.
4849         * symtab.h: Declarations.
4850         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4851         mix an optimized and non-optimized object in the same binary
4852         (odr_violation2.so): Same.
4853         * testsuite/Makefile.in: Regenerate from Makefile.am.
4854         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4855         * testsuite/debug_msg.sh: Update line numbers and add
4856         assertions.
4857         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4858         non-optimized context.
4859         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4860         isn't inlined, and use OdrDerived in an optimized context.
4861         * testsuite/odr_header1.h: Defines OdrDerived, where
4862         optimization will change the
4863         first-instruction-in-the-destructor's file and line number.
4864         * testsuite/odr_header2.h: Defines OdrBase.
4865
4866 2011-03-09  Ian Lance Taylor  <iant@google.com>
4867
4868         * fileread.cc (File_read::clear_views): Don't delete the whole
4869         file view.
4870
4871 2011-03-08  Ian Lance Taylor  <iant@google.com>
4872
4873         PR gold/12525
4874         * fileread.cc: #include <climits>.
4875         (GOLD_IOV_MAX): Define.
4876         (File_read::read_multiple): Limit number of entries by iov_max.
4877         * fileread.h (class File_read): Always set max_readv_entries to
4878         128.
4879
4880 2011-03-07  Ian Lance Taylor  <iant@google.com>
4881
4882         PR gold/12525
4883         * options.h (class General_options): Add -dy and -dn.
4884
4885 2011-03-02  Cary Coutant  <ccoutant@google.com>
4886
4887         * testsuite/script_test_9.t: Add TLS segment.
4888
4889 2011-03-02  Simon Baldwin  <simonb@google.com>
4890
4891         * configure.ac: Add check for gnu_indirect_function support in
4892         the toolchain building binutils.
4893         * configure: Rebuild.
4894
4895 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4896
4897         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4898         plugin only symbols.
4899         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4900         in plugin files as not needed in the symbol table.
4901
4902 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4903
4904         * output.cc (Output_section::add_input_section): Delay fill
4905         generation for section ordering.
4906
4907 2011-02-09  Ian Lance Taylor  <iant@google.com>
4908
4909         PR gold/12316
4910         * object.h (class Sized_relobj): Remove clear_local_symbols.
4911         * reloc.cc (Sized_relobj::do_relocate): Don't call
4912         clear_local_symbols.
4913
4914 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4915
4916         * plugin.cc (is_visible_from_outside): Return true for symbols
4917         in the -u option.
4918
4919 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4920
4921         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4922         filename.
4923
4924 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4925
4926         * icf.h (is_section_foldable_candidate): Change type of parameter
4927         to std::string.
4928         * icf.cc (Icf::find_identical_sections): Change type of local variable
4929         section_name to be std::string.
4930         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4931
4932 2011-01-25  Ian Lance Taylor  <iant@google.com>
4933
4934         * script.cc (script_add_extern): Rewrite to use
4935         add_symbol_reference.
4936
4937 2011-01-25  Doug Kwan  <dougkwan@google.com>
4938
4939         * icf.cc (get_section_contents): Always lock section's object.
4940
4941 2011-01-24  Ian Lance Taylor  <iant@google.com>
4942
4943         * options.h (class General_options): Accept
4944         --no-detect-odr-violations.
4945
4946 2011-01-24  Ian Lance Taylor  <iant@google.com>
4947
4948         * version.cc (version_string): Bump to 1.11.
4949
4950 2011-01-24  Ian Lance Taylor  <iant@google.com>
4951
4952         * plugin.cc (class Plugin_rescan): Define new class.
4953         (Plugin_manager::claim_file): Set any_claimed_.
4954         (Plugin_manager::save_archive): New function.
4955         (Plugin_manager::save_input_group): New function.
4956         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4957         necessary.
4958         (Plugin_manager::new_undefined_symbol): New function.
4959         (Plugin_manager::rescan): New function.
4960         (Plugin_manager::rescannable_defines): New function.
4961         (Plugin_manager::add_input_file): Set any_added_.
4962         * plugin.h (class Plugin_manager): define new fields rescannable_,
4963         undefined_symbols_, any_claimed_, and any_added_.  Declare
4964         Plugin_rescan as friend.  Declare new functions.
4965         (Plugin_manager::Rescannable): Define type.
4966         (Plugin_manager::Rescannable_list): Define type.
4967         (Plugin_manager::Undefined_symbol_list): Define type.
4968         (Plugin_manager::Plugin_manager): Initialize new fields.
4969         * archive.cc (Archive::defines_symbol): New function.
4970         (Add_archive_symbols::run): Pass archive to plugins if any.
4971         * archive.h (class Archive): Declare defines_symbol.
4972         * readsyms.cc (Input_group::~Input_group): New function.
4973         (Finish_group::run): Pass input_group to plugins if any.
4974         * readsyms.h (class Input_group): Declare destructor.
4975         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4976         any.
4977
4978 2011-01-10  Ian Lance Taylor  <iant@google.com>
4979
4980         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4981         section as relro.
4982         (Layout::set_segment_offsets): Reset increase_relro before calling
4983         set_section_addresses a second time.
4984
4985 2011-01-04  Cary Coutant  <ccoutant@google.com>
4986
4987         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4988         sections before NOBITS sections.
4989
4990 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4991
4992         * version.cc (print_version): Update copyright to 2011.
4993
4994 2010-12-23  Cary Coutant  <ccoutant@google.com>
4995
4996         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4997         of OS to this->add.  Add OD parameter to second form of the function.
4998
4999 2010-12-20  Ian Lance Taylor  <iant@google.com>
5000
5001         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5002         second of two consecutive entries with same offset.
5003
5004 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5005
5006         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5007         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5008         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5009         to avoid unneeded links against $(LDADD).
5010         * testsuite/Makefile.in: Regenerate.
5011
5012 2010-12-15  Ian Lance Taylor  <iant@google.com>
5013
5014         PR gold/12324
5015         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5016         for R_X86_64_32 and R_X86_64_PC32.
5017         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5018         ver_matching_def_pic.o.
5019         (ver_matching_def_pic.o): New target.
5020
5021 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5022
5023         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5024         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5025         Move definition before File_read::View member definitions.
5026         (File_read::View::~View): Initialize and hold lock before
5027         updating current_mapped_bytes.
5028
5029 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5030
5031         * dwarf_reader.cc: Remove outdated comment.
5032         * gold-threads.cc: Fix typo in error message.
5033         * archive.cc: Fix typos in comments.
5034         * archive.h: Likewise.
5035         * arm-reloc-property.cc: Likewise.
5036         * arm-reloc-property.h: Likewise.
5037         * arm-reloc.def: Likewise.
5038         * arm.cc: Likewise.
5039         * attributes.h: Likewise.
5040         * cref.cc: Likewise.
5041         * ehframe.cc: Likewise.
5042         * fileread.h: Likewise.
5043         * gold.h: Likewise.
5044         * i386.cc: Likewise.
5045         * icf.cc: Likewise.
5046         * incremental.h: Likewise.
5047         * int_encoding.cc: Likewise.
5048         * layout.h: Likewise.
5049         * main.cc: Likewise.
5050         * merge.h: Likewise.
5051         * object.cc: Likewise.
5052         * object.h: Likewise.
5053         * options.cc: Likewise.
5054         * readsyms.cc: Likewise.
5055         * reduced_debug_output.cc: Likewise.
5056         * reloc.cc: Likewise.
5057         * script-sections.cc: Likewise.
5058         * sparc.cc: Likewise.
5059         * symtab.h: Likewise.
5060         * target-reloc.h: Likewise.
5061         * target.cc: Likewise.
5062         * target.h: Likewise.
5063         * timer.cc: Likewise.
5064         * timer.h: Likewise.
5065         * x86_64.cc: Likewise.
5066
5067 2010-12-09  Cary Coutant  <ccoutant@google.com>
5068
5069         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5070         stack.
5071         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5072         parameter; change all callers.
5073         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5074         * options.h (warn_execstack): New option.
5075
5076 2010-12-07  Doug Kwan  <dougkwan@google.com>
5077
5078         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5079         like function call relocations.
5080
5081 2010-12-07  Ian Lance Taylor  <iant@google.com>
5082
5083         * archive.cc (Archive::get_elf_object_for_member): Permit
5084         punconfigured to be NULL.
5085         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5086         (Archive::include_member): Pass NULL to get_elf_object_for_member
5087         if we searched for the archive and this is the first included
5088         object.
5089
5090 2010-12-01  Ian Lance Taylor  <iant@google.com>
5091
5092         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5093         track_relocs_type_ field.
5094         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5095         Set track_relocs_type_.
5096         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5097         contents when using RELA relocs.
5098         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5099         reloc_map_.
5100         * reloc.cc (Track_relocs::next_addend): New function.
5101         * reloc.h (class Track_relocs): Declare next_addend.
5102
5103 2010-12-01  Ian Lance Taylor  <iant@google.com>
5104
5105         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5106         virtual destructor.
5107
5108 2010-12-01  Ian Lance Taylor  <iant@google.com>
5109
5110         * README: Update compilers known to work and fail.
5111
5112 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5113
5114         * configure.in: For --enable-gold, handle value `default' instead of
5115         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5116         not the default.
5117         * configure: Regenerate.
5118
5119 2010-11-18  Doug Kwan  <dougkwan@google.com>
5120
5121         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5122         and right_alignment to be zero.  Store result alignment only if it is
5123         greater than existing alignment.
5124
5125 2010-11-16  Cary Coutant  <ccoutant@google.com>
5126
5127         PR gold/12220
5128         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5129         Check for ".zdebug_line".
5130
5131 2010-11-16  Doug Kwan  <dougkwan@google.com>
5132             Cary Coutant  <ccoutant@google.com>
5133
5134         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5135         by reference; adjust all callers.
5136         * output.cc (Output_segment::set_section_addresses): Adjust references
5137         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5138         list is empty.
5139         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5140         end at page boundary.
5141
5142 2010-11-16  Cary Coutant  <ccoutant@google.com>
5143
5144         PR gold/12220
5145         * layout.cc (Layout::choose_output_section): Transform names of
5146         compressed sections even when using a script with a SECTIONS clause.
5147         (Layout::output_section_name): Remove code to transform
5148         compressed debug section names.
5149         * output.cc (Output_section::add_input_section): Use uncompressed
5150         section size when tracking input sections.
5151
5152 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5153
5154         * symtab.h (Symbol::NON_PIC_REF): Remove.
5155         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5156         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5157         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5158         (Symbol::use_plt_offset): Take a flags argument and pass it
5159         directly to needs_dynamic_reloc.  Restrict check for undefined
5160         weak symbols to function calls.
5161         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5162         (Target_arm::Scan::global): Use it.
5163         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5164         (Target_arm::Relocate::relocate): Likewise.
5165         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5166         parameter with an r_type parameter.  Use get_reference_flags
5167         to get the flags.
5168         (Target_arm::Relocate::relocate): Update accordingly.
5169         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5170         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5171         (Target_i386::Scan::global): Likewise.
5172         (Target_i386::Relocate::relocate): Likewise.
5173         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5174         parameter with an r_type parameter.  Use get_reference_flags
5175         to get the flags.
5176         (Target_i386::Relocate::relocate): Update accordingly.
5177         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5178         (Target_powerpc::Scan::global): Use it.
5179         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5180         (Target_powerpc::Relocate::relocate): Likewise.
5181         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5182         (Target_sparc::Scan::global): Use it.
5183         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5184         (Target_sparc::Relocate::relocate): Likewise.
5185         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5186         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5187         (Target_x86_64::Scan::global): Likewise.
5188         (Target_x86_64::Relocate::relocate): Likewise.
5189
5190 2010-11-08  Doug Kwan  <dougkwan@google.com>
5191             Cary Coutant  <ccoutant@google.com>
5192
5193         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5194         (Arm_exidx_merge_section::section_contents_): New data member.
5195         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5196         (Arm_input_section::~Arm_input_section): De-allocate memory.
5197         (Arm_input_section::original_contents_): New data member.
5198         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5199         in parameters instead of calling Object::section_contents without
5200         locking.
5201         (Arm_output_section::group_section): New parameter TASK.  Pass it
5202         to callees that need locking objects.
5203         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5204         to lock EXIDX input sections.  Fix a formatting issue.  Call
5205         Arm_exidx_merged_section::build_contents to create merged section
5206         contents.
5207         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5208         to lock object of stub table owner.
5209         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5210         TEXT_SIZE to initialize data member TEXT_SIZE_.
5211         (Arm_exidx_input_section::addralign): Fix typo in comment.
5212         (Arm_exidx_input_section::text_size): New method.
5213         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5214         that require locking objects.  Lock objects before scanning for stubs
5215         and updating local symbols.
5216         (Arm_input_section<big_endian>::init): Copy contents of original
5217         input section.
5218         (Arm_input_section<big_endian>::do_write): Use saved contents of
5219         original input section instead of calling Object::section_contents
5220         without locking.
5221         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5222         size without calling Object::section_size().
5223         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5224         for size.  Allocate a buffer for merged EXIDX entries.
5225         (Arm_exidx_merged_section::build_contents): New method.
5226         (Arm_exidx_merged_section::do_write): Move merge section contents
5227         building code to Arm_exidx_merged_section::build_contetns.  Write
5228         out contetns in buffer instead of building it on the fly.
5229         (Arm_relobj::make_exidx_input_section): Also pass text section size
5230         to Arm_exidx_input_section constructor.
5231         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5232         (Arm_dynobj::do_read_symbols): Fix memory leak.
5233         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5234         * target.h: (class Task): Add forward declaration.
5235         (Target::relax): Add new parameter TASK and pass it to
5236         Target::do_relax().
5237         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5238
5239 2010-11-05  Cary Coutant  <ccoutant@google.com>
5240
5241         PR gold/10708
5242         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5243         object when reading from the file.
5244         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5245         second layout pass.
5246         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5247         when reading section contents.
5248         (get_section_contents): Likewise.
5249         (icf::find_identical_sections): Likewise.
5250         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5251         object when reading from the file.
5252         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5253         the object when doing deferred section layout.
5254
5255 2010-11-03  Nick Clifton  <nickc@redhat.com>
5256
5257         PR gold/12001
5258         * script.h (class Symbol_assignment: name): New member.  Returns
5259         the name of the symbol.
5260         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5261         Returns true if the given symbol name is on the list of
5262         assignments wating to be processed.
5263         * archive.cc (should_incldue_member): If the symbol is undefined,
5264         check to see if it is on the list of symbols pending assignment.
5265
5266 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5267
5268         * script-sections.cc (Script_sections::find_memory_region): Check
5269         for a NULL output section pointer.
5270
5271 2010-10-29  Doug Kwan  <dougkwan@google.com>
5272
5273         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5274         Output_section::add_relaxed_input_section.
5275         * output.cc (Output_section::add_relaxed_input_section): Add new
5276         arguments LAYOUT and NAME.  Set section order index.
5277         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5278         Copy section order index.
5279         * output.h (Output_section::add_relaxed_input_section): Add new
5280         arguments LAYOUT and NAME.
5281
5282 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5283
5284         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5285         NATIVE_OR_CROSS_LINKER.
5286         * testsuite/Makefile.in: Regenerate.
5287
5288 2010-10-20  Doug Kwan  <dougkwan@google.com>
5289
5290         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5291         without SHF_LINK_ORDER flags.
5292         * layout.cc (Layout::choose_output_section): Do not filter
5293         SHF_LINK_ORDER flag in a relocatable link.
5294
5295 2010-10-17  Cary Coutant  <ccoutant@google.com>
5296
5297         * output.h (Output_segment::set_section_addresses): Change function
5298         signature.  Update all callers.
5299         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5300         sections.
5301         (Output_segment::set_section_addresses): Align after last TLS
5302         section.  Add padding before last relro section instead of after.
5303
5304 2010-10-17  Doug Kwan  <dougkwan@google.com>
5305
5306         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5307         GOT output section to be writable.
5308
5309 2010-10-14  Cary Coutant  <ccoutant@google.com>
5310
5311         * debug.h (DEBUG_INCREMENTAL): New flag.
5312         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5313         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5314         mode.
5315         * incremental.cc (report_command_line): Ignore all forms of
5316         --incremental.
5317         * layout.cc (Layout::Layout): Check parameters for incremental link
5318         mode.
5319         * options.cc (General_options::parse_incremental): New function.
5320         (General_options::parse_no_incremental): New function.
5321         (General_options::parse_incremental_full): New function.
5322         (General_options::parse_incremental_update): New function.
5323         (General_options::incremental_mode_): New data member.
5324         (General_options::finalize): Check incremental_mode_.
5325         * options.h (General_options): Update help text for --incremental.
5326         Add --no-incremental, --incremental-full, --incremental-update.
5327         (General_options::Incremental_mode): New enum type.
5328         (General_options::incremental_mode): New function.
5329         (General_options::incremental_mode_): New data member.
5330         * parameters.cc (Parameters::incremental_mode_): New data member.
5331         (Parameters::set_options): Set incremental_mode_.
5332         (Parameters::set_incremental_full): New function.
5333         (Parameters::incremental): New function.
5334         (Parameters::incremental_update): New function.
5335         (set_parameters_incremental_full): New function.
5336         * parameters.h (Parameters::set_incremental_full): New function.
5337         (Parameters::incremental): New function.
5338         (Parameters::incremental_update): New function.
5339         (Parameters::incremental_mode_): New data member.
5340         (set_parameters_incremental_full): New function.
5341         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5342         incremental link mode.
5343         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5344         (Sized_relobj::do_relocate_sections): Likewise.
5345         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5346         option.
5347         * testsuite/Makefile.in: Regenerate.
5348         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5349
5350 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5351
5352         * script-sections.h (class Script_sections): Make
5353         Sections_elements typedef public.
5354         * script-sections.cc (class Sort_output_sections): Add elements_
5355         field.  Add constructor which sets it; change all callers.
5356         (Sort_output_sections::is_before): New function.
5357         (Sort_output_sections::operator()): Call is_before.
5358         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5359         conditional.
5360         * testsuite/script_test_10.sh: New test. Test script section
5361         order.
5362         * testsuite/script_test_10.t: Likewise.
5363         * testsuite/script_test_10.s: Likewise.
5364         * testsuite/Makefile.am: Wrap the cross linker tests and the
5365         common tests into NATIVE_OR_CROSS_LINKER.
5366         (check_SCRIPTS): Add script_test_10.sh.
5367         (check_DATA): Add script_test_10.stdout.
5368         (script_test_10.o, script_test_10): New targets.
5369         (script_test_10.stdout): New target.
5370         * configure, testsuite/Makefile.in: Regenerate.
5371
5372 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5373
5374         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5375         error for the deprecated relocations.
5376         (Target_arm::Scan::global): Likewise.
5377         (Target_arm::Relocate::relocate): Likewise.
5378
5379 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5380
5381         * fileread.cc (Input_file::find_file): Initialize *found_name
5382         and *namep when using the fallback search for case 4.
5383
5384 2010-10-11  Cary Coutant  <ccoutant@google.com>
5385
5386         * options.h (class General_options): Redefine -z lazy as an alias for
5387         the negation of -z now.
5388
5389 2010-10-11  Ian Lance Taylor  <iant@google.com>
5390
5391         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5392         binding.
5393
5394 2010-10-06  Nick Clifton  <nickc@redhat.com>
5395
5396         * script-sections.cc(class Memory_region): Remove
5397         current_lma_offset_ field.  Rename current_vma_offset_ to
5398         current_offset_.  Add last_section_ field.
5399         (Memory_region::get_current_vma_address): Rename to
5400         get_current_address.
5401         (Memory_region::get_current_lma_address): Delete.
5402         (Memory_region::increment_vma_offset): Rename to
5403         increment_offset.
5404         (Memory_region::increment_lma_offset): Delete.
5405         (Memory_region::attributes_compatible): New method.  Returns
5406         true if the provided section is compatible with the region.
5407         (Memory_region::get_last_section): New method.  Returns the last
5408         section to use the region.
5409         (Memory_region::set_last_section): New method.  Stores the last
5410         section to use the region.
5411         (Script_sections::block_in_region): New method.  Returns true if
5412         a block of memory is contained within a region.
5413         (Script_sections::find_memory_region): New method.  Locates a
5414         memory region to be used to set a VMA or LMA address.
5415         (Output_section_definition::set_section_addresses): Add code to
5416         check for addresses set by memory regions.
5417         (Output_segment::set_section_addresses): Remove memory region
5418         walking code.
5419         (Script_sections::create_segment): Add a warning if a header
5420         segment is created outside of any region.
5421         * script-sections.h (class Script_sections): Add prototypes for
5422         find_memory_region and block_in_region methods.
5423         * testsuite/memory_test.s: Use .long instead of .word.
5424         * testsuite/memory_test.t: Add some more output sections.
5425         * testsuite/memory_test.sh: Update expected output.
5426
5427 2010-10-02  Doug Kwan  <dougkwan@google.com>
5428
5429         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5430         defintion to symtab.h
5431         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5432         declaration to defintion.
5433
5434 2010-10-01  Nick Clifton  <nickc@redhat.com>
5435
5436         * expression.cc (eval): Replace dummy argument with NULL.
5437         (eval_maybe_dot): Check for a NULL result section pointer.
5438         (Symbol_expression::value): Likewise.
5439         (Dot_expression::value): Likewise.
5440         (BINARY_EXPRESSION): Likewise.
5441         (Max_expression::value): Likewise.
5442         (Min_expression::value): Likewise.
5443         (Absolute_expression::value): Likewise.
5444         (Addr_expression::value_from_output_section): Likewise.
5445         (Loaddddr_expression::value_from_output_section): Likewise.
5446         (Segment_start_expression::value): Likewise.
5447         * script-sections.cc
5448         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5449         argument with NULL.
5450         (Sections_elememt_dot_assignment::set_section_addresses):
5451         Likewise.
5452         (Output_data_expression::do_write_to_buffer): Likewise.
5453         (Output_section_definition::finalize_symbols): Likewise.
5454         (Output_section_definition::set_section_addresses): Likewise.
5455
5456 2010-09-30  Doug Kwan  <dougkwan@google.com>
5457
5458         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5459
5460 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5461
5462         * target.h (Target::can_icf_inline_merge_sections): New virtual
5463         function.
5464         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5465         virtual function.
5466         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5467         virtual function.
5468         * icf.cc (get_section_contents): Inline merge sections only when
5469         target allows it.
5470
5471 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5472
5473         * configure: Regenerate.
5474
5475 2010-09-17  Ian Lance Taylor  <iant@google.com>
5476
5477         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5478         * testsuite/Makefile.am (memory_test.o): New target.
5479         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5480         memory_test.t.
5481         * testsuite/Makefile.in: Rebuild.
5482
5483 2010-09-17  Doug Kwan  <dougkwan@google.com>
5484
5485         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5486         defintion if relocation uses GOT entries of the symbol.
5487         * testsuite/icf_safe_test.sh: Fix test.
5488         * testsuite/icf_safe_so_test.sh: Fix test.
5489
5490 2010-09-16  Cary Coutant  <ccoutant@google.com>
5491
5492         * script_sections.cc (class Memory_region): Remove "NULL" from
5493         vector initializations.
5494
5495 2010-09-15  Cary Coutant  <ccoutant@google.com>
5496
5497         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5498         Resolve forwarding symbols.
5499
5500 2010-09-15  Doug Kwan  <dougkwan@google.com>
5501
5502         * gold/testsuite/script_test_3.t: Add ARM special sections.
5503         * gold/testsuite/script_test_4.t: Same.
5504         * gold/testsuite/script_test_5.t: Same.
5505         * gold/testsuite/script_test_6.t: Same.
5506         * gold/testsuite/script_test_7.t: Same.
5507         * gold/testsuite/script_test_7.t: Same.
5508         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5509
5510 2010-09-14  Cary Coutant  <ccoutant@google.com>
5511
5512         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5513         (Target_x86_64::Relocate::relocate_tls): Replace check for
5514         saw_tls_block_reloc_ with test for executable section.
5515
5516 2010-09-12  Cary Coutant  <ccoutant@google.com>
5517
5518         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5519         position-independent executables to shared libraries need dynamic
5520         relocations.
5521         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5522         position-independent executables.
5523         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5524         * testsuite/Makefile.in: Regenerate.
5525
5526 2010-09-10  Nick Clifton  <nickc@redhat.com>
5527
5528         PR gold/11997
5529         * testsuite/memory_test.t: Discard any sections that are not
5530         needed.
5531
5532 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5533
5534         PR gold/11996
5535         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5536         "This::" to work around a bug in gcc 4.2.
5537
5538         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5539
5540 2010-09-09  Rafael Espindola  <espindola@google.com>
5541
5542         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5543         sections with different PF_X flags in the same segment.
5544         (Layout::find_first_load_seg): Search all segments to find the first
5545         one.
5546         * options.h (rosegment): New.
5547
5548 2010-09-08  Rafael Espindola  <espindola@google.com>
5549
5550         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5551
5552 2010-09-08  Doug Kwan  <dougkwan@google.com>
5553
5554         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5555         (Arm_relobj::do_relocate_sections): Add new parameter for output
5556         file to match the parent.
5557         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5558         of local symbols instead of input values.  Update code to track
5559         changes in gold::relocate_section.
5560         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5561         (Sized_relobj::compute_final_local_value_internal): New methods.
5562         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5563         body into private version of Sized_relobj::compute_final_local_value.
5564         Call the inline method.
5565         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5566         merged symbol value if there is one.
5567         (Symbol_value::has_output_value): New method defintiion.
5568         (Sized_relobj::Compute_final_local_value_status): New enum type.
5569         (Sized_relobj::compute_final_local_value): New methods.
5570         (Sized_relobj::compute_final_local_value_internal): New methods.
5571         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5572         and arm_cortex_a8.sh.
5573         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5574         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5575         New tests.
5576         * Makefile.in: Regenerate.
5577         * testsuite/arm_bl_out_of_range.s: Update test.
5578         * testsuite/thumb_bl_out_of_range.s: Ditto.
5579         * testsuite/thumb_blx_out_of_range.s: Ditto.
5580         * testsuite/arm_branch_out_of_range.sh: New file.
5581         * testsuite/arm_cortex_a8.sh: Ditto.
5582         * testsuite/arm_cortex_a8_b.s: Ditto.
5583         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5584         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5585         * testsuite/arm_cortex_a8_bl.s: Ditto.
5586         * testsuite/arm_cortex_a8_blx.s: Ditto.
5587         * testsuite/arm_cortex_a8_local.s: Ditto.
5588         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5589         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5590
5591 2010-09-08  Rafael Espindola  <espindola@google.com>
5592
5593         * Makefile.am (memory_test.stdout): Run readelf with -W.
5594         * Makefile.in: Regenerate.
5595         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5596         64 bit output.
5597
5598 2010-09-08  Rafael Espindola  <espindola@google.com>
5599
5600         * script-sections.cc (Script_sections::add_memory_region): Convert
5601         field precision to int.
5602         * script.cc (script_set_section_region, script_set_section_region):
5603         Convert field precision to int.
5604
5605 2010-09-08  Rafael Espindola  <espindola@google.com>
5606
5607         * arm.cc (do_finalize_sections): Create the __exidx_start and
5608         __exdix_end symbols even when the section is missing.
5609
5610 2010-09-08  Nick Clifton  <nickc@redhat.com>
5611
5612         * README: Remove claim that MEMORY is not supported.
5613         * expression.cc (script_exp_function_origin)
5614         (script_exp_function_length): Move from here to ...
5615         * script.cc: ... here.
5616         (script_set_section_region, script_add_memory)
5617         (script_parse_memory_attr, script_include_directive): New
5618         functions.
5619         * script-sections.cc
5620         (class Memory_region): New class.
5621         (class Output_section_definition): Add set_memory_region,
5622         set_section_vma, set_section_lma and get_section_name methods.
5623         (class Script_Sections): Add add_memory_region,
5624         find_memory_region, find_memory_region_origin,
5625         find_memory_region_length and set_memory_region methods.
5626         Have set_section_addresses method walk the list of set memory
5627         regions.
5628         Extend the print methos to display memory regions.
5629         * script-sections.h: Add prototypes for new methods.
5630         Add enum for MEMORY region attributes.
5631         * yyscript.y: Add support for parsing MEMORY regions.
5632         * script-c.h: Add prototypes for new functions.
5633         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5634         * testsuite/Makefile.in: Regenerate.
5635         * testsuite/memory_test.sh: New script.
5636         * testsuite/memory_test.s: New assembler source file.
5637         * testsuite/memory_test.t: New linker script.
5638
5639 2010-08-27  Doug Kwan  <dougkwan@google.com>
5640
5641         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5642         reference override an existing dynamic weak reference.
5643         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5644         * testsuite/Makefile.in: Regenerate.
5645         * testsuite/dyn_weak_ref.sh: New file.
5646         * testsuite/dyn_weak_ref_1.c: Ditto.
5647         * testsuite/dyn_weak_ref_2.c: Ditto.
5648
5649 2010-08-27  Ian Lance Taylor  <iant@google.com>
5650
5651         * incremental.h (class Incremental_input_entry): Add virtual
5652         destructor.
5653
5654 2010-08-27  Ian Lance Taylor  <iant@google.com>
5655
5656         * testsuite/start_lib_test_3.c: Mark t3 as used.
5657
5658 2010-08-27  Nick Clifton  <nickc@redhat.com>
5659
5660         * options.cc (version_script): Fix small typo in previous
5661         whitespace tidyup.
5662
5663 2010-08-25  Nick Clifton  <nickc@redhat.com>
5664
5665         * archive.cc: Formatting fixes: Remove whitespace between
5666         typename and following asterisk.  Remove whitespace between
5667         function name and opening parenthesis.
5668         * archive.h: Likewise.
5669         * arm.cc: Likewise.
5670         * attributes.cc: Likewise.
5671         * attributes.h: Likewise.
5672         * common.cc: Likewise.
5673         * copy-relocs.cc: Likewise.
5674         * dirsearch.h: Likewise.
5675         * dynobj.cc: Likewise.
5676         * ehframe.cc: Likewise.
5677         * ehframe.h: Likewise.
5678         * expression.cc: Likewise.
5679         * fileread.cc: Likewise.
5680         * fileread.h: Likewise.
5681         * gc.h: Likewise.
5682         * gold-threads.cc: Likewise.
5683         * gold.cc: Likewise.
5684         * i386.cc: Likewise.
5685         * icf.h: Likewise.
5686         * incremental-dump.cc: Likewise.
5687         * incremental.cc: Likewise.
5688         * layout.cc: Likewise.
5689         * layout.h: Likewise.
5690         * main.cc: Likewise.
5691         * merge.cc: Likewise.
5692         * merge.h: Likewise.
5693         * object.cc: Likewise.
5694         * object.h: Likewise.
5695         * options.cc: Likewise.
5696         * options.h: Likewise.
5697         * output.cc: Likewise.
5698         * output.h: Likewise.
5699         * plugin.cc: Likewise.
5700         * plugin.h: Likewise.
5701         * powerpc.cc: Likewise.
5702         * reloc.cc: Likewise.
5703         * script-c.h: Likewise.
5704         * script-sections.cc: Likewise.
5705         * script.cc: Likewise.
5706         * stringpool.cc: Likewise.
5707         * symtab.cc: Likewise.
5708         * symtab.h: Likewise.
5709         * target.cc: Likewise.
5710         * timer.cc: Likewise.
5711         * timer.h: Likewise.
5712         * version.cc: Likewise.
5713         * x86_64.cc: Likewise.
5714
5715 2010-08-24  Nick Clifton  <nickc@redhat.com>
5716
5717         PR 11899
5718         * layout.cc (segment_precedes): Sort segments by their physical
5719         addresses, if they have been set.
5720
5721 2010-08-23  Cary Coutant  <ccoutant@google.com>
5722
5723         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5724         symbols data.
5725         (Lib_group::include_member): Unlock object after deleting its
5726         symbols data.
5727         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5728         the bug fixed here.
5729
5730 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5731             Cary Coutant  <ccoutant@google.com>
5732
5733         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5734         constructor, and set_blocker.
5735         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5736         readsyms_blocker_.
5737         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5738         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5739         * testsuite/Makefile.am (start_lib_test): New test case.
5740         * testsuite/Makefile.in: Regenerate.
5741         * testsuite/start_lib_test_main.c: New file.
5742         * testsuite/start_lib_test_1.c: New file.
5743         * testsuite/start_lib_test_2.c: New file.
5744         * testsuite/start_lib_test_3.c: New file.
5745
5746 2010-08-19  Ian Lance Taylor  <iant@google.com>
5747
5748         * Makefile.in: Rebuild with automake 1.11.1.
5749         * aclocal.m4: Likewise.
5750         * testsuite/Makefile.in: Likewise.
5751
5752 2010-08-19  Ian Lance Taylor  <iant@google.com>
5753
5754         PR 10893
5755         * i386.cc (class Output_data_plt_i386): Update declarations.
5756         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5757         local_ifuncs_ fields.
5758         (Target_i386::do_plt_section_for_global): New function.
5759         (Target_i386::do_plt_section_for_local): New function.
5760         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5761         parameter; change all callers.  Initialize global_ifuncs_ and
5762         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5763         __rel_iplt_end.
5764         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5765         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5766         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5767         symbols.
5768         (Target_i386::make_plt_section): New function, broken out of
5769         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5770         (Target_i386::make_plt_entry): Call make_plt_section.
5771         (Target_i386::make_local_ifunc_plt_entry): New function.
5772         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5773         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5774         R_386_IRELATIVE to switch.
5775         (Target_i386::Scan::global): Likewise.
5776         (Target_i386::Relocate::relocate): Likewise.
5777         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5778         switch.
5779         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5780         (Target_x86_64::do_plt_section_for_global): New function.
5781         (Target_x86_64::do_plt_section_for_local): New function.
5782         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5783         parameter; change all callers.  If doing a static link define
5784         __rela_iplt_start and __rela_iplt_end.
5785         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5786         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5787         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5788         to point to .plt.
5789         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5790         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5791         switch.
5792         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5793         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5794         R_X86_64_IRELATIVE to switch.
5795         (Target_x86_64::Scan::global): Likewise.
5796         (Target_x86_64::Relocate::relocate): Likewise.
5797         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5798         switch.
5799         * target.h (class Target): Add plt_section_for_global and
5800         plt_section_for_local functions.  Add do_plt_section_for_global
5801         and do_plt_section_for_local virtual functions.
5802         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5803         clarifying comments.
5804         (Symbol::use_plt_offset): Handle IFUNC symbol.
5805         * object.cc (Sized_relobj::Sized_relobj): Initialize
5806         local_plt_offsets_.
5807         (Sized_relobj::local_has_plt_offset): New function.
5808         (Sized_relobj::local_plt_offset): New function.
5809         (Sized_relobj::set_local_plt_offset): New function.
5810         (Sized_relobj::do_count): Handle IFUNC symbol.
5811         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5812         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5813         is_ifunc_symbol functions.
5814         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5815         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5816         local_plt_offsets_ field.
5817         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5818         * output.h (class Output_section_data): Add non-const
5819         output_section function.
5820         (class Output_data_got): Update declarations.
5821         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5822         Add use_plt_offset parameter to global and local constructors.
5823         Change all callers.  Change local_sym_index_ field to 31 bits.
5824         Change GSYM_CODE and CONSTANT_CODE accordingly.
5825         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5826         doing a static link don't set sh_link field.
5827         (Output_data_got::Got_entry::write): Use PLT offset if
5828         appropriate.
5829         (Output_data_got::add_global_plt): New function.
5830         (Output_data_got::add_local_plt): New function.
5831         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5832         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5833         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5834         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5835         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5836         IFUNC conditional.
5837         * testsuite/ifunc-sel.h: New file.
5838         * testsuite/ifuncmain1.c: New file.
5839         * testsuite/ifuncmain1vis.c: New file.
5840         * testsuite/ifuncmod1.c: New file.
5841         * testsuite/ifuncdep2.c: New file.
5842         * testsuite/ifuncmain2.c: New file.
5843         * testsuite/ifuncmain3.c: New file.
5844         * testsuite/ifuncmod3.c: New file.
5845         * testsuite/ifuncmain4.c: New file.
5846         * testsuite/ifuncmain5.c: New file.
5847         * testsuite/ifuncmod5.c: New file.
5848         * testsuite/ifuncmain6pie.c: New file.
5849         * testsuite/ifuncmod6.c: New file.
5850         * testsuite/ifuncmain7.c: New file.
5851         * configure, testsuite/Makefile.in: Rebuild.
5852
5853 2010-08-18  Ian Lance Taylor  <iant@google.com>
5854
5855         * incremental.cc
5856         (Output_section_incremental_inputs::write_input_files): Add cast
5857         to avoid signed/unsigned comparison warning.
5858         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5859
5860 2010-08-12  Cary Coutant  <ccoutant@google.com>
5861
5862         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5863
5864 2010-08-13  Ian Lance Taylor  <iant@google.com>
5865
5866         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5867
5868 2010-08-12  Cary Coutant  <ccoutant@google.com>
5869             Doug Kwan  <dougkwan@google.com>
5870
5871         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5872         defintion overrides non-weak undef, remember that the original undef
5873         is not weak.
5874         * symtab.cc (Symbol_table::sized_write_global): For undef without
5875         an original weak binding, set binding to global in output.
5876         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5877         * testsuite/Makefile.in: Regenerate.
5878         * testsuite/strong_ref_weak_def.sh: New file.
5879         * testsuite/strong_ref_weak_def_1.c: Ditto.
5880         * testsuite/strong_ref_weak_def_2.c: Ditto.
5881
5882 2010-08-12  Cary Coutant  <ccoutant@google.com>
5883
5884         * testsuite/incremental_test.sh: Rewrite.
5885         * testsuite/incremental_test_1.c: Rewrite.
5886         * testsuite/incremental_test_2.c: Rewrite.
5887
5888 2010-08-12  Cary Coutant  <ccoutant@google.com>
5889
5890         * arm.cc (Target_arm::got_size): Add const.
5891         (Target_arm::got_entry_count): New function.
5892         (Target_arm::plt_entry_count): New function.
5893         (Target_arm::first_plt_entry_offset): New function.
5894         (Target_arm::plt_entry_size): New function.
5895         (Output_data_plt_arm::entry_count): New function.
5896         (Output_data_plt_arm::first_plt_entry_offset): New function.
5897         (Output_data_plt_arm::get_plt_entry_size): New function.
5898         * i386.cc (Target_i386::got_size): Add const.
5899         (Target_i386::got_entry_count): New function.
5900         (Target_i386::plt_entry_count): New function.
5901         (Target_i386::first_plt_entry_offset): New function.
5902         (Target_i386::plt_entry_size): New function.
5903         (Output_data_plt_i386::entry_count): New function.
5904         (Output_data_plt_i386::first_plt_entry_offset): New function.
5905         (Output_data_plt_i386::get_plt_entry_size): New function.
5906         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5907         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5908         * incremental.cc: Include target.h.
5909         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5910         parameter.  Adjust all callers.  Find incremental_got_plt section.
5911         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5912         section.
5913         (Output_section_incremental_inputs::set_final_data_size): Calculate
5914         size of incremental_got_plt section.
5915         (Output_section_incremental_inputs::do_write): Write the
5916         incremental_got_plt section.
5917         (Got_plt_view_info): New struct.
5918         (Local_got_offset_visitor): New class.
5919         (Global_got_offset_visitor): New class.
5920         (Global_symbol_visitor_got_plt): New class.
5921         (Output_section_incremental_inputs::write_got_plt): New function.
5922         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5923         Add parameter.  Adjust all callers.
5924         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5925         (Incremental_inputs::got_plt_section): New function.
5926         (Incremental_inputs::got_plt_section_): New data member.
5927         (Incremental_got_plt_reader): New class.
5928         * layout.cc (Layout::create_incremental_info_sections): Add the
5929         incremental_got_plt section.
5930         * object.h (Got_offset_list::get_list): New function.
5931         (Got offset_list::for_all_got_offsets): New function.
5932         (Sized_relobj::local_got_offset_list): New function.
5933         * powerpc.cc (Target_powerpc::got_size): Add const.
5934         (Target_powerpc::got_entry_count): New function.
5935         (Target_powerpc::plt_entry_count): New function.
5936         (Target_powerpc::first_plt_entry_offset): New function.
5937         (Target_powerpc::plt_entry_size): New function.
5938         (Output_data_plt_powerpc::entry_count): New function.
5939         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5940         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5941         * sparc.cc (Target_sparc::got_size): Add const.
5942         (Target_sparc::got_entry_count): New function.
5943         (Target_sparc::plt_entry_count): New function.
5944         (Target_sparc::first_plt_entry_offset): New function.
5945         (Target_sparc::plt_entry_size): New function.
5946         (Output_data_plt_sparc::entry_count): New function.
5947         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5948         (Output_data_plt_sparc::get_plt_entry_size): New function.
5949         * symtab.h (Symbol::got_offset_list): New function.
5950         (Symbol_table::for_all_symbols): New function.
5951         * target.h (Sized_target::got_entry_count): New function.
5952         (Sized_target::plt_entry_count): New function.
5953         (Sized_target::plt_entry_size): New function.
5954         * x86_64.cc (Target_x86_64::got_size): Add const.
5955         (Target_x86_64::got_entry_count): New function.
5956         (Target_x86_64::plt_entry_count): New function.
5957         (Target_x86_64::first_plt_entry_offset): New function.
5958         (Target_x86_64::plt_entry_size): New function.
5959         (Output_data_plt_x86_64::entry_count): New function.
5960         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5961         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5962
5963 2010-08-12  Cary Coutant  <ccoutant@google.com>
5964
5965         * archive.cc: Include incremental.h.
5966         (Archive::Archive): Initialize incremental_info_.
5967         (Archive::include_member): Record archive members in incremental info.
5968         (Add_archive_symbols::run): Record begin and end of an archive in
5969         incremental info.
5970         (Lib_group::include_member): Record objects in incremental info.
5971         * archive.h (Incremental_archive_entry): Forward declaration.
5972         (Archive::set_incremental_info): New member function.
5973         (Archive::incremental_info): New member function.
5974         (Archive::Unused_symbol_iterator): New class.
5975         (Archive::unused_symbols_begin): New member function.
5976         (Archive::unused_symbols_end): New member function.
5977         (Archive::incremental_info_): New data member.
5978         * incremental-dump.cc (find_input_containing_global): New function.
5979         (dump_incremental_inputs): Dump new incremental info sections.
5980         * incremental.cc: Include symtab.h.
5981         (Output_section_incremental_inputs): New class.
5982         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5983         new incremental info sections.
5984         (Sized_incremental_binary::do_check_inputs): Likewise.
5985         (Incremental_inputs::report_archive): Remove.
5986         (Incremental_inputs::report_archive_begin): New function.
5987         (Incremental_inputs::report_archive_end): New function.
5988         (Incremental_inputs::report_object): New function.
5989         (Incremental_inputs::finalize_inputs): Remove.
5990         (Incremental_inputs::report_input_section): New function.
5991         (Incremental_inputs::report_script): Rewrite.
5992         (Incremental_inputs::finalize): Do nothing but finalize string table.
5993         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5994         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5995         (Incremental_inputs::create_data_sections): New function.
5996         (Incremental_inputs::relocs_entsize): New function.
5997         (Output_section_incremental_inputs::set_final_data_size): New function.
5998         (Output_section_incremental_inputs::do_write): New function.
5999         (Output_section_incremental_inputs::write_header): New function.
6000         (Output_section_incremental_inputs::write_input_files): New function.
6001         (Output_section_incremental_inputs::write_info_blocks): New function.
6002         (Output_section_incremental_inputs::write_symtab): New function.
6003         * incremental.h (Incremental_script_entry): Forward declaration.
6004         (Incremental_object_entry): Forward declaration.
6005         (Incremental_archive_entry): Forward declaration.
6006         (Incremental_inputs): Forward declaration.
6007         (Incremental_inputs_header_data): Remove.
6008         (Incremental_inputs_header): Remove.
6009         (Incremental_inputs_header_write): Remove.
6010         (Incremental_inputs_entry_data): Remove.
6011         (Incremental_inputs_entry): Remove.
6012         (Incremental_inputs_entry_write): Remove.
6013         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6014         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6015         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6016         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6017         Likewise.
6018         (Incremental_input_entry): New class.
6019         (Incremental_script_entry): New class.
6020         (Incremental_object_entry): New class.
6021         (Incremental_archive_entry): New class.
6022         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6023         (Incremental_inputs::report_inputs): Remove.
6024         (Incremental_inputs::report_archive): Remove.
6025         (Incremental_inputs::report_archive_begin): New function.
6026         (Incremental_inputs::report_archive_end): New function.
6027         (Incremental_inputs::report_object): Change prototype.
6028         (Incremental_inputs::report_input_section): New function.
6029         (Incremental_inputs::report_script): Change prototype.
6030         (Incremental_inputs::get_reloc_count): New function.
6031         (Incremental_inputs::set_reloc_count): New function.
6032         (Incremental_inputs::create_data_sections): New function.
6033         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6034         (Incremental_inputs::inputs_section): New function.
6035         (Incremental_inputs::symtab_section): New function.
6036         (Incremental_inputs::relocs_section): New function.
6037         (Incremental_inputs::get_stringpool): Add const.
6038         (Incremental_inputs::command_line): Add const.
6039         (Incremental_inputs::inputs): Remove.
6040         (Incremental_inputs::command_line_key): New function.
6041         (Incremental_inputs::input_file_count): New function.
6042         (Incremental_inputs::input_files): New function.
6043         (Incremental_inputs::relocs_entsize): New function.
6044         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6045         (Incremental_inputs::finalize_inputs): Remove.
6046         (Incremental_inputs::Input_info): Remove.
6047         (Incremental_inputs::lock_): Remove.
6048         (Incremental_inputs::inputs_): Change type.
6049         (Incremental_inputs::inputs_map_): Remove.
6050         (Incremental_inputs::current_object_entry_): New data member.
6051         (Incremental_inputs::inputs_section_): New data member.
6052         (Incremental_inputs::symtab_section_): New data member.
6053         (Incremental_inputs::relocs_section_): New data member.
6054         (Incremental_inputs::reloc_count_): New data member.
6055         (Incremental_inputs_reader): New class.
6056         (Incremental_symtab_reader): New class.
6057         (Incremental_relocs_reader): New class.
6058         * layout.cc (Layout::finalize): Move finalization of incremental info
6059         and creation of incremental info sections to follow finalization of
6060         symbol table.  Set offsets for postprocessing sections.
6061         (Layout::create_incremental_info_sections): Call
6062         Incremental_inputs::create_data_sections.  Add incremental symtab
6063         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6064         sections to layout after input sections.
6065         * layout.h (struct Timespec): Forward declaration.
6066         (Layout::incremental_inputs): Add const.
6067         (Layout::create_incremental_info_sections): Add parameter.
6068         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6069         * object.cc: Include incremental.h.
6070         (Relobj::finalize_incremental_relocs): New function.
6071         (Sized_relobj::do_layout): Record input sections in incremental info.
6072         * object.h (Object::output_section): New function.
6073         (Object::output_section_offset): Moved from Relobj.
6074         (Object::get_incremental_reloc_base): New function.
6075         (Object::get_incremental_reloc_count): New function.
6076         (Object::do_output_section): New function.
6077         (Object::do_output_section_offset): Moved from Relobj.
6078         (Object::do_get_incremental_reloc_base): New function.
6079         (Object::do_get_incremental_reloc_count): New function.
6080         (Object::Object): Initialize new data members.
6081         (Relobj::output_section): Renamed do_output_section and moved to
6082         protected.
6083         (Relobj::output_section_offset): Moved to Object.
6084         (Relobj::do_get_incremental_reloc_base): New function.
6085         (Relobj::do_get_incremental_reloc_count): New function.
6086         (Relobj::allocate_incremental_reloc_counts): New function.
6087         (Relobj::count_incremental_reloc): New function.
6088         (Relobj::finalize_incremental_relocs): New function.
6089         (Relobj::next_incremental_reloc_index): New function.
6090         (Relobj::reloc_counts_): New data member.
6091         (Relobj::reloc_bases_): New data member.
6092         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6093         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6094         (Sized_relobj::incremental_relocs_scan): New function.
6095         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6096         (Sized_relobj::incremental_relocs_write): New function.
6097         (Sized_relobj::incremental_relocs_write_reltype): New function.
6098         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6099         incremental link.
6100         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6101         archives and object files elsewhere.
6102         (Add_symbols::run): Report object files here.
6103         (Finish_group::run): Report end of archive at end of group.
6104         * reloc.cc: Include layout.h, incremental.h.
6105         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6106         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6107         (Sized_relobj::incremental_relocs_scan): New function.
6108         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6109         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6110         (Sized_relobj::incremental_relocs_write): New function.
6111         (Sized_relobj::incremental_relocs_write_reltype): New function.
6112         * script.cc (read_input_script): Rewrite test for incremental link.
6113         Change call to Incremental_inputs::report_script.
6114         * symtab.h (Symbol_table::first_global_index): New function.
6115         (Symbol_table::output_count): New function.
6116
6117 2010-08-12  Doug Kwan  <dougkwan@google.com>
6118
6119         * arm.cc (Target_arm::merge_object_attributes): Check command line
6120         options --no-wchar-size-warning and --no-enum-size-warning.
6121         * options.h (General_options): Add ld-compatible options
6122         --no-enum-size-warning and --no-wchar-size-warning.
6123
6124 2010-08-04  Ian Lance Taylor  <iant@google.com>
6125
6126         * x86_64.cc (Target_x86_64::Scan::local): Use
6127         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6128         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6129         (Target_x86_64::Scan::global): Likewise.
6130         (Target_x86_64::Relocate::relocate): Likewise.
6131         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6132         Likewise.
6133
6134 2010-08-03  Cary Coutant  <ccoutant@google.com>
6135
6136         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6137         to reserve space in merged_strings vector. Keep total input size
6138         for stats.
6139         (Output_merge_string::do_print_merge_stats): Print total input size.
6140         * merge.h (Output_merge_string): Add input_size_ field.
6141         * stringpool.cc (Stringpool_template::string_length): Move
6142         implementations out of Stringpool_template class and place in
6143         stringpool.h.
6144         * stringpool.h (string_length): Move out of Stringpool_template.
6145
6146 2010-08-03  Ian Lance Taylor  <iant@google.com>
6147
6148         PR 11712
6149         * layout.cc (relaxation_loop_body): If address of load segment is
6150         set, adjust address to include headers if possible.
6151
6152 2010-08-03  Ian Lance Taylor  <iant@google.com>
6153
6154         * version.cc (version_string): Bump to 1.10.
6155
6156 2010-08-03  Ian Lance Taylor  <iant@google.com>
6157
6158         PR 11805
6159         * layout.h (enum Output_section_order): Define.
6160         (class Layout): Update declarations.
6161         * layout.cc (Layout::get_output_section): Add order parameter.
6162         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6163         is_first_non_relro parameters.  Change all callers.
6164         (Layout::choose_output_section): Likewise.
6165         (Layout::add_output_section_data): Likewise.
6166         (Layout::make_output_section): Likewise.  Set order.
6167         (Layout::default_section_order): New function.
6168         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6169         * output.cc (Output_section::Output_section): Initialize order_.
6170         Don't initialize deleted fields.
6171         (Output_segment::Output_segment): Don't initialize deleted
6172         fields.
6173         (Output_segment::add_output_section_to_load): New function
6174         replacing add_output_section.  Change all callers to call this or
6175         add_output_section_to_nonload.
6176         (Output_segment::add_output_section_to_nonload): New function.
6177         (Output_segment::remove_output_section): Rewrite.
6178         (Output_segment::add_initial_output_data): Likewise.
6179         (Output_segment::has_any_data_sections): Likewise.
6180         (Output_segment::is_first_section_relro): Likewise.
6181         (Output_segment::maximum_alignment): Likewise.
6182         (Output_segment::has_dynamic_reloc): New function replacing
6183         dynamic_reloc_count.  Change all callers.
6184         (Output_segment::has_dynamic_reloc_list): New function replacing
6185         dynamic_reloc_count_list.  Change all callers.
6186         (Output_segment::set_section_addresses): Rewrite.
6187         (Output_segment::set_offset): Rewrite.
6188         (Output_segment::find_first_and_last_list): Remove.
6189         (Output_segment::set_tls_offsets): Rewrite.
6190         (Output_segment::first_section_load_address): Likewise.
6191         (Output_segment::output_section_count): Likewise.
6192         (Output_segment::section_with_lowest_load_address): Likewise.
6193         (Output_segment::write_section_headers): Likewise.
6194         (Output_segment::print_sections_to_map): Likewise.
6195         * output.h (class Output_data): Remove dynamic_reloc_count_
6196         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6197         (Output_data::add_dynamic_reloc): Rewrite.
6198         (Output_data::has_dynamic_reloc): New function.
6199         (Output_data::dynamic_reloc_count): Remove.
6200         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6201         is_last_relro_, is_first_non_relro_, is_interp_,
6202         is_dynamic_linker_section_ fields.  Add order and set_order
6203         functions.  Remove is_relro_local, set_is_relro_local,
6204         is_last_relro, set_is_last_relro, is_first_non_relro,
6205         set_is_first_non_relro functions, is_interp, set_is_interp,
6206         is_dynamic_linker_section, and set_is_dynamic_linker_section
6207         functions.
6208         (class Output_segment): Change Output_data_list from std::list to
6209         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6210         output_bss_ fields.  Update declarations.
6211
6212 2010-08-02  Ian Lance Taylor  <iant@google.com>
6213
6214         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6215         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6216         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6217
6218 2010-08-02  Ian Lance Taylor  <iant@google.com>
6219
6220         PR 11855
6221         * script.cc (Script_options::Script_options): Initialize
6222         symbol_definitions_ and symbol_references_.
6223         (Script_options::add_symbol_assignment): Update
6224         symbol_definitions_ and symbol_references_.
6225         (Script_options::add_symbol_reference): New function.
6226         (script_symbol): New function.
6227         * script.h (class Script_options): Add symbol_definitions_ and
6228         symbol_references_ fields.
6229         (Script_options::referenced_const_iterator): New type.
6230         (Script_options::referenced_begin): New function.
6231         (Script_options::referenced_end): New function.
6232         (Script_options::is_referenced): New function.
6233         (Script_options::any_unreferenced): New function.
6234         * script-c.h (script_symbol): Declare.
6235         * yyscript.y (exp): Call script_symbol.
6236         * symtab.cc: Include "script.h".
6237         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6238         Change all callers.  Check symbols referenced by scripts.
6239         (Symbol_table::add_undefined_symbols_from_command_line): Add
6240         layout parameter.  Change all callers.
6241         (Symbol_table::do_add_undefined_symbols_from_command_line):
6242         Likewise.  Break out loop body.  Check symbols referenced by
6243         scripts.
6244         (Symbol_table::add_undefined_symbol_from_command_line): New
6245         function broken out of
6246         do_add_undefined_symbols_from_command_line.
6247         * symtab.h (class Symbol_table): Update declarations.
6248         * archive.cc: Include "layout.h".
6249         (Archive::should_include_member): Add layout parameter.  Change
6250         all callers.  Check for symbol mentioned in expression.
6251         * archive.h (class Archive): Update declaration.
6252         * object.cc (Sized_relobj::do_should_include_member): Add layout
6253         parameter.
6254         * object.h (Object::should_include_member): Add layout parameter.
6255         Change all callers.
6256         (Object::do_should_include_member): Add layout parameter.
6257         (class Sized_relobj): Update declaration.
6258         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6259         parameter.
6260         * dynobj.h (class Sized_dynobj): Update declaration.
6261         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6262         layout parameter.
6263         * plugin.h (class Sized_pluginobj): Update declaration.
6264
6265 2010-08-02  Ian Lance Taylor  <iant@google.com>
6266
6267         PR 11866
6268         * output.cc (Output_segment::set_offset): Search for the first and
6269         last sections rather than assuming that the list is in order.
6270         (Output_segment::find_first_and_last_list): New function.
6271         * output.h (class Output_segment): Update declarations.
6272         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6273         (relro_strip_test_SOURCES): New variable.
6274         (relro_strip_test_DEPENDENCIES): New variable.
6275         (relro_strip_test_LDFLAGS): New variable.
6276         (relro_strip_test_LDADD): New variable.
6277         (relro_strip_test.so): New target.
6278
6279 2010-08-02  Ian Lance Taylor  <iant@google.com>
6280
6281         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6282         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6283         (Target_i386::got_tlsdesc_section): New function.
6284         (Target_i386::got_section): Create space for GOT entries for
6285         TLSDESC relocations.
6286         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6287         R_386_TLS_GOTDESC.
6288         (Target_i386::Scan::global): Likewise.
6289         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6290         using TLSDESC GOT.
6291         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6292         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6293         (Target_x86_64::got_tlsdesc_section): New function.
6294         (Target_x86_64::got_section): Create space for GOT entries for
6295         TLSDESC relocations.
6296         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6297         R_386_TLS_GOTDESC.
6298         (Target_x86_64::Scan::global): Likewise.
6299         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6300         using TLSDESC GOT.
6301
6302 2010-08-02  Ian Lance Taylor  <iant@google.com>
6303
6304         * testsuite/final_layout.sh: Use dc to convert from hex to
6305         decimal.
6306
6307 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6308
6309         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6310         paramter to the call to gold::gc_process_relocs.
6311         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6312         paramter to the call to gold::gc_process_relocs.
6313         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6314         parameter to the call to gold::gc_process_relocs.
6315         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6316         template parameter to the call to gold::gc_process_relocs.
6317         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6318         paramter to the call to gold::gc_process_relocs.
6319         * gc.h (get_embedded_addend_size): New function.
6320         (gc_process_relocs): Save the size of the reloc for use by ICF.
6321         * icf.cc (get_section_contents): Get the addend from the text section
6322         for SHT_REL relocation sections.
6323         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6324         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6325         * int_encoding.h (read_from_pointer): New overloaded function.
6326         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6327         * testsuite/icf_sht_rel_addend_test.sh: New file.
6328         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6329         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6330
6331 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6332
6333         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6334         * Makefile.in: Regenerate.
6335         * testsuite/Makefile.in: Regenerate.
6336
6337 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6338
6339         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6340         * gold/testsuite/debug_msg.cc: Likewise.
6341         * gold/testsuite/odr_violation1.cc
6342         * gold/testsuite/odr_violation2.cc
6343
6344 2010-07-21  Cary Coutant  <ccoutant@google.com>
6345
6346         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6347         string, and length fields.
6348         (Output_merge_string::Merged_strings_list): New type.
6349         (Output_merge_string::Merged_strings_lists): New typedef.
6350         (Output_merge_string): Replace merged_strings_ with
6351         merged_strings_lists_.
6352         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6353         Merged_strings_list per input object and section.  Don't store pointer
6354         to the string.  Don't store length with each merged string entry.
6355         (Output_merge_string::finalize_merged_data): Loop over list of merged
6356         strings lists.  Recompute length of each merged string.
6357
6358 2010-07-15  Cary Coutant  <ccoutant@google.com>
6359
6360         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6361         here.
6362
6363 2010-07-14  Ian Lance Taylor  <iant@google.com>
6364
6365         * descriptors.cc (Descriptors::open): Report correct name in error
6366         message.
6367
6368 2010-07-13  Doug Kwan  <dougkwan@google.com>
6369
6370         * arm.cc (Arm_input_section::Arm_input_section): For a
6371         SHT_ARM_EXIDX section, always keeps the input sections.
6372         (Arm_input_section::set_exidx_section_link): New method.
6373         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6374         has_errors_ to false.
6375         (Arm_exidx_input_section::has_errors,
6376         Arm_exidx_input_section::set_has_errors): New methods.
6377         (Arm_exidx_input_section::has_errors_): New data member.
6378         (Arm_relobj::get_exidx_shndx_list): New method.
6379         (Arm_output_section::append_text_sections_to_list): Do not skip
6380         section without SHF_EXECINSTR.
6381         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6382         errors.
6383         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6384         section header.  Make error messages more verbose.  Check for
6385         a non-executable section linked to an EXIDX section.
6386         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6387         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6388         check that there is no deferred EXIDX section if we exit early.
6389         Instead of not making an EXIDX section in case of an error, make one
6390         and set the has_errors flag of it.
6391         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6392         in a relocatable link.
6393         (Target_arm::do_relax): Look for the EXIDX output section instead of
6394         assuming that it is called .ARM.exidx.
6395         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6396         section list.  Do not check for SHF_EXECINSTR section flags but
6397         skip any input section with errors.
6398         * output.cc (Output_section::Output_section): Initialize
6399         always_keeps_input_sections_ to false.
6400         (Output_section::add_input_section): Check for
6401         always_keeps_input_sections_.
6402         *  output.h (Output_section::always_keeps_input_sections,
6403         Output_section::set_always_keeps_input_sections): New methods.
6404         (Output_section::always_keeps_input_sections): New data member.
6405
6406 2010-07-13  Rafael Espindola  <espindola@google.com>
6407
6408         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6409         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6410
6411 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6412             Ian Lance Taylor  <iant@google.com>
6413
6414         * output.h (Output_section_lookup_maps::add_merge_section):
6415         Correct check of whether value was inserted.
6416         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6417         (Output_section_lookup_maps::add_relaxed_input_section):
6418         Likewise.
6419         * arm.cc (Target_arm::got_section): Remove used local os.
6420         * i386.cc (Target_i386::got_section): Likewise.
6421         * x86_64.cc (Target_x86_64::got_section): Likewise.
6422         * sparc.cc (Target_sparc::got_section): Likewise.
6423         (Target_sparc::relocate): Remove unused local have_got_offset.
6424         * powerpc.cc (Target_powerpc::relocate): Likewise.
6425
6426 2010-07-13  Ian Lance Taylor  <iant@google.com>
6427
6428         * compressed_output.cc (zlib_decompress): Fix signature in
6429         !HAVE_ZLIB_H case.
6430
6431         * archive.cc (Archive::include_member): Unlock an external member
6432         of a thin archive.  Don't bother to delete an object we know is
6433         NULL.
6434
6435 2010-07-12  Cary Coutant  <ccoutant@google.com>
6436
6437         * compressed_output.cc (zlib_decompress): New function.
6438         (get_uncompressed_size): New function.
6439         (decompress_input_section): New function.
6440         * compressed_output.h (get_uncompressed_size): New function.
6441         (decompress_input_section): New function.
6442         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6443         Handle compressed debug sections.
6444         * layout.cc (is_compressed_debug_section): New function.
6445         (Layout::output_section_name): Map compressed section names to
6446         canonical names.
6447         * layout.h (is_compressed_debug_section): New function.
6448         (is_debug_info_section): Recognize compressed debug sections.
6449         * merge.cc: Include compressed_output.h.
6450         (Output_merge_data::do_add_input_section): Handle compressed
6451         debug sections.
6452         (Output_merge_string::do_add_input_section): Handle compressed
6453         debug sections.
6454         * object.cc: Include compressed_output.h.
6455         (Sized_relobj::Sized_relobj): Initialize new data members.
6456         (build_compressed_section_map): New function.
6457         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6458         * object.h (Object::section_is_compressed): New method.
6459         (Object::do_section_is_compressed): New method.
6460         (Sized_relobj::Compressed_section_map): New type.
6461         (Sized_relobj::do_section_is_compressed): New method.
6462         (Sized_relobj::compressed_sections_): New data member.
6463         * output.cc (Output_section::add_input_section): Handle compressed
6464         debug sections.
6465         * reloc.cc: Include compressed_output.h.
6466         (Sized_relobj::write_sections): Handle compressed debug sections.
6467
6468 2010-07-08  Cary Coutant  <ccoutant@google.com>
6469
6470         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6471         weak when resolving to a dynamic def.
6472         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6473         for weak undef/dynamic def cases. Adjust callers.
6474         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6475         undef_binding_weak_.
6476         (Symbol_table::sized_write_globals): Adjust symbol binding.
6477         (Symbol_table::sized_write_symbol): Add binding parameter.
6478         * symtab.h (Symbol::set_undef_binding): New method.
6479         (Symbol::is_undef_binding_weak): New method.
6480         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6481         (Symbol_table::should_override): Add new parameter.
6482         (Symbol_table::sized_write_symbol): Add new parameter.
6483
6484         * testsuite/weak_undef_file1.cc: Add new test case.
6485         * testsuite/weak_undef_file2.cc: Fix header comment.
6486         * testsuite/weak_undef_test.cc: Add new test case.
6487
6488 2010-06-29  Doug Kwan  <dougkwan@google.com>
6489
6490         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6491         Initialize USE_SYMBOL_.
6492         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6493         definition.
6494         (Arm_reloc_property::uses_symbol_): New data member declaration.
6495         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6496         uses symbol value and symbol is undefined but not weakly undefined.
6497
6498 2010-06-28  Rafael Espindola  <espindola@google.com>
6499
6500         * plugin.cc (Plugin::load): Use dlerror.
6501
6502 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6503
6504         * symtab.cc (detect_odr_violations): When reporting an ODR
6505         violation, report an object where the symbol is defined.
6506
6507 2010-06-25  Doug Kwan  <dougkwan@google.com>
6508
6509         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6510         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6511         definition.
6512         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6513         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6514         target hook to detect function points.
6515         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6516         * icf.h (Icf::check_section_for_function_pointers): Change type of
6517         parameter SECTION_NAME to const reference to std::string.  Use
6518         target hook to determine if section may have unsafe pointers.
6519         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6520         method definition.
6521
6522 2010-06-21  Rafael Espindola  <espindola@google.com>
6523
6524         * fileread.cc (Input_file::find_fie): New
6525         (Input_file::open): Use Input_file::find_fie.
6526         * fileread.h (Input_file::find_fie): New
6527         * plugin.cc (set_extra_library_path): New.
6528         (Plugin::load): Add set_extra_library_path to the transfer vector.
6529         (Plugin_manager::set_extra_library_path): New.
6530         (Plugin_manager::add_input_file): Use the extra search path if set.
6531         (set_extra_library_path(): New.
6532         * plugin.h (Plugin_manager): Add set_extra_library_path and
6533         extra_search_path_.
6534
6535 2010-06-19  Cary Coutant  <ccoutant@google.com>
6536
6537         * layout.cc (gdb_sections): Add .debug_types.
6538         (lines_only_debug_sections): Likewise.
6539
6540 2010-06-18  Rafael Espindola  <espindola@google.com>
6541
6542         * plugin.cc (add_input_file,add_input_library)
6543         (Plugin_manager::add_input_file): Make filename arguments const.
6544         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6545         const.
6546
6547 2010-06-16  Doug Kwan  <dougkwan@google.com>
6548
6549         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6550         .ARM.attributes section if we have not merged any input
6551         attributes sections.
6552
6553 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6554
6555         * arm.cc: Allow combining objects with no EABI version
6556         information.
6557
6558 2010-06-15  Rafael Espindola  <espindola@google.com>
6559
6560         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6561
6562 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6563
6564         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6565         (struct iovec): Correct !HAVE_READV definition.
6566
6567 2010-06-10  Cary Coutant  <ccoutant@google.com>
6568
6569         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6570         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6571         reloc sections.
6572         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6573
6574         PR 11683
6575         * symtab.h (Symbol::is_placeholder): New member function.
6576         * target-reloc.h (relocate_section): Check for placeholder symbols.
6577
6578         * testsuite/Makefile.am (plugin_test_8): New test.
6579         (plugin_test_9): New test.
6580         * testsuite/Makefile.in: Regenerate.
6581
6582 2010-06-09  Nick Clifton  <nickc@redhat.com>
6583
6584         * yyscript.y (input_list_element): Allow strings prefixed with
6585         the '-' character.  Treat these as libraries.
6586         * script.cc (script_add_library): New function.  Adds a library
6587         specified by "-l<name>" found in an input script.
6588         * script-c.h: Add prototype for script_add_library.
6589
6590 2010-06-07  Doug Kwan  <dougkwan@google.com>
6591
6592         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6593         Restrict stub-group size to be within long conditional branch
6594         range when working around cortex-A8 erratum.
6595
6596 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6597
6598         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6599         #ifdef typo.
6600
6601 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6602
6603         PR gold/11658
6604         * output.cc
6605         (Output_section::Input_section_sort_entry::compare_section_ordering):
6606         Change to return non-zero correctly.
6607         (Output_section::Input_section_sort_section_order_index_compare
6608         ::operator()): Change to fix ambiguity in comparisons.
6609
6610 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6611
6612         * gold.h (is_wildcard_string): New function.
6613         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6614         (Layout::layout_eh_frame): Ditto.
6615         (Layout::find_section_order_index): New method.
6616         (Layout::read_layout_from_file): New method.
6617         * layout.h (Layout::find_section_order_index): New method.
6618         (Layout::read_layout_from_file): New method.
6619         (Layout::input_section_position_): New private member.
6620         (Layout::input_section_glob_): New private member.
6621         * main.cc (main): Call read_layout_from_file here.
6622         * options.h (--section-ordering-file): New option.
6623         * output.cc (Output_section::input_section_order_specified_): New
6624         member.
6625         (Output_section::Output_section): Initialize new member.
6626         (Output_section::add_input_section): Add new parameter.
6627         Keep input sections when --section-ordering-file is used.
6628         (Output_section::set_final_data_size): Sort input sections when
6629         section ordering file is specified.
6630         (Output_section::Input_section_sort_entry): Add new parameter.
6631         Check sorting type.
6632         (Output_section::Input_section_sort_entry::compare_section_ordering):
6633         New method.
6634         (Output_section::Input_section_sort_compare::operator()): Change to
6635         consider section_order_index.
6636         (Output_section::Input_section_sort_init_fini_compare::operator()):
6637         Change to consider section_order_index.
6638         (Output_section::Input_section_sort_section_order_index_compare
6639         ::operator()): New method.
6640         (Output_section::sort_attached_input_sections): Change to sort
6641         according to section order when specified.
6642         (Output_section::add_input_section<32, true>): Add new parameter.
6643         (Output_section::add_input_section<64, true>): Add new parameter.
6644         (Output_section::add_input_section<32, false>): Add new parameter.
6645         (Output_section::add_input_section<64, false>): Add new parameter.
6646         * output.h (Output_section::add_input_section): Add new parameter.
6647         (Output_section::input_section_order_specified): New
6648         method.
6649         (Output_section::set_input_section_order_specified): New method.
6650         (Input_section::Input_section): Initialize section_order_index_.
6651         (Input_section::section_order_index): New method.
6652         (Input_section::set_section_order_index): New method.
6653         (Input_section::section_order_index_): New member.
6654         (Input_section::Input_section_sort_section_order_index_compare): New
6655         struct.
6656         (Output_section::input_section_order_specified_): New member.
6657         * script-sections.cc (is_wildcard_string): Delete and move modified
6658         method to gold.h.
6659         (Output_section_element_input::Output_section_element_input): Modify
6660         call to is_wildcard_string.
6661         (Output_section_element_input::Input_section_pattern
6662         ::Input_section_pattern): Ditto.
6663         (Output_section_element_input::Output_section_element_input): Ditto.
6664         * testsuite/Makefile.am (final_layout): New test case.
6665         * testsuite/Makefile.in: Regenerate.
6666         * testsuite/final_layout.cc: New file.
6667         * testsuite/final_layout.sh: New file.
6668
6669 2010-06-01  Rafael Espindola  <espindola@google.com>
6670
6671         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6672
6673 2010-06-01  Rafael Espindola  <espindola@google.com>
6674
6675         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6676         visibility of symbols.
6677
6678 2010-05-27  Doug Kwan  <dougkwan@google.com>
6679
6680         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6681         from start of output section instead of address for a local symbol
6682         in a merged or relaxed section when doing a relocatable link.
6683
6684 2010-05-26  Rafael Espindola  <espindola@google.com>
6685
6686         PR 11604
6687         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6688         adding sections the garbage collector removed.
6689         * gold/testsuite/Makefile.am: Add test.
6690         * gold/testsuite/Makefile.in: Regenerate.
6691         * gold/testsuite/plugin_test_7.sh: New.
6692         * gold/testsuite/plugin_test_7_1.c: New.
6693         * gold/testsuite/plugin_test_7_2.c: New.
6694
6695 2010-05-26  Rafael Espindola  <espindola@google.com>
6696
6697         * script-sections.cc (Output_section_definition::set_section_addresses):
6698         Check for --section-start.
6699
6700 2010-05-26  Doug Kwan  <dougkwan@google.com>
6701
6702         * arm.cc (Arm_scan_relocatable_relocs): New class.
6703         (Target_arm::relocate_special_relocatable): New method.
6704         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6705         (Arm_relocate_functions::thumb_branch_common): Same.
6706         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6707         instead of Default_scan_relocatable_relocs.
6708         * target-reloc.h (relocate_for_relocatable): Let target handle
6709         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6710         * target.h (Sized_target::relocate_special_relocatable): New method.
6711
6712 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6713
6714         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6715
6716 2010-05-23  Doug Kwan  <dougkwan@google.com>
6717
6718         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6719         instead of a cast.
6720         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6721         with a direct branch, not a conditional branch, to a stub.
6722         * merge.cc (Output_merge_base::record_input_section): New method
6723         defintion.
6724         (Output_merge_data::do_add_input_section): Record input section if
6725         keeps-input-sections flag is set.
6726         (Output_merge_string::do_add_input_section): Ditto.
6727         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6728         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6729         INPUT_SECTIONS_.
6730         (Output_merge_base::keeps_input_sections,
6731         Output_merge_base::set_keeps_input_sections,
6732         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6733         method definitions.
6734         (Output_merge_base::Input_sections): New type declaration.
6735         (Output_merge_base::input_sections_begin,
6736         Output_merge_base::input_sections_end,
6737         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6738         (Output_merge_base::bool keeps_input_sections_,
6739         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6740         Output_merge_base::input_sections_): New data members.
6741         (Output_merge_data::do_set_keeps_input_sections): New method
6742         defintion.
6743         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6744         * output.cc (Output_section::Input_section::relobj): Move method
6745         defintion from class declaration to here and handle merge sections.
6746         (Output_section::Input_section::shndx): Ditto.
6747         (Output_section::Output_section): Remove initializations of removed
6748         data members and initialize new data member LOOKUP_MAPS_.
6749         (Output_section::add_input_section): Set keeps-input-sections flag
6750         for a newly created merge output section as appropriate.  Adjust code
6751         to use Output_section_lookup_maps class.
6752         (Output_section::add_relaxed_input_section): Adjst code for lookup
6753         maps code refactoring.
6754         (Output_section::add_merge_input_section): Add a new parameter
6755         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6756         class.  If adding input section to a newly created merge output
6757         section fails, remove the new merge section.
6758         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6759         Adjust code for use of the Output_section_lookup_maps class.
6760         (Output_section::find_merge_section): Ditto.
6761         (Output_section::build_lookup_maps): New method defintion.
6762         (Output_section::find_relaxed_input_section): Adjust code to use
6763         Output_section_lookup_maps class.
6764         (Output_section::get_input_sections): Export merge sections.  Adjust
6765         code to use Output_section_lookup_maps class.
6766         (Output_section:::add_script_input_section): Adjust code to use
6767         Output_section_lookup_maps class.  Update lookup maps for merge
6768         sections also.
6769         (Output_section::discard_states): Use Output_section_lookup_maps.
6770         (Output_section::restore_states): Same.
6771         * output.h (Merge_section_properties): Move class defintion out of
6772         Output_section.
6773         (Output_section_lookup_maps): New class.
6774         (Output_section::Input_section::is_merge_section): New method
6775         defintion.
6776         (Output_section::Input_section::relobj): Move defintion out of class
6777         defintion.  Declare method only.
6778         (Output_section::Input_section::shndx): Ditto.
6779         (Output_section::Input_section::output_merge_base): New method defintion.
6780         (Output_section::Input_section::u2_.pomb): New union field.
6781         (Output_section::Merge_section_by_properties_map,
6782         Output_section::Output_section_data_by_input_section_map,
6783         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6784         Remove types.
6785         (Output_section::add_merge_input_section): Add new parameter
6786         KEEPS_INPUT_SECTIONS.
6787         (Output_section::build_lookup_maps): New method declaration.
6788         (Output_section::merge_section_map_,
6789         Output_section::merge_section_by_properties_map_,
6790         Output_section::relaxed_input_section_map_,
6791         Output_section::is_relaxed_input_section_map_valid_): Remove data
6792         members.
6793         (Output_section::lookup_maps_): New data member.
6794
6795 2010-05-21  Doug Kwan  <dougkwan@google.com>
6796
6797         PR gold/11619
6798         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6799         avoid a compilation error.
6800
6801 2010-05-19  Rafael Espindola  <espindola@google.com>
6802
6803         * script-sections.cc (Output_section_definition::allocate_to_segment):
6804         Update the phdrs_list even when the output section is NULL.
6805         * testsuite/Makefile.am: Add test.
6806         * testsuite/Makefile.in: Regenerate.
6807         * testsuite/script_test_9.cc: New.
6808         * testsuite/script_test_9.sh: New.
6809         * testsuite/script_test_9.t: New.
6810
6811 2010-05-19  Doug Kwan  <dougkwan@google.com>
6812
6813         * arm.cc (Arm_input_section::original_size): New method.
6814         (Arm_input_section::do_addralign): Add a cast.
6815         (Arm_input_section::do_output_offset): Remove static cast.
6816         (Arm_input_section::original_addralign,
6817          Arm_input_section::original_size_): Change type to uint32_t.
6818         (Arm_input_section::init): Add safe casts for section alignment
6819         and size.
6820         (Arm_input_section::set_final_data_size): Do not set address and
6821         offset of stub table.
6822         (Arm_output_section::fix_exidx_coverage): Change use of of
6823         Output_section::Simple_input_section to that of
6824         Output_section::Input_section.
6825         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6826         except for the first pass.
6827         * output.cc (Output_section::get_input_sections): Change type of
6828         input_sections to std::list<Input_section>.
6829         (Output_section::add_script_input_section): Rename from
6830         Output_section::add_simple_input_section.  Change type of SIS
6831         parameter from Simple_input_section to Input_section.
6832         * output.h (Output_section::Simple_input_section): Remove class.
6833         (Output_section::Input_section): Change class visibility to public.
6834         (Output_section::Input_section::addralign): Use stored alignments
6835         for special input sections if set.
6836         (Output_section::Input_section::set_addralign): New method.
6837         (Output_section::get_input_sections): Change parameter type from
6838         list of Simple_input_section to list of Input_section.
6839         (Output_section::add_script_input_section): Rename from
6840         Output_section::add_simple_input_section. Change first parameter's
6841         type from Simple_input_section to Input_section and remove the
6842         second and third parameters.
6843         * script-sections.cc (Input_section::Input_section_list): Change
6844         type to list of Output_section::Input_section/
6845         (Input_section_info::Input_section_info): Change parameter type of
6846         INPUT_SECTION to Output_section::Input_section.
6847         (Input_section_info::input_section): Change return type.
6848         (Input_section_info::input_section_): Change type to
6849         Output_section::Input_section.
6850         (Output_section_element_input::set_section_addresses): Adjust code
6851         to use Output_section::Input_section instead of
6852         Output_section::Simple_input_section.  Adjust code for renaming
6853         of Output_section::add_simple_input_section.
6854         (Orphan_output_section::set_section_addresses): Ditto.
6855
6856 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6857
6858         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6859         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6860
6861 2010-05-18  Rafael Espindola  <espindola@google.com>
6862
6863         * options.cc (General_options::finalize): Handle -nostdlib.
6864         * options.h (nostdlib): New option.
6865         * script.cc (script_add_search_dir): Handle -nostdlib.
6866
6867 2010-05-12  Doug Kwan  <dougkwan@google.com>
6868
6869         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6870         attributes section only if there no attributes section after merging.
6871         (Target_arm::merge_object_attributes): Move value of
6872         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6873         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6874         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6875         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6876         and arm_attr_merge_7.stdout.
6877         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6878         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6879         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6880         arm_attr_merge_7b.o): New rules.
6881         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6882         arm_attr_merge_7
6883         * testsuite/Makefile.in: Regenerate.
6884         * testsuite/arm_attr_merge.sh: New file.
6885         * testsuite/arm_attr_merge_[67][ab].s: Same.
6886
6887 2010-05-05  Nick Clifton  <nickc@redhat.com>
6888
6889         * po/es.po: Updated Spanish translation.
6890
6891 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6892
6893         * Makefile.am (install-exec-local): Properly install gold as
6894         default cross linker.
6895         * Makefile.in: Regenerated.
6896
6897 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6898             Nick Clifton  <nickc@redhat.com>
6899
6900         * configure.ac (install_as_default): Define and set to false
6901         unless --enable-gold or --enable-gold=both/gold has been
6902         specified.
6903         * configure: Regenerate.
6904
6905         * Makefile.am (install-exec-local): Install the executable as
6906         'ld.gold'.  If install_as_default is true then also install it as
6907         'ld'.
6908         * Makefile.in: Regenerated.
6909
6910 2010-04-24  Ian Lance Taylor  <iant@google.com>
6911
6912         * layout.cc (Layout::layout_reloc): In relocatable link don't
6913         combine reloc sections for grouped sections.
6914
6915 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6916
6917         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6918         sections that are not ordinary to icf.
6919         * icf.cc (get_section_contents): Handle relocation pointing to section
6920         with no object or shndx information.
6921         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6922         * testsuite/Makefile.in: Regenerate.
6923         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6924         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6925
6926 2010-04-22  Ian Lance Taylor  <iant@google.com>
6927
6928         * expression.cc (Expression::Expression_eval_info): Add
6929         result_alignment_pointer field.
6930         (Expression::eval_with_dot): Add result_alignment_pointer
6931         parameter.  Change all callers.
6932         (Expression::eval_maybe_dot): Likewise.
6933         (class Binary_expression): Add alignment_pointer parameter to
6934         left_value and right_value.  Change all callers.
6935         (BINARY_EXPRESSION): Set result alignment.
6936         (class Trinary_expression): Add alignment_pointer parameter to
6937         arg2_value and arg3_value.  Change all callers.
6938         (Trinary_cond::value): Set result alignment.
6939         (Max_expression::value, Min_expression::value): Likewise.
6940         (Align_expression::value): Likewise.
6941         * script-sections.cc (class Sections_element): Add dot_alignment
6942         parameter to set_section_addresses virtual function.  Update
6943         instantiations.
6944         (class Output_section_element): Likewise.
6945         (Script_sections::create_segments): Add dot_alignment parameter.
6946         Change all callers.
6947         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6948         (Script_sections::set_phdrs_clause_addresses): Likewise.
6949         * script-sections.h: Update declarations.
6950         * script.h: Update declarations.
6951         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6952         min_p_align.
6953         * testsuite/script_test_3.t: Set large alignment.
6954         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6955         segment has expected alignment.
6956
6957 2010-04-22  Nick Clifton  <nickc@redhat.com>
6958
6959         * po/gold.pot: Updated by the Translation project.
6960         * po/vi.po: Updated Vietnamese translation.
6961
6962 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6963
6964         * testsuite/Makefile.am (check_PROGRAMS): Add
6965         icf_virtual_function_folding_test.
6966         * testsuite/Makefile.in: Regenerated.
6967
6968 2010-04-15  Andrew Haley  <aph@redhat.com>
6969
6970         * options.h (merge_exidx_entries): New option.
6971         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6972         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6973         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6974         (Target_arm::merge_exidx_entries): New function.
6975         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6976         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6977         to Arm_exidx_fixup constructor.
6978         Add new arg, merge_exidx_entries.
6979         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6980         Arm_output_section::fix_exidx_coverage.
6981
6982 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6983
6984         * icf.cc (get_section_contents): Check for preemptible functions.
6985         Ignore addend when appropriate.
6986         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6987         section folded.
6988         (add_from_relobj): Check for section folded.
6989         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6990         * symtab.h (should_add_dynsym_entry): Add new parameter.
6991         * target-reloc.h (scan_relocs): Check for section folded.
6992         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6993         Check reloc types for function pointers in shared objects.
6994         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6995         case.
6996         (icf_preemptible_functions_test): New test case.
6997         (icf_string_merge_test): New test case.
6998         * testsuite.Makefile.in: Regenerate.
6999         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7000         bar_glob.  Refactor code.
7001         * testsuite/icf_preemptible_functions_test.cc: New file.
7002         * testsuite/icf_preemptible_functions_test.sh: New file.
7003         * testsuite/icf_string_merge_test.cc: New file.
7004         * testsuite/icf_string_merge_test.sh: New file.
7005         * testsuite/icf_virtual_function_folding_test.cc: New file.
7006         * testsuite/icf_virtual_function_folding_test.sh: New file.
7007
7008 2010-04-14  Doug Kwan  <dougkwan@google.com>
7009
7010         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7011         for local symbol recounting if we remove a section due to ICF.
7012         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7013         there are no regular objects in input.
7014
7015 2010-04-13  Doug Kwan  <dougkwan@google.com>
7016
7017         * arm.cc (Arm_input_section::set_final_data_size): Compute
7018         accurate final data size instead of using current data size.
7019
7020 2010-04-09  Doug Kwan  <dougkwan@google.com>
7021
7022         * layout.cc (Layout::choose_output_section): Handle script section
7023         types.
7024         (Layout::make_output_section_for_script): Add section type parameter.
7025         Handle script section types.
7026         * layout.h (Layout::make_output_section_for_script): Add section
7027         type parameter.
7028         * output.cc (Output_section::Output_section): Initialize data member
7029         is_noload_.
7030         (Output_section::do_reset_address_and_file_offset): Do not set address
7031         to 0 if section is a NOLOAD section.
7032         * output.h (Output_section::is_noload): New method.
7033         (Output_section::set_is_noload): Ditto.
7034         (Output_section::is_noload_): New data member.
7035         * script-c.h (Script_section_type): New enum type.
7036         (struct Parser_output_section_header): Add new file section_type.
7037         * script-sections.cc (Sections_element::output_section_name): Add
7038         parameter for returning script section type.
7039         (Output_section_definition::output_section_name): Ditto.
7040         (Output_section_definition::section_type)P; New method.
7041         (Output_section_definiton::script_section_type_name): Ditto.
7042         (Output_section_definition::script_section_type_): New data member.
7043         (Output_section_definition::Output_section_definition): Initialize
7044         data member Output_section_definition::script_section_type_.
7045         (Output_section_definition::create_sections): Pass script section type
7046         to Layout::make_output_section_for_script.
7047         (Output_section_definition::output_section_name): Return script
7048         section type to caller.
7049         (Output_section_definition::set_section_address): Do not advance
7050         dot value and load address if section type is NOLOAD.  Set address
7051         of NOLOAD sections regardless of section flags.
7052         (Output_section_definition::print): Print section type if it is
7053         not SCRIPT_SECTION_TYPE_NONE.
7054         (Output_section_definition::section_type): New method.
7055         (Output_section_definition::script_section_type_name): Ditto.
7056         (Script_sections::output_section_name): Add new parameter
7057         PSECTION_TYPE for returning script section type.  Pass it to
7058         section elements.  Handle discard sections.
7059         (Sort_output_sections::operator()): Handle NOLOAD sections.
7060         * script-sections.h (Script_sections::Section_type): New enum type.
7061         (Script_sections::output_section_name): Add a new parameter for
7062         returning script section type.
7063         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7064         INFO and NOLOAD.
7065         * yyscript.y (union): Add new field SECTION_TYPE.
7066         (COPY, DSECT, INFO, NOLOAD): New tokens.
7067         (opt_address_and_section_type): Change type to output_section_header.
7068         (section_type): New non-terminal
7069         (section_header): Handle section type.
7070         (opt_address_and_section_type): Return section type value.
7071
7072 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7073
7074         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7075         * testsuite/plugin_common_test_2.c (foo): Likewise.
7076
7077 2010-04-08  Doug Kwan  <dougkwan@google.com>
7078
7079         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7080         Output_merge_data.
7081         * output.cc (Output_section::add_merge_input_section): Simplify
7082         code and return status of Output_merge_base::add_input_section.
7083         Update merge section map only if Output_merge_base::add_input_section
7084         returns true.
7085
7086 2010-04-07  Doug Kwan  <dougkwan@google.com>
7087
7088         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7089         if section is marked as containing instructions but has no mapping
7090         symbols.
7091         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7092         correct section index.
7093         (Arm_relobj::find_linked_text_section): Ditto.
7094
7095 2010-04-07  Cary Coutant  <ccoutant@google.com>
7096
7097         * archive.cc (include_member): Destroy Read_symbols_data object before
7098         releasing file.
7099         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7100         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7101         (Read_symbols_data::~Read_symbols_data) New destructor.
7102         (Section_relocs::Section_relocs) New constructor.
7103         (Section_relocs::~Section_relocs) New destructor.
7104         (Read_relocs_data::Read_relocs_data) New constructor.
7105         (Read_relocs_data::~Read_relocs_data) New destructor.
7106         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7107         pointers to NULL after deleting.
7108
7109 2010-04-07  Doug Kwan  <dougkwan@google.com>
7110
7111         * arm.cc: Replace "endianity" with "endianness" in comments.
7112         (Arm_exidx_cantunwind): Ditto.
7113         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7114         (Arm_relobj::merge_flags_and_attributes): New method.
7115         (Arm_relobj::merge_flags_and_attributes_): New data member.
7116         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7117         (Arm_relobj::scan_sections_for_stubs): Ditto.
7118         (Arm_relobj::do_read_symbols): Check to see if we really want to
7119         merge processor-specific flags and attributes.  Exit early if
7120         an object is empty except for section names and the undefined symbol.
7121         (Target_arm::do_finalize_sections): Move check for ELF format to
7122         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7123         attributes from a regular object only when we have determined that
7124         it is aapropriate.  Do not create an .ARM.attributes section in
7125         output if there is no regular input object.
7126         (Target_arm::merge_processor_specific_flags): Check
7127         --warn-mismatch before printing any error.
7128         (Target_arm::merge_object_attributes): Ditto.
7129         * gold.cc (queue_middle_tasks): Handle the case in which there is
7130         no regular object in input.
7131         * options.cc (General_options::parse_EB): New method.
7132         (General_options::parse_EL): Same.
7133         (General_options::General_options): Initialize endianness_.
7134         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7135         New options.
7136         (General_options::Endianness): New enum.
7137         (General_options::endianness): New method.
7138         (General_options::endianness_): New data member.
7139         * parameters.cc (Parameters::set_options): Check target endianness.
7140         (Parameters::set_target_once): Ditto.
7141         (Parameters::check_target_endianness): New method.
7142         (parameters_force_valid_target): If either -EL or -EB is specified,
7143         use it to define endianness of default target.
7144         * parameters.h (Parameters::check_target_endianness): New method
7145         declaration.
7146         * target.h (class Target): Change "endianity" to "endianness"
7147         in comments.
7148
7149 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7150
7151         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7152         * configure: Regenerate.
7153         * Makefile.in: Regenerate.
7154         * testsuite/Makefile.in: Regenerate.
7155
7156 2010-04-06  Cary Coutant  <ccoutant@google.com>
7157
7158         gcc PR lto/42757
7159         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7160         prevailing definitions of common symbols.
7161         * testsuite/plugin_test_6.sh: New test case.
7162         * testsuite/plugin_common_test_1.c: New test case.
7163         * testsuite/plugin_common_test_2.c: New test case.
7164         * testsuite/Makefile.am (plugin_test_6): New test case.
7165         * testsuite/Makefile.in: Regenerate.
7166
7167 2010-04-06  Nick Clifton  <nickc@redhat.com>
7168
7169         * po/vi.po: New Vietnamese translation.
7170
7171 2010-03-30  Doug Kwan  <dougkwan@google.com>
7172
7173         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7174
7175 2010-03-25  Doug Kwan  <dougkwan@google.com>
7176
7177         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7178         to avoid a conversion warning on a 32-bit host.
7179
7180 2010-03-24  Ian Lance Taylor  <iant@google.com>
7181
7182         * testsuite/script_test_3.t: Add a TLS segment.
7183         * testsuite/Makefile.am (check_PROGRAMS): Add
7184         tls_phdrs_script_test.
7185         (tls_phdrs_script_test_SOURCES): Define.
7186         (tls_phdrs_script_test_DEPENDENCIES): Define.
7187         (tls_phdrs_script_test_LDFLAGS): Define.
7188         (tls_phdrs_script_test_LDADD): Define.
7189         * testsuite/Makefile.in: Rebuild.
7190
7191 2010-03-23  Cary Coutant  <ccoutant@google.com>
7192
7193         * fileread.cc (find_or_make_view): Fix comment.
7194
7195 2010-03-23  Ian Lance Taylor  <iant@google.com>
7196
7197         * script-sections.cc (class Orphan_section_placement): Define
7198         PLACE_TLS and PLACE_TLS_BSS.
7199         (Orphan_section_placement::Orphan_section_placement): Initialize
7200         new places.
7201         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7202         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7203         (tls_script_test_SOURCES): Define.
7204         (tls_script_test_DEPENDENCIES): Define.
7205         (tls_script_test_LDFLAGS): Define.
7206         (tls_script_test_LDADD): Define.
7207         * testsuite/Makefile.in: Rebuild.
7208
7209 2010-03-22  Doug Kwan  <dougkwan@google.com>
7210
7211         * arm.cc (Arm_relocate_functions::abs8,
7212         Arm_relocate_functions::abs16): Use correct check for overflow
7213         specified in the ARM ELF specs.
7214         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7215         target of a BLX instruction specially.
7216         (Reloc_stub::stub_type_for_reloc): Ditto.
7217         (Relocate::relocate): Use symbolic names instead of numeric relocation
7218         codes to report error.
7219         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7220         workaround.
7221         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7222         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7223         thumb2_blx_out_of_range.stdout
7224         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7225         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7226         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7227         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7228         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7229         thumb2_blx_in_range, thumb2_blx_in_range.o,
7230         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7231         thumb2_blx_out_of_range.o): New rules.
7232         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7233         thumb2_blx_in_range and thumb2_blx_out_of_range.
7234         * testsuite/Makefile.in: Regenerate.
7235         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7236         * testsuite/thumb_blx_in_range.s: New file.
7237         * testsuite/thumb_blx_out_of_range.s: New file.
7238
7239 2010-03-22  Rafael Espindola  <espindola@google.com>
7240
7241         * archive.cc (Should_include): Move to archive.h.
7242         (should_include_member): Make it a member of Archive.
7243         (Lib_group): New.
7244         (Add_lib_group_symbols): New.
7245         * archive.h: Include options.h.
7246         (Archive_member): Moved from Archive.
7247         (Should_include): Moved from archive.cc.
7248         (Lib_group): New.
7249         (Add_lib_group_symbols): New.
7250         * dynobj.cc (do_should_include_member): New.
7251         * dynobj.h (do_should_include_member): New.
7252         * gold.cc (queue_initial_tasks): Update call to queue.
7253         * main.cc (main): Print lib group stats.
7254         * object.cc (do_should_include_member): New.
7255         * object.h: Include archive.h.
7256         (Object::should_include_member): New.
7257         (Object::do_should_include_member): New.
7258         (Sized_relobj::do_should_include_member): New.
7259         * options.cc (General_options::parse_start_lib): New.
7260         (General_options::parse_end_lib): New.
7261         (Input_arguments::add_file): Handle lib groups.
7262         (Input_arguments::start_group): Check we are not in a lib.
7263         (Input_arguments::start_lib): New.
7264         (Input_arguments::end_lib): New.
7265         * options.h (General_options): Add start_lib and end_lib.
7266         (Input_argument::lib_): New.
7267         (Input_argument::lib): New.
7268         (Input_argument::is_lib): New.
7269         (Input_file_lib): New.
7270         (Input_arguments::in_lib_): New.
7271         (Input_arguments::in_lib): New.
7272         (Input_arguments::start_lib): New.
7273         (Input_arguments::end_lib_): New.
7274         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7275         in unused members as preempted.
7276         (Sized_pluginobj::do_should_include_member): New.
7277         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7278         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7279         return the blocker.
7280         (Read_symbols::do_whole_lib_group): New.
7281         (Read_symbols::do_lib_group): New.
7282         (Read_symbols::do_read_symbols): Handle lib groups.
7283         (Read_symbols::get_name): Handle lib groups.
7284         * readsyms.h (Read_symbols): Add an archive member pointer.
7285         (Read_symbols::do_whole_lib_group): New.
7286         (Read_symbols::do_lib_group): New.
7287         (Read_symbols::member_): New.
7288         * script.cc (read_input_script): Update call to queue_soon.
7289
7290 2010-03-19  Doug Kwan  <dougkwan@google.com>
7291
7292         * arm.cc (Stub_table::Stub_table): Initialize new data members
7293         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7294         (Stub_table::add_reloc_stub): Assign stub offset and update
7295         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7296         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7297         New data members.
7298         (Stub_table::update_data_size_and_addralign): Use
7299         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7300         instead of going over all reloc stubs.
7301         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7302         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7303         Stringpool_template::offset_ to size of Stringpool_char.
7304         (Stringpool_template::new_key_offset): Remove code to initialize
7305         Stringpool_template::offset_.
7306         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7307         Stringpool_template::offset_ to zero.
7308
7309 2010-03-15  Doug Kwan  <dougkwan@google.com>
7310
7311         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7312         offset_.
7313         (Stringpool_template::new_key_offset): New method.
7314         (Stringpool_template::add_string): Assign offsets when adding new
7315         strings.
7316         (Stringpool_template::set_string_offsets): Do not set string offsets
7317         when not optimizing.
7318         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7319         member size_.
7320         (Chunked_vector::clear): Clear size_.
7321         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7322         (Chunked_vector::size): Return size_.
7323         (Chunked_vector::push_back): Use size_ to find insert position.
7324         (Chunked_vector::size_): New data member.
7325         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7326         (Stringpool_template::new_key_offset): New method declaration.
7327         (Stringpool_template::offset_): New data member.
7328
7329 2010-03-15   Rafael Espindola  <espindola@google.com>
7330
7331         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7332         Add_symbols' constructor.
7333         * readsyms.h (Add_symbols): Remove the input_group member.
7334
7335 2010-03-10  Ian Lance Taylor  <iant@google.com>
7336
7337         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7338         target to ask whether a reference to a symbol requires a stack
7339         split.
7340         * target.h (Target::is_call_to_non_split): New function.
7341         (Target::do_is_call_to_non_split): Declare virtual function.
7342         * target.cc: Include "symtab.h".
7343         (Target::do_is_call_to_non_split): New function.
7344         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7345
7346 2010-03-10  Cary Coutant  <ccoutant@google.com>
7347
7348         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7349         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7350         (File_read::open[2]): Add whole_file_view_ to list of views.
7351         (File_read::make_view): Remove test of whole_file_view_.
7352         (File_read::find_or_make_view): Create whole_file_view_ if
7353         necessary.
7354         (File_read::clear_views): Replace bool parameter with enum;
7355         adjust all callers.  Don't delete views with permanent data;
7356         do delete cached views and views from archives if
7357         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7358         if clearing the corresponding view.
7359         * fileread.h (File_read::Clear_views_mode): New enum.
7360         (File_read::View::is_permanent_view): New method.
7361         (File_read::clear_views): Replace bool parameter
7362         with enum; adjust all callers.
7363         * options.h (General_options): Change keep_files_mapped option;
7364         add map_whole_files.
7365         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7366         releasing the file.
7367         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7368         the file.
7369
7370 2010-03-10  David S. Miller  <davem@davemloft.net>
7371
7372         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7373
7374 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7375
7376         * icf.cc (get_section_contents): Add '@' marker after processing the
7377         merge reloc.
7378
7379 2010-03-08  Doug Kwan  <dougkwan@google.com>
7380
7381         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7382         due to a conversion warning.
7383         (Arm_relobj::update_output_local_symbol_count): Check for local
7384         symbol with unset output index.
7385
7386 2010-03-05  Ian Lance Taylor  <iant@google.com>
7387
7388         * options.h (class General_options): Add --spare-dynamic-tags.
7389         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7390         --spare-dynamic-tags.
7391
7392 2010-03-05  Ian Lance Taylor  <iant@google.com>
7393
7394         * incremental.cc: Include "libiberty.h".
7395
7396 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7397
7398         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7399         function, is_info_ member.
7400         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7401         (Versions::Versions): Update caller.
7402         (Versions::define_base_version): Likewise.
7403         (Versions::add_def): Likewise.
7404
7405 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7406
7407         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7408         (Scan::possible_function_pointer_reloc): New function.
7409         (Scan::local_reloc_may_be_function_pointer): Change to call
7410         possible_function_pointer_reloc.
7411         (Scan::global_reloc_may_be_function_pointer): Ditto.
7412         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7413         relocations in ".data.rel.ro._ZTV" section.
7414         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7415         * testsuite/icf_safe_so_test.cc: Ditto.
7416         * testsuite/icf_safe_test.cc: Ditto.
7417         * testsuite/icf_safe_test.sh: Ditto.
7418
7419 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7420             Ian Lance Taylor  <iant@google.com>
7421
7422         * target-reloc.h (relocate_section): Check the symbol table index
7423         for -1U before setting the local symbol index.
7424         (scan_relocatable_relocs): If copying the relocation, record that
7425         the local symbol is required.
7426         * object.h (Symbol_value::is_output_symtab_index_set): New
7427         function.
7428         (Symbol_value::may_be_discarded_from_output_symtab): New
7429         function.
7430         (Symbol_value::has_output_symtab_entry): New function.
7431         (Symbol_value::needs_output_symtab_entry): Remove.
7432         (Symbol_value::output_symtab_index): Make sure the symbol index is
7433         set.
7434         (Symbol_value::set_output_symtab_index): Make sure the symbol
7435         index is not set.  Make sure the new index is valid.
7436         (Symbol_value::set_must_have_output_symtab_entry): New function.
7437         (Symbol_value::has_output_dynsym_entry): New function.
7438         (Symbol_value::set_output_dynsym_index): Make sure the new index
7439         is valid.
7440         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7441         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7442         local symbol if permitted.
7443         (Sized_relobj::do_finalize_local_symbols): Call
7444         is_output_symtab_index_set rather than needs_output_symtab_entry.
7445         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7446         rather than needs_output_symtab_entry.  Call
7447         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7448         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7449         is_output_symtab_index_set rather than needs_output_symtab_entry.
7450         * testsuite/discard_locals_relocatable_test.c: New file.
7451         * testsuite/discard_locals_test.sh: Test -r.
7452         * testsuite/Makefile.am (check_DATA): Add
7453         discard_locals_relocatable_test1.syms,
7454         discard_local_relocatable_test2.syms.
7455         (MOSTLYCLEANFILES): Likewise.  Also add
7456         discard_locals_relocatable_test1.lout and
7457         discard_locals_relocatable_test2.out.
7458         (discard_locals_relocatable_test1.syms): New target.
7459         (discard_locals_relocatable_test.o): New target.
7460         (discard_locals_relocatable_test1.out): New target.
7461         (discard_locals_relocatable_test2.syms): New target.
7462         (discard_locals_relocatable_test2.out): New target.
7463         (various): Add missing ../ld-new dependencies.
7464         * testsuite/Makefile.in: Rebuild.
7465
7466 2010-03-03  Nick Clifton  <nickc@redhat.com>
7467
7468         * po/fi.po: New Finnish translation.
7469
7470 2010-03-01  Doug Kwan  <dougkwan@google.com>
7471
7472         * layout.cc (Layout::Layout): Force section types of .init_array*,
7473         .preinit_array* and .fini_array* sections.
7474         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7475         Fix check of return value of std::string::find.().
7476         (Output_section::Input_section_sort_compare::operator()): Remove
7477         comment about .init_array.
7478         (Output_section::Input_section_sort_init_fini_compare::operator()):
7479         New method.
7480         (Output_section::sort_attached_input_sections): Handle .init_array
7481         and .fini_array specially.
7482         * output.h (Output_section::Inut_section_sort_compare): Update
7483         comment.
7484         (Output_section::Input_section_sort_init_fini_compare): New struct.
7485
7486 2010-02-26  Doug Kwan  <dougkwan@google.com>
7487
7488         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7489         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7490         * testsuite/debug_msg.sh: Avoid matching source line number for
7491         use of global variable undef_int.
7492
7493 2010-02-26  Doug Kwan  <dougkwan@google.com>
7494
7495         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7496         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7497         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7498         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7499         * options.cc (General_options::General_options): Initialize member
7500         fix_v4bx_.
7501         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7502         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7503         and rm_no_fix_v4bx.stdout
7504         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7505         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7506         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7507         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7508         and arm_no_fix_v4bx.
7509         * Makefile.in: Regenerate.
7510         * testsuite/arm_fix_v4bx.s: New file.
7511         * testsuite/arm_fix_v4bx.sh: Ditto.
7512
7513 2010-02-24  Doug Kwan  <dougkwan@google.com>
7514
7515         * arm.cc (Target_arm::got_section): Make the .got section the first
7516         non RELRO section in the data segment.
7517         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7518         suffixes of section names.
7519
7520 2010-02-24  Doug Kwan  <dougkwan@google.com>
7521
7522         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7523         flags and attributes merging if an input file is a binary file.
7524         * fileread.cc (Input_file::open): Record format of original file.
7525         * fileread.h (Input_file::Format): New enum type.
7526         (Input_file::Input_file): Initialize data member format_.
7527         (Input_file::format): New method definition.
7528         (Input_file::format_):: New data member.
7529
7530 2010-02-24  Doug Kwan  <dougkwan@google.com>
7531
7532         * arm.cc (Arm_output_data_got): New class.
7533         (ARM_TCB_SIZE): New constant
7534         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7535         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7536         If user uses a script with a SECTIONS clause, issue only a warning
7537         for a misplaced EXIDX input section.  Otherwise, issue an error.
7538         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7539         garbage collection.
7540         (Target_arm::got_mode_index_entry): Handle static linking.
7541         (Target_arm::Scan::local): Ditto.
7542         (Target_arm::Scan::global): Ditto.
7543         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7544         all incorrectly implemented relocations.
7545         (Target_arm::fix_exidx_coverage): Pass layout to
7546         Arm_output_section::fix_exidx_coverage.
7547         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7548         from ".ARM.exidx." and ".ARM.extab.".
7549
7550 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7551
7552         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7553         section if it does not already exist.
7554         * attributes.cc (Attributes_section_data::Attributes_section_data):
7555         Don't crash if size is zero.
7556
7557 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7558             Ian Lance Taylor  <iant@google.com>
7559
7560         * gold.cc (queue_middle_tasks): If no input files were opened,
7561         exit.
7562         * workqueue.h (Task_function::Task_function): Assert that there is
7563         a blocker.
7564
7565 2010-02-22  Doug Kwan  <dougkwan@google.com>
7566
7567         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7568         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7569         types to avoid warnings due to different uint64_t implementations
7570         on different hosts.
7571
7572 2010-02-21  Doug Kwan  <dougkwan@google.com>
7573
7574         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7575         handling of the maximum backward branch offset.
7576         (Arm_relocate_functions::thumb_branch_common): Ditto.
7577         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7578         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7579         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7580         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7581         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7582         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7583         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7584         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7585         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7586         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7587         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7588         thumb2_bl_out_of_range.o): New rules.
7589         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7590         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7591         thumb2_bl_out_of_range
7592         * testsuite/Makefile.in: Regenerate.
7593         * testsuite/arm_bl_in_range.s: New file.
7594         * testsuite/arm_bl_out_of_range.s: Ditto.
7595         * testsuite/arm_branch_in_range.sh: Ditto.
7596         * testsuite/arm_branch_range.t: Ditto.
7597         * testsuite/thumb2_branch_range.t: Ditto.
7598         * testsuite/thumb_bl_in_range.s: Ditto.
7599         * testsuite/thumb_bl_out_of_range.s: Ditto.
7600         * testsuite/thumb_branch_range.t: Ditto.
7601
7602 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7603
7604         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7605         Add reloc offset information.
7606         * icf.cc (get_section_contents): Change iterators to point to the new
7607         vectors. Add reloc offset information to the contents.
7608         * icf.h (Icf::Sections_reachable_info): New typedef.
7609         (Icf::Sections_reachable_list): New typedef.
7610         (Icf::Offset_info): New typedef.
7611         (Icf::Reloc_info): New struct typedef.
7612         (Icf::Reloc_info_list): New typedef.
7613         (Icf::symbol_reloc_list): Delete method.
7614         (Icf::addend_reloc_list): Delete method.
7615         (Icf::section_reloc_list): Delete method.
7616         (Icf::reloc_info_list): New method.
7617         (Icf::reloc_info_list_): New member.
7618
7619 2010-02-19  Doug Kwan  <dougkwan@google.com>
7620
7621         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7622         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7623         * arm.cc (Arm_relocation_functions): New forward declaration.
7624         (Target_arm::Target_arm): Initialize new data members
7625         got_mod_index_offset_ and tls_base_symbol_defined_.
7626         (Target_arm::Relocate::relocate_tls): New method.
7627         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7628          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7629         New methods.
7630         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7631         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7632         (Target_arm::got_mod_index_offset_,
7633         Target_arm::tls_base_symbol_defined_): New data members.
7634         (Target_arm::Scan::local, Target::Scan::global,
7635         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7636         relocations.
7637
7638 2010-02-18  Doug Kwan  <dougkwan@google.com>
7639
7640         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7641         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7642         text section as a parameter becuase some broken tools may not set
7643         the link in section header.
7644         (Target_arm::has_got_section): New method.
7645         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7646         without any mapping symbol as data only.  Remove warning.
7647         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7648         link in its section header, try to discover the link by inspecting the
7649         REL31 relocation at the beginning of the section.
7650         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7651         in error message.
7652         (Target_arm::Scan::global): Treat any reference to the symbol
7653         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7654
7655 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7656
7657         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7658         (Scan::global_reloc_may_be_function_pointer): New function.
7659         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7660         (Scan::global_reloc_may_be_function_pointer): New function.
7661         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7662         (Scan::global_reloc_may_be_function_pointer): New function.
7663         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7664         (Scan::global_reloc_may_be_function_pointer): New function.
7665         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7666         (Scan::global_reloc_may_be_function_pointer): New function.
7667         (Scan::possible_function_pointer_reloc): New function.
7668         (Target_x86_64::can_check_for_function_pointers): New function.
7669         * gc.h (gc_process_relocs): Scan relocation types to determine if
7670         function pointers were taken for targets that support it.
7671         * icf.cc (Icf::find_identical_sections): Include functions for
7672         folding in safe ICF whose pointer is not taken.
7673         * icf.h (Secn_fptr_taken_set): New typedef.
7674         (fptr_section_id_): New member.
7675         (section_has_function_pointers): New function.
7676         (set_section_has_function_pointers): New function.
7677         (check_section_for_function_pointers): New function.
7678         * options.h: Fix comment for safe ICF option.
7679         * target.h (can_check_for_function_pointers): New function.
7680         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7681         Modify icf_safe_test for X86-64.
7682         * testsuite/Makefile.in: Regenerate.
7683         * testsuite/icf_safe_so_test.cc: New file.
7684         * testsuite/icf_safe_so_test.sh: New file.
7685         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7686         (main): Change to take pointer to function kept_func_3.
7687         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7688         folding is done correctly for X86-64.
7689
7690 2010-02-12  David S. Miller  <davem@davemloft.net>
7691
7692         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7693         is_symbolless parameter.
7694         (Output_reloc<SHT_REL>::is_symbolless): New.
7695         (Output_reloc<SHT_REL>::is_symbolless_): New.
7696         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7697         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7698         (Output_reloc<SHT_RELA>::is_symbolless): New.
7699         (Output_data_reloc::add_global): Handle is_symbolless.
7700         (Output_data_reloc::add_global_relative): Likewise.
7701         (Output_data_reloc::add_local): Likewise.
7702         (Output_data_reloc::add_local_relative): Likewise.
7703         (Output_data_reloc::add_symbolless_global_addend): New.
7704         (Output_data_reloc::add_symbolless_local_addend): New.
7705         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7706         is_symbolless.
7707         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7708         instead of ->is_relative_
7709         (Output_reloc::write): Likewise.
7710         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7711         (Output_reloc::write_rel): Simplify.
7712
7713         * sparc.cc (Target_sparc::Scan::local): Use
7714         ->add_symbolless_local_addend as needed.
7715         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7716         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7717         based upon relocation offset.
7718
7719 2010-02-11  Doug Kwan  <dougkwan@google.com>
7720
7721         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7722         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7723         beginning of function.
7724         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7725         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7726         parameter is_32bit in calls to should_apply_static_reloc.
7727         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7728         (check_DATA): Add arm_abs_global.stdout.
7729         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7730         arm_abs_global.stdout): New rules.
7731         (MOSTLLYCLEANFILES): Add arm_abs_global
7732         * Makefile.in: Regenerate.
7733         * testsuite/arm_abs_global.s: New file.
7734         * testsuite/arm_abs_global.sh: Ditto.
7735         * testsuite/arm_abs_lib.s: Ditto.
7736
7737 2010-02-11  Ian Lance Taylor  <iant@google.com>
7738
7739         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7740         Read_relocs task.
7741         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7742         Allocate_commons_task first.
7743         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7744         task, rather than symtab_lock_.
7745         (Gc_process_relocs::~Gc_process_relocs): New function.
7746         (Gc_process_relocs::is_runnable): Check this_blocker_.
7747         (Gc_process_relocs::locks): Use next_blocker_ rather than
7748         blocker_.
7749         (Scan_relocs::~Scan_relocs): New function.
7750         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7751         symtab_lock_.
7752         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7753         next_blocker_.
7754         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7755         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7756         constructor accordingly.
7757         (class Gc_process_relocs): Likewise.
7758         (class Scan_relocs): Likewise.
7759         * common.h (class Allocate_commons_task): Remove symtab_lock_
7760         field, and corresponding constructor parameter.
7761         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7762         symtab_lock_.
7763         (Allocate_commons_task::locks): Likewise.
7764
7765 2010-02-11  Ian Lance Taylor  <iant@google.com>
7766
7767         * gold-threads.h (class Once): Define.
7768         (class Initialize_lock): Rewrite as child of Once.
7769         * gold-threads.cc (class Once_initialize): Define.
7770         (once_pointer_control): New static variable.
7771         (once_pointer, once_arg): New static variables.
7772         (c_run_once): New static function.
7773         (Once::Once, Once::run_once, Once::internal_run): New functions.
7774         (class Initialize_lock_once): Remove.
7775         (initialize_lock_control): Remove.
7776         (initialize_lock_pointer): Remove.
7777         (initialize_lock_once): Remove.
7778         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7779         (Initialize_lock::initialize): Rewrite.
7780         (Initialize_lock::do_run_once): New function.
7781         * archive.cc (Archive::interpret_header): Only clear name if it is
7782         not already empty.
7783         * fileread.cc: Include "gold-threads.h"
7784         (file_counts_lock): New static variable.
7785         (file_counts_initialize_lock): Likewise.
7786         (File_read::release): Only increment counts when using --stats.
7787         Use a lock around the increment.
7788         * parameters.cc (class Set_parameters_target_once): Define.
7789         (set_parameters_target_once): New static variable.
7790         (Parameters::Parameters): Move here from parameters.h.
7791         (Parameters::set_target): Rewrite.
7792         (Parameters::set_target_once): New function.
7793         (Parameters::clear_target): Move here and rewrite.
7794         * parameters.h (class Parameters): Update declarations.  Add
7795         set_parameters_target_once_ field.
7796         (Parameters::Parameters): Move to parameters.cc.
7797         (Parameters::clear_target): Likewise.
7798         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7799         task.
7800         (Start_group::~Start_group): New function.
7801         (Start_group::is_runnable): New function.
7802         (Start_group::locks, Start_group::run): New functions.
7803         (Finish_group::run): Change saw_undefined to size_t.
7804         * readsyms.h (class Start_group): Define.
7805         (class Finish_group): Change saw_undefined_ field to size_t.
7806         (Finish_group::Finish_group): Remove saw_undefined and
7807         this_blocker parameters.  Change all callers.
7808         (Finish_group::set_saw_undefined): New function.
7809         (Finish_group::set_blocker): New function.
7810         * symtab.h (class Symbol_table): Change saw_undefined to return
7811         size_t.  Change saw_undefined_ field to size_t.
7812         * target-select.cc (Set_target_once::do_run_once): New function.
7813         (Target_selector::Target_selector): Initialize set_target_once_
7814         field.  Don't initialize lock_ and initialize_lock_ fields.
7815         (Target_selector::instantiate_target): Rewrite.
7816         (Target_selector::set_target): New function.
7817         * target-select.h (class Set_target_once): Define.
7818         (class Target_selector): Update declarations.  Make
7819         Set_target_once a friend.  Remove lock_ and initialize_lock_
7820         fields.  Add set_target_once_ field.
7821
7822 2010-02-10  Ian Lance Taylor  <iant@google.com>
7823
7824         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7825         queueing any tasks.
7826         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7827         (queue_middle_tasks): Add all blockers before queueing any tasks.
7828         (queue_final_tasks): Likewise.
7829         * token.h (Task_token::add_blockers): New function.
7830         * object.h (Input_objects::number_of_relobjs): New function.
7831
7832 2010-02-10  Ian Lance Taylor  <iant@google.com>
7833
7834         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7835         shared, not if not position independent.
7836         * x86_64.cc (Relocate::relocate_tls): Likewise.
7837         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7838         (tls_pie_pic_test): New target.
7839         * testsuite/Makefile.in: Rebuild.
7840
7841         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7842         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7843         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7844         * testsuite/Makefile.in: Rebuild.
7845
7846 2010-02-09  David S. Miller  <davem@davemloft.net>
7847
7848         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7849         R_SPARC_RELATIVE using ->add_local_relative().
7850         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7851
7852         * output.h (Output_data_dynamic::add_section_size): New method
7853         that takes two Output_data objects.
7854         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7855         entry param.  Handle it in initializers.
7856         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7857         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7858         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7859         arg.
7860         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7861         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7862         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7863         for dynrel_includes_plt.
7864         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7865         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7866         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7867         before .rela.plt
7868         (Target_sparc::do_finalize_sections): Update to pass true for
7869         dynrel_includes_plt.
7870         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7871         output before .rela.plt
7872         (Target_powerpc::do_finalize_sections): Update to pass true for
7873         dynrel_includes_plt when 32-bit.
7874
7875 2010-02-08  Doug Kwan  <dougkwan@google.com>
7876
7877         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7878         method.
7879         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7880         Arm_relobj::scan_section_for_cortex_a8_stubs,
7881         Arm_relobj::do_relocation_section): Instead of calling
7882         Output_section::output_address, use faster
7883         Arm_relobj::simple_input_section_output_address.
7884
7885 2010-02-08  David S. Miller  <davem@davemloft.net>
7886
7887         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7888         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7889         relocation helper function.
7890
7891         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7892         just like R_SPARC_GOT{10,13,22}.
7893         (Target_sparc::Scan::local): Likewise.
7894         (Target_sparc::Relocate:relocate): Likewise.
7895
7896 2010-02-06  Ian Lance Taylor  <iant@google.com>
7897
7898         * configure.ac: Rewrite targetobjs duplicate removal code to use
7899         only shell constructs.
7900         * configure: Rebuild.
7901
7902 2010-02-05  Doug Kwan  <dougkwan@google.com>
7903
7904         PR 11247
7905         * arm.cc (Arm_relobj::section_is_scannable): New method.
7906         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7907         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7908
7909 2010-02-04  Doug Kwan  <dougkwan@google.com>
7910
7911         PR 11247
7912         * arm-reloc-property.cc (cstdio): Include.
7913         * configure.ac (targetobjs): Remove duplicates.
7914         * configure: Regenerate.
7915         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7916         big and little endian version for a given address size.
7917
7918 2010-02-03  Doug Kwan  <dougkwan@google.com>
7919
7920         * arm-reloc-property.cc
7921         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7922         definition.
7923         * arm-reloc-property.h
7924         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7925         New method definition.
7926         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7927         declaration.
7928         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7929         overflow to N.
7930         (GOT_PREL): Change implemented to Y.
7931         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7932         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7933         (Arm_relocate_functions::movw_abs_nc): Remove method.
7934         (Arm_relocate_functions::movt_abs): Ditto.
7935         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7936         (Arm_relocate_functions::thm_movt_abs): Ditto.
7937         (Arm_relocate_functions::movw_rel_nc): Ditto.
7938         (Arm_relocate_functions::movw_rel): Ditto.
7939         (Arm_relocate_functions::movt_rel): Ditto.
7940         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7941         (Arm_relocate_functions:thm_movw_rel): Ditto.
7942         (Arm_relocate_functions:thm_movt_rel): Ditto.
7943         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7944         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7945         New method definitions.
7946         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7947         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7948         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7949         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7950         (Target_arm::Relocate::relocate): Check for non-static or
7951         unimplemented relocation code and exit early.  Change calls to
7952         Target_arm::reloc_uses_thumb_bit and
7953         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7954         instead.  Refactor code to handle similar relocations to increase
7955         code sharing.  Remove check for unsupported relocation code in switch
7956         statement.
7957         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7958         relocation property table to find out size.  Change error message to
7959         print out the name of a relocation code instead of the numeric value.
7960         (Target_arm::scan_reloc_for_stub): Use relocation property table
7961         instead of calling Target_arm::reloc_uses_thumb_bit().
7962
7963 2010-02-02  Doug Kwan  <dougkwan@google.com>
7964
7965         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7966         types of relaxed input section.
7967
7968 2010-02-02  Doug Kwan  <dougkwan@google.com>
7969
7970         * Makefile.am (HFILES): Add arm-reloc-property.h.
7971         (DEFFILES): New.
7972         (TARGETSOURCES): Add arm-reloc-property.cc
7973         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7974         (libgold_a_SOURCES): $(DEFFILES)
7975         * Makefile.in: Regenerate.
7976         * arm-reloc-property.cc: New file.
7977         * arm-reloc-property.h: New file.
7978         * arm-reloc.def: New file.
7979         * arm.cc: Update comments.
7980         (arm-reloc-property.h): New included header.
7981         (arm_reloc_property_table): New global variable.
7982         (Target_arm::do_select_as_default_target): New method definition.
7983         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7984         arm-reloc-property to targ_extra_obj.
7985         * parameters.cc (set_parameters_target): Call
7986         Target::select_as_default_target().
7987         * target.h (Target::select_as_default_target): New method definition.
7988         (Target::do_select_as_default_target): Same.
7989
7990 2010-02-01  Doug Kwan  <dougkwan@google.com>
7991
7992         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7993         first_output_text_section_.
7994         (Arm_exidx_fixup::first_output_text_section): New method definition.
7995         (Arm_exidx_fixup::first_output_text_section_): New data member.
7996         (Arm_exidx_fixup::process_exidx_section): Record the first text
7997         output section seen.
7998         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7999         and entsize in output section header.
8000
8001 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8002
8003         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8004         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8005         (Arm_relocate_functions::thm_alu11): New Method.
8006         (Arm_relocate_functions::thm_pc8): New Method.
8007         (Arm_relocate_functions::thm_pc12): New Method.
8008         (Target_arm::Scan::local): Handle the relocations.
8009         (Target_arm::Scan::global): Likewise.
8010         (Target_arm::Relocate::relocate): Likewise.
8011         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8012
8013 2010-01-29  Doug Kwan  <dougkwan@google.com>
8014
8015         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8016         of relocation types as ld.
8017
8018 2010-01-29  Doug Kwan  <dougkwan@google.com>
8019
8020         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8021         to public.
8022         (Arm_relocate_functions::thumb_branch_common): Ditto.
8023         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8024         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8025         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8026         Arm_relocate_functions::jump24): Remove.
8027         (Target_arm::Relocate::relocate): Adjust code to call
8028         Arm_relocation_functions::arm_branch_common and
8029         Arm_relocation_functions::thumb_branch_common instead of their removed
8030         wrappers.  Merge switch-cases together to reduce source code size.
8031
8032 2010-01-29  Doug Kwan  <dougkwan@google.com>
8033
8034         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8035         output_local_symbol_count_needs_update_.
8036         (Arm_relobj::output_local_symbol_count_needs_update,
8037          Arm_relobj::set_output_local_symbol_count_needs_update,
8038          Arm_relobj::update_output_local_symbol_count): New methods.
8039         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8040         member.
8041         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8042         of pointed function as in a R_ARM_PREL31 relocation.
8043         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8044         for output local symbol count updating.
8045         (Target_arm::do_relax): Update output local symbol counts in objects
8046         if necessary.
8047         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8048
8049 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8050
8051         * arm.cc: Added support for the ARM relocations:
8052         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8053         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8054         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8055         movw_prel_nc).
8056         (Arm_relocate_functions::movw_rel): New method.
8057         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8058         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8059         thm_movw_prel_nc).
8060         (Arm_relocate_functions::thm_movw_rel): New method.
8061         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8062         thm_movt_prel).
8063         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8064         relocations.
8065         (Target_arm::Scan::global): Likewise.
8066         (Target_arm::Relocate::relocate): Likewise.
8067         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8068         Likewise.
8069
8070 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8071
8072         * arm.cc: Added support for ARM group relocations.
8073         (Target_arm::reloc_needs_sym_origin): New method.
8074         (Arm_relocate_functions::calc_grp_kn): New method.
8075         (Arm_relocate_functions::calc_grp_residual): New method.
8076         (Arm_relocate_functions::calc_grp_gn): New method.
8077         (Arm_relocate_functions::arm_grp_alu): New Method.
8078         (Arm_relocate_functions::arm_grp_ldr): New Method.
8079         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8080         (Arm_relocate_functions::arm_grp_ldc): New Method.
8081         (Target_arm::Scan::local): Handle the ARM group relocations.
8082         (Target_arm::Scan::global): Likewise.
8083         (Target_arm::Relocate::relocate): Likewise.
8084         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8085         Likewise.
8086
8087 2010-01-26  Doug Kwan  <dougkwan@google.com>
8088
8089         * arm.cc (set): Include.
8090         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8091         pointer type.
8092         (Arm_output_section::Text_section_list): New type.
8093         (Arm_output_section::append_text_sections_to_list): New method.
8094         (Arm_output_section::fix_exidx_coverage): Ditto.
8095         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8096         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8097         Relobj::set_section_offset() instead of
8098         Sized_relobj::invalidate_section_offset().
8099         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8100         parameter for section headers. Ignore relocation sections for
8101         unallocated sections and EXIDX sections.
8102         (Target_arm::fix_exidx_coverage): New method.
8103         (Target_arm::output_section_address_less_than): New type.
8104         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8105         linked text section instead of the EXIDX section.
8106         (Arm_output_section::create_stub_group): Add an assertion to check
8107         that this is not an EXIDX output section.
8108         (Arm_output_section::append_text_sections_to_list): New method.
8109         (Arm_output_section::fix_exidx_coverage): Ditto.
8110         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8111         Arm_relobj::section_needs_reloc_stub_scanning.
8112         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8113         first pass.
8114         (Target_arm::fix_exidx_coverage): New method.
8115         * object.h (Relobj::set_output_section): New method.
8116         (Sized_relobj::invalidate_section_offset): Remove method.
8117         (Sized_relobj::do_invalidate_section_offset): Remove method.
8118         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8119
8120 2010-01-25  Doug Kwan  <dougkwan@google.com>
8121
8122         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8123         Fix warning due to signed and unsigned comparison on a 32-bit host.
8124
8125 2010-01-22  Doug Kwan  <dougkwan@google.com>
8126
8127         * arm.cc (Target_arm::do_relax): Record an output section for section
8128         offset adjustment it contains any stub table that has changed.
8129         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8130         offsets in an output section if necessary.
8131         * output.cc (Output_section::Output_section): Initialize
8132         section_offsets_need_adjustments_.
8133         (Output_section::add_input_section_for_script): Renamed to
8134         Output_section::add_simple_input_section.
8135         (Output_section::save_states): Add a comment.
8136         (Output_section::discard_states): New method defintion.
8137         (Output_section::adjust_section_offsets): Same.
8138         * output.h (Output_section::add_input_section_for_script): Renamed to
8139         Output_section::add_simple_input_section.
8140         (Output_section::discard_states): New method declaration.
8141         (Output_section::adjust_section_offsets): Same.
8142         (Output_section::section_offsets_need_adjustment,
8143         Output_section::set_section_offsets_need_adjustment): New method
8144         definitions.
8145         (Output_section::section_offsets_need_adjustment_): New data member.
8146         * script-sections.cc
8147         (Output_section_element_input::set_section_address): Adjust code for
8148         renaming of Output_section::add_input_section_for_script.
8149         (Orphan_output_section::set_section_address): Same.
8150
8151 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8152
8153         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8154         Fix_v4bx enum values .
8155         * gold/options.h (General_options): New option definitions.
8156         (General_options::fix_v4bx): New method.
8157         (General_options::Fix_v4bx): New enum.
8158         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8159         (General_options::parse_fix_v4bx_interworking): New method.
8160
8161 2010-01-22  Doug Kwan  <dougkwan@google.com>
8162
8163         * arm.cc (Arm_exidx_fixup): New class.
8164
8165 2010-01-21  Doug Kwan  <dougkwan@google.com>
8166
8167         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8168         classes.
8169         (Arm_exidx_section_offset_map): New type.
8170
8171 2010-01-21  Doug Kwan  <dougkwan@google.com>
8172
8173         * arm.cc (Arm_exidx_input_section): New class.
8174         (Arm_relobj::exidx_input_section_by_link,
8175         Arm_relobj::exidx_input_section_by_shndx,
8176         Arm_relobj::make_exidx_input_section): New methods.
8177         (read_arm_attributes_section): Remove.
8178         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8179         information about them.
8180         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8181         to here.
8182
8183 2010-01-20  Doug Kwan  <dougkwan@google.com>
8184
8185         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8186         Input_section_specifier to Section_id.
8187         (Target_arm::new_arm_input_section: Adjust code for change of key
8188         type.
8189         (Target_arm::find_arm_input_section): Ditto.
8190         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8191         (Section_id): Remove.
8192         (Garbage_collection::Section_id_hash): Remove.
8193         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8194         (Section_id): Remove.
8195         (Icf::Section_id_hash): Remove.
8196         * object.h (Section_id, Const_section_id, Section_id_hash,
8197         Const_section_id_hash): New type definitions.
8198         * output.cc (Output_section::add_relaxed_input_section): Change to
8199         use Const_section_id instead of Input_section_specifier as key type.
8200         (Output_section::add_merge_input_section): Ditto.
8201         (Output_section::build_relaxation_map): Change to use Section_id
8202         instead of Input_section_specifier as key type.
8203         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8204         Ditto.
8205         (Output_section::convert_input_sections_to_relaxed_sections): Change
8206         to use Const_section_id instead of Input_section_specifier as key type.
8207         (Output_section::find_merge_section): Ditto.
8208         (Output_section::find_relaxed_input_section): Ditto.
8209         * output.h (Input_section_specifier): Remove class.
8210         (Output_section::Output_section_data_by_input_section_map): Change
8211         key type to Const_section_id.
8212         (Output_section::Output_relaxed_input_section_by_input_section_map):
8213         Ditto.
8214         (Output_section::Relaxation_map): Change key type to Section_id.
8215
8216 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8217
8218         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8219         (class Arm_v4bx_stub): New class.
8220         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8221         (Stub_factory::make_arm_v4bx_stub): New method.
8222         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8223         (Stub_table::empty): Handle v4bx stubs.
8224         (Stub_table::add_arm_v4bx_stub): New method.
8225         (Stub_table::find_arm_v4bx_stub): New method.
8226         (Arm_relocate_functions::v4bx): New method.
8227         (Target_arm::fix_v4bx): New method.
8228         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8229         (Stub_table::relocate_stubs): Likewise.
8230         (Stub_table::do_write): Likewise.
8231         (Stub_table::update_data_size_and_addralign): Likewise.
8232         (Stub_table::finalize_stubs):  Likewise.
8233         (Target_arm::Scan::local): Likewise.
8234         (Target_arm::Scan::global): Likewise.
8235         (Target_arm::do_finalize_sections): Likewise.
8236         (Target_arm::Relocate::relocate): Likewise.
8237         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8238         Likewise.
8239         (Target_arm::scan_reloc_for_stub): Likewise.
8240         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8241
8242 2010-01-19  Ian Lance Taylor  <iant@google.com>
8243
8244         * output.cc (Output_section_headers::do_sized_write): Write large
8245         segment count to sh_info field.
8246         (Output_file_header::do_sized_write): For large segment count,
8247         write PN_XNUM to e_phnum field.
8248
8249 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8250
8251         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8252         (Arm_relocate_functions::thm_jump8): New function.
8253         (Arm_relocate_functions::thm_jump11): New function.
8254         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8255         R_ARM_THM_JUMP11.
8256         (Target_arm::Scan::global): Likewise.
8257         (Target_arm::Relocate::relocate): Likewise.
8258         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8259         Likewise.
8260
8261 2010-01-14  Doug Kwan  <dougkwan@google.com>
8262
8263         * arm.cc (map, utility): Include headers.
8264         (Target_arm::apply_cortex_a8_workaround): New method.
8265         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8266         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8267         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8268         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8269         the --[no-]fix-cortex-a8 command line options.
8270         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8271         (Target_arm::relocate_stub): Use addend in instruction template.
8272         * options.h (DEFINE_bool): Set the user-set flag.
8273         (General_options): Add --[no-]-fix-cortex options.
8274         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8275         : Update fast look-up map after conversion.
8276
8277 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8278
8279         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8280         in the first pass of do_layout.
8281
8282 2010-01-13  Doug Kwan  <dougkwan@google.com>
8283
8284         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8285         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8286         apparent compiler problem of not folding static constant integral
8287         data members of elfcpp::Elf_sizes<32>.
8288
8289 2010-01-13  Doug Kwan  <dougkwan@google.com>
8290
8291         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8292         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8293         Arm_relobj::scan_section_for_cortex_a8_erratum,
8294         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8295         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8296         sections to scan for relocation stubs into a new method
8297         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8298         relocation and Cortex-A8 stub scanning.
8299         (Target_arm::do_relax): Force stubs to be after stubbed sections
8300         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8301         the beginning of a new relaxation pass.  Update a comment.
8302         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8303
8304 2010-01-12  Ian Lance Taylor  <iant@google.com>
8305
8306         * target-reloc.h (visibility_error): New inline function.
8307         (relocate_section): Call visibility_error.
8308         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8309         (MOSTLYCLEANFILES): Likewise.
8310         (protected_4_pic.o, protected_3.err): New targets.
8311         * testsuite/protected_4.cc: New file.
8312
8313 2010-01-12  Doug Kwan  <dougkwan@google.com>
8314
8315         * arm.cc (Cortex_a8_reloc): New class.
8316         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8317         and cortex_a8_relocs_info_.
8318         (Target_arm::fix_cortex_a8): New method definition.
8319         (Target_arm::Cortex_a8_relocs_info): New type.
8320         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8321         New data member declarations.
8322         (Target_arm::scan_reloc_for_stub): Record information about
8323         relocations for THUMB branches that might be exempted from the
8324         Cortex-A8 workaround.
8325         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8326         at the beginning of a relaxation pass.
8327
8328 2010-01-12  Doug Kwan  <dougkwan@google.com>
8329
8330         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8331         (Arm_relobj::Mapping_symbol_position,
8332          Arm_reloj::Mapping_symbol_position_less,
8333          Arm_relobj::Mapping_symbols_info): New types.
8334         (Target_arm::is_mapping_symbol_name): New method definition.
8335         (Arm_relobj::do_count_local_symbols): Save information about mapping
8336         symbols.
8337
8338 2010-01-11  Doug Kwan  <dougkwan@google.com>
8339
8340         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8341         Arm_relocate_functions::thumb32_branch_upper,
8342         Arm_relocate_functions::thumb32_branch_lower,
8343         Arm_relocate_functions::thumb32_cond_branch_offset,
8344         Arm_relocate_functions::thumb32_cond_branch_upper,
8345         Arm_relocate_functions::thumb32_cond_branch_lower,
8346         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8347         branch offset encoding.
8348         (Arm_relocate_functions::thumb_branch_common): Use new branch
8349         offset encoding methods to avoid code duplication.
8350         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8351         (Stub_addend_reader::operator()): Use new branch encoding method
8352         to avoid code duplication.
8353
8354 2010-01-11  Doug Kwan  <dougkwan@google.com>
8355
8356         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8357         (Target_arm::do_finalize_sections): Define special EXIDX section
8358         symbols only if referenced.
8359         * gc.h (Garbage_collection::add_reference): New method.
8360         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8361         code duplication.
8362
8363 2010-01-11  Ian Lance Taylor  <iant@google.com>
8364
8365         * script.cc (Version_script_info::build_expression_list_lookup):
8366         Change complaing about duplicate wildcard match from error to
8367         warning.
8368
8369         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8370         of 2009-12-30.
8371         (Version_script_info::Version_script_info): Initialize globs_,
8372         default_version_, default_is_global_, and exact_.  Don't
8373         initialize globals_ or locals_.
8374         (Version_script_info::build_lookup_tables): Build local symbols
8375         first.
8376         (Version_script_info::unquote): New function.
8377         (Version_script_info::add_exact_match): New function.
8378         (Version_script_info::build_expression_list_lookup): Remove lookup
8379         parameter.  Add is_global parameter.  Change all callers.  Handle
8380         wildcard pattern specially.  Unquote pattern.  Call
8381         add_exact_match.
8382         (Version_script_info::get_name_to_match): New function.
8383         (Version_script_info::get_symbol_version): New function.
8384         (Version_script_info::get_symbol_version_helper): Remove.
8385         (Version_script_info::check_unmatched_names): Call unquote.
8386         * script.h (class Version_script_info): Change get_symbol_version
8387         to be non-inline and add is_global parameter; change all callers.
8388         Rewrite symbol_is_local.  Update declarations.  Define struct
8389         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8390         Remove globals_ and locals_ members.  Add exact_, globs_,
8391         default_version_, is_global_.
8392         (Version_script_info::Glob): Remove pattern, add expression and
8393         is_global.  Update constructor.  Change all callers.
8394         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8395         default version.
8396         (Versions::symbol_section_contents): If a symbol is undefined, or
8397         defined in a dynamic object, set the version index to
8398         VER_NDX_LOCAL.
8399         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8400         symbol_is_local.
8401         (Symbol_table::add_from_pluginobj): Likewise.
8402         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8403
8404 2010-01-11  Doug Kwan  <dougkwan@google.com>
8405
8406         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8407         (incremental_dump_LDADD): Add linking option for libintl.
8408         * Makefile.in: Regenerate.
8409
8410 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8411
8412         PR gold/11144
8413         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8414         instead of -Ds.
8415         * testsuite/Makefile.in: Regenerated.
8416
8417 2010-01-10  Doug Kwan  <dougkwan@google.com>
8418
8419         * options.h (DEFINE_var): Use parentheses around argument varname__
8420         in macro body to avoid any unintended subsequent substitutions.
8421
8422 2010-01-10  Ian Lance Taylor  <iant@google.com>
8423
8424         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8425         candidates before doing symbol resolution.
8426
8427         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8428         ODR candidates if only one is weak.
8429
8430 2010-01-08  Ian Lance Taylor  <iant@google.com>
8431
8432         * script.cc (Version_script_info::build_expression_list_lookup):
8433         Don't warn about ambiguous version, just record the ambiguity.
8434         (Version_script_info::get_symbol_version_helper): Give error if
8435         version is ambiguous.
8436
8437 2010-01-08  Doug Kwan  <dougkwan@google.com>
8438
8439         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8440         prev_data_size_ and prev_addralign_.  Remove initializer for
8441         deleted data member has_been_changed_.
8442         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8443         to determine if the table is empty.
8444         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8445         Remove.
8446         (Stub_table::add_reloc_stub): Define method in class definition
8447         instead of just declaring it there.
8448         (Stub_table::add_cortex_a8_stub): New method definition.
8449         (Stub_table::update_data_size_and_addralign): Ditto.
8450         (Stub_table::finalize_stubs): Ditto.
8451         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8452         (Stub_table::do_addralign_): Return address alignment in the
8453         (Stub_table::do_reset_address_and_file_offset): Define method in
8454         class definition instead of declaring it there.  Set current data
8455         size to be the data size of the previous pass.
8456         (Stub_table::set_final_data_size): Use current data size as the
8457         final data size.
8458         (Stub_table::relocate_stub): Change parameter type of stub from
8459         Reloc_stub pointer to Stub pointer.
8460         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8461         (Stub_table::Cortex_a8_stub_list): New typedef.
8462         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8463          Stub_table::prev_addralign_): New data member.
8464         (Arm_relobj::Arm_relobj): Initialize data member
8465         section_has_cortex_a8_workaround_.
8466         (Arm_relobj::section_has_cortex_a8_workaround,
8467          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8468          definitions.
8469         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8470         declarations.
8471         (Target_arm::relocate_stub): Change parameter type of stub from
8472         Reloc_stub pointer to Stub pointer.
8473         (Insn_template::size, Insn_template::alignment): Handle
8474         THUMB16_SPECIAL_TYPE.
8475         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8476          Stub_table::update_data_size_and_addralign,
8477          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8478         definitions.
8479         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8480         (Stub_table::do_write): Ditto.
8481         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8482
8483 2010-01-08  Ian Lance Taylor  <iant@google.com>
8484
8485         PR 11108
8486         * symtab.h (class Symbol): Remove fields is_target_special_ and
8487         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8488         (Symbol::is_defined_in_discarded_section): New function.
8489         (Symbol::set_is_defined_in_discarded_section): New function.
8490         (Symbol::has_plt_offset): Rewrite.
8491         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8492         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8493         Don't initialize is_target_special_ or has_plt_offset_.
8494         Initialize is_defined_in_discarded_section_.
8495         (Symbol_table::add_from_relobj): If appropriate, set
8496         is_defined_in_discarded_section.
8497         * resolve.cc (Symbol::override_base_with_special): Don't test
8498         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8499         * target-reloc.h (relocate_section): Do special handling for
8500         symbols defined in discarded sections for global symbols as well
8501         as local symbols.
8502
8503 2010-01-08  Ian Lance Taylor  <iant@google.com>
8504
8505         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8506         the SHT_SYMTAB case.
8507
8508 2010-01-08  Ian Lance Taylor  <iant@google.com>
8509
8510         * object.cc (Sized_relobj::do_layout): Don't get confused if
8511         layout_eh_frame returns NULL.
8512
8513 2010-01-08  Ian Lance Taylor  <iant@google.com>
8514
8515         PR 11084
8516         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8517         dynamic symbol table, use the normal symbol table.
8518         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8519         symbol table.
8520
8521 2010-01-08  Ian Lance Taylor  <iant@google.com>
8522
8523         PR 11072
8524         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8525         sections.
8526
8527 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8528
8529         * version.cc (print_version): Change to "Copyright 2010".
8530
8531 2010-01-08  Ian Lance Taylor  <iant@google.com>
8532
8533         PR 10287
8534         PR 11063
8535         * i386.cc (class Target_i386): Change return type of plt_section
8536         to be non-const.
8537         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8538         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8539         tls_desc_rel_ field.
8540         (Output_data_plt_i386::rel_tls_desc): New function.
8541         (Target_i386::rel_tls_desc_section): New function.
8542         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8543         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8544         R_386_TLS_DESC reloc in rel_tls_desc_section.
8545         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8546         Define struct Tlsdesc_info.
8547         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8548         (Target_x86_64::do_reloc_symbol_index): New function.
8549         (Target_x86_64::add_tlsdesc_info): New function.
8550         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8551         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8552         tlsdesc_rel_ field.
8553         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8554         all callers.
8555         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8556         (Target_x86_64::rela_tlsdesc_section): New function.
8557         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8558         handling.
8559         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8560         (Target_x86_64::do_reloc_addend): New function.
8561         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8562         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8563         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8564         (Output_reloc::type): New function.
8565         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8566         (Output_reloc::is_target_specific): New function.
8567         (Output_reloc::target_arg): New function.
8568         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8569         absolute relocs and target specific relocs.
8570         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8571         add_target_specific.
8572         (class Output_data_reloc) [SHT_RELA]: Likewise.
8573         * output.cc (Output_reloc::Output_reloc): Add four new versions
8574         for absolute relocs and target specific relocs.
8575         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8576         (Output_reloc::get_symbol_index): Likewise.
8577         (Output_reloc::local_section_offset): Check that local_sym_index_
8578         is not TARGET_CODE or 0.
8579         (Output_reloc::symbol_value): Likewise.
8580         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8581         reloc.
8582         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8583         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8584         functions.
8585         * layout.cc (add_target_dynamic_tags): Use output section for
8586         DT_PLTRELSZ and DT_JMPREL.
8587
8588 2010-01-07  Ian Lance Taylor  <iant@google.com>
8589
8590         PR 11061
8591         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8592         function.
8593         (class Output_data_reloc_generic): Define.
8594         (class Output_data_reloc_base): Change base class to
8595         Output_data_reloc_generic.  Change add() method to call
8596         bump_relative_reloc_count for a relative reloc.  Remove
8597         sort_relocs_ field.
8598         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8599         to sort_relocs().
8600         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8601         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8602         appropriate.
8603         * layout.h (class Layout): Update declaration.
8604
8605 2010-01-07  Ian Lance Taylor  <iant@google.com>
8606
8607         * output.h (class Output_data): Add const version of
8608         output_section and do_output_section.
8609         (class Output_section_data): Add const version of
8610         do_output_section.
8611         (class Output_section): Likewise.
8612         * layout.cc (Layout::add_target_dynamic_tags): New function.
8613         * layout.h (class Layout): Update declarations.
8614         * arm.cc (Target_arm::do_finalize_sections): Use
8615         add_target_dynamic_tags.
8616         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8617         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8618         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8619         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8620
8621 2010-01-07  Ian Lance Taylor  <iant@google.com>
8622
8623         PR 11042
8624         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8625         object as needed.
8626
8627 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8628             Ian Lance Taylor  <iant@google.com>
8629
8630         PR 11019
8631         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8632         Xindex::read_symtab_xindex.
8633
8634 2010-01-07  Doug Kwan  <dougkwan@google.com>
8635
8636         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8637         (Insn_template::thumb16_bcond_insn): New method declaration.
8638         (Insn_template): Fix spelling.
8639         (Stub::thumb16_special): New method declaration.
8640         (Stub::do_write): Define virtual method which was previously pure
8641         virtual.
8642         (Stub::do_thumb16_special): New method declaration.
8643         (Stub::do_fixed_endian_write): New template member.
8644         (Reloc_stub::do_write): Remove.
8645         (Reloc_stub::do_fixed_endian_write): Remove.
8646         (Cortex_a8_stub): New class definition.
8647         (Stub_factory::make_cortex_a8_stub): New method definition.
8648         (Stub_factory::Stub_factory): Add missing static storage class
8649         qualifier for elf32_arm_stub_a8_veneer_blx.
8650
8651 2010-01-07  Ian Lance Taylor  <iant@google.com>
8652
8653         PR 10980
8654         * options.h (class General_options): Add --warn-unresolved-symbols
8655         and --error-unresolved-symbols.
8656         * errors.cc (Errors::undefined_symbol): Implement
8657         --warn-unresolved-symbols.
8658
8659         * options.h (class General_options): Add -z text and -z textoff.
8660         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8661
8662 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8663
8664         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8665         (Garbage_collection::cident_sections): New function.
8666         (Garbage_collection::add_cident_section): New function.
8667         (Garbage_collection::cident_sections_): New member.
8668         (gc_process_relocs): Add references to sections whose names are C
8669         identifiers.
8670         * gold.h (cident_section_start_prefix): New constant.
8671         (cident_section_stop_prefix): New constant.
8672         (is_cident): New function.
8673         * layout.cc (Layout::define_section_symbols): Replace string constants
8674         with the newly defined constants.
8675         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8676         C identifiers.
8677         * testsuite/Makefile.am: Add gc_orphan_section_test.
8678         * testsuite/Makefile.in: Regenerate.
8679         * testsuite/gc_orphan_section_test.cc: New file.
8680         * testsuite/gc_orphan_section_test.sh: New file.
8681
8682 2010-01-06  Ian Lance Taylor  <iant@google.com>
8683
8684         PR 10980
8685         * options.h (class General_options): Add --warn-shared-textrel.
8686         * layout.cc (Layout::finish_dynamic_section): Implement
8687         --warn-shared-textrel.
8688
8689         PR 10980
8690         * options.h (class General_options): Add --warn-multiple-gp.
8691
8692 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8693
8694         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8695         $(THREADSLIB) and $(LIBDL).
8696         * Makefile.in: Rebuild.
8697
8698 2010-01-06  Ian Lance Taylor  <iant@google.com>
8699
8700         PR 10980
8701         * options.cc (General_options::parse_section_start): New function.
8702         (General_options::section_start): New function.
8703         (General_options::General_options): Initialize all members.
8704         * options.h: Include <map>
8705         (class General_options): Add --section-start.  Add section_starts_
8706         member.
8707         * layout.cc (Layout::attach_allocated_section_to_segment): If
8708         --section-start was used, set the address of the segment.  Remove
8709         local sort_sections.
8710         (Layout::relaxation_loop_body): If the address of the load segment
8711         has been set by --section-start, don't use it.
8712         * output.h (Output_segment::update_flags_for_output_section): New
8713         function.
8714         * output.cc (Output_segment::add_output_section): Call
8715         update_flags_for_output_section.
8716
8717 2010-01-05  Ian Lance Taylor  <iant@google.com>
8718
8719         PR 10980
8720         * options.h (class General_options): Add --undefined-version.
8721         * script.cc (struct Version_expression): Add was_matched_by_symbol
8722         field.
8723         (Version_script_info::matched_symbol): New function.
8724         (Version_script_info::get_symbol_version_helper): Call
8725         matched_symbol.
8726         (Version_script_info::check_unmatched_names): New function.
8727         * script.h (class Version_script_info): Update declarations.
8728         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8729
8730         * options.h (class General_options): Use DEFINE_bool_alias for
8731         allow_multiple_definition.
8732         * resolve.cc (Symbol_table::should_override): Don't test
8733         allow_multiple_definition.
8734
8735         PR 10980
8736         * options.h (class General_options): Add --cref.
8737         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8738         until after printing cref table.
8739         * cref.cc: Include "symtab.h".
8740         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8741         (Cref_table_compare::operator()): New function.
8742         (Cref_inputs::gather_cref): New function.
8743         (filecol): New static const.
8744         (Cref_inputs::print_cref): New function.
8745         (Cref::print_cref): New function.
8746         * cref.h: Include <cstdio>.
8747         (class Cref): Update declarations.
8748         * mapfile.h (Mapfile::file): New function.
8749         * object.h (class Object): Define Symbols.  Declare virtual
8750         do_get_global_symbols.
8751         (Object::get_global_symbols): New function.
8752         * object.cc (Input_objects::add_object): Pass object to cref_ if
8753         --cref.
8754         (Input_objects::archive_start): Likewise.
8755         (Input_objects::archive_stop): Likewise.
8756         (Input_objects::print_cref): New function.
8757         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8758         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8759         --cref.
8760         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8761         function.
8762         * plugin.h (class Sized_pluginobj): Update declarations.
8763
8764 2010-01-05  Ian Lance Taylor  <iant@google.com>
8765
8766         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8767         to is_default_version.  Rename insdef to insdefault.
8768         (Symbol_table::add_from_relobj): Rename def to is_default_version
8769         and local to is_forced_local.
8770         (Symbol_table::add_from_pluginobj): Likewise.
8771         (Symbol_table::add_from_dynobj): Likewise.
8772         (Symbol_table::define_special_symbol): Rename insdef to
8773         insdefault.
8774
8775 2010-01-04  Ian Lance Taylor  <iant@google.com>
8776
8777         PR 10980
8778         * options.h (class General_options): Add
8779         --allow-multiple-definition and -z muldefs.
8780         * resolve.cc (Symbol_table::should_override): Don't warn about a
8781         multiple symbol definition if --allow-multiple-definition or -z
8782         muldefs.
8783
8784         PR 10980
8785         * options.h (class General_options): Add --add-needed and
8786         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8787         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8788         error if --copy-dt-needed-entries aka --add-needed is used and
8789         would cause a change in behaviour.
8790
8791         PR 10980
8792         * options.h (class General_options): Add -G as a short version of
8793         --shared.  Add no-op options -assert, -g, and -i.
8794
8795 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8796
8797         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8798         check for .text or .gnu.linkonce.t sections.
8799         * icf.cc (Icf::find_identical_sections): Ditto.
8800         Change the detection for mangled function name within the section
8801         name.
8802         * icf.h (is_section_foldable_candidate): New function.
8803
8804 2009-12-30  Ian Lance Taylor  <iant@google.com>
8805
8806         PR 10980
8807         * options.h (class General_options): Permit two dashes with
8808         --retain-symbols-file.
8809
8810 2009-12-30  Ian Lance Taylor  <iant@google.com>
8811
8812         PR 10979
8813         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8814         don't put the file header and segment headers in the text
8815         segment.
8816
8817         PR 10979
8818         * common.cc (Sort_commons::operator()): Stabilize sort when both
8819         entries are NULL.
8820         (Symbol_table::do_allocate_commons_list): When allocating common
8821         symbols, skip a symbol which is no longer common.
8822         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8823         an object before checking its type.
8824         * testsuite/common_test_2.c: New file.
8825         * testsuite/common_test_3.c: New file.
8826         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8827         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8828         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8829         (common_test_2_pic.o, common_test_2.so): New targets.
8830         (common_test_3_pic.o, common_test_3.so): New targets.
8831         * testsuite/Makefile.in: Rebuild.
8832
8833         PR 10979
8834         * script.cc (read_input_script): If we see a new SECTIONS clause,
8835         and we have added an input section, give an error.
8836         * layout.h (class Layout): Add have_added_input_section function.
8837         Add have_added_input_section_ field.
8838         * layout.cc (Layout::Layout): Initialize
8839         have_added_input_section_.
8840         (Layout::layout): Set have_added_input_section_.
8841         (Layout::layout_eh_frame): Likewise.
8842
8843 2009-12-30  Ian Lance Taylor  <iant@google.com>
8844
8845         PR 10931
8846         * options.h (class General_options): Add --sort-common option.
8847         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8848         * common.cc (Sort_common): Add sort_order parameter to
8849         constructor.  Add sort_order_ field.
8850         (Sort_commons::operator): Check sort_order_.
8851         (Symbol_table::allocate_commons): Determine the sort order.
8852         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8853         Change all callers.
8854         (Symbol_table::do_allocate_commons_list): Likewise.
8855
8856 2009-12-30  Ian Lance Taylor  <iant@google.com>
8857
8858         PR 10916
8859         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8860         symbols from this object, don't change the visibility of an
8861         undefined symbol.
8862         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8863
8864 2009-12-30  Ian Lance Taylor  <iant@google.com>
8865
8866         PR 10861
8867         * script.h (class Version_script_info): Define Language enum.
8868         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8869         new fields globals_, locals_, and is_finalized_.
8870         * script.cc: Various formatting fixes.
8871         (class Parser_closure): Change language_stack_ from a vector of
8872         std::string to one of Version_script_info::Language.  Adjust all
8873         uses accordingly.
8874         (class Lazy_demangler): Remove.
8875         (struct Version_expression): Change language from std::string to
8876         Version_script_info::Language.
8877         (Version_script_info::Version_script_info): New function.
8878         (Version_script_info::~Version_script_info): Don't call clear.
8879         (Version_script_info::finalize): New function.
8880         (Version_script_info::build_lookup_tables): New function.
8881         (Version_script_info::build_expression_list_lookup): New
8882         function.
8883         (Version_script_info::get_symbol_version_helper): Rewrite to use
8884         lookup tables.
8885         (Version_script_info::print_expression_list): Adjust to use
8886         Version_script_info::Language.
8887         (script_push_lex_into_version_mode): Check that the version script
8888         has not been finalized.
8889         (version_script_push_lang): Change language string to
8890         Version_script_info::Language.
8891         * options.cc (Command_line::version_script): New function.
8892         * options.h (class General_options): Add finalize_dynamic_list
8893         function.  Change version_script from declaration to definition.
8894         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8895         * testsuite/version_script.map: Remove duplicate def of foo.
8896         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8897         version_script.map.
8898         * testsuite/Makefile.in: Rebuild.
8899
8900 2009-12-30  Ian Lance Taylor  <iant@google.com>
8901
8902         PR 10843
8903         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8904         if the input symbol index is 0, make the output symbol index 0.
8905
8906 2009-12-30  Ian Lance Taylor  <iant@google.com>
8907
8908         PR 10670
8909         * options.h (class General_options): Add -x/--discard-all.
8910         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8911         --discard-all.  If the local symbol needs a dynamic entry, check
8912         that before handling --discard-locals.
8913
8914 2009-12-30  Ian Lance Taylor  <iant@google.com>
8915
8916         PR 10450
8917         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8918         flags to PF_R.
8919         (Output_segment::add_output_section): Don't change the flags if
8920         the type is PT_TLS.
8921
8922         PR 10450
8923         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8924         GNU hash table if they need a dynamic value.  Otherwise, don't add
8925         them if they are defined in a dynamic object or are forced local.
8926
8927 2009-12-29  Ian Lance Taylor  <iant@google.com>
8928
8929         PR 10450
8930         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8931         .gnu.hash table for a 32-bit target.
8932
8933         PR 10450
8934         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8935         regular and a dynamic object only needs a dynamic symbol table
8936         entry if it is externally visible.
8937
8938         PR 10450
8939         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8940         constructor.  Add global_offset_table_ field.
8941         (Target_i386::got_section): Set global_offset_table_.
8942         (Target_i386::do_finalize_sections): Set global_offset_table_
8943         size.
8944         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8945         in constructor.  Add global_offset_table_ field.
8946         (Target_x86_64::got_section): Set global_offset_table_.
8947         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8948         size.
8949
8950         * layout.cc (Layout::Layout): Initialize increase_relro_.
8951         (Layout::get_output_section): Add is_relro, is_last_relro, and
8952         is_first_non_relro parameters.  Change all callers.
8953         (Layout::choose_output_section): Likewise.
8954         (Layout::add_output_section_data): Likewise.
8955         (Layout::make_output_section): Likewise.
8956         (Layout::set_segment_offsets): Clear increase_relro when using a
8957         linker script.
8958         * layout.h (class Layout): Add increase_relro method.  Add
8959         increase_relro_ field.  Update declarations.
8960         * output.cc (Output_section::Output_section): Initialize
8961         is_last_relro_ and is_first_non_relro_.
8962         (Output_segment::add_output_section): Group relro sections is
8963         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8964         (Output_segment::maximum_alignment): Remove relro handling.
8965         (Output_segment::set_section_addresses): Add increase_relro
8966         parameter.  Change all callers.  Add initial alignment to align
8967         relro sections on separate page.  Remove old relro handling.
8968         (Output_segment::set_section_list_addresses): Remove in_relro
8969         parameter.  Change all callers.
8970         (Output_segment::set_offset): Add increase parameter.  Change all
8971         callers.  Remove old relro handling.
8972         * output.h (class Output_section): Add new methods: is_last_relro,
8973         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8974         Add is_last_relro_ and is_first_non_relro_ fields.
8975         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8976         Create separate .got.plt section.  Call increase_relro.
8977         * x86_64.cc (Target_x86_64::got_section): Likewise.
8978         * testsuite/relro_script_test.t: Add .got.plt.
8979
8980         PR 10450
8981         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8982         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8983         (Layout::finalize): Call set_dynamic_symbol_size.
8984         (Layout::set_dynamic_symbol_size): New function.
8985         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8986         set_dynamic_symbol_size.
8987
8988         PR 10450
8989         * output.h (class Output_section): Add is_entsize_zero_ field.
8990         * output.cc (Output_section::Output_section): Initialize
8991         is_entsize_zero_.
8992         (Output_section::set_entsize): If two different entsizes are
8993         requested, force it to zero.
8994         (Output_section::add_input_section): Set flags for .debug_str
8995         before updating section flags.  Set entsize.
8996         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8997         and SHF_STRING if all input sections have those flags.
8998
8999 2009-12-29   Rafael Espindola  <espindola@google.com>
9000
9001         * main.cc (main): Fix the sys time reporting.
9002         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9003         reporting.
9004
9005 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9006
9007         * options.cc (General_options::parse_version): Allow -v to exit
9008         without an error if there is nothing to link.
9009
9010 2009-12-29  Ian Lance Taylor  <iant@google.com>
9011
9012         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9013         using a version of gcc before 4.1.
9014         * configure: Rebuild.
9015
9016 2009-12-28  Chris Demetriou  <cgd@google.com>
9017
9018         * attributes.cc (Output_attributes_section_data::do_write): Use
9019         std::vector::front rather than std::vector::data.
9020
9021 2009-12-28  Ian Lance Taylor  <iant@google.com>
9022
9023         * symtab.h (class Symbol_table): Add enum Defined.
9024         * resolve.cc (Symbol_table::should_override): Add defined
9025         parameter.  Change all callers.  Test whether object is NULL
9026         before calling a method on it.
9027         (Symbol_table::report_resolve_problem): Add defined parameter.
9028         Change all callers.
9029         (Symbol_table::should_override_with_special): Likewise.
9030         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9031         parameter.  Change all callers.
9032         (Symbol_table::do_define_in_output_data): Likewise.
9033         (Symbol_table::define_in_output_segment): Likewise.
9034         (Symbol_table::do_define_in_output_segment): Likewise.
9035         (Symbol_table::define_as_constant): Likewise.
9036         (Symbol_table::do_define_as_constant): Likewise.
9037         * script.h (class Symbol_assignment): Add is_defsym parameter to
9038         constructor; change all callers.
9039         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9040         parameter.  Change all callers.  Add is_defsym_ field.
9041         (class Parser_closure): Add parsing_defsym parameter to
9042         constructor; change all callers.  Add parsing_defsym accessor
9043         function.  Add parsing_defsym_ field.
9044
9045 2009-12-28  Ian Lance Taylor  <iant@google.com>
9046
9047         * gold.cc (queue_middle_tasks): Fix formatting.
9048         * object.cc (Relobj::is_section_name_included): Likewise.
9049
9050 2009-12-23  Ian Lance Taylor  <iant@google.com>
9051
9052         * i386.cc (Target_i386::do_calls_non_split): Recognize
9053         -fsplit-stack prologue for a function with a static chain.
9054         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9055         -fsplit-stack prologue when using %r11.
9056
9057 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9058
9059         * options.cc (General_options::parse_version): Make -v continue and do
9060         the link like GNU ld does.
9061
9062 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9063
9064         * Makefile.am (CCFILES): Add timer.cc.
9065         (HFILES): Add timer.h.
9066         * configure.ac: Check for sysconf and times.
9067         * main.cc: include timer.h.
9068         (main): Use Timer instead of get_run_time.
9069         * timer.cc: New.
9070         * timer.h: New.
9071         * workqueue.cc: include timer.h.
9072         (Workqueue::find_and_run_task):
9073         Report user, sys and wall time.
9074         * Makefile.in: Regenerate.
9075         * config.in: Regenerate.
9076         * configure: Regenerate.
9077
9078 2009-12-16  Doug Kwan  <dougkwan@google.com>
9079
9080         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9081         sections.
9082         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9083         relaxed input sections.
9084         * output.cc (Output_section::find_relaxed_input_section): Change
9085         return type to Output_relaxed_input_section pointer.  Adjust code
9086         for new type of relaxed_input_section_map_.
9087         * output.h (Output_section::find_relaxed_input_section): Change
9088         return type to Output_relaxed_input_section pointer.
9089         (Output_section::Output_relaxed_input_section_by_input_section_map):
9090         New type.
9091         (Output_section::relaxed_input_section_map_): Change type to
9092         Output_section::Output_relaxed_input_section_by_input_section_map.
9093         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9094         input section.
9095
9096 2009-12-15  Ian Lance Taylor  <iant@google.com>
9097
9098         * layout.cc (Layout::create_shstrtab): Only write out after input
9099         sections if we are compressing debug sections.
9100
9101 2009-12-15  Ian Lance Taylor  <iant@google.com>
9102
9103         * archive.cc (Archive::add_symbols): Only look up a symbol without
9104         a version if there is, in fact, a version.
9105
9106 2009-12-14  Ian Lance Taylor  <iant@google.com>
9107
9108         Revert -Wshadow changes, all changes from:
9109         2009-12-11  Doug Kwan  <dougkwan@google.com>
9110         2009-12-11  Nick Clifton  <nickc@redhat.com>
9111         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9112
9113 2009-12-11  Doug Kwan  <dougkwan@google.com>
9114
9115         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9116         due to -Wshadow.
9117         * attributes.cc (Object_attribute::size): Ditto.
9118         (Attributes_section_data::size): Ditto.
9119         (Attributes_section_data::Attributes_section_data): Ditto.
9120         (Output_attributes_section_data::do_write): Ditto.
9121         * attributes.h (Object_attribute::set_type): Ditto.
9122         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9123
9124 2009-12-11  Nick Clifton  <nickc@redhat.com>
9125
9126         * archive.cc: Fix shadowed variable warnings.
9127         * arm.cc: Likewise.
9128         * compressed_output.cc: Likewise.
9129         * compressed_output.h: Likewise.
9130         * configure: Likewise.
9131         * dwarf_reader.cc: Likewise.
9132         * dynobj.cc: Likewise.
9133         * dynobj.h: Likewise.
9134         * ehframe.cc: Likewise.
9135         * ehframe.h: Likewise.
9136         * errors.cc: Likewise.
9137         * expression.cc: Likewise.
9138         * fileread.cc: Likewise.
9139         * fileread.h: Likewise.
9140         * freebsd.h: Likewise.
9141         * i386.cc: Likewise.
9142         * icf.cc: Likewise.
9143         * incremental.h: Likewise.
9144         * layout.cc: Likewise.
9145         * layout.h: Likewise.
9146         * mapfile.cc: Likewise.
9147         * merge.cc: Likewise.
9148         * merge.h: Likewise.
9149         * object.cc: Likewise.
9150         * object.h: Likewise.
9151         * options.h: Likewise.
9152         * output.cc: Likewise.
9153         * output.h: Likewise.
9154         * parameters.cc: Likewise.
9155         * plugin.cc: Likewise.
9156         * powerpc.cc: Likewise.
9157         * reduced_debug_output.cc: Likewise.
9158         * reduced_debug_output.h: Likewise.
9159         * reloc.cc: Likewise.
9160         * reloc.h: Likewise.
9161         * resolve.cc: Likewise.
9162         * script-sections.cc: Likewise.
9163         * script.cc: Likewise.
9164         * script.h: Likewise.
9165         * sparc.cc: Likewise.
9166         * symtab.cc: Likewise.
9167         * symtab.h: Likewise.
9168         * target-select.cc: Likewise.
9169         * target-select.h: Likewise.
9170         * token.h: Likewise.
9171         * workqueue.cc: Likewise.
9172         * workqueue.h: Likewise.
9173         * x86_64.cc: Likewise.
9174
9175 2009-12-10  Doug Kwan  <dougkwan@google.com>
9176
9177         * arm.cc (attributes.h): New include.
9178         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9179         (Arm_relobj::~Arm_relobj): Delete object pointed by
9180         attributes_section_data_.
9181         (Arm_relobj::attributes_section_data): New method definition.
9182         (Arm_relobj::attributes_section_data_): New data member declaration.
9183         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9184         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9185         attributes_section_data_.
9186         (Arm_dynobj::attributes_section_data): New method definition.
9187         (Arm_dynobj::attributes_section_data_): New data member declaration.
9188         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9189         initialization value of may_use_blx_ to false.
9190         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9191         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9192         object attributes to compute results instead of hard-coding.
9193         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9194         Target_arm::get_secondary_compatible_arch,
9195         Target_arm::set_secondary_compatible_arch
9196         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9197         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9198         New method declarations.
9199         (Target_arm::get_aeabi_object_attribute): New method definition.
9200         (Target_arm::attributes_section_data_): New data member declaration.
9201         (read_arm_attributes_section): New template definition.
9202         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9203         (Arm_dynobj::do_read_symbols): Ditto.
9204         (Target_arm::do_finalize_sections): Merge attributes sections from
9205         input.  Check for BLX use after attributes section merging.
9206         Fix __exidx_start and __exidx_end visibility.  Create an
9207         .ARM.attributes section if necessary.
9208         (Target_arm::get_secondary_compatible_arch,
9209         Target_arm::set_secondary_compatible_arch,
9210         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9211         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9212         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9213         New method definitions.
9214
9215 2009-12-09  Ian Lance Taylor  <iant@google.com>
9216
9217         * plugin.cc (Plugin::load): Don't cast from void* to a function
9218         pointer.
9219
9220 2009-12-09  Ian Lance Taylor  <iant@google.com>
9221
9222         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9223         information fields.
9224
9225 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9226
9227         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9228         Replace two_file_shared_1.so with two_file_shared_2.so.
9229         * testsuite/Makefile.in: Regenerated.
9230
9231 2009-12-08  Doug Kwan  <dougkwan@google.com>
9232
9233         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9234         (HFILES): Add attributes.h and int_encoding.h.
9235         * Makefile.in: Regenerate.
9236         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9237         function definitions to int_encoding.cc
9238         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9239         prototypes to int_encoding.h
9240         * reduced_debug_output.cc (int_encoding.h): New include.
9241         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9242         function definitions to int_encoding.cc
9243         (insert_into_vector, read_from_pointer): Move template definitions to
9244         int_encoding.h
9245         * attributes.cc: New file.
9246         * attributes.h: New file.
9247         * int_encoding.cc: New file.
9248         * int_encoding.h: New file.
9249
9250 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9251
9252         PR gold/11055
9253         * incremental-dump.cc (dump_incremental_inputs): New.
9254         (main): Use dump_incremental_inputs.
9255
9256 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9257
9258         PR gold/10893
9259         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9260         checking elfcpp::STT_FUNC.
9261         (Target_i386::Relocate::relocate): Likewise.
9262         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9263
9264         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9265         symbols from shared libraries into normal FUNC symbols.
9266
9267         * symtab.h (Symbol): Add is_func and use it.
9268
9269 2009-12-05  Doug Kwan  <dougkwan@google.com>
9270
9271         * arm.cc (Target_arm::arm_info): Initialize new fields
9272         attributes_section and attributes_vendor.
9273         * i386.cc (Target_i386::i386_info): Same.
9274         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9275         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9276         fields attributes_section and attributes_vendor.
9277         * sparc.cc (Target_sparc::sparc_info): Same.
9278         * target.h (Target::attributes_section, Target::attributes_vendor,
9279         Target::is_attributes_section, Target::attribute_arg_type,
9280         Target::attributes_order): New method definitions.
9281         (Target::Target_info::attributes_section,
9282         Target::Target_info::attributes_vendor): New fields.
9283         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9284         virtual method definitions.
9285         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9286         attributes_section and attributes_vendor.
9287         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9288
9289 2009-12-05  Doug Kwan  <dougkwan@google.com>
9290
9291         * arm.cc: Update comments about interworking and stub generation.
9292         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9293         considered as non-PIC.
9294         (Arm_relocate_functions::base_abs): Fix formatting.
9295         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9296         of function to use GOT entry address instead of offset.
9297         (Target_arm::Scan::global): Issue an error if a symbol would need a
9298         PLT does not get one because it is untyped.  Remove code to create
9299         dynamic symbols for relative branches.
9300         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9301         takes unsigned integer instead of boolean.
9302
9303 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9304
9305         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9306         (two_file_test_LDADD): Likewise.
9307         (common_test_1_LDADD): Likewise.
9308         (exception_test_LDADD) Likewise.
9309         (weak_test_LDADD): Likewise.
9310         (many_sections_test_LDADD): Likewise.
9311         (initpri1_LDADD): Likewise.
9312         (script_test_1_LDADD): Likewise.
9313         (script_test_2_LDADD): Likewise.
9314         (justsyms_LDADD): Likewise.
9315         (binary_test_LDADD): Likewise.
9316         (large_LDADD): Likewise.
9317         * testsuite/Makefile.in: Regenerated.
9318
9319 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9320
9321         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9322         (Symbol_table::override_with_special): Likewise.
9323         (Symbol_table::add_from_object): Likewise.
9324
9325 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9326
9327         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9328         Don't set the data_offset twice.
9329
9330 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9331
9332         * testsuite/Makefile.in: Regenerate.
9333
9334 2009-12-03  Doug Kwan  <dougkwan@google.com>
9335
9336         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9337         (Target_arm::do_finalize_sections): Add parameter for symbol table
9338         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9339         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9340         parameter for symbol table pointer.
9341         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9342         an additional parameter for a pointer to symbol table.
9343         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9344         parameter for a symbol table pointer.
9345         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9346         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9347         Ditto.
9348         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9349         parameter for a symbol table pointer.
9350
9351 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9352
9353         * incremental.cc (Incremental_inputs_header)
9354         (Incremental_inputs_header_write, Incremental_inputs_entry)
9355         (Incremental_inputs_entry_write): Move ...
9356         * incremental.h (Incremental_inputs_header)
9357         (Incremental_inputs_header_write, Incremental_inputs_entry)
9358         (Incremental_inputs_entry_write): here.
9359
9360 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9361
9362         * incremental.cc (make_sized_incremental_binary): Set the target.
9363         Error if it is incompatible.
9364         * output.h (Output_file): Add filename method.
9365
9366 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9367
9368         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9369         from the get_* methods.
9370
9371 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9372
9373         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9374         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9375         Write 0 for the data_offset of scripts.
9376
9377 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9378
9379         * testsuite/Makefile.am: Add the incremental_test.sh test.
9380         * testsuite/incremental_test.sh: New.
9381         * testsuite/incremental_test_1.c: New.
9382         * testsuite/incremental_test_2.c: New.
9383
9384 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9385
9386         * incremental-dump.cc (main): Fix typos.
9387
9388 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9389
9390         PR gold/11025
9391         * incremental-dump.cc (main): Use llu to print 64 bit values.
9392
9393 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9394             H.J. Lu  <hongjiu.lu@intel.com>
9395
9396         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9397         $(LIBDL).
9398         (incremental_dump_LDADD): Likewise.
9399         * Makefile.in: Regenerated.
9400
9401 2009-11-25  Doug Kwan  <dougkwan@google.com>
9402
9403         Revert:
9404
9405         2009-11-25  Doug Kwan  <dougkwan@google.com>
9406
9407                 * arm.cc (Target_arm::Target_arm): Move method definition
9408                 outside of class definition.  Add code to handle
9409                 --target1-rel, --target1-abs and --target2= options.
9410                 (Target_arm::get_reloc_reloc_type): Change method to be
9411                 non-static and const.
9412                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9413                 New data member declaration.
9414                 (Target_arm::Scan::local, Target_arm::Scan::global,
9415                 Target_arm::Relocate::relocate,
9416                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9417                 Adjust call to Target_arm::get_real_reloc_type.
9418                 (Target_arm::get_real_reloc_type): Use command line options
9419                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9420                 * options.h (--target1-rel, --target1-abs, --target2): New
9421                 ARM-only options.
9422
9423 2009-11-25  Doug Kwan  <dougkwan@google.com>
9424
9425         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9426         class definition.  Add code to handle --target1-rel, --target1-abs
9427         and --target2= options.
9428         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9429         and const.
9430         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9431         member declaration.
9432         (Target_arm::Scan::local, Target_arm::Scan::global,
9433         Target_arm::Relocate::relocate,
9434         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9435         call to Target_arm::get_real_reloc_type.
9436         (Target_arm::get_real_reloc_type): Use command line options to
9437         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9438         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9439         options.
9440
9441 2009-11-25  Doug Kwan  <dougkwan@google.com>
9442
9443         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9444         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9445         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9446         formatting.
9447         (Arm_relocate_functions::thm_call): Replace body with a call to
9448         Arm_relocate_functions::thumb_branch_common.
9449         (Arm_relocate_functions::thm_jump24,
9450         Arm_relocate_functions::thm_xpc22): New method definitions.
9451         (Arm_relocate_functions::thumb_branch_common): New method definition.
9452         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9453         operator.
9454         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9455         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9456
9457 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9458
9459         * Makefile.am: Build incremental-dump
9460         * Makefile.in: Regenerate.
9461         * incremental-dump.cc: New.
9462         * incremental.cc (Incremental_inputs_header_data,
9463         Incremental_inputs_entry_data): Move to incremental.h
9464         * incremental.h: (Incremental_inputs_header_data,
9465         Incremental_inputs_entry_data): Move from incremental.cc
9466
9467 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9468
9469         * incremental.cc (Incremental_inputs_header,
9470         Incremental_inputs_header_write, Incremental_inputs_entry,
9471         Incremental_inputs_entry_write): Add a typedef with the data type.
9472
9473 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9474
9475         * incremental.cc (Incremental_inputs_header,
9476         Incremental_inputs_header_write, Incremental_inputs_entry,
9477         Incremental_inputs_entry_write): Update comment about which
9478         type has the filed descriptions.
9479
9480 2009-11-15  Doug Kwan  <dougkwan@google.com>
9481
9482         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9483         (Arm_relocate_functions::arm_branch_common): Change method defintion
9484         in class definition to a method declaration and update list of formal
9485         parameters.
9486         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9487         Arm_relocation_functions::jump24): Adjust call to
9488         Arm_relocate_functions::arm_branch_common.  Update list of formal
9489         parameters.
9490         (Arm_relocate_functions::xpc25): New method definition.
9491         (Arm_relocate_functions::arm_branch_common): Move method defintion
9492         out from class definition.  Use stubs for mode-switching and extending
9493         branch ranges.
9494         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9495         specially.  Change code to enable use of stubs in ARM branches.
9496
9497 2009-11-10  Doug Kwan  <dougkwan@google.com>
9498
9499         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9500         in method declaration.
9501         (Target_arm::relocate_stub): New method declaration.
9502         (Target_arm::default_target): Change to return a pointer instead of
9503         a const reference.
9504         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9505         Target_arm::default_target.
9506         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9507         method definition.
9508         (Target_arm::relocate_section): Adjust view.
9509         (Target_arm::relocate_stub): New method definition.
9510
9511 2009-11-10  Doug Kwan  <dougkwan@google.com>
9512
9513         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9514         a format warning.
9515         * incremental.cc (open_incremental_binary): Initialized local
9516         variables to avoid warnings.
9517         * object.cc (make_elf_object): Ditto.
9518         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9519         a format warning.
9520
9521 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9522
9523         PR gold/10930
9524         * testsuite/plugin_test.c: Include "config.h".
9525
9526 2009-11-09  Doug Kwan  <dougkwan@google.com>
9527
9528         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9529         (arm_symbol_value): Remove.
9530         (Arm_relocate_functions::arm_branch_common,
9531         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9532         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9533         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9534         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9535         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9536         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9537         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9538         Arm_relocate_functions::thm_mobw_abs_nc,
9539         Arm_relocate_functions::thm_mov_abs,
9540         Arm_relocate_functions::movw_prel_nc,
9541         Arm_relocate_functions::thm_movt_abs,
9542         Arm_relocate_functions::movt_prel,
9543         Arm_relocate_functions::thm_movw_prel_nc,
9544         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9545         (Target_arm::Relocate::relocate): Only decompose address into two
9546         parts if relocation type uses the thumb-bit and pass the actual
9547         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9548         calls to methods in Arm_relocate_functions for this change.
9549
9550 2009-11-08  Ian Lance Taylor  <iant@google.com>
9551
9552         PR 10925
9553         * reloc.cc: Instantiate
9554         Sized_relobj::initialize_input_to_output_maps and
9555         Sized_relobj:free_input_to_output_maps.
9556
9557 2009-11-06  Ian Lance Taylor  <iant@google.com>
9558
9559         PR 10876
9560         * defstd.cc (in_segment): Set only_if_ref true for "end".
9561
9562 2009-11-06  Doug Kwan  <dougkwan@google.com>
9563
9564         * arm.cc (class Reloc_stub): Correct a comment.
9565         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9566         (Target_arm::scan_section_for_stubs): New method declaration.
9567         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9568         Change methods from private to protected.
9569         (Target_arm::do_may_relax): New method definition.
9570         (Target_arm::do_relax, Target_arm::group_sections,
9571         Target_arm::scan_reloc_for_stub,
9572         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9573         (Target_arm::arm_input_section_map_): New data member declaration.
9574         (Target_arm::scan_reloc_for_stub,
9575         Target_arm::scan_reloc_section_for_stubs,
9576         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9577         Target_arm::do_relax): New method definitions.
9578
9579 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9580
9581         * configure.ac: Check for (struct stat)::st_mtim
9582         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9583         * config.in: Regenerate.
9584         * configure: Regenerate.
9585
9586 2009-11-05  Ian Lance Taylor  <iant@google.com>
9587
9588         PR 10910
9589         * output.cc (Output_segment::add_output_section): Add missing
9590         return statement.
9591
9592 2009-11-04  Ian Lance Taylor  <iant@google.com>
9593
9594         PR 10880
9595         * object.h (class Object): Add is_needed and set_is_needed
9596         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9597         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9598         defined in a dynamic object and referenced by a regular object,
9599         set is_needed for the dynamic object.
9600         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9601         if the file is marked with as_needed and it is not needed.
9602
9603 2009-11-04  Ian Lance Taylor  <iant@google.com>
9604
9605         PR 10887
9606         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9607         tags if data is discarded by linker script.
9608         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9609         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9610         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9611         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9612
9613 2009-11-04  Ian Lance Taylor  <iant@google.com>
9614
9615         * layout.cc (Layout::get_output_section): Add is_interp and
9616         is_dynamic_linker_section parameters.  Change all callers.
9617         (Layout::choose_output_section): Likewise.
9618         (Layout::make_output_section): Likewise.
9619         (Layout::add_output_section_data): Add is_dynamic_linker_section
9620         parameter.  Change all callers.
9621         * layout.h (class Layout): Update declarations.
9622         * output.h (class Output_section): Add is_interp, set_is_interp,
9623         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9624         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9625         generate_code_fills_at_write_ to a bitfield.
9626         * output.cc (Output_section::Output_sections): Initialize new
9627         fields.
9628         (Output_segment::add_output_section): Add do_sort parameter.
9629         Change all callers.
9630
9631 2009-11-03  Ian Lance Taylor  <iant@google.com>
9632
9633         PR 10860
9634         * options.h (class General_options): Add --warn-common.
9635         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9636         merging two common symbols.
9637         (Symbol_table::should_override): Handle --warn-common when merging
9638         a common symbol with a defined symbol.  Use report_resolve_problem
9639         for multiple definitions.
9640         (Symbol_table::report_resolve_problem): New function.
9641         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9642
9643 2009-11-03  Doug Kwan  <dougkwan@google.com>
9644
9645         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9646         stub_factory_.
9647         (Target_arm::stub_factory): New method definition.
9648         (Target_arm::new_arm_input_section,
9649         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9650         Target_arm::reloc_uses_thumb_bit): New method declarations.
9651         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9652         New type definitions.
9653         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9654         member declarations.
9655         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9656         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9657         New method definitions.
9658
9659 2009-11-03  Ian Lance Taylor  <iant@google.com>
9660
9661         * options.h (class General_options): Add --warn_constructors.
9662
9663 2009-11-03  Ian Lance Taylor  <iant@google.com>
9664
9665         PR 10893
9666         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9667         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9668
9669 2009-11-03  Ian Lance Taylor  <iant@google.com>
9670
9671         PR 10895
9672         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9673         --msgid-bugs-address.
9674         (install-pdf): New target.
9675         (install-data_yes): Look up one directory to find mkinstalldirs.
9676
9677 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9678
9679         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9680         tree.
9681
9682 2009-10-30  Doug Kwan  <dougkwan@google.com>
9683
9684         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9685
9686 2009-10-30  Doug Kwan  <dougkwan@google.com>
9687
9688         * arm.cc (Stub_addend_reader): New struct template definition
9689         and partial specializations.
9690         (Stub_addend_reader::operator()): New method definition for a
9691         partially specialized template.
9692
9693 2009-10-30  Doug Kwan  <dougkwan@google.com>
9694
9695         * arm.cc (Arm_relobj::processor_specific_flags): New method
9696         definition.
9697         (Arm_relobj::do_read_symbols): New method declaration.
9698         (Arm_relobj::processor_specific_flags_): New data member declaration.
9699         (Arm_dynobj): New class definition.
9700         (Target_arm::do_finalize_sections): Add input_objects parameter.
9701         (Target_arm::do_adjust_elf_header): New method declaration.
9702         (Target_arm::are_eabi_versions_compatible,
9703         (Target_arm::merge_processor_specific_flags): New method declaration.
9704         (Target_arm::do_make_elf_object): New overloaded method definitions
9705         and declaration.
9706         (Arm_relobj::do_read_symbols): New method definition.
9707         (Arm_dynobj::do_read_symbols): Ditto.
9708         (Target_arm::do_finalize_sections): Add input_objects parameters.
9709         Merge processor-specific flags from all input objects.
9710         (Target_arm::are_eabi_versions_compatible,
9711         Target_arm::merge_processor_specific_flags,
9712         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9713         New method definitions.
9714         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9715         Input_objects pointer type parameter.
9716         * layout.cc (Layout::finalize): Pass input objects to target's.
9717         finalize_sections function.
9718         * output.cc (Output_file_header::do_sized_write): Set ELF file
9719         header's processor-specific flags.
9720         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9721         Input_objects pointer type parameter.
9722         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9723         * target.h (Input_objects): New forward class declaration.
9724         (Target::processor_specific_flags,
9725         Target::are_processor_specific_flags_sect): New method definitions.
9726         (Target::finalize_sections): Add input_objects parameter.
9727         (Target::Target): Initialize processor_specific_flags_ and
9728         are_processor_specific_flags_set_.
9729         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9730         parameter.
9731         (Target::set_processor_specific_flags): New method definition.
9732         (Target::processor_specific_flags_,
9733         Target::are_processor_specific_flags_set_): New data member
9734         declarations.
9735         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9736         Input_objects pointer type parameter.
9737
9738 2009-10-30  Doug Kwan  <dougkwan@google.com>
9739
9740         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9741
9742 2009-10-28  Ian Lance Taylor  <iant@google.com>
9743
9744         * object.h (class Relobj): Drop options parameter from
9745         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9746         do_scan_relocs, do_relocate.  Change all callers.
9747         (class Sized_relobj): Drop options parameters from
9748         do_gc_process_relocs, do_scan_relocs, do_relocate,
9749         do_relocate_sections, relocate_sections, emit_relocs_scan,
9750         emit_relocs_scan_reltype.  Change all callers.
9751         (struct Relocate_info): Remove options field and all references to
9752         it.
9753         * reloc.h (class Read_relocs): Remove options constructor
9754         parameter and options_ field.  Change all callers.
9755         (class Gc_process_relocs, class Scan_relocs): Likewise.
9756         (class Relocate_task): Likewise.
9757         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9758         all callers.
9759         (scan_relocatable_relocs): Likewise.
9760         * target.h (class Sized_target): Remove options parameter from
9761         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9762         all callers.
9763         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9764         callers.
9765         * arm.cc: Update functions to remove options parameters.
9766         * i386.cc: Likewise.
9767         * powerpc.cc: Likewise.
9768         * sparc.cc: Likewise.
9769         * x86_64.cc: Likewise.
9770         * testsuite/testfile.cc: Likewise.
9771
9772 2009-10-28  Doug Kwan  <dougkwan@google.com>
9773
9774         * arm.cc (Arm_relobj): New class definition.
9775         (Arm_relobj::scan_sections_for_stubs,
9776         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9777         New method definitions.
9778
9779 2009-10-28  Cary Coutant  <ccoutant@google.com>
9780
9781         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9782         (Plugin::cleanup_done_): New member.
9783         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9784         (Plugin_manager::cleanup_done_): Remove.
9785         (Plugin_manager::add_input_file): Edit error message.
9786         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9787         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9788
9789 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9790
9791         * fileread.cc: (File_read::View::~View): Use the new
9792         data_ownership_ filed.
9793         (File_read::~File_read): Dispose the new whole_file_view_.
9794         (File_read::open): Mmap the whole file if needed.
9795         (File_read::open): Use whole_file_view_ instead of contents_.
9796         (File_read::find_view): Use whole_file_view_ if applicable.
9797         (File_read::do_read): Use whole_file_view_ instead of contents_.
9798         (File_read::make_view): Use whole_file_view_ instead of contents_,
9799         update File_read::View::View call.
9800         (File_read::find_or_make_view): Update File_read::View::View
9801         call.
9802         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9803         remove contents_
9804         (File_read::View::Data_ownership): New enum.
9805         (File_read::View::View): Replace bool mapped_ with Data_ownership
9806         argument.
9807         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9808         (File_read::View::data_ownership_): New field.
9809         (File_read::contents_): Remove (replaced by whole_file_view_).
9810         (File_read::whole_file_view_): New field.
9811         * options.h (class General_options): Add --keep-files-mapped.
9812
9813 2009-10-27  Cary Coutant  <ccoutant@google.com>
9814
9815         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9816         * testsuite/Makefile.am (plugin_test_5): New test case.
9817         * testsuite/Makefile.in: Regenerate.
9818
9819 2009-10-25  Doug Kwan  <dougkwan@google.com>
9820
9821         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9822         from private to protected to allow access by child class.
9823         (Sized_relobj::do_relocate_sections): New method declaration.
9824         (Sized_relobj::relocate_sections): Virtualize.
9825         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9826         Sized_relobj::relocate_sections.  Instantiate template explicitly
9827         for different target sizes and endianity.
9828
9829 2009-10-24  Doug Kwan  <dougkwan@google.com>
9830
9831         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9832         (Arm_input_section::as_arm_input_section): New method.
9833         (Arm_output_section): New class definition.
9834         (Arm_output_section::create_stub_group,
9835         Arm_output_section::group_sections): New method definitions.
9836
9837 2009-10-22  Doug Kwan  <dougkwan@google.com>
9838
9839         * arm.cc (Arm_input_section): New class definition.
9840         (Arm_input_section::init, Arm_input_section:do_write,
9841         Arm_input_section::set_final_data_size,
9842         Arm_input_section::do_reset_address_and_file_offset): New method
9843         definitions.
9844
9845 2009-10-21  Doug Kwan  <dougkwan@google.com>
9846
9847         * arm.cc (Stub_table, Arm_input_section): New forward class
9848         declarations.
9849         (Stub_table): New class defintion.
9850         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9851         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9852         New method definition.
9853
9854 2009-10-21  Doug Kwan  <dougkwan@google.com>
9855
9856         * arm.cc: Update copyright comments.
9857         (Target_arm): New forward class template declaration.
9858         (Arm_address): New type.
9859         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9860         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9861         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9862         constants.
9863         (Insn_template): Same.
9864         (DEF_STUBS): New macro.
9865         (Stub_type): New enum type.
9866         (Stub_template): New class definition.
9867         (Stub): Same.
9868         (Reloc_stub): Same.
9869         (Stub_factory): Same.
9870         (Target_arm::Target_arm): Initialize may_use_blx_ and
9871         should_force_pic_veneer_.
9872         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9873         Target_arm::should_force_pic_veneer,
9874         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9875         Target_arm::using_thumb_only, Target_arm:;default_target): New
9876         method defintions.
9877         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9878         New data member declarations.
9879         (Insn_template::size, Insn_template::alignment): New method defintions.
9880         (Stub_template::Stub_template): New method definition.
9881         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9882         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9883         (Stub_factory::Stub_factory): New method definition.
9884         * gold.h (string_hash): New template.
9885         * output.h (Input_section_specifier::hash_value): Use
9886         gold::string_hash.
9887         (Input_section_specifier::string_hash): Remove.
9888         * stringpool.cc (Stringpool_template::string_hash): Use
9889         gold::string_hash.
9890
9891 2009-10-20  Doug Kwan  <dougkwan@google.com>
9892
9893         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9894         symbols of relaxed input sections.
9895         * output.h (Output_section::find_relaxed_input_section): Make
9896         method public.
9897
9898 2009-10-16  Doug Kwan  <dougkwan@google.com>
9899
9900         * dynobj.cc (Versions::Versions): Initialize version_script_.
9901         Only insert base version symbol definition for a shared object
9902         if version script defines any version versions.
9903         (Versions::define_base_version): New method definition.
9904         (Versions::add_def): Check that base version is not needed.
9905         (Versions::add_need): Define base version lazily.
9906         * dynobj.h (Versions::define_base_version): New method declaration.
9907         (Versions::needs_base_version_): New data member declaration.
9908         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9909         (check_DATA): Add no_version_test.stdout.
9910         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9911         New make rules.
9912         * testsuite/Makefile.in: Regenerate.
9913         * testsuite/no_version_test.c: New file.
9914         * testsuite/no_version_test.sh: Ditto.
9915
9916 2009-10-16  Doug Kwan  <dougkwan@google.com>
9917
9918         * expression.cc (class Segment_start_expression): New class definition.
9919         (Segment_start_expression::value): New method definition.
9920         (script_exp_function_segment_start): Return a new
9921         Segment_start_expression.
9922         * gold/script-c.h (script_saw_segment_start_expression): New function
9923         prototype.
9924         * script-sections.cc (Script_sections::Script_sections): Initialize
9925         SAW_SEGMENT_START_EXPRESSION_ to false.
9926         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9927         and -Tbbs options to specify section addresses if given in
9928         command line and no SEGMENT_START expression is seen in a script.
9929         * script-sections.h (Script_sections::saw_segment_start_expression,
9930         Script_sections::set_saw_segment_start_expression): New method
9931         definition.
9932         (Script_sections::saw_segment_start_expression_): New data member
9933         declaration.
9934         * script.cc (script_saw_segment_start_expression): New function.
9935         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9936         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9937         script_test_7.sh and script_test_8.sh.
9938         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9939         script_test_8.stdout.
9940         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9941         (script_test_6, script_test_6.stdout, script_test_7,
9942         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9943         * Makefile.in: Regenerate.
9944         * testsuite/script_test_6.sh: New file.
9945         * testsuite/script_test_6.t: Same.
9946         * testsuite/script_test_7.sh: Same.
9947         * testsuite/script_test_7.t: Same.
9948         * testsuite/script_test_8.sh: Same.
9949
9950 2009-10-16  Doug Kwan  <dougkwan@google.com>
9951
9952         * output.cc (Output_segment::set_section_list_address): Cast
9953         expressions to unsigned long long type to avoid format warnings.
9954
9955 2009-10-15  Ian Lance Taylor  <iant@google.com>
9956
9957         * script.cc (Script_options::add_symbol_assignment): Always add a
9958         dot assignment to script_sections_.
9959         * script-sections.cc (Script_sections::add_dot_assignment):
9960         Initialize if necessary.
9961
9962         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9963         program headers with no load segment if there is a linker script.
9964
9965         * layout.cc (Layout::set_segment_offsets): Align the file offset
9966         to the segment aligment for -N or -n with no load segment.
9967         * output.cc (Output_segment::add_output_section): Don't crash if
9968         the first section is a TLS section.
9969         (Output_segment::set_section_list_addresses): Print an error
9970         message if the address moves backward in a linker script.
9971         * script-sections.cc
9972         (Output_section_element_input::set_section_addresses): Don't
9973         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9974         (Orphan_output_section::set_section_addresses): Likewise.
9975
9976 2009-10-15  Doug Kwan  <dougkwan@google.com>
9977
9978         * layout.cc (Layout::finish_dynamic_section): Generate tags
9979         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9980         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9981         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9982
9983 2009-10-14  Ian Lance Taylor  <iant@google.com>
9984
9985         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9986         fields.
9987         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9988         data_shdr fields of relinfo.
9989         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9990         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9991         R_386_TLS_LDO_32, adjust based on section flags.
9992         (Target_i386::Relocate::fix_up_ldo): Remove.
9993
9994 2009-10-13  Ian Lance Taylor  <iant@google.com>
9995
9996         Add support for -pie.
9997         * options.h (class General_options): Add -pie and
9998         --pic-executable.
9999         (General_options::output_is_position_independent): Test -pie.
10000         (General_options::output_is_executable): Return true if not shared
10001         and not relocatable.
10002         (General_options::output_is_pie): Remove.
10003         * options.cc (General_options::finalize): Reject incompatible uses
10004         of -pie.
10005         * gold.cc (queue_middle_tasks): A -pie link is not static.
10006         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10007         * symtab.cc (Symbol::final_value_is_known): Return false if
10008         output_is_position_independent.
10009         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10010         output_is_position_independent.
10011         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10012         output_is_position_independent.
10013         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10014         output_is_position_independent.
10015         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10016         two_file_pie_test.
10017         (basic_pie_test.o, basic_pie_test): New targets.
10018         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10019         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10020         (two_file_pie_test): New target.
10021         * testsuite/Makefile.in: Rebuild.
10022         * README: Remove note saying that -pie is not supported.
10023
10024 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10025
10026         * options.h (class General_options): Add -init and -fini.
10027         * layout.cc (Layout::finish_dynamic_section): Emit
10028         given init and fini functions.
10029
10030 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10031
10032         * gc.h (gc_process_relocs): Check if icf is enabled using new
10033         function.
10034         * gold.cc (queue_initial_tasks): Likewise.
10035         (queue_middle_tasks): Likewise.
10036         * object.cc (do_layout): Likewise.
10037         * symtab.cc (is_section_folded): Likewise.
10038         * main.cc (main): Likewise.
10039         * reloc.cc (Read_relocs::run): Likewise.
10040         (Sized_relobj::do_scan_relocs): Likewise.
10041         * icf.cc (is_function_ctor_or_dtor): New function.
10042         (Icf::find_identical_sections): Check if function is ctor or dtor when
10043         safe icf is chosen.
10044         * options.h (General_options::icf): Change option to be an enum.
10045         (Icf_status): New enum.
10046         (icf_enabled): New method.
10047         (icf_safe_folding): New method.
10048         (set_icf_status): New method.
10049         (icf_status_): New variable.
10050         * (options.cc) (General_options::finalize): Set icf_status_.
10051         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10052         icf_test and icf_keep_unique_test to use the --icf enum flag.
10053         * testsuite/icf_safe_test.sh: New file.
10054         * testsuite/icf_safe_test.cc: New file.
10055
10056 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10057
10058         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10059         includes to gc.h and icf.h.
10060         * arm.cc: Include gc.h.
10061         * gold.cc: Likewise.
10062         * i386.cc: Likewise.
10063         * powerpc.cc: Likewise.
10064         * sparc.cc: Likewise.
10065         * x86_64.cc: Likewise.
10066         * gc.h: Include icf.h.
10067
10068 2009-10-11  Ian Lance Taylor  <iant@google.com>
10069
10070         * plugin.cc: Include "gold.h" before other header files.
10071
10072 2009-10-10  Chris Demetriou  <cgd@google.com>
10073
10074         * options.h (Input_file_argument::Input_file_type): New enum.
10075         (Input_file_argument::is_lib_): Replace with...
10076         (Input_file_argument::type_): New member.
10077         (Input_file_argument::Input_file_argument): Take Input_file_type
10078         'type' rather than boolean 'is_lib' as second argument.
10079         (Input_file_argument::is_lib): Use type_.
10080         (Input_file_argument::is_searched_file): New function.
10081         (Input_file_argument::may_need_search): Handle is_searched_file.
10082         * options.cc (General_options::parse_library): Support -l:filename.
10083         (General_options::parse_just_symbols): Update for Input_file_argument
10084         changes.
10085         (Command_line::process): Likewise.
10086         * archive.cc (Archive::get_file_and_offset): Likewise.
10087         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10088         * script.cc (read_script_file, script_add_file): Likewise.
10089         * fileread.cc (Input_file::Input_file): Likewise.
10090         (Input_file::will_search_for): Handle is_searched_file.
10091         (Input_file::open): Likewise.
10092         * readsyms.cc (Read_symbols::get_name): Likewise.
10093         * testsuite/Makefile.am (searched_file_test): New test.
10094         * testsuite/Makefile.in: Regenerate.
10095         * testsuite/searched_file_test.cc: New file.
10096         * testsuite/searched_file_test_lib.cc: New file.
10097
10098 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10099             Ian Lance Taylor  <iant@google.com>
10100
10101         * descriptor.cc: Include <cstdio> and "binary-io.h".
10102         (Descriptors::open): Open the files in binary mode always.
10103         * script.cc (Lex::get_token): Treat \r as whitespace.
10104
10105 2009-10-09  Ian Lance Taylor  <iant@google.com>
10106
10107         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10108
10109 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10110             Ian Lance Taylor  <iant@google.com>
10111
10112         * configure.ac: Check for readv function also.
10113         * fileread.cc (readv): Define if not HAVE_READV.
10114         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10115         does not exist.
10116         * config.in: Regenerate.
10117         * configure: Regenerate.
10118
10119 2009-10-09  Doug Kwan  <dougkwan@google.com>
10120
10121         * layout.cc (Layout::make_output_section): Call target hook to make
10122         ordinary output section.
10123         (Layout::finalize): Adjust parameter list of call the
10124         Target::may_relax().
10125         * layout.h (class Layout::section_list): New method.
10126         * merge.h (Output_merge_base::entsize): Change visibility to public.
10127         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10128         New methods.
10129         (Output_merge_string::do_is_string): New method.
10130         * object.cc (Sized_relobj::do_setup): renamed from
10131         Sized_relobj::set_up.
10132         * object.h (Sized_relobj::adjust_shndx,
10133         Sized_relobj::initializ_input_to_output_maps,
10134         Sized_relobj::free_input_to_output_maps): Change visibilities to
10135         protected.
10136         (Sized_relobj::setup): Virtualize.
10137         (Sized_relobj::do_setup): New method declaration.
10138         (Sized_relobj::invalidate_section_offset,
10139         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10140         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10141         * options.cc (parse_int): New function.
10142         * options.h (parse_int): New declaration.
10143         (DEFINE_int): New macro.
10144         (stub_group_size): New option.
10145         * output.cc (Output_section::Output_section): Initialize memebers
10146         merge_section_map_, merge_section_by_properties_map_,
10147         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10148         (Output_section::add_input_section): Handled deferred code-fill
10149         generation and remove an old comment.
10150         (Output_section::add_relaxed_input_section): New method definition.
10151         (Output_section::add_merge_input_section): Use merge section by
10152         properties map to speed to search.  Update merge section maps
10153         as appropriate.
10154         (Output_section::build_relaxation_map): New method definition.
10155         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10156         Same.
10157         (Output_section::relax_input_section): Renamed to
10158         Output_section::convert_input_sections_to_relaxed_sections and change
10159         interface to take a vector of pointers to relaxed sections.
10160         (Output_section::find_merge_section,
10161         Output_section::find_relaxed_input_section): New method definitions.
10162         (Output_section::is_input_address_mapped,
10163         Output_section::output_offset, Output_section::output_address):
10164         Use output section data maps to speed up searching.
10165         (Output_section::find_starting_output_address): Add comments.
10166         (Output_section::do_write,
10167         Output_section::write_to_postprocessing_buffer): Do code-fill
10168         generation as appropriate.
10169         (Output_section::get_input_sections): Invalidate relaxed input section
10170         map.
10171         (Output_section::restore_states): Adjust type of checkpoint .
10172         Invalidate relaxed input section map.
10173         * output.h (Output_merge_base): New class declaration.
10174         (Input_section_specifier): New class defintion.
10175         (class Output_relaxed_input_section) Change base class to
10176         Output_section_data_build.
10177         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10178         base class initializer.
10179         (Output_section::add_relaxed_input_section): New method declaration.
10180         (Output_section::Input_section): Change visibility to protected.
10181         (Output_section::Input_section::relobj,
10182         Output_section::Input_section::shndx): Handle relaxed input sections.
10183         Output_section::input_sections) Change visibility to protected.  Also
10184         define overload to return a non-const pointer.
10185         (Output_section::Merge_section_properties): New class defintion.
10186         (Output_section::Merge_section_by_properties_map,
10187         Output_section::Output_section_data_by_input_section_map,
10188         Output_section::Relaxation_map): New types.
10189         (Output_section::relax_input_section): Rename method to
10190         Output_section::convert_input_sections_to_relaxed_sections and change
10191         interface to take a vector of relaxed section pointers.
10192         (Output_section::find_merge_section,
10193         Output_section::find_relaxed_input_section,
10194         Output_section::build_relaxation_map,
10195         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10196         New method declarations.
10197         (Output_section::merge_section_map_
10198         Output_section::merge_section_by_properties_map_,
10199         Output_section::relaxed_input_section_map_,
10200         Output_section::is_relaxed_input_section_map_valid_,
10201         Output_section::generate_code_fills_at_write_): New data members.
10202         * script-sections.cc
10203         (Output_section_element_input::set_section_addresses): Call
10204         current_data_size and addralign methods of relaxed input sections.
10205         (Orphan_output_section::set_section_addresses): Call current_data_size
10206         and addralign methods of relaxed input sections.
10207         * symtab.cc (Symbol_table::compute_final_value): Extract template
10208         from the body of Symbol_table::sized_finalize_symbol.
10209         (Symbol_table::sized_finalized_symbol): Call
10210         Symbol_table::compute_final_value.
10211         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10212         (Symbol_table::compute_final_value): New templated method declaration.
10213         * target.cc (Target::do_make_output_section): New method defintion.
10214         * target.h (Target::make_output_section): New method declaration.
10215         (Target::relax): Add more parameters for input objects, symbol table
10216         and layout.  Adjust call to do_relax.
10217         (Target::do_make_output_section): New method declaration.
10218         (Target::do_relax): Add parameters for input objects, symbol table
10219         and layout.
10220
10221 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10222
10223         * pread.c: Include stdio.h.
10224
10225 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10226
10227         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10228         defined.
10229
10230 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10231
10232         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10233         Change read_shndx type to unsigned int.
10234         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10235         int.
10236         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10237         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10238         Change read_shndx type to unsigned int.
10239         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10240         int.
10241         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10242         * layout.cc (Layout::create_symtab_sections): Cast the result of
10243         local_symcount * symsize to off_t in the gold_assert.
10244
10245 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10246
10247         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10248         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10249         R_ARM_BASE_ABS.
10250         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10251         (Arm_relocate_functions::thm_abs5): New function.
10252         (Arm_relocate_functions::abs12): New function.
10253         (Arm_relocate_functions::abs16): New function.
10254         (Arm_relocate_functions::base_abs): New function.
10255         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10256         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10257         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10258         R_ARM_BASE_ABS.
10259         (Scan::global): Likewise.
10260         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10261         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10262         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10263         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10264         R_ARM_BASE_ABS.
10265
10266 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10267
10268         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10269         (Arm_relocate_functions::movt_prel): New function.
10270         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10271         (Arm_relocate_functions::thm_movt_prel): New function.
10272         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10273         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10274         (Scan::global, Relocate::relocate): Likewise.
10275         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10276
10277 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10278
10279         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10280         Incremental_checker.
10281         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10282         unsigned int.
10283         (class Incremental_inputs_header): New class.
10284         (Incremental_inputs_header_writer): Edit comment.
10285         (Incremental_inputs_entry): New class.
10286         (Incremental_inputs_entry_writer): Edit comment.
10287         (Sized_incremental_binary::do_find_incremental_inputs_section):
10288         Add *strtab_shndx parameter, fill it.
10289         (Sized_incremental_binary::do_check_inputs): New method.
10290         (Incremental_checker::can_incrementally_link_output_file): Use
10291         Sized_incremental_binary::check_inputs.
10292         (Incremental_inputs::report_command_line): Save command line in
10293         command_line_.
10294         * incremental.h:
10295         (Incremental_binary::find_incremental_inputs_section): New
10296         method.
10297         (Incremental_binary::do_find_incremental_inputs_section): Add
10298         strtab_shndx parameter.
10299         (Incremental_binary::do_check_inputs): New pure virtual method.
10300         (Sized_incremental_binary::do_check_inputs): Declare.
10301         (Incremental_checker::Incremental_checker): Add incremental_inputs
10302         parameter, use it to initialize incremental_inputs_.
10303         (Incremental_checker::incremental_inputs_): New field.
10304         (Incremental_checker::command_line): New method.
10305         (Incremental_checker::inputs): New method.
10306         (Incremental_checker::command_line_): New field.
10307
10308 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10309
10310         * incremental.cc: Include <cstdarg> and "target-select.h".
10311         (vexplain_no_incremental): New function.
10312         (explain_no_incremental): New function.
10313         (Incremental_binary::error): New method.
10314         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10315         method.
10316         (make_sized_incremental_binary): New function.
10317         (open_incremental_binary): New function.
10318         (can_incrementally_link_file): Add checks if output is ELF and has
10319         inputs section.
10320         * incremental.h: Include "elfcpp_file.h" and "output.h".
10321         (Incremental_binary): New class.
10322         (Sized_incremental_binary): New class.
10323         (open_incremental_binary): Declare.
10324         * object.cc (is_elf_object): Use
10325         elfcpp::Elf_recognizer::is_elf_file.
10326         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10327         * output.h (Output_file::filesize): New method.
10328
10329 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10330
10331         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10332         New function.
10333         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10334         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10335         function.
10336         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10337         function.
10338         (Arm_relocate_functions::movw_abs_nc): New function.
10339         (Arm_relocate_functions::movt_abs): New function.
10340         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10341         (Arm_relocate_functions::thm_movt_abs): New function.
10342         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10343         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10344         (Scan::global): Likewise.
10345         (Relocate::relocate): Likewise.
10346         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10347
10348 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10349
10350         * arm.cc (Arm_relocate_functions::got_prel) New function.
10351         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10352         (Relocate::relocate): Likewise.
10353         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10354
10355 2009-10-06  Ian Lance Taylor  <iant@google.com>
10356
10357         * options.h (class General_options): Define
10358         split_stack_adjust_size parameter.
10359         * object.h (class Object): Add uses_split_stack_ and
10360         has_no_split_stack_ fields.  Add uses_split_stack and
10361         has_no_split_stack accessor functions.  Declare
10362         handle_split_stack_section.
10363         (class Reloc_symbol_changes): Define.
10364         (class Sized_relobj): Define Function_offsets.  Declare
10365         split_stack_adjust, split_stack_adjust_reltype, and
10366         find_functions.
10367         * object.cc (Object::handle_split_stack_section): New function.
10368         (Sized_relobj::do_layout): Call handle_split_stack_section.
10369         * dynobj.cc (Sized_dynobj::do_layout): Call
10370         handle_split_stack_section.
10371         * reloc.cc (Sized_relobj::relocate_sections): Call
10372         split_stack_adjust for executable sections in split_stack
10373         objects.  Pass reloc_map to relocate_section.
10374         (Sized_relobj::split_stack_adjust): New function.
10375         (Sized_relobj::split_stack_adjust_reltype): New function.
10376         (Sized_relobj::find_functions): New function.
10377         * target-reloc.h: Include "object.h".
10378         (relocate_section): Add reloc_symbol_changes parameter.  Change
10379         all callers.
10380         * target.h (class Target): Add calls_non_split method.  Declare
10381         do_calls_non_split virtual method.  Declare match_view and
10382         set_view_to_nop.
10383         * target.cc: Include "elfcpp.h".
10384         (Target::do_calls_non_split): New function.
10385         (Target::match_view): New function.
10386         (Target::set_view_to_nop): New function.
10387         * gold.cc (queue_middle_tasks): Give an error if mixing
10388         split-stack and non-split-stack objects with -r.
10389         * i386.cc (Target_i386::relocate_section): Add
10390         reloc_symbol_changes parameter.
10391         (Target_i386::do_calls_non_split): New function.
10392         * x86_64.cc (Target_x86_64::relocate_section): Add
10393         reloc_symbol_changes parameter.
10394         (Target_x86_64::do_calls_non_split): New function.
10395         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10396         parameter.
10397         * powerpc.cc (Target_powerpc::relocate_section): Add
10398         reloc_symbol_changes parameter.
10399         * sparc.cc (Target_sparc::relocate_section): Add
10400         reloc_symbol_changes parameter.
10401         * configure.ac: Call AM_CONDITIONAL for the default target.
10402         * configure: Rebuild.
10403         * testsuite/Makefile.am (TEST_AS): New variable.
10404         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10405         (check_DATA): Add split_i386 and split_x86_64 files.
10406         (SPLIT_DEFSYMS): Define.
10407         (split_i386_[1234n].o): New targets.
10408         (split_i386_[124]): New targets.
10409         (split_i386_[1234r].stdout): New targets.
10410         (split_x86_64_[1234n].o): New targets.
10411         (split_x86_64_[124]): New targets.
10412         (split_x86_64_[1234r].stdout): New targets.
10413         (MOSTLYCLEANFILES): Add new executables.
10414         * testsuite/split_i386.sh: New file.
10415         * testsuite/split_x86_64.sh: New file.
10416         * testsuite/split_i386_1.s: New file.
10417         * testsuite/split_i386_2.s: New file.
10418         * testsuite/split_i386_3.s: New file.
10419         * testsuite/split_i386_4.s: New file.
10420         * testsuite/split_i386_n.s: New file.
10421         * testsuite/split_x86_64_1.s: New file.
10422         * testsuite/split_x86_64_2.s: New file.
10423         * testsuite/split_x86_64_3.s: New file.
10424         * testsuite/split_x86_64_4.s: New file.
10425         * testsuite/split_x86_64_n.s: New file.
10426         * testsuite/testfile.cc (Target_test): Update relocation_section
10427         function.
10428         * testsuite/Makefile.in: Rebuild.
10429
10430 2009-10-06  Ian Lance Taylor  <iant@google.com>
10431
10432         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10433         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10434         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10435         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10436         the address on ldo_addrs_.
10437         (Target_i386::Relocate::fix_up_ldo): New function.
10438
10439 2009-10-06   Rafael Espindola  <espindola@google.com>
10440
10441         * plugin.cc (add_input_library): New.
10442         (Plugin::load): Add add_input_library to tv.
10443         (Plugin_manager::add_input_file): Add the is_lib argument.
10444         (add_input_file): Update call to Plugin_manager::add_input_file.
10445         (add_input_library): New.
10446         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10447
10448 2009-09-30  Doug Kwan  <dougkwan@google.com>
10449
10450         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10451         symbol and call Symbol::may_need_copy_reloc to determine if
10452         a copy reloc is needed.
10453         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10454         nocopyreloc is given in command line.
10455         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10456         given in command line.
10457         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10458         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10459         of the removed Target_i386::may_need_copy_reloc.
10460         * options.h (copyreloc): New option with default value false.
10461         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10462         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10463         instead of the removed Target_powerpc::may_need_copy_reloc.
10464         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10465         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10466         instead of the removed Target_sparc::may_need_copy_reloc.
10467         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10468         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10469         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10470         instead of the removed Target_x86_64::may_need_copy_reloc.
10471
10472 2009-09-30  Ian Lance Taylor  <iant@google.com>
10473
10474         * object.h (class Object): Remove target_ field, and target,
10475         sized_target, and set_target methods.
10476         (Object::sized_target): Remove.
10477         (class Sized_relobj): Update declarations.  Remove sized_target.
10478         * object.cc (Sized_relobj::setup): Remove target parameter.
10479         Change all callers.
10480         (Input_objects::add_object): Don't do anything with the target.
10481         (make_elf_sized_object): Add punconfigured parameter.  Change all
10482         callers.  Set or test parameter target.
10483         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10484         Change all callers.
10485         * parameters.cc (Parameters::set_target): Change parameter type to
10486         be non-const.
10487         (Parameters::default_target): Remove.
10488         (set_parameters_target): Change parameter type to be non-const.
10489         (parameters_force_valid_target): New function.
10490         (parameters_clear_target): New function.
10491         * parameters.h (class Parameters): Update declarations.  Remove
10492         default_target method.  Add sized_target and clear_target
10493         methods.  Change target_ to be non-const.
10494         (set_parameters_target): Update declaration.
10495         (parameters_force_valid_target): Declare.
10496         (parameters_clear_target): Declare.
10497         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10498         as NULL if we aren't searching.
10499         (Add_symbols::run): Don't check for compatible target.
10500         * fileread.cc (Input_file::open_binary): Call
10501         parameters_force_valid_target.
10502         * gold.cc (queue_middle_tasks): Likewise.
10503         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10504         set_target on object.
10505         * dynobj.h (class Sized_dynobj): Update declarations.
10506         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10507         make_elf_object returns NULL.
10508         (Archive::include_member): Don't check whether object target is
10509         compatible.
10510         * output.cc (Output_section::add_input_section): Get target from
10511         parameters.
10512         (Output_section::relax_input_section): Likewise.
10513         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10514         parameters.
10515         (Sized_relobj::do_scan_relocs): Likewise.
10516         (Sized_relobj::relocate_sections): Likewise.
10517         * resolve.cc (Symbol_table::resolve): Likewise.
10518         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10519         parameter.  Change all callers.
10520         (Symbol_table::add_from_object): Get target from parameters.
10521         (Symbol_table::add_from_relobj): Don't check object target.
10522         (Symbol_table::add_from_dynobj): Likewise.
10523         (Symbol_table::define_special_symbol): Get target from
10524         parameters.
10525         * symtab.h (class Symbol_table): Update declaration.
10526         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10527         parameter.  Change all callers.  Clear parameter target.
10528         (Binary_test): Test target here.
10529         * testsuite/object_unittest.cc (gold_testsuite): Remove
10530         target_test_pointer parameter.  Change all callers.
10531         (Object_test): Test target here.
10532
10533 2009-09-26  Ian Lance Taylor  <iant@google.com>
10534
10535         * testsuite/initpri1.c: Don't try to use constructor priorities if
10536         compiling with gcc before 4.3.
10537
10538 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10539
10540         * testsuite/retain_symbols_file_test.sh (check_present): Change
10541         output file name to retain_symbols_file_test.stdout.
10542         (check_absent): Likewise.
10543
10544 2009-09-18  Craig Silverstein  <csilvers@google.com>
10545
10546         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10547         * options.cc: Include <cerrno> and <fstream>.
10548         (General_options::finalize): Parse -retain-symbols-file tag.
10549         * options.h: New flag.
10550         (General_options): New method should_retain_symbol, new
10551         variable symbols_to_retain.
10552         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10553         should_retain_symbol map.
10554         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10555         * testsuite/Makefile.in: Regenerate.
10556         * testsuite/retain_symbols_file_test.sh: New file.
10557
10558 2009-09-18  Nick Clifton  <nickc@redhat.com>
10559
10560         * po/es.po: Updated Spanish translation.
10561
10562 2009-09-17  Doug Kwan  <dougkwan@google.com>
10563
10564         * debug.h (DEBUG_RELAXATION): New constant.
10565         (DEBUG_ALL): Add DEBUG_RELAXATION.
10566         (debug_string_to_enum): Add relaxation debug option.
10567         * layout.cc
10568         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10569         Layout::Relaxation_debug_check::read_sections,
10570         Layout::Relaxation_debug_check::read_sections): New method definitions.
10571         (Layout::Layout): Initialize data members
10572         record_output_section_data_from_scrips_,
10573         script_output_section_data_list_ and relaxation_debug_check_.
10574         (Layout::save_segments, Layout::restore_segments,
10575         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10576         Layout::relaxation_loop_body): New method definitions.
10577         (Layout::finalize): Support relaxation.  Move section layout code to
10578         Layout::relaxation_loop_body.
10579         (Layout::set_asection_address_from_script): Move code for orphan
10580         section placement out.
10581         (Layout::place_orphan_sections_in_script): New method definition.
10582         * layout.h (Output_segment_headers, Output_file_header):
10583         New forward class declarations.
10584         (Layout::~Layout): Define.
10585         (Layout::new_output_section_data_from_script): New method definition.
10586         (Layout::place_orphan_sections_in_script): New method declaration.
10587         (Layout::Segment_states): New type declaration.
10588         (Layout::save_segments, Layout::restore_segments,
10589         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10590         Layout::relaxation_loop_body): New method declarations.
10591         (Layout::Output_section_data_list): New type declaration.
10592         (Layout::Relaxation_debug_check): New class definition.
10593         (Layout::record_output_section_data_from_script_,
10594         Layout::script_output_section_data_list_, Layout::segment_states_,
10595         Layout::relaxation_debug_check_): New data members.
10596         * output.cc: (Output_section_headers::do_size): New method definition.
10597         (Output_section_headers::Output_section_headers): Move size
10598         computation to Output_section_headers::do_size.
10599         (Output_segment_headers::do_size): New method definition.
10600         (Output_file_header::Output_file_header): Move size computation to
10601         Output_file_header::do_size and call it.
10602         (Output_file_header::do_size): New method definition.
10603         (Output_data_group::Output_data_group): Adjust call to
10604         Output_section_data.
10605         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10606         (Output_symtab_xindex::do_write): Add array bound check.
10607         (Output_section::Input_section::print_to_mapfile): Handle
10608         RELAXED_INPUT_SECTION_CODE.
10609         (Output_section::Output_section): Initialize data member checkpoint_.
10610         (Output_section::~Output_section): Delete checkpoint object pointed
10611         by checkpoint_.
10612         (Output_section::add_input_section): Always add an Input_section if
10613         relaxing.
10614         (Output_section::add_merge_input_section): Add assert.
10615         (Output_section::relax_input_section): New method definition.
10616         (Output_section::set_final_data_size): Set load address to zero for
10617         an unallocated section.
10618         (Output_section::do_address_and_file_offset_have_reset_values):
10619         New method definition.
10620         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10621         Handle relaxed input section.
10622         (Output_section::sort_attached_input_sections): Checkpoint input
10623         section list lazily.
10624         (Output_section::get_input_sections): Change type of input_sections to
10625         list of Simple_input_section pointers.  Checkpoint input section list
10626         lazily.  Also handle relaxed input sections.
10627         (Output_section::add_input_section_for_script): Take a reference to
10628         a Simple_input_section object instead of Relobj pointer and section
10629         index as parameter.  Handle relaxed input sections.
10630         (Output_section::save_states, Output_section::restore_states): New
10631         method definitions.
10632         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10633         (Output_data::is_data_size_fixed): New method definition.
10634         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10635         if it is fixed.
10636         (Output_data::address_and_file_offset_have_reset_values): New method
10637         definition.
10638         (Output_data::do_address_and_file_offset_have_reset_values): New method
10639         definition.
10640         (Output_data::set_data_size): Check that data size is not fixed.
10641         (Output_data::fix_data_size): New method definition.
10642         (Output_data::is_data_size_fixed_): New data member.
10643         (Output_section_headers::set_final_data_size): New method definition.
10644         (Output_section_headers::do_size): New method declaration.
10645         (Output_segment_headers::set_final_data_size): New method definition.
10646         (Output_segment_headers::do_size): New method declaration.
10647         (Output_file_header::set_final_data_size)::New method definition.
10648         (Output_file_header::do_size)::New method declaration.
10649         (Output_section_data::Output_section_data): Add new parameter
10650         is_data_size_fixed and use it to fix data size.
10651         (Output_data_const::Output_data_const): Adjust call to base class
10652         constructor and fix data size.
10653         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10654         base class constructor and fix data size.
10655         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10656         base class constructor and fix data size.
10657         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10658         class constructor and fix data size.
10659         (Output_data_group::set_final_data_size): New method definition.
10660         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10661         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10662         class constructor and fix data size.
10663         (Output_relaxed_input_section): New class definition.
10664         (Output_section::Simple_input_section): New class definition.
10665         (Output_section::get_input_sections): Adjust parameter list.
10666         (Output_section::add_input_section_for_script): Same.
10667         (Output_section::save_states, Output_section::restore_states,
10668         Output_section::do_address_and_file_offset_have_reset_values,
10669         (Output_section::Input_section::Input_section): Handle
10670         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10671         Output_relaxed_input_section.
10672         (Output_section::Input_section::is_input_section,
10673         Output_section::Input_section::set_output_section): Handle relaxed
10674         input section.
10675         (Output_section::Input_section::is_relaxed_input_section,
10676         Output_section::Input_section::output_section_data,
10677         Output_section::Input_section::relaxed_input_section): New method
10678         definitions.
10679         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10680         value.
10681         (Output_section::Input_section::u1_): Update comments.
10682         (Output_section::Input_section::u2_): Add new union member poris.
10683         (Output_section::Checkpoint_output_section): New classs definition.
10684         (Output_section::relax_input_section): New method declaration.
10685         (Output_section::checkpoint_): New data member.
10686         (Output_segment): Update comments.
10687         (Output_segment::Output_segment): Un-privatize copy constructor.
10688         (Output_segment::operator=): Un-privatize.
10689         * script-sections.cc (Output_section_element::Input_section_list):
10690         Change element type to Output_section::Simple_input_section.
10691         (Output_section_element_dot_assignment::set_section_addresses):
10692         Register output section data for relaxation clean up.
10693         (Output_data_exression::Output_data_expression): Adjust call to base
10694         constructor to fix data size.
10695         (Output_section_element_data::set_section_addresses): Register
10696         Output_data_expression object for relaxation clean up.
10697         (struct Input_section_info): Replace Relobj pointer and section index
10698         pair with Output_section::Simple_input_section and Convert struct to a
10699         class.
10700         (Input_section_sorter::operator()): Adjust access to
10701         Input_section_info data member to use accessors.
10702         (Output_section_element_input::set_section_addresses): Use layout
10703         parameter.  Adjust code to use Output_section::Simple_input_section
10704         and Input_secction_info classes.  Register filler for relaxation
10705         clean up.
10706         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10707         and section index pair with Output_section::Simple_input_section
10708         class.  Adjust code accordingly.
10709         (Phdrs_element::release_segment): New method definition.
10710         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10711         segment list.
10712         (Script_sections::release_segments): New method definition.
10713         * gold/script-sections.h (Script_sections::release_segments): New
10714         method declaration.
10715         * gold/target.h (Target::may_relax, Target::relax,
10716         Target::do_may_relax, Target::do_relax): New method definitions.
10717
10718 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10719
10720         * arm.cc (has_signed_unsigned_overflow): New function.
10721         (Arm_relocate_functions::abs8): New function.
10722         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10723         (Target_arm::Scan::global): Likewise.
10724         (Target_arm::relocate::relocate): Likewise.
10725         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10726         Likewise.
10727
10728 2009-09-16  Cary Coutant  <ccoutant@google.com>
10729
10730         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10731         * testsuite/Makefile.in: Regenerate.
10732
10733 2009-09-11  Nick Clifton  <nickc@redhat.com>
10734
10735         * po/gold.pot: Updated by the Translation project.
10736
10737 2009-09-08  Cary Coutant  <ccoutant@google.com>
10738
10739         * output.cc (Output_file::open): Add execute permission to empty file.
10740         * testsuite/Makefile.am (permission_test): New test.
10741         * testsuite/Makefile.in: Regenerate.
10742
10743 2009-09-02  Ian Lance Taylor  <iant@google.com>
10744
10745         * output.cc (Output_file::resize): Call map_no_anonymous rather
10746         than map.
10747
10748 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10749
10750         * gold.cc: Include "incremental.h".
10751         (queue_initial_tasks): Call Incremental_checker methods.
10752         * incremental.cc: Include "output.h".
10753         (Incremental_checker::can_incrementally_link_output_file): New
10754         method.
10755         * incremental.h (Incremental_checker): New class.
10756
10757         * output.cc (Output_file::open_for_modification): New method.
10758         (Output_file::map_anonymous): Changed return type to bool.  Record
10759         map in base_ field.
10760         (Output_file::map_no_anonymous): New method, broken out of map.
10761         (Output_file::map): Use map_no_anonymous and map_anonymous.
10762         * output.h (class Output_file): Update declarations.
10763
10764 2009-08-24  Cary Coutant  <ccoutant@google.com>
10765
10766         * options.h (Command_line::Pre_options): New class.
10767         (Command_line::pre_options): New member.
10768         * options.cc (gold::options::ready_to_register): New variable.
10769         (One_option::register_option): Do nothing if not registering options.
10770         Assert if same short option registered twice.
10771         (General_options::General_options): Turn off option registration when
10772         done constructing.
10773         (Command_line::Pre_options::Pre_options): New constructor.
10774
10775 2009-08-24  Cary Coutant  <ccoutant@google.com>
10776
10777         * options.h (General_options::no_keep_memory): Remove incorrect
10778         short option.
10779
10780 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10781
10782         * Makefile.am (am__skiplex, am__skipyacc): New.
10783         * Makefile.in: Regenerate.
10784
10785 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10786
10787         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10788         (INCLUDES): ... this.
10789         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10790         (AM_CPPFLAGS): Renamed from ...
10791         (INCLUDE): ... this.
10792         * Makefile.in, testsuite/Makefile.in: Regenerate.
10793
10794         * Makefile.in: Regenerate.
10795         * aclocal.m4: Likewise.
10796         * config.in: Likewise.
10797         * configure: Likewise.
10798         * testsuite/Makefile.in: Likewise.
10799
10800         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10801         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10802         * Makefile.in: Regenerate.
10803         * testsuite/Makefile.in: Regenerate.
10804
10805 2009-08-19  Cary Coutant  <ccoutant@google.com>
10806
10807         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10808         symbols in shared libraries overridden by hidden or internal symbols
10809         in the main program.
10810
10811 2009-08-19  Chris Demetriou  <cgd@google.com>
10812
10813         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10814         checking source file names in error messages.
10815
10816 2009-08-18  Doug Kwan  <dougkwan@google.com>
10817
10818         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10819         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10820         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10821         an elfcpp::Ehdr as parameter.
10822         * object.cc (Object::set_target): Remove the version that looks up
10823         a target and sets it.
10824         (Sized_relobj::setup): Take a Target object instead of
10825         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10826         (make_elf_sized_object): Find target and ask target to
10827         make an ELF object.
10828         * object.h: (Object::set_target): Remove the version that looks up
10829         a target and sets it.
10830         (Sized_relobj::setup): Take a Target object instead of
10831         an elfcpp:Ehdr as parameter.
10832         * target.cc: Include dynobj.h.
10833         (Target::do_make_elf_object_implementation): New.
10834         (Target::do_make_elf_object): New.
10835         * target.h (Target::make_elf_object): New template declaration.
10836         (Target::do_make_elf_object): New method declarations.
10837         (Target::do_make_elf_object_implementation): New template declaration.
10838
10839 2009-08-14  Ian Lance Taylor  <iant@google.com>
10840
10841         * gold.h (FUNCTION_NAME): Define.
10842         (gold_unreachable): Use FUNCTION_NAME.
10843
10844 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10845
10846         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10847         symbol in the --keep-unique list is not found.
10848
10849 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10850
10851         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10852         been maked as --keep-unique.
10853         (Icf::unfold_section): New function.
10854         * icf.h (Icf::unfold_section): New function.
10855         * options.h (General_options::keep_unique): New option.
10856         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10857         * testsuite/Makefile.in: Regenerate.
10858         * testsuite/icf_keep_unique_test.sh: New file.
10859         * testsuite/icf_keep_unique_test.cc: New file.
10860
10861 2009-08-12  Cary Coutant  <ccoutant@google.com>
10862
10863         PR 10471
10864         * resolve.cc (Symbol_table::resolve): Check for references from
10865         dynamic objects to hidden and internal symbols.
10866         * testsuite/Makefile.am (hidden_test.sh): New test.
10867         * testsuite/Makefile.in: Regenerate.
10868         * testsuite/hidden_test.sh: New script.
10869         * testsuite/hidden_test_1.c: New test source.
10870         * testsuite/hidden_test_main.c: New test source.
10871
10872 2009-08-11  Doug Kwan  <dougkwan@google.com>
10873
10874         * arm.cc: Update comments.
10875         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10876         segment to locate the .ARM.exidx section if present.
10877
10878 2009-08-09  Doug Kwan  <dougkwan@google.com>
10879
10880         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10881         patch.
10882
10883 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10884         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10885         compiler warnings.
10886
10887 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10888
10889         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10890         valid tls_segment only for non-debug-section relocations.
10891         * testsuite/Makefile.am: Add gc_tls_test.
10892         * testsuite/Makefile.in: Regenerate.
10893         * testsuite/gc_tls_test.cc: New file.
10894         * testsuite/gc_tls_test.sh: New file.
10895
10896 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10897
10898         * icf.cc: New file.
10899         * icf.h: New file.
10900         * Makefile.am (CCFILES): Add icf.cc.
10901         (HFILES): Add icf.h
10902         * Makefile.in: Regenerate.
10903         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10904         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10905         section, symbol and addend information for the relocs.
10906         * gold.cc (queue_middle_tasks): Call identical code folding.
10907         * gold.h: Add defines for multimap.
10908         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10909         to the call of finalize_local_symbols.
10910         * main.cc (main): Create object of class Icf.
10911         * object.cc (Sized_relobj::do_layout): Allow this function to be
10912         called twice during icf.
10913         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10914         to sections marked as identical by icf.
10915         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10916         when available.
10917         (Sized_relobj::do_section_entsize): New function.
10918         * object.h (Object::section_entsize): New function.
10919         (Object::do_section_entsize): New pure virtual function.
10920         (Relobj::finalize_local_symbols): Add new parameter.
10921         (Relobj::do_section_entsize): New function.
10922         * options.h (General_options::icf): New option.
10923         (General_options::icf_iterations): New option.
10924         (General_options::print_icf_sections): New option.
10925         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10926         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10927         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10928         icf.
10929         * symtab.cc (Symbol_table::is_section_folded): New function.
10930         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10931         to sections marked as identical by icf.
10932         * symtab.h (Symbol_table::set_icf): New function.
10933         (Symbol_table::icf): New function.
10934         (Symbol_table::is_section_folded): New function.
10935         (Symbol_table::icf_): New data member.
10936         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10937         * testsuite/Makefile.am: Add commands to build icf_test.
10938         * testsuite/Makefile.in: Regenerate.
10939         * testsuite/icf_test.sh: New file.
10940         * testsuite/icf_test.cc: New file.
10941
10942 2009-07-24  Chris Demetriou  <cgd@google.com>
10943
10944         * layout.cc (is_compressible_debug_section): Fix incorrect
10945         comment about compressed section names.
10946
10947 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10948
10949         PR 10419
10950         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10951
10952 2009-07-16  Ian Lance Taylor  <iant@google.com>
10953
10954         PR 10400
10955         * layout.h: #include <map>.
10956         (class Kept_section): Change from struct to class.  Add accessors
10957         and setters.  Add section size to Comdat_group mapping.  Change
10958         Comdat_group to std::map.  Add is_comdat_ field.  Add
10959         linkonce_size field in union.
10960         (class Layout): Update declaration of find_or_add_kept_section.
10961         Don't declare find_kept_object.
10962         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10963         parameter.  Add object, shndx, is_comdat, and is_group_name
10964         parameters.  Change all callers.  Adjust for new Kept_section.
10965         (Layout::find_kept_object): Remove.
10966         * object.cc (Sized_relobj::include_section_group): Update use of
10967         Kept_section.  Rename secnum to shndx.  Only record
10968         Kept_comdat_section if sections are the same size.
10969         (Sized_relobj::include_linkonce_section): Update use of
10970         Kept_section.  Only record Kept_comdat_section if sections are the
10971         same size.  Set size of linkonce section.
10972         (Sized_relobj::map_to_kept_section): Update call to
10973         get_kept_comdat_section.
10974         * object.h (class Sized_relobj): Rename fields in
10975         Kept_comdat_section to drop trailing underscores; change object
10976         field to Relobj*.  Change Kept_comdat_section_table to store
10977         struct rather than pointer.
10978         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10979         Add kept_object and kept_shndx parameters.  Change all callers.
10980         (Sized_relobj::get_kept_comdat_section): Change return type to
10981         bool.  Add kept_object and kept_shndx parameters.  Change all
10982         callers.
10983         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10984         Layout::find_or_add_kept_section.
10985
10986 2009-07-09  Ian Lance Taylor  <iant@google.com>
10987
10988         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10989         Reserve space in the hash table.
10990
10991 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10992
10993         * fileread.cc (File_read::get_mtime): New method.
10994         * fileread.h (Timespec): New structure.
10995         (File_read::get_mtime): New method.
10996         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10997         Renamed from timestamp_nsec.
10998         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10999         Elf_Xword.
11000         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11001         timestamp_nsec.
11002         (Incremental_inputs::report_archive): Save mtime; style fix.
11003         (Incremental_inputs::report_obejct): Save mtime; style fix.
11004         (Incremental_inputs::report_script): Save mtime; style fix.
11005         (Incremental_inputs::finalize_inputs): Style fix.
11006         (Incremental_inputs::finalize): Style fix.
11007         (Incremental_inputs::create_input_section_data): Store inputs
11008         mtime.
11009         * incremental.h (Incremental_inputs::report_script): Add mtime
11010         argument.
11011         (Incremental_inputs::Input_info::Input_info): Intialize only one
11012         union member.
11013         (Incremental_inputs::Input_info::archive): Move to nameless
11014         union.
11015         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11016         (Incremental_inputs::Input_info::script): Move to nameless union.
11017         (Incremental_inputs::mtime): New field.
11018         * script.cc (read_input_script): Pass file mtime to
11019         Incremental_input.
11020         * script.h (Script_info::inputs): Style fix.
11021
11022 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11023
11024         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11025         instead of 32.
11026
11027 2009-06-24  Ian Lance Taylor  <iant@google.com>
11028
11029         PR 10156
11030         * layout.cc (Layout::choose_output_section): If we find an
11031         existing section, update the flags.
11032         (Layout::create_notes): New function, broken out of
11033         Layout::finalize.
11034         (Layout::finalize): Don't create note sections.
11035         (Layout::create_note): Don't crash if linker script discards
11036         section.
11037         (Layout::create_gold_note): Likewise.
11038         (Layout::create_build_id): Likewise.  Don't set
11039         after_input_sections on the section.
11040         (Layout::create_executable_stack_info): Remove target parameter.
11041         Change caller.
11042         * layout.h (class Layout): Declare create_notes.  Update
11043         declaration of create_executable_stack_info.
11044         * gold.cc (queue_middle_tasks): Call create_notes.
11045         * output.cc (Output_section::update_flags_for_input_section): Move
11046         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11047         invalid.
11048         * output.h (Output_data::mark_address_invalid): New function.
11049         (class Output_section): Only declare, not define,
11050         update_flags_for_input_section.  Remove set_flags.
11051
11052 2009-06-24  Ian Lance Taylor  <iant@google.com>
11053
11054         * script-sections.cc (Output_section_definition::
11055         set_section_addresses): Rename shadowing local load_address to
11056         laddr.
11057
11058 2009-06-24  Ian Lance Taylor  <iant@google.com>
11059
11060         PR 10244
11061         * reloc.cc (relocate_sections): Skip empty relocation sections.
11062
11063 2009-06-23  Ian Lance Taylor  <iant@google.com>
11064
11065         PR 10156
11066         * layout.cc (Layout::create_note): Use choose_output_section
11067         rather than make_output_section.
11068
11069 2009-06-23  Ian Lance Taylor  <iant@google.com>
11070
11071         PR 10237
11072         * options.cc (General_options::parse_V): Set printed_version_.
11073         (General_options::General_options): Initialize printed_version_.
11074         * options.h (class General_options): Add printed_version_ field.
11075         * gold.cc (queue_initial_tasks): If there are no input files,
11076         don't give a fatal error if we printed the version information.
11077         (queue_middle_tasks): If using -r with a shared object, give a
11078         fatal error rather than an ordinary error.
11079
11080 2009-06-23  Ian Lance Taylor  <iant@google.com>
11081
11082         PR 10219
11083         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11084         (Layout::make_output_section): Set have_stabstr_section_ if we see
11085         a .stab*str section.
11086         (Layout::finalize): Call link_stabs_sections.
11087         (Layout::link_stabs_sections): New file.
11088         * layout.h (class Layout): Add have_stabstr_section_ field.
11089         Declare link_stabs_sections.
11090
11091 2009-06-23  Doug Kwan  <dougkwan@google.com>
11092
11093         * Makefile.am (libgold_a_LIBADD): New.
11094         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11095         * Makefile.in: Regenerate.
11096         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11097         * configure: Regenerate.
11098         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11099         * fileread.cc: Include sys/state.h
11100         * gold.h: Declare memmem and strndup if found missing.
11101         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11102
11103 2009-06-23  Ian Lance Taylor  <iant@google.com>
11104
11105         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11106         * configure: Rebuild.
11107
11108 2009-06-23  Ian Lance Taylor  <iant@google.com>
11109
11110         PR 10147
11111         * object.cc (Object::section_contents): Don't try to get a view if
11112         the section has length zero.
11113         (Object::handle_gnu_warning_section): If the section is empty, use
11114         the name of the section as the warning.
11115
11116 2009-06-23  Ian Lance Taylor  <iant@google.com>
11117
11118         PR 10133
11119         * stringpool.h (class Stringpool_template): Add optimize_ field.
11120         (Stringpool_template::set_optimize): New function.
11121         * stringpool.cc (Stringpool_template::Stringpool_template):
11122         Initialize optimize_ field.
11123         (Stringpool_template::set_string_offsets): Test local optimize
11124         fild rather than parameter.
11125         * layout.cc (Layout::Layout): Call set_optimize on the section
11126         name stringpool.
11127
11128 2009-06-22  Ian Lance Taylor  <iant@google.com>
11129
11130         PR 10030
11131         * yyscript.y: Parse TARGET.
11132         * script.cc (script_set_target): New function.
11133         * script-c.h (script_set_target): Declare.
11134         * options.cc (General_options::string_to_object_format): Rename
11135         from string_to_object_format in anonymous namespace.  Change
11136         callers.
11137         * options.h (class General_options): Declare
11138         string_to_object_format.
11139
11140 2009-06-22  Ian Lance Taylor  <iant@google.com>
11141
11142         * script-sections.cc (Script_sections::create_segments): Don't put
11143         program headers in a PT_LOAD segment if -n or -N.
11144
11145 2009-06-22  Ian Lance Taylor  <iant@google.com>
11146
11147         PR 10141
11148         * options.h (class General_options): Add -z lazy and -z now.  Sort
11149         -z options into alphabetical order.
11150         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11151
11152 2009-06-21  Ian Lance Taylor  <iant@google.com>
11153
11154         * layout.cc (Layout::make_output_section): Call
11155         Target::new_output_section.
11156         (Layout::attach_allocated_section_to_segment): Put large section
11157         sections in a separate load segment with the large segment flag
11158         set.
11159         (Layout::segment_precedes): Sort large data segments after other
11160         load segments.
11161         (align_file_offset): New static function.
11162         (Layout::set_segment_offsets): Use align_file_offset.
11163         * output.h (class Output_section): Add is_small_section_ and
11164         is_large_section_ fields.
11165         (Output_section::is_small_section): New function.
11166         (Output_section::set_is_small_section):  New function.
11167         (Output_section::is_large_section): New function.
11168         (Output_section::set_is_large_section): New function.
11169         (Output_section::is_large_data_section): New function.
11170         (class Output_segment): Add is_large_data_segment_ field.
11171         (Output_segment::is_large_data_segment): New function.
11172         (Output_segment::set_is_large_data_segment): New function.
11173         * output.cc (Output_section::Output_section): Initialize new
11174         fields.
11175         (Output_segment::Output_segment): Likewise.
11176         (Output_segment::add_output_section): Add assertion that large
11177         data sections always go in large data segments.  Force small data
11178         sections to the end of the list of data sections.  Force small BSS
11179         sections to the start of the list of BSS sections.  For large BSS
11180         sections to the end of the list of BSS sections.
11181         * symtab.h (class Symbol): Declare is_common_shndx.
11182         (Symbol::is_defined): Check Symbol::is_common_shndx.
11183         (Symbol::is_common): Likewise.
11184         (class Symbol_table): Define enum Commons_section_type.  Update
11185         declarations.  Add small_commons_ and large_commons_ fields.
11186         * symtab.cc (Symbol::is_common_shndx): New function.
11187         (Symbol_table::Symbol_table): Initialize new fields.
11188         (Symbol_table::add_from_object): Put small and large common
11189         symbols in the right list.
11190         (Symbol_table::sized_finalized_symbol): Check
11191         Symbol::is_common_shndx.
11192         (Symbol_table::sized_write_globals): Likewise.
11193         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11194         common symbol lists.  Don't call do_allocate_commons_list if the
11195         list is empty.
11196         (Symbol_table::do_allocate_commons_list): Remove is_tls
11197         parameter.  Add comons_section_type parameter.  Change all
11198         callers.  Handle small and large common symbols.
11199         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11200         Symbol::is_common_shndx.
11201         * resolve.cc (symbol_to_bits): Likewise.
11202         * target.h (Target::small_common_shndx): New function.
11203         (Target::small_common_section_flags): New function.
11204         (Target::large_common_shndx): New function.
11205         (Target::large_common_section_flags): New function.
11206         (Target::new_output_section): New function.
11207         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11208         small_common_section_flags, and large_common_section_flags
11209         fields.
11210         (Target::do_new_output_section): New virtual function.
11211         * arm.cc (Target_arm::arm_info): Initialize new fields.
11212         * i386.cc (Target_i386::i386_info): Likewise.
11213         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11214         Likewise.
11215         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11216         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11217         (Target_x86_64::do_new_output_section): New function.
11218         * configure.ac: Define conditional MCMODEL_MEDIUM.
11219         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11220         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11221         (large_LDFLAGS): Define.
11222         * testsuite/large.c: New file.
11223         * testsuite/testfile.cc (Target_test::test_target_info):
11224         Initialize new fields.
11225         * configure, testsuite/Makefile.in: Rebuild.
11226
11227 2009-06-05  Doug Kwan  <dougkwan@google.com>
11228
11229         * Makefile.am (CCFILES): Add target.cc.
11230         * Makefile.in: Regenerate.
11231         * i386.cc (class Target_i386): Define new virtual method to
11232         override do_is_local_label_name in parent.
11233         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11234         local symbols if --discard-locals or -X is given.
11235         * options.h (class General_options): Declare new options
11236         '--discard-locals' and '-X' for discarding locals.
11237         * target.h (class Target): Define new methods is_local_label_name.
11238         Declare new virtual method do_is_local_label_name.
11239         * target.cc: New file.
11240         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11241         (check_SCRIPTS): Add discard_locals_test.sh.
11242         (check_DATA): Add discard_local_tests.syms.
11243         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11244         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11245         * testsuite/Makefile.in: Regenerate.
11246         * testsuite/discard_locals_test.c: New file.
11247         * testsuite/discard_locals_test.sh: Same.
11248
11249 2009-06-05  Doug Kwan  <dougkwan@google.com>
11250
11251         * object.cc (Sized_relobj::Sized_relobj): Initialize
11252         discarded_eh_frame_shndx_ to -1U.
11253         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11254         section.
11255         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11256         a discarded .eh_frame section.
11257         (Sized_relobj::do_finalize_local_symbols): Ditto.
11258         * object.h (class Sized_relobj): Declare new member
11259         discarded_eh_frame_shndx_.
11260         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11261         (local_labels_test.o, local_labels_test): New rules.
11262         * testsuite/Makefile.in: Regenerate.
11263
11264 2009-06-04  Doug Kwan  <dougkwan@google.com>
11265
11266         * layout.cc (Layout::section_name_mapping): Add mapping for
11267         special ARM sections.
11268
11269 2009-06-03  Doug Kwan  <dougkwan@google.com>
11270
11271         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11272         (utils::has_overflow): Same.
11273
11274 2009-06-03  Ian Lance Taylor  <iant@google.com>
11275
11276         * layout.cc (Layout::section_name_mapping): New array, replacing
11277         Layout::linkonce_mapping.
11278         (Layout::section_name_mapping_count): New variable, replacing
11279         Layout::linkonce_mapping_count.
11280         (Layout::linkonce_output_name): Remove.
11281         (Layout::output_section_name): Rewrite.
11282         * layout.h (class Layout): Rename Linkonce_mapping to
11283         Section_name_mapping, linkonce_mapping to section_name_mapping,
11284         linkonce_mapping_count to section_name_mapping_count.  Don't
11285         declare linkonce_output_name.
11286
11287 2009-06-03  Doug Kwan  <dougkwan@google.com>
11288
11289         * gold/arm.cc (namespace utils): New.
11290         (Target_arm::reloc_is_non_pic): Define new method.
11291         (class Arm_relocate_functions): New.
11292         (Target_arm::Relocate::relocate): Handle relocation types used by
11293         Android.
11294
11295 2009-06-03  Ian Lance Taylor  <iant@google.com>
11296
11297         * arm.cc (Target_arm::scan::global): Use || instead of |.
11298
11299 2009-06-02  Doug Kwan  <dougkwan@google.com>
11300
11301         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11302         issued_non_pic_error_.
11303         (class Target_arm::Scan): Declare new method check_non_pic.
11304         Define new method symbol_needs_plt_entry.
11305         Declare new data member issued_non_pic_error_.
11306         (class Target_arm::Relocate): Declare new method
11307         should_apply_static_reloc.
11308         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11309         (Target_arm::Scan::check_non_pic): Define new method.
11310         (Target_arm::Scan::local): Handle a small subset of reloc types used
11311         by Android.
11312         (Target_arm::Scan::local): Same.
11313         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11314
11315 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11316
11317         * incremental.cc (Incremental_inputs::report_command_line): Filter
11318         out --incremental-* options.
11319
11320 2009-05-29  Doug Kwan  <dougkwan@google.com>
11321
11322         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11323         template class.
11324         (class Target_arm): Update comment.
11325         (Target_arm::Target_arm): Initialize new data members GOT_,
11326         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11327         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11328         and Target_arm::rel_dyn_section.
11329         Declare new_enum Target_arm::Got_type.
11330         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11331         and DYNBSS_.
11332         Update commments for member do_dynsym_value.
11333         (Target_arm::got_size, Target_arm::plt_section,
11334         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11335         new methods inside class defintion.
11336         (Target_arm::got_section): Define new method.
11337         (Target_arm::rel_dyn_section): Same.
11338         (Output_data_plt_arm): New template class.
11339         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11340         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11341         (Output_data_plt_arm::add_entry): Same.
11342         (Output_data_plt_arm::first_plt_entry): Define new
11343         static data member for PLT instruction template.
11344         (Output_data_plt_arm::plt_entry): Same.
11345         (Output_data_plt_arm::do_write): Define new method.
11346         (Target_arm::make_plt_entry): Same.
11347         (Target_arm::do_finalize_sections): Same.
11348         (Target_arm::do_dynsym_value): Same.
11349
11350 2009-05-28  Doug Kwan  <dougkwan@google.com>
11351
11352         * Makefile.am (TARGETSOURCES): Add arm.cc.
11353         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11354         * Makefile.in: Regenerate.
11355         * arm.cc: New file.
11356         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11357
11358 2009-05-26  Doug Kwan  <dougkwan@google.com>
11359
11360         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11361         (General_options::check_excluded_libs): Strip off directories in
11362         archive name before matching like GNU ld does.
11363         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11364         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11365         (exclude_libs_test_LDFLAGS): Add linker option
11366         -Wl,--exclude-libs,libexclude_libs_test_3
11367         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11368         an explicit archive without using -l.
11369         (alt/libexclude_libs_test_3.a): New make rule.
11370         * testsuite/Makefile.in: Regenerate.
11371         * testsuite/exclude_libs_test.c : Declare lib3_default().
11372         (main): Call it.
11373         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11374         * exclude_libs_test_3.c: New file.
11375
11376 2009-05-26  Nick Clifton  <nickc@redhat.com>
11377
11378         * po/id.po: New Indonesian translation.
11379         * po/gold.pot: Updated template file.
11380
11381 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11382
11383         * testsuite/Makefile.am: Add -ffunction-sections to compile
11384         gc_comdat_test files.  Add -Wl,--gc-sections to build
11385         gc_comdat_test.
11386         * testsuite/Makefile.in: Regenerate.
11387         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11388
11389 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11390
11391         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11392         kept comdat section was garbage collected.
11393         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11394         * testsuite/Makefile.in: Regenerate.
11395         * testsuite/gc_comdat_test.sh: New file.
11396         * testsuite/gc_comdat_test_1.cc: New file.
11397         * testsuite/gc_comdat_test_2.cc: New file.
11398
11399 2009-05-19  Doug Kwan  <dougkwan@google.com>
11400
11401         * archive.cc (Archive::Archive): Move constructor from archive.h
11402         to here.  Initialize no_export_.
11403         (Archive::get_elf_object_for_member): Set no_export flag of object.
11404         * archive.h (Archive::Archive): Move constructor body to
11405         archive.cc.
11406         (Archive::no_export): New method.
11407         (Archive::no_export_): New field.
11408         * object.h (Object::Object): Initialize no_export_ to false.
11409         (Object::no_export, Object::set_no_export): New methods.
11410         (Object::no_export_): New field.
11411         * options.cc (General_options::parse_exclude_libs): New method.
11412         (General_options::check_excluded_libs) Same.
11413         * options.h (exclude_libs): New option.
11414         (General_options::check_excluded_libs): New method declaration.
11415         (General_options::excluded_libs_): New field.
11416         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11417         default or protected visibility if an object has no-export flag set.
11418         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11419         (check_SCRIPTS): Add exclude_libs_test.sh.
11420         (check_DATA): Add exclude_libs_test.syms.
11421         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11422         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11423         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11424         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11425         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11426         libexclude_libs_test_2.a): New rules.
11427         * testsuite/Makefile.in: Regenerate.
11428         * testsuite/exclude_libs_test.c: New file.
11429         * testsuite/exclude_libs_test.sh: Ditto.
11430         * testsuite/exclude_libs_test_1.c: Ditto.
11431         * testsuite/exclude_libs_test_2.c: Ditto.
11432
11433 2009-05-15  Ian Lance Taylor  <iant@google.com>
11434
11435         * configure.ac: Check for declarations for cases where libiberty.h
11436         checks HAVE_DECL_xxx.
11437         * configure, config.in: Rebuild.
11438
11439 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11440
11441         * gold.h (Incremental_argument_list): Remove (invalid) forward
11442         declaration.
11443         * incremental.cc (Incremental_inputs::report_achive): New method.
11444         (Incremental_inputs::report_object): New method.
11445         (Incremental_inputs::report_script): New method.
11446         (Incremental_inputs::finalize_inputs): New method.
11447         (Incremental_inputs::finalize): Call finalize_inputs().
11448         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11449         Create inputs entries.
11450         * incremental.h (Incremental_input_type): New enum.
11451         (Incremental_inputs::Incremental_input): Initialize new fields.
11452         (Incremental_inputs::report_inputs): New method.
11453         (Incremental_inputs::report_achive): New method.
11454         (Incremental_inputs::report_object): New method.
11455         (Incremental_inputs::report_script): New method.
11456         (Incremental_inputs::finalize_inputs): New method.
11457         (Incremental_inputs::Input_info): New struct.
11458         (Incremental_inputs::Input_info_map): New typedef.
11459         (Incremental_inputs::lock_): New field.
11460         (Incremental_inputs::Inputs_): New field.
11461         (Incremental_inputs::Inputs_map): New field.
11462         * main.cc (main): Call Incremental_input::report_inputs.
11463         * options.h (Input_argument_list): Typedef moved from
11464         Input_arguments.
11465         (Input_file_group::Files): Remove, use ::Input_argument_list.
11466         (Input_file_group::Input_argument_list): Remove, use
11467         ::Input_argument_list.
11468         * plugin.cc (Plugin_manager::add_input_file): Add error in
11469         incremental build.
11470         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11471         functions.
11472         * script.cc (read_input_script): Call
11473         Incremental_input::report_script.
11474         * script.h (Script_info): New class.
11475
11476 2009-04-27  Ian Lance Taylor  <iant@google.com>
11477
11478         * x86_64.cc (do_adjust_output_section): Set entsize to
11479         plt_entry_size.
11480
11481 2009-04-23  Elliott Hughes  <enh@google.com>
11482
11483         * output.cc (Output_file::close): After short writes, continue
11484         writing from the correct offset in the buffer being written.
11485
11486 2009-04-23  Chris Demetriou  <cgd@google.com>
11487
11488         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11489         * configure: Regenerate.
11490         * config.in: Regenerate.
11491         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11492         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11493
11494 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11495
11496         * incremental.cc (Incremental_inputs_header_data): Renamed from
11497         Incremental_input_header_data.
11498         (Incremental_inputs_header_data::data_size): New field.
11499         (Incremental_inputs_header_data::put_input_file_count): Renamed
11500         from input_file_count.
11501         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11502         from command_line_offset.
11503         (Incremental_inputs_header_data::put_reserved): Renamed from
11504         put_reserved.
11505         (Incremental_inputs_entry_data): Renamed from
11506         Incremental_input_entry_data.
11507         (Incremental_inputs_entry_data::data_size): New field.
11508         (Incremental_inputs::report_command_line): New method.
11509         (Incremental_inputs::finalize): New method.
11510         (Incremental_inputs::create_incremental_inputs_data): New method.
11511         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11512         * incremental.h: New file.
11513         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11514         (Layout::finalize): Create incremental inputs section in
11515         incremental builds.
11516         (Layout::create_incremental_info_sections): New method.
11517         * layout.h (Layout::incremental_inputs): New method.
11518         (Layout::create_incremental_info_sections): New method.
11519         (Layout::incremental_inputs_): New field.
11520         * main.cc (main): Notify Incremental_input of the command line.
11521
11522 2009-04-01  Ian Lance Taylor  <iant@google.com>
11523             Mikolaj Zalewski  <mikolajz@google.com>
11524
11525         * gold.h (reserve_unordered_map): Define, three versions, one for
11526         each version of Unordered_map.
11527         * layout.cc (Layout::Layout): Remove options parameter.  Add
11528         number_of_input_files parameter.  Don't initialize options_.
11529         Initialize number_of_input_files_ and resized_signatures_.  Move
11530         sections_are_attached_.
11531         (Layout::layout_group): Reserve space for group_signatures_.
11532         (Layout::find_or_add_kept_section): Change name parameter to be a
11533         reference.  Resize signatures_ map when it gets large enough.
11534         (Layout::layout_eh_frame): Use parameters->options() instead of
11535         this->options_.
11536         (Layout::make_output_section): Likewise.
11537         (Layout::attach_allocated_section_to_segment): Likewise.
11538         (Layout::finalize, Layout::create_executable_stack): Likewise.
11539         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11540         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11541         * layout.h (class Layout): Update declarations.  Remove options_
11542         field.  Add number_of_input_files_ and resized_signatures_
11543         fields.  Move sections_are_attached_ field.
11544         * main.cc (main): Pass number of input files to Layout
11545         constructor.  Don't pass options.
11546
11547 2009-03-30  Ian Lance Taylor  <iant@google.com>
11548
11549         * ffsll.c (ffsll): Correct implementation.
11550
11551 2009-03-27  Ian Lance Taylor  <iant@google.com>
11552
11553         * ffsll.c: New file.
11554         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11555         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11556         * ftruncate.c (ftruncate): Declare before definition.
11557         * mremap.c (mremap): Likewise.
11558         * pread.c (pread): Likewise.
11559         * configure, Makefile.in, config.in: Rebuild.
11560
11561         * mremap.c: New file.
11562         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11563         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11564         (mremap): Declare if HAVE_MREMAP is not defined.
11565         * configure, Makefile.in, config.in: Rebuild.
11566
11567 2009-03-27  Cary Coutant  <ccoutant@google.com>
11568
11569         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11570         position independent.
11571         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11572         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11573
11574 2009-03-24  Cary Coutant  <ccoutant@google.com>
11575
11576         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11577         an executable.
11578         (needs_dynamic_reloc): Likewise.
11579
11580 2009-03-24  Ian Lance Taylor  <iant@google.com>
11581
11582         * yyscript.y (file_cmd): Recognize EXTERN.
11583         (extern_name_list, extern_name_list_body): New nonterminals.
11584         * script.cc (script_add_extern): Define.
11585         * script-c.h (script_add_extern): Declare.
11586
11587 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11588
11589         * object.cc (is_elf_object): Define.
11590         * object.h (is_elf_object): Declare.
11591         * archive.cc (Archive::get_elf_object_for_member): Call
11592         is_elf_object.
11593         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11594
11595 2009-03-24  Elliott Hughes  <enh@google.com>
11596
11597         * output.cc (Output_file::map_anonymous): Define.
11598         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11599         try an anonymous one.  Report the size if the mmap fails.
11600         * output.h (class Output_file): Declare map_anonymous.
11601
11602 2009-03-24  Ian Lance Taylor  <iant@google.com>
11603
11604         * target-select.cc (instantiate_target): Don't acquire the lock if
11605         the instantiated_target_ field has already been set.
11606
11607 2009-03-23  Ian Lance Taylor  <iant@google.com>
11608
11609         * gold-threads.h (class Initialize_lock): Define.
11610         * gold-threads.cc (class Initialize_lock_once): Define.
11611         (initialize_lock_control): New static variable.
11612         (initialize_lock_pointer): New static variable.
11613         (initialize_lock_once): New static function.
11614         (Initialize_lock::Initialize_lock): Define.
11615         (Initialize_lock::initialize): Define.
11616         * target-select.h: Include "gold-threads.h".
11617         (class Target_selector): Add lock_ and initialize_lock_ fields.
11618         Don't define instantiate_target, just declare it.
11619         * target-select.cc (Target_selector::Target_selector): Initialize
11620         new fields.
11621         (Target_selector::instantiate_target): Define.
11622         * descriptors.h: Include "gold-threads.h".
11623         (class Descriptors): Add initialize_lock_ field.
11624         * descriptors.cc (Descriptors::Descriptors): Initialize new
11625         field.
11626         (Descriptors::open): Use initialize_lock_ field
11627         * errors.h (class Errors): Add initialize_lock_ field.
11628         * errors.cc (Errors::Errors): Initialize new field.
11629         (Errors::initialize_lock): Use initialize_lock_ field.
11630         * powerpc.cc (class Target_selector_powerpc): Remove
11631         instantiated_target_ field.  In do_recognize call
11632         instantiate_target rather than do_instantiate_target.  In
11633         do_instantiate_target just allocate a new target.
11634         * sparc.cc (class Target_selector_sparc): Likewise.
11635
11636         * freebsd.h: New file.
11637         * i386.cc: Include "freebsd.h".
11638         (Target_i386): Derive from Target_freebsd rather than
11639         Sized_target.
11640         (Target_selector_i386): Derive from Target_selector_freebsd rather
11641         than Target_selector.
11642         * x86_64.cc: Include "freebsd.h".
11643         (Target_x86_64): Derive from Target_freebsd rather than
11644         Sized_target.
11645         (Target_selector_x86_64): Derive from Target_selector_freebsd
11646         rather than Target_selector.
11647         * target.h (class Target): Add adjust_elf_header and
11648         do_adjust_elf_header.
11649         * output.cc (Output_file_header:: do_sized_write): Call target
11650         adjust_elf_header routine.
11651         * configure.tgt: Set targ_osabi.
11652         * configure.ac: Define GOLD_DEFAULT_OSABI.
11653         * parameters.cc (Parameters::default_target): Pass
11654         GOLD_DEFAULT_OSABI to select_target.
11655         * target-select.h (class Target_selector): Make instantiate_target
11656         protected rather than private.
11657         * Makefile.am (HFILES): Add freebsd.h.
11658         * configure, Makefile.in, config.in: Rebuild.
11659
11660         * merge.cc (do_add_input_section): Correct pend value.  Change
11661         message about last entry not being null terminated from error to
11662         warning.
11663
11664 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11665
11666         * incremental.cc: New file.
11667         * Makefile.am (CCFILES): Add incremental.cc.
11668         * Makefile.in: Rebuild.
11669
11670 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11671
11672         * layout.cc (Layout::output_section_name): Preserve names
11673         of '.note.' sections.
11674
11675 2009-03-19  Ian Lance Taylor  <iant@google.com>
11676
11677         * descriptors.cc (Descriptors::open): Check that the options are
11678         valid before using them.
11679
11680 2009-03-18  Ian Lance Taylor  <iant@google.com>
11681
11682         * script-sections.h: Include <list>.
11683         (class Script_sections): Change Sections_elements from std::vector
11684         to std::list.  Typedef public Elements_iterator.  Add
11685         orphan_section_placement_, data_segment_align_start_, and
11686         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11687         field.
11688         * script-sections.cc (class Orphan_section_placement): New class.
11689         (class Sections_element): Add virtual functions is_relro and
11690         orphan_section_init.  Remove virtual function place_orphan_here.
11691         (class Output_section_definition): Add is_relro and
11692         orphan_section_init.  Remove place_orphan_here.
11693         (class Orphan_output_section): Likewise.
11694         (Script_sections::Script_sections): Update for field changes.
11695         (Script_sections::data_segment_align): Set saw_data_segment_align_
11696         and data_segment_align_start_, not data_segment_align_index.
11697         (Script_sections::data_segment_relro_end): Check
11698         saw_data_segment_align_.  Use data_segment_align_start_ rather
11699         than data_segment_align_index_.
11700         (Script_sections::place_orphan): Rewrite to use
11701         Orphan_section_placement.
11702
11703 2009-03-17  Ian Lance Taylor  <iant@google.com>
11704
11705         * archive.cc (Archive::add_symbols): Check for a version attached
11706         to the symbol name in the archive map.
11707         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11708         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11709         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11710         (ver_test_11.a): New target.
11711         * testsuite/Makefile.in: Rebuild.
11712
11713         * configure.ac: Check for chsize and posix_fallocate.  Replace
11714         ftruncate.
11715         * ftruncate.c: New file, from gnulib.
11716         * output.cc (posix_fallocate): Define dummy version if not
11717         HAVE_POSIX_FALLOCATE.
11718         (Output_file::map): Call posix_fallocate rather than lseek and
11719         write.
11720         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11721         * configure, Makefile.in, config.in: Rebuild.
11722
11723 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11724
11725         * layout.h (Layout::create_note): Add section_name parameter.
11726         * layout.cc (Layout::create_note): Likewise.
11727         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11728
11729 2009-03-17  Ian Lance Taylor  <iant@google.com>
11730
11731         * descriptors.cc: Include "options.h".
11732         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11733         (Descriptors::open): Always use O_CLOEXEC when opening a new
11734         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11735         then set FD_CLOEXEC.
11736
11737         * sparc.cc (class Target_sparc): Add has_got_section.
11738         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11739         make sure we have a GOT section.
11740
11741         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11742         (Target_sparc::Scan::local): Likewise.
11743         (Target_sparc::Scan::global): Likewise.
11744         (Target_sparc::Relocate::relocate): Likewise.
11745         (Target_sparc::Relocate::relocate_tls): Likewise.
11746
11747         * symtab.cc (Symbol_table::define_default_version): New function,
11748         broken out of add_from_object.
11749         (Symbol_table::add_from_object): Call define_default_version.
11750         (Symbol_table::define_special_symbol): Add resolve_oldsym
11751         parameter.  Change all callers.  If the version for a symbol comes
11752         from a version script, resolve it with the symbol with the same
11753         name with no version.  Also add the symbol without a version if
11754         appropriate.
11755         (do_define_in_output_data): If resolving with oldsym, don't delete
11756         sym.
11757         (do_define_in_output_segment): Likewise.
11758         (do_define_as_constant): Likewise.
11759         * symtab.h (class Symbol_table): Update declarations.
11760
11761 2009-03-13  Ian Lance Taylor  <iant@google.com>
11762
11763         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11764         (Read_symbols::requeue): New function.
11765         (Read_symbols::do_read_symbols): If make_elf_object fails because
11766         the target type is not configured, and the file was searched for,
11767         issue a warning and retry with the next directory.
11768         (Add_symbols::run): If the file has an incompatible format, and
11769         it was searched for, requeue the Read_symbols task.  On error,
11770         release the object.
11771         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11772         dirindex parameter to constructor.  Change all callers.  Declare
11773         incompatible_warning and requeue.
11774         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11775         input_argument_ and input_group_ fields.  Add them to
11776         constructor.  Change all callers.
11777         (class Read_script): Add dirindex_ field.  Add it to constructor.
11778         Change all callers.
11779         * archive.cc (Archive::setup): Remove input_objects parameter.
11780         Change all callers.
11781         (Archive::get_file_and_offset): Likewise.
11782         (Archive::read_all_symbols): Likewise.
11783         (Archive::read_symbols): Likewise.
11784         (Archive::get_elf_object_for_member): Remove input_objects
11785         parameter.  Add punconfigured parameter.  Change all callers.
11786         (Archive::add_symbols): Change return type to bool.  Check return
11787         value of include_member.
11788         (Archive::include_all_members): Likewise.
11789         (Archive::include_member): Change return type to bool.  Return
11790         false if first included object has incompatible target.  Set
11791         included_member_ field.
11792         (Add_archive_symbols::run): If add_symbols returns false, requeue
11793         Read_symbols task.
11794         * archive.h (class Archive): Add included_member_ field.
11795         Initialize it in constructor.  Add input_file and searched_for
11796         methods.  Update declarations.
11797         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11798         input_argument_ fields.  Add them to constructor.  Change all
11799         callers.
11800         * script.cc: Include "target-select.h".
11801         (class Parser_closure): Add skip_on_incompatible_target_ and
11802         found_incompatible_target_ fields.  Add
11803         skip_on_incompatible_target parameter to constructor.  Change all
11804         callers.  Add methods skip_on_incompatible_target,
11805         clear_skip_on_incompatible_target, found_incompatible_target, and
11806         set_found_incompatible_target.
11807         (read_input_script): Add dirindex parameter.  Change all callers.
11808         If parser finds an incompatible target, requeue Read_symbols
11809         task.
11810         (script_set_symbol): Clear skip_on_incompatible_target in
11811         closure.
11812         (script_add_assertion, script_parse_option): Likewise.
11813         (script_start_sections, script_add_phdr): Likewise.
11814         (script_check_output_format): New function.
11815         * script.h (read_input_script): Update declaration.
11816         * script-c.h (script_check_output_format): Declare.
11817         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11818         (ignore_cmd): Remove OUTPUT_FORMAT.
11819         * fileread.cc (Input_file::Input_file): Add explicit this.
11820         (Input_file::will_search_for): New function.
11821         (Input_file::open): Add pindex parameter.  Change all callers.
11822         * fileread.h (class Input_file): Add input_file_argument method.
11823         Declare will_search_for.  Update declarations.
11824         * object.cc (make_elf_object): Add punconfigured parameter.
11825         Change all callers.
11826         * object.h (class Object): Make input_file public.  Add
11827         searched_for method.
11828         (make_elf_object): Update declaration.
11829         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11830         restart search.
11831         * dirsearch.h (class Dirsearch): Update declaration.
11832         * options.h (class General_options): Add --warn-search-mismatch.
11833         * parameters.cc (Parameters::is_compatible_target): New function.
11834         * parameters.h (class Parameters): Declare is_compatible_target.
11835         * workqueue.cc (Workqueue::add_blocker): New function.
11836         * workqueue.h (class Workqueue): Declare add_blocker.
11837
11838         * fileread.cc (Input_file::open): Remove options parameter.
11839         Change all callers.
11840         (Input_file::open_binary): Likewise.
11841         * script.cc (read_input_script): Likewise.
11842         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11843         options parameter from constructor.  Change all callers.
11844         (class Read_script): Likewise.
11845         * fileread.h (class Input_file): Update declarations.
11846         * script.h (read_input_script): Update declaration.
11847
11848 2009-03-10  Nick Clifton  <nickc@redhat.com>
11849
11850         * po/es.po: New Spanish translation.
11851
11852 2009-03-06  Cary Coutant  <ccoutant@google.com>
11853
11854         * options.cc (parse_short_option): Keep dash_z from registering itself.
11855
11856 2009-03-03  Ian Lance Taylor  <iant@google.com>
11857
11858         PR 9918
11859         * target-reloc.h (relocate_section): Pass output_section to
11860         relocate.
11861         * i386.cc (Target_i386::should_apply_static_reloc): Add
11862         output_section parameter.  Change all callers.
11863         (Target_i386::Relocate::relocate): Add output_section parameter.
11864         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11865         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11866         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11867         * testsuite/two_file_shared.sh: New script.
11868         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11869         (check_DATA): Add two_file_shared.dbg.
11870         (two_file_shared.dbg): New target.
11871         * testsuite/Makefile.in: Rebuild.
11872
11873 2009-03-01  Ian Lance Taylor  <iant@google.com>
11874
11875         * configure.ac: Check for byteswap.h.
11876         * configure: Rebuild.
11877         * config.in: Rebuild.
11878
11879 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11880
11881         * layout.cc (Layout::find_or_add_kept_section): New function.
11882         (Layout::add_comdat): Removed.
11883         * layout.h (struct Kept_section): Move out of class Layout.
11884         Remove trailing underscores from field names.  Add group_sections
11885         field.  Rename group_ field to is_group.  Change all uses.
11886         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11887         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11888         comdat_groups_ field.
11889         (Sized_relobj::include_section_group): Use
11890         find_or_add_kept_section and Kept_section::group_sections.
11891         (Sized_relobj::include_linkonce_section): Likewise.
11892         * object.cc (class Sized_relobj): Don't define Comdat_group or
11893         Comdat_group_table.  Remove find_comdat_group and
11894         add_comdat_group.  Remove comdat_groups_ field.
11895         * plugin.cc (include_comdat_group): Use
11896         Layout::find_or_add_kept_section.
11897
11898 2009-02-28  Ian Lance Taylor  <iant@google.com>
11899
11900         * README: --gc-sections and map files are now supported.  Document
11901         some build requirements.
11902
11903         PR 6992
11904         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11905         relocatable link set the value of the section symbol to zero.
11906         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11907         relocatable link don't include the section address in the local
11908         symbol value.
11909
11910 2009-02-27  Ian Lance Taylor  <iant@google.com>
11911
11912         PR 6811
11913         * options.h (class Search_directory): Add is_system_directory.
11914         (class General_options): Declare is_in_system_directory.
11915         * options.cc (get_relative_sysroot): Make static.
11916         (get_default_sysroot): Make static.
11917         (General_optoins::is_in_system_directory): New function.
11918         * fileread.cc (Input_file::is_in_system_directory): New function.
11919         * fileread.h (class Input_file): Declare is_in_system_directory.
11920         * object.h (class Object): Add is_in_system_directory.
11921         (class Input_objects): Remove system_library_directory_ field.
11922         * object.cc (Input_objects::add_object): Don't set
11923         system_library_directory_.
11924         (input_objects::found_in_system_library_directory): Remove.
11925         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11926         parameter.  Change all callers.
11927         (Symbol_table::sized_write_globals): Likewise.
11928         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11929         Call Object::is_in_system_directory.
11930         * symtab.h (class Symbol_table): Update declarations.
11931
11932         PR 5990
11933         * descriptors.h (Open_descriptor): Add is_on_stack field.
11934         * descriptors.cc (Descriptors::open): If the descriptor is on the
11935         top of the stack, remove it.  Initialize is_on_stack field.
11936         (Descriptors::release): Only add pod to stack if it is not on the
11937         stack already.
11938         (Descriptors::close_some_descriptor): Clear stack_next and
11939         is_on_stack fields.
11940
11941         PR 7091
11942         * output.cc (Output_section::find_starting_output_address): Rename
11943         from starting_output_address; add PADDR parameter; change return
11944         type.
11945         * output.h (class Output_section): Declare
11946         find_starting_output_address instead of starting_output_address.
11947         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11948         section symbol for which we can't find a merge section.
11949
11950         PR 9836
11951         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11952         hidden or internal, force the symbol to be local.
11953         * resolve.cc (Symbol::override_visibility): Define.
11954         (Symbol::override_base): Use override_visibility.
11955         (Symbol_table::resolve): Likewise.
11956         (Symbol::override_base_with_special): Likewise.
11957         (Symbol_table::override_with_special): If the visibility is hidden
11958         or internal, force the symbol to be local.
11959         * symtab.h (class Symbol): Add set_visibility and
11960         override_visibility.
11961         * testsuite/ver_test_1.sh: New file.
11962         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11963         (check_DATA): Add ver_test_1.syms.
11964         (ver_test_1.syms): New target.
11965         * testsuite/Makefile.in: Rebuild.
11966
11967 2009-02-25  Cary Coutant  <ccoutant@google.com>
11968
11969         * layout.cc (Layout::choose_output_section): Don't rename sections
11970         when using a linker script that has a SECTIONS clause.
11971         * Makefile.in: Regenerate.
11972
11973         * testsuite/Makefile.am (script_test_5.sh): New test case.
11974         * testsuite/Makefile.in: Regenerate.
11975         * testsuite/script_test_5.cc: New file.
11976         * testsuite/script_test_5.sh: New file.
11977         * testsuite/script_test_5.t: New file.
11978
11979 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11980
11981         * archive.cc (Archive::include_member): Update calls to add_symbols.
11982         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11983         the Layout argument.
11984         * dynobj.h (do_add_symbols): Add the Layout argument.
11985         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11986         Layout argument.
11987         * object.h (Object::add_symbols): Add the Layout argument.
11988         (Object::do_add_symbols): Add the Layout argument.
11989         (Sized_relobj::do_add_symbols): Add the Layout argument.
11990         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11991         Unify the two versions.
11992         (Add_plugin_symbols): Remove.
11993         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11994         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11995         (Add_plugin_symbols): Remove.
11996         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11997         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11998         (Add_symbols::run): Make it work with Pulginobj.
11999
12000 2009-02-06  Ian Lance Taylor  <iant@google.com>
12001
12002         * object.cc (Sized_relobj::do_layout): Make info message start
12003         with lower case letter.
12004
12005 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12006
12007         * binary.cc: Fix file comment.
12008
12009         * options.h (enum Incremental_disposition): Define.
12010         (class General_options): Add new options: --incremental,
12011         --incremental_changed, --incremental_unchanged,
12012         --incremental_unknown.  Add incremental_disposition_ and
12013         implicit_incremental_ fields.
12014         (General_options::incremental_disposition): New function.
12015         (class Position_dependent_options): Add incremental_disposition
12016         option.
12017         (Position_dependent_options::copy_from_options): Set incremental
12018         dispositions.
12019         * options.cc (General_options::parse_incremental_changed): New
12020         function.
12021         (General_options::parse_incremental_unchanged): New function.
12022         (General_options::parse_incremental_unknown): New function.
12023         (General_options::General_options): Initialize new fields
12024         incremental_disposition_ and implicit_incremental_.
12025         (General_options::finalize): Check for uasge of --incremental-*
12026         without --incremental.
12027
12028 2009-02-06  Chris Demetriou  <cgd@google.com>
12029
12030         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12031         pointer and to report location as the file name associated with
12032         the symbol.
12033         (gold_undefined_symbol_at_location): New function to replace the
12034         old gold_undefined_symbol functionality.
12035         * target-reloc.h (relocate_section): Update to use
12036         gold_undefined_symbol_at_location.
12037         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12038         Call gold_undefined_symbol function rather than gold_error.
12039         * errors.h (Errors::undefined_symbol): Take location as a
12040         string, rather than calculating it from a relocation.
12041         * errors.cc (Errors::fatal): Print "fatal error:" before the
12042         formatted message.
12043         (Errors::error, Errors::error_at_location): Print "error: "
12044         before the formatted message.
12045         (Errors::undefined_symbol): Take location as a string, rather
12046         than calculating it from a relocation.
12047         (gold_undefined_symbol_at_location): New function akin to
12048         old gold_undefined_symbol, calculates location from relocation.
12049         (gold_undefined_symbol): Change to take only a Symbol pointer
12050         and to report location as the file name associated with the symbol.
12051         * testsuite/debug_msg.sh: Update for changed error messages.
12052         * testsuite/undef_symbol.sh: Likewise.
12053
12054 2009-02-04  Duncan Sands  <baldrick@free.fr>
12055
12056         PR 9812
12057         * reduced_debug_output.h
12058         (Output_reduced_debug_abbrev_section::failed): Use format for
12059         gold_warning.
12060         (Output_reduced_debug_info_section::faild): Likewise.
12061
12062 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12063
12064         * script.cc (Lazy_demangler): New class.
12065         (Version_script_info::get_symbol_version_helper): Demangle a
12066         symbol only once.
12067
12068 2009-01-29  Cary Coutant  <ccoutant@google.com>
12069
12070         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12071         to __tls_get_addr.
12072         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12073
12074 2009-01-28  Ian Lance Taylor  <iant@google.com>
12075
12076         * version.cc (version_string): Bump to 1.9.
12077
12078         * gold.h: Include <cstring> and <stdint.h>.
12079         * version.cc: Include <cstdio>.
12080         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12081         warning.
12082         * reduced_debug_output.cc (insert_into_vector): Rename from
12083         Insert_into_vector; change all callers.  Use Swap_unaligned to
12084         avoid aliasing issue; remove union since it is unnecessary.
12085
12086 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12087
12088         * Makefile.am (CCFILES): Add gc.cc.
12089         (HFILES): Add gc.h.
12090         * Makefile.in: Regenerate.
12091         * gold.cc (Gc_runner): New class.
12092         (queue_initial_tasks): Call garbage collection related tasks
12093         when corresponding options are invoked.
12094         (queue_middle_gc_tasks): New function.
12095         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12096         processed early before laying out sections during garbage collection.
12097         * gold.h (queue_middle_gc_tasks): New function.
12098         (is_prefix_of): Move from "layout.cc".
12099         * i386.cc (Target_i386::gc_process_relocs): New function.
12100         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12101         * main.cc (main): Create object of class "Garbage_collection".
12102         * object.cc (Relobj::copy_symbols_data): New function.
12103         (Relobj::is_section_name_included): New function.
12104         (Sized_relobj::do_layout): Allow this function to be called twice
12105         during garbage collection and defer layout of section during the
12106         first call.
12107         * object.h (Relobj::get_symbols_data): New function.
12108         (Relobj::is_section_name_included): New function.
12109         (Relobj::copy_symbols_data): New function.
12110         (Relobj::set_symbols_data): New function.
12111         (Relobj::get_relocs_data): New function.
12112         (Relobj::set_relocs_data): New function.
12113         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12114         (Relobj::gc_process_relocs): New function.
12115         (Relobj::do_gc_process_relocs): New pure virtual function.
12116         (Relobj::sd_): New data member.
12117         (Sized_relobj::is_output_section_offset_invalid): New function.
12118         (Sized_relobj::do_gc_process_relocs): New function.
12119         * options.h (General_options::gc_sections): Modify to not be a no-op.
12120         (General_options::print_gc_sections): New option.
12121         * plugin.cc (Plugin_finish::run): Remove function call to
12122         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12123         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12124         * reloc.cc (Read_relocs::run): Add task to process relocs and
12125         determine unreferenced sections when doing garbage collection.
12126         (Gc_process_relocs): New class.
12127         (Sized_relobj::do_gc_process_relocs): New function.
12128         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12129         sections that are garbage collected.
12130         * reloc.h (Gc_process_relocs): New class.
12131         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12132         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12133         symbols whose corresponding sections are garbage collected.
12134         (Symbol_table::Symbol_table): Add new parameter for the garbage
12135         collection object.
12136         (Symbol_table::gc_mark_undef_symbols): New function.
12137         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12138         (Symbol_table::gc_mark_dyn_syms): New function.
12139         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12140         as garbage.
12141         (Symbol_table::add_from_object): Likewise.
12142         (Symbol_table::add_from_relobj): When building shared objects, do not
12143         treat externally visible symbols as garbage.
12144         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12145         table information for static and relocatable links.
12146         * symtab.h (Symbol_table::set_gc): New function.
12147         (Symbol_table::gc): New function.
12148         (Symbol_table::gc_mark_undef_symbols): New function.
12149         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12150         (Symbol_table::gc_mark_dyn_syms): New function.
12151         (Symbol_table::gc_): New data member.
12152         * target.h (Sized_target::gc_process_relocs): New pure virtual
12153         function.
12154         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12155         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12156
12157 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12158
12159         * options.h (General_options::gc_sections): Define as a no-op for now.
12160         (General_options::no_keep_memory): Ditto.
12161         (General_options::Bshareable): Define.
12162         * options.cc (General_options::finalize): Honor -Bshareable.
12163
12164 2009-01-20  Andreas Schwab  <schwab@suse.de>
12165
12166         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12167         read the value in the contents, since we don't use it.  Use the
12168         template endianness when writing.
12169         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12170
12171 2009-01-19  Andreas Schwab  <schwab@suse.de>
12172
12173         * configure.tgt (powerpc64-*): Fix targ_obj.
12174
12175 2009-01-15  Ian Lance Taylor  <iant@google.com>
12176
12177         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12178         local symbols when stripping all symbols.
12179
12180 2009-01-14  Cary Coutant  <ccoutant@google.com>
12181
12182         * output.cc (Output_reloc): Add explicit instantiations.
12183
12184 2009-01-14  Cary Coutant  <ccoutant@google.com>
12185
12186         * archive.cc (Archive::get_elf_object_for_member): Remove call
12187         to File_read::claim_for_plugin.
12188         * descriptors.cc (Descriptors::open): Remove reference to
12189         is_claimed.
12190         (Descriptors::claim_for_plugin): Remove.
12191         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12192         (Descriptors::is_claimed): Remove.
12193         (claim_descriptor_for_plugin): Remove.
12194         * fileread.cc (File_read::claim_for_plugin): Remove.
12195         * fileread.h (File_read::claim_for_plugin): Remove.
12196         (File_read::descriptor): Reopen descriptor if necessary.
12197         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12198         (Plugin_manager::all_symbols_read): Add task parameter. Change
12199         all callers.
12200         (Plugin_manager::get_input_file): New function.
12201         (Plugin_manager::release_input_file): New function.
12202         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12203         corresponding data member.
12204         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12205         and pass to base constructor. Change all callers.
12206         (get_input_file, release_input_file): New functions.
12207         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12208         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12209         (Plugin_manager::all_symbols_read): Add task parameter.
12210         (Plugin_manager::get_input_file): New function.
12211         (Plugin_manager::release_input_file): New function.
12212         (Plugin_manager::task_): New data member.
12213         (Pluginobj::Pluginobj): Add filesize parameter.
12214         (Pluginobj::filename): New function.
12215         (Pluginobj::descriptor): New function.
12216         (Pluginobj::filesize): New function.
12217         (Pluginobj::filesize_): New data member.
12218         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12219         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12220         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12221
12222         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12223         with archive libraries.
12224         * testsuite/Makefile.in: Regenerate.
12225         * testsuite/plugin_test.c (struct sym_info): New type.
12226         (get_input_file, release_input_file): New static variables.
12227         (onload): Capture new transfer vector entries.
12228         (claim_file_hook): Stop reading at end of file according to filesize.
12229         Factor out parsing of readelf output into separate function.
12230         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12231         APIs and get the source file name from the symbol table.  Convert
12232         source file name to corresponding object file name.  Print info
12233         message when adding new input files.
12234         (parse_readelf_line): New function.
12235         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12236         * testsuite/plugin_test_2.sh: Likewise.
12237         * testsuite/plugin_test_3.sh: Likewise.
12238         * testsuite/plugin_test_4.sh: New test case.
12239
12240 2009-01-07  Ian Lance Taylor  <iant@google.com>
12241
12242         * version.cc (version_string): Bump to 1.8.
12243
12244 2008-12-23  Cary Coutant  <ccoutant@google.com>
12245
12246         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12247         * plugin.cc (Plugin_manager::finish): Rename as
12248         layout_deferred_objects.  Move cleanup to separate function.
12249         (Plugin_manager::cleanup): New function.
12250         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12251         separately.
12252         * plugin.h (Plugin_manager::finish): Rename as
12253         layout_deferred_objects.
12254         (Plugin_manager::cleanup): New function.
12255         (Plugin_manager::cleanup_done): New field.
12256
12257 2008-12-23  Cary Coutant  <ccoutant@google.com>
12258
12259         * plugin.cc (is_visible_from_outside): New function.
12260         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12261         so we don't return "IR only" status for exported symbols or -r links.
12262
12263         * testsuite/Makefile.am (plugin_test_3): New test case.
12264         * testsuite/Makefile.in: Regenerate.
12265         * testsuite/plugin_test_3.sh: New file.
12266
12267 2008-12-22  Cary Coutant  <ccoutant@google.com>
12268
12269         * object.cc (Sized_relobj::layout_section): New function.
12270         (Sized_relobj::do_layout): Defer layout of input sections until after
12271         plugin has provided replacement files.
12272         (Sized_relobj::do_layout_deferred_sections): New function.
12273         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12274         (Relobj::layout_deferred_sections): New function.
12275         (Relobj::do_layout_deferred_sections): New function.
12276         (Sized_relobj::do_layout_deferred_sections): New function.
12277         (Sized_relobj::layout_section): New function.
12278         (Sized_relobj::Deferred_layout): New structure.
12279         (Sized_relobj::deferred_layout_): New field.
12280         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12281         Change all callers.  Layout deferred sections.
12282         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12283         references.
12284         (Plugin_hook::run): Move code from do_plugin_hook inline.
12285         (Plugin_hook::do_plugin_hook): Remove.
12286         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12287         (Plugin_manager::finish): Renamed, was cleanup.
12288         (Plugin_manager::should_defer_layout): New function.
12289         (Plugin_manager::add_deferred_layout_object): New function.
12290         (Plugin_manager::Deferred_layout_list): New type.
12291         (Plugin_manager::deferred_layout_objects_): New field.
12292         (Plugin_hook::do_plugin_hook): Remove.
12293
12294 2008-12-17  Ian Lance Taylor  <iant@google.com>
12295
12296         * options.h (class General_options): Add --no case for
12297         --export-dynamic.
12298
12299 2008-12-16  Cary Coutant  <ccoutant@google.com>
12300
12301         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12302         vector.
12303         (Plugin_manager::claim_file): Create plugin object even if
12304         plugin did not call the add_symbols callback.
12305         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12306         asking for more symbols than were added.
12307         * testsuite/Makefile.am (plugin_test_1): Add test case with
12308         no global symbols.
12309         (empty.syms): New target.
12310         * testsuite/Makefile.in: Regenerate.
12311         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12312         message. Don't call add_symbols if no globals.
12313         (all_symbols_read_hook): Don't provide replacement for empty
12314         claimed file.
12315
12316 2008-12-12  Ian Lance Taylor  <iant@google.com>
12317
12318         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12319         r_type == 0 for a local symbol with r_sym == 0.
12320         (scan_relocatable_relocs): Pass r_sym to
12321         local_non_section_strategy.
12322         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12323         r_sym parameter.
12324
12325         * configure.ac: Update test for TLS descriptors: they are
12326         supported as of glibc 2.9.
12327         * configure: Rebuild.
12328
12329 2008-12-11  Ian Lance Taylor  <iant@google.com>
12330
12331         PR 7091
12332         * target-reloc.h (Default_scan_relocatable_relocs): For each
12333         function, map r_type == 0 to RELOC_DISCARD.
12334
12335 2008-12-10  Cary Coutant  <ccoutant@google.com>
12336
12337         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12338         object to override a kept COMDAT group from a plugin object.
12339
12340 2008-12-09  Ian Lance Taylor  <iant@google.com>
12341
12342         PR 7088
12343         * yyscript.y (file_cmd): Handle INPUT.
12344
12345         * testsuite/initpri1.c: Change all declarations to be full
12346         prototypes by adding void, to avoid compiler warnings.
12347
12348 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12349
12350         * options.cc (General_options::parse_plugin_opt): New.
12351         (General_options::add_plugin): The argument now is just the filename.
12352         (General_options::add_plugin_option): New.
12353         * options.h (plugin_opt): New.
12354         (add_plugin): Change argument name.
12355         (add_plugin_option): New.
12356         * plugin.cc (Plugin::load): Don't parse the plugin option.
12357         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12358         (Plugin::add_option): New.
12359         (Plugin::args_): Change type.
12360         (Plugin::filename_): New.
12361         (Plugin_manager::add_plugin_option): New.
12362         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12363         * testsuite/Makefile.in: Regenerate.
12364
12365 2008-12-05  Cary Coutant  <ccoutant@google.com>
12366
12367         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12368         Handle --strip-lto-sections option.
12369         * options.h (strip_lto_sections): New option.
12370
12371 2008-12-01  Cary Coutant  <ccoutant@google.com>
12372
12373         * plugin.cc (ld_plugin_message): Change format parameter to const.
12374         Fix mismatch between new[] and delete.
12375
12376 2008-11-14  Cary Coutant  <ccoutant@google.com>
12377
12378         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12379         instead of -1U.
12380
12381 2008-11-05  Craig Silverstein  <csilvers@google.com>
12382
12383         * options.cc (General_options::parse_dynamic_list): New function.
12384         * options.h (General_options): New flags dynamic_list,
12385         dynamic_list_data, dynamic_list_cpp_new, and
12386         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12387         (General_options::in_dynamic_list): New function.
12388         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12389         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12390         (Lex::can_continue_name): Likewise.
12391         (yylex): Likewise.
12392         (read_script_file): New parameter script_options.
12393         (read_dynamic_list): New function.
12394         (Script_options::define_dynamic_list): New function.
12395         (dynamic_list_keyword_parsecodes): New variable.
12396         (dynamic_list_keywords): New variable.
12397         * script.h (Script_options::define_dynamic_list): New function
12398         prototype.
12399         (read_dynamic_list): New function prototype.
12400         * symtab.cc (strprefix): New macro.
12401         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12402         dynamic_list_data, dynamic_list_cpp_new, and
12403         dynamic_list_cpp_typeinfo.
12404         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12405         (dynamic_list_expr): New rule.
12406         (dynamic_list_nodes): Likewise.
12407         (dynamic_list_node): Likewise.
12408         * testsuite/Makefile.am (dynamic_list): New test.
12409         * testsuite/Makefile.in: Regenerated.
12410         * testsuite/dynamic_list.t: New file.
12411         * testsuite/dynamic_list.sh: New file.
12412
12413 2008-11-05  Craig Silverstein  <csilvers@google.com>
12414
12415         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12416         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12417         (t11_last): Likewise.
12418         * testsuite/ver_test_6.c (main): Likewise.
12419
12420 2008-10-07  Cary Coutant  <ccoutant@google.com>
12421
12422         * options.c (General_options::finalize): Add check for -static and
12423         -shared.
12424         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12425         is not empty.
12426
12427 2008-10-02  Cary Coutant  <ccoutant@google.com>
12428
12429         * plugin.cc (make_sized_plugin_object): Fix conditional
12430         compilation to work when not all targets are enabled.
12431
12432 2008-09-29  Cary Coutant  <ccoutant@google.com>
12433
12434         * archive.cc (Archive::get_file_and_offset): Use filename instead
12435         of name to get library path.
12436         (Archive::include_member): Unlock external member of a thin archive.
12437
12438         * testsuite/Makefile.am (TEST_AR): New variable.
12439         (thin_archive_test_1): New test.
12440         (thin_archive_test_2): New test.
12441         * testsuite/Makefile.in: Regenerate.
12442         * testsuite/thin_archive_main.cc: New file.
12443         * testsuite/thin_archive_test_1.cc: New file.
12444         * testsuite/thin_archive_test_2.cc: New file.
12445         * testsuite/thin_archive_test_3.cc: New file.
12446         * testsuite/thin_archive_test_4.cc: New file.
12447
12448 2008-09-29  Cary Coutant  <ccoutant@google.com>
12449
12450         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12451         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12452         instead of -1U.
12453         (Sized_relobj::do_finalize_local_symbols): Likewise.
12454         (Sized_relobj::map_to_kept_section): Likewise.
12455         * object.h (Sized_relobj::invalid_address): New constant.
12456         (Sized_relobj::do_output_section_offset): Check for invalid_address
12457         and return -1ULL.
12458         * output.cc (Output_reloc::local_section_offset): Use constant
12459         invalid_address instead of -1U.
12460         (Output_reloc::get_address): Likewise.
12461         (Output_section::output_address): Change -1U to -1ULL.
12462         * output.h (Output_reloc::invalid_address): New constant.
12463         * reloc.cc (Sized_relobj::write_sections): Use constant
12464         invalid_address instead of -1U.
12465         (Sized_relobj::relocate_sections): Likewise.
12466         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12467         values for merge sections.
12468         * target-reloc.h (relocate_for_relocatable): Use constant
12469         invalid_address instead of -1U.
12470
12471 2008-09-19  Cary Coutant  <ccoutant@google.com>
12472
12473         Add plugin functionality for link-time optimization (LTO).
12474         * configure.ac (plugins): Add --enable-plugins option.
12475         * configure: Regenerate.
12476         * config.in: Regenerate.
12477         * Makefile.am (LIBDL): New variable.
12478         (CCFILES): Add plugin.cc.
12479         (HFILES): Add plugin.h.
12480         (ldadd_var): Add LIBDL.
12481         * Makefile.in: Regenerate.
12482
12483         * archive.cc: Include "plugin.h".
12484         (Archive::setup): Don't preread archive symbols when using a plugin.
12485         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12486         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12487         files.
12488         (Archive::include_member): Add symbols from plugin objects.
12489         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12490         * descriptors.cc (Descriptors::open): Check for file descriptors
12491         abandoned by plugins.
12492         (Descriptors::claim_for_plugin): New function.
12493         * descriptors.h (Descriptors::claim_for_plugin): New function.
12494         (Open_descriptor::is_claimed): New field.
12495         (claim_descriptor_for_plugin): New function.
12496         * fileread.cc (File_read::claim_for_plugin): New function.
12497         * fileread.h (File_read::claim_for_plugin): New function.
12498         (File_read::descriptor): New function.
12499         * gold.cc: Include "plugin.h".
12500         (queue_initial_tasks): Add task to call plugin hooks for generating
12501         new object files.
12502         * main.cc: Include "plugin.h".
12503         (main): Load plugin libraries.
12504         * object.h (Pluginobj): Declare.
12505         (Object::pluginobj): New function.
12506         (Object::do_pluginobj): New function.
12507         (Object::set_target): New function.
12508         * options.cc: Include "plugin.h".
12509         (General_options::parse_plugin): New function.
12510         (General_options::General_options): Initialize plugins_ field.
12511         (General_options::add_plugin): New function.
12512         * options.h (Plugin_manager): Declare.
12513         (General_options): Add --plugin option.
12514         (General_options::has_plugins): New function.
12515         (General_options::plugins): New function.
12516         (General_options::add_plugin): New function.
12517         (General_options::plugins_): New field.
12518         * plugin.cc: New file.
12519         * plugin.h: New file.
12520         * readsyms.cc: Include "plugin.h".
12521         (Read_symbols::do_read_symbols): Check for archive before checking
12522         for ELF file.  Call plugin hooks to claim files.
12523         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12524         from a real object file; force override when processing replacement
12525         files.
12526         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12527         (Symbol::init_base_object): Likewise.
12528         (Symbol::init_base_output_data): Likewise.
12529         (Symbol::init_base_output_segment): Likewise.
12530         (Symbol::init_base_constant): Likewise.
12531         (Symbol::init_base_undefined): Likewise.
12532         (Symbol::output_section): Assert that object is not a plugin.
12533         (Symbol_table::add_from_pluginobj): New function.
12534         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12535         undefined.
12536         (Symbol_table::sized_write_globals): Likewise.
12537         (Symbol_table::add_from_pluginobj): Instantiate template.
12538         * symtab.h (Sized_pluginobj): Declare.
12539         (Symbol::in_real_elf): New function.
12540         (Symbol::set_in_real_elf): New function.
12541         (Symbol::in_real_elf_): New field.
12542         (Symbol_table::add_from_pluginobj): New function.
12543
12544         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12545         (LIBDL): New variable.
12546         (LDADD): Add LIBDL.
12547         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12548         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12549         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12550         (MOSTLYCLEANFILES): Likewise.
12551         * testsuite/Makefile.in: Regenerate.
12552         * testsuite/plugin_test.c: New file.
12553         * testsuite/plugin_test_1.sh: New file.
12554         * testsuite/plugin_test_2.sh: New file.
12555
12556 2008-09-16  Ian Lance Taylor  <iant@google.com>
12557
12558         * target-reloc.h (relocate_section): Check whether a symbol is
12559         defined by the ABI before reporting an undefined symbol error.
12560         * target.h (Target::is_defined_by_abi): Make parameter const.
12561         (Target::do_is_defined_by_abi): Likewise.
12562         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12563         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12564         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12565         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12566         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12567         * testsuite/Makefile.in: Rebuild.
12568
12569         * fileread.cc (make_view): Add casts to avoid warning.
12570
12571 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12572
12573         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12574         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12575
12576 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12577
12578         * options.h (General_options::output_is_executable): New.
12579         (General_options::output_is_pie): New.
12580         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12581         for shared libraries.
12582         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12583
12584 2008-09-11  Chris Demetriou  <cgd@google.com>
12585
12586         * options.h (origin): New -z option.
12587         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12588         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12589         in DT_FLAGS_1.
12590
12591 2008-09-05  Cary Coutant  <ccoutant@google.com>
12592
12593         * fileread.cc (File_read::make_view): Add check for attempt to map
12594         beyond end of file.
12595
12596 2008-09-05  Cary Coutant  <ccoutant@google.com>
12597
12598         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12599         explicit instantiations.
12600
12601 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12602
12603         PR gold/6858
12604         * options.cc (General_options::finalize): Allow undefined symbols
12605         in shlibs if linking -shared.
12606
12607         PR gold/6859
12608         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12609         symbols as not needing a dynsym entry.
12610
12611 2008-08-20  Craig Silverstein  <csilvers@google.com>
12612
12613         * fileread.cc (File_read::open): Do not lock the file unless it
12614         was successfully opened.
12615
12616 2008-08-14  Cary Coutant  <ccoutant@google.com>
12617
12618         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12619         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12620         * testsuite/tls_test.cc (struct int128): 128-bit struct
12621         for testing TLS relocs with non-zero addend.
12622         (v12): New TLS variable.
12623         (t12): New test.
12624         (t_last): Add check for v12.
12625         * testsuite/tls_test.h (t12): New function.
12626         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12627
12628 2008-08-13  Ian Lance Taylor  <iant@google.com>
12629
12630         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12631         set tls_segment_ or relro_segment_.
12632         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12633         when appropriate.
12634         * output.h (Output_section::clear_is_relro): New function.
12635         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12636         sections specially even when output_data_ is empty.
12637         (Output_segment::maximum_alignment): When first section is relro,
12638         only force alignment for PT_LOAD segments.
12639         * script.cc (script_data_segment_align): New function.
12640         (script_data_segment_relro_end): New function.
12641         * script-c.h (script_data_segment_align): Declare.
12642         (script_data_segment_relro_end): Declare.
12643         * script-sections.h (class Script_sections): Declare
12644         data_segment_align and data_segment_relro_end.  Add fields
12645         segment_align_index_ and saw_relro_end_.
12646         * script-sections.cc (class Sections_element): Add set_is_relro
12647         virtual function.  Add new bool* parameter to place_orphan_here.
12648         Add get_output_section virtual function.
12649         (class Output_section_definition): Add set_is_relro.  Add new
12650         bool* parameter to place_orphan_here.  Add get_output_section.
12651         Add is_relro_ field.
12652         (Output_section_definition::Output_section_definition): Initialize
12653         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12654         and is_relro_ fields.
12655         (Output_section_definition::place_orphan_here): Add is_relro
12656         parameter.
12657         (Output_section_definition::set_section_addresses): Set relro for
12658         output section.
12659         (Output_section_definition::alternate_constraint): Likewise.
12660         (class Orphan_output_section): Add new bool* parameter to
12661         place_orphan_here.  Add get_output_section.
12662         (Orphan_output_section::place_orphan_here): Add is_relro
12663         parameter.
12664         (Script_sections::Script_sections): Initialize
12665         data_segment_align_index_ and saw_relro_end_.
12666         (Script_sections::data_segment_align): New function.
12667         (Script_sections::data_segment_relro_end): New function.
12668         (Script_sections::place_orphan): Set or clear is_relro.
12669         (Script_sections::set_section_addresses): Force alignment of first
12670         TLS section.
12671         * yyscript.y (exp): Call script_data_segment_align and
12672         script_data_segment_relro_end.
12673         * testsuite/relro_script_test.t: New file.
12674         * testsuite/relro_test.cc (using_script): Declare.
12675         (t1, t2): Test using_script.
12676         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12677         (relro_script_test_SOURCES): Define.
12678         (relro_script_test_DEPENDENCIES): Define.
12679         (relro_script_test_LDFLAGS): Define.
12680         (relro_script_test_LDADD): Define.
12681         (relro_script_test.so): New target.
12682         * testsuite/Makefile.in: Rebuild.
12683
12684 2008-08-06  Cary Coutant <ccoutant@google.com>
12685
12686         * archive.cc (Archive::total_archives, Archive::total_members)
12687         (Archive::total_members_loaded): New variables.
12688         (Archive::setup): Add parameter.  Add option to preread
12689         archive symbols.
12690         (Archive::read_armap): Add counter.
12691         (Archive::get_file_and_offset): New function.
12692         (Archive::get_elf_object_for_member): New function.
12693         (Archive::read_all_symbols): New function.
12694         (Archive::read_symbols): New function.
12695         (Archive::add_symbols): Add counters.
12696         (Archive::include_all_members): Use armap to find members if it's
12697         already built.
12698         (Archive::include_member): Skip reading symbols if already read.
12699         Factored code into Archive::get_file_and_offset and
12700         Archive::get_elf_object_for_member.  Changed call to
12701         Mapfile::report_include_archive_member.
12702         (Archive::print_stats): New function.
12703         * archive.h: Declare Object and Read_symbols_data classes.
12704         (Archive::Archive): Add initializers for new members.
12705         (Archive::setup): Add parameter.
12706         (Archive::print_stats): New function.
12707         (Archive::total_archives, Archive::total_members)
12708         (Archive::total_members_loaded): New variables.
12709         (Archive::get_file_and_offset): New function.
12710         (Archive::get_elf_object_for_member): New function.
12711         (Archive::read_all_symbols): New function.
12712         (Archive::read_symbols): New function.
12713         (Archive::Archive_member): New class.
12714         (Archive::members_): New member.
12715         (Archive::num_members_): New member.
12716         * main.cc: Include archive.h.
12717         (main): Call Archive::print_stats.
12718         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12719         archive parameter; member_name is now the fully-decorated name.
12720         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12721         * options.h: (General_options): Add --preread-archive-symbols option.
12722         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12723         Archive::setup.
12724
12725 2008-08-04  Ian Lance Taylor  <iant@google.com>
12726
12727         * symtab.h (Symbol::use_plt_offset): New function.
12728         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12729         * powerpc.cc (Relocate::relocate): Likewise.
12730         * sparc.cc (Relocate::relocate): Likewise.
12731         * x86_64.cc (Relocate::relocate): Likewise.
12732         * testsuite/weak_plt.sh: New test.
12733         * testsuite/weak_plt_main.cc: New test.
12734         * testsuite/weak_plt_shared.cc: New test.
12735         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12736         (check_PROGRAMS): Add weak_plt.
12737         (check_DATA): Add weak_plt_shared.so.
12738         (weak_plt_main_pic.o, weak_plt): New targets.
12739         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12740         * testsuite/Makefile.in: Rebuild.
12741
12742         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12743         gcctestdir/ld.
12744         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12745         * testsuite/Makefile.in: Rebuild.
12746
12747 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12748
12749         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12750         * Makefile.in: Regenerate.
12751         * po/POTFILES.in: Regenerate.
12752
12753 2008-07-29  Ian Lance Taylor  <iant@google.com>
12754
12755         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12756         symbols before other symbols.
12757         * testsuite/script_test_2.cc (test_addr): Declare.
12758         (test_addr_alias): Declare.
12759         (main): Check that test_addr and test_addr_alias have the right
12760         values.
12761         * testsuite/script_test_2.t: Define test_addr_alias and
12762         test_addr.
12763
12764 2008-07-24  Ian Lance Taylor  <iant@google.com>
12765
12766         PR 5990
12767         * descriptors.cc: New file.
12768         * descriptors.h: New file.
12769         * gold-threads.h (class Hold_optional_lock): New class.
12770         * fileread.cc: Include "descriptors.h".
12771         (File_read::~File_read): Release descriptor rather than closing
12772         it.
12773         (File_read::open) [file]: Call open_descriptor rather than open.
12774         Set is_descriptor_opened_.
12775         (File_read::open) [memory]: Assert that descriptor is not open.
12776         (File_read::reopen_descriptor): New function.
12777         (File_read::release): Release descriptor.
12778         (File_read::do_read): Make non-const.  Reopen descriptor.
12779         (File_read::read): Make non-const.
12780         (File_read::make_view): Reopen descriptor.
12781         (File_read::do_readv): Likewise.
12782         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12783         Update declarations.
12784         * layout.cc: Include "descriptors.h".
12785         (Layout::create_build_id): Use open_descriptor rather than open.
12786         * output.cc: Include "descriptors.h".
12787         (Output_file::open): Use open_descriptor rather than open.
12788         * archive.cc (Archive::const_iterator): Change Archive to be
12789         non-const.
12790         (Archive::begin, Archive::end): Make non-const.
12791         (Archive::count_members): Likewise.
12792         * archive.h (class Archive): Update declarations.
12793         * object.h (Object::read): Make non-const.
12794         * Makefile.am (CCFILES): Add descriptors.cc.
12795         (HFILES): Add descriptors.h.
12796         * Makefile.in: Rebuild.
12797
12798         PR 6716
12799         * gold.h: Always include <clocale>.  Add Solaris workarounds
12800         following code in binutils/sysdep.h.
12801
12802         PR 6048
12803         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12804         this->eh_frame_hdr_ is NULL before using it.
12805
12806         * dynobj.cc (Versions::Versions): Update comment.
12807
12808         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12809         the base version name.
12810
12811         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12812         array size plus one.
12813         (Stringpool_template::set_string_offsets): Subtract one from key
12814         before using it as an array index.
12815         (Stringpool_template::get_offset_with_length): Likewise.
12816         (Stringpool_template::write_to_buffer): Likewise.
12817         * stringpool.h (Stringpool_template::get_offset_from_key):
12818         Likewise.
12819
12820 2008-07-23  Ian Lance Taylor  <iant@google.com>
12821
12822         PR 6658
12823         * object.h (Merged_symbol_value::value): Do our best to handle a
12824         negative addend.
12825
12826         PR 6647
12827         * script.cc (Version_script_info::get_versions): Don't add empty
12828         version tag to return value.
12829         (Version_script_info::get_symbol_version_helper): Change return
12830         type to bool.  Add pversion parameter.  Change all callers.
12831         (script_register_vers_node): Don't require a non-NULL tag.
12832         * script.h (class Version_script_info): Update declarations.
12833         (Version_script_info::get_symbol_version): Change return type to
12834         bool.  Add version parameter.  Change all callers.
12835         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12836         handling.  Handle an empty version from a version script.
12837         (Symbol_table::define_special_symbol): Likewise.
12838         * testsuite/ver_test_10.script: New file.
12839         * testsuite/ver_test_10.sh: New file.
12840         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12841         (check_DATA): Add ver_test_10.syms.
12842         (ver_test_10.syms, ver_test_10.so): New target.
12843         * testsuite/Makefile.in: Rebuild.
12844
12845 2008-07-23  Simon Baldwin  <simonb@google.com>
12846
12847         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12848         to zero for undefined symbols from dynamic libraries.
12849
12850 2008-07-23  Ian Lance Taylor  <iant@google.com>
12851
12852         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12853         Change all callers.
12854         * symtab.h (class Symbol_table): Update declaration.
12855         * testsuite/ver_test_9.cc: New file.
12856         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12857         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12858         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12859         (ver_test_9.so, ver_test_9.o): New targets.
12860         * testsuite/Makefile.in: Rebuild.
12861
12862 2008-07-22  Ian Lance Taylor  <iant@google.com>
12863
12864         * options.h (class General_options): Define --check-sections.
12865         * layout.cc (Layout::set_segment_offsets): Handle
12866         --check-sections.
12867
12868         * options.h (class General_options): Define -n/--nmagic and
12869         -N/--omagic.
12870         * options.cc (General_options::finalize): For -n/--nmagic or
12871         -N/--omagic, set -static.
12872         * layout.cc (Layout::attach_allocated_section_to_segment): If
12873         -N/--omagic, don't put read-only and read-write sections in
12874         different segments.
12875         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12876         finding a read-only segment.
12877         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12878         don't set the minimum segment alignment to the common page size,
12879         and don't set the file offset to the address modulo the page size.
12880         * script-sections.cc (Script_sections::create_segments): If
12881         -n/--omagic, don't put read-only and read-write sections in
12882         different segments.
12883
12884         * cref.cc: New file.
12885         * cref.h: New file.
12886         * options.h (class General_options): Add --print-symbol-counts.
12887         * main.cc (main): Issue defined symbol report if requested.
12888         * archive.cc (Archive::interpret_header): Make into a const member
12889         function.
12890         (Archive::add_symbols): Call Input_objects::archive_start and
12891         archive_stop.
12892         (Archive::const_iterator): Define new class.
12893         (Archive::begin, Archive::end): New functions.
12894         (Archive::include_all_members): Rewrite to use iterator.
12895         (Archive::count_members): New function.
12896         * archive.h (class Archive): Update declarations.
12897         (Archive::filename): New function.
12898         * object.cc: Include "cref.h".
12899         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12900         (Sized_relobj::do_get_global_symbol_counts): New function.
12901         (Input_objects::add_object): Add object to cross-referencer.
12902         (Input_objects::archive_start): New function.
12903         (Input_objects::archive_stop): New function.
12904         (Input_objects::print_symbol_counts): New function.
12905         * object.h: Declare Cref and Archive.
12906         (Object::get_global_symbol_counts): New function.
12907         (Object::do_get_global_symbol_counts): New pure virtual function.
12908         (class Sized_relobj): Add defined_count_ field.  Update
12909         declarations.
12910         (class Input_objects): Add cref_ field.  Update constructor.
12911         Update declarations.
12912         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12913         defined_count_.
12914         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12915         symbol counts.
12916         (Sized_dynobj::do_get_global_symbol_counts): New function.
12917         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12918         defined_count_.  Update declarations.  Define Symbols typedef.
12919         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12920         parameter.  Change all callers.
12921         (Symbol_table::add_from_dynobj): Add sympointers and defined
12922         parameters.  Change all callers.
12923         * symtab.h (class Symbol_table): Update declarations.
12924         * Makefile.am (CCFILES): Add cref.cc.
12925         (HFILES): Add cref.h.
12926         * Makefile.in: Rebuild.
12927
12928 2008-07-22  Simon Baldwin  <simonb@google.com>
12929
12930         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12931         to zero when writing undefined symbols.
12932
12933 2008-07-22  Ian Lance Taylor  <iant@google.com>
12934
12935         * output.cc (Output_section::add_input_section): Don't try to
12936         merge empty merge sections.
12937
12938 2008-07-21  Craig Silverstein  <csilvers@google.com>
12939
12940         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12941         Include symbol version in error message.
12942
12943 2008-07-20  Chris Demetriou  <cgd@google.com>
12944
12945         * configure.ac (gold_cv_c_random_seed): New configured variable.
12946         (RANDOM_SEED_CFLAGS): New substituted variable.
12947         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12948         * configure: Rebuild.
12949         * Makefile.in: Likewise.
12950         * testsuite/Makefile.in: Likewise.
12951
12952 2008-07-18  Ian Lance Taylor  <iant@google.com>
12953
12954         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12955         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12956         * testsuite/ver_test_main.cc (main): Call t4.
12957         (t4, t4_2a): Define.
12958         * testsuite/ver_test_2.cc (t4_2): Define.
12959         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12960         * testsuite/ver_test_4.cc (t4_2a): Define.
12961         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12962         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12963
12964 2008-07-17  Ian Lance Taylor  <iant@google.com>
12965
12966         * dynobj.cc (Versions::add_def): If we give an error about a
12967         missing version, go ahead and create the version anyhow.
12968
12969 2008-07-10  Ian Lance Taylor  <iant@google.com>
12970
12971         Handle output sections with more than 0x7fffffff bytes.
12972         * object.h (class Relobj): Change map_to_output_ to
12973         output_sections_, and just keep a section pointer.  Change all
12974         uses.  Move comdat group support to Sized_relobj.
12975         (Relobj::is_section_specially_mapped): Remove.
12976         (Relobj::output_section): Remove poff parameter.  Change all
12977         callers.
12978         (Relobj::output_section_offset): New function.
12979         (Relobj::set_section_offset): Rewrite.
12980         (Relobj::map_to_output): Remove.
12981         (Relobj::output_sections): New function.
12982         (Relobj::do_output_section_offset): New pure virtual function.
12983         (Relobj::do_set_section_offset): Likewise.
12984         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12985         group support from Relobj.  Update declarations.
12986         (Sized_relobj::get_output_section_offset): New function.
12987         (Sized_relobj::do_output_section_offset): New function.
12988         (Sized_relobj::do_set_section_offset): New function.
12989         * object.cc (Relobj::output_section_address): Remove.
12990         (Sized_relobj::Sized_relobj): Initialize new fields.
12991         (Sized_relobj::include_section_group): Cast find_kept_object to
12992         Sized_relobj.
12993         (Sized_relobj::include_linkonce_section): Likewise.
12994         (Sized_relobj::do_layout): Use separate arrays for output section
12995         and output offset.
12996         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12997         output_sections.
12998         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12999         output_sections and section_offsets.
13000         (Sized_relobj::write_local_symbols): Likewise.
13001         (map_to_kept_section): Compute output address directly.
13002         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13003         output_sections and section_offsets.
13004         (Sized_relobj::write_sections): Likewise.
13005         (Sized_relobj::relocate_sections): Likewise.
13006         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13007         * output.h (class Output_reloc): Update declarations.  Change
13008         u2_.relobj to Sized_relobj*.
13009         (class Output_data_reloc): Change add functions to use
13010         Sized_relobj*.
13011         * output.cc (Output_reloc::Output_reloc): Change relobj to
13012         Sized_relobj*.
13013         (Output_reloc::local_section_offset): Change return type to
13014         Elf_Addr.  Use get_output_section_offset.
13015         (Output_reloc::get_address): Likewise.
13016         (Output_section::is_input_address_mapped): Don't call
13017         is_section_specially_mapped.
13018         (Output_section::output_offset): Likewise.
13019         (Output_section::output_address): Likewise.
13020         (Output_section::starting_output_address): Likewise.
13021         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13022         parameter to Sized_relobj*.
13023         (Copy_relocs::need_copy_reloc): Likewise.
13024         (Copy_relocs::save): Likewise.
13025         * copy-relocs.h (class Copy_relocs): Update declarations.
13026         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13027         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13028         * target-reloc.h (relocate_for_relocatable): Change
13029         offset_in_output_section type to Elf_Addr.  Change code that uses
13030         it as well.
13031         * layout.cc (Layout::layout): Always set *off.
13032         * mapfile.cc (Mapfile::print_input_section): Use
13033         output_section_offset.
13034         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13035         Sized_relobj*.
13036         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13037         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13038         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13039
13040 2008-07-03  Ian Lance Taylor  <iant@google.com>
13041
13042         * layout.cc (Layout::include_section): Do not discard unrecognized
13043         SHT_STRTAB sections.
13044
13045 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13046
13047         * script.cc (Lex::can_continue_name): Make '?' allowable in
13048         version-script names.
13049         * testsuite/version_script.map: Change glob pattern to use '?'
13050
13051 2008-06-30  Manish Singh  <yosh@gimp.org>
13052
13053         PR 6585
13054         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13055         Correct typo.
13056
13057 2008-06-30  Ian Lance Taylor  <iant@google.com>
13058
13059         PR 6660
13060         PR 6682
13061         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13062         versions]: Don't try to read the value in the contents, since we
13063         don't use it.  Use the template endianness when writing.
13064
13065 2008-06-25  Cary Coutant  <ccoutant@google.com>
13066
13067         * fileread.cc (File_read::make_view): Assert on zero-length view.
13068         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13069         symbol table when there are no symbols to read.
13070
13071 2008-06-23  Craig Silverstein  <csilvers@google.com>
13072
13073         * version.cc (version_string): Bump to 1.7
13074
13075 2008-06-18  Craig Silverstein  <csilvers@google.com>
13076
13077         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13078         constant 0xFFFF to type Valtype.
13079         (Powerpc_relocate_functions::rel16_ha): Likewise.
13080
13081 2008-06-17  Ian Lance Taylor  <iant@google.com>
13082
13083         * output.h (Output_section::Input_section): Initialize p2align_ to
13084         zero for Output_section_data constructors.
13085         (Output_section::Input_section::addralign): If not an input
13086         section, return the alignment of the Output_section_data.
13087         * testsuite/copy_test.cc: New file.
13088         * testsuite/copy_test_1.cc: New file.
13089         * testsuite/copy_test_2.cc: New file.
13090         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13091         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13092         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13093         (copy_test_1_pic.o, copy_test_1.so): New targets.
13094         (copy_test_2_pic.o, copy_test_2.so): New targets.
13095         * testsuite/Makefile.in: Rebuild.
13096
13097         * script-sections.cc (Script_sections::place_orphan): Initialize
13098         local variable exact.
13099
13100 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13101
13102         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13103
13104 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13105             David S. Miller  <davem@davemloft.net>
13106
13107         * powerpc.cc: New file.
13108         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13109         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13110         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13111         * Makefile.in: Rebuild.
13112
13113 2008-06-09  Ian Lance Taylor  <iant@google.com>
13114
13115         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13116         <exception>.
13117         (throwing, orig_terminate): New static variables.
13118         (terminate_handler): New static function.
13119         (t2): Set terminate handler.
13120
13121 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13122
13123         PR 6584
13124         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13125         alignment.
13126
13127 2008-05-30  Cary Coutant  <ccoutant@google.com>
13128
13129         * archive.cc (Archive::include_all_members) Correct to step
13130         over symbol table and extended name table in thin archives.
13131
13132 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13133
13134         PR 6407
13135         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13136         calculation.
13137
13138 2008-05-28  Caleb Howe  <cshowe@google.com>
13139
13140         * reduced_debug_output.cc: New file.
13141         * reduced_debug_output.h: New file.
13142         * options.h (class General_options): Add --strip-debug-non-line.
13143         * options.cc (General_options::finalize): Add strip_debug_non_line
13144         to the strip heirarchy.
13145         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13146         fields.
13147         * layout.cc: Include "reduced_debug_output.h".
13148         (Layout::Layout): Initialize new fields.
13149         (line_only_debug_sections): New static array.
13150         (is_lines_only_debug_sections): New static inline function.
13151         (Layout::include_section): Handle --strip-debug-non-line.
13152         (Layout::make_output_section): If --strip-debug-non-line, build
13153         new output sections for .debug_abbrev and .debug_info.
13154         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13155         gold.  Warn about possible overflow.
13156         (read_signed_LEB_128): Likewise.
13157         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13158         (read_signed_LEB_128): Declare.
13159         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13160         (HFILES): Add reduced_debug_output.h.
13161         * Makefile.in: Rebuild.
13162
13163 2008-05-21  Ian Lance Taylor  <iant@google.com>
13164
13165         * mapfile.cc: New file.
13166         * mapfile.h: New file.
13167         * options.h (class General_options): Add -M/--print-map and -Map.
13168         * options.cc (General_options::finalize): Make -M equivalent to
13169         -Map -.
13170         * main.cc: Include <cstdio> and "mapfile.h".
13171         (main): Open mapfile if requested.
13172         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13173         constructor.  Change caller.
13174         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13175         (queue_middle_tasks): Likewise.
13176         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13177         declarations.
13178         * archive.cc: Include "mapfile.h".
13179         (Archive::add_symbols): Add mapfile parameter.  Change all
13180         callers.  Pass mapfile, symbol, and reason to include_member.
13181         (Archive::include_all_members): Add mapfile parameter.  Change all
13182         callers.
13183         (Archive::include_member): Add mapfile, sym, and why parameters.
13184         Change all callers.  Report inclusion to map file.
13185         * archive.h: Include "fileread.h".
13186         (class Archive): Update declarations.
13187         (Archive::file): New const method.
13188         (class Add_archive_symbols): Add mapfile_ field.  Update
13189         constructor.  Change all callers.
13190         * readsyms.h (class Read_symbols): Likewise.
13191         (class Finish_group): Likewise.
13192         (class Read_script): Likewise.
13193         * common.cc: Include "mapfile.h".
13194         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13195         all callers.
13196         (Symbol_table::do_allocate_commons): Likewise.
13197         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13198         symbol allocation to mapfile.
13199         * common.h (class Allocate_commons_task): Add mapfile_ field.
13200         Update constructor.  Change all callers.
13201         * symtab.h (class Symbol_table): Update declarations.
13202         * layout.cc: Include "mapfile.h".
13203         (Layout_task_runner::run): Print information to mapfile.
13204         (Layout::create_gold_note): Change Output_data_fixed_space to
13205         Output_data_zero_fill.
13206         (Layout::create_build_id): Likewise.
13207         (Layout::print_to_mapfile): New function.
13208         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13209         constructor.  Change caller.
13210         (class Layout): Declare print_to_mapfile.
13211         * output.cc (Output_section::Input_section::print_to_mapfile): New
13212         function.
13213         (Output_section::add_input_section): If producing a map, always
13214         add to input_sections_ list.
13215         (Output_section::do_print_to_mapfile): New function.
13216         (Output_segment::print_sections_to_mapfile): New function.
13217         (Output_segment::print_section_list_to_mapfile): New function.
13218         * output.h: Include "mapfile.h".
13219         (Output_data::print_to_mapfile): New function.
13220         (Output_data::do_print_to_mapfile): New virtual function.
13221         (Output_segment_headers::do_print_to_mapfile): New function.
13222         (Output_file_header::do_print_to_mapfile): New function.
13223         (Output_data_const::do_print_to_mapfile): New function.
13224         (class Output_data_const_buffer): Add map_name_ field.  Update
13225         constructor.  Change all callers.  Add do_print_to_mapfile
13226         function.
13227         (class Output_data_fixed_space): Likewise.
13228         (class Output_data_space): Likewise.
13229         (class Output_data_zero_fill): New class.
13230         (Output_data_strtab::do_print_to_mapfile): New function.
13231         (Output_data_reloc_base::do_print_to_mapfile): New function.
13232         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13233         (Output_data_group::do_print_to_mapfile): New function.
13234         (Output_data_got::do_print_to_mapfile): New function.
13235         (Output_data_dynamic::do_print_to_mapfile): New function.
13236         (Output_symtab_xindex::do_print_to_mapfile): New function.
13237         (class Output_section): Declare do_print_to_mapflie.  Declare
13238         print_to_mapfile in Input_section.
13239         (class Output_segment): Declare new functions.
13240         * object.h (Sized_relobj::symbol_count): New function.
13241         * script-sections.cc
13242         (Output_section_element_dot_assignment::set_section_addresses):
13243         Change Output_data_fixed_space to Output_data_zero_fill.
13244         (Output_data_expression::do_print_to_mapfile): New function.
13245         * script.cc (read_input_script): Add mapfile parameter.  Change
13246         all callers.
13247         * script.h (read_input_script): Update declaration.
13248         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13249         (Eh_frame::do_print_to_mapfile): New function.
13250         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13251         (Output_merge_string::do_print_to_mapfile): New function.
13252         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13253         function.
13254         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13255         function.
13256         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13257         function.
13258         * Makefile.am (CCFILES): Add mapfile.cc.
13259         (HFILES): Add mapfile.h.
13260         * Makefile.in: Rebuild.
13261
13262 2008-05-19  Ian Lance Taylor  <iant@google.com>
13263
13264         * options.h (class General_options): Add -z relro.
13265         * layout.cc (Layout::Layout): Initialize relro_segment_.
13266         (Layout::add_output_section_data): Return the output section.
13267         (Layout::make_output_section): Rcognize relro sections and mark
13268         them appropriately.
13269         (Layout::attach_allocated_section_to_segment): Put relro sections
13270         in a PT_GNU_RELRO segment.
13271         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13272         section as relro.
13273         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13274         PT_TLS segments.
13275         (Layout::linkonce_mapping): Map d.rel.ro.local to
13276         .data.rel.ro.local.
13277         (Layout::output_section_name): Us .data.rel.ro.local for any
13278         section which begins with that.
13279         * layout.h (class Layout): Update add_output_section_data
13280         declaration.  Add relro_segment_ field.
13281         * output.cc (Output_section::Output_section): Initialize is_relro_
13282         and is_relro_local_ fields.
13283         (Output_segment::add_output_section): Group relro sections.
13284         (Output_segment::is_first_section_relro): New function.
13285         (Output_segment::maximum_alignment): If there is a relro section,
13286         align the segment to the common page size.
13287         (Output_segment::set_section_addresses): Track whether we are
13288         looking at relro sections.  If the last section is a relro
13289         section, align to the common page size.
13290         (Output_segment::set_section_list_addresses): Add in_relro
13291         parameter.  Change all callers.  Align to the page size when
13292         moving from relro to non-relro section.
13293         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13294         segment.
13295         * output.h (class Output_section): Add is_relro_ and
13296         is_relro_local_ fields.
13297         (Output_section::is_relro): New function.
13298         (Output_section::set_is_relro): New function.
13299         (Output_section::is_relro_local): New function.
13300         (Output_section::set_is_relro_local): New function.
13301         (class Output_segment): Update declarations.
13302         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13303         * sparc.cc (Target_sparc::got_section): Likewise.
13304         * x86_64.cc (Target_x86_64::got_section): Likewise.
13305         * testsuite/relro_test_main.cc: New file.
13306         * testsuite/relro_test.cc: New file.
13307         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13308         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13309         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13310         (relro_test.so, relro_test_pic.o): New targets.
13311         * testsuite/Makefile.in: Rebuild.
13312
13313 2008-05-16  Ian Lance Taylor  <iant@google.com>
13314
13315         * output.cc (Output_segment::add_output_section): Remove front
13316         parameter.
13317         * output.h (class Output_segment): Remove
13318         add_initial_output_section and overloaded add_output_section.
13319         Update declaration of remaining add_output_section.
13320         * layout.cc (Layout::create_interp): Call add_output_section
13321         rather than add_initial_output_section.
13322         (Layout::finish_dynamic_section): Likewise.
13323
13324         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13325         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13326         know the dynamic type.
13327         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13328         field.  Initialize it in constructor.
13329         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13330         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13331         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13332         reloc.
13333
13334         * output.cc (Output_reloc::get_address): Change return type to
13335         Elf_Addr.
13336         * output.h (class Output_reloc): Update get_address declaration.
13337         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13338         for section addresses.
13339
13340 2008-05-09  Ian Lance Taylor  <iant@google.com>
13341
13342         PR 6493
13343         * gold.cc (gold_nomem): Use return value of write.
13344
13345 2008-05-08  Ian Lance Taylor  <iant@google.com>
13346
13347         * symtab.c (Symbol::init_base_output_data): Add version
13348         parameter.  Change all callers.
13349         (Symbol::init_base_output_segment): Likewise.
13350         (Symbol::init_base_constant): Likewise.
13351         (Symbol::init_base_undefined): Likewise.
13352         (Sized_symbol::init_output_data): Likewise.
13353         (Sized_symbol::init_output_segment): Likewise.
13354         (Sized_symbol::init_constant): Likewise.
13355         (Sized_symbol::init_undefined): Likewise.
13356         (Symbol_table::do_define_in_output_data): If the new symbol has a
13357         version, mark it as the default.
13358         (Symbol_table::do_define_in_output_segment): Likewise.
13359         (Symbol_table::do_define_as_constant): Likewise.
13360         * symtab.h (class Symbol): Update declarations.
13361         (class Sized_symbol): Likewise.
13362         * resolve.cc (Symbol::override_version): New function.
13363         (Symbol::override_base): Call override_version.
13364         (Symbol::override_base_with_special): Likewise.
13365         * testsuite/ver_script_8.script: New file.
13366         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13367         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13368         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13369         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13370
13371 2008-05-06  Ian Lance Taylor  <iant@google.com>
13372
13373         PR 6049
13374         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13375         functions.
13376         (class General_options): Remove existing --undefined, and add
13377         --no-undefined instead.  Add new --undefined as synonym for -u.
13378         * archive.cc (Archive::add_symbols): Check whether symbol was
13379         named with -u.
13380         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13381         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13382         all uses.  Add IS_UNDEFINED.  Update declarations to split
13383         different versions of init_base.  Declare init_base_undefined.
13384         (Symbol::is_defined): Handle IS_UNDEFINED.
13385         (Symbol::is_undefined): Likewise.
13386         (Symbol::is_weak_undefined): Call is_undefined.
13387         (Symbol::is_absolute): Handle IS_CONSTANT.
13388         (class Sized_symbol): Update declarations to split different
13389         versions of init.  Declare init_undefined.
13390         (class Symbol_table): Declare new functions.
13391         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13392         Change all callers.
13393         (Symbol::init_base_output_data): Likewise.
13394         (Symbol::init_base_output_segment): Likewise.
13395         (Symbol::init_base_constant): Likewise.
13396         (Symbol::init_base_undefined): New function.
13397         (Sized_symbol::init_object): Rename from init.  Change all
13398         callers.
13399         (Sized_symbol::init_output_data): Likewise.
13400         (Sized_symbol::init_output_segment): Likewise.
13401         (Sized_symbol::init_constant): Likewise.
13402         (Sized_symbol::init_undefined): New function.
13403         (Symbol_table::add_undefined_symbols_from_command_line): New
13404         function.
13405         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13406         function.
13407         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13408         (Symbol::output_section): Likewise.
13409         (Symbol::set_output_section): Likewise.
13410         (Symbol_table::sized_finalize_symbol): Likewise.
13411         (Symbol_table::sized_write_globals): Likewise.
13412         * resolve.cc (Symbol_table::should_override): Likewise.
13413         (Symbol::override_base_with_special): Likewise.
13414
13415         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13416         symbol, change it to have default visibility.
13417         * testsuite/protected_1.cc: New file.
13418         * testsuite/protected_2.cc: New file.
13419         * testsuite/protected_3.cc: New file.
13420         * testsuite/protected_main_1.cc: New file.
13421         * testsuite/protected_main_2.cc: New file.
13422         * testsuite/protected_main_3.cc: New file.
13423         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13424         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13425         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13426         (protected_1.so): New target.
13427         (protected_1_pic.o, protected_2_pic.o): New targets.
13428         (protected_3_pic.o): New target.
13429         (check_PROGRAMS): Add protected_2.
13430         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13431         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13432         * testsuite/Makefile.in: Rebuild.
13433
13434         * options.h (DEFINE_var): Add set_user_set_##varname__.
13435         (DEFINE_bool_alias): New macro.
13436         (class General_options): Define -Bstatic using DEFINE_bool_alias
13437         rather than DEFINE_special.  Add --undefined as an alias for -z
13438         defs.
13439         * options.cc (General_options::parse_Bstatic): Remove.
13440
13441         * options.h (class General_options): Add --fatal-warnings.
13442         * main.cc (main): Implement --fatal-warnings.
13443         * errors.h (Errors::warning_count): New function.
13444
13445         * options.h (class General_options): Add -Bsymbolic-functions.
13446         * symtab.h (Symbol::is_preemptible): Check for
13447         -Bsymbolic-functions.
13448
13449 2008-05-05  Ian Lance Taylor  <iant@google.com>
13450
13451         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13452         as noVARNAME rather than no-VARNAME.
13453         (class General_options): Add option -z combreloc.
13454         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13455         get_address.
13456         (Output_reloc::sort_before) [SHT_REL]: New function.
13457         (Output_reloc::sort_before) [SHT_RELA]: New function.
13458         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13459         Sort_relocs_comparison.
13460         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13461         parameter.  Change all callers.
13462         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13463         sort_relocs parameter.  Change all callers.
13464         * output.cc (Output_reloc::get_address): New function, broken out
13465         of write_rel.
13466         (Output_reloc::write_rel): Call it.
13467         (Output_reloc::compare): New function.
13468         (Output_data_reloc_base::do_write): Optionally sort relocs.
13469
13470         * configure.ac: If targ_extra_obj is set, link it in.
13471         * configure.tgt: Initialize all variables.
13472         (x86_64*): Set targ_extra_obj and targ_extra_size.
13473         * configure: Rebuild.
13474
13475         * object.cc (Sized_relobj::include_section_group): Adjust section
13476         indexes read from group data.  Build vector to pass to
13477         layout_group.
13478         * layout.cc (Layout::layout_group): Add flags and shndxes
13479         parameters.  Remove contents parameter.  Change caller.  Update
13480         explicit instantiations.
13481         * layout.h (class Layout): Update layout_group declaration.
13482         * output.cc (Output_data_group::Output_data_group): Add flags and
13483         input_shndxes parameters.  Remove contents parameter.  Change
13484         caller.
13485         (Output_data_group::do_write): Change input_sections_ to
13486         input_shndxes_.
13487         * output.h (class Output_data_group): Update constructor
13488         declaration.  Rename input_sections_ to input_shndxes_.
13489         * testsuite/many_sections_test.cc: Add template.
13490
13491 2008-04-30  Cary Coutant  <ccoutant@google.com>
13492
13493         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13494
13495         * layout.cc (Layout::include_section): Refactored check for debug
13496         info section.
13497         (Layout::add_comdat): Add new parameters.  Change type
13498         of signature parameter.  Add object and shndx to signatures table.
13499         (Layout::find_kept_object): New function.
13500         * layout.h: Include <cstring>.
13501         (Layout::is_debug_info_section): New function.
13502         (Layout::add_comdat): Add new parameters.
13503         (Layout::find_kept_object): New function.
13504         (Layout::Kept_section): New struct.
13505         (Layout::Signatures): Change type of map range.
13506         * object.cc (Relobj::output_section_address): New function.
13507         (Sized_relobj::include_section_group): Add new parameters.  Change
13508         calls to Layout::add_comdat.  Change to build table of kept comdat
13509         groups and table mapping discarded sections to kept sections.
13510         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13511         (Sized_relobj::do_layout): Change calls to include_section_group and
13512         include_linkonce_section.
13513         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13514         value to zero when section is discarded.
13515         (Sized_relobj::map_to_kept_section): New function.
13516         * object.h (Relobj::output_section_address): New function.
13517         (Relobj::Comdat_group): New type.
13518         (Relobj::find_comdat_group): New function.
13519         (Relobj::Comdat_group_table): New type.
13520         (Relobj::Kept_comdat_section): New type.
13521         (Relobj::Kept_comdat_section_table): New type.
13522         (Relobj::add_comdat_group): New function.
13523         (Relobj::set_kept_comdat_section): New function.
13524         (Relobj::get_kept_comdat_section): New function.
13525         (Relobj::comdat_groups_): New field.
13526         (Relobj::kept_comdat_sections_): New field.
13527         (Symbol_value::input_value): Update comment.
13528         (Sized_relobj::map_to_kept_section) New function.
13529         (Sized_relobj::include_linkonce_section): Add new parameter.
13530         * target-reloc.h (Comdat_behavior): New type.
13531         (get_comdat_behavior): New function.
13532         (relocate_section): Add code to map a discarded section to the
13533         corresponding kept section when applying a relocation.
13534
13535 2008-04-30  Craig Silverstein  <csilvers@google.com>
13536
13537         * dwarf_reader.cc (next_generation_count): New static var.
13538         (Addr2line_cache_entry): New struct.
13539         (addr2line_cache): New static var.
13540         (Dwarf_line_info::one_addr2line): Added caching.
13541         (Dwarf_line_info::clear_addr2line_cache): New function.
13542         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13543         cache-size parameter.
13544         (Dwarf_line_info::one_addr2line_cache): New function.
13545         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13546         new cache-size argument to one_addr2line(), and clear cache.
13547
13548 2008-04-28  Cary Coutant  <ccoutant@google.com>
13549
13550         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13551         R_386_PC8 relocations.
13552
13553 2008-04-23  Ian Lance Taylor  <iant@google.com>
13554
13555         * object.cc (Sized_relobj::include_section_group): Check for
13556         invalid section group.
13557
13558         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13559         header size.
13560
13561         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13562         than read for file header.
13563         * archive.cc (Archive::include_member): Likewise.
13564
13565 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13566
13567         * aclocal.m4: Regenerate.
13568         * configure: Regenerate.
13569
13570 2008-04-19  Ian Lance Taylor  <iant@google.com>
13571
13572         * version.cc (version_string): Bump to 1.6.
13573
13574         * testsuite/Makefile.am (many_sections_r_test): New target.
13575         (many_sections_r_test_SOURCES): Remove.
13576         (many_sections_r_test_DEPENDENCIES): Remove.
13577         (many_sections_r_test_LDFLAGS): Remove.
13578         (many_sections_r_test_LDADD): Remove.
13579
13580         * object.cc (Sized_relobj::do_add_symbols): Always pass
13581         local_symbol_count_ to add_from_relobj.
13582
13583         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13584         every thousand variables.
13585         * testsuite/Makefile.in: Rebuild.
13586
13587         * object.cc (Xindex::initialize_symtab_xindex): New function.
13588         (Xindex::read_symtab_xindex): New function.
13589         (Xindex::sym_xindex_to_shndx): New function.
13590         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13591         available.
13592         (Sized_relobj::do_initialize_xindex): New function.
13593         (Sized_relobj::do_read_symbols): Adjust section links.
13594         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13595         parameter.  Change all callers.
13596         (Sized_relobj::include_section_group): Adjust section links and
13597         symbol section indexes.
13598         (Sized_relobj::do_layout): Adjust section links.
13599         (Sized_relobj::do_count_local_symbols): Adjust section links and
13600         symbol section indexes.
13601         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13602         ordinary and special symbols.
13603         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13604         dynsym_xindex parameters.  Change all callers.  Adjust section
13605         links.  Use SHN_XINDEX when needed.
13606         (Sized_relobj::get_symbol_location_info): Adjust section links.
13607         Don't get fooled by special symbols.
13608         * object.h (class Xindex): Define.
13609         (class Object): Add xindex_ parameter.  Declare virtual functoin
13610         do_initialize_xindex.
13611         (Object::adjust_sym_shndx): New function.
13612         (Object::set_xindex): New protected function.
13613         (class Symbol_value): Add is_ordinary_shndx_ field.
13614         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13615         (Symbol_value::value): Assert ordinary section.
13616         (Symbol_value::initialize_input_to_output_map): Likewise.
13617         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13618         Change all callers.
13619         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13620         all callers.
13621         (class Sized_relobj): Update declarations.
13622         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13623         parameter.  Change all callers.
13624         (Sized_relobj::adjust_shndx): New function.
13625         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13626         field.
13627         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13628         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13629         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13630         (Sized_dynobj::read_dynsym_section): Adjust section links.
13631         (Sized_dynobj::read_dynamic): Likewise.
13632         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13633         section links.
13634         (Sized_dynobj::do_initialize_xindex): New function.
13635         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13636         do_initialize_xindex.
13637         (Sized_dynobj::adjust_shndx): New function.
13638         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13639         dynsym_xindex_ fields.
13640         (Layout::finalize): Add a call to set_section_indexes before
13641         creating the symtab sections.
13642         (Layout::set_section_indexes): Don't do anything if the section
13643         already has a section index.
13644         (Layout::create_symtab_sections): Add shnum parameter.  Change
13645         caller.  Create .symtab_shndx section if needed.
13646         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13647         caller.
13648         (Layout::allocated_output_section_count): New function.
13649         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13650         needed.
13651         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13652         fields.  Update declarations.
13653         (Layout::symtab_xindex): New function.
13654         (Layout::dynsym_xindex): New function.
13655         (class Write_symbols_task): Add layout_ field.
13656         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13657         Change caller.
13658         * output.cc (Output_section_headers::Output_section_headers): Add
13659         shstrtab_section parameter.  Change all callers.
13660         (Output_section_headers::do_sized_write): Store overflow values
13661         for section count and section string table section index in
13662         section header zero.
13663         (Output_file_header::do_sized_write): Check for overflow of
13664         section count and section string table section index.
13665         (Output_symtab_xindex::do_write): New function.
13666         (Output_symtab_xindex::endian_do_write): New function.
13667         * output.h (class Output_section_headers): Add shstrtab_section_.
13668         Update declarations.
13669         (class Output_symtab_xindex): Define.
13670         (Output_section::has_out_shndx): New function.
13671         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13672         field.
13673         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13674         Change all callers.
13675         (Sized_symbol::init): Likewise.
13676         (Symbol::output_section): Check for ordinary symbol.
13677         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13678         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13679         callers.
13680         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13681         Change all callers.  Simplify handling of symbols from sections
13682         not included in the link.
13683         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13684         distinction.
13685         (Weak_alias_sorter::operator()): Assert that symbols are
13686         ordinary.
13687         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13688         distinction.
13689         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13690         parameters.  Change all callers.
13691         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13692         symbol distinction.  Use SHN_XINDEX when needed.
13693         (Symbol_table::write_section_symbol): Add symtab_xindex
13694         parameter.  Change all callers.
13695         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13696         SHN_XINDEX when needed.
13697         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13698         declarations.
13699         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13700         (Symbol::is_defined): Check is_ordinary.
13701         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13702         (Symbol::is_absolute, Symbol::is_common): Likewise.
13703         (class Sized_symbol): Update declarations.
13704         (class Symbol_table): Update declarations.
13705         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13706         parameters.  Change all callers.
13707         (Sized_symbol::override): Likewise.
13708         (Symbol_table::override): Likewise.
13709         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13710         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13711         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13712         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13713         to be in an ordinary section.
13714         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13715         object and is_ordinary parameters.  Change all callers.
13716         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13717         Change all callers.  Don't add undefined or non-ordinary symbols
13718         to reloc_map_.
13719         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13720         Change all callers.
13721         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13722         declarations.
13723         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13724         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13725         (Sized_relobj::relocate_sections): Likewise.
13726         * target-reloc.h (scan_relocs): Adjust section symbol index.
13727         (scan_relocatable_relocs): Likewise.
13728         * i386.cc (Scan::local): Check for ordinary symbols.
13729         * sparc.cc (Scan::local): Likewise.
13730         * x86_64.cc (Scan::local): Likewise.
13731         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13732         to symbol_section_and_value.
13733         * testsuite/many_sections_test.cc: New file.
13734         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13735         (check_PROGRAMS): Add many_sections_test.
13736         (many_sections_test_SOURCES): Define.
13737         (many_sections_test_DEPENDENCIES): Define.
13738         (many_sections_test_LDFLAGS): Define.
13739         (BUILT_SOURCES): Add many_sections_define.h.
13740         (many_sections_define.h): New target.
13741         (BUILT_SOURCES): Add many_sections_check.h.
13742         (many_sections_check.h): New target.
13743         (check_PROGRAMS): Add many_sections_r_test.
13744         (many_sections_r_test_SOURCES): Define.
13745         (many_sections_r_test_DEPENDENCIES): Define.
13746         (many_sections_r_test_LDFLAGS): Define.
13747         (many_sections_r_test_LDADD): Define.
13748         (many_sections_r_test.o): New target.
13749         * testsuite/Makefile.in: Rebuild.
13750
13751 2008-04-17  Cary Coutant  <ccoutant@google.com>
13752
13753         * errors.cc (Errors::info): New function.
13754         (gold_info): New function.
13755         * errors.h (Errors::info): New function.
13756         * gold.h (gold_info): New function.
13757         * object.cc (Input_objects::add_object): Print trace output.
13758         * options.cc (options::parse_set): New function.
13759         (General_options::parse_wrap): Deleted.
13760         (General_options::General_options): Deleted initializer.
13761         * options.h (options::String_set): New typedef.
13762         (options::parse_set): New function.
13763         (DEFINE_set): New macro.
13764         (General_options::wrap): Changed to use DEFINE_set. Changed
13765         callers of any_wrap_symbols and is_wrap_symbol.
13766         (General_options::trace, General_options::trace_symbol):
13767         New options.
13768         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13769         (General_options::wrap_symbols_): Deleted.
13770         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13771
13772 2008-04-17  David S. Miller  <davem@davemloft.net>
13773
13774         * options.cc (General_options::parse_V): New function.
13775         * options.h: Add entries for -V and -Qy.
13776
13777 2008-04-17  Ian Lance Taylor  <iant@google.com>
13778
13779         * common.cc (Symbol_table::allocate_commons): Remove options
13780         parameter.  Change caller.
13781         (Symbol_table::do_allocate_commons): Remove options parameter.
13782         Change caller.  Just call do_allocate_commons_list twice.
13783         (Symbol_table::do_allocate_commons_list): New function, broken out
13784         of do_allocate_commons.
13785         * common.h (class Allocate_commons_task): Remove options_ field.
13786         Update constructor.
13787         * symtab.cc (Symbol_table::Symbol_table): Initialize
13788         tls_commons_.
13789         (Symbol_table::add_from_object): Put TLS common symbols on
13790         tls_commons_ list.
13791         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13792         which are IN_OUTPUT_DATA.
13793         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13794         allocate_commons and do_allocate_commons declarations.  Declare
13795         do_allocate_commons_list.
13796         * gold.cc (queue_middle_tasks): Update creation of
13797         Allocate_commons_task to not pass options.
13798         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13799         (TLS_TEST_C_FLAGS): New variable.
13800         (tls_test_c_pic.o): New target.
13801         (tls_test_shared.so): Link in tls_test_c_pic.o.
13802         (tls_test_c_pic_ie.o): New target.
13803         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13804         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13805         (tls_test_c.o): New target.
13806         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13807         (tls_pic_test_LDADD): Likewise.
13808         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13809         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13810         (tls_test_c_gnu2.o): New target.
13811         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13812         tls_test_c_gnu2.o.
13813         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13814         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13815         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13816         * testsuite/tls_test.cc: Include "config.h".
13817         (t_last): Call t11_last.
13818         * testsuite/tls_test.h (t11, t11_last): Declare.
13819         * testsuite/tls_test_c.c: New file.
13820         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13821         * configure.ac: Check for OpenMP support.
13822         * configure, config.in, Makefile.in: Rebuild.
13823         * testsuite/Makefile.in: Rebuild.
13824
13825 2008-04-16  Cary Coutant  <ccoutant@google.com>
13826
13827         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13828         (Target_i386::tls_base_symbol_defined_): New field.
13829         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13830         (Target_i386::Scan::global): Likewise.
13831         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13832         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13833         (Target_x86_64::tls_base_symbol_defined_): New field.
13834         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13835         (Target_x86_64::Scan::global): Likewise.
13836
13837 2008-04-16  Cary Coutant  <ccoutant@google.com>
13838
13839         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13840         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13841         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13842         building shared libraries.
13843         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13844         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13845         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13846         * testsuite/Makefile.in: Rebuild.
13847         * testsuite/weak_undef.h: New file.
13848         * testsuite/weak_undef_file1.cc: Add extra test cases.
13849         * testsuite/weak_undef_file2.cc: Likewise.
13850         * testsuite/weak_undef_test.cc: Likewise.
13851
13852 2008-04-16  David S. Miller  <davem@davemloft.net>
13853
13854         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13855         Add issued_non_pic_error_ field.  Declare check_non_pic.
13856         (Target_sparc::Scan::check_non_pic): New function.
13857         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13858         (Target_sparc::Scan::global): Likewise.
13859
13860         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13861         * configure: Rebuild.
13862
13863         * options.h (DEFINE_enable): New macro.
13864         (new_dtags): New enable option.
13865         (initfirst, interpose, loadfltr, nodefaultlib,
13866         nodelete, nodlopen, nodump): New -z options.
13867         * layout.cc (Layout:finish_dynamic_section): If new
13868         dtags enabled, emit DT_RUNPATH.  Also, emit a
13869         DT_FLAGS_1 containing any specified -z flags.
13870
13871 2008-04-16  Ian Lance Taylor  <iant@google.com>
13872
13873         * copy-relocs.cc: New file.
13874         * copy-relocs.h: New file.
13875         * reloc.cc: Remove Copy_relocs code.
13876         * reloc.h: Likewise.
13877         * reloc-types.h (struct Reloc_types) [both versions]: Add
13878         get_reloc_addend_noerror.
13879         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13880         variants of add_global which take an addend which must be zero.
13881         * i386.cc: Include "copy-relocs.h".
13882         (class Target_i386): Change type of copy_relocs_ to variable,
13883         update initializer.
13884         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13885         Change all callers.
13886         (Target_i386::do_finalize_sections): Change handling of
13887         copy_relocs_.
13888         * sparc.cc: Include "copy-relocs.h".
13889         (class Target_sparc): Change type of copy_relocs_ to variable,
13890         update initializer.
13891         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13892         Change all callers.
13893         (Target_sparc::do_finalize_sections): Change handling of
13894         copy_relocs_.
13895         * x86_64.cc: Include "copy-relocs.h".
13896         (class Target_x86_64): Change type of copy_relocs_ to variable,
13897         update initializer.
13898         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13899         class.  Change all callers.
13900         (Target_x86_64::do_finalize_sections): Change handling of
13901         copy_relocs_.
13902         * Makefile.am (CCFILES): Add copy-relocs.cc.
13903         (HFILES): Add copy-relocs.h.
13904
13905         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13906
13907         * testsuite/script_test_4.sh: Permit leading zeroes.
13908
13909 2008-04-15  Ian Lance Taylor  <iant@google.com>
13910
13911         * script-sections.cc (Script_sections::create_segments): Use
13912         header_size_adjustment even when there is enough room for the
13913         headers.
13914         * testsuite/script_test_4.sh: New file.
13915         * testsuite/script_test_4.t: New file.
13916         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13917         (check_DATA): Add script_test_4.stdout.
13918         (MOSTLYCLEANFILES): Likewise.
13919         (script_test_4): New target.
13920         (script_test_4.stdout): New target.
13921         * testsuite/Makefile.in: Rebuild.
13922
13923         * sparc.cc: Add definitions for Output_data_plt_sparc class
13924         constants.
13925
13926 2008-04-14  David S. Miller  <davem@davemloft.net>
13927
13928         * sparc.cc: New file.
13929         * Makefile.am (TARGETSOURCES): Add sparc.cc
13930         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13931         * configure.tgt: Document targ_extra_size and
13932         targ_extra_big_endian.  Add entries for sparc-* and
13933         sparc64-*.
13934         * configure.ac: Handle targ_extra_size and
13935         targ_extra_big_endian.
13936         * Makefile.in: Rebuild.
13937         * configure: Likewise.
13938         * po/POTFILES.in: Likewise.
13939         * po/gold.pot: Likewise.
13940
13941 2008-04-14  Ian Lance Taylor  <iant@google.com>
13942
13943         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13944         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13945         in the name/type/flags to section mapping.  Don't call
13946         allocate_output_section.
13947         (Layout::choose_output_section): Change parameter from adjust_name
13948         to is_input_section.  Don't permit input sections after sections
13949         are attached to segments.  Don't call allocate_output_section.
13950         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13951         not write_enable_output_section.
13952         (Layout::make_output_section): Don't push to
13953         unattached_section_list_ nor call attach_to_segment.  Call
13954         attach_section_to_segment if sections are attached.
13955         (Layout::attach_sections_to_segments): New function.
13956         (Layout::attach_section_to_segment): New function.
13957         (Layout::attach_allocated_section_to_segment): Rename from
13958         attach_to_segment.  Remove flags parameter.
13959         (Layout::allocate_output_section): Remove function.
13960         (Layout::write_enable_output_section): Remove function.
13961         * layout.h (class Layout): Update for above changes.  Add new
13962         field sections_are_attached_.
13963         * output.h (Output_section::update_flags_for_input_section): New
13964         function.
13965         * output.cc (Output_section::add_input_section): Call
13966         update_flags_for_input_section.
13967         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13968
13969 2008-04-11  Cary Coutant  <ccoutant@google.com>
13970
13971         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13972         thought unnecessary.
13973         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13974
13975 2008-04-11  Ian Lance Taylor  <iant@google.com>
13976
13977         * output.h (class Output_section_data): Remove inline definition
13978         of set_addralign.
13979         * output.cc (Output_section_data::set_addralign): New function.
13980
13981 2008-04-11  Cary Coutant  <ccoutant@google.com>
13982
13983         Add support for TLS descriptors for i386 and x86_64.
13984         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13985         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13986         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13987         GOT_TYPE_TLS_DESC.
13988         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13989         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13990         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13991         relocations.
13992         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13993         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13994         Fix problem with initial-exec relocations.
13995         (Target_i386::Relocate::relocate_tls): Likewise.
13996         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13997         relaxation.
13998         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13999         support for section-plus-offset dynamic table entries.
14000         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14001         (Output_data_dynamic::Dynamic_entry): Add support for
14002         section-plus-offset dynamic table entries.
14003         (Output_data_dynamic::Classification): Likewise.
14004         (Output_data_dynamic::classification_): Renamed offset_.
14005         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14006         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14007         (Target_x86_64::make_plt_section): New function.
14008         (Target_x86_64::reserve_tlsdesc_entries): New function.
14009         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14010         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14011         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14012         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14013         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14014         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14015         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14016         add extra PLT entry for TLS descriptors.
14017         (Output_data_plt_x86_64::got_): New field.
14018         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14019         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14020         fields.
14021         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14022         descriptors.
14023         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14024         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14025         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14026         R_386_TLS_DESC_CALL relocations.
14027         (Target_x86_64::Scan::global): Likewise.
14028         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14029         for TLS descriptors.
14030         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14031         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14032         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14033         GD-to-IE relaxation.
14034         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14035         and TLS_DESCRIPTORS.
14036         * Makefile.in: Rebuild.
14037         * configure: Rebuild.
14038         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14039         (tls_test_shared2.so): New target.
14040         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14041         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14042         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14043         (tls_shared_gd_to_ie_test_LDADD): New variable.
14044         (tls_shared_gnu2_gd_to_ie_test): New target.
14045         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14046         New targets.
14047         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14048         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14049         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14050         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14051         (tls_shared_gnu2_test): New target.
14052         (tls_test_gnu2_shared.so): New target.
14053         (tls_shared_gnu2_test_SOURCES): New variable.
14054         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14055         (tls_shared_gnu2_test_LDFLAGS): New variable.
14056         (tls_shared_gnu2_test_LDADD): New variable.
14057         * testsuite/Makefile.in: Rebuild.
14058         * testsuite/Makefile.
14059
14060 2008-04-11  Ian Lance Taylor  <iant@google.com>
14061
14062         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14063         justsyms.t.
14064         * testsuite/Makefile.in: Rebuild.
14065
14066         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14067         long.
14068         * testsuite/script_test_2.cc (main): Adjust test.
14069
14070 2008-04-11  David S. Miller  <davem@davemloft.net>
14071             Ian Lance Taylor  <iant@google.com>
14072
14073         * options.h (General_options): Add entries for '-Y' and
14074         '-relax'.
14075         * options.cc (General_options:finalize): If -Y was used, add those
14076         entries to the library path instead of the default "/lib" and
14077         "/usr/lib".
14078
14079 2008-04-11  David S. Miller  <davem@davemloft.net>
14080
14081         * testsuite/justsyms.t: Start at 0x100.
14082         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14083         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14084         long.
14085         * testsuite/script_test_2.cc: Adjust string and section length
14086         checks.
14087
14088 2008-04-09  Ian Lance Taylor  <iant@google.com>
14089
14090         PR gold/5996
14091         * script-sections.cc (Sections_element::allocate_to_segment): Add
14092         orphan parameter.
14093         (Output_section_definition::allocate_to_segment): Likewise.
14094         (Orphan_output_section::allocate_to_segment): Likewise.
14095         (Script_sections::attach_sections_using_phdrs_clause): Don't
14096         propagate non-PT_LOAD segments to orphan sections.
14097         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14098         readelf rather than objdump.
14099         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14100         .interp section and PT_INTERP segment are the same size.
14101         * testsuite/Makefile.in: Rebuild.
14102
14103         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14104         aliases for symbols defined in the same object.
14105         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14106         (weak_alias_test_SOURCES): New variable.
14107         (weak_alias_test_DEPENDENCIES): New variable.
14108         (weak_alias_test_LDFLAGS): New variable.
14109         (weak_alias_test_LDADD): New variable.
14110         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14111         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14112         (weak_alias_test_3.o): New target.
14113         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14114         * testsuite/weak_alias_test_main.cc: New file.
14115         * testsuite/weak_alias_test_1.cc: New file.
14116         * testsuite/weak_alias_test_2.cc: New file.
14117         * testsuite/weak_alias_test_3.cc: New file.
14118
14119 2008-04-08  Ian Lance Taylor  <iant@google.com>
14120
14121         * options.h (class General_options): Add --noinhibit-exec option.
14122         * main.cc (main): Check --noinhibit-exec.
14123
14124         * options.h (class General_options): Define --wrap as a special
14125         option.  Add wrap_symbols_ field.
14126         (General_options::any_wrap_symbols): New function.
14127         (General_options::is_wrap_symbol): New function.
14128         * options.cc (General_options::parse_wrap): New function.
14129         (General_options::General_options): Initialize wrap_symbols_.
14130         * symtab.cc (Symbol_table::wrap_symbol): New function.
14131         (Symbol_table::add_from_object): Handle --wrap.
14132         * symtab.h (class Symbol_table): Declare wrap_symbol.
14133         * target.h (Target::wrap_char): New function.
14134         (Target::Target_info): Add wrap_char field.
14135         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14136         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14137         * testsuite/testfile.cc (Target_test::test_target_info):
14138         Likewise.
14139
14140         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14141         there is one.
14142
14143         * layout.h (class Layout): Add added_eh_frame_data_ field.
14144         * layout.cc (Layout::Layout): Initialize new field.
14145         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14146         output section until we find a section we merged successfully.
14147         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14148         that the size be non-zero.
14149
14150         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14151         qualifier.
14152
14153 2008-04-08  Craig Silverstein  <csilvers@google.com>
14154
14155         * configure.ac: Export new conditional variable HAVE_ZLIB.
14156         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14157         on HAVE_ZLIB.
14158         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14159         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14160
14161 2008-04-07  Ian Lance Taylor  <iant@google.com>
14162
14163         * version.cc (version_string): Set to "1.5".
14164
14165         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14166         Add issued_non_pic_error_ field.  Declare check_non_pic.
14167         (Target_x86_64::Scan::check_non_pic): New function.
14168         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14169         (Target_x86_64::Scan::global): Likewise.
14170
14171         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14172         addend parameter.  Change caller.  Handle merge sections.
14173         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14174         Address to Addend.  Don't add in the result of
14175         local_section_offset, pass down the addend and use the returned
14176         value.
14177         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14178         Update declarations of local_section_offset and symbol_value.
14179         * testsuite/two_file_test_1.cc (t18): New function.
14180         * testsuite/two_file_test_2.cc (f18): New function.
14181         * testsuite/two_file_test_main.cc (main): Call t18.
14182         * testsuite/two_file_test.h (t18, f18): Declare.
14183
14184         * configure.ac: Don't test for objdump, c++filt, or readelf.
14185         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14186         conditionals.
14187         (TEST_READELF): New variable.
14188         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14189         (check_PROGRAMS): Add two_file_strip_test.
14190         (two_file_strip_test): New target.
14191         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14192         (two_file_same_shared_strip_test_SOURCES): New variable.
14193         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14194         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14195         (two_file_same_shared_strip_test_LDADD): New variable.
14196         (two_file_shared_strip.so): New target.
14197         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14198         (ver_test_5.syms, ver_test_7.syms): Likewise.
14199         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14200         (strip_test_3.stdout): Use TEST_OBJDUMP.
14201         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14202
14203 2008-04-04  Cary Coutant  <ccoutant@google.com>
14204
14205         * symtab.h (Symbol::is_weak_undefined): New function.
14206         (Symbol::is_strong_undefined): New function.
14207         (Symbol::is_absolute): New function.
14208         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14209         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14210         absolute symbols.
14211         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14212         (weak_undef_test): New target.
14213         * testsuite/Makefile.in: Rebuild.
14214         * testsuite/weak_undef_file1.cc: New file.
14215         * testsuite/weak_undef_file2.cc: New file.
14216         * testsuite/weak_undef_test.cc: New file.
14217
14218 2008-04-03  Craig Silverstein  <csilvers@google.com>
14219
14220         * compressed_output.h (class Output_compressed_section): Use
14221         unsigned buffer.
14222         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14223         add zlib header.
14224         (zlib_compressed_suffix): Removed.
14225         (Output_compressed_section::set_final_data_size): Use unsigned
14226         buffers.
14227         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14228         Fix linker invocation.
14229         (flagstest_o_specialfile_and_compress_debug_sections):
14230         Likewise.
14231         * testsuite/Makefile.in: Regenerated.
14232
14233 2008-04-02  David S. Miller  <davem@davemloft.net>
14234
14235         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14236         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14237
14238 2008-04-02  Craig Silverstein  <csilvers@google.com>
14239
14240         * TODO: New file.
14241
14242 2008-04-02  Ian Lance Taylor  <iant@google.com>
14243
14244         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14245         parameters.  Update for new key type to views_.  Change all
14246         callers.
14247         (File_read::read): Adjust for byteshift in returned view.
14248         (File_read::add_view): New function, broken out of
14249         find_and_make_view.
14250         (File_read::make_view): New function, broken out of
14251         find_and_make_view.
14252         (File_read::find_or_make_view): Add offset and aligned
14253         parameters.  Rewrite accordingly.  Change all callers.
14254         (File_read::get_view): Add offset and aligned parameters.  Adjust
14255         for byteshift in return value.
14256         (File_read::get_lasting_view): Likewise.
14257         * fileread.h (class File_read): Update declarations.
14258         (class File_read::View): Add byteshift_ field.  Add byteshift to
14259         constructor.  Add byteshift method.
14260         * archive.h (Archive::clear_uncached_views): New function.
14261         (Archive::get_view): Add aligned parameter.  Change all callers.
14262         * object.h (Object::get_view): Add aligned parameter.  Change all
14263         callers.
14264         (Object::get_lasting_view): Likewise.
14265
14266         * fileread.cc (File_read::release): Don't call clear_views if
14267         there are multiple objects.
14268         * fileread.h (File_read::clear_uncached_views): New function.
14269         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14270         on the archive.
14271
14272 2008-03-31  Cary Coutant  <ccoutant@google.com>
14273
14274         Add thin archive support.
14275         * archive.cc (Archive::armagt): New const.
14276         (Archive::setup): Remove task parameter and calls to unlock.
14277         (Archive::unlock_nested_archives): New function.
14278         (Archive::read_header): Add nested_off parameter. Change
14279         all callers.
14280         (Archive::interpret_header): Likewise.
14281         (Archive::include_all_members): Change to handle thin
14282         archives.
14283         (Archive::include_member): Likewise.
14284         * archive.h (Archive::Archive): Add new parameters and
14285         initializers.
14286         (Archive::armagt): New const.
14287         (Archive::setup): Remove task parameter.
14288         (Archive::unlock_nested_archives): New function.
14289         (Archive::read_header): Add nested_off parameter.
14290         (Archive::interpret_header): Likewise.
14291         (Archive::Nested_archive_table): New typedef.
14292         (Archive::is_thin_archive_): New field.
14293         (Archive::nested_archives_): New field.
14294         (Archive::options_): New field.
14295         (Archive::dirpath_): New field.
14296         (Archive::task_): New field.
14297         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14298         for thin archives.  Pass additional parameters to
14299         Archive::Archive.  Unlock the archive file after calling
14300         Archive::setup.
14301
14302 2008-03-29  Ian Lance Taylor  <iant@google.com>
14303
14304         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14305         version symbol to be local.
14306         * testsuite/ver_test_4.sh: New file.
14307         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14308         (check_DATA): Add ver_test_4.syms.
14309         (ver_test_4.syms): New target.
14310         * testsuite/Makefile.in: Rebuild.
14311
14312         * output.cc
14313         (Output_section::Input_section_sort_entry::has_priority): New
14314         function.
14315         (Output_section::Input_section_sort_entry::match_file_name): New
14316         function.
14317         (Output_section::Input_section_sort_entry::match_section_name):
14318         Remove.
14319         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14320         Remove.
14321         (Output_section::Input_section_sort_entry::match_section_file):
14322         Remove.
14323         (Output_section::Input_section_sort_compare::operator()): Rewrite
14324         using new Input_section_sort_entry functions.  Sort crtbegin and
14325         crtend first.  Sort sections with no priority before sections with
14326         a priority.
14327         * testsuite/initpri1.c (d3): Check j != 4.
14328         (cd5): New constructor/destructor function.
14329         (main): Check j != 2.
14330
14331         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14332         new symbol when resolving, don't call set_is_default.
14333         * testsuite/ver_test_7.cc: New file.
14334         * testsuite/ver_test_7.sh: New file.
14335         * testsuite/Makefile.am (ver_test_7.so): New target.
14336         (ver_test_7.o): New target.
14337         (check_SCRIPTS): Add ver_test_7.sh.
14338         (check_DATA): Add ver_test_7.syms.
14339         (ver_test_7.syms): New target.
14340
14341 2008-03-28  Ian Lance Taylor  <iant@google.com>
14342
14343         * layout.cc (Layout::layout): If we see an input section with a
14344         name that needs sorting, set the must_sort flag for the output
14345         section.
14346         (Layout::make_output_section): If the name of the output section
14347         indicates that it might require sorting, set the may_sort flag.
14348         * output.h (Output_section::may_sort_attached_input_sections): New
14349         function.
14350         (Output_section::set_may_sort_attached_input_sections): New
14351         function.
14352         (Output_section::must_sort_attached_input_sections): New
14353         function.
14354         (Output_section::set_must_sort_attached_input_sections): New
14355         function.
14356         (class Output_section): Declare Input_section_sort_entry.  Define
14357         Input_section_sort_compare.  Declare
14358         sort_attached_input_sections.  Add new fields:
14359         may_sort_attached_input_sections_,
14360         must_sort_attached_input_sections_,
14361         attached_input_sections_are_sorted_.
14362         * output.cc (Output_section::Output_section): Initialize new
14363         fields.
14364         (Output_section::add_input_section): Add an entry to
14365         input_sections_ if may_sort or must_sort are true.
14366         (Output_section::set_final_data_size): Call
14367         sort_attached_input_sections if necessary.
14368         (Output_section::Input_section_sort_entry): Define new class.
14369         (Output_section::Input_section_sort_compare::operator()): New
14370         function.
14371         (Output_section::sort_attached_input_sections): New function.
14372         * configure.ac: Check whether the compiler supports constructor
14373         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14374         * testsuite/initpri1.c: New file.
14375         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14376         CONSTRUCTOR_PRIORITY.
14377         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14378         (initpri1_LDFLAGS): New variable.
14379         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14380
14381 2008-03-27  Ian Lance Taylor  <iant@google.com>
14382
14383         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14384         * testsuite/common_test_1.c: New file.
14385         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14386         (common_test_1_SOURCES): New variable.
14387         (common_test_1_DEPENDENCIES): New variable.
14388         (common_test_1_LDFLAGS): New variable.
14389
14390         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14391         and commons_ correctly when NAME/VERSION does not override
14392         NAME/NULL.
14393         * testsuite/ver_test_6.c: New file.
14394         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14395         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14396         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14397
14398 2008-03-26  Ian Lance Taylor  <iant@google.com>
14399
14400         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14401         of an undefined symbol from a version script.
14402         * testsuite/Makefile.am (ver_test_5.so): New target.
14403         (ver_test_5.o): New target.
14404         (check_SCRIPTS): Add ver_test_5.sh.
14405         (check_DATA): Add ver_test_5.syms.
14406         (ver_test_5.syms): New target.
14407         * testsuite/ver_test_5.cc: New file.
14408         * testsuite/ver_test_5.script: New file.
14409         * testsuite/ver_test_5.sh: New file.
14410         * Makefile.in, testsuite/Makefile.in: Rebuild.
14411
14412         PR gold/5986
14413         Fix problems building gold with gcc 4.3.0.
14414         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14415         (gold_error_at_location, gold_warning_at_location): Use it.
14416         * configure.ac: Check whether we can compile and use a template
14417         function with a printf attribute.
14418         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14419         when jumping over bytes.
14420         * object.cc: Instantiate Object::read_section_data.
14421         * debug.h: Include <cstring>
14422         * dwarf_reader.cc: Include <algorithm>
14423         * main.cc: Include <cstring>.
14424         * options.cc: Include <cstring>.
14425         * output.cc: Include <cstring>.
14426         * script.cc: Include <cstring>.
14427         * script.h: Include <string>.
14428         * symtab.cc: Include <cstring> and <algorithm>.
14429         * target-select.cc: Include <cstring>.
14430         * version.cc: Include <string>.
14431         * testsuite/testmain.cc: Include <cstdlib>.
14432         * configure, config.in: Rebuild.
14433
14434 2008-03-25  Ian Lance Taylor  <iant@google.com>
14435
14436         * options.cc: Include "../bfd/bfdver.h".
14437         (options::help): Print bug reporting address.
14438
14439         * version.cc (print_version): Adjust output for current value of
14440         BFD_VERSION_STRING.
14441
14442         * NEWS: New file.
14443
14444         * options.cc (options::help): Print list of supported targets.
14445         * target-select.h: Include <vector>.
14446         (class Target_selector): Make machine_, size_, and is_big_endian_
14447         fields const.  Add bfd_name_ and instantiated_target_ fields.
14448         (Target_selector::Target_selector): Add bfd_name parameter.
14449         (Target_selector::recognize): Make non-virtual, call
14450         do_recognize.
14451         (Target_selector::recognize_by_name): Make non-virtual, call
14452         do_recognize_by_name.
14453         (Target_selector::supported_names): New function.
14454         (Target_selector::bfd_name): New function.
14455         (Target_selector::do_instantiate_target): New pure virtual
14456         function.
14457         (Target_selector::do_recognize): New virtual function.
14458         (Target_selector::do_recognize_by_name): New virtual function.
14459         (Target_selector::instantiate_target): New private function.
14460         (supported_target_names): Declare.
14461         * target-select.cc (Target_selector::Target_selector): Update for
14462         new parameter and fields.
14463         (select_target_by_name): Check that the name matches before
14464         calling recognize_by_name.
14465         (supported_target_names): New function.
14466         * i386.cc (class Target_selector_i386): Update Target_selector
14467         constructor call.  Remove recognize and recognize_by_name.  Add
14468         do_instantiate_target.
14469         * x86_64.cc (class Target_selector_x86_64): Likewise.
14470         * testsuite/testfile.cc (class Target_selector_test): Update for
14471         changes to Target_selector.
14472
14473         * README: Rewrite, with some notes on unsupported features.
14474
14475 2008-03-24  Cary Coutant  <ccoutant@google.com>
14476
14477         * i386.cc (Target_i386::Got_type): New enum declaration.
14478         (Target_i386::Scan::local): Updated callers of Output_data_got
14479         member functions.
14480         (Target_i386::Scan::global): Likewise.
14481         (Target_i386::Relocate::relocate): Likewise.
14482         (Target_i386::Relocate::relocate_tls): Likewise.
14483         * object.h (Got_offset_list): New class.
14484         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14485         (Sized_relobj::local_got_offset): Likewise.
14486         (Sized_relobj::set_local_got_offset): Likewise.
14487         (Sized_relobj::local_has_tls_got_offset): Removed.
14488         (Sized_relobj::local_tls_got_offset): Removed.
14489         (Sized_relobj::set_local_tls_got_offset): Removed.
14490         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14491         * output.cc (Output_data_got::add_global): Added got_type parameter.
14492         (Output_data_got::add_global_with_rel): Likewise.
14493         (Output_data_got::add_global_with_rela): Likewise.
14494         (Output_data_got::add_global_pair_with_rel): New function.
14495         (Output_data_got::add_global_pair_with_rela): New function.
14496         (Output_data_got::add_local): Added got_type parameter.
14497         (Output_data_got::add_local_with_rel): Likewise.
14498         (Output_data_got::add_local_with_rela): Likewise.
14499         (Output_data_got::add_local_pair_with_rel): New function.
14500         (Output_data_got::add_local_pair_with_rela): New function.
14501         (Output_data_got::add_global_tls): Removed.
14502         (Output_data_got::add_global_tls_with_rel): Removed.
14503         (Output_data_got::add_global_tls_with_rela): Removed.
14504         (Output_data_got::add_local_tls): Removed.
14505         (Output_data_got::add_local_tls_with_rel): Removed.
14506         (Output_data_got::add_local_tls_with_rela): Removed.
14507         * output.h (Output_data_got::add_global): Added got_type parameter.
14508         (Output_data_got::add_global_with_rel): Likewise.
14509         (Output_data_got::add_global_with_rela): Likewise.
14510         (Output_data_got::add_global_pair_with_rel): New function.
14511         (Output_data_got::add_global_pair_with_rela): New function.
14512         (Output_data_got::add_local): Added got_type parameter.
14513         (Output_data_got::add_local_with_rel): Likewise.
14514         (Output_data_got::add_local_with_rela): Likewise.
14515         (Output_data_got::add_local_pair_with_rel): New function.
14516         (Output_data_got::add_local_pair_with_rela): New function.
14517         (Output_data_got::add_global_tls): Removed.
14518         (Output_data_got::add_global_tls_with_rel): Removed.
14519         (Output_data_got::add_global_tls_with_rela): Removed.
14520         (Output_data_got::add_local_tls): Removed.
14521         (Output_data_got::add_local_tls_with_rel): Removed.
14522         (Output_data_got::add_local_tls_with_rela): Removed.
14523         * resolve.cc (Symbol::override_base_with_special): Removed
14524         reference to has_got_offset_ field.
14525         * symtab.cc (Symbol::init_fields): Replaced initialization
14526         of got_offset_ with got_offsets_.  Removed initialization
14527         of has_got_offset_
14528         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14529         (Symbol::got_offset): Likewise.
14530         (Symbol::set_got_offset): Likewise.
14531         (Symbol::has_tls_got_offset): Removed.
14532         (Symbol::tls_got_offset): Removed.
14533         (Symbol::set_tls_got_offset): Removed.
14534         (Symbol::got_offset_): Removed.
14535         (Symbol::tls_mod_got_offset_): Removed.
14536         (Symbol::tls_pair_got_offset_): Removed.
14537         (Symbol::got_offsets_): New field.
14538         (Symbol::has_got_offset): Removed.
14539         (Symbol::has_tls_mod_got_offset): Removed.
14540         (Symbol::has_tls_pair_got_offset): Removed.
14541         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14542         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14543         member functions.
14544         (Target_x86_64::Scan::global): Likewise.
14545         (Target_x86_64::Relocate::relocate): Likewise.
14546         (Target_x86_64::Relocate::relocate_tls): Likewise.
14547
14548 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14549
14550         * yyscript.y: Fix spelling error in comment.
14551
14552 2008-03-24  Ian Lance Taylor  <iant@google.com>
14553
14554         * options.h (class General_options): Define build_id option.
14555         * layout.h (class Layout): Declare write_build_id, create_note,
14556         create_build_id.  Add build_id_note_ member.
14557         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14558         "libiberty.h", "md5.h", "sha1.h".
14559         (Layout::Layout): Initialize eh_frame_data_,
14560         eh_frame_hdr_section_, and build_id_note_.
14561         (Layout::finalize): Call create_build_id.
14562         (Layout::create_note): New function, broken out of
14563         Layout::create_gold_note.
14564         (Layout::create_gold_note): Call create_note.
14565         (Layout::create_build_id): New function.
14566         (Layout::write_build_id): New function.
14567         (Close_task_runner::run): Call write_build_id.
14568
14569         * x86_64.cc: Correct license to GPLv3.
14570
14571 2008-03-23  Ian Lance Taylor  <iant@google.com>
14572
14573         * options.cc: Include "demangle.h".
14574         (parse_optional_string): New function.
14575         (parse_long_option): Handle takes_optional_argument.
14576         (parse_short_option): Update dash_z initializer.  Handle
14577         takes_optional_argument.
14578         (General_options::General_options): Initialize do_demangle_.
14579         (General_options::finalize): Set do_demangle_.  Handle demangling
14580         style.
14581         * options.h (parse_optional_string): Declare.
14582         (struct One_option): Add optional_arg field.  Update constructor.
14583         Update call constructor calls.  Add takes_optional_argument
14584         function.
14585         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14586         (DEFINE_optional_string): Define.
14587         (General_options::demangle): Change from DEFINE_bool to
14588         DEFINE_optional_string.
14589         (General_options::no_demangle): New function.
14590         (General_options::do_demangle): New function.
14591         (General_options::set_do_demangle): New function.
14592         (General_options::execstack_status_): Move definition to end of
14593         class definition.
14594         (General_options::static_): Likewise.
14595         (General_options::do_demangle_): New field.
14596         * object.cc (big_endian>::get_symbol_location_info): Call
14597         Options::do_demangle, not Options::demangle.
14598         * symtab.cc (demangle): Likewise.
14599
14600 2008-03-22  Ian Lance Taylor  <iant@google.com>
14601
14602         * gold.h: Include <cstddef> and <sys/types.h>
14603         * options.h: Include <cstring>.
14604
14605 2008-03-21  Ian Lance Taylor  <iant@google.com>
14606
14607         * Added source code to GNU binutils.
14608 \f
14609 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14610
14611 Copying and distribution of this file, with or without modification,
14612 are permitted in any medium without royalty provided the copyright
14613 notice and this notice are preserved.
14614
14615 Local Variables:
14616 mode: change-log
14617 left-margin: 8
14618 fill-column: 74
14619 version-control: never
14620 End: