Update gold copyright year to 2013
[external/binutils.git] / gold / ChangeLog
1 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2
3         * version.cc (print_version): Update copyright year to 2013.
4
5 2012-12-20  Ian Lance Taylor  <iant@google.com>
6
7         * layout.cc (Layout::special_ordering_of_input_section): New
8         function.
9         (Layout::layout): If input section requires special ordering, must
10         sort input sections.
11         (Layout::make_output_section): May sort .text input sections.
12         (Layout::is_section_name_prefix_grouped): Remove.
13         * layout.h (class Layout): Declare
14         special_ordering_of_input_section.  Don't declare
15         is_section_name_prefix_grouped.
16         * output.cc (Output_section::add_input_section): Revert last
17         change.
18         (Output_section::Input_section_sort::match_file_name): Don't crash
19         if called on output section data.
20         (Output_section::Input_section_sort_compare): Sort based on
21         special ordering.
22         (Output_section::Input_section_sort_section_order_index_compare):
23         Revert last patch.
24         (Output_section::sort_attached_input_sections): Likewise.
25
26 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
27
28         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
29         * layout.h (Layout::is_section_name_prefix_grouped): New function.
30         * output.cc (Output_section::add_input_section): Check if section
31         name contains special prefix.  Keep input sections to sort such
32         sections.
33         (Output_section::Input_section_sort_section_order_index_compare
34          ::operator()): Group sections according to prefixes.
35         (Output_section::sort_attached_input_sections): Add condition to
36         Input_section_entry constructor call.
37         * testsuite/Makefile.am (text_section_grouping): New test.
38         * testsuite/Makefile.in: Regenerate.
39         * testsuite/text_section_grouping.cc: New file.
40         * testsuite/text_section_grouping.sh: New file.
41
42 2012-12-17  Nick Clifton  <nickc@redhat.com>
43
44         * Makefile.am: Add copyright notice.
45         * NEWS: Likewise.
46         * README: Likewise.
47         * configure.ac: Likewise.
48         * ftruncate.c: Likewise.
49         * Makefile.in: Regenerate.
50
51 2012-12-14  Cary Coutant  <ccoutant@google.com>
52
53         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
54         --no-as-needed flag.
55         (exception_separate_shared_12_test): Likewise.
56         (incremental_copy_test): Likewise.
57         * testsuite/Makefile.in: Regenerate.
58
59 2012-12-14  Cary Coutant  <ccoutant@google.com>
60
61         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
62         (Dwp_output_file::Dwp_index::enter_set): Add assert.
63
64 2012-12-12  Alan Modra  <amodra@gmail.com>
65
66         * powerpc.cc (class Track_tls): New.
67         (class Relocate, class Scan): Inherit Track_tls.
68         (Target_powerpc::Scan::local, global): Track tls optimization
69         and avoid creating plt entry for __tls_get_addr if all uses
70         are optimized away.
71         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
72
73 2012-12-12  Alan Modra  <amodra@gmail.com>
74
75         * options.h (General_options): Add --toc-sort/--no-toc-sort.
76         Replace no_toc_optimize with toc_optimize.
77         * output.h (Output_section::input_sections): Provide non-const variant.
78         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
79         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
80         accessors.
81         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
82         (class Sort_toc_sections): New.
83         (Target_powerpc::do_finalize_sections): Sort toc sections.
84         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
85
86 2012-12-10  Roland McGrath  <mcgrathr@google.com>
87
88         * testsuite/binary_unittest.cc (read_all): New function.
89         (Sized_binary_test): Use it instead of ::read.
90         * fileread.cc (do_read): Don't assume pread always reads the whole
91         amount in a single call.
92
93 2012-12-10  Alan Modra  <amodra@gmail.com>
94
95         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
96         Set EM_PPC64 or EM_PPC here.
97         (Target_selector_powerpc::do_recognize): Delete.
98
99 2012-12-10  Alan Modra  <amodra@gmail.com>
100
101         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
102         stub_table_.
103         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
104
105 2012-12-07  Roland McGrath  <mcgrathr@google.com>
106
107         * testsuite/binary_unittest.cc (Sized_binary_test):
108         Use open_descriptor rather than ::open.
109
110 2012-12-07  Alan Modra  <amodra@gmail.com>
111
112         * powerpc.cc (Stub_table::do_write): Delete redundant Address
113         typedef and invalid_address constant.
114         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
115         instantiate constants.
116
117 2012-12-06  Roland McGrath  <mcgrathr@google.com>
118
119         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
120         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
121         * aclocal.m4: Regenerate.
122         * configure: Regenerate.
123         * Makefile.in: Regenerate.
124         * testsuite/Makefile.in: Regenerate.
125
126 2012-12-07  Alan Modra  <amodra@gmail.com>
127
128         * options.h (General_options): Add no_toc_optimize.
129         * powerpc.cc (ok_lo_toc_insn): New function.
130         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
131
132 2012-12-06  Alan Modra  <amodra@gmail.com>
133
134         * options.h (General_options): Add plt_align, plt_static_chain,
135         plt_thread_safe.  Update stub_group_size help text.
136         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
137         for new plt_thread_safe_ var.
138         (use_plt_offset): Correct comments.
139         (Target_powerpc::do_relax): Look for thread creation symbols to
140         determine default plt_thread_safe value.  Clear plt call stubs
141         as well as branch stubs each iteration.
142         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
143         insn constants.
144         (l, hi, ha, write_insn): Move earlier.
145         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
146         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
147         plt stubs too.
148         (Stub_table::update_size): Adjust.
149         (Stub_table::prev_size, set_prev_size): Delete.
150         (Stub_table::stub_align): Let --plt-align affect result.
151         (Stub_table::plt_call_size): Calculate sizes for various stubs.
152         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
153         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
154         (Stub_table::do_write): Support more stub variants.
155
156 2012-12-04  Alan Modra  <amodra@gmail.com>
157
158         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
159         (Target_powerpc::do_define_standard_symbols): New function.
160
161 2012-12-03  Alan Modra  <amodra@gmail.com>
162
163         * output.h: Formatting, whitespace.
164
165 2012-12-03  Alan Modra  <amodra@gmail.com>
166
167         * layout.h (Layout::get_executable_sections): Declare.
168         * layout.cc (Layout::get_executable_sections): New function.
169         * arm.cc (Target_arm::group_sections): Use it.
170         (Arm_output_section::group_sections): Delete now redundant test.
171         * output.cc (Output_reloc::Output_reloc): Add is_relative.
172         param to handle relative relocs.
173         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
174         (Output_data_reloc::add_absolute): Adjust.
175         (Output_data_reloc::add_relative): New function.
176         (Output_data::reset_data_size): New function.
177         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
178         (Output_section::set_addralign): New function.
179         (Output_section::checkpoint_set_addralign): New function.
180         (Output_section::clear_section_offsets_need_adjustment): New function.
181         (Output_section::input_sections): Make public.
182         * powerpc.cc (class Output_data_brlt_powerpc): New.
183         (class Stub_table, class Stub_control): New.
184         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
185         stub_table_, set_stub_table, stub_table): New vectors and accessor
186         functions.
187         (Target_powerpc::do_may_relax, do_relax, push_branch,
188         new_stub_table, stub_tables, brlt_section, group_sections,
189         add_branch_lookup_table, find_branch_lookup_table,
190         write_branch_lookup_table, make_brlt_section): New functions.
191         (Target_powerpc::struct Sort_sections, class Branch_info): New.
192         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
193         branch_info_): New vars.
194         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
195         make call stubs here.
196         (Output_data_glink): Remove all call stub handling from this class.
197         (Target_powerpc::Scan::local, global): Save interesting branch
198         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
199         (Target_powerpc::do_finalize_sections): Only make reg save/restore
200         functions on final link.
201         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
202         Handle long branch destinations too.
203         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
204         do_plt_address_for_local): Adjust lookup of plt call stubs.
205
206 2012-11-30  Alan Modra  <amodra@gmail.com>
207
208         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
209         relocs against protected symbols when building 32-bit shared libs.
210
211 2012-11-30  Alan Modra  <amodra@gmail.com>
212
213         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
214         param.  Call got_section() to make .got.  Update all callers
215         and their callers and so on.
216
217 2012-11-30  Alan Modra  <amodra@gmail.com>
218
219         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
220         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
221         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
222         value if it already exists.
223
224 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
225
226         PR gold/14858
227         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
228
229 2012-11-14  Roland McGrath  <mcgrathr@google.com>
230
231         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
232         than bfc instruction for data sandboxing.
233
234 2012-11-08  Alan Modra  <amodra@gmail.com>
235
236         * po/POTFILES.in: Regenerate.
237
238 2012-11-05  Alan Modra  <amodra@gmail.com>
239
240         * configure.ac: Apply 2012-09-10 change to config.in here.
241         * configure: Regenerate.
242
243 2012-11-05  Alan Modra  <amodra@gmail.com>
244
245         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
246         (struct Opd_ent): Use "Address" rather than "Offset".
247         (Output_data_got_powerpc::got_base_offset): Return Valtype.
248         (Target_powerpc::got_section): Make public.
249         (Target_powerpc::scan_relocs): Move code setting symbols..
250         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
251         Create _SDA_BASE_ only when referenced.
252
253 2012-11-02  Roland McGrath  <mcgrathr@google.com>
254
255         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
256         from last change.
257
258 2012-11-01  Roland McGrath  <mcgrathr@google.com>
259
260         * target.h (Sized_target::relocate_relocs): Use Elf_Off
261         for offset_in_output_section parameter.
262         (Sized_target::relocate_special_relocatable): Likewise.
263         * arm.cc (Target_arm::relocate_relocs): Likewise.
264         (Target_arm::relocate_special_relocatable): Likewise.
265         * i386.cc (Target_i386::relocate_relocs): Likewise.
266         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
267         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
268         * target-reloc.h (relocate_relocs): Likewise.
269         * testsuite/testfile.cc (Target_test): Likewise.
270         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
271         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
272
273         * system.h: Move inclusion of <clocale> to after <libintl.h> in
274         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
275
276         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
277         parameter, which is unused in the [!F_SETFD] case.
278
279         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
280         SYMNDX to off_t before comparing it to this->data_size().
281         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
282         * incremental.cc (Output_section_incremental_inputs::do_write):
283         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
284
285         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
286
287 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
288
289         * gold.cc (Target_arm::do_adjust_elf_header): Add the
290         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
291         in EABI_VER5.
292
293 2012-10-29  Cary Coutant  <ccoutant@google.com>
294
295         * dwp.cc (usage): Add file and exit status parameters;
296         add --help and --version options.
297         (print_version): New function.
298         (main): Add --help and --version options.
299
300 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
301
302         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
303         final_layout_sequence.txt.
304         * testsuite/Makefile.in: Regenerated.
305
306 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
307
308         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
309         COMPILE generated by automake.
310         (LINK1): Likewise.
311         (CXXCOMPILE1): Likewise.
312         (CXXLINK1): Likewise.
313         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
314         (LINK): Likewise.
315         (CXXCOMPILE): Likewise.
316         (CXXLINK): Likewise.
317         * testsuite/Makefile.in: Regenerated.
318
319 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
320
321         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
322         on bad fwrite return.
323
324 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
325
326         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
327         on val.
328
329 2012-10-23  Cary Coutant  <ccoutant@google.com>
330
331         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
332         * testsuite/Makefile.in: Regenerate.
333         * testsuite/dwp_test.h: New source file.
334         * testsuite/dwp_test_1.cc: New source file.
335         * testsuite/dwp_test_1.s: New source file.
336         * testsuite/dwp_test_1.sh: New source file.
337         * testsuite/dwp_test_1b.cc: New source file.
338         * testsuite/dwp_test_1b.s: New source file.
339         * testsuite/dwp_test_2.cc: New source file.
340         * testsuite/dwp_test_2.s: New source file.
341         * testsuite/dwp_test_2.sh: New source file.
342         * testsuite/dwp_test_main.cc: New source file.
343         * testsuite/dwp_test_main.s: New source file.
344
345 2012-10-23  Cary Coutant  <ccoutant@google.com>
346
347         * dwp.h: New header file.
348         * dwp.cc: New source file.
349         * gold.h: Move shared declarations to system.h.
350         * system.h: New header file.
351         * Makefile.am: Add dwp.
352         * Makefile.in: Regenerate.
353
354 2012-10-23  Cary Coutant  <ccoutant@google.com>
355
356         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
357         Dwarf_info_reader::read_from_pointer.
358         (Dwarf_pubnames_table::read_header): Likewise.
359         (Dwarf_pubnames_table::next_name): Likewise.
360         (Dwarf_die::read_attributes): Likewise.
361         (Dwarf_die::skip_attributes): Likewise.
362         (Dwarf_info_reader::read_from_pointer): New function template.
363         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
364         (Dwarf_pubnames_table): Likewise.
365         (Dwarf_info_reader::read_from_pointer): New function template.
366         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
367         Dwarf_pubnames_table ctor.
368
369 2012-10-23  Cary Coutant  <ccoutant@google.com>
370
371         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
372         abbrev_shndx.
373         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
374         abbrev_shndx_.
375         (Dwarf_info_reader::set_abbrev_shndx): New method.
376         (Dwarf_info_reader::abbrev_shndx_): New data member.
377
378 2012-10-23  Cary Coutant  <ccoutant@google.com>
379
380         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
381         from object, not parameters.
382         (Dwarf_info_reader::parse): Likewise.
383         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
384         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
385         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
386         methods.
387
388 2012-10-23  Cary Coutant  <ccoutant@google.com>
389
390         * fileread.cc (Input_file::Input_file): New constructor.
391         * fileread.h (class Input_file): Add new constructor.
392
393 2012-10-18  Alan Modra  <amodra@gmail.com>
394
395         PR gold/14727
396         * object.cc (Relobj::is_section_name_included): Also match
397         .sdata personality section.
398
399 2012-10-18  Alan Modra  <amodra@gmail.com>
400
401         * target-reloc.h (class Default_comdat_behavior): New, package up..
402         (get_comdat_behaviour): ..this.
403         (relocate_section): Add Relocate_comdat_behavior template arg,
404         adjust code to suit.
405         * arm.cc (Target_arm::relocate_section): Adjust to suit.
406         (Target_arm::scan_reloc_section): Likewise.
407         * i386.cc (Target_i386::relocate_section): Likewise.
408         * sparc.cc (Target_sparc::relocate_section): Likewise.
409         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
410         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
411         * powerpc.cc (class Relocate_comdat_behavior): New.
412         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
413         gold::relocate_section with new template arg.
414
415 2012-10-18  Alan Modra  <amodra@gmail.com>
416
417         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
418         dynamic relocs for GOT_TPREL got entries, without symbol if
419         resolving locally.
420         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
421         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
422         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
423
424 2012-10-17  Alan Modra  <amodra@gmail.com>
425
426         PR gold/14726
427         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
428
429 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
430
431         * layout.cc (Layout::include_section): Keep sections marked
432         SHF_EXCLUDE when doing relocatable links.
433
434 2012-10-16  Alan Modra  <amodra@gmail.com>
435
436         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
437         (Target_powerpc::do_finalize_sections): Call it.
438         (Output_data_save_res): New class and supporting functions.
439         (Target_powerpc::symval_for_branch): Only look up .opd entry for
440         normal symbols defined in object files.
441
442 2012-10-12  Alan Modra  <amodra@gmail.com>
443
444         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
445         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
446         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
447         section if scan_opd_relocs not yet called.
448         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
449
450 2012-10-12  Alan Modra  <amodra@gmail.com>
451
452         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
453         add_local_ifunc_entry): Revert last change.
454         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
455
456 2012-10-05  Alan Modra  <amodra@gmail.com>
457
458         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
459         do_plt_address_for_global): New functions.
460         (Output_data_got_powerpc::do_write): Don't segfault when linking
461         statically.
462         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
463         add_local_ifunc_entry): Return true on adding entry..
464         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
465         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
466         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
467         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
468         set up symbols here.
469         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
470         syms here.  Do so even when no .iplt.  Don't segfault when linking
471         statically.
472         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
473         new variants without reloc param.
474         (Glink_sym_ent::Glink_sym_ent): Likewise.
475         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
476         reloc when refs will resolve to plt call stub.
477         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
478         R_PPC_PLTREL24 to resolve locally.
479         (Target_powerpc::Scan::global): Correct ifunc handling.
480         (Target_powerpc::Relocate::relocate): Correct local sym glink
481         lookup.  Don't destroy "value" when we have a plt call stub,
482         and when checking plt call validity.
483         (Target_powerpc::do_dynsym_value): Simplify.
484
485 2012-10-05  Alan Modra  <amodra@gmail.com>
486
487         * i386.cc (Output_data_plt_i386::address_for_global,
488         address_for_local): Add plt offset to returned value.  Adjust uses.
489         * sparc.cc (Output_data_plt_sparc::address_for_global,
490         address_for_local): Likewise.
491         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
492         address_for_local): Likewise.
493         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
494         address_for_local): Likewise.
495         * target.h (Target::plt_address_for_global, plt_address_for_local):
496         Update comment.
497         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
498         (Output_data_got::Got_entry::write): Nor here.
499         * output.h: Comment fix.
500
501 2012-10-02  Jiong Wang  <jiwang@tilera.com>
502
503         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
504         global_offset_table_ value for larget got.
505         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
506
507 2012-09-29  Alan Modra  <amodra@gmail.com>
508
509         * powerpc.cc (Target_powerpc::iplt_): New output section.
510         (Target_powerpc::iplt_section, make_iplt_section,
511         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
512         (Target_powerpc::make_plt_entry): Handle ifunc syms.
513         Target_powerpc::plt_entry_count): Count iplt entries too.
514         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
515         reloc section in constructor.  New params.
516         (Target_powerpc::make_plt_section): Create reloc section here instead.
517         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
518         functions.
519         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
520         (Output_data_glink::add_entry, find_entry): New functions to
521         deal with local syms.
522         (Glink_sym_ent): Add support for local syms.
523         (Output_data_glink::do_write): Handle ifunc plt entries.
524         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
525         (Target_powerpc::Scan::local, global): Handle ifunc syms.
526         (Target_powerpc::Relocate::relocate): Likewise.
527         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
528
529 2012-09-25  Alan Modra  <amodra@gmail.com>
530
531         * object.h (Sized_relobj_file::adjust_local_symbol,
532         do_adjust_local_symbol): New functions.
533         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
534         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
535         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
536         and irregular opd entry spacing.
537         (Powerpc_relobj::do_read_relocs): Add opd size checks.
538         (Global_symbol_visitor_opd): New functor.
539         (Target_powerpc::do_finalize_sections): Omit global symbols defined
540         on deleted opd entries.
541
542 2012-09-15  Jiong Wang  <jiwang@tilera.com>
543
544         * tilegx.cc: New file.
545         * Makefile.am (TARGETSOURCES): Add tilegx.cc
546         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
547         * configure.tgt: Add entries for tilegx*.
548         * configure.ac: Likewise.
549         * Makefile.in: Rebuild.
550         * configure: Likewise.
551         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
552         tilegx.
553
554 2012-09-13  Alan Modra  <amodra@gmail.com>
555
556         * target-reloc.h (scan_relocs): Call scan.local for relocs
557         against symbols in discarded sections.  Pass is_discarded
558         param.
559         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
560         Add is_discarded param.
561         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
562         is_discarded to flag opd entry as discarded.  Don't emit dyn
563         relocs on such entries.
564         (Target_powerpc::Scan::global): Similarly detect and handle
565         such opd entries.
566         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
567         opd_ent_.  Update all uses.
568         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
569         (Target_powerpc::relocate_section): Zero out discarded opd
570         entry relocs.
571
572 2012-09-12  Ian Lance Taylor  <iant@google.com>
573
574         PR gold/14570
575         * output.cc: Rename Output_data_got template parameter from size
576         to got_size for all functions.  Compile all variants of
577         Output_data_got.
578         (Output_data_got::Got_entry::write): Correct use of size for
579         symbol value.  Use local_is_tls rather than casting to
580         Sized_relobj_file.
581         * object.h (class Object): Add local_is_tls and do_local_is_tls.
582         (class Sized_relobj_file): Add do_local_is_tls.
583         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
584
585 2012-09-11  Alan Modra  <amodra@gmail.com>
586
587         PR gold/14566
588         * layout.cc (Layout::set_segment_offsets): When using
589         common-page-size alignment, ensure we are on a new max-page-size
590         page.
591         * output.cc (Output_segment::set_section_addresses): Use
592         abi_pagesize, not common_pagesize for relro boundary.
593         (Output_segment::set_offset): Likewise.
594
595 2012-09-11  Alan Modra  <amodra@gmail.com>
596
597         * output.h (Output_data_got::add_global_tls, add_local_tls,
598         add_local_tls_pair): New functions.
599         (Output_data_got::add_local_pair_with_rel): Remove second
600         reloc param.  Expand comment.
601         (Output_data_got::Got_entry): Rename use_plt_offset_ to
602         use_plt_or_tls_offset_, similarly for constructor param.
603         (Output_data_got::Got_entry::write): Add got_index param.
604         * output.cc (Output_data_got::add_global_tls, add_local_tls,
605         add_local_tls_pair): New functions.
606         (Output_data_got::Got_entry::write): Handle tls symbols
607         with use_plt_or_tls_offset_ set specially.
608         (Output_data_got::add_local_pair_with_rel): Only one reloc.
609         (Output_data_got::do_write): Replace iterator with index, pass
610         index to entry write function.
611         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
612         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
613         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
614         call.
615         * i386.cc (Target_i386::Scan::local): Likewise.
616         * sparc.cc (Target_sparc::Scan::local): Likewise.
617         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
618         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
619         do_tls_offset_for_global): New functions.
620         (Target_powerpc::Scan::local): Correct TLS relocations and got
621         entry values.
622         (Target_powerpc::Scan::global): Don't emit unnecessary
623         dynamic relocations on TLS GOT entries.
624
625 2012-09-10  Matthias Klose  <doko@ubuntu.com>
626
627         * config.in: Disable sanity check for kfreebsd.
628
629 2012-09-10  Sterling Augustine  <saugustine@google.com>
630
631         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
632         (Gdb_index::pubtypes_read): New parameter.
633         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
634         to calls.
635         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
636         pubtypes_object_.
637
638 2012-09-09  Alan Modra  <amodra@gmail.com>
639
640         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
641         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
642         * gc.h (gc_process_relocs): Call target gc_add_reference.
643         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
644         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
645         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
646         unnecessary cast.
647         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
648         to cater for when we don't need code offset.  Update use.
649         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
650         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
651         set_opd_valid): New functions.
652         (Target_powerpc::do_gc_add_reference): New function.
653         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
654         stashed refs.
655         (Target_powerpc::do_gc_mark_symbol): New function.
656
657 2012-09-06  Cary Coutant  <ccoutant@google.com>
658
659         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
660         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
661         (Dwarf_die::skip_attributes): Likewise.
662         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
663         * testsuite/gdb_index_test.cc (inline_func_1): New function.
664         (main): Call it.
665         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
666
667 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
668
669         * testsuite/script_test_3.t: Add .got.plt output section
670         statement.
671         * testsuite/script_test_4.t: Likewise.
672
673 2012-09-05  Alan Modra  <amodra@gmail.com>
674
675         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
676         update all uses and lose "enum" when using type.
677
678 2012-09-05  Alan Modra  <amodra@gmail.com>
679
680         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
681         * configure: Regenerate.
682         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
683         (plugin_final_layout.stdout): Likewise.
684         (memory_test): Set page sizes to 0x1000.
685         * testsuite/Makefile.in: Regenerate.
686         * testsuite/discard_locals_test.sh: Add FIXME comment.
687         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
688         * testsuite/pr14265.t: Add .got output section statement.
689         * testsuite/script_test_2.t: Likewise.
690         * testsuite/script_test_3.t: Likewise.
691         * testsuite/script_test_4.t: Likewise.
692         * testsuite/script_test_5.t: Likewise.
693         * testsuite/script_test_6.t: Likewise.
694         * testsuite/script_test_7.t: Likewise.
695         * testsuite/script_test_9.t: Likewise.
696
697 2012-09-05  Alan Modra  <amodra@gmail.com>
698
699         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
700         (Powerpc_relocate_functions::Status): New typedef.
701         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
702         (Target_powerpc::Scan::local): Handle REL64.
703         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
704         for REL32 and REL64.
705         (Target_powerpc::symval_for_branch): New function, extracted from..
706         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
707         checks.  Report overflow errors.
708
709 2012-09-05  Alan Modra  <amodra@gmail.com>
710
711         * object.h (Sized_relobj_file::emit_relocs): Delete.
712         (Sized_relobj_file::emit_relocs_reltype): Delete.
713         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
714         relocate_relocs for --emit-relocs.
715         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
716         * output.h: Update comment.
717         (Output_segment::first_section): New function.
718         (Output_segment::first_section_load_address): Use first_section.
719         * output.cc (Output_segment::first_section): New function extracted..
720         (Output_segment::first_section_load_address): ..from here.  Delete.
721         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
722         * target.h (Sized_target::relocate_for_relocatable): Likewise.
723         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
724         adjust call to target.h function.
725         * i386.cc (Target_i386): Likewise.
726         * sparc.cc (Target_sparc): Likewise.
727         * x86_64.cc (Target_x86_64): Likewise.
728         * powerpc.cc (Target_powerpc): Likewise.
729         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
730         first tls section has section symbol for optimised local dynamic
731         output relocs.
732         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
733         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
734         optimised tls code.
735         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
736         Rename to relocate_relocs.  Update error message.
737
738 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
739
740         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
741         --just-symbols.
742
743 2012-08-31  Alan Modra  <amodra@gmail.com>
744
745         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
746         (Powerpc_relobj::toc_base_offset): New stub function.
747         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
748         got_mod_index_offset to tlsld_got_offset.  Update all refs.
749         (Target_powerpc::Relocate::enum skip_tls): New.
750         (Target_powerpc::call_tls_get_addr_): New var.
751         (Target_powerpc::is_branch_reloc): Move to file scope.
752         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
753         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
754         New functions.
755         (Target_powerpc::enum Got_type): Delete old values, add new ones.
756         (powerpc_info): Correct common_pagesize for ppc64.
757         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
758         (Powerpc_relocate_functions): Add overflow check enums and functions.
759         Add non-shift version of rela, rela_ua.  Delete all rel public
760         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
761         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
762         addr16_ha3, addr14 functions.
763         (Output_data_got_powerpc::add_constant_pair): New function.
764         (Output_data_got_powerpc::got_base_offset): Likewise.
765         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
766         (instruction constants): Sort, add some more.
767         (Output_data_glink::do_write): Add and use Address typedef.  Use
768         object->toc_base_offset() stub for 64-bit.
769         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
770         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
771         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
772         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
773         Always treat .opd relocs as against locally defined symbol.
774         Correct condition for RELATIVE relocs.
775         (Target_powerpc::do_finalize_sections): Test for NULL sections.
776         (Target_powerpc::Relocate::relocate): Use plt call stub as value
777         for 32-bit syms with a plt entry.  Correct ppc64 toc base
778         calculations.  Handle TLS relocs, and more.  Add overflow
779         checking and adjust for Powerpc_relocate_functions changes.
780         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
781         Reinstate --emit-relocs code with FIXME.
782
783 2012-08-30  Alan Modra  <amodra@gmail.com>
784
785         * layout.cc (Layout::set_segment_offsets): Set p_align to
786         abi_pagesize, not common_pagesize.
787         (Layout::relaxation_loop_body): Similarly use abi_pagesize
788         to determine whether file header can go in segment.
789
790 2012-08-30  Alan Modra  <amodra@gmail.com>
791
792         * output.h (Output_reloc::Output_reloc <output section>): Add
793         is_relative param.  Adjust calls.
794         (Output_reloc::add_output_section_relative): New functions.
795         * output.cc (Output_reloc::Output_reloc <output section>): Handle
796         is_relative.
797         (Output_reloc::symbol_value): Handle SECTION_CODE.
798
799 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
800
801         * gold.cc (queue_middle_tasks): Call layout again when unique
802         segments for sections is desired.
803         * layout.cc (Layout::Layout): Initialize new members.
804         (Layout::get_output_section_flags): New function.
805         (Layout::choose_output_section): Call get_output_section_flags.
806         (Layout::layout): Make output section for mapping to a unique segment.
807         (Layout::insert_section_segment_map): New function.
808         (Layout::attach_allocated_section_to_segment): Make unique segment for
809         output sections marked so.
810         (Layout::segment_precedes): Check for unique segments when sorting.
811         * layout.h (Layout::Unique_segment_info): New struct.
812         (Layout::Section_segment_map): New typedef.
813         (Layout::insert_section_segment_map): New function.
814         (Layout::get_output_section_flags): New function.
815         (Layout::is_unique_segment_for_sections_specified): New function.
816         (Layout::set_unique_segment_for_sections_specified): New function.
817         (Layout::unique_segment_for_sections_specified_): New member.
818         (Layout::section_segment_map_): New member.
819         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
820         Rename is_gc_pass_one to is_pass_one.
821         Rename is_gc_pass_two to is_pass_two.
822         Rename is_gc_or_icf to is_two_pass.
823         Check for which pass based on whether symbols data is present.
824         Make it two pass when unique segments for sections is desired.
825         * output.cc (Output_section::Output_section): Initialize new
826         members.
827         * output.h (Output_section::is_unique_segment): New function.
828         (Output_section::set_is_unique_segment): New function.
829         (Output_section::is_unique_segment_): New member.
830         (Output_section::extra_segment_flags): New function.
831         (Output_section::set_extra_segment_flags): New function.
832         (Output_section::extra_segment_flags_): New member.
833         (Output_section::segment_alignment): New function.
834         (Output_section::set_segment_alignment): New function.
835         (Output_section::segment_alignment_): New member.
836         (Output_segment::Output_segment): Initialize is_unique_segment_.
837         (Output_segment::is_unique_segment): New function.
838         (Output_segment::set_is_unique_segment): New function.
839         (Output_segment::is_unique_segment_): New member.
840         * plugin.cc (allow_unique_segment_for_sections): New function.
841         (unique_segment_for_sections): New function.
842         (Plugin::load): Add new functions to transfer vector.
843         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
844         * Makefile.in: Regenerate.
845         * testsuite/plugin_final_layout.sh: Check if unique segment
846         functionality works.
847         * testsuite/plugin_section_order.c (onload): Check if new interfaces
848         are available.
849         (allow_unique_segment_for_sections): New global.
850         (unique_segment_for_sections): New global.
851         (claim_file_hook): Call allow_unique_segment_for_sections.
852         (all_symbols_read_hook): Call unique_segment_for_sections.
853
854 2012-08-22  Cary Coutant  <ccoutant@google.com>
855
856         * layout.cc (Layout::include_section): Don't assert on GROUP
857         sections with --emit-relocs.
858
859 2012-08-21  Cary Coutant  <ccoutant@google.com>
860
861         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
862         if --export-dynamic-symbol names an undef symbol.
863
864 2012-08-18  Alan Modra  <amodra@gmail.com>
865
866         * powerpc.cc: Formatting and white space.
867         (Powerpc_relobj): Rename got2_section_ to special_.
868         Add opd_ent_shndx_ and opd_ent_off_ vectors.
869         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
870         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
871         (Target_powerpc): Add Address typedef and invalid_address.  Use
872         throughout.
873         (Target_powerpc::is_branch_reloc): New function.
874         (Powerpc_relocate_functions): Add Address typedef, use throughout.
875         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
876         for dst_mask, value and addend.
877         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
878         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
879         (Output_data_glink::do_write): Correct toc base.  Don't try to use
880         uint16_t for 24-bit offset.  Use get_output_section_offset and
881         check return.
882         (Target_powerpc::Scan::local): Handle more relocs.
883         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
884         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
885         Plug in toc restoring insn after plt calls.  Translate branches
886         to function descriptor symbols to corresponding entry point.
887         (Target_powerpc::relocate_for_relocatable): Check return from
888         get_output_section_offset.
889         * symtab.h: Comment typo.
890
891 2012-08-14  Ian Lance Taylor  <iant@google.com>
892
893         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
894         unsupported_relocal_local to call unsupported_reloc_global.
895
896 2012-08-14  Nick Clifton  <nickc@redhat.com>
897
898         PR ld/14265
899         * script-sections.cc (Sections_element::output_section_name): Add
900         keep return parameter.
901         (Output_section_element::match_name): Add keep return parameter.
902         Return the value of the keep_ member.
903         * script-sections.h (class Output_section): Update
904         output_section_name prototype.
905         * layout.cc (Layout::keep_input_section): New public member
906         function.
907         (Layout::choose_output_section): Pass keep parameter to
908         output_section_name.
909         * layout.h (class Layout): Add keep_input_section.
910         * object.cc (Sized_relobj_file::do_layout): Check for kept input
911         sections.
912         * testsuite/Makefile.am: Add a test.
913         * testsuite/Makefile.in: Regenerate.
914         * testsuite/pr14265.c: Source file for the test.
915         * testsuite/pr14265.t: Linker script for the test.
916         * testsuite/pr14265.sh: Shell script for the test.
917
918 2012-08-14  Alan Modra  <amodra@gmail.com>
919
920         * target.h (Target::output_section_name): New function.
921         (Target::do_output_section_name): New function.
922         * layout.cc (Layout::choose_output_section): Call the above.
923         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
924
925 2012-08-14  Alan Modra  <amodra@gmail.com>
926
927         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
928         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
929         for replace_constant call.
930         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
931         (Output_data_glink::do_print_to_mapfile): New function.
932         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
933         (Target_powerpc::Relocate::relocate): Likewise.
934
935 2012-08-14  Alan Modra  <amodra@gmail.com>
936
937         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
938         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
939         (Output_data_glink::add_entry,find_entry): Remove shndx param.
940         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
941         all references to shndx_.  Handle special case for R_PPC_PLTREL24
942         here.
943         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
944         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
945         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
946         here.
947         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
948         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
949
950 2012-08-12  Alan Modra  <amodra@gmail.com>
951
952         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
953         (glink insn constants): Use uint32_t.
954         (Output_data_glink::add_entry): Use insert, not [] operator.
955
956 2012-08-11  Alan Modra  <amodra@gmail.com>
957
958         * object.h (Sized_relobj_file::find_shdr): New function.
959         (Sized_relobj_file::find_special_sections): New function.
960         * object.cc (Sized_relobj_file::find_shdr): New function.
961         (Sized_relobj_file::find_eh_frame): Use find_shdr.
962         (Sized_relobj_file::find_special_sections): New function, split out..
963         (Sized_relobj_file::do_read_symbols): ..from here.
964         * output.h (Output_data_got::replace_constant): New function.
965         (Output_data_got::num_entries): New function.
966         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
967         (Output_data_got::got_offset): Protected rather than private.
968         (Output_data_got::replace_got_entry): New function.
969         * output.cc (Output_data_got::replace_got_entry): New function.
970         * powerpc.cc (class Powerpc_relobj): New.
971         (class Powerpc_relocate_functions): Delete all psymval variants or
972         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
973         Implement _ha functions using corresponding _hi function.
974         (Powerpc_relobj::find_special_sections): New function.
975         (Target_powerpc::do_make_elf_object): New function.
976         (class Output_data_got_powerpc): New.
977         (class Output_data_glink): New.
978         (class Powerpc_scan_relocatable_reloc): New.
979         Many more changes througout file.
980
981 2012-08-09  Nick Clifton  <nickc@redhat.com>
982
983         * po/vi.po: Updated Vietnamese translation.
984
985 2012-08-07  Ian Lance Taylor  <iant@google.com>
986
987         * layout.cc (Layout::add_target_dynamic_tags): If
988         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
989         plt_rel.
990
991 2012-07-30  Nick Clifton  <nickc@redhat.com>
992
993         * po/gold.pot: Updated template.
994         * po/es.po: Updated Spanish translation.
995
996 2012-07-18  Cary Coutant  <ccoutant@google.com>
997
998         PR gold/14344
999         * configure.ac: Add check for -gpubnames support.
1000         * configure: Regenerate.
1001         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1002         support; force -gno-pubnames.
1003         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1004         support.
1005         (gdb_index_test_4): New test.
1006         * testsuite/Makefile.in: Regenerate.
1007         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1008         * testsuite/gdb_index_test_2.sh: Likewise.
1009         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1010         * testsuite/gdb_index_test_4.sh: New script.
1011         * testsuite/gdb_index_test_comm.sh: New script with common code;
1012         don't look for space after colon.
1013
1014 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1015
1016         * gold.cc (queue_middle_tasks): Update function order only after
1017         deferred objects due to plugins are processed.
1018
1019 2012-07-11  Ian Lance Taylor  <iant@google.com>
1020
1021         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1022         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1023         (Target_arm::scan_reloc_for_stub): Likewise.
1024         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1025         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1026         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1027         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1028         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1029
1030 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1031             Ian Lance Taylor  <iant@google.com>
1032
1033         PR gold/14309
1034         * configure.ac: Test whether std::tr1::hash<off_t> works.
1035         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1036         needed.
1037         * output.h (class Output_fill): Add virtual destructor.
1038         * configure, config.in: Rebuild.
1039
1040 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1041
1042         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1043
1044 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1045
1046         * plugin.cc (Plugin::load): Handle position independent executables.
1047
1048 2012-06-06  Cary Coutant  <ccoutant@google.com>
1049
1050         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1051         add .debug_macro.
1052         (lines_only_debug_sections): Likewise.
1053         (gdb_fast_lookup_sections): New static array.
1054         (is_gdb_debug_section): Rename formal parameter.
1055         (is_lines_only_debug_section): Likewise.
1056         (is_gdb_fast_lookup_section): New function.
1057         (Layout::include_section): Check for ".zdebug_" prefix; pass
1058         section name suffix to is_gdb_debug_section, et al.; check for
1059         fast-lookup sections when building .gdb_index.
1060         * options.h (--strip-debug-gdb): Update GDB version number.
1061
1062 2012-06-06  Cary Coutant  <ccoutant@google.com>
1063
1064         * configure.ac: Add check for fallocate.
1065         * configure: Regenerate.
1066         * config.in: Regenerate.
1067
1068         * options.h (class General_options): Add --mmap-output-file and
1069         --posix-fallocate options.
1070         * output.cc: (posix_fallocate): Remove; replace with...
1071         (gold_fallocate): New function.
1072         (Output_file::map_no_anonymous): Call gold_fallocate.
1073         (Output_file::map): Check --mmap-output-file option.
1074
1075 2012-06-05  Jing Yu  <jingyu@google.com>
1076
1077         * gold.h (textdomain): Add do {} to empty while(0).
1078         (bindtextdomain): Likewise.
1079
1080 2012-06-04  Cary Coutant  <ccoutant@google.com>
1081
1082         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1083         has_dynsym_index.
1084
1085 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1086
1087         * symtab.cc (Symbol_table::define_special_symbol):
1088         Initialize *poldsym to prevent uninitialized variable errors.
1089
1090 2012-05-23  Cary Coutant  <ccoutant@google.com>
1091
1092         * layout.cc (Layout::section_name_mapping): Add rules to handle
1093         exact match on .data.rel.ro.local or .data.rel.ro.
1094         (Layout::output_section_name): Check for exact matches.
1095
1096 2012-05-23  Cary Coutant  <ccoutant@google.com>
1097
1098         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1099         more carefully.
1100
1101 2012-05-22  Cary Coutant  <ccoutant@google.com>
1102
1103         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1104         object before exporting symbol.
1105
1106 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1107
1108         * testsuite/tls_test.cc: Include "config.h" first.
1109         * testsuite/tls_test_c.c: Likewise.
1110
1111 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1112             Nick Clifton  <nickc@redhat.com>
1113
1114         PR 14072
1115         * configure.in: Add check that sysdep.h has been included before
1116         any system header files.
1117         * configure: Regenerate.
1118         * config.in: Regenerate.
1119
1120 2012-05-14  Cary Coutant  <ccoutant@google.com>
1121
1122         * layout.cc (Layout::make_output_section): Mark .tdata section
1123         as RELRO.
1124         * testsuite/relro_test.cc: Add a TLS variable.
1125
1126 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
1127
1128         PR gold/14091
1129         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
1130         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
1131         R_X86_64_64.
1132
1133 2012-05-08  Cary Coutant  <ccoutant@google.com>
1134
1135         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
1136         (lines_only_debug_sections): Likewise.
1137
1138 2012-05-02  Roland McGrath  <mcgrathr@google.com>
1139
1140         * nacl.cc: New file.
1141         * nacl.h: New file.
1142         * Makefile.am (CCFILES, HFILES): Add them.
1143         * Makefile.in: Regenerate.
1144         * i386.cc (Output_data_plt_i386_nacl): New class.
1145         (Output_data_plt_i386_nacl_exec): New class.
1146         (Output_data_plt_i386_nacl_dyn): New class.
1147         (Target_i386_nacl): New class.
1148         (Target_selector_i386_nacl): New class.
1149         (target_selector_i386): Use it instead of Target_selector_i386.
1150         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
1151         (Target_x86_64_nacl): New class.
1152         (Target_selector_x86_64_nacl): New class.
1153         (target_selector_x86_64, target_selector_x32): Use it instead of
1154         Target_selector_x86_64.
1155         * arm.cc (Output_data_plt_arm_nacl): New class.
1156         (Target_arm_nacl): New class.
1157         (Target_selector_arm_nacl): New class.
1158         (target_selector_arm, target_selector_armbe): Use it instead of
1159         Target_selector_arm.
1160
1161         * target-select.cc (select_target): Take new Input_file* and off_t
1162         arguments, pass them on to recognize method of selector.
1163         * object.cc (make_elf_sized_object): Update caller.
1164         * parameters.cc (parameters_force_valid_target): Likewise.
1165         * incremental.cc (make_sized_incremental_binary): Likewise.
1166         * target-select.h: Update decl.
1167         (Target_selector::recognize): Take new Input_file* argument,
1168         pass it on to do_recognize.
1169         (Target_selector::do_recognize): Take new Input_file* argument.
1170         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
1171         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
1172         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
1173         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
1174
1175         * target.h (Target::Target_info): New members isolate_execinstr
1176         and rosegment_gap.
1177         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
1178         * arm.cc (Target_arm::arm_info): Update initializer.
1179         * i386.cc (Target_i386::i386_info): Likewise.
1180         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
1181         * sparc.cc (Target_sparc::sparc_info): Likewise.
1182         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
1183         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1184         * layout.cc (Layout::attach_allocated_section_to_segment):
1185         Take new const Target* argument.  If target->isolate_execinstr(), act
1186         like --rosegment.
1187         (Layout::find_first_load_seg): Take new const Target* argument;
1188         if target->isolate_execinstr(), reject PF_X segments.
1189         (Layout::relaxation_loop_body): Update caller.
1190         (Layout::set_segment_offsets): If target->isolate_execinstr(),
1191         reset file offset to zero when we hit LOAD_SEG, and then do a second
1192         loop over the segments before LOAD_SEG to reassign offsets after
1193         addresses have been determined.  Handle target->rosegment_gap().
1194         (Layout::attach_section_to_segment): Take new const Target* argument;
1195         pass it to attach_allocated_section_to_segment.
1196         (Layout::make_output_section): Update caller.
1197         (Layout::attach_sections_to_segments): Take new const Target* argument;
1198         pass it to attach_section_to_segment.
1199         * gold.cc (queue_middle_tasks): Update caller.
1200         * layout.h (Layout): Update method decls with new arguments.
1201
1202         * arm.cc (Target_arm::Target_arm): Take optional argument for the
1203         Target_info pointer to use.
1204         (Target_arm::do_make_data_plt): New virtual method.
1205         (Target_arm::make_data_plt): New method that calls it.
1206         (Target_arm::make_plt_entry): Use it.
1207         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
1208         for the section alignment.
1209         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
1210         method.
1211         (Output_data_plt_arm::first_plt_entry_offset): Call it.
1212         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
1213         method.
1214         (Output_data_plt_arm::get_plt_entry_size): Call it.
1215         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
1216         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
1217         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
1218         method.
1219         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
1220         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
1221         method instead of sizeof(plt_entry).
1222         (Output_data_plt_arm::add_entry): Likewise.
1223         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
1224         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
1225         than static method.
1226         (Target_arm::plt_entry_size): Likewise.
1227         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
1228         Move to ...
1229         (Output_data_plt_arm_standard): ... here, new class.
1230         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
1231         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
1232         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
1233
1234         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
1235         Take additional argument for the PLT entry size.
1236         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
1237         Use get_plt_entry_size method rather than plt_entry_size variable.
1238         (Output_data_plt_x86_64::reserve_slot): Likewise.
1239         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
1240         (Output_data_plt_x86_64::add_entry): Likewise.
1241         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
1242         (Output_data_plt_x86_64::address_for_global): Likewise.
1243         (Output_data_plt_x86_64::address_for_local): Likewise.
1244         (Output_data_plt_x86_64::set_final_data_size): Likewise.
1245         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
1246         Make method non-static.
1247         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
1248         method.
1249         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
1250         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
1251         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
1252         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
1253         virtual method.
1254         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
1255         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
1256         virtual method.
1257         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
1258         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
1259         virtual method.
1260         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
1261         (Output_data_plt_x86_64::plt_entry_size)
1262         (Output_data_plt_x86_64::first_plt_entry)
1263         (Output_data_plt_x86_64::plt_entry)
1264         (Output_data_plt_x86_64::tlsdesc_plt_entry)
1265         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
1266         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
1267         (Output_data_plt_x86_64_standard): ... here, new class.
1268         (Target_x86_64::Target_x86_64): Take optional argument for the
1269         Target_info pointer to use.
1270         (Target_x86_64::do_make_data_plt): New virtual method.
1271         (Target_x86_64::make_data_plt): New method to call it.
1272         (Target_x86_64::init_got_plt_for_update): Use that.
1273         Call this->plt_->add_eh_frame method here.
1274         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
1275         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
1276         rather than static method.
1277         (Target_x86_64::plt_entry_size): Likewise.
1278         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
1279         rather than plt_entry_size variable.  Move guts of PLT filling to...
1280         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
1281         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
1282         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
1283
1284         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
1285         additional argument for the section alignment.
1286         Don't do add_eh_frame_for_plt here.
1287         (Output_data_plt_i386::first_plt_entry_offset): Make the method
1288         non-static.  Use get_plt_entry_size method rather than plt_entry_size
1289         variable.
1290         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
1291         method.
1292         (Output_data_plt_i386::get_plt_entry_size): Call it.
1293         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
1294         (Output_data_plt_i386::add_eh_frame): New method to call it.
1295         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
1296         method.
1297         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
1298         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
1299         method.
1300         (Output_data_plt_i386::fill_plt_entry): New method to call it.
1301         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
1302         method instead of plt_entry_size.
1303         (Output_data_plt_i386::plt_entry_size)
1304         (Output_data_plt_i386::plt_eh_frame_fde_size)
1305         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
1306         (Output_data_plt_i386_standard): ... here, new class.
1307         (Output_data_plt_i386_exec): New class.
1308         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
1309         (Output_data_plt_i386_exec::first_plt_entry): ... here.
1310         (Output_data_plt_i386::exec_plt_entry): Move to ...
1311         (Output_data_plt_i386_exec::plt_entry): ... here.
1312         (Output_data_plt_i386_dyn): New class.
1313         (Output_data_plt_i386::first_plt_entry): Move to ...
1314         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
1315         (Output_data_plt_i386::dyn_plt_entry): Move to ...
1316         (Output_data_plt_i386_dyn::plt_entry): ... here.
1317         (Target_i386::Target_i386): Take optional argument for the Target_info
1318         pointer to use.
1319         (Target_i386::do_make_data_plt): New virtual method.
1320         (Target_i386::make_data_plt): New method to call it.
1321         (Target_i386::make_plt_section): Use that.
1322         Call this->plt_->add_eh_frame method here.
1323         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
1324         rather than plt_entry_size variable.
1325         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
1326         (Output_data_plt_i386::address_for_local): Likewise.
1327         (Output_data_plt_i386::do_write): Likewise.
1328         Move guts of PLT filling to...
1329         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
1330         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
1331         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
1332         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
1333
1334 2012-05-01  Cary Coutant  <ccoutant@google.com>
1335
1336         * dwarf_reader.cc (Dwarf_die::read_attributes)
1337         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
1338         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
1339         * reduced_debug_output.cc
1340         (Output_reduced_debug_info_section::get_die_end): Remove
1341         DW_FORM_GNU_ref_index.  Add default case.
1342
1343 2012-04-26  Mark Wielaard  <mjw@redhat.com>
1344
1345         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
1346         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
1347         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
1348         DW_AT_high_pc as offset from DW_AT_low_pc.
1349
1350         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
1351         * testsuite/Makefile.in: Regenerate.
1352         * testsuite/gdb_index_test_3.c: New test source file.
1353         * testsuite/gdb_index_test_3.sh: New test source file.
1354
1355 2012-04-25  Ian Lance Taylor  <iant@google.com>
1356
1357         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
1358         pointer.
1359         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
1360         as a class, not a struct.
1361         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
1362         (Target_arm::apply_cortex_a8_workaround): Likewise.
1363         * gc.h: Declare Reloc_types as a struct, not a class.
1364         * object.h: Declare Symbols_data as a struct.
1365         * reloc.h: Declare Read_relocs_data as a struct.
1366         * target.h: Declare Relocate_info as a struct.
1367
1368 2012-04-24  David S. Miller  <davem@davemloft.net>
1369
1370         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
1371         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
1372         and R_SPARC_WPLT30.
1373
1374 2012-04-24  Cary Coutant  <ccoutant@google.com>
1375
1376         * incremental-dump.cc (find_input_containing_global): Replace
1377         magic number with symbolic constant.
1378         (dump_incremental_inputs): Update version number.
1379         * incremental.cc (Output_section_incremental_inputs): Update version
1380         number; import symbolic constants from Incremental_inputs_reader.
1381         (Incremental_inputs::create_data_sections): Align relocations
1382         section correctly for 64-bit targets.
1383         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
1384         constants; add padding.
1385         (Output_section_incremental_inputs::write_header): Add assert for
1386         header_size.
1387         (Output_section_incremental_inputs::write_input_files): Add assert
1388         for input_entry_size.
1389         (Output_section_incremental_inputs::write_info_blocks): Add padding;
1390         add assert for object_info_size, input_section_entry_size,
1391         global_sym_entry_size.
1392         * incremental.h (Incremental_inputs_reader): Add symbolic constants
1393         for data structure sizes; use them.
1394         (Incremental_input_entry_reader): Import symbolic constants from
1395         Incremental_inputs_reader; use them.
1396
1397 2012-04-23  David S. Miller  <davem@davemloft.net>
1398
1399         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
1400         and elf_flags_set_.
1401         (Target_sparc::Target_sparc): Initialize new fields.
1402         (Target_sparc::do_make_elf_object): New function.
1403         (Target_sparc::do_adjust_elf_header): New function.
1404
1405 2012-04-23  Cary Coutant  <ccoutant@google.com>
1406
1407         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
1408         CU range table of gdb index.
1409
1410 2012-04-20  David S. Miller  <davem@davemloft.net>
1411
1412         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
1413         instead of false.
1414
1415 2012-04-16  David S. Miller  <davem@davemloft.net>
1416
1417         * sparc.cc (Target_sparc::got_address): New function.
1418         (Sparc_relocate_functions::gdop_hix22): New function.
1419         (Sparc_relocate_functions::gdop_lox10): New function.
1420         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
1421         relocs.
1422         (Target_sparc::Scan::local): Likewise if the global symbol is not
1423         preemptible and is not IFUNC.
1424         (Target_sparc::Relocate::relocate): Perform GOTDATA code
1425         transformations for local and non-preemptible non-IFUNC global
1426         symbols.
1427
1428         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
1429         writing out 64-bit part of ranges.
1430
1431         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
1432         -fpic and -fpie respectively.
1433         * Makefile.in: Regenerate.
1434
1435         * sparc.cc (class Target_sparc): Add rela_ifunc_.
1436         (Target_sparc::Target_sparc): Initialize new field.
1437         (Target_sparc::do_plt_section_for_global): New function.
1438         (Target_sparc::do_plt_section_for_local): New function.
1439         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
1440         (Target_sparc::make_plt_section): New function, broken out of
1441         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
1442         (Target_sparc::make_plt_entry): Call make_plt_section.
1443         (Target_sparc::make_local_ifunc_plt_entry): New function.
1444         (Target_sparc::rela_ifunc_section): New function.
1445         (Target_sparc::plt_section): Remove const.
1446         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
1447         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
1448         and ifunc_count_ fields.
1449         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
1450         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
1451         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
1452         (Output_data_plt_sparc::rela_ifunc): New function.
1453         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
1454         (Output_data_plt_sparc::has_ifunc_section): New function.
1455         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
1456         (Output_data_plt_sparc::address_for_global): New function.
1457         (Output_data_plt_sparc::address_for_local): New function.
1458         (Output_data_plt_sparc::plt_index_to_offset): New function.
1459         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
1460         and entry_count.
1461         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
1462         entry_count.
1463         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
1464         R_SPARC_JMP_IREL to switch.
1465         (Target_sparc::Scan::check_non_pic): Likewise.
1466         (Target_sparc::Scan::local): Handle IFUNC symbols.
1467         (Target_sparc::Scan::local): Likewise.
1468         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
1469         and plt_address_for_local.
1470         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
1471         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
1472
1473         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
1474         (class Output_data_reloc): Adjust calls to Output_reloc_type.
1475         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
1476         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
1477         global relocs too.
1478         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
1479         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
1480         calls.
1481         * sparc.cc (Target_sparc::Scan::global): Likewise.
1482         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
1483
1484 2012-04-16  Cary Coutant  <ccoutant@google.com>
1485
1486         * archive.cc (Library_base::should_include_member): Check for
1487         --export-dynamic-symbol.
1488         * options.h (class General_options): Add --export-dynamic-symbol.
1489         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
1490         --export-dynamic-symbol.
1491         (Symbol_table::gc_mark_undef_symbols): Likewise.
1492         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
1493
1494 2012-04-12  David S. Miller  <davem@davemloft.net>
1495
1496         * sparc.cc (Reloc::wdisp10): New relocation method.
1497         (Reloc::h34): Likewise.
1498         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
1499         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
1500         R_SPARC_WDISP10.
1501         (Target_sparc::Scan::local): Likewise.
1502         (Target_sparc::Scan::global): Likewise.
1503         (Target_sparc::Relocate::relocate): Likewise.
1504
1505 2012-04-09  Cary Coutant  <ccoutant@google.com>
1506
1507         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
1508         low_pc == 0.
1509
1510 2012-04-06  Ian Lance Taylor  <iant@google.com>
1511
1512         * timer.cc: #include <unistd.h>.
1513
1514 2012-04-06  Roland McGrath  <mcgrathr@google.com>
1515
1516         * configure.in (AC_CHECK_HEADERS): Add locale.h.
1517         * config.in: Regenerate.
1518         * configure: Regenerate.
1519
1520 2012-04-05  Nick Clifton  <nickc@redhat.com>
1521
1522         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
1523         (AM_LC_MESSAGES): Add.
1524         * aclocal.m4: Regenerate.
1525         * config.in: Regenerate.
1526         * configure: Regenerate.
1527
1528 2012-03-21  Cary Coutant  <ccoutant@google.com>
1529
1530         * Makefile.am: Add gdb-index.cc, gdb-index.h.
1531         * Makefile.in: Regenerate.
1532         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
1533         (Sized_elf_reloc_mapper::symbol_section): New function.
1534         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
1535         (make_elf_reloc_mapper): New function.
1536         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
1537         (Dwarf_abbrev_table::do_read_abbrevs): New function.
1538         (Dwarf_abbrev_table::do_get_abbrev): New function.
1539         (Dwarf_ranges_table::read_ranges_table): New function.
1540         (Dwarf_ranges_table::read_range_list): New function.
1541         (Dwarf_pubnames_table::read_section): New function.
1542         (Dwarf_pubnames_table::read_header): New function.
1543         (Dwarf_pubnames_table::next_name): New function.
1544         (Dwarf_die::Dwarf_die): New function.
1545         (Dwarf_die::read_attributes): New function.
1546         (Dwarf_die::skip_attributes): New function.
1547         (Dwarf_die::set_name): New function.
1548         (Dwarf_die::set_linkage_name): New function.
1549         (Dwarf_die::attribute): New function.
1550         (Dwarf_die::string_attribute): New function.
1551         (Dwarf_die::int_attribute): New function.
1552         (Dwarf_die::uint_attribute): New function.
1553         (Dwarf_die::ref_attribute): New function.
1554         (Dwarf_die::child_offset): New function.
1555         (Dwarf_die::sibling_offset): New function.
1556         (Dwarf_info_reader::check_buffer): New function.
1557         (Dwarf_info_reader::parse): New function.
1558         (Dwarf_info_reader::do_parse): New function.
1559         (Dwarf_info_reader::do_read_string_table): New function.
1560         (Dwarf_info_reader::lookup_reloc): New function.
1561         (Dwarf_info_reader::get_string): New function.
1562         (Dwarf_info_reader::visit_compilation_unit): New function.
1563         (Dwarf_info_reader::visit_type_unit): New function.
1564         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
1565         Sized_elf_reloc_mapper.
1566         (Sized_dwarf_line_info::symbol_section): Remove function.
1567         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
1568         (Sized_dwarf_line_info::read_line_mappings): Remove object
1569         parameter, adjust callers.
1570         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
1571         * dwarf_reader.h: Include <sys/types.h>.
1572         (class Track_relocs): Remove forward declaration.
1573         (class Elf_reloc_mapper): New class.
1574         (class Sized_elf_reloc_mapper): New class.
1575         (class Dwarf_abbrev_table): New class.
1576         (class Dwarf_range_list): New class.
1577         (class Dwarf_ranges_table): New class.
1578         (class Dwarf_pubnames_table): New class.
1579         (class Dwarf_die): New class.
1580         (class Dwarf_info_reader): New class.
1581         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
1582         (Sized_dwarf_line_info::symbol_section): Remove member function.
1583         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
1584         base class.
1585         * gdb-index.cc: New source file.
1586         * gdb-index.h: New source file.
1587         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
1588         and .debug_types sections, call Layout::add_to_gdb_index.
1589         (Sized_relobj_incr::do_section_name): Implement.
1590         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
1591         return type; Implement.
1592         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
1593         return type.
1594         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
1595         parameter list and return type.
1596         (Sized_incr_dynobj::do_section_contents): Likewise.
1597         * layout.cc: Include gdb-index.h.
1598         (Layout::Layout): Initialize gdb_index_data_.
1599         (Layout::init_fixed_output_section): Check for .gdb_index section.
1600         (Layout::add_to_gdb_index): New function. Instantiate.
1601         * layout.h: Add forward declaration for class Gdb_index.
1602         (Layout::add_to_gdb_index): New member function.
1603         (Layout::gdb_index_data_): New data member.
1604         * main.cc: Include gdb-index.h.
1605         (main): Print statistics for gdb index.
1606         * object.cc (Object::section_contents): Move code into
1607         do_section_contents.
1608         (need_decompressed_section): Check for sections needed when building
1609         gdb index.
1610         (build_compressed_section_map): Likewise.
1611         (Sized_relobj_file::do_read_symbols): Need local symbols when building
1612         gdb index.
1613         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
1614         sections; call Layout::add_to_gdb_index.
1615         (Sized_relobj_file::do_decompressed_section_contents): Call
1616         do_section_contents directly.
1617         * object.h (Object::do_section_contents): Adjust parameter list and
1618         return type.
1619         (Object::do_decompressed_section_contents): Call do_section_contents
1620         directly.
1621         (Sized_relobj_file::do_section_contents): Adjust parameter list and
1622         return type.
1623         * options.h (class General_options): Add --gdb-index option.
1624         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
1625         list and return type.
1626         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
1627         * reloc.h (Track_relocs::checkpoint): New function.
1628         (Track_relocs::reset): New function.
1629
1630         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
1631         New test cases.
1632         * testsuite/Makefile.in: Regenerate.
1633         * testsuite/gdb_index_test.cc: New test source file.
1634         * testsuite/gdb_index_test_1.sh: New test source file.
1635         * testsuite/gdb_index_test_2.sh: New test source file.
1636
1637 2012-03-19  Doug Kwan  <dougkwan@google.com>
1638
1639         * arm.cc (Target_arm::do_define_standard_symbols): New method.
1640         (Target_arm::do_finalize_sections): Remove code which defines
1641         __exidx_start and __exidx_end.  Make symbol table parameter
1642         anonymous as it is not used.
1643         * gold.cc (queue_middle_tasks): Call target hook to define any
1644         target-specific symbols.
1645         * target.h (Target::define_standard_symbols): New method.
1646         (Target::do_define_standard_symbols): Same.
1647         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
1648         * testsuite/Makefile.in: Regenerate.
1649         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
1650         and __exidx_end.
1651         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
1652         relocations are generated for __exidx_start and __exidx_end.
1653
1654 2012-03-16  Doug Kwan  <dougkwan@google.com>
1655
1656         * testsuite/Makefile.am: Disable test initpri3b.
1657         * testsuite/Makefile.in: Regenerate.
1658
1659 2012-03-15  Doug Kwan  <dougkwan@google.com>
1660
1661         * arm.cc (Target_arm::got_section): Make .got section read-only
1662         if -z now is given.
1663
1664 2012-03-15  Ian Lance Taylor  <iant@google.com>
1665
1666         PR gold/13850
1667         * layout.cc (Layout::make_output_section): Correctly mark
1668         SHT_INIT_ARRAY, et. al., as relro.
1669
1670 2012-03-14  Doug Kwan  <dougkwan@google.com>
1671
1672         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
1673         dynamic relocations for protected symbols in shared objects.
1674
1675 2012-03-13  Ian Lance Taylor  <iant@google.com>
1676
1677         * resolve.cc (Symbol_table::resolve): When merging common symbols,
1678         keep the larger alignment.
1679
1680 2012-03-12  Cary Coutant  <ccoutant@google.com>
1681
1682         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
1683         handling of DW_LNE_define_file.
1684
1685 2012-03-12  Cary Coutant  <ccoutant@google.com>
1686
1687         * reduced_debug_output.cc
1688         (Output_reduced_debug_info_section::get_die_end): Add new FORM
1689         codes to switch.
1690
1691 2012-02-29  Cary Coutant  <ccoutant@google.com>
1692
1693         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
1694
1695 2012-02-29  Cary Coutant  <ccoutant@google.com>
1696
1697         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
1698         Call Object::decompressed_section_contents.
1699         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
1700         New dtor.
1701         (Sized_dwarf_line_info::buffer_start_): New data member.
1702         * merge.cc (Output_merge_data::do_add_input_section): Call
1703         Object::decompressed_section_contents.
1704         (Output_merge_string::do_add_input_section): Likewise.
1705         * object.cc (need_decompressed_section): New function.
1706         (build_compressed_section_map): Decompress sections needed later.
1707         (Sized_relobj_file::do_decompressed_section_contents): New function.
1708         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1709         * object.h (Object::decompressed_section_contents): New function.
1710         (Object::discard_decompressed_sections): New function.
1711         (Object::do_decompressed_section_contents): New function.
1712         (Object::do_discard_decompressed_sections): New function.
1713         (Compressed_section_info): New type.
1714         (Compressed_section_map): Include decompressed section contents.
1715         (Sized_relobj_file::do_decompressed_section_contents): New function.
1716         (Sized_relobj_file::do_discard_decompressed_sections): New function.
1717
1718 2012-02-16  Cary Coutant  <ccoutant@google.com>
1719
1720         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
1721         * testsuite/Makefile.in: Regenerate.
1722
1723 2012-02-14  Cary Coutant  <ccoutant@google.com>
1724
1725         * options.cc (General_options::finalize): Disallow -pie and -static.
1726
1727 2012-02-03  Doug Kwan  <dougkwan@google.com>
1728
1729         * arm.cc (Arm_relocate_functions::abs8,
1730         Arm_relocate_functions::abs16): Use
1731         Bits::has_signed_unsigned_overflow32.
1732         (Arm_relocate_functions::thm_abs8): Correct range of
1733         overflow check.
1734         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
1735         in assertions.
1736
1737 2012-02-02  Doug Kwan  <dougkwan@google.com>
1738
1739         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
1740         position independent outputs, not just shared objects.
1741
1742 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
1743
1744         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
1745         * configure: Regenerated.
1746
1747 2012-01-27  Ian Lance Taylor  <iant@google.com>
1748
1749         * reloc.h (Bits): New class with static functions, copied from
1750         namespace utils in arm.cc.
1751         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
1752         instead.
1753
1754 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1755
1756         * incremental.cc (write_info_blocks): Correct relocation offset.
1757
1758 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1759
1760         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
1761         (Relocate::tls_gd_to_le): Likewise.
1762
1763 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1764
1765         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
1766
1767 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
1768
1769         * configure.ac: Check if -mcmodel=medium works.
1770         * configure: Regenerated.
1771
1772 2012-01-24  Cary Coutant  <ccoutant@google.com>
1773
1774         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
1775         definition and ...
1776         (read_unsigned_LEB_128_x): ... this new function.
1777         (read_signed_LEB_128): Replaced with inline definition and ...
1778         (read_signed_LEB_128_x): ... this new function.
1779         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
1780         (read_unsigned_LEB_128): Add inline definition.
1781         (read_signed_LEB_128_x): New function.
1782         (read_signed_LEB_128): Add inline definition.
1783         * testsuite/Makefile.am (leb128_unittest): New unit test.
1784         * testsuite/Makefile.in: Regenerate.
1785         * testsuite/leb128_unittest.cc: New unit test.
1786
1787 2012-01-23  Ian Lance Taylor  <iant@google.com>
1788
1789         PR gold/13617
1790         * i386.cc (Target_i386::do_code_fill): When using a jmp
1791         instruction, pad with nop instructions.
1792         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1793
1794 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
1795
1796         * x86_64.cc (gc_process_relocs): Add typename on types used in
1797         template.
1798         (scan_relocs): Likewise.
1799         (relocate_section): Likewise.
1800         (apply_relocation): Likewise.
1801
1802 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
1803
1804         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
1805         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
1806         under x32.
1807
1808 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
1809
1810         * x86_64.cc: Initial support for x32.
1811
1812 2012-01-03  Cary Coutant  <ccoutant@google.com>
1813
1814         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
1815         Use abstract base class for GOT.
1816         * gold/output.h (class Output_data_got_base): New abstract base class.
1817         (class Output_data_got): Derive from new base class, adjust ctors.
1818         (Output_data_got::reserve_slot): Make virtual; rename to
1819         do_reserve_slot; Adjust callers.
1820         * gold/target.h (Sized_target::init_got_plt_for_update): Return
1821         pointer to abstract base class.
1822         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
1823
1824 2011-12-18  Ian Lance Taylor  <iant@google.com>
1825
1826         * object.h (Relobj::local_symbol_value): New function.
1827         (Relobj::local_plt_offset): New function.
1828         (Relobj::local_has_got_offset): New function.
1829         (Relobj::local_got_offset): New function.
1830         (Relobj::set_local_got_offset): New function.
1831         (Relobj::do_local_symbol_value): New pure virtual function.
1832         (Relobj::do_local_plt_offset): Likewise.
1833         (Relobj::do_local_has_got_offset): Likewise.
1834         (Relobj::do_local_got_offset): Likewise.
1835         (Relobj::do_set_local_got_offset): Likewise.
1836         (Sized_relobj::do_local_has_got_offset): Rename from
1837         local_has_got_offset.
1838         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
1839         (Sized_relobj::do_set_local_got_offset): Rename from
1840         set_local_got_offset.
1841         (Sized_relobj_file::do_local_plt_offset): Rename from
1842         local_plt_offset.
1843         (Sized_relobj_file::do_local_symbol_value): New function.
1844         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
1845         local_plt_offset.
1846         * output.cc (Output_data_got::Got_entry::write): Change object to
1847         Relobj.  Use local_symbol_value.
1848         (Output_data_got::add_global_with_rel): Change rel_dyn to
1849         Output_data_reloc_generic*.  Use add_global_generic.
1850         (Output_data_got::add_global_with_rela): Remove.  Change all
1851         callers to use add_global_with_rel.
1852         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
1853         Output_data_reloc_generic*.  Use add_global_generic.
1854         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
1855         callers to use add_global_pair_with_rel.
1856         (Output_data_got::add_local): Change object to Relobj*.
1857         (Output_data_got::add_local_plt): Likewise.
1858         (Output_data_got::add_local_with_rel): Change object to Relobj*,
1859         change rel_dyn to Output_data_reloc_generic*.  Use
1860         add_local_generic.
1861         (Output_data_got::add_local_with_rela): Remove.  Change all
1862         callers to use all_local_with_rel.
1863         (Output_data_got::add_local_pair_with_rel): Change object to
1864         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
1865         add_output_section_generic.
1866         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
1867         callers to use add_local_pair_with_rel.
1868         (Output_data_got::reserve_local): Change object to Relobj*.
1869         * output.h: (class Output_data_reloc_generic): Add pure virtual
1870         declarations for add_global_generic, add_local_generic,
1871         add_output_section_generic.
1872         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
1873         functions for Output_data_reloc_generic.  Update declarations for
1874         changes listed in output.cc.
1875         (class Output_data_got): Change template parameter to got_size.
1876         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
1877         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
1878         function.
1879         (Sized_relobj_incr::do_local_plt_offset): New function.
1880         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
1881         add_global_generic.
1882
1883 2011-12-17  Cary Coutant  <ccoutant@google.com>
1884
1885         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
1886         * resolve.cc (Symbol_table::resolve): Likewise.
1887         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
1888         arrays.
1889         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
1890
1891 2011-12-16  Ian Lance Taylor  <iant@google.com>
1892
1893         * output.h (Output_data_reloc_generic::add): Only call
1894         add_dynamic_reloc if this is a dynamic reloc section.
1895
1896 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
1897
1898         PR gold/13505
1899         * target-reloc.h (apply_relocation): Replace <64, false> with
1900         <size, big_endian>.
1901
1902 2011-11-25  Nick Clifton  <nickc@redhat.com>
1903
1904         * po/it.po: New Italian translation.
1905
1906 2011-11-17  Sterling Augustine  <saugustine@google.com>
1907
1908         * script.cc (script_include_directive): Implement.
1909         (read_script_file): New local variables name and search_path. Update
1910         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
1911         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
1912         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
1913
1914 2011-11-11  Sterling Augustine  <saugustine@google.com>
1915
1916         * yyscript.y (section_cmd): Add support for INCLUDE directive.
1917         (file_or_sections_cmd): Likewise.
1918
1919 2011-11-11  Doug Kwan  <dougkwan@google.com>
1920
1921         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
1922         if --just-symbols is given.
1923
1924 2011-11-10  Doug Kwan  <dougkwan@google.com>
1925
1926         PR gold/13362
1927         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
1928         when processing data relocs.
1929         * reloc.h (Relocate_functions::rel_unaligned): New method.
1930         (Relocate_functions::pcrel_unaligned): Ditto.
1931         (Relocate_functions::rel32_unaligned): Ditto.
1932         (Relocate_functions::pcrel32_unaligned): Ditto.
1933
1934 2011-11-09  Doug Kwan  <dougkwan@google.com>
1935
1936         PR gold/13362
1937         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
1938         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
1939         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
1940         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1941         (Relocate_functions::rel_unaligned): New.
1942         (Relocate_functions::rel32_unaligned): New.
1943         * target-reloc.h (relocate_for_relocatable): Add code to handle
1944         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
1945         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
1946         arm_unaligned_reloc_r): New targets.
1947         * testsuite/Makefile.in: Regenerate.
1948         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
1949         linking.
1950
1951 2011-11-02  Ian Lance Taylor  <iant@google.com>
1952
1953         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
1954         NATIVE_LINKER.
1955         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
1956         * options.cc (General_options::finalize): Use library search path
1957         from configure script if specified.  If not native and no sysroot,
1958         only search TOOLLIBDIR.
1959         * options.h (Search_directory::Search_directory): Change name to
1960         const std::string&.
1961         (General_options::add_to_library_path_with_sysroot): Change arg to
1962         const std::string&.
1963         * configure, Makefile.in, config.in: Rebuild.
1964
1965 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1966
1967         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
1968         we are working around the ARM1176 Erratum.
1969         * options.h (General_options::fix_arm1176): Add option.
1970         * testsuite/Makefile.am: Add testcases, and keep current ones
1971         working.
1972         * testsuite/Makefile.in: Regenerate.
1973         * testsuite/arm_fix_1176.s: New file.
1974         * testsuite/arm_fix_1176.sh: Likewise.
1975
1976 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
1977
1978         * arm.cc (Target_arm::Target_arm): Remove initialisation of
1979         may_use_blx_.
1980         (Target_arm::may_use_blx): Remove method.
1981         (Target_arm::set_may_use_blx): Likewise.
1982         (Target_arm::may_use_v4t_interworking): New method.
1983         (Target_arm::may_use_v5t_interworking): Likewise.
1984         (Target_arm::may_use_blx_): Remove member variable.
1985         (Arm_relocate_functions::arm_branch_common): Check for v5T
1986         interworking.
1987         (Arm_relocate_functions::thumb_branch_common): Likewise.
1988         (Reloc_stub::stub_type_for_reloc): Likewise.
1989         (Target_arm::do_finalize_sections): Correct interworking checks.
1990         * testsuite/Makefile.am: Add new tests.
1991         * testsuite/Makefile.in: Regenerate.
1992         * testsuite/arm_farcall_arm_arm.s: New test.
1993         * testsuite/arm_farcall_arm_arm.sh: Likewise.
1994         * testsuite/arm_farcall_arm_thumb.s: Likewise.
1995         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
1996         * testsuite/arm_farcall_thumb_arm.s: Likewise.
1997         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
1998         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
1999         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2000
2001 2011-10-31  Cary Coutant  <ccoutant@google.com>
2002
2003         PR gold/13023
2004         * expression.cc (Expression::eval_with_dot): Add
2005         is_section_dot_assignment parameter.
2006         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2007         absolute and assigning to dot within a section.
2008         * script-sections.cc
2009         (Output_section_element_assignment::set_section_addresses): Pass
2010         dot_section to set_if_absolute.
2011         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2012         as is_section_dot_assignment flag to eval_with_dot.
2013         (Output_section_element_dot_assignment::set_section_addresses):
2014         Likewise.
2015         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2016         parameter.  Also set value if relative to dot_section; set the
2017         symbol's output_section.
2018         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2019         parameter.  Adjust all callers.
2020         (Expression::eval_maybe_dot): Likewise.
2021         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2022         Adjust all callers.
2023         * testsuite/script_test_2.t: Test assignment of an absolute value
2024         to dot within an output section element.
2025
2026 2011-10-31  Cary Coutant  <ccoutant@google.com>
2027
2028         * options.h (class General_options): Add --[no-]gnu-unique options.
2029         * symtab.cc (Symbol_table::sized_write_globals): Convert
2030         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2031
2032 2011-10-31  Cary Coutant  <ccoutant@google.com>
2033
2034         PR gold/13359
2035         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2036         unnecessary assertion.
2037         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2038
2039 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2040
2041         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2042         gc_mark_symbol.
2043         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2044         gc_mark_symbol.
2045         Change to just keep the section associated with symbol.
2046         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2047         they are externally visible and --export-dynamic is turned on.
2048         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2049
2050 2011-10-19  Ian Lance Taylor  <iant@google.com>
2051
2052         PR gold/13163
2053         * script-sections.cc
2054         (Output_section_element_dot_assignment::needs_output_section): New
2055         function.
2056
2057 2011-10-19  Ian Lance Taylor  <iant@google.com>
2058
2059         PR gold/13204
2060         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2061         --section-start option was seen.
2062         * options.h (General_options::any_section_start): New function.
2063
2064 2011-10-18  David S. Miller  <davem@davemloft.net>
2065
2066         PR binutils/13301
2067         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2068         member to track relocation locations that have moved during TLS
2069         reloc optimizations.
2070         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2071         (Target_sparc::Relocate::relocate): Adjust view down by 4
2072         bytes if it matches reloc_adjust_addr_.
2073         (Target_sparc::Relocate::relocate_tls): Always move the
2074         __tls_get_addr call delay slot instruction forward 4 bytes when
2075         performing relaxation.
2076
2077 2011-10-18  Cary Coutant  <ccoutant@google.com>
2078
2079         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2080         (Output_file::map_no_anonymous): Check for non-zero
2081         return code from posix_fallocate.
2082
2083 2011-10-17  Cary Coutant  <ccoutant@google.com>
2084
2085         PR gold/13245
2086         * plugin.cc (is_visible_from_outside): Check for symbols
2087         referenced from dynamic objects.
2088         * resolve.cc (Symbol_table::resolve): Don't count references
2089         from dynamic objects as references from real ELF files.
2090         * testsuite/plugin_test_2.sh: Adjust expected result.
2091
2092 2011-10-17  Cary Coutant  <ccoutant@google.com>
2093
2094         * gold.cc: Include timer.h.
2095         (queue_middle_tasks): Stamp time.
2096         (queue_final_tasks): Likewise.
2097         * main.cc (main): Store timer in parameters.  Print timers
2098         for each pass.
2099         * parameters.cc (Parameters::Parameters): Initialize timer_.
2100         (Parameters::set_timer): New function.
2101         (set_parameters_timer): New function.
2102         * parameters.h (Parameters::set_timer): New function.
2103         (Parameters::timer): New function.
2104         (Parameters::timer_): New data member.
2105         (set_parameters_timer): New function.
2106         * timer.cc (Timer::stamp): New function.
2107         (Timer::get_pass_time): New function.
2108         * timer.h (Timer::stamp): New function.
2109         (Timer::get_pass_time): New function.
2110         (Timer::pass_times_): New data member.
2111
2112 2011-10-17  Cary Coutant  <ccoutant@google.com>
2113
2114         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2115         task for members of lib groups.
2116
2117 2011-10-17  Cary Coutant  <ccoutant@google.com>
2118
2119         PR gold/13288
2120         * fileread.cc (File_read::find_view): Add assert.
2121         (File_read::make_view): Move bounds check (replace with assert)...
2122         (File_read::find_or_make_view): ... to here.
2123
2124 2011-10-12  Cary Coutant  <ccoutant@google.com>
2125
2126         * output.cc (Output_file::open_base_file): Handle case where
2127         ::read returns less than requested size.
2128
2129 2011-10-10  Cary Coutant  <ccoutant@google.com>
2130
2131         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
2132         Initialize defined_count_.
2133         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
2134         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
2135         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
2136         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
2137         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
2138         * incremental.h (Sized_relobj_incr::defined_count_): New data
2139         member.
2140         (Sized_incr_dynobj::defined_count_): New data member.
2141         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
2142         Return zeroes instead of internal error.
2143
2144 2011-10-10  Cary Coutant  <ccoutant@google.com>
2145
2146         PR gold/13249
2147         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
2148         (Output_reloc::symbol_value): Return PLT offset if flag is set.
2149         * output.h (class Output_reloc): Add use_plt_offset flag.
2150         (Output_reloc::type_): Adjust size of bit field.
2151         (Output_reloc::use_plt_offset_): New bit field.
2152         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
2153         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
2154         flag.  Adjust all callers.
2155         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
2156         creating RELATIVE relocations.
2157
2158 2011-10-10  Nick Clifton  <nickc@redhat.com>
2159
2160         * po/es.po: Updated Spanish translation.
2161         * po/fi.po: Updated Finnish translation.
2162
2163 2011-10-03   Diego Novillo  <dnovillo@google.com>
2164
2165         * options.cc (parse_uint): Fix dereference of RETVAL.
2166
2167 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
2168
2169         * layout.h (section_order_map_): New member.
2170         (get_section_order_map): New member function.
2171         * output.cc (Output_section::add_input_section): Check for patterns
2172         only when --section-ordering-file is specified.
2173         * gold.cc (queue_middle_tasks): Delay updating order of sections till
2174         output_sections have been formed.
2175         * layout.cc (Layout_Layout): Initialize section_order_map_.
2176         * plugin.cc (update_section_order): Store order in order_map. Do not
2177         update the order.
2178         * testsuite/Makefile.am: Add test case for plugin_final_layout.
2179         * testsuite/Makefile.in: Regenerate.
2180         * testsuite/plugin_section_order.c: New file.
2181         * testsuite/plugin_final_layout.cc: New file.
2182         * testsuite/plugin_final_layout.sh: New file.
2183
2184 2011-09-29  Cary Coutant  <ccoutant@google.com>
2185
2186         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
2187         Check for NULL.
2188         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
2189         symbols during incremental update.
2190         (Symbol_table::add_from_dynobj): Likewise.
2191
2192 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
2193             Ian Lance Taylor  <iant@google.com>
2194
2195         * symtab.cc (Symbol_table::define_special_symbol): Always
2196         canonicalize version string.
2197
2198 2011-09-26  Cary Coutant  <ccoutant@google.com>
2199
2200         * gold.cc (queue_initial_tasks): Move option checks ...
2201         * options.cc (General_options::finalize): ... to here. Disable
2202         some options; make others fatal.
2203
2204 2011-09-26  Cary Coutant  <ccoutant@google.com>
2205
2206         gcc PR lto/47247
2207         * plugin.cc (get_symbols_v2): New function.
2208         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
2209         (is_referenced_from_outside): New function.
2210         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
2211         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
2212         (get_symbols): Pass version parameter.
2213         (get_symbols_v2): New function.
2214         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
2215         parameter.
2216         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
2217         (onload): Add LDPT_GET_SYMBOLS_V2.
2218         (all_symbols_read_hook): Use get_symbols_v2; check for
2219         LDPR_PREVAILING_DEF_IRONLY_EXP.
2220         * testsuite/plugin_test_3.sh: Update expected results.
2221
2222 2011-09-23  Simon Baldwin  <simonb@google.com>
2223
2224         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
2225         configuration options.
2226         * configure: Regenerate.
2227         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
2228         * Makefile.in: Regenerate.
2229         * testsuite/Makefile.in: Regenerate.
2230
2231 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
2232
2233         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
2234
2235 2011-09-19  Cary Coutant  <ccoutant@google.com>
2236
2237         * incremental.cc (can_incremental_update): Fix typo in comment.
2238         * incremental.h (can_incremental_update): Likewise.
2239
2240 2011-09-18  Cary Coutant  <ccoutant@google.com>
2241
2242         * incremental.cc (can_incremental_update): New function.
2243         * incremental.h (can_incremental_update): New function.
2244         * layout.cc (Layout::init_fixed_output_section): Call it.
2245         (Layout::make_output_section): Don't allow patch space in .eh_frame.
2246         * object.cc (Sized_relobj_file::do_layout): Call
2247         can_incremental_update.
2248
2249 2011-09-13  Cary Coutant  <ccoutant@google.com>
2250
2251         * configure.ac: Check for glibc support for gnu_indirect_function
2252         support with static linking, setting automake conditional
2253         IFUNC_STATIC.
2254         * Makefile.in: Regenerate.
2255         * configure: Regenerate.
2256
2257         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
2258         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
2259         for IFUNC_STATIC.
2260         * testsuite/Makefile.in: Regenerate.
2261
2262 2011-09-13  Cary Coutant  <ccoutant@google.com>
2263
2264         * incremental.cc (Sized_relobj_incr::do_layout): Call
2265         report_comdat_group for kept comdat sections.
2266         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
2267         * testsuite/Makefile.in: Regenerate.
2268         * testsuite/incr_comdat_test_1.cc: New source file.
2269         * testsuite/incr_comdat_test_2_v1.cc: New source file.
2270         * testsuite/incr_comdat_test_2_v2.cc: New source file.
2271         * testsuite/incr_comdat_test_2_v3.cc: New source file.
2272
2273 2011-09-13  Ian Lance Taylor  <iant@google.com>
2274
2275         * object.cc (Sized_relobj_file::do_layout): Remove unused local
2276         variable external_symbols_offset.
2277
2278 2011-09-12  Ian Lance Taylor  <iant@google.com>
2279
2280         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
2281         triggered if object has no symbols.
2282
2283 2011-09-09  David S. Miller  <davem@davemloft.net>
2284
2285         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
2286         (Output_fill_debug_line::do_write): Likewise.
2287
2288 2011-08-29  Cary Coutant  <ccoutant@google.com>
2289
2290         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
2291         casts to match formatting specs.
2292         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
2293
2294 2011-08-26  Cary Coutant  <ccoutant@google.com>
2295
2296         * layout.cc (Free_list::allocate): Provide guarantee of minimum
2297         remaining hole size when allocating.
2298         (Layout::make_output_section): Set fill methods for debug sections.
2299         * layout.h (Free_list::Free_list_node): Move from private to
2300         public.
2301         (Free_list::set_min_hole_size): New function.
2302         (Free_list::begin, Free_list::end): New functions.
2303         (Free_list::min_hole_): New data member.
2304         * output.cc: Include dwarf.h.
2305         (Output_fill_debug_info::do_minimum_hole_size): New function.
2306         (Output_fill_debug_info::do_write): New function.
2307         (Output_fill_debug_line::do_minimum_hole_size): New function.
2308         (Output_fill_debug_line::do_write): New function.
2309         (Output_section::Output_section): Initialize new data member.
2310         (Output_section::set_final_data_size): Ensure patch space is larger
2311         than minimum hole size.
2312         (Output_section::do_write): Fill holes in debug sections.
2313         * output.h (Output_fill): New class.
2314         (Output_fill_debug_info): New class.
2315         (Output_fill_debug_line): New class.
2316         (Output_section::set_free_space_fill): New function.
2317         (Output_section::free_space_fill_): New data member.
2318         * testsuite/Makefile.am (incremental_test_3): Add
2319         --incremental-patch option.
2320         (incremental_test_4): Likewise.
2321         (incremental_test_5): Likewise.
2322         (incremental_test_6): Likewise.
2323         (incremental_copy_test): Likewise.
2324         (incremental_common_test_1): Likewise.
2325         * testsuite/Makefile.in: Regenerate.
2326
2327 2011-08-26  Nick Clifton  <nickc@redhat.com>
2328
2329         * po/es.po: Updated Spanish translation.
2330
2331 2011-08-01  Cary Coutant  <ccoutant@google.com>
2332
2333         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
2334         * gold/testsuite/Makefile.in: Regenerate.
2335         * gold/testsuite/justsyms_exec.c: New source file.
2336         * gold/testsuite/justsyms_lib.c: New source file.
2337
2338 2011-08-01  Cary Coutant  <ccoutant@google.com>
2339
2340         * layout.cc (Layout::set_segment_offsets): Don't realign text
2341         segment if -Ttext was specified.
2342         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
2343         file type.
2344         * object.h (Sized_relobj_file::e_type): New function.
2345         (Sized_relobj_file::e_type_): New data member.
2346         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
2347         base address for ET_EXEC files.
2348         * target.cc (Target::do_make_elf_object_implementation): Allow
2349         ET_EXEC files with --just-symbols option.
2350
2351 2011-07-28  Cary Coutant  <ccoutant@google.com>
2352
2353         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
2354         Add thread_number parameter.
2355         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
2356         * workqueue-threads.cc
2357         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
2358         current thread if its thread number is greater than desired thread
2359         count.
2360         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
2361         Add thread_number parameter.
2362         (Workqueue::should_cancel_thread): Likewise.
2363         (Workqueue::find_runnable_or_wait): Pass thread_number to
2364         should_cancel_thread.
2365         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
2366         parameter.
2367
2368 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
2369
2370         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
2371         only after checking if it cannot be forced local.
2372         * symtab.h (is_externally_visible): Check if the symbol is not forced
2373         local.
2374
2375 2011-07-15  Ian Lance Taylor  <iant@google.com>
2376
2377         * options.h (class General_options): Add --print-output-format.
2378         Move -EL next to -EB, for  better --help output.
2379         * target-select.cc: Include <cstdio>, "options.h", and
2380         "parameters.h".
2381         (Target_selector::do_target_bfd_name): New function.
2382         (print_output_format): New function.
2383         * target-select.h (class Target_selector): Update declarations.
2384         (Target_selector::target_bfd_name): New function.
2385         (print_output_format): Declare.
2386         * main.cc: Include "target-select.h".
2387         (main): Handle --print-output-format.
2388         * gold.cc: Include "target-select.h".
2389         (queue_initial_tasks): Handle --print-output-format when there are
2390         no input files.
2391         * parameters.cc (parameters_force_valid_target): Give a better
2392         error message if -EB/-EL does not match target.
2393         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
2394         function.
2395
2396 2011-07-15  Ian Lance Taylor  <iant@google.com>
2397
2398         * i386.cc (class Output_data_plt_i386): Add layout_ field.
2399         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
2400         (Output_data_plt_i386::do_write): Write address of .dynamic
2401         section to first entry in .got.plt section.
2402         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
2403         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2404         Initialize layout_.
2405         (Output_data_plt_x86_64::do_write): Write address of .dynamic
2406         section to first entry in .got.plt section.
2407         * layout.h (Layout::dynamic_section): New function.
2408
2409 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
2410
2411         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
2412         to claim_file call.
2413         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
2414         input_section_position_, and input_section_glob_.
2415         (read_layout_from_file): Call function section_ordering_specified.
2416         * layout.h (is_section_ordering_specified): New function.
2417         (section_ordering_specified): New function.
2418         (section_ordering_specified_): New boolean member.
2419         * main.cc(main): Call load_plugins after layout object is defined.
2420         * output.cc (Output_section::add_input_section): Use
2421         function section_ordering_specified to check if section ordering is
2422         needed.
2423         * output.cc (Output_section::add_relaxed_input_section): Use
2424         function section_ordering_specified to check if section ordering is
2425         needed.
2426         (Output_section::update_section_layout): New function.
2427         (Output_section::sort_attached_input_sections): Check if input section
2428         must be reordered.
2429         * output.h (Output_section::update_section_layout): New function.
2430         * plugin.cc (get_section_count): New function.
2431         (get_section_type): New function.
2432         (get_section_name): New function.
2433         (get_section_contents): New function.
2434         (update_section_order): New function.
2435         (allow_section_ordering): New function.
2436         (Plugin::load): Add the new interfaces to the transfer vector.
2437         (Plugin_manager::load_plugins): New parameter.
2438         (Plugin_manager::all_symbols_read): New parameter.
2439         (Plugin_manager::claim_file): New parameter. Save the elf object for
2440         unclaimed objects.
2441         (Plugin_manager::get_elf_object): New function.
2442         (Plugin_manager::get_view): Change to directly use the bool to check
2443         if get_view is called from claim_file_hook.
2444         * plugin.h (input_objects): New function
2445         (Plugin__manager::load_plugins): New parameter.
2446         (Plugin_manager::claim_file): New parameter.
2447         (Plugin_manager::get_elf_object): New function.
2448         (Plugin_manager::in_claim_file_handler): New function.
2449         (Plugin_manager::in_claim_file_handler_): New member.
2450         (layout): New function.
2451         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
2452         handler with an extra parameter. Make the elf object before calling
2453         claim_file handler.
2454         * testsuite/plugin_test.c (get_section_count): New function pointer.
2455         (get_section_type): New function pointer.
2456         (get_section_name): New function pointer.
2457         (get_section_contents): New function pointer.
2458         (update_section_order): New function pointer.
2459         (allow_section_ordering): New function pointer.
2460         (onload): Check if the new interfaces exist.
2461
2462 2011-07-13  Ian Lance Taylor  <iant@google.com>
2463
2464         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
2465         relro section.
2466         * x86_64.cc (Target_x86_64::got_section): Likewise.
2467         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
2468         (relro_now_test_SOURCES): New variable.
2469         (relro_now_test_DEPENDENCIES): New variable.
2470         (relro_now_test_LDFLAGS): New variable.
2471         (relro_now_test_LDADD): New variable.
2472         (relro_now_test.so): New target.
2473         * testsuite/Makefile.in: Rebuild.
2474
2475 2011-07-12  Ian Lance Taylor  <iant@google.com>
2476
2477         PR gold/12980
2478         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
2479         GLOB_DAT relocation rather than a RELATIVE relocation for a
2480         protected symbol when creating a shared library.
2481         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2482         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
2483         * testsuite/protected_main_1.cc (main): Test that protected
2484         function has same address.
2485
2486 2011-07-11  Ian Lance Taylor  <iant@google.com>
2487
2488         PR gold/12979
2489         * options.h (class General_options): Add -Bgroup.
2490         * options.cc (General_options::finalize): If -Bgroup is set,
2491         default to --unresolved-symbols=report-all.
2492         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
2493         * target-reloc.h (issue_undefined_symbol_error): Handle
2494         --unresolved-symbols=report-all.
2495
2496 2011-07-08  Ian Lance Taylor  <iant@google.com>
2497
2498         PR gold/11985
2499         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
2500         if linker script discards key sections.
2501         (Layout::create_dynamic_symtab): Likewise.
2502         (Layout::assign_local_dynsym_offsets): Likewise.
2503         (Layout::sized_create_version_sections): Likewise.
2504         (Layout::create_interp): Likewise.
2505         (Layout::finish_dynamic_section): Likewise.
2506         (Layout::set_dynamic_symbol_size): Likewise.
2507
2508 2011-07-08  Ian Lance Taylor  <iant@google.com>
2509
2510         PR gold/12386
2511         * options.h (class General_options): Add --unresolved-symbols.
2512         * target-reloc.h (issue_undefined_symbol_error): Check
2513         --unresolved-symbols.  Add comments.
2514
2515 2011-07-08  Ian Lance Taylor  <iant@google.com>
2516
2517         * testsuite/odr_violation2.cc (Ordering::operator()): Make
2518         expression more complex.
2519
2520 2011-07-08  Ian Lance Taylor  <iant@google.com>
2521
2522         PR gold/11317
2523         * target-reloc.h (issue_undefined_symbol_error): New inline
2524         function, broken out of relocate_section.
2525         (relocate_section): Call issue_undefined_symbol_error.
2526         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2527         there is no TLS segment if we are about to issue an undefined
2528         symbol error.
2529         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2530
2531 2011-07-08  Ian Lance Taylor  <iant@google.com>
2532
2533         PR gold/12279
2534         * resolve.cc (Symbol_table::should_override): Add fromtype
2535         parameter.  Change all callers.  Give error when linking together
2536         TLS and non-TLS symbol.
2537         (Symbol_table::should_override_with_special): Add fromtype
2538         parameter.  Change all callers.
2539         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
2540         there is no TLS segment if we have reported some errors.
2541         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
2542
2543 2011-07-08  Ian Lance Taylor  <iant@google.com>
2544
2545         PR gold/12372
2546         * target.h (Target::plt_address_for_global): New function.
2547         (Target::plt_address_for_local): New function.
2548         (Target::plt_section_for_global): Remove.
2549         (Target::plt_section_for_local): Remove.
2550         (Target::do_plt_address_for_global): New virtual function.
2551         (Target::do_plt_address_for_local): New virtual function.
2552         (Target::do_plt_section_for_global): Remove.
2553         (Target::do_plt_section_for_local): Remove.
2554         (Target::register_global_plt_entry): Add Symbol_table and Layout
2555         parameters.
2556         * output.cc (Output_data_got::Got_entry::write): Use
2557         plt_address_for_global and plt_address_for_local.
2558         * layout.cc (Layout::add_target_dynamic_tags): Use size and
2559         address of output section.
2560         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
2561         got_irelative_, and irelative_count_ fields.  Update
2562         declarations.
2563         (Output_data_plt_i386::has_irelative_section): New function.
2564         (Output_data_plt_i386::entry_count): Add irelative_count_.
2565         (Output_data_plt_i386::set_final_data_size): Likewise.
2566         (class Target_i386): Add got_irelative_ and rel_irelative_
2567         fields.  Update declarations.
2568         (Target_i386::Target_i386): Initialize new fields.
2569         (Target_i386::do_plt_address_for_global): New function replacing
2570         do_plt_section_for_global.
2571         (Target_i386::do_plt_address_for_local): New function replacing
2572         do_plt_section_for_local.
2573         (Target_i386::got_section): Create got_irelative_.
2574         (Target_i386::rel_irelative_section): New function.
2575         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
2576         fields.  Don't define __rel_iplt_{start,end}.
2577         (Output_data_plt_i386::add_entry): Add symtab and layout
2578         parameters.  Change all callers.  Use different PLT and GOT for
2579         IFUNC symbols.
2580         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
2581         layout parameters.  Change all callers.  Use different PLT and
2582         GOT.
2583         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
2584         (Output_data_plt_i386::rel_irelative): New function.
2585         (Output_data_plt_i386::address_for_global): New function.
2586         (Output_data_plt_i386::address_for_local): New function.
2587         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
2588         IRELATIVE GOT when changing IFUNC GOT entries.
2589         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
2590         reloc.
2591         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
2592         if we didn't create an IRELATIVE GOT.
2593         (Target_i386::Relocate::relocate): Use plt_address_for_global and
2594         plt_address_for_local.
2595         (Target_i386::do_dynsym_value): Use plt_address_for_global.
2596         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
2597         got_irelative_, and irelative_count_ fields.  Update
2598         declarations.
2599         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
2600         Initialize new fields.  Remove symtab parameter.  Change all
2601         callers.
2602         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
2603         irelative_count_.
2604         (Output_data_plt_x86_64::has_irelative_section): New function.
2605         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
2606         (class Target_x86_64): Add got_irelative_ and rel_irelative_
2607         fields.  Update declarations.
2608         (Target_x86_64::Target_x86_64): Initialize new fields.
2609         (Target_x86_64::do_plt_address_for_global): New function replacing
2610         do_plt_section_for_global.
2611         (Target_x86_64::do_plt_address_for_local): New function replacing
2612         do_plt_section_for_local.
2613         (Target_x86_64::got_section): Create got_irelative_.
2614         (Target_x86_64::rela_irelative_section): New function.
2615         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
2616         all callers.  Don't create __rel_iplt_{start,end}.
2617         (Output_data_plt_x86_64::add_entry): Add symtab and layout
2618         parameters.  Change all callers.  Use different PLT and GOT for
2619         IFUNC symbols.
2620         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
2621         layout parameters.  Change all callers.  Use different PLT and
2622         GOT.
2623         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
2624         parameters.  Change all callers.  Use different PLT and GOT for
2625         IFUNC symbols.
2626         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
2627         (Output_data_plt_x86_64::rela_irelative): New function.
2628         (Output_data_plt_x86_64::address_for_global): New function.
2629         (Output_data_plt_x86_64::address_for_local): New function.
2630         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2631         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
2632         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
2633         (Target_x86_64::register_global_plt_entry): Add symtab and layout
2634         parameters.
2635         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
2636         reloc.
2637         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
2638         symbols if we didn't create an IRELATIVE GOT.
2639         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
2640         plt_address_for_local.
2641         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
2642         * testsuite/ifuncvar1.c: New test file.
2643         * testsuite/ifuncvar2.c: New test file.
2644         * testsuite/ifuncvar3.c: New test file.
2645         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
2646         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
2647         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
2648         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
2649         * testsuite/Makefile.in: Rebuild.
2650
2651 2011-07-07  Cary Coutant  <ccoutant@google.com>
2652
2653         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
2654         (two_file_test_1_ndebug.o): Likewise.
2655         (two_file_test_1b_ndebug.o): Likewise.
2656         (two_file_test_2_ndebug.o): Likewise.
2657         (two_file_test_main_ndebug.o): Likewise.
2658         (incremental_test_2): Link with no-debug versions.
2659
2660 2011-07-06  Cary Coutant  <ccoutant@google.com>
2661
2662         * gold/incremental.cc
2663         (Output_section_incremental_inputs::write_info_blocks): Check for
2664         hidden and internal symbols.
2665
2666 2011-07-06  Cary Coutant  <ccoutant@google.com>
2667
2668         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
2669         Check disposition for startup file.
2670         (Incremental_inputs::report_command_line): Ignore
2671         --incremental-startup-unchanged option.
2672         * options.cc (General_options::parse_incremental_startup_unchanged):
2673         New function.
2674         (General_options::General_options): Initialize new data member.
2675         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
2676         (General_options): Add --incremental-startup-unchanged option.
2677         (General_options::incremental_startup_disposition): New function.
2678         (General_options::incremental_startup_disposition_): New data member.
2679
2680 2011-07-06  Cary Coutant  <ccoutant@google.com>
2681
2682         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
2683         input file index to Script_info ctor.
2684         (Sized_incremental_binary::do_file_has_changed): Find the
2685         command-line argument for files named in scripts.
2686         * incremental.h (Script_info::Script_info): New ctor
2687         with input file index.
2688         (Script_info::input_file_index): New function.
2689         (Script_info::input_file_index_): New data member.
2690         (Incremental_binary::get_library): Add const.
2691         (Incremental_binary::get_script_info): Add const.
2692         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
2693         * testsuite/Makefile.am (incremental_test_5): New test case.
2694         (incremental_test_6): New test case.
2695         * testsuite/Makefile.in: Regenerate.
2696
2697 2011-07-06  Cary Coutant  <ccoutant@google.com>
2698
2699         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
2700         debug output when command lines differ.
2701
2702 2011-07-06  Cary Coutant  <ccoutant@google.com>
2703
2704         * incremental.cc (Incremental_inputs::report_command_line): Ignore
2705         --incremental-patch option.
2706         * layout.cc (Free_list::allocate): Extend allocation beyond original
2707         end if enabled.
2708         (Layout::make_output_section): Mark sections that should get
2709         patch space.
2710         * options.cc (parse_percent): New function.
2711         * options.h (parse_percent): New function.
2712         (DEFINE_percent): New macro.
2713         (General_options): Add --incremental-patch option.
2714         * output.cc (Output_section::Output_section): Initialize new data
2715         members.
2716         (Output_section::add_input_section): Print section name when out
2717         of patch space.
2718         (Output_section::add_output_section_data): Likewise.
2719         (Output_section::set_final_data_size): Add patch space when
2720         doing --incremental-full.
2721         (Output_section::do_reset_address_and_file_offset): Remove patch
2722         space.
2723         (Output_segment::set_section_list_addresses): Print debug output
2724         only if --incremental-update.
2725         * output.h (Output_section::set_is_patch_space_allowed): New function.
2726         (Output_section::is_patch_space_allowed_): New data member.
2727         (Output_section::patch_space_): New data member.
2728         * parameters.cc (Parameters::incremental_full): New function.
2729         * parameters.h (Parameters::incremental_full): New function
2730         * testsuite/Makefile.am (incremental_test_2): Add test for
2731         --incremental-patch option.
2732         * testsuite/Makefile.in: Regenerate.
2733         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
2734         (t18): Remove function body.
2735
2736 2011-07-05  Doug Kwan  <dougkwan@google.com>
2737
2738         PR gold/12771
2739         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
2740         Arm_Address type for relocation result.
2741         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
2742         overflow check.
2743         (Arm_relocate_functions::abs32): Use unaligned access.
2744         (Arm_relocate_functions::rel32): Ditto.
2745         (Arm_relocate_functions::prel31): Ditto.
2746         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
2747         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
2748         static data relocations.
2749         * testsuite/Makefile.in: Regnerate.
2750         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
2751
2752 2011-07-05  Ian Lance Taylor  <iant@google.com>
2753
2754         PR gold/12392
2755         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
2756         symbols if necessary.
2757         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
2758
2759 2011-07-05  Ian Lance Taylor  <iant@google.com>
2760
2761         PR gold/12952
2762         * resolve.cc (Symbol::override_base_with_special): Simply override
2763         version with special symbol version, ignoring previous version.
2764
2765 2011-07-05  Ian Lance Taylor  <iant@google.com>
2766
2767         * object.cc (Sized_relobj_file::include_section_group): Add
2768         information to comment about signature location.
2769
2770 2011-07-02  Ian Lance Taylor  <iant@google.com>
2771
2772         PR gold/12957
2773         * options.h (class General_options): Add -f and -F.
2774         * options.cc (General_options::finalize): Fatal error if -f/-F
2775         are used without -shared.
2776         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
2777
2778 2011-07-02  Ian Lance Taylor  <iant@google.com>
2779
2780         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
2781
2782 2011-07-01  Ian Lance Taylor  <iant@google.com>
2783
2784         PR gold/12525
2785         PR gold/12952
2786         * resolve.cc (Symbol::override_base_with_special): Don't override
2787         the version if the overriding symbol has a different name.
2788         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
2789         all callers.  If we give an error about an undefined version,
2790         define the base version if necessary.
2791         * dynobj.h (class Versions): Update declaration.
2792         * testsuite/weak_alias_test_5.cc: New file.
2793         * testsuite/weak_alias_test.script: New file.
2794         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
2795         and versioned_alias have the right value, and call t2.
2796         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
2797         weak_alias_test_5.so.
2798         (weak_alias_test_LDADD): Likewise.
2799         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
2800         * testsuite/Makefile.in: Rebuild.
2801
2802 2011-07-01  Ian Lance Taylor  <iant@google.com>
2803
2804         PR gold/12525
2805         * options.h (class General_options): Support -z notext.
2806         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
2807         -Wl,-z,notext.
2808         (two_file_shared_nonpic.so): Likewise.
2809         (two_file_shared_mixed.so): Likewise.
2810         (two_file_shared_mixed_1.so): Likewise.
2811         (weak_undef_lib_nonpic.so): Likewise.
2812         (alt/weak_undef_lib_nonpic.so): Likewise.
2813         (tls_test_shared_nonpic.so): Likewise.
2814         * testsuite/Makefile.in: Rebuild.
2815
2816 2011-07-01  Ian Lance Taylor  <iant@google.com>
2817
2818         PR gold/12525
2819         * configure.ac: Test whether static linking works, setting
2820         the automake conditional HAVE_STATIC.
2821         * testsuite/Makefile.am: Disable tests using -static if
2822         HAVE_STATIC is not true.
2823         * configure, testsuite/Makefile.in: Rebuild.
2824
2825 2011-07-01  Ian Lance Taylor  <iant@google.com>
2826
2827         PR gold/12525
2828         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
2829         Assert if we see DW_EH_PE_indirect.
2830         * target.h (Target::ehframe_datarel_base): New function.
2831         (Target::do_ehframe_datarel_base): New target function.
2832         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
2833         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
2834         function.
2835
2836 2011-07-01  Ian Lance Taylor  <iant@google.com>
2837
2838         PR gold/12571
2839         * options.h (class General_options): Add
2840         --ld-generated-unwind-info.
2841         * ehframe.cc (Fde::write): Add address parameter.  Change all
2842         callers.  If associated with PLT, fill in address and size.
2843         (Cie::set_output_offset): Only add merge mapping if there is an
2844         object.
2845         (Cie::write): Add address parameter.  Change all callers.
2846         (Eh_frame::add_ehframe_for_plt): New function.
2847         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
2848         input_offset_ fields into union u_, with new plt field.
2849         (Fde::Fde): Adjust for new union field.
2850         (Fde::Fde) [Output_data version]: New constructor.
2851         (Fde::add_mapping): Only add merge mapping if there is an object.
2852         (class Cie): Update declarations.
2853         (class Eh_frame): Declare add_ehframe_for_plt.
2854         * layout.cc (Layout::layout_eh_frame): Break out code into
2855         make_eh_frame_section, and call it.
2856         (Layout::make_eh_frame_section): New function.
2857         (Layout::add_eh_frame_for_plt): New function.
2858         * layout.h (class Layout): Update declarations.
2859         * merge.cc (Merge_map::add_mapping): Add assertion.
2860         * i386.cc: Include "dwarf.h".
2861         (class Output_data_plt_i386): Make first_plt_entry,
2862         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
2863         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2864         and plt_eh_frame_fde.
2865         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
2866         boundary.  Call add_eh_frame_for_plt if appropriate.
2867         * x86_64.cc: Include "dwarf.h".
2868         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
2869         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
2870         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
2871         and plt_eh_frame_fde.
2872         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
2873         appropriate.
2874
2875 2011-06-29  Ian Lance Taylor  <iant@google.com>
2876
2877         PR gold/12629
2878         * object.cc (Sized_relobj_file::layout_section): Change shdr
2879         parameter to be const.
2880         (Sized_relobj_file::layout_eh_frame_section): New function, broken
2881         out of do_layout.
2882         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
2883         appropriate.  Call layout_eh_frame_section.
2884         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
2885         sections.
2886         * object.h (class Sized_relobj_file): Update declarations.
2887
2888 2011-06-29  Ian Lance Taylor  <iant@google.com>
2889
2890         PR gold/12652
2891         * script.cc (Token::integer_value): Accept trailing M/m/K/k
2892         modifier.
2893         (Lex::gather_token): Accept trailing M/m/K/k for integers.
2894
2895 2011-06-29  Ian Lance Taylor  <iant@google.com>
2896
2897         PR gold/12675
2898         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
2899         SHT_X86_64_UNWIND.
2900         * layout.cc (Layout::layout_eh_frame): Likewise.
2901
2902 2011-06-29  Ian Lance Taylor  <iant@google.com>
2903
2904         PR gold/12695
2905         * layout.cc (Layout::symtab_section_shndx): New function.
2906         * layout.h (class Layout): Declare symtab_section_shndx.
2907         * output.cc (Output_section::write_header): Call it.
2908
2909 2011-06-29  Ian Lance Taylor  <iant@google.com>
2910
2911         PR gold/12818
2912         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
2913         symbols which are not used in a relocation.
2914
2915 2011-06-28  Ian Lance Taylor  <iant@google.com>
2916
2917         PR gold/12898
2918         * layout.cc (Layout::segment_precedes): Don't crash if a linker
2919         script create indistinguishable segments.
2920         (Layout::set_segment_offsets): Use stable_sort when sorting
2921         segments.  Pass this to Compare_segments constructor.
2922         * layout.h (class Layout): Make segment_precedes non-static.
2923         (class Compare_segments): Change from struct to class.  Add
2924         layout_ field.  Add constructor.
2925         * script-sections.cc
2926         (Script_sections::attach_sections_using_phdrs_clause): Rename
2927         local orphan to is_orphan.  Don't report failure to put empty
2928         section in segment.  On attachment failure, report name of
2929         section, and attach to first PT_LOAD segment.
2930
2931 2011-06-28  Ian Lance Taylor  <iant@google.com>
2932
2933         PR gold/12934
2934         * target-select.cc (Target_selector::Target_selector): Add
2935         emulation parameter.  Change all callers.
2936         (select_target_by_bfd_name): Rename from select_target_by_name.
2937         Change all callers.
2938         (select_target_by_emulation): New function.
2939         (supported_emulation_names): New function.
2940         * target-select.h (class Target_selector): Add emulation_ field.
2941         Update declarations.
2942         (Target_selector::recognize_by_bfd_name): Rename from
2943         recognize_by_name.  Change all callers.
2944         (Target_selector::supported_bfd_names): Rename from
2945         supported_names.  Change all callers.
2946         (Target_selector::recognize_by_emulation): New function.
2947         (Target_selector::supported_emulations): New function.
2948         (Target_selector::emulation): New function.
2949         (Target_selector::do_recognize_by_bfd_name): Rename from
2950         do_recognize_by_name.  Change all callers.
2951         (Target_selector::do_supported_bfd_names): Rename from
2952         do_supported_names.  Change all callers.
2953         (Target_selector::do_recognize_by_emulation): New function.
2954         (Target_selector::do_supported_emulations): New function.
2955         (select_target_by_bfd_name): Change name in declaration.
2956         (select_target_by_emulation): Declare.
2957         (supported_emulation_names): Declare.
2958         * parameters.cc (parameters_force_valid_target): Try to find
2959         target based on emulation from -m option.
2960         * options.h (class General_options): Change doc string for -m.
2961         * options.cc (help): Print emulations.
2962         (General_options::parse_V): Likewise.
2963         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
2964         Add emulation parameter.  Change all callers.
2965
2966 2011-06-28  Ian Lance Taylor  <iant@google.com>
2967
2968         * target.h (class Target): Add osabi_ field.
2969         (Target::osabi): New function.
2970         (Target::set_osabi): New function.
2971         (Target::Target): Initialize osabi_.
2972         (Target::do_adjust_elf_header): Make pure virtual.
2973         (Sized_target::do_adjust_elf_header): Declare.
2974         * target.cc (Sized_target::do_adjust_elf_header): New function.
2975         (class Sized_target): Instantiate all versions.
2976         * freebsd.h (class Target_freebsd): Remove.
2977         (Target_selector_freebsd::do_recognize): Call set_osabi on
2978         Target.
2979         (Target_selector_freebsd::do_recognize_by_name): Likewise.
2980         (Target_selector_freebsd::set_osabi): Remove.
2981         * i386.cc (class Target_i386): Inherit from Sized_target rather
2982         than Target_freebsd.
2983         * x86_64.cc (class Target_x86_64): Likewise.
2984
2985 2011-06-28  Ian Lance Taylor  <iant@google.com>
2986
2987         * target.h (Target::can_check_for_function_pointers): Rewrite.
2988         Make non-virtual.
2989         (Target::can_icf_inline_merge_sections): Likewise.
2990         (Target::section_may_have_icf_unsafe_poineters): Likewise.
2991         (Target::Target_info): Add can_icf_inline_merge_sections field.
2992         (Target::do_can_check_for_function_pointers): New virtual
2993         function.
2994         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
2995         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
2996         from can_check_for_function_pointers, move in file.
2997         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
2998         section_may_have_icf_unsafe_poineters, move in file.
2999         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3000         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3001         Rename from can_check_for_function_pointers, move in file.
3002         (Target_i386::can_icf_inline_merge_sections): Remove.
3003         (Target_i386::i386_info): Initialize
3004         can_icf_inline_merge_sections.
3005         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3006         Initialize can_icf_inline_merge_sections.
3007         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3008         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3009         Rename from can_check_for_function_pointers, move in file.
3010         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3011         (Target_x86_64::x86_64_info): Initialize
3012         can_icf_inline_merge_sections.
3013         * testsuite/testfile.cc (Target_test::test_target_info):
3014         Likewise.
3015         * icf.cc (get_section_contents): Correct formatting.
3016
3017 2011-06-27  Ian Lance Taylor  <iant@google.com>
3018
3019         * symtab.cc (Symbol::versioned_name): New function.
3020         (Symbol_table::add_to_final_symtab): Use versioned_name when
3021         appropriate.
3022         (Symbol_table::sized_write_symbol): Likewise.
3023         * symtab.h (class Symbol): Declare versioned_name.
3024         * stringpool.h (class Stringpool_template): Add variant of add
3025         which takes a std::basic_string.
3026         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3027         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3028         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3029         (ver_test_12.o): New target.
3030         * testsuite/Makefile.in: Rebuild.
3031
3032 2011-06-27  Doug Kwan  <dougkwan@google.com>
3033
3034         * arm.cc (Arm_relocate_functions::thm_jump8,
3035         Arm_relocate_functions::thm_jump11): Use a wider signed
3036         type to compute offset.
3037         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3038         arm_thm_jump8.
3039         * testsuite/Makefile.in: Regenerate.
3040         * testsuite/arm_branch_in_range.sh: Check test results of
3041         arm_thm_jump11 and arm_thm_jump8.
3042         * testsuite/arm_thm_jump11.s: New test source file.
3043         * testsuite/arm_thm_jump11.t: New linker script.
3044         * testsuite/arm_thm_jump8.s: New test source file.
3045         * testsuite/arm_thm_jump8.t: New linker script.
3046
3047 2011-06-24  Ian Lance Taylor  <iant@google.com>
3048
3049         * layout.cc: Include "object.h".
3050         (ctors_sections_in_init_array): New static variable.
3051         (Layout::is_ctors_in_init_array): New function.
3052         (Layout::layout): Add entry to ctors_sections_in_init_array if
3053         appropriate.
3054         * layout.h (class Layout): Declare is_ctors_in_init_array.
3055         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3056         is_ctors_reverse_view is set.
3057         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3058         all callers.  Set is_ctors_reverse_view field of View_size.
3059         (Sized_relobj_file::reverse_words): New function.
3060         * object.h (Sized_relobj_file::View_size): Add
3061         is_ctors_reverse_view field.
3062         (class Sized_relobj_file): Update declarations.
3063         * testsuite/initpri3.c: New test.
3064         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3065         initpri3b.
3066         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3067         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3068         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3069         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3070         * testsuite/Makefile.in: Rebuild.
3071
3072 2011-06-24  Cary Coutant  <ccoutant@google.com>
3073
3074         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3075         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3076         (debug_msg_cdebug.err): New targets.
3077         * testsuite/Makefile.in: Regenerate.
3078         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3079         Fix checks for link with shared library.
3080
3081 2011-06-24  Doug Kwan  <dougkwan@google.com>
3082
3083         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3084         skip empty text sections.
3085         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3086
3087 2011-06-22  Ian Lance Taylor  <iant@google.com>
3088
3089         PR gold/12910
3090         * options.h (class General_options): Add --ctors-in-init-array.
3091         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3092         friends as SHT_PROGBITS for merging sections.
3093         (Layout::layout): Remove special handling of .init_array and
3094         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3095         and .dtors if ctors_in_init_array.
3096         (Layout::make_output_section): Force correct section types for
3097         .init_array and friends.  Don't sort if doing relocatable link,
3098         Don't sort .ctors and .dtors if ctors_in_init_array.
3099         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3100         (Layout::output_section_name): Add relobj parameter.  Change all
3101         callers.  Handle .ctors. and .dtors. in code rather than table.
3102         Handle .ctors and .dtors if ctors_in_init_array.
3103         (Layout::match_file_name): New function, moved from output.cc.
3104         * layout.h (class Layout): Update declarations.
3105         * output.cc: Include "layout.h".
3106         (Input_section_sort_entry::get_priority): New function.
3107         (Input_section_sort_entry::match_file_name): Just call
3108         Layout::match_file_name.
3109         (Output_section::Input_section_sort_init_fini_compare::operator()):
3110         Handle .ctors and .dtors.  Sort by explicit priority rather than
3111         by name.
3112         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3113         * testsuite/initpri2.c: New test.
3114         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3115         (check_PROGRAMS): Add initpri2.
3116         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3117         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3118         * configure, testsuite/Makefile.in: Rebuild.
3119
3120 2011-06-19  Ian Lance Taylor  <iant@google.com>
3121
3122         PR gold/12880
3123         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
3124         .interp section to a PT_INTERP segment even if we have seen a
3125         --dynamic-linker option.  Don't do it if we have seen a PHDRS
3126         clause in a linker script.
3127         (Layout::finalize): Don't create a .interp section if we've
3128         already create a PT_INTERP segment.
3129         (Layout::create_interp): Always call choose_output_section (revert
3130         patch of 2011-06-17).  Don't create PT_INTERP segment.
3131         * script-sections.cc
3132         (Script_sections::create_note_and_tls_segments): Add a .interp
3133         section to a PT_INTERP segment even if we have seen a
3134         --dynamic-linker option.
3135
3136 2011-06-18  Ian Lance Taylor  <iant@google.com>
3137
3138         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
3139         merely because a non-PT_LOAD segment has a dynamic reloc.
3140
3141 2011-06-18  Ian Lance Taylor  <iant@google.com>
3142
3143         * layout.cc (Layout::finish_dynamic_section): Don't create
3144         DT_FLAGS entry if not needed.
3145
3146 2011-06-18  Ian Lance Taylor  <iant@google.com>
3147
3148         PR gold/12745
3149         * layout.cc (Layout::layout_eh_frame): Correct handling of
3150         writable .eh_frame section.
3151
3152 2011-06-17  Ian Lance Taylor  <iant@google.com>
3153
3154         PR gold/12893
3155         * resolve.cc (Symbol_table::resolve): Don't give an error if a
3156         symbol is redefined with the exact same object and value.
3157
3158 2011-06-17  Ian Lance Taylor  <iant@google.com>
3159
3160         PR gold/12880
3161         * layout.h (class Layout): Add interp_segment_ field.
3162         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
3163         (Layout::attach_allocated_section_to_segment): If making shared
3164         library, put .interp section in PT_INTERP segment.
3165         (Layout::finalize): Also call create_interp if -dynamic-linker
3166         option was used.
3167         (Layout::create_interp): Assert that there is no PT_INTERP
3168         segment.  If not using a SECTIONS clause, use make_output_section.
3169         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
3170         * script-sections.cc
3171         (Script_sections::create_note_and_tls_segments): If making shared
3172         library, put .interp section in PT_INTERP segment.
3173
3174 2011-06-17  Ian Lance Taylor  <iant@google.com>
3175
3176         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
3177         when making a shared library.
3178
3179 2011-06-17  Ian Lance Taylor  <iant@google.com>
3180
3181         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
3182         parameter.  Change all callers.  Don't issue warning about PC32
3183         against locally defined symbol.
3184
3185 2011-06-16  Ian Lance Taylor  <iant@google.com>
3186
3187         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
3188         occurs in same object.
3189
3190 2011-06-14  Alan Modra  <amodra@gmail.com>
3191
3192         * po/POTFILES.in: Regenerate.
3193
3194 2011-06-09  Ian Lance Taylor  <iant@google.com>
3195
3196         * script-sections.cc
3197         (Orphan_output_section::set_section_addresses): For a relocatable
3198         link set address to 0.
3199
3200 2011-06-09  Cary Coutant  <ccoutant@google.com>
3201
3202         PR gold/12804
3203         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
3204         used with --compress-debug-sections.
3205         * gold/object.cc (Sized_relobj_file::do_layout): Report
3206         uncompressed size of compressed input sections.
3207
3208 2011-06-08  Cary Coutant  <ccoutant@google.com>
3209
3210         PR gold/12804
3211         * testsuite/two_file_test_2_v1.cc: Change initialization of
3212         v2 to keep it in .data.
3213
3214 2011-06-07  Cary Coutant  <ccoutant@google.com>
3215
3216         * common.cc (Symbol_table::do_allocate_commons_list): Call
3217         gold_fallback.
3218         * errors.cc (Errors::fatal): Adjust call to gold_exit.
3219         (Errors::fallback): New function.
3220         (gold_fallback): New function.
3221         * errors.h (Errors::fallback): New function.
3222         * gold.cc (gold_exit): Change status parameter to enum; adjust
3223         all callers.
3224         (queue_initial_tasks): Call gold_fallback.
3225         * gold.h: Include cstdlib.
3226         (Exit_status): New enum type.
3227         (gold_exit): Change status parameter to enum.
3228         (gold_fallback): New function.
3229         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
3230         (Layout::create_symtab_sections): Likewise.
3231         (Layout::create_shdrs): Likewise.
3232         * main.cc (main): Adjust call to gold_exit.
3233         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
3234         (Output_data_got::add_got_entry_pair): Likewise.
3235         (Output_section::add_input_section): Likewise.
3236         (Output_section::add_output_section_data): Likewise.
3237         (Output_segment::set_section_list_addresses): Likewise.
3238         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
3239
3240 2011-06-07  Cary Coutant  <ccoutant@google.com>
3241
3242         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
3243         for incremental links.
3244         * output.cc (Output_segment::set_section_list_addresses): Remove
3245         FIXME and test for TLS or BSS.
3246
3247 2011-06-07  Cary Coutant  <ccoutant@google.com>
3248
3249         * testsuite/Makefile.am: Add incremental_copy_test,
3250         incremental_common_test_1.
3251         * testsuite/Makefile.in: Regenerate.
3252         * testsuite/common_test_1_v1.c: New source file.
3253         * testsuite/common_test_1_v2.c: New source file.
3254         * testsuite/copy_test_v1.cc: New source file.
3255
3256 2011-06-07  Cary Coutant  <ccoutant@google.com>
3257
3258         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
3259         update, allocate common from bss section's free list.
3260         * incremental-dump.cc (dump_incremental_inputs): Print flag for
3261         linker-defined symbols.
3262         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3263         Skip GOT and PLT entries that are no longer referenced.
3264         (Output_section_incremental_inputs::write_info_blocks): Mark
3265         linker-defined symbols.
3266         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
3267         * output.cc (Output_section::allocate): New function.
3268         * output.h (Output_section::allocate): New function.
3269         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
3270         linker-defined symbols.
3271         (Symbol::override_base_with_special): Copy is_predefined_ flag.
3272         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
3273         (Symbol::init_base_output_data): Likewise.
3274         (Symbol::init_base_output_segment): Likewise.
3275         (Symbol::init_base_constant): Likewise.
3276         (Sized_symbol::init_output_data): Likewise.
3277         (Sized_symbol::init_output_segment): Likewise.
3278         (Sized_symbol::init_constant): Likewise.
3279         (Symbol_table::do_define_in_output_data): Likewise.
3280         (Symbol_table::do_define_in_output_segment): Likewise.
3281         (Symbol_table::do_define_as_constant): Likewise.
3282         * symtab.h (Symbol::is_predefined): New function.
3283         (Symbol::init_base_output_data): Add is_predefined parameter.
3284         (Symbol::init_base_output_segment): Likewise.
3285         (Symbol::init_base_constant): Likewise.
3286         (Symbol::is_predefined_): New data member.
3287         (Sized_symbol::init_output_data): Add is_predefined parameter.
3288         (Sized_symbol::init_output_segment): Likewise.
3289         (Sized_symbol::init_constant): Likewise.
3290         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
3291
3292 2011-06-07  Cary Coutant  <ccoutant@google.com>
3293
3294         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
3295         instead of emit_copy_reloc.
3296         (Copy_relocs::emit_copy_reloc): Refactor.
3297         (Copy_relocs::make_copy_reloc): New function.
3298         (Copy_relocs::add_copy_reloc): Remove.
3299         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
3300         section.
3301         (Copy_relocs::make_copy_reloc): New function.
3302         (Copy_relocs::add_copy_reloc): Remove.
3303         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
3304         unchanged input files.
3305         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
3306         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
3307         Reserve BSS space for COPY relocations.
3308         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3309         (Output_section_incremental_inputs::write_info_blocks): Record
3310         whether a symbol is copied from a shared object.
3311         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
3312         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
3313         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
3314         (Incremental_input_entry_reader::get_output_symbol_index): Add
3315         is_copy parameter.
3316         (Incremental_binary::emit_copy_relocs): New function.
3317         (Incremental_binary::do_emit_copy_relocs): New function.
3318         (Sized_incremental_binary::Sized_incremental_binary): Initialize
3319         new data member.
3320         (Sized_incremental_binary::add_copy_reloc): New function.
3321         (Sized_incremental_binary::do_emit_copy_relocs): New function.
3322         (Sized_incremental_binary::Copy_reloc): New struct.
3323         (Sized_incremental_binary::Copy_relocs): New typedef.
3324         (Sized_incremental_binary::copy_relocs_): New data member.
3325         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
3326         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
3327         * target.h (Sized_target::emit_copy_reloc): New function.
3328         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
3329
3330 2011-06-02  Cary Coutant  <ccoutant@google.com>
3331
3332         PR gold/12163
3333         * gold/archive.cc (Archive::Archive): Initialize new data member.
3334         (Archive::include_all_members): Return if archive has already been
3335         included.
3336         * gold/archive.h (Archive::include_all_members_): New data member.
3337
3338 2011-06-02  Nick Clifton  <nickc@redhat.com>
3339
3340         * dynobj.h: Fix spelling mistake in comment.
3341         * output.cc: Likewise.
3342
3343 2011-05-31  Doug Kwan  <dougkwan@google.com>
3344             Asier Llano
3345
3346         PR gold/12826
3347         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
3348         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
3349         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
3350         redundant arm_exidx_test.so.
3351         * testsuite/Makefile.in: Regenerate.
3352         (check_SCRIPTS): Add pr12826.sh
3353         (check_DATA): Add pr12826.stdout
3354         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
3355         * testsuite/pr12826.sh: New file.
3356         * testsuite/pr12826_1.s: Ditto.
3357         * testsuite/pr12826_1.s: Ditto.
3358
3359 2011-05-30  Ian Lance Taylor  <iant@google.com>
3360
3361         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
3362         sections.
3363
3364 2011-05-29  Ian Lance Taylor  <iant@google.com>
3365
3366         PR gold/12804
3367         * testsuite/Makefile.am: Use different file name for two_file_test
3368         temporary file for each incremental test.
3369         * testsuite/Makefile.in: Rebuild.
3370
3371 2011-05-29  Ian Lance Taylor  <iant@google.com>
3372
3373         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
3374         binary input file is empty.
3375
3376 2011-05-27  Ian Lance Taylor  <iant@google.com>
3377
3378         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
3379         (ver_test_9.so): Likewise.
3380         * testsuite/Makefile.in: Rebuild.
3381
3382 2011-05-26 Cary Coutant  <ccoutant@google.com>
3383
3384         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
3385         * incremental.cc (Incremental_inputs::report_input_section): Fix
3386         comment, indentation.
3387         (Incremental_inputs::report_comdat_group): New function.
3388         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3389         of data for incremental input file entry.
3390         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
3391         group count, COMDAT group signatures.
3392         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
3393         an unchanged input file.
3394         * incremental.h (Incremental_object_entry::Incremental_object_entry):
3395         Initialize new data member.
3396         (Incremental_object_entry::add_comdat_group): New function.
3397         (Incremental_object_entry::get_comdat_group_count): New function.
3398         (Incremental_object_entry::get_comdat_signature_key): New function.
3399         (Incremental_object_entry::groups_): New data member.
3400         (Incremental_inputs::report_comdat_group): New function.
3401         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
3402         data for incremental input file entry.
3403         (Incremental_input_entry_reader::get_comdat_group_count): New function.
3404         (Incremental_input_entry_reader::get_input_section): Adjust size of
3405         data for incremental input file entry.
3406         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
3407         (Incremental_input_entry_reader::get_comdat_group_signature): New
3408         function.
3409         * object.cc (Sized_relobj::include_section_group): Report kept
3410         COMDAT groups for incremental links.
3411
3412 2011-05-24  David Meyer  <pdox@google.com>
3413
3414         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
3415         with name parameter.  Add found_name parameter.
3416         * fileread.cc (Input_file::find_file): Adjust code accordingly.
3417         * dirsearch.h (class Dirsearch): Update declaration.
3418
3419 2011-05-24  Ian Lance Taylor  <iant@google.com>
3420
3421         * archive.cc (Library_base::should_include_member): Pull in object
3422         from archive if it defines the entry symbol.
3423         * parameters.cc (Parameters::entry): New function.
3424         * parameters.h (class Parameters): Declare entry.
3425         * output.h (class Output_file_header): Remove entry_ field.
3426         * output.cc (Output_file_header::Output_file_header): Remove entry
3427         parameter.  Change all callers.
3428         (Output_file_header::entry): Use parameters->entry.
3429         * gold.cc (queue_middle_tasks): Likewise.
3430         * plugin.cc (Plugin_hook::run): Likewise.
3431
3432 2011-05-24 Cary Coutant  <ccoutant@google.com>
3433
3434         * gold.cc (queue_initial_tasks): Pass incremental base filename
3435         to Output_file::open_base_file; don't print error message.
3436         * incremental-dump.cc (main): Adjust call to
3437         Output_file::open_for_modification.
3438         * incremental-dump.cc (main): Likewise.
3439         * incremental.cc (Incremental_inputs::report_command_line):
3440         Ignore --incremental-base option when comparing command lines.
3441         Ignore parameter when given as separate argument.
3442         * options.h (class General_options): Add --incremental-base.
3443         * output.cc (Output_file::Output_file):
3444         (Output_file::open_base_file): Add base_name and writable parameters;
3445         read base file into new file; print error message here.
3446         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3447         callers.
3448         * output.h (Output_file::open_for_modification): Rename to...
3449         (Output_file::open_base_file): ...this; add base_name and
3450         writable parameters; adjust all callers.
3451         (Output_file::map_no_anonymous): Add writable parameter; adjust all
3452         callers.
3453         * testsuite/Makefile.am (incremental_test_4): Test
3454         --incremental-base.
3455         * testsuite/Makefile.in: Regenerate.
3456
3457 2011-05-24 Cary Coutant  <ccoutant@google.com>
3458
3459         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
3460         incremental_test_4.
3461         * testsuite/Makefile.in: Regenerate.
3462         * testsuite/two_file_test_1_v1.cc: New test source file.
3463         * testsuite/two_file_test_1b_v1.cc: New test source file.
3464         * testsuite/two_file_test_2_v1.cc: New test source file.
3465
3466 2011-05-24 Cary Coutant  <ccoutant@google.com>
3467
3468         * dynobj.h (Dynobj::do_dynobj): New function.
3469         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
3470         flag and soname for shared objects.
3471         * incremental.cc (Incremental_inputs::report_object): Make
3472         either Incremental_object_entry or Incremental_dynobj_entry; add
3473         soname to string table.
3474         (Incremental_inputs::report_input_section): Add assertion.
3475         (Output_section_incremental_inputs::set_final_data_size): Adjust
3476         type of input file entry for shared libraries; adjust size of
3477         shared library info entry.
3478         (Output_section_incremental_inputs::write_input_files): Write
3479         as_needed flag for shared libraries.
3480         (Output_section_incremental_inputs::write_info_blocks): Adjust type
3481         of input file entry for shared libraries; write soname.
3482         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
3483         soname from incremental info.
3484         * incremental.h (enum Incremental_input_flags): Add
3485         INCREMENTAL_INPUT_AS_NEEDED.
3486         (Incremental_input_entry::Incremental_input_entry): Initialize new
3487         data member.
3488         (Incremental_input_entry::set_as_needed): New function.
3489         (Incremental_input_entry::as_needed): New function.
3490         (Incremental_input_entry::do_dynobj_entry): New function.
3491         (Incremental_input_entry::as_needed_): New data member.
3492         (Incremental_object_entry::Incremental_object_entry): Don't check
3493         for shared library.
3494         (Incremental_object_entry::do_type): Likewise.
3495         (class Incremental_dynobj_entry): New class.
3496         (Incremental_input_entry_reader::as_needed): New function.
3497         (Incremental_input_entry_reader::get_soname): New function.
3498         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
3499         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
3500         size of shared library info entry.
3501         * layout.cc (Layout::finish_dynamic_section): Don't test for
3502         incremental link when adding DT_NEEDED entries.
3503         * object.h (Object::Object): Initialize new data member.
3504         (Object::dynobj): New function.
3505         (Object::set_as_needed): New function.
3506         (Object::as_needed): New function.
3507         (Object::do_dynobj): New function.
3508         (Object::as_needed_): New data member.
3509
3510 2011-05-24 Cary Coutant  <ccoutant@google.com>
3511
3512         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
3513         info; adjust display of GOT entries.
3514         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3515         vector of input objects; remove file_status_.
3516         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
3517         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
3518         got_plt reader; call target hooks to reserve GOT entries.
3519         (Output_section_incremental_inputs::set_final_data_size): Adjust size
3520         of input file info header and GOT info entry.
3521         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
3522         relocation info.
3523         (Got_plt_view_info::got_descriptor): Remove.
3524         (Got_plt_view_info::sym_index): New data member.
3525         (Got_plt_view_info::input_index): New data member.
3526         (Local_got_offset_visitor::visit): Write input file index.
3527         (Global_got_offset_visitor::visit): Write 0 for input file index.
3528         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
3529         with sym_index and input_index.
3530         (Output_section_incremental_inputs::write_got_plt): Adjust size of
3531         incremental info GOT entry; replace got_descriptor with input_index.
3532         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
3533         map from input file index to object.
3534         (Sized_relobj_incr::do_layout): Replace direct data member reference
3535         with accessor function.
3536         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
3537         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
3538         Adjust size of input file info header.
3539         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
3540         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
3541         (Incremental_input_entry_reader::get_input_section): Adjust size of
3542         input file info header.
3543         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
3544         of incremental info GOT entry.
3545         (Incremental_got_plt_reader::get_got_desc): Remove.
3546         (Incremental_got_plt_reader::get_got_symndx): New function.
3547         (Incremental_got_plt_reader::get_got_input_index): New function.
3548         (Sized_incremental_binary::Sized_incremental_binary): Remove
3549         file_status_; add input_objects_.
3550         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
3551         (Sized_incremental_binary::set_file_is_unchanged): Remove.
3552         (Sized_incremental_binary::file_is_unchanged): Remove.
3553         (Sized_incremental_binary::set_input_object): New function.
3554         (Sized_incremental_binary::input_object): New function.
3555         (Sized_incremental_binary::file_status_): Remove.
3556         (Sized_incremental_binary::input_objects_): New data member.
3557         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
3558         references.
3559         (Sized_relobj_incr::invalid_address): Move to base class.
3560         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
3561         class.
3562         (Sized_relobj_incr::do_output_section_offset): Likewise.
3563         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
3564         (Sized_relobj_incr::section_offsets_): Likewise.
3565         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
3566         function.
3567         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
3568         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
3569         with accessor function.
3570         (Sized_relobj_file::do_layout): Likewise.
3571         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
3572         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
3573         (Sized_relobj_file::compute_final_local_value): Replace refs to
3574         section_offsets_ with accessor function.
3575         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
3576         * object.h (Relobj::Relobj): Initialize new data members.
3577         (Relobj::add_dyn_reloc): New function.
3578         (Relobj::first_dyn_reloc): New function.
3579         (Relobj::dyn_reloc_count): New function.
3580         (Relobj::first_dyn_reloc_): New data member.
3581         (Relobj::dyn_reloc_count_): New data member.
3582         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
3583         references.
3584         (Sized_relobj::Address): New typedef.
3585         (Sized_relobj::invalid_address): Move here from child class.
3586         (Sized_relobj::Sized_relobj): Initialize new data members.
3587         (Sized_relobj::sized_relobj): New function.
3588         (Sized_relobj::is_output_section_offset_invalid): Move here from
3589         child class.
3590         (Sized_relobj::get_output_section_offset): Likewise.
3591         (Sized_relobj::local_has_got_offset): Likewise.
3592         (Sized_relobj::local_got_offset): Likewise.
3593         (Sized_relobj::set_local_got_offset): Likewise.
3594         (Sized_relobj::do_for_all_local_got_entries): Likewise.
3595         (Sized_relobj::clear_got_offsets): New function.
3596         (Sized_relobj::section_offsets): Move here from child class.
3597         (Sized_relobj::do_output_section_offset): Likewise.
3598         (Sized_relobj::do_set_section_offset): Likewise.
3599         (Sized_relobj::Local_got_offsets): Likewise.
3600         (Sized_relobj::local_got_offsets_): Likewise.
3601         (Sized_relobj::section_offsets_): Likewise.
3602         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
3603         references.
3604         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
3605         class.
3606         (Sized_relobj_file::sized_relobj): New function
3607         (Sized_relobj_file::local_has_got_offset): Move to base class.
3608         (Sized_relobj_file::local_got_offset): Likewise.
3609         (Sized_relobj_file::set_local_got_offset): Likewise.
3610         (Sized_relobj_file::get_output_section_offset): Likewise.
3611         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
3612         (Sized_relobj_file::do_output_section_offset): Likewise.
3613         (Sized_relobj_file::do_set_section_offset): Likewise.
3614         (Sized_relobj_file::Local_got_offsets): Likewise.
3615         (Sized_relobj_file::local_got_offsets_): Likewise.
3616         (Sized_relobj_file::section_offsets_): Likewise.
3617         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
3618         (all constructors).
3619         (set_needs_dynsym_index): Convert relobj to derived class pointer.
3620         (Output_reloc::get_symbol_index): Likewise.
3621         (Output_reloc::local_section_offset): Likewise.
3622         (Output_reloc::get_address): Likewise.
3623         (Output_reloc::symbol_value): Likewise.
3624         (Output_data_got::reserve_slot): Move to class definition.
3625         (Output_data_got::reserve_local): New function.
3626         (Output_data_got::reserve_slot_for_global): Remove.
3627         (Output_data_got::reserve_global): New function.
3628         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
3629         (all constructors, two instantiations).
3630         (Output_reloc::get_relobj): New function (two instantiations).
3631         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
3632         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
3633         (Output_data_reloc::add_global): Adjust type of relobj.
3634         (Output_data_reloc::add_global_relative): Likewise.
3635         (Output_data_reloc::add_symbolless_global_addend): Likewise.
3636         (Output_data_reloc::add_local): Likewise.
3637         (Output_data_reloc::add_local_relative): Likewise.
3638         (Output_data_reloc::add_symbolless_local_addend): Likewise.
3639         (Output_data_reloc::add_local_section): Likewise.
3640         (Output_data_reloc::add_output_section): Likewise.
3641         (Output_data_reloc::add_absolute): Likewise.
3642         (Output_data_reloc::add_target_specific): Likewise.
3643         (Output_data_got::reserve_slot): Move definition here.
3644         (Output_data_got::reserve_local): New function.
3645         (Output_data_got::reserve_global): New function.
3646         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
3647         section_offsets_ with accessor function.
3648         (Sized_relobj_file::write_sections): Likewise.
3649         (Sized_relobj_file::do_relocate_sections): Likewise.
3650         * target.h (Sized_target::reserve_local_got_entry): New function.
3651         (Sized_target::reserve_global_got_entry): New function.
3652         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
3653         (Target_x86_64::reserve_global_got_entry): New function.
3654         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
3655
3656 2011-05-23 Cary Coutant  <ccoutant@google.com>
3657
3658         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
3659         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
3660         bit when checking got_type.
3661         * incremental.cc (Sized_incremental_binary::setup_readers):
3662         Store symbol table and string table locations; initialize bit vector
3663         of file status flags.
3664         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
3665         unchanged files.
3666         (Sized_incremental_binary::do_process_got_plt): New function.
3667         (Sized_incremental_binary::get_symtab_view): Use stored locations.
3668         (Output_section_incremental_inputs::set_final_data_size): Record
3669         file index for each input file.
3670         (Output_section_incremental_inputs::write_got_plt): Store file index
3671         instead of input entry offset for each GOT entry.
3672         * incremental.h
3673         (Incremental_input_entry::Incremental_input_entry): Initialize new
3674         data member.
3675         (Incremental_input_entry::set_offset): Store file index.
3676         (Incremental_input_entry::get_file_index): New function.
3677         (Incremental_input_entry::file_index_): New data member.
3678         (Incremental_binary::process_got_plt): New function.
3679         (Incremental_binary::do_process_got_plt): New function.
3680         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3681         data members.
3682         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
3683         (Sized_incremental_binary::set_file_is_unchanged): New function.
3684         (Sized_incremental_binary::file_is_unchanged): New function.
3685         (Sized_incremental_binary::do_process_got_plt): New function.
3686         (Sized_incremental_binary::file_status_): New data member.
3687         (Sized_incremental_binary::main_symtab_loc_): New data member.
3688         (Sized_incremental_binary::main_strtab_loc_): New data member.
3689         * output.cc (Output_data_got::Got_entry::write): Add case
3690         RESERVED_CODE.
3691         (Output_data_got::add_global): Call add_got_entry.
3692         (Output_data_got::add_global_plt): Likewise.
3693         (Output_data_got::add_global_with_rel): Likewise.
3694         (Output_data_got::add_global_with_rela): Likewise.
3695         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
3696         (Output_data_got::add_global_pair_with_rela): Likewise.
3697         (Output_data_got::add_local): Call add_got_entry.
3698         (Output_data_got::add_local_plt): Likewise.
3699         (Output_data_got::add_local_with_rel): Likewise.
3700         (Output_data_got::add_local_with_rela): Likewise.
3701         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
3702         (Output_data_got::add_local_pair_with_rela): Likewise.
3703         (Output_data_got::reserve_slot): New function.
3704         (Output_data_got::reserve_slot_for_global): New function.
3705         (Output_data_got::add_got_entry): New function.
3706         (Output_data_got::add_got_entry_pair): New function.
3707         (Output_section::add_output_section_data): Edit FIXME.
3708         * output.h
3709         (Output_section_data_build::Output_section_data_build): New
3710         constructor with size parameter.
3711         (Output_data_space::Output_data_space): Likewise.
3712         (Output_data_got::Output_data_got): Initialize new data member; new
3713         constructor with size parameter.
3714         (Output_data_got::add_constant): Call add_got_entry.
3715         (Output_data_got::reserve_slot): New function.
3716         (Output_data_got::reserve_slot_for_global): New function.
3717         (class Output_data_got::Got_entry): Add RESERVED_CODE.
3718         (Output_data_got::add_got_entry): New function.
3719         (Output_data_got::add_got_entry_pair): New function.
3720         (Output_data_got::free_list_): New data member.
3721         * target.h (Sized_target::init_got_plt_for_update): New function.
3722         (Sized_target::register_global_plt_entry): New function.
3723         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3724         Initialize new data member; call init; add constructor with PLT count.
3725         (Output_data_plt_x86_64::init): New function.
3726         (Output_data_plt_x86_64::add_relocation): New function.
3727         (Output_data_plt_x86_64::reserve_slot): New function.
3728         (Output_data_plt_x86_64::free_list_): New data member.
3729         (Target_x86_64::init_got_plt_for_update): New function.
3730         (Target_x86_64::register_global_plt_entry): New function.
3731         (Output_data_plt_x86_64::add_entry): Allocate from free list for
3732         incremental updates.
3733         (Output_data_plt_x86_64::add_relocation): New function.
3734         * testsuite/object_unittest.cc (Object_test): Set default options.
3735
3736 2011-05-16  Ian Lance Taylor  <iant@google.com>
3737
3738         * options.h (class General_options): Make -i a synonym for -r.
3739
3740 2011-05-16  Ian Lance Taylor  <iant@google.com>
3741
3742         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
3743
3744 2011-05-10 Cary Coutant  <ccoutant@google.com>
3745
3746         * object.cc (Sized_relobj::do_count_local_symbols): Check for
3747         strip_all (-s).
3748
3749 2011-05-06  Ian Lance Taylor  <iant@google.com>
3750
3751         * layout.cc (Layout::layout): If the output section flags change,
3752         update the ordering.
3753
3754 2011-04-25 Cary Coutant  <ccoutant@google.com>
3755
3756         * incremental-dump.cc (dump_incremental_inputs): Print local
3757         symbol info for each input file.
3758         * incremental.cc
3759         (Output_section_incremental_inputs::set_final_data_size): Add local
3760         symbol info to input file entries in incremental info.
3761         (Output_section_incremental_inputs::write_info_blocks): Likewise.
3762         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
3763         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
3764         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
3765         implementation.
3766         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
3767         (Sized_incr_relobj::do_relocate): Write the local symbols.
3768         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
3769         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
3770         Adjust size of input file header.
3771         (Incremental_inputs_reader::get_local_symbol_offset): New function.
3772         (Incremental_inputs_reader::get_local_symbol_count): New function.
3773         (Incremental_inputs_reader::get_input_section): Adjust size of input
3774         file header.
3775         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
3776         (Sized_incr_relobj::This): New typedef.
3777         (Sized_incr_relobj::sym_size): New const data member.
3778         (Sized_incr_relobj::Local_symbol): New struct.
3779         (Sized_incr_relobj::do_output_local_symbol_count): New function.
3780         (Sized_incr_relobj::do_local_symbol_offset): New function.
3781         (Sized_incr_relobj::local_symbol_count_): New data member.
3782         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
3783         (Sized_incr_relobj::local_symbol_index_): New data member.
3784         (Sized_incr_relobj::local_symbol_offset_): New data member.
3785         (Sized_incr_relobj::local_dynsym_offset_): New data member.
3786         (Sized_incr_relobj::local_symbols_): New data member.
3787         * object.h (Relobj::output_local_symbol_count): New function.
3788         (Relobj::local_symbol_offset): New function.
3789         (Relobj::do_output_local_symbol_count): New function.
3790         (Relobj::do_local_symbol_offset): New function.
3791         (Sized_relobj::do_output_local_symbol_count): New function.
3792         (Sized_relobj::do_local_symbol_offset): New function.
3793
3794 2011-04-22  Vladimir Simonov  <sv@sw.ru>
3795
3796         * descriptors.cc (set_close_on_exec): New function.
3797         (Descriptors::open): Use set_close_on_exec.
3798         * output.cc (S_ISLNK): Define if not defined.
3799
3800 2011-04-22 Cary Coutant  <ccoutant@google.com>
3801
3802         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
3803         global symbol map.
3804         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3805         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
3806         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
3807         relocations.
3808         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
3809         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
3810         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
3811         * incremental.h
3812         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
3813         function.
3814         (Incremental_binary::apply_incremental_relocs): New function.
3815         (Incremental_binary::do_apply_incremental_relocs): New function.
3816         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
3817         data member.
3818         (Sized_incremental_binary::add_global_symbol): New function.
3819         (Sized_incremental_binary::global_symbol): New function.
3820         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
3821         (Sized_incremental_binary::symbol_map_): New data member.
3822         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
3823         * target.h (Sized_target::apply_relocation): New function.
3824         * target-reloc.h (apply_relocation): New function.
3825         * x86_64.cc (Target_x86_64::apply_relocation): New function.
3826
3827 2011-04-22  Doug Kwan  <dougkwan@google.com>
3828
3829         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
3830         flag of a SHT_ARM_EXIDX section.
3831         * testsuite/Makefile.am (arm_exidx_test): New test rules.
3832         * testsuite/Makefile.in: Regenerate.
3833         * testsuite/arm_exidx_test.s: New file.
3834         * testsuite/arm_exidx_test.sh: Same.
3835
3836 2011-04-20 Cary Coutant  <ccoutant@google.com>
3837
3838         PR gold/12689
3839         * archive.h (Incremental_archive_entry::Archive_member):
3840         Initialize arg_serial_ (second constructor).
3841
3842 2011-04-17  Ian Lance Taylor  <iant@google.com>
3843
3844         * object.cc (Relocate_info::location): Simplify location string.
3845         * errors.cc (Errors::error_at_location): Don't print program
3846         name.
3847         (Errors::warning_at_location): Likewise.
3848         (Errors::undefined_symbol): Likewise.
3849         * testsuite/debug_msg.sh: Update accordingly.
3850
3851 2011-04-14 Cary Coutant  <ccoutant@google.com>
3852
3853         * gold/layout.cc (Layout::symtab_section_offset): New function.
3854         * gold/layout.h (Layout::symtab_section_offset): New function.
3855         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
3856
3857 2011-04-12  Ian Lance Taylor  <iant@google.com>
3858
3859         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
3860         with MREMAP_MAYMOVE.
3861         * output.h (class Output_file): Add map_is_allocated_ field.
3862         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
3863         not available, provide stubs.  If mremap is not available, #define
3864         it to gold_mremap.
3865         (MREMAP_MAYMOVE): Define if not defined.
3866         (Output_file::Output_file): Initialize map_is_allocated_.
3867         (Output_file::resize): Check map_is_allocated_.
3868         (Output_file::map_anonymous): If mmap fails, use malloc.
3869         (Output_file::unmap): Don't do anything for an anonymous map.
3870         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
3871         is not available, provide stubs.
3872         (File_read::View::~View): Use free rather than delete[].
3873         (File_read::make_view): Use malloc rather than new[].  If mmap
3874         fails, use malloc.
3875         (File_read::find_or_make_view): Use malloc rather than new[].
3876         * gold.h: Remove HAVE_REMAP code.
3877         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
3878         exists.  Rename mremap to gold_mremap.  If mmap is not available
3879         don't do anything.
3880         * configure, config.in: Rebuild.
3881
3882 2011-04-11  Ian Lance Taylor  <iant@google.com>
3883
3884         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
3885         initialize local variable v.
3886
3887 2011-04-11  Cary Coutant  <ccoutant@google.com>
3888
3889         * archive.cc (Archive::include_member): Adjust call to
3890         report_object.
3891         (Add_archive_symbols::run): Track argument serial numbers.
3892         (Lib_group::include_member): Likewise.
3893         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
3894         * archive.h (Incremental_archive_entry::Archive_member):
3895         Initialize arg_serial_.
3896         (Archive_member::arg_serial_): New data member.
3897         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
3898         (Sized_dynobj::do_add_symbols): Track symbols when doing an
3899         incremental link.
3900         (Sized_dynobj::do_for_all_local_got_entries): New function.
3901         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
3902         function.
3903         * fileread.cc (get_mtime): New function.
3904         * fileread.h (get_mtime): New function.
3905         * gold.cc (queue_initial_tasks): Check for incremental update.
3906         (process_incremental_input): New function.
3907         (queue_middle_tasks): Don't force valid target for incremental
3908         update.
3909         * incremental-dump.cc (find_input_containing_global): Adjust
3910         size of symbol info entry.
3911         (dump_incremental_inputs): Dump argument serial number and
3912         in_system_directory flag; bias shndx by 1; print symbol names
3913         when dumping per-file symbol lists; use new symbol info readers.
3914         * incremental.cc
3915         (Output_section_incremental_inputs:update_data_size): New function.
3916         (Sized_incremental_binary::setup_readers): Setup input readers
3917         for each input file; build maps for files added from libraries
3918         and scripts.
3919         (Sized_incremental_binary::check_input_args): New function.
3920         (Sized_incremental_binary::do_check_inputs): Build map of argument
3921         serial numbers to input arguments.
3922         (Sized_incremental_binary::do_file_has_changed): Rename
3923         do_file_is_unchanged to this; compare file modification times.
3924         (Sized_incremental_binary::do_init_layout): New function.
3925         (Sized_incremental_binary::do_reserve_layout): New function.
3926         (Sized_incremental_binary::do_get_input_reader): Remove.
3927         (Sized_incremental_binary::get_symtab_view): New function.
3928         (Incremental_checker::can_incrementally_link_output_file): Remove.
3929         (Incremental_inputs::report_command_line): Exclude --debug options.
3930         (Incremental_inputs::report_archive_begin): Add parameter; track
3931         argument serial numbers; don't put input file entry for archive
3932         before archive members.
3933         (Incremental_inputs::report_archive_end): Put input file entry
3934         for archive after archive members.
3935         (Incremental_inputs::report_object): Add parameter; track argument
3936         serial numbers and in_system_directory flag.
3937         (Incremental_inputs::report_script): Add parameter; track argument
3938         serial numbers.
3939         (Output_section_incremental_inputs::set_final_data_size): Adjust
3940         size of symbol info entry; check for forwarding symbols.
3941         (Output_section_incremental_inputs::write_input_files): Write
3942         in_system_directory flag and argument serial number.
3943         (Output_section_incremental_inputs::write_info_blocks): Map section
3944         indices between incremental info and original input file; store
3945         input section index for each symbol.
3946         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
3947         change operator() to visit().
3948         (class Global_got_offset_visitor): Likewise.
3949         (class Global_symbol_visitor_got_plt):
3950         (Output_section_incremental_inputs::write_got_plt): Use new visitor
3951         classes.
3952         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
3953         (Sized_incr_relobj::do_read_symbols): New function.
3954         (Sized_incr_relobj::do_layout): New function.
3955         (Sized_incr_relobj::do_layout_deferred_sections): New function.
3956         (Sized_incr_relobj::do_add_symbols): New function.
3957         (Sized_incr_relobj::do_should_include_member): New function.
3958         (Sized_incr_relobj::do_for_all_global_symbols): New function.
3959         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
3960         (Sized_incr_relobj::do_section_size): New function.
3961         (Sized_incr_relobj::do_section_name): New function.
3962         (Sized_incr_relobj::do_section_contents): New function.
3963         (Sized_incr_relobj::do_section_flags): New function.
3964         (Sized_incr_relobj::do_section_entsize): New function.
3965         (Sized_incr_relobj::do_section_address): New function.
3966         (Sized_incr_relobj::do_section_type): New function.
3967         (Sized_incr_relobj::do_section_link): New function.
3968         (Sized_incr_relobj::do_section_info): New function.
3969         (Sized_incr_relobj::do_section_addralign): New function.
3970         (Sized_incr_relobj::do_initialize_xindex): New function.
3971         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
3972         (Sized_incr_relobj::do_read_relocs): New function.
3973         (Sized_incr_relobj::do_gc_process_relocs): New function.
3974         (Sized_incr_relobj::do_scan_relocs): New function.
3975         (Sized_incr_relobj::do_count_local_symbols): New function.
3976         (Sized_incr_relobj::do_finalize_local_symbols): New function.
3977         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
3978         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
3979         (Sized_incr_relobj::do_relocate): New function.
3980         (Sized_incr_relobj::do_set_section_offset): New function.
3981         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
3982         (Sized_incr_dynobj::do_read_symbols): New function.
3983         (Sized_incr_dynobj::do_layout): New function.
3984         (Sized_incr_dynobj::do_add_symbols): New function.
3985         (Sized_incr_dynobj::do_should_include_member): New function.
3986         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
3987         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
3988         (Sized_incr_dynobj::do_section_size): New function.
3989         (Sized_incr_dynobj::do_section_name): New function.
3990         (Sized_incr_dynobj::do_section_contents): New function.
3991         (Sized_incr_dynobj::do_section_flags): New function.
3992         (Sized_incr_dynobj::do_section_entsize): New function.
3993         (Sized_incr_dynobj::do_section_address): New function.
3994         (Sized_incr_dynobj::do_section_type): New function.
3995         (Sized_incr_dynobj::do_section_link): New function.
3996         (Sized_incr_dynobj::do_section_info): New function.
3997         (Sized_incr_dynobj::do_section_addralign): New function.
3998         (Sized_incr_dynobj::do_initialize_xindex): New function.
3999         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4000         (make_sized_incremental_object): New function.
4001         (Incremental_library::copy_unused_symbols): New function.
4002         (Incremental_library::do_for_all_unused_symbols): New function.
4003         * incremental.h (enum Incremental_input_flags): New type.
4004         (class Incremental_checker): Remove.
4005         (Incremental_input_entry::Incremental_input_entry): Add argument
4006         serial number.
4007         (Incremental_input_entry::arg_serial): New function.
4008         (Incremental_input_entry::set_is_in_system_directory): New function.
4009         (Incremental_input_entry::is_in_system_directory): New function.
4010         (Incremental_input_entry::arg_serial_): New data member.
4011         (Incremental_input_entry::is_in_system_directory_): New data member.
4012         (class Script_info): Move here from script.h.
4013         (Script_info::Script_info): Add filename parameter.
4014         (Script_info::filename): New function.
4015         (Script_info::filename_): New data member.
4016         (Incremental_script_entry::Incremental_script_entry): Add argument
4017         serial number.
4018         (Incremental_object_entry::Incremental_object_entry): Likewise.
4019         (Incremental_object_entry::add_input_section): Build list of input
4020         sections with map to original shndx.
4021         (Incremental_object_entry::get_input_section_index): New function.
4022         (Incremental_object_entry::shndx_): New data member.
4023         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4024         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4025         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4026         serial number.
4027         (Incremental_inputs::report_archive_begin): Likewise.
4028         (Incremental_inputs::report_object): Likewise.
4029         (Incremental_inputs::report_script): Likewise.
4030         (class Incremental_global_symbol_reader): New class.
4031         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4032         and store flags and input file type.
4033         (Incremental_input_entry_reader::arg_serial): New function.
4034         (Incremental_input_entry_reader::type): Extract type from flags.
4035         (Incremental_input_entry_reader::is_in_system_directory): New function.
4036         (Incremental_input_entry_reader::get_input_section_count): Call
4037         accessor function for type.
4038         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4039         function for type; adjust size of global symbol entry.
4040         (Incremental_input_entry_reader::get_global_symbol_count): Call
4041         accessor function for type.
4042         (Incremental_input_entry_reader::get_object_count): Likewise.
4043         (Incremental_input_entry_reader::get_object_offset): Likewise.
4044         (Incremental_input_entry_reader::get_member_count): Likewise.
4045         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4046         (Incremental_input_entry_reader::get_member_offset): Likewise.
4047         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4048         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4049         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4050         (Incremental_input_entry_reader::get_global_symbol_reader): New
4051         function.
4052         (Incremental_input_entry_reader::get_output_symbol_index): New
4053         function.
4054         (Incremental_input_entry_reader::type_): Remove.
4055         (Incremental_input_entry_reader::flags_): New data member.
4056         (Incremental_inputs_reader::input_file_offset): New function.
4057         (Incremental_inputs_reader::input_file_index): New function.
4058         (Incremental_inputs_reader::input_file): Call input_file_offset.
4059         (Incremental_inputs_reader::input_file_at_offset): New function.
4060         (Incremental_relocs_reader::get_r_type): Reformat.
4061         (Incremental_relocs_reader::get_r_shndx): Reformat.
4062         (Incremental_relocs_reader::get_r_offset): Reformat.
4063         (Incremental_relocs_reader::data): New function.
4064         (Incremental_binary::Incremental_binary): Initialize new data members.
4065         (Incremental_binary::check_inputs): Add cmdline parameter.
4066         (Incremental_binary::file_is_unchanged): Remove.
4067         (Input_reader::arg_serial): New function.
4068         (Input_reader::get_unused_symbol_count): New function.
4069         (Input_reader::get_unused_symbol): New function.
4070         (Input_reader::do_arg_serial): New function.
4071         (Input_reader::do_get_unused_symbol_count): New function.
4072         (Input_reader::do_get_unused_symbol): New function.
4073         (Incremental_binary::input_file_count): New function.
4074         (Incremental_binary::get_input_reader): Change signature to use
4075         index instead of filename.
4076         (Incremental_binary::file_has_changed): New function.
4077         (Incremental_binary::get_input_argument): New function.
4078         (Incremental_binary::get_library): New function.
4079         (Incremental_binary::get_script_info): New function.
4080         (Incremental_binary::init_layout): New function.
4081         (Incremental_binary::reserve_layout): New function.
4082         (Incremental_binary::output_file): New function.
4083         (Incremental_binary::do_check_inputs): New function.
4084         (Incremental_binary::do_file_is_unchanged): Remove.
4085         (Incremental_binary::do_file_has_changed): New function.
4086         (Incremental_binary::do_init_layout): New function.
4087         (Incremental_binary::do_reserve_layout): New function.
4088         (Incremental_binary::do_input_file_count): New function.
4089         (Incremental_binary::do_get_input_reader): Change signature.
4090         (Incremental_binary::input_args_map_): New data member.
4091         (Incremental_binary::library_map_): New data member.
4092         (Incremental_binary::script_map_): New data member.
4093         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4094         new data members.
4095         (Sized_incremental_binary::output_section): New function.
4096         (Sized_incremental_binary::inputs_reader): Add const.
4097         (Sized_incremental_binary::symtab_reader): Add const.
4098         (Sized_incremental_binary::relocs_reader): Add const.
4099         (Sized_incremental_binary::got_plt_reader): Add const.
4100         (Sized_incremental_binary::get_symtab_view): New function.
4101         (Sized_incremental_binary::Inputs_reader): New typedef.
4102         (Sized_incremental_binary::Input_entry_reader): New typedef.
4103         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4104         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4105         (Sized_incremental_binary::do_file_has_changed): New function.
4106         (Sized_incremental_binary::do_init_layout): New function.
4107         (Sized_incremental_binary::do_reserve_layout): New function.
4108         (Sized_input_reader::Inputs_reader): Remove.
4109         (Sized_input_reader::Input_entry_reader): Remove.
4110         (Sized_input_reader::do_arg_serial): New function.
4111         (Sized_input_reader::do_get_unused_symbol_count): New function.
4112         (Sized_input_reader::do_get_unused_symbol): New function.
4113         (Sized_incremental_binary::do_input_file_count): New function.
4114         (Sized_incremental_binary::do_get_input_reader): Change signature;
4115         use index instead of filename.
4116         (Sized_incremental_binary::section_map_): New data member.
4117         (Sized_incremental_binary::input_entry_readers_): New data member.
4118         (class Sized_incr_relobj): New class.
4119         (class Sized_incr_dynobj): New class.
4120         (make_sized_incremental_object): New function.
4121         (class Incremental_library): New class.
4122         * layout.cc (Free_list::num_lists): New static data member.
4123         (Free_list::num_nodes): New static data member.
4124         (Free_list::num_removes): New static data member.
4125         (Free_list::num_remove_visits): New static data member.
4126         (Free_list::num_allocates): New static data member.
4127         (Free_list::num_allocate_visits): New static data member.
4128         (Free_list::init): New function.
4129         (Free_list::remove): New function.
4130         (Free_list::allocate): New function.
4131         (Free_list::dump): New function.
4132         (Free_list::print_stats): New function.
4133         (Layout_task_runner::run): Resize output file for incremental updates.
4134         (Layout::Layout): Initialize new data members.
4135         (Layout::set_incremental_base): New function.
4136         (Layout::init_fixed_output_section): New function.
4137         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
4138         incremental updates.
4139         (Layout::create_gold_note): Do not create gold note section for
4140         incremental updates.
4141         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
4142         for incremental updates.
4143         (Layout::set_section_offsets): For incremental updates, allocate space
4144         from free list.
4145         (Layout::create_symtab_sections): Layout with offsets relative to
4146         start of section; for incremental updates, allocate space from free
4147         list.
4148         (Layout::create_shdrs): For incremental updates, allocate space from
4149         free list.
4150         (Layout::finish_dynamic_section): For incremental updates, do not
4151         check --as-needed (fixed in subsequent patch).
4152         * layout.h (class Free_list): New class.
4153         (Layout::set_incremental_base): New function.
4154         (Layout::incremental_base): New function.
4155         (Layout::init_fixed_output_section): New function.
4156         (Layout::allocate): New function.
4157         (Layout::incremental_base_): New data member.
4158         (Layout::free_list_): New data member.
4159         * main.cc (main): Print Free_list statistics.
4160         * object.cc (Relobj::finalize_incremental_relocs): Add
4161         clear_counts parameter; clear counts only when clear_counts is set.
4162         (Sized_relobj::Sized_relobj): Initialize new base class.
4163         (Sized_relobj::do_layout): Don't report special sections.
4164         (Sized_relobj::do_for_all_local_got_entries): New function.
4165         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
4166         symtab_off to all symbol table offsets.
4167         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
4168         * object.h (class Got_offset_list): Move to top of file.
4169         (Object::Object): Allow case where input_file == NULL.
4170         (Object::~Object): Likewise.
4171         (Object::input_file): Assert that input_file != NULL.
4172         (Object::lock): Allow case where input_file == NULL.
4173         (Object::unlock): Likewise.
4174         (Object::is_locked): Likewise.
4175         (Object::token): Likewise.
4176         (Object::release): Likewise.
4177         (Object::is_incremental): New function.
4178         (Object::get_mtime): New function.
4179         (Object::for_all_local_got_entries): New function.
4180         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
4181         (Object::set_is_in_system_directory): New function.
4182         (Object::is_in_system_directory): New function.
4183         (Object::do_is_incremental): New function.
4184         (Object::do_get_mtime): New function.
4185         (Object::do_for_all_local_got_entries): New function.
4186         (Object::is_in_system_directory_): New data member.
4187         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
4188         (class Sized_relobj_base): New class.
4189         (class Sized_relobj): Derive from Sized_relobj_base.
4190         (class Sized_relobj::Symbols): Redeclare from base class.
4191         (class Sized_relobj::local_got_offset_list): Remove.
4192         (class Sized_relobj::Output_sections): Redeclare from base class.
4193         (class Sized_relobj::do_for_all_local_got_entries): New function.
4194         (class Sized_relobj::write_local_symbols): Add offset parameter.
4195         (class Sized_relobj::local_symbol_offset_): Update comment.
4196         (class Sized_relobj::local_dynsym_offset_): Update comment.
4197         * options.cc (Input_arguments::add_file): Remove const.
4198         * options.h (Input_file_argument::Input_file_argument):
4199         Initialize arg_serial_ (all constructors).
4200         (Input_file_argument::set_arg_serial): New function.
4201         (Input_file_argument::arg_serial): New function.
4202         (Input_file_argument::arg_serial_): New data member.
4203         (Input_arguments::Input_arguments): Initialize file_count_.
4204         (Input_arguments::add_file): Remove const.
4205         (Input_arguments::number_of_input_files): New function.
4206         (Input_arguments::file_count_): New data member.
4207         (Command_line::number_of_input_files): Call
4208         Input_arguments::number_of_input_files.
4209         * output.cc (Output_segment_headers::Output_segment_headers):
4210         Set current size.
4211         (Output_section::Input_section::current_data_size): New function.
4212         (Output_section::Output_section): Initialize new data members.
4213         (Output_section::add_input_section): Don't do merge sections for
4214         an incremental link; allocate space from free list for an
4215         incremental update.
4216         (Output_section::add_output_section_data): Allocate space from
4217         free list for an incremental update.
4218         (Output_section::update_data_size): New function.
4219         (Output_section::set_fixed_layout): New function.
4220         (Output_section::reserve): New function.
4221         (Output_segment::set_section_addresses): Remove const.
4222         (Output_segment::set_section_list_addresses): Remove const; allocate
4223         space from free list for an incremental update.
4224         (Output_segment::set_offset): Adjust size of RELRO segment for an
4225         incremental update.
4226         * output.h (Output_data::current_data_size): Move here from
4227         child classes.
4228         (Output_data::pre_finalize_data_size): New function.
4229         (Output_data::update_data_size): New function.
4230         (Output_section_headers::update_data_size): new function.
4231         (Output_section_data_build::current_data_size): Move to Output_data.
4232         (Output_data_strtab::update_data_size): New function.
4233         (Output_section::current_data_size): Move to Output_data.
4234         (Output_section::set_fixed_layout): New function.
4235         (Output_section::has_fixed_layout): New function.
4236         (Output_section::reserve): New function.
4237         (Output_section::update_data_size): New function.
4238         (Output_section::has_fixed_layout_): New data member.
4239         (Output_section::free_list_): New data member.
4240         (Output_segment::set_section_addresses): Remove const.
4241         (Output_segment::set_section_list_addresses): Remove const.
4242         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
4243         New function.
4244         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
4245         New function.
4246         * readsyms.cc (Read_symbols::do_read_symbols): Add library
4247         parameter when calling Add_symbols constructor; store argument
4248         serial number for members of a lib group.
4249         (Add_symbols::locks): Allow case where token == NULL.
4250         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
4251         (Read_member::~Read_member): New function.
4252         (Read_member::is_runnable): New function.
4253         (Read_member::locks): New function.
4254         (Read_member::run): New function.
4255         (Check_script::~Check_script): New function.
4256         (Check_script::is_runnable): New function.
4257         (Check_script::locks): New function.
4258         (Check_script::run): New function.
4259         (Check_library::~Check_library): New function.
4260         (Check_library::is_runnable): New function.
4261         (Check_library::locks): New function.
4262         (Check_library::run): New function.
4263         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
4264         (Add_symbols::library_): New data member.
4265         (class Read_member): New class.
4266         (class Check_script): New class.
4267         (class Check_library): New class.
4268         * reloc.cc (Read_relocs::is_runnable): Allow case where
4269         token == NULL.
4270         (Read_relocs::locks): Likewise.
4271         (Scan_relocs::locks): Likewise.
4272         (Relocate_task::locks): Likewise.
4273         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
4274         to clear counters.
4275         (Sized_relobj::incremental_relocs_scan): Fix comment.
4276         (Sized_relobj::do_relocate): Pass output file offset to
4277         write_local_symbols.
4278         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
4279         from class declaration.
4280         * script.cc (read_input_script): Allocate Script_info; pass
4281         argument serial number to report_script.
4282         * script.h (class Script_info): Move to incremental.h.
4283         * symtab.cc (Symbol_table::add_from_incrobj): New function.
4284         * symtab.h (Symbol_table::add_from_incrobj): New function.
4285         (Symbol_table::set_file_offset): New function.
4286
4287 2011-04-05  Cary Coutant  <ccoutant@google.com>
4288
4289         * incremental-dump.cc (dump_incremental_inputs): Change signature
4290         to take a Sized_incremental_binary; change caller.  Use readers
4291         in Sized_incremental_binary.
4292         * incremental.cc
4293         (Sized_incremental_binary::find_incremental_inputs_sections):
4294         Rename do_find_incremental_inputs_sections to this.
4295         (Sized_incremental_binary::setup_readers): New function.
4296         (Sized_incremental_binary::do_check_inputs): Check
4297         has_incremental_info_ flag; move setup code to setup_readers;
4298         use input readers.
4299         (Sized_incremental_binary::do_file_is_unchanged): New function.
4300         (Sized_incremental_binary::do_get_input_reader): New function.
4301         * incremental.h (class Incremental_binary): Move to end of file.
4302         (Incremental_binary::file_is_unchanged): New function.
4303         (Incremental_binary::do_file_is_unchanged): New function.
4304         (Incremental_binary::Input_reader): New class.
4305         (Incremental_binary::get_input_reader): New function.
4306         (class Sized_incremental_binary): Move to end of file.
4307         (Sized_incremental_binary::Sized_incremental_binary): Setup the
4308         input section reader classes.
4309         (Sized_incremental_binary::has_incremental_info): New function.
4310         (Sized_incremental_binary::inputs_reader): New function.
4311         (Sized_incremental_binary::symtab_reader): New function.
4312         (Sized_incremental_binary::relocs_reader): New function.
4313         (Sized_incremental_binary::got_plt_reader): New function.
4314         (Sized_incremental_binary::do_file_is_unchanged): New function.
4315         (Sized_incremental_binary::Sized_input_reader): New class.
4316         (Sized_incremental_binary::get_input_reader): New function.
4317         (Sized_incremental_binary::find_incremental_inputs_sections):
4318         Rename do_find_incremental_inputs_sections to this.
4319         (Sized_incremental_binary::setup_readers): New function.
4320         (Sized_incremental_binary::has_incremental_info_): New data member.
4321         (Sized_incremental_binary::inputs_reader_): New data member.
4322         (Sized_incremental_binary::symtab_reader_): New data member.
4323         (Sized_incremental_binary::relocs_reader_): New data member.
4324         (Sized_incremental_binary::got_plt_reader_): New data member.
4325         (Sized_incremental_binary::current_input_file_): New data member.
4326
4327 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
4328
4329         PR gold/12640
4330         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
4331         violation.
4332
4333 2011-03-30  Cary Coutant  <ccoutant@google.com>
4334
4335         * archive.cc (Archive::include_member): Adjust call to report_object.
4336         (Add_archive_symbols::run): Add script_info to call to
4337         report_archive_begin.
4338         (Lib_group::include_member): Adjust call to report_object.
4339         (Add_lib_group_symbols::run): Adjust call to report_object.
4340         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
4341         blocks.  Add object count for script input files.
4342         * incremental.cc (Incremental_inputs::report_archive_begin): Add
4343         script_info parameter; change all callers.
4344         (Incremental_inputs::report_object): Add script_info parameter;
4345         change all callers.
4346         (Incremental_inputs::report_script): Store backpointer to
4347         incremental info entry.
4348         (Output_section_incremental_inputs::set_final_data_size): Record
4349         additional information for scripts.
4350         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4351         * incremental.h (Incremental_script_entry::add_object): New function.
4352         (Incremental_script_entry::get_object_count): New function.
4353         (Incremental_script_entry::get_object): New function.
4354         (Incremental_script_entry::objects_): New data member; adjust
4355         constructor.
4356         (Incremental_inputs::report_archive_begin): Add script_info parameter.
4357         (Incremental_inputs::report_object): Add script_info parameter.
4358         (Incremental_inputs_reader::get_object_count): New function.
4359         (Incremental_inputs_reader::get_object_offset): New function.
4360         * options.cc (Input_arguments::add_file): Return reference to
4361         new input argument.
4362         * options.h (Input_argument::set_script_info): New function.
4363         (Input_argument::script_info): New function.
4364         (Input_argument::script_info_): New data member; adjust all
4365         constructors.
4366         (Input_file_group::add_file): Return reference to new input argument.
4367         (Input_file_lib::add_file): Likewise.
4368         (Input_arguments::add_file): Likewise.
4369         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
4370         * script.cc (Parser_closure::Parser_closure): Add script_info
4371         parameter; adjust all callers.
4372         (Parser_closure::script_info): New function.
4373         (Parser_closure::script_info_): New data member.
4374         (read_input_script): Report scripts earlier to incremental info.
4375         (script_add_file): Set script_info in Input_argument.
4376         (script_add_library): Likewise.
4377         * script.h (Script_options::Script_info): Rewrite class.
4378
4379 2011-03-29  Cary Coutant  <ccoutant@google.com>
4380
4381         * archive.cc (Library_base::should_include_member): Move
4382         method here from class Archive.
4383         (Archive::Archive): Initialize base class.
4384         (Archive::should_include_member): Move to base class.
4385         (Archive::do_for_all_unused_symbols): New function.
4386         (Add_archive_symbols::run): Remove redundant access to
4387         incremental_inputs.
4388         (Lib_group::Lib_group): Initialize base class.
4389         (Lib_group::do_filename): New function.
4390         (Lib_group::include_member): Pass pointer to Lib_group to
4391         report_object.
4392         (Lib_group::do_for_all_unused_symbols): New function.
4393         (Add_lib_group_symbols::run): Report archive information for
4394         incremental links.
4395         * archive.h (class Library_base): New base class.
4396         (class Archive): Derive from Library_base.
4397         (Archive::filename): Move to base class.
4398         (Archive::set_incremental_info): Likewise.
4399         (Archive::incremental_info): Likewise.
4400         (Archive::Should_include): Likewise.
4401         (Archive::should_include_member): Likewise.
4402         (Archive::Armap_entry): Remove.
4403         (Archive::Unused_symbol_iterator): Remove.
4404         (Archive::unused_symbols_begin): Remove.
4405         (Archive::unused_symbols_end): Remove.
4406         (Archive::do_filename): New function.
4407         (Archive::do_get_mtime): New function.
4408         (Archive::do_for_all_unused_symbols): New function.
4409         (Archive::task_): Move to base class.
4410         (Archive::incremental_info_): Likewise.
4411         (class Lib_group): Derive from Library_base.
4412         (Lib_group::do_filename): New function.
4413         (Lib_group::do_get_mtime): New function.
4414         (Lib_group::do_for_all_unused_symbols): New function.
4415         (Lib_group::task_): Move to base class.
4416         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
4417         function.
4418         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
4419         function.
4420         * incremental.cc (Incremental_inputs::report_archive_begin):
4421         Use Library_base; call library's get_mtime; add incremental inputs
4422         entry before members.
4423         (class Unused_symbol_visitor): New class.
4424         (Incremental_inputs::report_archive_end): Use Library_base; use
4425         visitor class to record unused symbols; don't add incremental inputs
4426         entry after members.
4427         (Incremental_inputs::report_object): Use Library_base.
4428         * incremental.h
4429         (Incremental_archive_entry::Incremental_archive_entry): Remove
4430         unused Archive parameter.
4431         (Incremental_inputs::report_archive_begin): Use Library_base.
4432         (Incremental_inputs::report_archive_end): Likewise.
4433         (Incremental_inputs::report_object): Likewise.
4434         * object.cc (Sized_relobj::do_for_all_global_symbols): New
4435         function.
4436         * object.h (Object::for_all_global_symbols): New function.
4437         (Object::do_for_all_global_symbols): New function.
4438         (Sized_relobj::do_for_all_global_symbols): New function.
4439         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
4440         function.
4441         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
4442         function.
4443
4444 2011-03-27  Ian Lance Taylor  <iant@google.com>
4445
4446         * archive.cc (Archive::interpret_header): Return -1 if something
4447         goes wrong.  Change callers accordingly.
4448
4449 2011-03-25  Cary Coutant  <ccoutant@google.com>
4450
4451         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
4452         * testsuite/Makefile.in: Regenerate.
4453
4454 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
4455
4456         * plugin.cc (get_view): New.
4457         (Plugin::load): Pass get_view to the plugin.
4458         (Plugin_manager::get_view): New.
4459
4460 2011-03-21  Ian Lance Taylor  <iant@google.com>
4461
4462         * testsuite/final_layout.sh: Rewrite to not use dc.
4463         * testsuite/relro_test.sh: Fail if dc is not present.
4464
4465 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
4466
4467         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
4468         Change == to -eq.
4469         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
4470         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
4471         Change == to -eq.
4472         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
4473         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
4474
4475 2011-03-14  Ian Lance Taylor  <iant@google.com>
4476
4477         * script-sections.cc (Sort_output_sections::script_compare):
4478         Rename from is_before, change return type.
4479         (Sort_output_sections::operator()): Adjust accordingly.
4480
4481 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
4482
4483         PR gold/12572
4484         * testsuite/odr_violation2.cc: Add comment to make all error line
4485         numbers double digits.
4486         * testsuite/debug_msg.sh: Adjust expected errors.
4487
4488 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
4489
4490         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
4491         but mark earlier ones as non-canonical
4492         (offset_to_iterator): Update search target and example
4493         (do_addr2line): Return extra lines in a vector*
4494         (format_file_lineno): Extract from do_addr2line
4495         (one_addr2line): Add vector* out-param
4496         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
4497         when a lineno entry appeared last for its instruction
4498         (Dwarf_line_info): Add vector* out-param
4499         * object.cc (Relocate_info): Pass NULL for the vector* out-param
4500         * symtab.cc (Odr_violation_compare): Include the lineno in the
4501         comparison again.
4502         (linenos_from_loc): New. Combine the canonical line for an
4503         address with its other lines.
4504         (True_if_intersect): New. Helper functor to make
4505         std::set_intersection a query.
4506         (detect_odr_violations): Compare sets of lines instead of just
4507         one line for each function. This became less deterministic, but
4508         has fewer false positives.
4509         * symtab.h: Declarations.
4510         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
4511         mix an optimized and non-optimized object in the same binary
4512         (odr_violation2.so): Same.
4513         * testsuite/Makefile.in: Regenerate from Makefile.am.
4514         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
4515         * testsuite/debug_msg.sh: Update line numbers and add
4516         assertions.
4517         * testsuite/odr_violation1.cc: Use OdrDerived, in a
4518         non-optimized context.
4519         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
4520         isn't inlined, and use OdrDerived in an optimized context.
4521         * testsuite/odr_header1.h: Defines OdrDerived, where
4522         optimization will change the
4523         first-instruction-in-the-destructor's file and line number.
4524         * testsuite/odr_header2.h: Defines OdrBase.
4525
4526 2011-03-09  Ian Lance Taylor  <iant@google.com>
4527
4528         * fileread.cc (File_read::clear_views): Don't delete the whole
4529         file view.
4530
4531 2011-03-08  Ian Lance Taylor  <iant@google.com>
4532
4533         PR gold/12525
4534         * fileread.cc: #include <climits>.
4535         (GOLD_IOV_MAX): Define.
4536         (File_read::read_multiple): Limit number of entries by iov_max.
4537         * fileread.h (class File_read): Always set max_readv_entries to
4538         128.
4539
4540 2011-03-07  Ian Lance Taylor  <iant@google.com>
4541
4542         PR gold/12525
4543         * options.h (class General_options): Add -dy and -dn.
4544
4545 2011-03-02  Cary Coutant  <ccoutant@google.com>
4546
4547         * testsuite/script_test_9.t: Add TLS segment.
4548
4549 2011-03-02  Simon Baldwin  <simonb@google.com>
4550
4551         * configure.ac: Add check for gnu_indirect_function support in
4552         the toolchain building binutils.
4553         * configure: Rebuild.
4554
4555 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
4556
4557         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
4558         plugin only symbols.
4559         (Symbol_table::sized_finalize_symbol) Mark symbol only present
4560         in plugin files as not needed in the symbol table.
4561
4562 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
4563
4564         * output.cc (Output_section::add_input_section): Delay fill
4565         generation for section ordering.
4566
4567 2011-02-09  Ian Lance Taylor  <iant@google.com>
4568
4569         PR gold/12316
4570         * object.h (class Sized_relobj): Remove clear_local_symbols.
4571         * reloc.cc (Sized_relobj::do_relocate): Don't call
4572         clear_local_symbols.
4573
4574 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
4575
4576         * plugin.cc (is_visible_from_outside): Return true for symbols
4577         in the -u option.
4578
4579 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
4580
4581         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
4582         filename.
4583
4584 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
4585
4586         * icf.h (is_section_foldable_candidate): Change type of parameter
4587         to std::string.
4588         * icf.cc (Icf::find_identical_sections): Change type of local variable
4589         section_name to be std::string.
4590         (is_function_ctor_or_dtor): Change type of parameter to std::string.
4591
4592 2011-01-25  Ian Lance Taylor  <iant@google.com>
4593
4594         * script.cc (script_add_extern): Rewrite to use
4595         add_symbol_reference.
4596
4597 2011-01-25  Doug Kwan  <dougkwan@google.com>
4598
4599         * icf.cc (get_section_contents): Always lock section's object.
4600
4601 2011-01-24  Ian Lance Taylor  <iant@google.com>
4602
4603         * options.h (class General_options): Accept
4604         --no-detect-odr-violations.
4605
4606 2011-01-24  Ian Lance Taylor  <iant@google.com>
4607
4608         * version.cc (version_string): Bump to 1.11.
4609
4610 2011-01-24  Ian Lance Taylor  <iant@google.com>
4611
4612         * plugin.cc (class Plugin_rescan): Define new class.
4613         (Plugin_manager::claim_file): Set any_claimed_.
4614         (Plugin_manager::save_archive): New function.
4615         (Plugin_manager::save_input_group): New function.
4616         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
4617         necessary.
4618         (Plugin_manager::new_undefined_symbol): New function.
4619         (Plugin_manager::rescan): New function.
4620         (Plugin_manager::rescannable_defines): New function.
4621         (Plugin_manager::add_input_file): Set any_added_.
4622         * plugin.h (class Plugin_manager): define new fields rescannable_,
4623         undefined_symbols_, any_claimed_, and any_added_.  Declare
4624         Plugin_rescan as friend.  Declare new functions.
4625         (Plugin_manager::Rescannable): Define type.
4626         (Plugin_manager::Rescannable_list): Define type.
4627         (Plugin_manager::Undefined_symbol_list): Define type.
4628         (Plugin_manager::Plugin_manager): Initialize new fields.
4629         * archive.cc (Archive::defines_symbol): New function.
4630         (Add_archive_symbols::run): Pass archive to plugins if any.
4631         * archive.h (class Archive): Declare defines_symbol.
4632         * readsyms.cc (Input_group::~Input_group): New function.
4633         (Finish_group::run): Pass input_group to plugins if any.
4634         * readsyms.h (class Input_group): Declare destructor.
4635         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
4636         any.
4637
4638 2011-01-10  Ian Lance Taylor  <iant@google.com>
4639
4640         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
4641         section as relro.
4642         (Layout::set_segment_offsets): Reset increase_relro before calling
4643         set_section_addresses a second time.
4644
4645 2011-01-04  Cary Coutant  <ccoutant@google.com>
4646
4647         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
4648         sections before NOBITS sections.
4649
4650 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
4651
4652         * version.cc (print_version): Update copyright to 2011.
4653
4654 2010-12-23  Cary Coutant  <ccoutant@google.com>
4655
4656         * output.h (Output_data_reloc::add_output_section): Pass OD instead
4657         of OS to this->add.  Add OD parameter to second form of the function.
4658
4659 2010-12-20  Ian Lance Taylor  <iant@google.com>
4660
4661         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
4662         second of two consecutive entries with same offset.
4663
4664 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4665
4666         * testsuite/Makefile.am (ifuncmain2static_LDADD)
4667         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
4668         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
4669         to avoid unneeded links against $(LDADD).
4670         * testsuite/Makefile.in: Regenerate.
4671
4672 2010-12-15  Ian Lance Taylor  <iant@google.com>
4673
4674         PR gold/12324
4675         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
4676         for R_X86_64_32 and R_X86_64_PC32.
4677         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
4678         ver_matching_def_pic.o.
4679         (ver_matching_def_pic.o): New target.
4680
4681 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4682
4683         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
4684         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
4685         Move definition before File_read::View member definitions.
4686         (File_read::View::~View): Initialize and hold lock before
4687         updating current_mapped_bytes.
4688
4689 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
4690
4691         * dwarf_reader.cc: Remove outdated comment.
4692         * gold-threads.cc: Fix typo in error message.
4693         * archive.cc: Fix typos in comments.
4694         * archive.h: Likewise.
4695         * arm-reloc-property.cc: Likewise.
4696         * arm-reloc-property.h: Likewise.
4697         * arm-reloc.def: Likewise.
4698         * arm.cc: Likewise.
4699         * attributes.h: Likewise.
4700         * cref.cc: Likewise.
4701         * ehframe.cc: Likewise.
4702         * fileread.h: Likewise.
4703         * gold.h: Likewise.
4704         * i386.cc: Likewise.
4705         * icf.cc: Likewise.
4706         * incremental.h: Likewise.
4707         * int_encoding.cc: Likewise.
4708         * layout.h: Likewise.
4709         * main.cc: Likewise.
4710         * merge.h: Likewise.
4711         * object.cc: Likewise.
4712         * object.h: Likewise.
4713         * options.cc: Likewise.
4714         * readsyms.cc: Likewise.
4715         * reduced_debug_output.cc: Likewise.
4716         * reloc.cc: Likewise.
4717         * script-sections.cc: Likewise.
4718         * sparc.cc: Likewise.
4719         * symtab.h: Likewise.
4720         * target-reloc.h: Likewise.
4721         * target.cc: Likewise.
4722         * target.h: Likewise.
4723         * timer.cc: Likewise.
4724         * timer.h: Likewise.
4725         * x86_64.cc: Likewise.
4726
4727 2010-12-09  Cary Coutant  <ccoutant@google.com>
4728
4729         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
4730         stack.
4731         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
4732         parameter; change all callers.
4733         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
4734         * options.h (warn_execstack): New option.
4735
4736 2010-12-07  Doug Kwan  <dougkwan@google.com>
4737
4738         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
4739         like function call relocations.
4740
4741 2010-12-07  Ian Lance Taylor  <iant@google.com>
4742
4743         * archive.cc (Archive::get_elf_object_for_member): Permit
4744         punconfigured to be NULL.
4745         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
4746         (Archive::include_member): Pass NULL to get_elf_object_for_member
4747         if we searched for the archive and this is the first included
4748         object.
4749
4750 2010-12-01  Ian Lance Taylor  <iant@google.com>
4751
4752         * dwarf_reader.h (class Sized_dwarf_line_info): Add
4753         track_relocs_type_ field.
4754         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4755         Set track_relocs_type_.
4756         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
4757         contents when using RELA relocs.
4758         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
4759         reloc_map_.
4760         * reloc.cc (Track_relocs::next_addend): New function.
4761         * reloc.h (class Track_relocs): Declare next_addend.
4762
4763 2010-12-01  Ian Lance Taylor  <iant@google.com>
4764
4765         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
4766         virtual destructor.
4767
4768 2010-12-01  Ian Lance Taylor  <iant@google.com>
4769
4770         * README: Update compilers known to work and fail.
4771
4772 2010-11-23  Matthias Klose  <doko@ubuntu.com>
4773
4774         * configure.in: For --enable-gold, handle value `default' instead of
4775         `both*'.  Always install ld as ld.bfd, install as ld if gold is
4776         not the default.
4777         * configure: Regenerate.
4778
4779 2010-11-18  Doug Kwan  <dougkwan@google.com>
4780
4781         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
4782         and right_alignment to be zero.  Store result alignment only if it is
4783         greater than existing alignment.
4784
4785 2010-11-16  Cary Coutant  <ccoutant@google.com>
4786
4787         PR gold/12220
4788         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
4789         Check for ".zdebug_line".
4790
4791 2010-11-16  Doug Kwan  <dougkwan@google.com>
4792             Cary Coutant  <ccoutant@google.com>
4793
4794         * output.h (Output_segment::set_section_addresses): Pass increase_relro
4795         by reference; adjust all callers.
4796         * output.cc (Output_segment::set_section_addresses): Adjust references
4797         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
4798         list is empty.
4799         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
4800         end at page boundary.
4801
4802 2010-11-16  Cary Coutant  <ccoutant@google.com>
4803
4804         PR gold/12220
4805         * layout.cc (Layout::choose_output_section): Transform names of
4806         compressed sections even when using a script with a SECTIONS clause.
4807         (Layout::output_section_name): Remove code to transform
4808         compressed debug section names.
4809         * output.cc (Output_section::add_input_section): Use uncompressed
4810         section size when tracking input sections.
4811
4812 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
4813
4814         * symtab.h (Symbol::NON_PIC_REF): Remove.
4815         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
4816         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
4817         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
4818         (Symbol::use_plt_offset): Take a flags argument and pass it
4819         directly to needs_dynamic_reloc.  Restrict check for undefined
4820         weak symbols to function calls.
4821         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
4822         (Target_arm::Scan::global): Use it.
4823         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
4824         (Target_arm::Relocate::relocate): Likewise.
4825         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
4826         parameter with an r_type parameter.  Use get_reference_flags
4827         to get the flags.
4828         (Target_arm::Relocate::relocate): Update accordingly.
4829         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
4830         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
4831         (Target_i386::Scan::global): Likewise.
4832         (Target_i386::Relocate::relocate): Likewise.
4833         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
4834         parameter with an r_type parameter.  Use get_reference_flags
4835         to get the flags.
4836         (Target_i386::Relocate::relocate): Update accordingly.
4837         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
4838         (Target_powerpc::Scan::global): Use it.
4839         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
4840         (Target_powerpc::Relocate::relocate): Likewise.
4841         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
4842         (Target_sparc::Scan::global): Use it.
4843         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
4844         (Target_sparc::Relocate::relocate): Likewise.
4845         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
4846         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
4847         (Target_x86_64::Scan::global): Likewise.
4848         (Target_x86_64::Relocate::relocate): Likewise.
4849
4850 2010-11-08  Doug Kwan  <dougkwan@google.com>
4851             Cary Coutant  <ccoutant@google.com>
4852
4853         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
4854         (Arm_exidx_merge_section::section_contents_): New data member.
4855         (Arm_input_section::Arm_input_section): Initialize original_contents_.
4856         (Arm_input_section::~Arm_input_section): De-allocate memory.
4857         (Arm_input_section::original_contents_): New data member.
4858         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
4859         in parameters instead of calling Object::section_contents without
4860         locking.
4861         (Arm_output_section::group_section): New parameter TASK.  Pass it
4862         to callees that need locking objects.
4863         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
4864         to lock EXIDX input sections.  Fix a formatting issue.  Call
4865         Arm_exidx_merged_section::build_contents to create merged section
4866         contents.
4867         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
4868         to lock object of stub table owner.
4869         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
4870         TEXT_SIZE to initialize data member TEXT_SIZE_.
4871         (Arm_exidx_input_section::addralign): Fix typo in comment.
4872         (Arm_exidx_input_section::text_size): New method.
4873         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
4874         that require locking objects.  Lock objects before scanning for stubs
4875         and updating local symbols.
4876         (Arm_input_section<big_endian>::init): Copy contents of original
4877         input section.
4878         (Arm_input_section<big_endian>::do_write): Use saved contents of
4879         original input section instead of calling Object::section_contents
4880         without locking.
4881         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
4882         size without calling Object::section_size().
4883         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
4884         for size.  Allocate a buffer for merged EXIDX entries.
4885         (Arm_exidx_merged_section::build_contents): New method.
4886         (Arm_exidx_merged_section::do_write): Move merge section contents
4887         building code to Arm_exidx_merged_section::build_contetns.  Write
4888         out contetns in buffer instead of building it on the fly.
4889         (Arm_relobj::make_exidx_input_section): Also pass text section size
4890         to Arm_exidx_input_section constructor.
4891         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
4892         (Arm_dynobj::do_read_symbols): Fix memory leak.
4893         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
4894         * target.h: (class Task): Add forward declaration.
4895         (Target::relax): Add new parameter TASK and pass it to
4896         Target::do_relax().
4897         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
4898
4899 2010-11-05  Cary Coutant  <ccoutant@google.com>
4900
4901         PR gold/10708
4902         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
4903         object when reading from the file.
4904         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
4905         second layout pass.
4906         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
4907         when reading section contents.
4908         (get_section_contents): Likewise.
4909         (icf::find_identical_sections): Likewise.
4910         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
4911         object when reading from the file.
4912         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
4913         the object when doing deferred section layout.
4914
4915 2010-11-03  Nick Clifton  <nickc@redhat.com>
4916
4917         PR gold/12001
4918         * script.h (class Symbol_assignment: name): New member.  Returns
4919         the name of the symbol.
4920         * scrfipt.cc (Script_options::is_pending_assignment): New member.
4921         Returns true if the given symbol name is on the list of
4922         assignments wating to be processed.
4923         * archive.cc (should_incldue_member): If the symbol is undefined,
4924         check to see if it is on the list of symbols pending assignment.
4925
4926 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
4927
4928         * script-sections.cc (Script_sections::find_memory_region): Check
4929         for a NULL output section pointer.
4930
4931 2010-10-29  Doug Kwan  <dougkwan@google.com>
4932
4933         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
4934         Output_section::add_relaxed_input_section.
4935         * output.cc (Output_section::add_relaxed_input_section): Add new
4936         arguments LAYOUT and NAME.  Set section order index.
4937         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
4938         Copy section order index.
4939         * output.h (Output_section::add_relaxed_input_section): Add new
4940         arguments LAYOUT and NAME.
4941
4942 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4943
4944         * testsuite/Makefile.am: Move gcctestdir/ld rule to
4945         NATIVE_OR_CROSS_LINKER.
4946         * testsuite/Makefile.in: Regenerate.
4947
4948 2010-10-20  Doug Kwan  <dougkwan@google.com>
4949
4950         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
4951         without SHF_LINK_ORDER flags.
4952         * layout.cc (Layout::choose_output_section): Do not filter
4953         SHF_LINK_ORDER flag in a relocatable link.
4954
4955 2010-10-17  Cary Coutant  <ccoutant@google.com>
4956
4957         * output.h (Output_segment::set_section_addresses): Change function
4958         signature.  Update all callers.
4959         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
4960         sections.
4961         (Output_segment::set_section_addresses): Align after last TLS
4962         section.  Add padding before last relro section instead of after.
4963
4964 2010-10-17  Doug Kwan  <dougkwan@google.com>
4965
4966         * gold/arm.cc (Target_arm::got_section): Use correct order and set
4967         GOT output section to be writable.
4968
4969 2010-10-14  Cary Coutant  <ccoutant@google.com>
4970
4971         * debug.h (DEBUG_INCREMENTAL): New flag.
4972         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
4973         * gold.cc (queue_initial_tasks): Check parameters for incremental link
4974         mode.
4975         * incremental.cc (report_command_line): Ignore all forms of
4976         --incremental.
4977         * layout.cc (Layout::Layout): Check parameters for incremental link
4978         mode.
4979         * options.cc (General_options::parse_incremental): New function.
4980         (General_options::parse_no_incremental): New function.
4981         (General_options::parse_incremental_full): New function.
4982         (General_options::parse_incremental_update): New function.
4983         (General_options::incremental_mode_): New data member.
4984         (General_options::finalize): Check incremental_mode_.
4985         * options.h (General_options): Update help text for --incremental.
4986         Add --no-incremental, --incremental-full, --incremental-update.
4987         (General_options::Incremental_mode): New enum type.
4988         (General_options::incremental_mode): New function.
4989         (General_options::incremental_mode_): New data member.
4990         * parameters.cc (Parameters::incremental_mode_): New data member.
4991         (Parameters::set_options): Set incremental_mode_.
4992         (Parameters::set_incremental_full): New function.
4993         (Parameters::incremental): New function.
4994         (Parameters::incremental_update): New function.
4995         (set_parameters_incremental_full): New function.
4996         * parameters.h (Parameters::set_incremental_full): New function.
4997         (Parameters::incremental): New function.
4998         (Parameters::incremental_update): New function.
4999         (Parameters::incremental_mode_): New data member.
5000         (set_parameters_incremental_full): New function.
5001         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5002         incremental link mode.
5003         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5004         (Sized_relobj::do_relocate_sections): Likewise.
5005         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5006         option.
5007         * testsuite/Makefile.in: Regenerate.
5008         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5009
5010 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5011
5012         * script-sections.h (class Script_sections): Make
5013         Sections_elements typedef public.
5014         * script-sections.cc (class Sort_output_sections): Add elements_
5015         field.  Add constructor which sets it; change all callers.
5016         (Sort_output_sections::is_before): New function.
5017         (Sort_output_sections::operator()): Call is_before.
5018         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5019         conditional.
5020         * testsuite/script_test_10.sh: New test. Test script section
5021         order.
5022         * testsuite/script_test_10.t: Likewise.
5023         * testsuite/script_test_10.s: Likewise.
5024         * testsuite/Makefile.am: Wrap the cross linker tests and the
5025         common tests into NATIVE_OR_CROSS_LINKER.
5026         (check_SCRIPTS): Add script_test_10.sh.
5027         (check_DATA): Add script_test_10.stdout.
5028         (script_test_10.o, script_test_10): New targets.
5029         (script_test_10.stdout): New target.
5030         * configure, testsuite/Makefile.in: Regenerate.
5031
5032 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5033
5034         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5035         error for the deprecated relocations.
5036         (Target_arm::Scan::global): Likewise.
5037         (Target_arm::Relocate::relocate): Likewise.
5038
5039 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5040
5041         * fileread.cc (Input_file::find_file): Initialize *found_name
5042         and *namep when using the fallback search for case 4.
5043
5044 2010-10-11  Cary Coutant  <ccoutant@google.com>
5045
5046         * options.h (class General_options): Redefine -z lazy as an alias for
5047         the negation of -z now.
5048
5049 2010-10-11  Ian Lance Taylor  <iant@google.com>
5050
5051         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5052         binding.
5053
5054 2010-10-06  Nick Clifton  <nickc@redhat.com>
5055
5056         * script-sections.cc(class Memory_region): Remove
5057         current_lma_offset_ field.  Rename current_vma_offset_ to
5058         current_offset_.  Add last_section_ field.
5059         (Memory_region::get_current_vma_address): Rename to
5060         get_current_address.
5061         (Memory_region::get_current_lma_address): Delete.
5062         (Memory_region::increment_vma_offset): Rename to
5063         increment_offset.
5064         (Memory_region::increment_lma_offset): Delete.
5065         (Memory_region::attributes_compatible): New method.  Returns
5066         true if the provided section is compatible with the region.
5067         (Memory_region::get_last_section): New method.  Returns the last
5068         section to use the region.
5069         (Memory_region::set_last_section): New method.  Stores the last
5070         section to use the region.
5071         (Script_sections::block_in_region): New method.  Returns true if
5072         a block of memory is contained within a region.
5073         (Script_sections::find_memory_region): New method.  Locates a
5074         memory region to be used to set a VMA or LMA address.
5075         (Output_section_definition::set_section_addresses): Add code to
5076         check for addresses set by memory regions.
5077         (Output_segment::set_section_addresses): Remove memory region
5078         walking code.
5079         (Script_sections::create_segment): Add a warning if a header
5080         segment is created outside of any region.
5081         * script-sections.h (class Script_sections): Add prototypes for
5082         find_memory_region and block_in_region methods.
5083         * testsuite/memory_test.s: Use .long instead of .word.
5084         * testsuite/memory_test.t: Add some more output sections.
5085         * testsuite/memory_test.sh: Update expected output.
5086
5087 2010-10-02  Doug Kwan  <dougkwan@google.com>
5088
5089         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5090         defintion to symtab.h
5091         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5092         declaration to defintion.
5093
5094 2010-10-01  Nick Clifton  <nickc@redhat.com>
5095
5096         * expression.cc (eval): Replace dummy argument with NULL.
5097         (eval_maybe_dot): Check for a NULL result section pointer.
5098         (Symbol_expression::value): Likewise.
5099         (Dot_expression::value): Likewise.
5100         (BINARY_EXPRESSION): Likewise.
5101         (Max_expression::value): Likewise.
5102         (Min_expression::value): Likewise.
5103         (Absolute_expression::value): Likewise.
5104         (Addr_expression::value_from_output_section): Likewise.
5105         (Loaddddr_expression::value_from_output_section): Likewise.
5106         (Segment_start_expression::value): Likewise.
5107         * script-sections.cc
5108         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5109         argument with NULL.
5110         (Sections_elememt_dot_assignment::set_section_addresses):
5111         Likewise.
5112         (Output_data_expression::do_write_to_buffer): Likewise.
5113         (Output_section_definition::finalize_symbols): Likewise.
5114         (Output_section_definition::set_section_addresses): Likewise.
5115
5116 2010-09-30  Doug Kwan  <dougkwan@google.com>
5117
5118         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5119
5120 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5121
5122         * target.h (Target::can_icf_inline_merge_sections): New virtual
5123         function.
5124         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
5125         virtual function.
5126         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
5127         virtual function.
5128         * icf.cc (get_section_contents): Inline merge sections only when
5129         target allows it.
5130
5131 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5132
5133         * configure: Regenerate.
5134
5135 2010-09-17  Ian Lance Taylor  <iant@google.com>
5136
5137         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
5138         * testsuite/Makefile.am (memory_test.o): New target.
5139         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
5140         memory_test.t.
5141         * testsuite/Makefile.in: Rebuild.
5142
5143 2010-09-17  Doug Kwan  <dougkwan@google.com>
5144
5145         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
5146         defintion if relocation uses GOT entries of the symbol.
5147         * testsuite/icf_safe_test.sh: Fix test.
5148         * testsuite/icf_safe_so_test.sh: Fix test.
5149
5150 2010-09-16  Cary Coutant  <ccoutant@google.com>
5151
5152         * script_sections.cc (class Memory_region): Remove "NULL" from
5153         vector initializations.
5154
5155 2010-09-15  Cary Coutant  <ccoutant@google.com>
5156
5157         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
5158         Resolve forwarding symbols.
5159
5160 2010-09-15  Doug Kwan  <dougkwan@google.com>
5161
5162         * gold/testsuite/script_test_3.t: Add ARM special sections.
5163         * gold/testsuite/script_test_4.t: Same.
5164         * gold/testsuite/script_test_5.t: Same.
5165         * gold/testsuite/script_test_6.t: Same.
5166         * gold/testsuite/script_test_7.t: Same.
5167         * gold/testsuite/script_test_7.t: Same.
5168         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
5169
5170 2010-09-14  Cary Coutant  <ccoutant@google.com>
5171
5172         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
5173         (Target_x86_64::Relocate::relocate_tls): Replace check for
5174         saw_tls_block_reloc_ with test for executable section.
5175
5176 2010-09-12  Cary Coutant  <ccoutant@google.com>
5177
5178         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
5179         position-independent executables to shared libraries need dynamic
5180         relocations.
5181         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
5182         position-independent executables.
5183         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
5184         * testsuite/Makefile.in: Regenerate.
5185
5186 2010-09-10  Nick Clifton  <nickc@redhat.com>
5187
5188         PR gold/11997
5189         * testsuite/memory_test.t: Discard any sections that are not
5190         needed.
5191
5192 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
5193
5194         PR gold/11996
5195         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
5196         "This::" to work around a bug in gcc 4.2.
5197
5198         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
5199
5200 2010-09-09  Rafael Espindola  <espindola@google.com>
5201
5202         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
5203         sections with different PF_X flags in the same segment.
5204         (Layout::find_first_load_seg): Search all segments to find the first
5205         one.
5206         * options.h (rosegment): New.
5207
5208 2010-09-08  Rafael Espindola  <espindola@google.com>
5209
5210         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
5211
5212 2010-09-08  Doug Kwan  <dougkwan@google.com>
5213
5214         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
5215         (Arm_relobj::do_relocate_sections): Add new parameter for output
5216         file to match the parent.
5217         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
5218         of local symbols instead of input values.  Update code to track
5219         changes in gold::relocate_section.
5220         * object.cc (Sized_relobj::compute_final_local_value): New methods.
5221         (Sized_relobj::compute_final_local_value_internal): New methods.
5222         (Sized_relobj::do_finalize_local_symbols): Move code from loop
5223         body into private version of Sized_relobj::compute_final_local_value.
5224         Call the inline method.
5225         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
5226         merged symbol value if there is one.
5227         (Symbol_value::has_output_value): New method defintiion.
5228         (Sized_relobj::Compute_final_local_value_status): New enum type.
5229         (Sized_relobj::compute_final_local_value): New methods.
5230         (Sized_relobj::compute_final_local_value_internal): New methods.
5231         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
5232         and arm_cortex_a8.sh.
5233         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
5234         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
5235         New tests.
5236         * Makefile.in: Regenerate.
5237         * testsuite/arm_bl_out_of_range.s: Update test.
5238         * testsuite/thumb_bl_out_of_range.s: Ditto.
5239         * testsuite/thumb_blx_out_of_range.s: Ditto.
5240         * testsuite/arm_branch_out_of_range.sh: New file.
5241         * testsuite/arm_cortex_a8.sh: Ditto.
5242         * testsuite/arm_cortex_a8_b.s: Ditto.
5243         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
5244         * testsuite/arm_cortex_a8_b_local.s: Ditto.
5245         * testsuite/arm_cortex_a8_bl.s: Ditto.
5246         * testsuite/arm_cortex_a8_blx.s: Ditto.
5247         * testsuite/arm_cortex_a8_local.s: Ditto.
5248         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
5249         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
5250
5251 2010-09-08  Rafael Espindola  <espindola@google.com>
5252
5253         * Makefile.am (memory_test.stdout): Run readelf with -W.
5254         * Makefile.in: Regenerate.
5255         * testsuite/memory_test.sh: Make the regexps accept both 32 and
5256         64 bit output.
5257
5258 2010-09-08  Rafael Espindola  <espindola@google.com>
5259
5260         * script-sections.cc (Script_sections::add_memory_region): Convert
5261         field precision to int.
5262         * script.cc (script_set_section_region, script_set_section_region):
5263         Convert field precision to int.
5264
5265 2010-09-08  Rafael Espindola  <espindola@google.com>
5266
5267         * arm.cc (do_finalize_sections): Create the __exidx_start and
5268         __exdix_end symbols even when the section is missing.
5269
5270 2010-09-08  Nick Clifton  <nickc@redhat.com>
5271
5272         * README: Remove claim that MEMORY is not supported.
5273         * expression.cc (script_exp_function_origin)
5274         (script_exp_function_length): Move from here to ...
5275         * script.cc: ... here.
5276         (script_set_section_region, script_add_memory)
5277         (script_parse_memory_attr, script_include_directive): New
5278         functions.
5279         * script-sections.cc
5280         (class Memory_region): New class.
5281         (class Output_section_definition): Add set_memory_region,
5282         set_section_vma, set_section_lma and get_section_name methods.
5283         (class Script_Sections): Add add_memory_region,
5284         find_memory_region, find_memory_region_origin,
5285         find_memory_region_length and set_memory_region methods.
5286         Have set_section_addresses method walk the list of set memory
5287         regions.
5288         Extend the print methos to display memory regions.
5289         * script-sections.h: Add prototypes for new methods.
5290         Add enum for MEMORY region attributes.
5291         * yyscript.y: Add support for parsing MEMORY regions.
5292         * script-c.h: Add prototypes for new functions.
5293         * testsuite/Makefile.am: Add test of MEMORY region functionality.
5294         * testsuite/Makefile.in: Regenerate.
5295         * testsuite/memory_test.sh: New script.
5296         * testsuite/memory_test.s: New assembler source file.
5297         * testsuite/memory_test.t: New linker script.
5298
5299 2010-08-27  Doug Kwan  <dougkwan@google.com>
5300
5301         * gold/resolve.cc (Symbol_table::should_override): Let a weak
5302         reference override an existing dynamic weak reference.
5303         * testsuite/Makefile.am: Add new test dyn_weak_ref.
5304         * testsuite/Makefile.in: Regenerate.
5305         * testsuite/dyn_weak_ref.sh: New file.
5306         * testsuite/dyn_weak_ref_1.c: Ditto.
5307         * testsuite/dyn_weak_ref_2.c: Ditto.
5308
5309 2010-08-27  Ian Lance Taylor  <iant@google.com>
5310
5311         * incremental.h (class Incremental_input_entry): Add virtual
5312         destructor.
5313
5314 2010-08-27  Ian Lance Taylor  <iant@google.com>
5315
5316         * testsuite/start_lib_test_3.c: Mark t3 as used.
5317
5318 2010-08-27  Nick Clifton  <nickc@redhat.com>
5319
5320         * options.cc (version_script): Fix small typo in previous
5321         whitespace tidyup.
5322
5323 2010-08-25  Nick Clifton  <nickc@redhat.com>
5324
5325         * archive.cc: Formatting fixes: Remove whitespace between
5326         typename and following asterisk.  Remove whitespace between
5327         function name and opening parenthesis.
5328         * archive.h: Likewise.
5329         * arm.cc: Likewise.
5330         * attributes.cc: Likewise.
5331         * attributes.h: Likewise.
5332         * common.cc: Likewise.
5333         * copy-relocs.cc: Likewise.
5334         * dirsearch.h: Likewise.
5335         * dynobj.cc: Likewise.
5336         * ehframe.cc: Likewise.
5337         * ehframe.h: Likewise.
5338         * expression.cc: Likewise.
5339         * fileread.cc: Likewise.
5340         * fileread.h: Likewise.
5341         * gc.h: Likewise.
5342         * gold-threads.cc: Likewise.
5343         * gold.cc: Likewise.
5344         * i386.cc: Likewise.
5345         * icf.h: Likewise.
5346         * incremental-dump.cc: Likewise.
5347         * incremental.cc: Likewise.
5348         * layout.cc: Likewise.
5349         * layout.h: Likewise.
5350         * main.cc: Likewise.
5351         * merge.cc: Likewise.
5352         * merge.h: Likewise.
5353         * object.cc: Likewise.
5354         * object.h: Likewise.
5355         * options.cc: Likewise.
5356         * options.h: Likewise.
5357         * output.cc: Likewise.
5358         * output.h: Likewise.
5359         * plugin.cc: Likewise.
5360         * plugin.h: Likewise.
5361         * powerpc.cc: Likewise.
5362         * reloc.cc: Likewise.
5363         * script-c.h: Likewise.
5364         * script-sections.cc: Likewise.
5365         * script.cc: Likewise.
5366         * stringpool.cc: Likewise.
5367         * symtab.cc: Likewise.
5368         * symtab.h: Likewise.
5369         * target.cc: Likewise.
5370         * timer.cc: Likewise.
5371         * timer.h: Likewise.
5372         * version.cc: Likewise.
5373         * x86_64.cc: Likewise.
5374
5375 2010-08-24  Nick Clifton  <nickc@redhat.com>
5376
5377         PR 11899
5378         * layout.cc (segment_precedes): Sort segments by their physical
5379         addresses, if they have been set.
5380
5381 2010-08-23  Cary Coutant  <ccoutant@google.com>
5382
5383         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
5384         symbols data.
5385         (Lib_group::include_member): Unlock object after deleting its
5386         symbols data.
5387         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
5388         the bug fixed here.
5389
5390 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
5391             Cary Coutant  <ccoutant@google.com>
5392
5393         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
5394         constructor, and set_blocker.
5395         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
5396         readsyms_blocker_.
5397         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
5398         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
5399         * testsuite/Makefile.am (start_lib_test): New test case.
5400         * testsuite/Makefile.in: Regenerate.
5401         * testsuite/start_lib_test_main.c: New file.
5402         * testsuite/start_lib_test_1.c: New file.
5403         * testsuite/start_lib_test_2.c: New file.
5404         * testsuite/start_lib_test_3.c: New file.
5405
5406 2010-08-19  Ian Lance Taylor  <iant@google.com>
5407
5408         * Makefile.in: Rebuild with automake 1.11.1.
5409         * aclocal.m4: Likewise.
5410         * testsuite/Makefile.in: Likewise.
5411
5412 2010-08-19  Ian Lance Taylor  <iant@google.com>
5413
5414         PR 10893
5415         * i386.cc (class Output_data_plt_i386): Update declarations.
5416         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
5417         local_ifuncs_ fields.
5418         (Target_i386::do_plt_section_for_global): New function.
5419         (Target_i386::do_plt_section_for_local): New function.
5420         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
5421         parameter; change all callers.  Initialize global_ifuncs_ and
5422         local_ifuncs_.  If doing a static link define __rel_iplt_start and
5423         __rel_iplt_end.
5424         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
5425         (Output_data_plt_i386::add_local_ifunc_entry): New function.
5426         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
5427         symbols.
5428         (Target_i386::make_plt_section): New function, broken out of
5429         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
5430         (Target_i386::make_plt_entry): Call make_plt_section.
5431         (Target_i386::make_local_ifunc_plt_entry): New function.
5432         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
5433         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
5434         R_386_IRELATIVE to switch.
5435         (Target_i386::Scan::global): Likewise.
5436         (Target_i386::Relocate::relocate): Likewise.
5437         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
5438         switch.
5439         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
5440         (Target_x86_64::do_plt_section_for_global): New function.
5441         (Target_x86_64::do_plt_section_for_local): New function.
5442         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
5443         parameter; change all callers.  If doing a static link define
5444         __rela_iplt_start and __rela_iplt_end.
5445         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
5446         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
5447         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
5448         to point to .plt.
5449         (Target_x86_64::make_local_ifunc_plt_entry): New function.
5450         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
5451         switch.
5452         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
5453         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
5454         R_X86_64_IRELATIVE to switch.
5455         (Target_x86_64::Scan::global): Likewise.
5456         (Target_x86_64::Relocate::relocate): Likewise.
5457         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
5458         switch.
5459         * target.h (class Target): Add plt_section_for_global and
5460         plt_section_for_local functions.  Add do_plt_section_for_global
5461         and do_plt_section_for_local virtual functions.
5462         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
5463         clarifying comments.
5464         (Symbol::use_plt_offset): Handle IFUNC symbol.
5465         * object.cc (Sized_relobj::Sized_relobj): Initialize
5466         local_plt_offsets_.
5467         (Sized_relobj::local_has_plt_offset): New function.
5468         (Sized_relobj::local_plt_offset): New function.
5469         (Sized_relobj::set_local_plt_offset): New function.
5470         (Sized_relobj::do_count): Handle IFUNC symbol.
5471         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
5472         a bit away from input_shndx_ field.  Add set_is_func_symbol and
5473         is_ifunc_symbol functions.
5474         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
5475         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
5476         local_plt_offsets_ field.
5477         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
5478         * output.h (class Output_section_data): Add non-const
5479         output_section function.
5480         (class Output_data_got): Update declarations.
5481         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
5482         Add use_plt_offset parameter to global and local constructors.
5483         Change all callers.  Change local_sym_index_ field to 31 bits.
5484         Change GSYM_CODE and CONSTANT_CODE accordingly.
5485         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
5486         doing a static link don't set sh_link field.
5487         (Output_data_got::Got_entry::write): Use PLT offset if
5488         appropriate.
5489         (Output_data_got::add_global_plt): New function.
5490         (Output_data_got::add_local_plt): New function.
5491         * target-reloc.h (relocate_section): Handle IFUNC symbol.
5492         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
5493         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
5494         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
5495         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
5496         IFUNC conditional.
5497         * testsuite/ifunc-sel.h: New file.
5498         * testsuite/ifuncmain1.c: New file.
5499         * testsuite/ifuncmain1vis.c: New file.
5500         * testsuite/ifuncmod1.c: New file.
5501         * testsuite/ifuncdep2.c: New file.
5502         * testsuite/ifuncmain2.c: New file.
5503         * testsuite/ifuncmain3.c: New file.
5504         * testsuite/ifuncmod3.c: New file.
5505         * testsuite/ifuncmain4.c: New file.
5506         * testsuite/ifuncmain5.c: New file.
5507         * testsuite/ifuncmod5.c: New file.
5508         * testsuite/ifuncmain6pie.c: New file.
5509         * testsuite/ifuncmod6.c: New file.
5510         * testsuite/ifuncmain7.c: New file.
5511         * configure, testsuite/Makefile.in: Rebuild.
5512
5513 2010-08-18  Ian Lance Taylor  <iant@google.com>
5514
5515         * incremental.cc
5516         (Output_section_incremental_inputs::write_input_files): Add cast
5517         to avoid signed/unsigned comparison warning.
5518         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5519
5520 2010-08-12  Cary Coutant  <ccoutant@google.com>
5521
5522         * common.cc (Sort_commons::operator()): Remove unnecessary code.
5523
5524 2010-08-13  Ian Lance Taylor  <iant@google.com>
5525
5526         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
5527
5528 2010-08-12  Cary Coutant  <ccoutant@google.com>
5529             Doug Kwan  <dougkwan@google.com>
5530
5531         * resolve.cc (Symbol_table::should_override): When a weak dynamic
5532         defintion overrides non-weak undef, remember that the original undef
5533         is not weak.
5534         * symtab.cc (Symbol_table::sized_write_global): For undef without
5535         an original weak binding, set binding to global in output.
5536         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
5537         * testsuite/Makefile.in: Regenerate.
5538         * testsuite/strong_ref_weak_def.sh: New file.
5539         * testsuite/strong_ref_weak_def_1.c: Ditto.
5540         * testsuite/strong_ref_weak_def_2.c: Ditto.
5541
5542 2010-08-12  Cary Coutant  <ccoutant@google.com>
5543
5544         * testsuite/incremental_test.sh: Rewrite.
5545         * testsuite/incremental_test_1.c: Rewrite.
5546         * testsuite/incremental_test_2.c: Rewrite.
5547
5548 2010-08-12  Cary Coutant  <ccoutant@google.com>
5549
5550         * arm.cc (Target_arm::got_size): Add const.
5551         (Target_arm::got_entry_count): New function.
5552         (Target_arm::plt_entry_count): New function.
5553         (Target_arm::first_plt_entry_offset): New function.
5554         (Target_arm::plt_entry_size): New function.
5555         (Output_data_plt_arm::entry_count): New function.
5556         (Output_data_plt_arm::first_plt_entry_offset): New function.
5557         (Output_data_plt_arm::get_plt_entry_size): New function.
5558         * i386.cc (Target_i386::got_size): Add const.
5559         (Target_i386::got_entry_count): New function.
5560         (Target_i386::plt_entry_count): New function.
5561         (Target_i386::first_plt_entry_offset): New function.
5562         (Target_i386::plt_entry_size): New function.
5563         (Output_data_plt_i386::entry_count): New function.
5564         (Output_data_plt_i386::first_plt_entry_offset): New function.
5565         (Output_data_plt_i386::get_plt_entry_size): New function.
5566         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
5567         find_incremental_inputs_sections.  Dump incremental_got_plt section.
5568         * incremental.cc: Include target.h.
5569         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
5570         parameter.  Adjust all callers.  Find incremental_got_plt section.
5571         (Incremental_inputs::create_data_sections): Create incremental_got_plt
5572         section.
5573         (Output_section_incremental_inputs::set_final_data_size): Calculate
5574         size of incremental_got_plt section.
5575         (Output_section_incremental_inputs::do_write): Write the
5576         incremental_got_plt section.
5577         (Got_plt_view_info): New struct.
5578         (Local_got_offset_visitor): New class.
5579         (Global_got_offset_visitor): New class.
5580         (Global_symbol_visitor_got_plt): New class.
5581         (Output_section_incremental_inputs::write_got_plt): New function.
5582         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
5583         Add parameter.  Adjust all callers.
5584         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5585         (Incremental_inputs::got_plt_section): New function.
5586         (Incremental_inputs::got_plt_section_): New data member.
5587         (Incremental_got_plt_reader): New class.
5588         * layout.cc (Layout::create_incremental_info_sections): Add the
5589         incremental_got_plt section.
5590         * object.h (Got_offset_list::get_list): New function.
5591         (Got offset_list::for_all_got_offsets): New function.
5592         (Sized_relobj::local_got_offset_list): New function.
5593         * powerpc.cc (Target_powerpc::got_size): Add const.
5594         (Target_powerpc::got_entry_count): New function.
5595         (Target_powerpc::plt_entry_count): New function.
5596         (Target_powerpc::first_plt_entry_offset): New function.
5597         (Target_powerpc::plt_entry_size): New function.
5598         (Output_data_plt_powerpc::entry_count): New function.
5599         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
5600         (Output_data_plt_powerpc::get_plt_entry_size): New function.
5601         * sparc.cc (Target_sparc::got_size): Add const.
5602         (Target_sparc::got_entry_count): New function.
5603         (Target_sparc::plt_entry_count): New function.
5604         (Target_sparc::first_plt_entry_offset): New function.
5605         (Target_sparc::plt_entry_size): New function.
5606         (Output_data_plt_sparc::entry_count): New function.
5607         (Output_data_plt_sparc::first_plt_entry_offset): New function.
5608         (Output_data_plt_sparc::get_plt_entry_size): New function.
5609         * symtab.h (Symbol::got_offset_list): New function.
5610         (Symbol_table::for_all_symbols): New function.
5611         * target.h (Sized_target::got_entry_count): New function.
5612         (Sized_target::plt_entry_count): New function.
5613         (Sized_target::plt_entry_size): New function.
5614         * x86_64.cc (Target_x86_64::got_size): Add const.
5615         (Target_x86_64::got_entry_count): New function.
5616         (Target_x86_64::plt_entry_count): New function.
5617         (Target_x86_64::first_plt_entry_offset): New function.
5618         (Target_x86_64::plt_entry_size): New function.
5619         (Output_data_plt_x86_64::entry_count): New function.
5620         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
5621         (Output_data_plt_x86_64::get_plt_entry_size): New function.
5622
5623 2010-08-12  Cary Coutant  <ccoutant@google.com>
5624
5625         * archive.cc: Include incremental.h.
5626         (Archive::Archive): Initialize incremental_info_.
5627         (Archive::include_member): Record archive members in incremental info.
5628         (Add_archive_symbols::run): Record begin and end of an archive in
5629         incremental info.
5630         (Lib_group::include_member): Record objects in incremental info.
5631         * archive.h (Incremental_archive_entry): Forward declaration.
5632         (Archive::set_incremental_info): New member function.
5633         (Archive::incremental_info): New member function.
5634         (Archive::Unused_symbol_iterator): New class.
5635         (Archive::unused_symbols_begin): New member function.
5636         (Archive::unused_symbols_end): New member function.
5637         (Archive::incremental_info_): New data member.
5638         * incremental-dump.cc (find_input_containing_global): New function.
5639         (dump_incremental_inputs): Dump new incremental info sections.
5640         * incremental.cc: Include symtab.h.
5641         (Output_section_incremental_inputs): New class.
5642         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
5643         new incremental info sections.
5644         (Sized_incremental_binary::do_check_inputs): Likewise.
5645         (Incremental_inputs::report_archive): Remove.
5646         (Incremental_inputs::report_archive_begin): New function.
5647         (Incremental_inputs::report_archive_end): New function.
5648         (Incremental_inputs::report_object): New function.
5649         (Incremental_inputs::finalize_inputs): Remove.
5650         (Incremental_inputs::report_input_section): New function.
5651         (Incremental_inputs::report_script): Rewrite.
5652         (Incremental_inputs::finalize): Do nothing but finalize string table.
5653         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5654         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5655         (Incremental_inputs::create_data_sections): New function.
5656         (Incremental_inputs::relocs_entsize): New function.
5657         (Output_section_incremental_inputs::set_final_data_size): New function.
5658         (Output_section_incremental_inputs::do_write): New function.
5659         (Output_section_incremental_inputs::write_header): New function.
5660         (Output_section_incremental_inputs::write_input_files): New function.
5661         (Output_section_incremental_inputs::write_info_blocks): New function.
5662         (Output_section_incremental_inputs::write_symtab): New function.
5663         * incremental.h (Incremental_script_entry): Forward declaration.
5664         (Incremental_object_entry): Forward declaration.
5665         (Incremental_archive_entry): Forward declaration.
5666         (Incremental_inputs): Forward declaration.
5667         (Incremental_inputs_header_data): Remove.
5668         (Incremental_inputs_header): Remove.
5669         (Incremental_inputs_header_write): Remove.
5670         (Incremental_inputs_entry_data): Remove.
5671         (Incremental_inputs_entry): Remove.
5672         (Incremental_inputs_entry_write): Remove.
5673         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
5674         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
5675         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
5676         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
5677         Likewise.
5678         (Incremental_input_entry): New class.
5679         (Incremental_script_entry): New class.
5680         (Incremental_object_entry): New class.
5681         (Incremental_archive_entry): New class.
5682         (Incremental_inputs::Incremental_inputs): Initialize new data members.
5683         (Incremental_inputs::report_inputs): Remove.
5684         (Incremental_inputs::report_archive): Remove.
5685         (Incremental_inputs::report_archive_begin): New function.
5686         (Incremental_inputs::report_archive_end): New function.
5687         (Incremental_inputs::report_object): Change prototype.
5688         (Incremental_inputs::report_input_section): New function.
5689         (Incremental_inputs::report_script): Change prototype.
5690         (Incremental_inputs::get_reloc_count): New function.
5691         (Incremental_inputs::set_reloc_count): New function.
5692         (Incremental_inputs::create_data_sections): New function.
5693         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
5694         (Incremental_inputs::inputs_section): New function.
5695         (Incremental_inputs::symtab_section): New function.
5696         (Incremental_inputs::relocs_section): New function.
5697         (Incremental_inputs::get_stringpool): Add const.
5698         (Incremental_inputs::command_line): Add const.
5699         (Incremental_inputs::inputs): Remove.
5700         (Incremental_inputs::command_line_key): New function.
5701         (Incremental_inputs::input_file_count): New function.
5702         (Incremental_inputs::input_files): New function.
5703         (Incremental_inputs::relocs_entsize): New function.
5704         (Incremental_inputs::sized_create_inputs_section_data): Remove.
5705         (Incremental_inputs::finalize_inputs): Remove.
5706         (Incremental_inputs::Input_info): Remove.
5707         (Incremental_inputs::lock_): Remove.
5708         (Incremental_inputs::inputs_): Change type.
5709         (Incremental_inputs::inputs_map_): Remove.
5710         (Incremental_inputs::current_object_entry_): New data member.
5711         (Incremental_inputs::inputs_section_): New data member.
5712         (Incremental_inputs::symtab_section_): New data member.
5713         (Incremental_inputs::relocs_section_): New data member.
5714         (Incremental_inputs::reloc_count_): New data member.
5715         (Incremental_inputs_reader): New class.
5716         (Incremental_symtab_reader): New class.
5717         (Incremental_relocs_reader): New class.
5718         * layout.cc (Layout::finalize): Move finalization of incremental info
5719         and creation of incremental info sections to follow finalization of
5720         symbol table.  Set offsets for postprocessing sections.
5721         (Layout::create_incremental_info_sections): Call
5722         Incremental_inputs::create_data_sections.  Add incremental symtab
5723         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
5724         sections to layout after input sections.
5725         * layout.h (struct Timespec): Forward declaration.
5726         (Layout::incremental_inputs): Add const.
5727         (Layout::create_incremental_info_sections): Add parameter.
5728         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
5729         * object.cc: Include incremental.h.
5730         (Relobj::finalize_incremental_relocs): New function.
5731         (Sized_relobj::do_layout): Record input sections in incremental info.
5732         * object.h (Object::output_section): New function.
5733         (Object::output_section_offset): Moved from Relobj.
5734         (Object::get_incremental_reloc_base): New function.
5735         (Object::get_incremental_reloc_count): New function.
5736         (Object::do_output_section): New function.
5737         (Object::do_output_section_offset): Moved from Relobj.
5738         (Object::do_get_incremental_reloc_base): New function.
5739         (Object::do_get_incremental_reloc_count): New function.
5740         (Object::Object): Initialize new data members.
5741         (Relobj::output_section): Renamed do_output_section and moved to
5742         protected.
5743         (Relobj::output_section_offset): Moved to Object.
5744         (Relobj::do_get_incremental_reloc_base): New function.
5745         (Relobj::do_get_incremental_reloc_count): New function.
5746         (Relobj::allocate_incremental_reloc_counts): New function.
5747         (Relobj::count_incremental_reloc): New function.
5748         (Relobj::finalize_incremental_relocs): New function.
5749         (Relobj::next_incremental_reloc_index): New function.
5750         (Relobj::reloc_counts_): New data member.
5751         (Relobj::reloc_bases_): New data member.
5752         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
5753         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
5754         (Sized_relobj::incremental_relocs_scan): New function.
5755         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5756         (Sized_relobj::incremental_relocs_write): New function.
5757         (Sized_relobj::incremental_relocs_write_reltype): New function.
5758         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
5759         incremental link.
5760         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
5761         archives and object files elsewhere.
5762         (Add_symbols::run): Report object files here.
5763         (Finish_group::run): Report end of archive at end of group.
5764         * reloc.cc: Include layout.h, incremental.h.
5765         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
5766         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
5767         (Sized_relobj::incremental_relocs_scan): New function.
5768         (Sized_relobj::incremental_relocs_scan_reltype): New function.
5769         (Sized_relobj::do_relocate_sections): Write incremental relocations.
5770         (Sized_relobj::incremental_relocs_write): New function.
5771         (Sized_relobj::incremental_relocs_write_reltype): New function.
5772         * script.cc (read_input_script): Rewrite test for incremental link.
5773         Change call to Incremental_inputs::report_script.
5774         * symtab.h (Symbol_table::first_global_index): New function.
5775         (Symbol_table::output_count): New function.
5776
5777 2010-08-12  Doug Kwan  <dougkwan@google.com>
5778
5779         * arm.cc (Target_arm::merge_object_attributes): Check command line
5780         options --no-wchar-size-warning and --no-enum-size-warning.
5781         * options.h (General_options): Add ld-compatible options
5782         --no-enum-size-warning and --no-wchar-size-warning.
5783
5784 2010-08-04  Ian Lance Taylor  <iant@google.com>
5785
5786         * x86_64.cc (Target_x86_64::Scan::local): Use
5787         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
5788         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
5789         (Target_x86_64::Scan::global): Likewise.
5790         (Target_x86_64::Relocate::relocate): Likewise.
5791         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
5792         Likewise.
5793
5794 2010-08-03  Cary Coutant  <ccoutant@google.com>
5795
5796         * merge.cc (Output_merge_string::do_add_input_section): Count strings
5797         to reserve space in merged_strings vector. Keep total input size
5798         for stats.
5799         (Output_merge_string::do_print_merge_stats): Print total input size.
5800         * merge.h (Output_merge_string): Add input_size_ field.
5801         * stringpool.cc (Stringpool_template::string_length): Move
5802         implementations out of Stringpool_template class and place in
5803         stringpool.h.
5804         * stringpool.h (string_length): Move out of Stringpool_template.
5805
5806 2010-08-03  Ian Lance Taylor  <iant@google.com>
5807
5808         PR 11712
5809         * layout.cc (relaxation_loop_body): If address of load segment is
5810         set, adjust address to include headers if possible.
5811
5812 2010-08-03  Ian Lance Taylor  <iant@google.com>
5813
5814         * version.cc (version_string): Bump to 1.10.
5815
5816 2010-08-03  Ian Lance Taylor  <iant@google.com>
5817
5818         PR 11805
5819         * layout.h (enum Output_section_order): Define.
5820         (class Layout): Update declarations.
5821         * layout.cc (Layout::get_output_section): Add order parameter.
5822         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
5823         is_first_non_relro parameters.  Change all callers.
5824         (Layout::choose_output_section): Likewise.
5825         (Layout::add_output_section_data): Likewise.
5826         (Layout::make_output_section): Likewise.  Set order.
5827         (Layout::default_section_order): New function.
5828         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
5829         * output.cc (Output_section::Output_section): Initialize order_.
5830         Don't initialize deleted fields.
5831         (Output_segment::Output_segment): Don't initialize deleted
5832         fields.
5833         (Output_segment::add_output_section_to_load): New function
5834         replacing add_output_section.  Change all callers to call this or
5835         add_output_section_to_nonload.
5836         (Output_segment::add_output_section_to_nonload): New function.
5837         (Output_segment::remove_output_section): Rewrite.
5838         (Output_segment::add_initial_output_data): Likewise.
5839         (Output_segment::has_any_data_sections): Likewise.
5840         (Output_segment::is_first_section_relro): Likewise.
5841         (Output_segment::maximum_alignment): Likewise.
5842         (Output_segment::has_dynamic_reloc): New function replacing
5843         dynamic_reloc_count.  Change all callers.
5844         (Output_segment::has_dynamic_reloc_list): New function replacing
5845         dynamic_reloc_count_list.  Change all callers.
5846         (Output_segment::set_section_addresses): Rewrite.
5847         (Output_segment::set_offset): Rewrite.
5848         (Output_segment::find_first_and_last_list): Remove.
5849         (Output_segment::set_tls_offsets): Rewrite.
5850         (Output_segment::first_section_load_address): Likewise.
5851         (Output_segment::output_section_count): Likewise.
5852         (Output_segment::section_with_lowest_load_address): Likewise.
5853         (Output_segment::write_section_headers): Likewise.
5854         (Output_segment::print_sections_to_map): Likewise.
5855         * output.h (class Output_data): Remove dynamic_reloc_count_
5856         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
5857         (Output_data::add_dynamic_reloc): Rewrite.
5858         (Output_data::has_dynamic_reloc): New function.
5859         (Output_data::dynamic_reloc_count): Remove.
5860         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
5861         is_last_relro_, is_first_non_relro_, is_interp_,
5862         is_dynamic_linker_section_ fields.  Add order and set_order
5863         functions.  Remove is_relro_local, set_is_relro_local,
5864         is_last_relro, set_is_last_relro, is_first_non_relro,
5865         set_is_first_non_relro functions, is_interp, set_is_interp,
5866         is_dynamic_linker_section, and set_is_dynamic_linker_section
5867         functions.
5868         (class Output_segment): Change Output_data_list from std::list to
5869         std:;vector.  Add output_lists_ field.  Remove output_data_ and
5870         output_bss_ fields.  Update declarations.
5871
5872 2010-08-02  Ian Lance Taylor  <iant@google.com>
5873
5874         * arm.cc (Target_arm::gc_process_relocs): Use typename.
5875         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
5876         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
5877
5878 2010-08-02  Ian Lance Taylor  <iant@google.com>
5879
5880         PR 11855
5881         * script.cc (Script_options::Script_options): Initialize
5882         symbol_definitions_ and symbol_references_.
5883         (Script_options::add_symbol_assignment): Update
5884         symbol_definitions_ and symbol_references_.
5885         (Script_options::add_symbol_reference): New function.
5886         (script_symbol): New function.
5887         * script.h (class Script_options): Add symbol_definitions_ and
5888         symbol_references_ fields.
5889         (Script_options::referenced_const_iterator): New type.
5890         (Script_options::referenced_begin): New function.
5891         (Script_options::referenced_end): New function.
5892         (Script_options::is_referenced): New function.
5893         (Script_options::any_unreferenced): New function.
5894         * script-c.h (script_symbol): Declare.
5895         * yyscript.y (exp): Call script_symbol.
5896         * symtab.cc: Include "script.h".
5897         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
5898         Change all callers.  Check symbols referenced by scripts.
5899         (Symbol_table::add_undefined_symbols_from_command_line): Add
5900         layout parameter.  Change all callers.
5901         (Symbol_table::do_add_undefined_symbols_from_command_line):
5902         Likewise.  Break out loop body.  Check symbols referenced by
5903         scripts.
5904         (Symbol_table::add_undefined_symbol_from_command_line): New
5905         function broken out of
5906         do_add_undefined_symbols_from_command_line.
5907         * symtab.h (class Symbol_table): Update declarations.
5908         * archive.cc: Include "layout.h".
5909         (Archive::should_include_member): Add layout parameter.  Change
5910         all callers.  Check for symbol mentioned in expression.
5911         * archive.h (class Archive): Update declaration.
5912         * object.cc (Sized_relobj::do_should_include_member): Add layout
5913         parameter.
5914         * object.h (Object::should_include_member): Add layout parameter.
5915         Change all callers.
5916         (Object::do_should_include_member): Add layout parameter.
5917         (class Sized_relobj): Update declaration.
5918         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
5919         parameter.
5920         * dynobj.h (class Sized_dynobj): Update declaration.
5921         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
5922         layout parameter.
5923         * plugin.h (class Sized_pluginobj): Update declaration.
5924
5925 2010-08-02  Ian Lance Taylor  <iant@google.com>
5926
5927         PR 11866
5928         * output.cc (Output_segment::set_offset): Search for the first and
5929         last sections rather than assuming that the list is in order.
5930         (Output_segment::find_first_and_last_list): New function.
5931         * output.h (class Output_segment): Update declarations.
5932         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
5933         (relro_strip_test_SOURCES): New variable.
5934         (relro_strip_test_DEPENDENCIES): New variable.
5935         (relro_strip_test_LDFLAGS): New variable.
5936         (relro_strip_test_LDADD): New variable.
5937         (relro_strip_test.so): New target.
5938
5939 2010-08-02  Ian Lance Taylor  <iant@google.com>
5940
5941         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
5942         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
5943         (Target_i386::got_tlsdesc_section): New function.
5944         (Target_i386::got_section): Create space for GOT entries for
5945         TLSDESC relocations.
5946         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
5947         R_386_TLS_GOTDESC.
5948         (Target_i386::Scan::global): Likewise.
5949         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
5950         using TLSDESC GOT.
5951         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
5952         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
5953         (Target_x86_64::got_tlsdesc_section): New function.
5954         (Target_x86_64::got_section): Create space for GOT entries for
5955         TLSDESC relocations.
5956         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
5957         R_386_TLS_GOTDESC.
5958         (Target_x86_64::Scan::global): Likewise.
5959         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
5960         using TLSDESC GOT.
5961
5962 2010-08-02  Ian Lance Taylor  <iant@google.com>
5963
5964         * testsuite/final_layout.sh: Use dc to convert from hex to
5965         decimal.
5966
5967 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
5968
5969         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
5970         paramter to the call to gold::gc_process_relocs.
5971         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
5972         paramter to the call to gold::gc_process_relocs.
5973         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
5974         parameter to the call to gold::gc_process_relocs.
5975         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
5976         template parameter to the call to gold::gc_process_relocs.
5977         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
5978         paramter to the call to gold::gc_process_relocs.
5979         * gc.h (get_embedded_addend_size): New function.
5980         (gc_process_relocs): Save the size of the reloc for use by ICF.
5981         * icf.cc (get_section_contents): Get the addend from the text section
5982         for SHT_REL relocation sections.
5983         * icf.h (Icf::Reloc_addend_size_info): New typedef.
5984         (Icf::Reloc_info): Add new member reloc_addend_size_info.
5985         * int_encoding.h (read_from_pointer): New overloaded function.
5986         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
5987         * testsuite/icf_sht_rel_addend_test.sh: New file.
5988         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
5989         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
5990
5991 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5992
5993         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
5994         * Makefile.in: Regenerate.
5995         * testsuite/Makefile.in: Regenerate.
5996
5997 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
5998
5999         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6000         * gold/testsuite/debug_msg.cc: Likewise.
6001         * gold/testsuite/odr_violation1.cc
6002         * gold/testsuite/odr_violation2.cc
6003
6004 2010-07-21  Cary Coutant  <ccoutant@google.com>
6005
6006         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6007         string, and length fields.
6008         (Output_merge_string::Merged_strings_list): New type.
6009         (Output_merge_string::Merged_strings_lists): New typedef.
6010         (Output_merge_string): Replace merged_strings_ with
6011         merged_strings_lists_.
6012         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6013         Merged_strings_list per input object and section.  Don't store pointer
6014         to the string.  Don't store length with each merged string entry.
6015         (Output_merge_string::finalize_merged_data): Loop over list of merged
6016         strings lists.  Recompute length of each merged string.
6017
6018 2010-07-15  Cary Coutant  <ccoutant@google.com>
6019
6020         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6021         here.
6022
6023 2010-07-14  Ian Lance Taylor  <iant@google.com>
6024
6025         * descriptors.cc (Descriptors::open): Report correct name in error
6026         message.
6027
6028 2010-07-13  Doug Kwan  <dougkwan@google.com>
6029
6030         * arm.cc (Arm_input_section::Arm_input_section): For a
6031         SHT_ARM_EXIDX section, always keeps the input sections.
6032         (Arm_input_section::set_exidx_section_link): New method.
6033         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6034         has_errors_ to false.
6035         (Arm_exidx_input_section::has_errors,
6036         Arm_exidx_input_section::set_has_errors): New methods.
6037         (Arm_exidx_input_section::has_errors_): New data member.
6038         (Arm_relobj::get_exidx_shndx_list): New method.
6039         (Arm_output_section::append_text_sections_to_list): Do not skip
6040         section without SHF_EXECINSTR.
6041         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6042         errors.
6043         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6044         section header.  Make error messages more verbose.  Check for
6045         a non-executable section linked to an EXIDX section.
6046         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6047         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6048         check that there is no deferred EXIDX section if we exit early.
6049         Instead of not making an EXIDX section in case of an error, make one
6050         and set the has_errors flag of it.
6051         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6052         in a relocatable link.
6053         (Target_arm::do_relax): Look for the EXIDX output section instead of
6054         assuming that it is called .ARM.exidx.
6055         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6056         section list.  Do not check for SHF_EXECINSTR section flags but
6057         skip any input section with errors.
6058         * output.cc (Output_section::Output_section): Initialize
6059         always_keeps_input_sections_ to false.
6060         (Output_section::add_input_section): Check for
6061         always_keeps_input_sections_.
6062         *  output.h (Output_section::always_keeps_input_sections,
6063         Output_section::set_always_keeps_input_sections): New methods.
6064         (Output_section::always_keeps_input_sections): New data member.
6065
6066 2010-07-13  Rafael Espindola  <espindola@google.com>
6067
6068         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6069         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6070
6071 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6072             Ian Lance Taylor  <iant@google.com>
6073
6074         * output.h (Output_section_lookup_maps::add_merge_section):
6075         Correct check of whether value was inserted.
6076         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6077         (Output_section_lookup_maps::add_relaxed_input_section):
6078         Likewise.
6079         * arm.cc (Target_arm::got_section): Remove used local os.
6080         * i386.cc (Target_i386::got_section): Likewise.
6081         * x86_64.cc (Target_x86_64::got_section): Likewise.
6082         * sparc.cc (Target_sparc::got_section): Likewise.
6083         (Target_sparc::relocate): Remove unused local have_got_offset.
6084         * powerpc.cc (Target_powerpc::relocate): Likewise.
6085
6086 2010-07-13  Ian Lance Taylor  <iant@google.com>
6087
6088         * compressed_output.cc (zlib_decompress): Fix signature in
6089         !HAVE_ZLIB_H case.
6090
6091         * archive.cc (Archive::include_member): Unlock an external member
6092         of a thin archive.  Don't bother to delete an object we know is
6093         NULL.
6094
6095 2010-07-12  Cary Coutant  <ccoutant@google.com>
6096
6097         * compressed_output.cc (zlib_decompress): New function.
6098         (get_uncompressed_size): New function.
6099         (decompress_input_section): New function.
6100         * compressed_output.h (get_uncompressed_size): New function.
6101         (decompress_input_section): New function.
6102         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6103         Handle compressed debug sections.
6104         * layout.cc (is_compressed_debug_section): New function.
6105         (Layout::output_section_name): Map compressed section names to
6106         canonical names.
6107         * layout.h (is_compressed_debug_section): New function.
6108         (is_debug_info_section): Recognize compressed debug sections.
6109         * merge.cc: Include compressed_output.h.
6110         (Output_merge_data::do_add_input_section): Handle compressed
6111         debug sections.
6112         (Output_merge_string::do_add_input_section): Handle compressed
6113         debug sections.
6114         * object.cc: Include compressed_output.h.
6115         (Sized_relobj::Sized_relobj): Initialize new data members.
6116         (build_compressed_section_map): New function.
6117         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6118         * object.h (Object::section_is_compressed): New method.
6119         (Object::do_section_is_compressed): New method.
6120         (Sized_relobj::Compressed_section_map): New type.
6121         (Sized_relobj::do_section_is_compressed): New method.
6122         (Sized_relobj::compressed_sections_): New data member.
6123         * output.cc (Output_section::add_input_section): Handle compressed
6124         debug sections.
6125         * reloc.cc: Include compressed_output.h.
6126         (Sized_relobj::write_sections): Handle compressed debug sections.
6127
6128 2010-07-08  Cary Coutant  <ccoutant@google.com>
6129
6130         * resolve.cc (Symbol_table::resolve): Remember whether undef was
6131         weak when resolving to a dynamic def.
6132         (Symbol_table::should_override): Add adjust_dyndef flag; set it
6133         for weak undef/dynamic def cases. Adjust callers.
6134         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
6135         undef_binding_weak_.
6136         (Symbol_table::sized_write_globals): Adjust symbol binding.
6137         (Symbol_table::sized_write_symbol): Add binding parameter.
6138         * symtab.h (Symbol::set_undef_binding): New method.
6139         (Symbol::is_undef_binding_weak): New method.
6140         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
6141         (Symbol_table::should_override): Add new parameter.
6142         (Symbol_table::sized_write_symbol): Add new parameter.
6143
6144         * testsuite/weak_undef_file1.cc: Add new test case.
6145         * testsuite/weak_undef_file2.cc: Fix header comment.
6146         * testsuite/weak_undef_test.cc: Add new test case.
6147
6148 2010-06-29  Doug Kwan  <dougkwan@google.com>
6149
6150         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
6151         Initialize USE_SYMBOL_.
6152         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
6153         definition.
6154         (Arm_reloc_property::uses_symbol_): New data member declaration.
6155         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
6156         uses symbol value and symbol is undefined but not weakly undefined.
6157
6158 2010-06-28  Rafael Espindola  <espindola@google.com>
6159
6160         * plugin.cc (Plugin::load): Use dlerror.
6161
6162 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
6163
6164         * symtab.cc (detect_odr_violations): When reporting an ODR
6165         violation, report an object where the symbol is defined.
6166
6167 2010-06-25  Doug Kwan  <dougkwan@google.com>
6168
6169         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
6170         (Target_arm::section_may_have_icf_unsafe_pointers): New method
6171         definition.
6172         (Target_arm::Scan::local_reloc_may_be_function_pointer,
6173         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
6174         target hook to detect function points.
6175         (Target_arm::Scan::possible_function_pointer_reloc): New method.
6176         * icf.h (Icf::check_section_for_function_pointers): Change type of
6177         parameter SECTION_NAME to const reference to std::string.  Use
6178         target hook to determine if section may have unsafe pointers.
6179         * target.h (Target::section_may_have_icf_unsafe_pointers): New
6180         method definition.
6181
6182 2010-06-21  Rafael Espindola  <espindola@google.com>
6183
6184         * fileread.cc (Input_file::find_fie): New
6185         (Input_file::open): Use Input_file::find_fie.
6186         * fileread.h (Input_file::find_fie): New
6187         * plugin.cc (set_extra_library_path): New.
6188         (Plugin::load): Add set_extra_library_path to the transfer vector.
6189         (Plugin_manager::set_extra_library_path): New.
6190         (Plugin_manager::add_input_file): Use the extra search path if set.
6191         (set_extra_library_path(): New.
6192         * plugin.h (Plugin_manager): Add set_extra_library_path and
6193         extra_search_path_.
6194
6195 2010-06-19  Cary Coutant  <ccoutant@google.com>
6196
6197         * layout.cc (gdb_sections): Add .debug_types.
6198         (lines_only_debug_sections): Likewise.
6199
6200 2010-06-18  Rafael Espindola  <espindola@google.com>
6201
6202         * plugin.cc (add_input_file,add_input_library)
6203         (Plugin_manager::add_input_file): Make filename arguments const.
6204         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
6205         const.
6206
6207 2010-06-16  Doug Kwan  <dougkwan@google.com>
6208
6209         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
6210         .ARM.attributes section if we have not merged any input
6211         attributes sections.
6212
6213 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6214
6215         * arm.cc: Allow combining objects with no EABI version
6216         information.
6217
6218 2010-06-15  Rafael Espindola  <espindola@google.com>
6219
6220         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
6221
6222 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6223
6224         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
6225         (struct iovec): Correct !HAVE_READV definition.
6226
6227 2010-06-10  Cary Coutant  <ccoutant@google.com>
6228
6229         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
6230         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
6231         reloc sections.
6232         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
6233
6234         PR 11683
6235         * symtab.h (Symbol::is_placeholder): New member function.
6236         * target-reloc.h (relocate_section): Check for placeholder symbols.
6237
6238         * testsuite/Makefile.am (plugin_test_8): New test.
6239         (plugin_test_9): New test.
6240         * testsuite/Makefile.in: Regenerate.
6241
6242 2010-06-09  Nick Clifton  <nickc@redhat.com>
6243
6244         * yyscript.y (input_list_element): Allow strings prefixed with
6245         the '-' character.  Treat these as libraries.
6246         * script.cc (script_add_library): New function.  Adds a library
6247         specified by "-l<name>" found in an input script.
6248         * script-c.h: Add prototype for script_add_library.
6249
6250 2010-06-07  Doug Kwan  <dougkwan@google.com>
6251
6252         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
6253         Restrict stub-group size to be within long conditional branch
6254         range when working around cortex-A8 erratum.
6255
6256 2010-06-07  Damien Diederen  <dd@crosstwine.com>
6257
6258         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
6259         #ifdef typo.
6260
6261 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
6262
6263         PR gold/11658
6264         * output.cc
6265         (Output_section::Input_section_sort_entry::compare_section_ordering):
6266         Change to return non-zero correctly.
6267         (Output_section::Input_section_sort_section_order_index_compare
6268         ::operator()): Change to fix ambiguity in comparisons.
6269
6270 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
6271
6272         * gold.h (is_wildcard_string): New function.
6273         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
6274         (Layout::layout_eh_frame): Ditto.
6275         (Layout::find_section_order_index): New method.
6276         (Layout::read_layout_from_file): New method.
6277         * layout.h (Layout::find_section_order_index): New method.
6278         (Layout::read_layout_from_file): New method.
6279         (Layout::input_section_position_): New private member.
6280         (Layout::input_section_glob_): New private member.
6281         * main.cc (main): Call read_layout_from_file here.
6282         * options.h (--section-ordering-file): New option.
6283         * output.cc (Output_section::input_section_order_specified_): New
6284         member.
6285         (Output_section::Output_section): Initialize new member.
6286         (Output_section::add_input_section): Add new parameter.
6287         Keep input sections when --section-ordering-file is used.
6288         (Output_section::set_final_data_size): Sort input sections when
6289         section ordering file is specified.
6290         (Output_section::Input_section_sort_entry): Add new parameter.
6291         Check sorting type.
6292         (Output_section::Input_section_sort_entry::compare_section_ordering):
6293         New method.
6294         (Output_section::Input_section_sort_compare::operator()): Change to
6295         consider section_order_index.
6296         (Output_section::Input_section_sort_init_fini_compare::operator()):
6297         Change to consider section_order_index.
6298         (Output_section::Input_section_sort_section_order_index_compare
6299         ::operator()): New method.
6300         (Output_section::sort_attached_input_sections): Change to sort
6301         according to section order when specified.
6302         (Output_section::add_input_section<32, true>): Add new parameter.
6303         (Output_section::add_input_section<64, true>): Add new parameter.
6304         (Output_section::add_input_section<32, false>): Add new parameter.
6305         (Output_section::add_input_section<64, false>): Add new parameter.
6306         * output.h (Output_section::add_input_section): Add new parameter.
6307         (Output_section::input_section_order_specified): New
6308         method.
6309         (Output_section::set_input_section_order_specified): New method.
6310         (Input_section::Input_section): Initialize section_order_index_.
6311         (Input_section::section_order_index): New method.
6312         (Input_section::set_section_order_index): New method.
6313         (Input_section::section_order_index_): New member.
6314         (Input_section::Input_section_sort_section_order_index_compare): New
6315         struct.
6316         (Output_section::input_section_order_specified_): New member.
6317         * script-sections.cc (is_wildcard_string): Delete and move modified
6318         method to gold.h.
6319         (Output_section_element_input::Output_section_element_input): Modify
6320         call to is_wildcard_string.
6321         (Output_section_element_input::Input_section_pattern
6322         ::Input_section_pattern): Ditto.
6323         (Output_section_element_input::Output_section_element_input): Ditto.
6324         * testsuite/Makefile.am (final_layout): New test case.
6325         * testsuite/Makefile.in: Regenerate.
6326         * testsuite/final_layout.cc: New file.
6327         * testsuite/final_layout.sh: New file.
6328
6329 2010-06-01  Rafael Espindola  <espindola@google.com>
6330
6331         * plugin.cc (Plugin::load): Pass the output name to the plugin.
6332
6333 2010-06-01  Rafael Espindola  <espindola@google.com>
6334
6335         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
6336         visibility of symbols.
6337
6338 2010-05-27  Doug Kwan  <dougkwan@google.com>
6339
6340         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
6341         from start of output section instead of address for a local symbol
6342         in a merged or relaxed section when doing a relocatable link.
6343
6344 2010-05-26  Rafael Espindola  <espindola@google.com>
6345
6346         PR 11604
6347         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
6348         adding sections the garbage collector removed.
6349         * gold/testsuite/Makefile.am: Add test.
6350         * gold/testsuite/Makefile.in: Regenerate.
6351         * gold/testsuite/plugin_test_7.sh: New.
6352         * gold/testsuite/plugin_test_7_1.c: New.
6353         * gold/testsuite/plugin_test_7_2.c: New.
6354
6355 2010-05-26  Rafael Espindola  <espindola@google.com>
6356
6357         * script-sections.cc (Output_section_definition::set_section_addresses):
6358         Check for --section-start.
6359
6360 2010-05-26  Doug Kwan  <dougkwan@google.com>
6361
6362         * arm.cc (Arm_scan_relocatable_relocs): New class.
6363         (Target_arm::relocate_special_relocatable): New method.
6364         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
6365         (Arm_relocate_functions::thumb_branch_common): Same.
6366         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
6367         instead of Default_scan_relocatable_relocs.
6368         * target-reloc.h (relocate_for_relocatable): Let target handle
6369         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
6370         * target.h (Sized_target::relocate_special_relocatable): New method.
6371
6372 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6373
6374         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
6375
6376 2010-05-23  Doug Kwan  <dougkwan@google.com>
6377
6378         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
6379         instead of a cast.
6380         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
6381         with a direct branch, not a conditional branch, to a stub.
6382         * merge.cc (Output_merge_base::record_input_section): New method
6383         defintion.
6384         (Output_merge_data::do_add_input_section): Record input section if
6385         keeps-input-sections flag is set.
6386         (Output_merge_string::do_add_input_section): Ditto.
6387         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
6388         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
6389         INPUT_SECTIONS_.
6390         (Output_merge_base::keeps_input_sections,
6391         Output_merge_base::set_keeps_input_sections,
6392         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
6393         method definitions.
6394         (Output_merge_base::Input_sections): New type declaration.
6395         (Output_merge_base::input_sections_begin,
6396         Output_merge_base::input_sections_end,
6397         Output_merge_base::do_set_keeps_input_sections): New method definitions.
6398         (Output_merge_base::bool keeps_input_sections_,
6399         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
6400         Output_merge_base::input_sections_): New data members.
6401         (Output_merge_data::do_set_keeps_input_sections): New method
6402         defintion.
6403         (Output_merge_string::do_set_keeps_input_sections): Ditto.
6404         * output.cc (Output_section::Input_section::relobj): Move method
6405         defintion from class declaration to here and handle merge sections.
6406         (Output_section::Input_section::shndx): Ditto.
6407         (Output_section::Output_section): Remove initializations of removed
6408         data members and initialize new data member LOOKUP_MAPS_.
6409         (Output_section::add_input_section): Set keeps-input-sections flag
6410         for a newly created merge output section as appropriate.  Adjust code
6411         to use Output_section_lookup_maps class.
6412         (Output_section::add_relaxed_input_section): Adjst code for lookup
6413         maps code refactoring.
6414         (Output_section::add_merge_input_section): Add a new parameter
6415         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
6416         class.  If adding input section to a newly created merge output
6417         section fails, remove the new merge section.
6418         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
6419         Adjust code for use of the Output_section_lookup_maps class.
6420         (Output_section::find_merge_section): Ditto.
6421         (Output_section::build_lookup_maps): New method defintion.
6422         (Output_section::find_relaxed_input_section): Adjust code to use
6423         Output_section_lookup_maps class.
6424         (Output_section::get_input_sections): Export merge sections.  Adjust
6425         code to use Output_section_lookup_maps class.
6426         (Output_section:::add_script_input_section): Adjust code to use
6427         Output_section_lookup_maps class.  Update lookup maps for merge
6428         sections also.
6429         (Output_section::discard_states): Use Output_section_lookup_maps.
6430         (Output_section::restore_states): Same.
6431         * output.h (Merge_section_properties): Move class defintion out of
6432         Output_section.
6433         (Output_section_lookup_maps): New class.
6434         (Output_section::Input_section::is_merge_section): New method
6435         defintion.
6436         (Output_section::Input_section::relobj): Move defintion out of class
6437         defintion.  Declare method only.
6438         (Output_section::Input_section::shndx): Ditto.
6439         (Output_section::Input_section::output_merge_base): New method defintion.
6440         (Output_section::Input_section::u2_.pomb): New union field.
6441         (Output_section::Merge_section_by_properties_map,
6442         Output_section::Output_section_data_by_input_section_map,
6443         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
6444         Remove types.
6445         (Output_section::add_merge_input_section): Add new parameter
6446         KEEPS_INPUT_SECTIONS.
6447         (Output_section::build_lookup_maps): New method declaration.
6448         (Output_section::merge_section_map_,
6449         Output_section::merge_section_by_properties_map_,
6450         Output_section::relaxed_input_section_map_,
6451         Output_section::is_relaxed_input_section_map_valid_): Remove data
6452         members.
6453         (Output_section::lookup_maps_): New data member.
6454
6455 2010-05-21  Doug Kwan  <dougkwan@google.com>
6456
6457         PR gold/11619
6458         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
6459         avoid a compilation error.
6460
6461 2010-05-19  Rafael Espindola  <espindola@google.com>
6462
6463         * script-sections.cc (Output_section_definition::allocate_to_segment):
6464         Update the phdrs_list even when the output section is NULL.
6465         * testsuite/Makefile.am: Add test.
6466         * testsuite/Makefile.in: Regenerate.
6467         * testsuite/script_test_9.cc: New.
6468         * testsuite/script_test_9.sh: New.
6469         * testsuite/script_test_9.t: New.
6470
6471 2010-05-19  Doug Kwan  <dougkwan@google.com>
6472
6473         * arm.cc (Arm_input_section::original_size): New method.
6474         (Arm_input_section::do_addralign): Add a cast.
6475         (Arm_input_section::do_output_offset): Remove static cast.
6476         (Arm_input_section::original_addralign,
6477          Arm_input_section::original_size_): Change type to uint32_t.
6478         (Arm_input_section::init): Add safe casts for section alignment
6479         and size.
6480         (Arm_input_section::set_final_data_size): Do not set address and
6481         offset of stub table.
6482         (Arm_output_section::fix_exidx_coverage): Change use of of
6483         Output_section::Simple_input_section to that of
6484         Output_section::Input_section.
6485         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
6486         except for the first pass.
6487         * output.cc (Output_section::get_input_sections): Change type of
6488         input_sections to std::list<Input_section>.
6489         (Output_section::add_script_input_section): Rename from
6490         Output_section::add_simple_input_section.  Change type of SIS
6491         parameter from Simple_input_section to Input_section.
6492         * output.h (Output_section::Simple_input_section): Remove class.
6493         (Output_section::Input_section): Change class visibility to public.
6494         (Output_section::Input_section::addralign): Use stored alignments
6495         for special input sections if set.
6496         (Output_section::Input_section::set_addralign): New method.
6497         (Output_section::get_input_sections): Change parameter type from
6498         list of Simple_input_section to list of Input_section.
6499         (Output_section::add_script_input_section): Rename from
6500         Output_section::add_simple_input_section. Change first parameter's
6501         type from Simple_input_section to Input_section and remove the
6502         second and third parameters.
6503         * script-sections.cc (Input_section::Input_section_list): Change
6504         type to list of Output_section::Input_section/
6505         (Input_section_info::Input_section_info): Change parameter type of
6506         INPUT_SECTION to Output_section::Input_section.
6507         (Input_section_info::input_section): Change return type.
6508         (Input_section_info::input_section_): Change type to
6509         Output_section::Input_section.
6510         (Output_section_element_input::set_section_addresses): Adjust code
6511         to use Output_section::Input_section instead of
6512         Output_section::Simple_input_section.  Adjust code for renaming
6513         of Output_section::add_simple_input_section.
6514         (Orphan_output_section::set_section_addresses): Ditto.
6515
6516 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6517
6518         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
6519         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
6520
6521 2010-05-18  Rafael Espindola  <espindola@google.com>
6522
6523         * options.cc (General_options::finalize): Handle -nostdlib.
6524         * options.h (nostdlib): New option.
6525         * script.cc (script_add_search_dir): Handle -nostdlib.
6526
6527 2010-05-12  Doug Kwan  <dougkwan@google.com>
6528
6529         * arm.cc (Target_arm::do_finalize_sections): Create an empty
6530         attributes section only if there no attributes section after merging.
6531         (Target_arm::merge_object_attributes): Move value of
6532         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
6533         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
6534         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
6535         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
6536         and arm_attr_merge_7.stdout.
6537         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
6538         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
6539         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
6540         arm_attr_merge_7b.o): New rules.
6541         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
6542         arm_attr_merge_7
6543         * testsuite/Makefile.in: Regenerate.
6544         * testsuite/arm_attr_merge.sh: New file.
6545         * testsuite/arm_attr_merge_[67][ab].s: Same.
6546
6547 2010-05-05  Nick Clifton  <nickc@redhat.com>
6548
6549         * po/es.po: Updated Spanish translation.
6550
6551 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6552
6553         * Makefile.am (install-exec-local): Properly install gold as
6554         default cross linker.
6555         * Makefile.in: Regenerated.
6556
6557 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
6558             Nick Clifton  <nickc@redhat.com>
6559
6560         * configure.ac (install_as_default): Define and set to false
6561         unless --enable-gold or --enable-gold=both/gold has been
6562         specified.
6563         * configure: Regenerate.
6564
6565         * Makefile.am (install-exec-local): Install the executable as
6566         'ld.gold'.  If install_as_default is true then also install it as
6567         'ld'.
6568         * Makefile.in: Regenerated.
6569
6570 2010-04-24  Ian Lance Taylor  <iant@google.com>
6571
6572         * layout.cc (Layout::layout_reloc): In relocatable link don't
6573         combine reloc sections for grouped sections.
6574
6575 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
6576
6577         * gc.h (gc_process_relocs): Pass information on relocs pointing to
6578         sections that are not ordinary to icf.
6579         * icf.cc (get_section_contents): Handle relocation pointing to section
6580         with no object or shndx information.
6581         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
6582         * testsuite/Makefile.in: Regenerate.
6583         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
6584         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
6585
6586 2010-04-22  Ian Lance Taylor  <iant@google.com>
6587
6588         * expression.cc (Expression::Expression_eval_info): Add
6589         result_alignment_pointer field.
6590         (Expression::eval_with_dot): Add result_alignment_pointer
6591         parameter.  Change all callers.
6592         (Expression::eval_maybe_dot): Likewise.
6593         (class Binary_expression): Add alignment_pointer parameter to
6594         left_value and right_value.  Change all callers.
6595         (BINARY_EXPRESSION): Set result alignment.
6596         (class Trinary_expression): Add alignment_pointer parameter to
6597         arg2_value and arg3_value.  Change all callers.
6598         (Trinary_cond::value): Set result alignment.
6599         (Max_expression::value, Min_expression::value): Likewise.
6600         (Align_expression::value): Likewise.
6601         * script-sections.cc (class Sections_element): Add dot_alignment
6602         parameter to set_section_addresses virtual function.  Update
6603         instantiations.
6604         (class Output_section_element): Likewise.
6605         (Script_sections::create_segments): Add dot_alignment parameter.
6606         Change all callers.
6607         (Script_sections::create_segments_from_phdrs_clause): Likewise.
6608         (Script_sections::set_phdrs_clause_addresses): Likewise.
6609         * script-sections.h: Update declarations.
6610         * script.h: Update declarations.
6611         * output.h (Output_segment::set_minimum_p_align): Don't decrease
6612         min_p_align.
6613         * testsuite/script_test_3.t: Set large alignment.
6614         * testsuite/script_test_3.sh: Make sure that at least one LOAD
6615         segment has expected alignment.
6616
6617 2010-04-22  Nick Clifton  <nickc@redhat.com>
6618
6619         * po/gold.pot: Updated by the Translation project.
6620         * po/vi.po: Updated Vietnamese translation.
6621
6622 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
6623
6624         * testsuite/Makefile.am (check_PROGRAMS): Add
6625         icf_virtual_function_folding_test.
6626         * testsuite/Makefile.in: Regenerated.
6627
6628 2010-04-15  Andrew Haley  <aph@redhat.com>
6629
6630         * options.h (merge_exidx_entries): New option.
6631         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
6632         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
6633         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
6634         (Target_arm::merge_exidx_entries): New function.
6635         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
6636         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
6637         to Arm_exidx_fixup constructor.
6638         Add new arg, merge_exidx_entries.
6639         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
6640         Arm_output_section::fix_exidx_coverage.
6641
6642 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
6643
6644         * icf.cc (get_section_contents): Check for preemptible functions.
6645         Ignore addend when appropriate.
6646         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
6647         section folded.
6648         (add_from_relobj): Check for section folded.
6649         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
6650         * symtab.h (should_add_dynsym_entry): Add new parameter.
6651         * target-reloc.h (scan_relocs): Check for section folded.
6652         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
6653         Check reloc types for function pointers in shared objects.
6654         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
6655         case.
6656         (icf_preemptible_functions_test): New test case.
6657         (icf_string_merge_test): New test case.
6658         * testsuite.Makefile.in: Regenerate.
6659         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
6660         bar_glob.  Refactor code.
6661         * testsuite/icf_preemptible_functions_test.cc: New file.
6662         * testsuite/icf_preemptible_functions_test.sh: New file.
6663         * testsuite/icf_string_merge_test.cc: New file.
6664         * testsuite/icf_string_merge_test.sh: New file.
6665         * testsuite/icf_virtual_function_folding_test.cc: New file.
6666         * testsuite/icf_virtual_function_folding_test.sh: New file.
6667
6668 2010-04-14  Doug Kwan  <dougkwan@google.com>
6669
6670         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
6671         for local symbol recounting if we remove a section due to ICF.
6672         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
6673         there are no regular objects in input.
6674
6675 2010-04-13  Doug Kwan  <dougkwan@google.com>
6676
6677         * arm.cc (Arm_input_section::set_final_data_size): Compute
6678         accurate final data size instead of using current data size.
6679
6680 2010-04-09  Doug Kwan  <dougkwan@google.com>
6681
6682         * layout.cc (Layout::choose_output_section): Handle script section
6683         types.
6684         (Layout::make_output_section_for_script): Add section type parameter.
6685         Handle script section types.
6686         * layout.h (Layout::make_output_section_for_script): Add section
6687         type parameter.
6688         * output.cc (Output_section::Output_section): Initialize data member
6689         is_noload_.
6690         (Output_section::do_reset_address_and_file_offset): Do not set address
6691         to 0 if section is a NOLOAD section.
6692         * output.h (Output_section::is_noload): New method.
6693         (Output_section::set_is_noload): Ditto.
6694         (Output_section::is_noload_): New data member.
6695         * script-c.h (Script_section_type): New enum type.
6696         (struct Parser_output_section_header): Add new file section_type.
6697         * script-sections.cc (Sections_element::output_section_name): Add
6698         parameter for returning script section type.
6699         (Output_section_definition::output_section_name): Ditto.
6700         (Output_section_definition::section_type)P; New method.
6701         (Output_section_definiton::script_section_type_name): Ditto.
6702         (Output_section_definition::script_section_type_): New data member.
6703         (Output_section_definition::Output_section_definition): Initialize
6704         data member Output_section_definition::script_section_type_.
6705         (Output_section_definition::create_sections): Pass script section type
6706         to Layout::make_output_section_for_script.
6707         (Output_section_definition::output_section_name): Return script
6708         section type to caller.
6709         (Output_section_definition::set_section_address): Do not advance
6710         dot value and load address if section type is NOLOAD.  Set address
6711         of NOLOAD sections regardless of section flags.
6712         (Output_section_definition::print): Print section type if it is
6713         not SCRIPT_SECTION_TYPE_NONE.
6714         (Output_section_definition::section_type): New method.
6715         (Output_section_definition::script_section_type_name): Ditto.
6716         (Script_sections::output_section_name): Add new parameter
6717         PSECTION_TYPE for returning script section type.  Pass it to
6718         section elements.  Handle discard sections.
6719         (Sort_output_sections::operator()): Handle NOLOAD sections.
6720         * script-sections.h (Script_sections::Section_type): New enum type.
6721         (Script_sections::output_section_name): Add a new parameter for
6722         returning script section type.
6723         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
6724         INFO and NOLOAD.
6725         * yyscript.y (union): Add new field SECTION_TYPE.
6726         (COPY, DSECT, INFO, NOLOAD): New tokens.
6727         (opt_address_and_section_type): Change type to output_section_header.
6728         (section_type): New non-terminal
6729         (section_header): Handle section type.
6730         (opt_address_and_section_type): Return section type value.
6731
6732 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
6733
6734         * testsuite/plugin_common_test_1.c (foo): Add prototype.
6735         * testsuite/plugin_common_test_2.c (foo): Likewise.
6736
6737 2010-04-08  Doug Kwan  <dougkwan@google.com>
6738
6739         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
6740         Output_merge_data.
6741         * output.cc (Output_section::add_merge_input_section): Simplify
6742         code and return status of Output_merge_base::add_input_section.
6743         Update merge section map only if Output_merge_base::add_input_section
6744         returns true.
6745
6746 2010-04-07  Doug Kwan  <dougkwan@google.com>
6747
6748         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
6749         if section is marked as containing instructions but has no mapping
6750         symbols.
6751         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
6752         correct section index.
6753         (Arm_relobj::find_linked_text_section): Ditto.
6754
6755 2010-04-07  Cary Coutant  <ccoutant@google.com>
6756
6757         * archive.cc (include_member): Destroy Read_symbols_data object before
6758         releasing file.
6759         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
6760         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
6761         (Read_symbols_data::~Read_symbols_data) New destructor.
6762         (Section_relocs::Section_relocs) New constructor.
6763         (Section_relocs::~Section_relocs) New destructor.
6764         (Read_relocs_data::Read_relocs_data) New constructor.
6765         (Read_relocs_data::~Read_relocs_data) New destructor.
6766         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
6767         pointers to NULL after deleting.
6768
6769 2010-04-07  Doug Kwan  <dougkwan@google.com>
6770
6771         * arm.cc: Replace "endianity" with "endianness" in comments.
6772         (Arm_exidx_cantunwind): Ditto.
6773         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
6774         (Arm_relobj::merge_flags_and_attributes): New method.
6775         (Arm_relobj::merge_flags_and_attributes_): New data member.
6776         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
6777         (Arm_relobj::scan_sections_for_stubs): Ditto.
6778         (Arm_relobj::do_read_symbols): Check to see if we really want to
6779         merge processor-specific flags and attributes.  Exit early if
6780         an object is empty except for section names and the undefined symbol.
6781         (Target_arm::do_finalize_sections): Move check for ELF format to
6782         Arm_relobj::do_read_symbols.  Merge processor specific flags and
6783         attributes from a regular object only when we have determined that
6784         it is aapropriate.  Do not create an .ARM.attributes section in
6785         output if there is no regular input object.
6786         (Target_arm::merge_processor_specific_flags): Check
6787         --warn-mismatch before printing any error.
6788         (Target_arm::merge_object_attributes): Ditto.
6789         * gold.cc (queue_middle_tasks): Handle the case in which there is
6790         no regular object in input.
6791         * options.cc (General_options::parse_EB): New method.
6792         (General_options::parse_EL): Same.
6793         (General_options::General_options): Initialize endianness_.
6794         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
6795         New options.
6796         (General_options::Endianness): New enum.
6797         (General_options::endianness): New method.
6798         (General_options::endianness_): New data member.
6799         * parameters.cc (Parameters::set_options): Check target endianness.
6800         (Parameters::set_target_once): Ditto.
6801         (Parameters::check_target_endianness): New method.
6802         (parameters_force_valid_target): If either -EL or -EB is specified,
6803         use it to define endianness of default target.
6804         * parameters.h (Parameters::check_target_endianness): New method
6805         declaration.
6806         * target.h (class Target): Change "endianity" to "endianness"
6807         in comments.
6808
6809 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6810
6811         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
6812         * configure: Regenerate.
6813         * Makefile.in: Regenerate.
6814         * testsuite/Makefile.in: Regenerate.
6815
6816 2010-04-06  Cary Coutant  <ccoutant@google.com>
6817
6818         gcc PR lto/42757
6819         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
6820         prevailing definitions of common symbols.
6821         * testsuite/plugin_test_6.sh: New test case.
6822         * testsuite/plugin_common_test_1.c: New test case.
6823         * testsuite/plugin_common_test_2.c: New test case.
6824         * testsuite/Makefile.am (plugin_test_6): New test case.
6825         * testsuite/Makefile.in: Regenerate.
6826
6827 2010-04-06  Nick Clifton  <nickc@redhat.com>
6828
6829         * po/vi.po: New Vietnamese translation.
6830
6831 2010-03-30  Doug Kwan  <dougkwan@google.com>
6832
6833         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
6834
6835 2010-03-25  Doug Kwan  <dougkwan@google.com>
6836
6837         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
6838         to avoid a conversion warning on a 32-bit host.
6839
6840 2010-03-24  Ian Lance Taylor  <iant@google.com>
6841
6842         * testsuite/script_test_3.t: Add a TLS segment.
6843         * testsuite/Makefile.am (check_PROGRAMS): Add
6844         tls_phdrs_script_test.
6845         (tls_phdrs_script_test_SOURCES): Define.
6846         (tls_phdrs_script_test_DEPENDENCIES): Define.
6847         (tls_phdrs_script_test_LDFLAGS): Define.
6848         (tls_phdrs_script_test_LDADD): Define.
6849         * testsuite/Makefile.in: Rebuild.
6850
6851 2010-03-23  Cary Coutant  <ccoutant@google.com>
6852
6853         * fileread.cc (find_or_make_view): Fix comment.
6854
6855 2010-03-23  Ian Lance Taylor  <iant@google.com>
6856
6857         * script-sections.cc (class Orphan_section_placement): Define
6858         PLACE_TLS and PLACE_TLS_BSS.
6859         (Orphan_section_placement::Orphan_section_placement): Initialize
6860         new places.
6861         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
6862         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
6863         (tls_script_test_SOURCES): Define.
6864         (tls_script_test_DEPENDENCIES): Define.
6865         (tls_script_test_LDFLAGS): Define.
6866         (tls_script_test_LDADD): Define.
6867         * testsuite/Makefile.in: Rebuild.
6868
6869 2010-03-22  Doug Kwan  <dougkwan@google.com>
6870
6871         * arm.cc (Arm_relocate_functions::abs8,
6872         Arm_relocate_functions::abs16): Use correct check for overflow
6873         specified in the ARM ELF specs.
6874         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
6875         target of a BLX instruction specially.
6876         (Reloc_stub::stub_type_for_reloc): Ditto.
6877         (Relocate::relocate): Use symbolic names instead of numeric relocation
6878         codes to report error.
6879         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
6880         workaround.
6881         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
6882         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
6883         thumb2_blx_out_of_range.stdout
6884         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
6885         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
6886         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
6887         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
6888         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
6889         thumb2_blx_in_range, thumb2_blx_in_range.o,
6890         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
6891         thumb2_blx_out_of_range.o): New rules.
6892         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
6893         thumb2_blx_in_range and thumb2_blx_out_of_range.
6894         * testsuite/Makefile.in: Regenerate.
6895         * arm_branch_in_range.sh: Add tests for THUMB BLX.
6896         * testsuite/thumb_blx_in_range.s: New file.
6897         * testsuite/thumb_blx_out_of_range.s: New file.
6898
6899 2010-03-22  Rafael Espindola  <espindola@google.com>
6900
6901         * archive.cc (Should_include): Move to archive.h.
6902         (should_include_member): Make it a member of Archive.
6903         (Lib_group): New.
6904         (Add_lib_group_symbols): New.
6905         * archive.h: Include options.h.
6906         (Archive_member): Moved from Archive.
6907         (Should_include): Moved from archive.cc.
6908         (Lib_group): New.
6909         (Add_lib_group_symbols): New.
6910         * dynobj.cc (do_should_include_member): New.
6911         * dynobj.h (do_should_include_member): New.
6912         * gold.cc (queue_initial_tasks): Update call to queue.
6913         * main.cc (main): Print lib group stats.
6914         * object.cc (do_should_include_member): New.
6915         * object.h: Include archive.h.
6916         (Object::should_include_member): New.
6917         (Object::do_should_include_member): New.
6918         (Sized_relobj::do_should_include_member): New.
6919         * options.cc (General_options::parse_start_lib): New.
6920         (General_options::parse_end_lib): New.
6921         (Input_arguments::add_file): Handle lib groups.
6922         (Input_arguments::start_group): Check we are not in a lib.
6923         (Input_arguments::start_lib): New.
6924         (Input_arguments::end_lib): New.
6925         * options.h (General_options): Add start_lib and end_lib.
6926         (Input_argument::lib_): New.
6927         (Input_argument::lib): New.
6928         (Input_argument::is_lib): New.
6929         (Input_file_lib): New.
6930         (Input_arguments::in_lib_): New.
6931         (Input_arguments::in_lib): New.
6932         (Input_arguments::start_lib): New.
6933         (Input_arguments::end_lib_): New.
6934         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
6935         in unused members as preempted.
6936         (Sized_pluginobj::do_should_include_member): New.
6937         * plugin.h (Sized_pluginobj::do_should_include_member): New.
6938         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
6939         return the blocker.
6940         (Read_symbols::do_whole_lib_group): New.
6941         (Read_symbols::do_lib_group): New.
6942         (Read_symbols::do_read_symbols): Handle lib groups.
6943         (Read_symbols::get_name): Handle lib groups.
6944         * readsyms.h (Read_symbols): Add an archive member pointer.
6945         (Read_symbols::do_whole_lib_group): New.
6946         (Read_symbols::do_lib_group): New.
6947         (Read_symbols::member_): New.
6948         * script.cc (read_input_script): Update call to queue_soon.
6949
6950 2010-03-19  Doug Kwan  <dougkwan@google.com>
6951
6952         * arm.cc (Stub_table::Stub_table): Initialize new data members
6953         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6954         (Stub_table::add_reloc_stub): Assign stub offset and update
6955         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
6956         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
6957         New data members.
6958         (Stub_table::update_data_size_and_addralign): Use
6959         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
6960         instead of going over all reloc stubs.
6961         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
6962         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6963         Stringpool_template::offset_ to size of Stringpool_char.
6964         (Stringpool_template::new_key_offset): Remove code to initialize
6965         Stringpool_template::offset_.
6966         * stringpool.h (Stringpool_template::set_no_zero_null): Set
6967         Stringpool_template::offset_ to zero.
6968
6969 2010-03-15  Doug Kwan  <dougkwan@google.com>
6970
6971         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
6972         offset_.
6973         (Stringpool_template::new_key_offset): New method.
6974         (Stringpool_template::add_string): Assign offsets when adding new
6975         strings.
6976         (Stringpool_template::set_string_offsets): Do not set string offsets
6977         when not optimizing.
6978         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
6979         member size_.
6980         (Chunked_vector::clear): Clear size_.
6981         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
6982         (Chunked_vector::size): Return size_.
6983         (Chunked_vector::push_back): Use size_ to find insert position.
6984         (Chunked_vector::size_): New data member.
6985         (Stringpool_template::set_no_zero_null): Assert string set is empty.
6986         (Stringpool_template::new_key_offset): New method declaration.
6987         (Stringpool_template::offset_): New data member.
6988
6989 2010-03-15   Rafael Espindola  <espindola@google.com>
6990
6991         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
6992         Add_symbols' constructor.
6993         * readsyms.h (Add_symbols): Remove the input_group member.
6994
6995 2010-03-10  Ian Lance Taylor  <iant@google.com>
6996
6997         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
6998         target to ask whether a reference to a symbol requires a stack
6999         split.
7000         * target.h (Target::is_call_to_non_split): New function.
7001         (Target::do_is_call_to_non_split): Declare virtual function.
7002         * target.cc: Include "symtab.h".
7003         (Target::do_is_call_to_non_split): New function.
7004         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7005
7006 2010-03-10  Cary Coutant  <ccoutant@google.com>
7007
7008         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7009         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7010         (File_read::open[2]): Add whole_file_view_ to list of views.
7011         (File_read::make_view): Remove test of whole_file_view_.
7012         (File_read::find_or_make_view): Create whole_file_view_ if
7013         necessary.
7014         (File_read::clear_views): Replace bool parameter with enum;
7015         adjust all callers.  Don't delete views with permanent data;
7016         do delete cached views and views from archives if
7017         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7018         if clearing the corresponding view.
7019         * fileread.h (File_read::Clear_views_mode): New enum.
7020         (File_read::View::is_permanent_view): New method.
7021         (File_read::clear_views): Replace bool parameter
7022         with enum; adjust all callers.
7023         * options.h (General_options): Change keep_files_mapped option;
7024         add map_whole_files.
7025         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7026         releasing the file.
7027         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7028         the file.
7029
7030 2010-03-10  David S. Miller  <davem@davemloft.net>
7031
7032         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7033
7034 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7035
7036         * icf.cc (get_section_contents): Add '@' marker after processing the
7037         merge reloc.
7038
7039 2010-03-08  Doug Kwan  <dougkwan@google.com>
7040
7041         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7042         due to a conversion warning.
7043         (Arm_relobj::update_output_local_symbol_count): Check for local
7044         symbol with unset output index.
7045
7046 2010-03-05  Ian Lance Taylor  <iant@google.com>
7047
7048         * options.h (class General_options): Add --spare-dynamic-tags.
7049         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7050         --spare-dynamic-tags.
7051
7052 2010-03-05  Ian Lance Taylor  <iant@google.com>
7053
7054         * incremental.cc: Include "libiberty.h".
7055
7056 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7057
7058         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7059         function, is_info_ member.
7060         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7061         (Versions::Versions): Update caller.
7062         (Versions::define_base_version): Likewise.
7063         (Versions::add_def): Likewise.
7064
7065 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7066
7067         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7068         (Scan::possible_function_pointer_reloc): New function.
7069         (Scan::local_reloc_may_be_function_pointer): Change to call
7070         possible_function_pointer_reloc.
7071         (Scan::global_reloc_may_be_function_pointer): Ditto.
7072         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7073         relocations in ".data.rel.ro._ZTV" section.
7074         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7075         * testsuite/icf_safe_so_test.cc: Ditto.
7076         * testsuite/icf_safe_test.cc: Ditto.
7077         * testsuite/icf_safe_test.sh: Ditto.
7078
7079 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7080             Ian Lance Taylor  <iant@google.com>
7081
7082         * target-reloc.h (relocate_section): Check the symbol table index
7083         for -1U before setting the local symbol index.
7084         (scan_relocatable_relocs): If copying the relocation, record that
7085         the local symbol is required.
7086         * object.h (Symbol_value::is_output_symtab_index_set): New
7087         function.
7088         (Symbol_value::may_be_discarded_from_output_symtab): New
7089         function.
7090         (Symbol_value::has_output_symtab_entry): New function.
7091         (Symbol_value::needs_output_symtab_entry): Remove.
7092         (Symbol_value::output_symtab_index): Make sure the symbol index is
7093         set.
7094         (Symbol_value::set_output_symtab_index): Make sure the symbol
7095         index is not set.  Make sure the new index is valid.
7096         (Symbol_value::set_must_have_output_symtab_entry): New function.
7097         (Symbol_value::has_output_dynsym_entry): New function.
7098         (Symbol_value::set_output_dynsym_index): Make sure the new index
7099         is valid.
7100         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7101         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7102         local symbol if permitted.
7103         (Sized_relobj::do_finalize_local_symbols): Call
7104         is_output_symtab_index_set rather than needs_output_symtab_entry.
7105         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7106         rather than needs_output_symtab_entry.  Call
7107         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7108         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7109         is_output_symtab_index_set rather than needs_output_symtab_entry.
7110         * testsuite/discard_locals_relocatable_test.c: New file.
7111         * testsuite/discard_locals_test.sh: Test -r.
7112         * testsuite/Makefile.am (check_DATA): Add
7113         discard_locals_relocatable_test1.syms,
7114         discard_local_relocatable_test2.syms.
7115         (MOSTLYCLEANFILES): Likewise.  Also add
7116         discard_locals_relocatable_test1.lout and
7117         discard_locals_relocatable_test2.out.
7118         (discard_locals_relocatable_test1.syms): New target.
7119         (discard_locals_relocatable_test.o): New target.
7120         (discard_locals_relocatable_test1.out): New target.
7121         (discard_locals_relocatable_test2.syms): New target.
7122         (discard_locals_relocatable_test2.out): New target.
7123         (various): Add missing ../ld-new dependencies.
7124         * testsuite/Makefile.in: Rebuild.
7125
7126 2010-03-03  Nick Clifton  <nickc@redhat.com>
7127
7128         * po/fi.po: New Finnish translation.
7129
7130 2010-03-01  Doug Kwan  <dougkwan@google.com>
7131
7132         * layout.cc (Layout::Layout): Force section types of .init_array*,
7133         .preinit_array* and .fini_array* sections.
7134         * output.cc (Output_section::Input_section_sort_entry::has_priority):
7135         Fix check of return value of std::string::find.().
7136         (Output_section::Input_section_sort_compare::operator()): Remove
7137         comment about .init_array.
7138         (Output_section::Input_section_sort_init_fini_compare::operator()):
7139         New method.
7140         (Output_section::sort_attached_input_sections): Handle .init_array
7141         and .fini_array specially.
7142         * output.h (Output_section::Inut_section_sort_compare): Update
7143         comment.
7144         (Output_section::Input_section_sort_init_fini_compare): New struct.
7145
7146 2010-02-26  Doug Kwan  <dougkwan@google.com>
7147
7148         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
7149         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
7150         * testsuite/debug_msg.sh: Avoid matching source line number for
7151         use of global variable undef_int.
7152
7153 2010-02-26  Doug Kwan  <dougkwan@google.com>
7154
7155         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
7156         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
7157         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
7158         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
7159         * options.cc (General_options::General_options): Initialize member
7160         fix_v4bx_.
7161         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
7162         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
7163         and rm_no_fix_v4bx.stdout
7164         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
7165         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
7166         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
7167         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
7168         and arm_no_fix_v4bx.
7169         * Makefile.in: Regenerate.
7170         * testsuite/arm_fix_v4bx.s: New file.
7171         * testsuite/arm_fix_v4bx.sh: Ditto.
7172
7173 2010-02-24  Doug Kwan  <dougkwan@google.com>
7174
7175         * arm.cc (Target_arm::got_section): Make the .got section the first
7176         non RELRO section in the data segment.
7177         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
7178         suffixes of section names.
7179
7180 2010-02-24  Doug Kwan  <dougkwan@google.com>
7181
7182         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
7183         flags and attributes merging if an input file is a binary file.
7184         * fileread.cc (Input_file::open): Record format of original file.
7185         * fileread.h (Input_file::Format): New enum type.
7186         (Input_file::Input_file): Initialize data member format_.
7187         (Input_file::format): New method definition.
7188         (Input_file::format_):: New data member.
7189
7190 2010-02-24  Doug Kwan  <dougkwan@google.com>
7191
7192         * arm.cc (Arm_output_data_got): New class.
7193         (ARM_TCB_SIZE): New constant
7194         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
7195         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
7196         If user uses a script with a SECTIONS clause, issue only a warning
7197         for a misplaced EXIDX input section.  Otherwise, issue an error.
7198         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
7199         garbage collection.
7200         (Target_arm::got_mode_index_entry): Handle static linking.
7201         (Target_arm::Scan::local): Ditto.
7202         (Target_arm::Scan::global): Ditto.
7203         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
7204         all incorrectly implemented relocations.
7205         (Target_arm::fix_exidx_coverage): Pass layout to
7206         Arm_output_section::fix_exidx_coverage.
7207         * layout.cc (Layout::section_name_mapping): Remove trailing dots
7208         from ".ARM.exidx." and ".ARM.extab.".
7209
7210 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7211
7212         * arm.cc (Target_arm::do_finalize_sections): Create attribute
7213         section if it does not already exist.
7214         * attributes.cc (Attributes_section_data::Attributes_section_data):
7215         Don't crash if size is zero.
7216
7217 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7218             Ian Lance Taylor  <iant@google.com>
7219
7220         * gold.cc (queue_middle_tasks): If no input files were opened,
7221         exit.
7222         * workqueue.h (Task_function::Task_function): Assert that there is
7223         a blocker.
7224
7225 2010-02-22  Doug Kwan  <dougkwan@google.com>
7226
7227         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
7228         * icf.cc (get_section_contents): Cast snprintf arguments to long long
7229         types to avoid warnings due to different uint64_t implementations
7230         on different hosts.
7231
7232 2010-02-21  Doug Kwan  <dougkwan@google.com>
7233
7234         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
7235         handling of the maximum backward branch offset.
7236         (Arm_relocate_functions::thumb_branch_common): Ditto.
7237         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
7238         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
7239         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
7240         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
7241         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
7242         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
7243         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
7244         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
7245         thumb_bl_out_of_range thumb_bl_out_of_range.o,
7246         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
7247         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
7248         thumb2_bl_out_of_range.o): New rules.
7249         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
7250         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
7251         thumb2_bl_out_of_range
7252         * testsuite/Makefile.in: Regenerate.
7253         * testsuite/arm_bl_in_range.s: New file.
7254         * testsuite/arm_bl_out_of_range.s: Ditto.
7255         * testsuite/arm_branch_in_range.sh: Ditto.
7256         * testsuite/arm_branch_range.t: Ditto.
7257         * testsuite/thumb2_branch_range.t: Ditto.
7258         * testsuite/thumb_bl_in_range.s: Ditto.
7259         * testsuite/thumb_bl_out_of_range.s: Ditto.
7260         * testsuite/thumb_branch_range.t: Ditto.
7261
7262 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
7263
7264         * gc.h (gc_process_relocs): Change vectors to point to the new list.
7265         Add reloc offset information.
7266         * icf.cc (get_section_contents): Change iterators to point to the new
7267         vectors. Add reloc offset information to the contents.
7268         * icf.h (Icf::Sections_reachable_info): New typedef.
7269         (Icf::Sections_reachable_list): New typedef.
7270         (Icf::Offset_info): New typedef.
7271         (Icf::Reloc_info): New struct typedef.
7272         (Icf::Reloc_info_list): New typedef.
7273         (Icf::symbol_reloc_list): Delete method.
7274         (Icf::addend_reloc_list): Delete method.
7275         (Icf::section_reloc_list): Delete method.
7276         (Icf::reloc_info_list): New method.
7277         (Icf::reloc_info_list_): New member.
7278
7279 2010-02-19  Doug Kwan  <dougkwan@google.com>
7280
7281         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
7282         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
7283         * arm.cc (Arm_relocation_functions): New forward declaration.
7284         (Target_arm::Target_arm): Initialize new data members
7285         got_mod_index_offset_ and tls_base_symbol_defined_.
7286         (Target_arm::Relocate::relocate_tls): New method.
7287         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
7288          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
7289         New methods.
7290         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
7291         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
7292         (Target_arm::got_mod_index_offset_,
7293         Target_arm::tls_base_symbol_defined_): New data members.
7294         (Target_arm::Scan::local, Target::Scan::global,
7295         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
7296         relocations.
7297
7298 2010-02-18  Doug Kwan  <dougkwan@google.com>
7299
7300         * arm.cc (Arm_relobj::find_linked_text_section): New method.
7301         (Arm_relobj::make_exidx_input_section): Pass section index of linked
7302         text section as a parameter becuase some broken tools may not set
7303         the link in section header.
7304         (Target_arm::has_got_section): New method.
7305         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
7306         without any mapping symbol as data only.  Remove warning.
7307         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
7308         link in its section header, try to discover the link by inspecting the
7309         REL31 relocation at the beginning of the section.
7310         (Target_arm::Scan::check_non_pic): Report name of offending relocation
7311         in error message.
7312         (Target_arm::Scan::global): Treat any reference to the symbol
7313         _GLOBAL_OFFSET_TABLE_ as a GOT access.
7314
7315 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
7316
7317         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
7318         (Scan::global_reloc_may_be_function_pointer): New function.
7319         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7320         (Scan::global_reloc_may_be_function_pointer): New function.
7321         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
7322         (Scan::global_reloc_may_be_function_pointer): New function.
7323         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
7324         (Scan::global_reloc_may_be_function_pointer): New function.
7325         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
7326         (Scan::global_reloc_may_be_function_pointer): New function.
7327         (Scan::possible_function_pointer_reloc): New function.
7328         (Target_x86_64::can_check_for_function_pointers): New function.
7329         * gc.h (gc_process_relocs): Scan relocation types to determine if
7330         function pointers were taken for targets that support it.
7331         * icf.cc (Icf::find_identical_sections): Include functions for
7332         folding in safe ICF whose pointer is not taken.
7333         * icf.h (Secn_fptr_taken_set): New typedef.
7334         (fptr_section_id_): New member.
7335         (section_has_function_pointers): New function.
7336         (set_section_has_function_pointers): New function.
7337         (check_section_for_function_pointers): New function.
7338         * options.h: Fix comment for safe ICF option.
7339         * target.h (can_check_for_function_pointers): New function.
7340         * testsuite/Makefile.am: Add icf_safe_so_test test case.
7341         Modify icf_safe_test for X86-64.
7342         * testsuite/Makefile.in: Regenerate.
7343         * testsuite/icf_safe_so_test.cc: New file.
7344         * testsuite/icf_safe_so_test.sh: New file.
7345         * testsuite/icf_safe_test.cc (kept_func_3): New function.
7346         (main): Change to take pointer to function kept_func_3.
7347         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
7348         folding is done correctly for X86-64.
7349
7350 2010-02-12  David S. Miller  <davem@davemloft.net>
7351
7352         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
7353         is_symbolless parameter.
7354         (Output_reloc<SHT_REL>::is_symbolless): New.
7355         (Output_reloc<SHT_REL>::is_symbolless_): New.
7356         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
7357         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
7358         (Output_reloc<SHT_RELA>::is_symbolless): New.
7359         (Output_data_reloc::add_global): Handle is_symbolless.
7360         (Output_data_reloc::add_global_relative): Likewise.
7361         (Output_data_reloc::add_local): Likewise.
7362         (Output_data_reloc::add_local_relative): Likewise.
7363         (Output_data_reloc::add_symbolless_global_addend): New.
7364         (Output_data_reloc::add_symbolless_local_addend): New.
7365         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
7366         is_symbolless.
7367         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
7368         instead of ->is_relative_
7369         (Output_reloc::write): Likewise.
7370         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
7371         (Output_reloc::write_rel): Simplify.
7372
7373         * sparc.cc (Target_sparc::Scan::local): Use
7374         ->add_symbolless_local_addend as needed.
7375         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
7376         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
7377         based upon relocation offset.
7378
7379 2010-02-11  Doug Kwan  <dougkwan@google.com>
7380
7381         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
7382         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
7383         beginning of function.
7384         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
7385         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
7386         parameter is_32bit in calls to should_apply_static_reloc.
7387         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
7388         (check_DATA): Add arm_abs_global.stdout.
7389         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
7390         arm_abs_global.stdout): New rules.
7391         (MOSTLLYCLEANFILES): Add arm_abs_global
7392         * Makefile.in: Regenerate.
7393         * testsuite/arm_abs_global.s: New file.
7394         * testsuite/arm_abs_global.sh: Ditto.
7395         * testsuite/arm_abs_lib.s: Ditto.
7396
7397 2010-02-11  Ian Lance Taylor  <iant@google.com>
7398
7399         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
7400         Read_relocs task.
7401         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
7402         Allocate_commons_task first.
7403         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
7404         task, rather than symtab_lock_.
7405         (Gc_process_relocs::~Gc_process_relocs): New function.
7406         (Gc_process_relocs::is_runnable): Check this_blocker_.
7407         (Gc_process_relocs::locks): Use next_blocker_ rather than
7408         blocker_.
7409         (Scan_relocs::~Scan_relocs): New function.
7410         (Scan_relocs::is_runnable): Check this_blocker_ rather than
7411         symtab_lock_.
7412         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
7413         next_blocker_.
7414         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
7415         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
7416         constructor accordingly.
7417         (class Gc_process_relocs): Likewise.
7418         (class Scan_relocs): Likewise.
7419         * common.h (class Allocate_commons_task): Remove symtab_lock_
7420         field, and corresponding constructor parameter.
7421         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
7422         symtab_lock_.
7423         (Allocate_commons_task::locks): Likewise.
7424
7425 2010-02-11  Ian Lance Taylor  <iant@google.com>
7426
7427         * gold-threads.h (class Once): Define.
7428         (class Initialize_lock): Rewrite as child of Once.
7429         * gold-threads.cc (class Once_initialize): Define.
7430         (once_pointer_control): New static variable.
7431         (once_pointer, once_arg): New static variables.
7432         (c_run_once): New static function.
7433         (Once::Once, Once::run_once, Once::internal_run): New functions.
7434         (class Initialize_lock_once): Remove.
7435         (initialize_lock_control): Remove.
7436         (initialize_lock_pointer): Remove.
7437         (initialize_lock_once): Remove.
7438         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
7439         (Initialize_lock::initialize): Rewrite.
7440         (Initialize_lock::do_run_once): New function.
7441         * archive.cc (Archive::interpret_header): Only clear name if it is
7442         not already empty.
7443         * fileread.cc: Include "gold-threads.h"
7444         (file_counts_lock): New static variable.
7445         (file_counts_initialize_lock): Likewise.
7446         (File_read::release): Only increment counts when using --stats.
7447         Use a lock around the increment.
7448         * parameters.cc (class Set_parameters_target_once): Define.
7449         (set_parameters_target_once): New static variable.
7450         (Parameters::Parameters): Move here from parameters.h.
7451         (Parameters::set_target): Rewrite.
7452         (Parameters::set_target_once): New function.
7453         (Parameters::clear_target): Move here and rewrite.
7454         * parameters.h (class Parameters): Update declarations.  Add
7455         set_parameters_target_once_ field.
7456         (Parameters::Parameters): Move to parameters.cc.
7457         (Parameters::clear_target): Likewise.
7458         * readsyms.cc (Read_symbols::do_group): Create a Start_group
7459         task.
7460         (Start_group::~Start_group): New function.
7461         (Start_group::is_runnable): New function.
7462         (Start_group::locks, Start_group::run): New functions.
7463         (Finish_group::run): Change saw_undefined to size_t.
7464         * readsyms.h (class Start_group): Define.
7465         (class Finish_group): Change saw_undefined_ field to size_t.
7466         (Finish_group::Finish_group): Remove saw_undefined and
7467         this_blocker parameters.  Change all callers.
7468         (Finish_group::set_saw_undefined): New function.
7469         (Finish_group::set_blocker): New function.
7470         * symtab.h (class Symbol_table): Change saw_undefined to return
7471         size_t.  Change saw_undefined_ field to size_t.
7472         * target-select.cc (Set_target_once::do_run_once): New function.
7473         (Target_selector::Target_selector): Initialize set_target_once_
7474         field.  Don't initialize lock_ and initialize_lock_ fields.
7475         (Target_selector::instantiate_target): Rewrite.
7476         (Target_selector::set_target): New function.
7477         * target-select.h (class Set_target_once): Define.
7478         (class Target_selector): Update declarations.  Make
7479         Set_target_once a friend.  Remove lock_ and initialize_lock_
7480         fields.  Add set_target_once_ field.
7481
7482 2010-02-10  Ian Lance Taylor  <iant@google.com>
7483
7484         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
7485         queueing any tasks.
7486         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
7487         (queue_middle_tasks): Add all blockers before queueing any tasks.
7488         (queue_final_tasks): Likewise.
7489         * token.h (Task_token::add_blockers): New function.
7490         * object.h (Input_objects::number_of_relobjs): New function.
7491
7492 2010-02-10  Ian Lance Taylor  <iant@google.com>
7493
7494         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
7495         shared, not if not position independent.
7496         * x86_64.cc (Relocate::relocate_tls): Likewise.
7497         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
7498         (tls_pie_pic_test): New target.
7499         * testsuite/Makefile.in: Rebuild.
7500
7501         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
7502         (tls_test_main_pie.o, tls_test_pie.o): New targets.
7503         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
7504         * testsuite/Makefile.in: Rebuild.
7505
7506 2010-02-09  David S. Miller  <davem@davemloft.net>
7507
7508         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
7509         R_SPARC_RELATIVE using ->add_local_relative().
7510         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
7511
7512         * output.h (Output_data_dynamic::add_section_size): New method
7513         that takes two Output_data objects.
7514         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
7515         entry param.  Handle it in initializers.
7516         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
7517         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
7518         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
7519         arg.
7520         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
7521         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
7522         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
7523         for dynrel_includes_plt.
7524         * i386.cc (Target_i386::do_finalize_sections): Likewise.
7525         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
7526         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
7527         before .rela.plt
7528         (Target_sparc::do_finalize_sections): Update to pass true for
7529         dynrel_includes_plt.
7530         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
7531         output before .rela.plt
7532         (Target_powerpc::do_finalize_sections): Update to pass true for
7533         dynrel_includes_plt when 32-bit.
7534
7535 2010-02-08  Doug Kwan  <dougkwan@google.com>
7536
7537         * arm.cc (Arm_relobj::simple_input_section_output_address): New
7538         method.
7539         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
7540         Arm_relobj::scan_section_for_cortex_a8_stubs,
7541         Arm_relobj::do_relocation_section): Instead of calling
7542         Output_section::output_address, use faster
7543         Arm_relobj::simple_input_section_output_address.
7544
7545 2010-02-08  David S. Miller  <davem@davemloft.net>
7546
7547         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
7548         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
7549         relocation helper function.
7550
7551         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
7552         just like R_SPARC_GOT{10,13,22}.
7553         (Target_sparc::Scan::local): Likewise.
7554         (Target_sparc::Relocate:relocate): Likewise.
7555
7556 2010-02-06  Ian Lance Taylor  <iant@google.com>
7557
7558         * configure.ac: Rewrite targetobjs duplicate removal code to use
7559         only shell constructs.
7560         * configure: Rebuild.
7561
7562 2010-02-05  Doug Kwan  <dougkwan@google.com>
7563
7564         PR 11247
7565         * arm.cc (Arm_relobj::section_is_scannable): New method.
7566         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
7567         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
7568
7569 2010-02-04  Doug Kwan  <dougkwan@google.com>
7570
7571         PR 11247
7572         * arm-reloc-property.cc (cstdio): Include.
7573         * configure.ac (targetobjs): Remove duplicates.
7574         * configure: Regenerate.
7575         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
7576         big and little endian version for a given address size.
7577
7578 2010-02-03  Doug Kwan  <dougkwan@google.com>
7579
7580         * arm-reloc-property.cc
7581         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7582         definition.
7583         * arm-reloc-property.h
7584         (Arm_reloc_property_table::get_implemented_static_reloc_property):
7585         New method definition.
7586         (Arm_reloc_property_table::reloc_name_in_error_message): New method
7587         declaration.
7588         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
7589         overflow to N.
7590         (GOT_PREL): Change implemented to Y.
7591         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
7592         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
7593         (Arm_relocate_functions::movw_abs_nc): Remove method.
7594         (Arm_relocate_functions::movt_abs): Ditto.
7595         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
7596         (Arm_relocate_functions::thm_movt_abs): Ditto.
7597         (Arm_relocate_functions::movw_rel_nc): Ditto.
7598         (Arm_relocate_functions::movw_rel): Ditto.
7599         (Arm_relocate_functions::movt_rel): Ditto.
7600         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
7601         (Arm_relocate_functions:thm_movw_rel): Ditto.
7602         (Arm_relocate_functions:thm_movt_rel): Ditto.
7603         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
7604         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
7605         New method definitions.
7606         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
7607         (Arm_relocation_functions::arm_grp_ldr): Ditto.
7608         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
7609         (Arm_relocation_functions::arm_grp_ldc): Ditto.
7610         (Target_arm::Relocate::relocate): Check for non-static or
7611         unimplemented relocation code and exit early.  Change calls to
7612         Target_arm::reloc_uses_thumb_bit and
7613         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
7614         instead.  Refactor code to handle similar relocations to increase
7615         code sharing.  Remove check for unsupported relocation code in switch
7616         statement.
7617         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
7618         relocation property table to find out size.  Change error message to
7619         print out the name of a relocation code instead of the numeric value.
7620         (Target_arm::scan_reloc_for_stub): Use relocation property table
7621         instead of calling Target_arm::reloc_uses_thumb_bit().
7622
7623 2010-02-02  Doug Kwan  <dougkwan@google.com>
7624
7625         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
7626         types of relaxed input section.
7627
7628 2010-02-02  Doug Kwan  <dougkwan@google.com>
7629
7630         * Makefile.am (HFILES): Add arm-reloc-property.h.
7631         (DEFFILES): New.
7632         (TARGETSOURCES): Add arm-reloc-property.cc
7633         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
7634         (libgold_a_SOURCES): $(DEFFILES)
7635         * Makefile.in: Regenerate.
7636         * arm-reloc-property.cc: New file.
7637         * arm-reloc-property.h: New file.
7638         * arm-reloc.def: New file.
7639         * arm.cc: Update comments.
7640         (arm-reloc-property.h): New included header.
7641         (arm_reloc_property_table): New global variable.
7642         (Target_arm::do_select_as_default_target): New method definition.
7643         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
7644         arm-reloc-property to targ_extra_obj.
7645         * parameters.cc (set_parameters_target): Call
7646         Target::select_as_default_target().
7647         * target.h (Target::select_as_default_target): New method definition.
7648         (Target::do_select_as_default_target): Same.
7649
7650 2010-02-01  Doug Kwan  <dougkwan@google.com>
7651
7652         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
7653         first_output_text_section_.
7654         (Arm_exidx_fixup::first_output_text_section): New method definition.
7655         (Arm_exidx_fixup::first_output_text_section_): New data member.
7656         (Arm_exidx_fixup::process_exidx_section): Record the first text
7657         output section seen.
7658         (Arm_output_section::fix_exidx_coverage): Set correct linked section
7659         and entsize in output section header.
7660
7661 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7662
7663         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
7664         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
7665         (Arm_relocate_functions::thm_alu11): New Method.
7666         (Arm_relocate_functions::thm_pc8): New Method.
7667         (Arm_relocate_functions::thm_pc12): New Method.
7668         (Target_arm::Scan::local): Handle the relocations.
7669         (Target_arm::Scan::global): Likewise.
7670         (Target_arm::Relocate::relocate): Likewise.
7671         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
7672
7673 2010-01-29  Doug Kwan  <dougkwan@google.com>
7674
7675         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
7676         of relocation types as ld.
7677
7678 2010-01-29  Doug Kwan  <dougkwan@google.com>
7679
7680         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
7681         to public.
7682         (Arm_relocate_functions::thumb_branch_common): Ditto.
7683         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
7684         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
7685         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
7686         Arm_relocate_functions::jump24): Remove.
7687         (Target_arm::Relocate::relocate): Adjust code to call
7688         Arm_relocation_functions::arm_branch_common and
7689         Arm_relocation_functions::thumb_branch_common instead of their removed
7690         wrappers.  Merge switch-cases together to reduce source code size.
7691
7692 2010-01-29  Doug Kwan  <dougkwan@google.com>
7693
7694         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
7695         output_local_symbol_count_needs_update_.
7696         (Arm_relobj::output_local_symbol_count_needs_update,
7697          Arm_relobj::set_output_local_symbol_count_needs_update,
7698          Arm_relobj::update_output_local_symbol_count): New methods.
7699         (Arm_relobj::output_local_symbol_count_needs_update_): New data
7700         member.
7701         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
7702         of pointed function as in a R_ARM_PREL31 relocation.
7703         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
7704         for output local symbol count updating.
7705         (Target_arm::do_relax): Update output local symbol counts in objects
7706         if necessary.
7707         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
7708
7709 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7710
7711         * arm.cc: Added support for the ARM relocations:
7712         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
7713         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
7714         (Arm_relocate_functions::movw_rel_nc): Renamed (was
7715         movw_prel_nc).
7716         (Arm_relocate_functions::movw_rel): New method.
7717         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
7718         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
7719         thm_movw_prel_nc).
7720         (Arm_relocate_functions::thm_movw_rel): New method.
7721         (Arm_relocate_functions::thm_movt_rel): Renamed (was
7722         thm_movt_prel).
7723         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
7724         relocations.
7725         (Target_arm::Scan::global): Likewise.
7726         (Target_arm::Relocate::relocate): Likewise.
7727         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7728         Likewise.
7729
7730 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7731
7732         * arm.cc: Added support for ARM group relocations.
7733         (Target_arm::reloc_needs_sym_origin): New method.
7734         (Arm_relocate_functions::calc_grp_kn): New method.
7735         (Arm_relocate_functions::calc_grp_residual): New method.
7736         (Arm_relocate_functions::calc_grp_gn): New method.
7737         (Arm_relocate_functions::arm_grp_alu): New Method.
7738         (Arm_relocate_functions::arm_grp_ldr): New Method.
7739         (Arm_relocate_functions::arm_grp_ldrs): New Method.
7740         (Arm_relocate_functions::arm_grp_ldc): New Method.
7741         (Target_arm::Scan::local): Handle the ARM group relocations.
7742         (Target_arm::Scan::global): Likewise.
7743         (Target_arm::Relocate::relocate): Likewise.
7744         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7745         Likewise.
7746
7747 2010-01-26  Doug Kwan  <dougkwan@google.com>
7748
7749         * arm.cc (set): Include.
7750         (class Arm_exidx_fixup): Change type of last_input_section_ to const
7751         pointer type.
7752         (Arm_output_section::Text_section_list): New type.
7753         (Arm_output_section::append_text_sections_to_list): New method.
7754         (Arm_output_section::fix_exidx_coverage): Ditto.
7755         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
7756         (Arm_relobj::convert_input_section_to_relaxed_section): Use
7757         Relobj::set_section_offset() instead of
7758         Sized_relobj::invalidate_section_offset().
7759         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
7760         parameter for section headers. Ignore relocation sections for
7761         unallocated sections and EXIDX sections.
7762         (Target_arm::fix_exidx_coverage): New method.
7763         (Target_arm::output_section_address_less_than): New type.
7764         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
7765         linked text section instead of the EXIDX section.
7766         (Arm_output_section::create_stub_group): Add an assertion to check
7767         that this is not an EXIDX output section.
7768         (Arm_output_section::append_text_sections_to_list): New method.
7769         (Arm_output_section::fix_exidx_coverage): Ditto.
7770         (Arm_relobj::scan_sections_for_stubs): Adjust call to
7771         Arm_relobj::section_needs_reloc_stub_scanning.
7772         (Target_arm::do_relax): Fix EXIDX output section coverage in the
7773         first pass.
7774         (Target_arm::fix_exidx_coverage): New method.
7775         * object.h (Relobj::set_output_section): New method.
7776         (Sized_relobj::invalidate_section_offset): Remove method.
7777         (Sized_relobj::do_invalidate_section_offset): Remove method.
7778         (Sized_relobj::do_set_section_offset): Handle offset value -1.
7779
7780 2010-01-25  Doug Kwan  <dougkwan@google.com>
7781
7782         * arm.cc (Arm_exidx_merged_section::do_output_offset):
7783         Fix warning due to signed and unsigned comparison on a 32-bit host.
7784
7785 2010-01-22  Doug Kwan  <dougkwan@google.com>
7786
7787         * arm.cc (Target_arm::do_relax): Record an output section for section
7788         offset adjustment it contains any stub table that has changed.
7789         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
7790         offsets in an output section if necessary.
7791         * output.cc (Output_section::Output_section): Initialize
7792         section_offsets_need_adjustments_.
7793         (Output_section::add_input_section_for_script): Renamed to
7794         Output_section::add_simple_input_section.
7795         (Output_section::save_states): Add a comment.
7796         (Output_section::discard_states): New method defintion.
7797         (Output_section::adjust_section_offsets): Same.
7798         * output.h (Output_section::add_input_section_for_script): Renamed to
7799         Output_section::add_simple_input_section.
7800         (Output_section::discard_states): New method declaration.
7801         (Output_section::adjust_section_offsets): Same.
7802         (Output_section::section_offsets_need_adjustment,
7803         Output_section::set_section_offsets_need_adjustment): New method
7804         definitions.
7805         (Output_section::section_offsets_need_adjustment_): New data member.
7806         * script-sections.cc
7807         (Output_section_element_input::set_section_address): Adjust code for
7808         renaming of Output_section::add_input_section_for_script.
7809         (Orphan_output_section::set_section_address): Same.
7810
7811 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7812
7813         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
7814         Fix_v4bx enum values .
7815         * gold/options.h (General_options): New option definitions.
7816         (General_options::fix_v4bx): New method.
7817         (General_options::Fix_v4bx): New enum.
7818         * gold/options.cc (General_options::parse_fix_v4bx): New method.
7819         (General_options::parse_fix_v4bx_interworking): New method.
7820
7821 2010-01-22  Doug Kwan  <dougkwan@google.com>
7822
7823         * arm.cc (Arm_exidx_fixup): New class.
7824
7825 2010-01-21  Doug Kwan  <dougkwan@google.com>
7826
7827         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
7828         classes.
7829         (Arm_exidx_section_offset_map): New type.
7830
7831 2010-01-21  Doug Kwan  <dougkwan@google.com>
7832
7833         * arm.cc (Arm_exidx_input_section): New class.
7834         (Arm_relobj::exidx_input_section_by_link,
7835         Arm_relobj::exidx_input_section_by_shndx,
7836         Arm_relobj::make_exidx_input_section): New methods.
7837         (read_arm_attributes_section): Remove.
7838         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
7839         information about them.
7840         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
7841         to here.
7842
7843 2010-01-20  Doug Kwan  <dougkwan@google.com>
7844
7845         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
7846         Input_section_specifier to Section_id.
7847         (Target_arm::new_arm_input_section: Adjust code for change of key
7848         type.
7849         (Target_arm::find_arm_input_section): Ditto.
7850         * gc.h (object.h): Include for Section_id nand Section_id_hash.
7851         (Section_id): Remove.
7852         (Garbage_collection::Section_id_hash): Remove.
7853         * icf.h (object.h): Include for Section_id nand Section_id_hash.
7854         (Section_id): Remove.
7855         (Icf::Section_id_hash): Remove.
7856         * object.h (Section_id, Const_section_id, Section_id_hash,
7857         Const_section_id_hash): New type definitions.
7858         * output.cc (Output_section::add_relaxed_input_section): Change to
7859         use Const_section_id instead of Input_section_specifier as key type.
7860         (Output_section::add_merge_input_section): Ditto.
7861         (Output_section::build_relaxation_map): Change to use Section_id
7862         instead of Input_section_specifier as key type.
7863         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7864         Ditto.
7865         (Output_section::convert_input_sections_to_relaxed_sections): Change
7866         to use Const_section_id instead of Input_section_specifier as key type.
7867         (Output_section::find_merge_section): Ditto.
7868         (Output_section::find_relaxed_input_section): Ditto.
7869         * output.h (Input_section_specifier): Remove class.
7870         (Output_section::Output_section_data_by_input_section_map): Change
7871         key type to Const_section_id.
7872         (Output_section::Output_relaxed_input_section_by_input_section_map):
7873         Ditto.
7874         (Output_section::Relaxation_map): Change key type to Section_id.
7875
7876 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7877
7878         * gold/arm.cc: Added support for R_ARM_V4BX relocation
7879         (class Arm_v4bx_stub): New class.
7880         (DEF_STUBS): Updated definition to support v4_veneer_bx.
7881         (Stub_factory::make_arm_v4bx_stub): New method.
7882         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
7883         (Stub_table::empty): Handle v4bx stubs.
7884         (Stub_table::add_arm_v4bx_stub): New method.
7885         (Stub_table::find_arm_v4bx_stub): New method.
7886         (Arm_relocate_functions::v4bx): New method.
7887         (Target_arm::fix_v4bx): New method.
7888         (Target_arm::Target_arm): Handle R_ARM_V4BX.
7889         (Stub_table::relocate_stubs): Likewise.
7890         (Stub_table::do_write): Likewise.
7891         (Stub_table::update_data_size_and_addralign): Likewise.
7892         (Stub_table::finalize_stubs):  Likewise.
7893         (Target_arm::Scan::local): Likewise.
7894         (Target_arm::Scan::global): Likewise.
7895         (Target_arm::do_finalize_sections): Likewise.
7896         (Target_arm::Relocate::relocate): Likewise.
7897         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7898         Likewise.
7899         (Target_arm::scan_reloc_for_stub): Likewise.
7900         (Target_arm::scan_reloc_section_for_stubs): Likewise.
7901
7902 2010-01-19  Ian Lance Taylor  <iant@google.com>
7903
7904         * output.cc (Output_section_headers::do_sized_write): Write large
7905         segment count to sh_info field.
7906         (Output_file_header::do_sized_write): For large segment count,
7907         write PN_XNUM to e_phnum field.
7908
7909 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7910
7911         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
7912         (Arm_relocate_functions::thm_jump8): New function.
7913         (Arm_relocate_functions::thm_jump11): New function.
7914         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
7915         R_ARM_THM_JUMP11.
7916         (Target_arm::Scan::global): Likewise.
7917         (Target_arm::Relocate::relocate): Likewise.
7918         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
7919         Likewise.
7920
7921 2010-01-14  Doug Kwan  <dougkwan@google.com>
7922
7923         * arm.cc (map, utility): Include headers.
7924         (Target_arm::apply_cortex_a8_workaround): New method.
7925         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
7926         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
7927         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
7928         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
7929         the --[no-]fix-cortex-a8 command line options.
7930         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
7931         (Target_arm::relocate_stub): Use addend in instruction template.
7932         * options.h (DEFINE_bool): Set the user-set flag.
7933         (General_options): Add --[no-]-fix-cortex options.
7934         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
7935         : Update fast look-up map after conversion.
7936
7937 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
7938
7939         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
7940         in the first pass of do_layout.
7941
7942 2010-01-13  Doug Kwan  <dougkwan@google.com>
7943
7944         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7945         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
7946         apparent compiler problem of not folding static constant integral
7947         data members of elfcpp::Elf_sizes<32>.
7948
7949 2010-01-13  Doug Kwan  <dougkwan@google.com>
7950
7951         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
7952         Arm_relobj::section_needs_cortex_a8_stub_scanning,
7953         Arm_relobj::scan_section_for_cortex_a8_erratum,
7954         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
7955         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
7956         sections to scan for relocation stubs into a new method
7957         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
7958         relocation and Cortex-A8 stub scanning.
7959         (Target_arm::do_relax): Force stubs to be after stubbed sections
7960         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
7961         the beginning of a new relaxation pass.  Update a comment.
7962         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
7963
7964 2010-01-12  Ian Lance Taylor  <iant@google.com>
7965
7966         * target-reloc.h (visibility_error): New inline function.
7967         (relocate_section): Call visibility_error.
7968         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
7969         (MOSTLYCLEANFILES): Likewise.
7970         (protected_4_pic.o, protected_3.err): New targets.
7971         * testsuite/protected_4.cc: New file.
7972
7973 2010-01-12  Doug Kwan  <dougkwan@google.com>
7974
7975         * arm.cc (Cortex_a8_reloc): New class.
7976         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
7977         and cortex_a8_relocs_info_.
7978         (Target_arm::fix_cortex_a8): New method definition.
7979         (Target_arm::Cortex_a8_relocs_info): New type.
7980         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
7981         New data member declarations.
7982         (Target_arm::scan_reloc_for_stub): Record information about
7983         relocations for THUMB branches that might be exempted from the
7984         Cortex-A8 workaround.
7985         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
7986         at the beginning of a relaxation pass.
7987
7988 2010-01-12  Doug Kwan  <dougkwan@google.com>
7989
7990         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
7991         (Arm_relobj::Mapping_symbol_position,
7992          Arm_reloj::Mapping_symbol_position_less,
7993          Arm_relobj::Mapping_symbols_info): New types.
7994         (Target_arm::is_mapping_symbol_name): New method definition.
7995         (Arm_relobj::do_count_local_symbols): Save information about mapping
7996         symbols.
7997
7998 2010-01-11  Doug Kwan  <dougkwan@google.com>
7999
8000         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8001         Arm_relocate_functions::thumb32_branch_upper,
8002         Arm_relocate_functions::thumb32_branch_lower,
8003         Arm_relocate_functions::thumb32_cond_branch_offset,
8004         Arm_relocate_functions::thumb32_cond_branch_upper,
8005         Arm_relocate_functions::thumb32_cond_branch_lower,
8006         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8007         branch offset encoding.
8008         (Arm_relocate_functions::thumb_branch_common): Use new branch
8009         offset encoding methods to avoid code duplication.
8010         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8011         (Stub_addend_reader::operator()): Use new branch encoding method
8012         to avoid code duplication.
8013
8014 2010-01-11  Doug Kwan  <dougkwan@google.com>
8015
8016         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8017         (Target_arm::do_finalize_sections): Define special EXIDX section
8018         symbols only if referenced.
8019         * gc.h (Garbage_collection::add_reference): New method.
8020         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8021         code duplication.
8022
8023 2010-01-11  Ian Lance Taylor  <iant@google.com>
8024
8025         * script.cc (Version_script_info::build_expression_list_lookup):
8026         Change complaing about duplicate wildcard match from error to
8027         warning.
8028
8029         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8030         of 2009-12-30.
8031         (Version_script_info::Version_script_info): Initialize globs_,
8032         default_version_, default_is_global_, and exact_.  Don't
8033         initialize globals_ or locals_.
8034         (Version_script_info::build_lookup_tables): Build local symbols
8035         first.
8036         (Version_script_info::unquote): New function.
8037         (Version_script_info::add_exact_match): New function.
8038         (Version_script_info::build_expression_list_lookup): Remove lookup
8039         parameter.  Add is_global parameter.  Change all callers.  Handle
8040         wildcard pattern specially.  Unquote pattern.  Call
8041         add_exact_match.
8042         (Version_script_info::get_name_to_match): New function.
8043         (Version_script_info::get_symbol_version): New function.
8044         (Version_script_info::get_symbol_version_helper): Remove.
8045         (Version_script_info::check_unmatched_names): Call unquote.
8046         * script.h (class Version_script_info): Change get_symbol_version
8047         to be non-inline and add is_global parameter; change all callers.
8048         Rewrite symbol_is_local.  Update declarations.  Define struct
8049         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8050         Remove globals_ and locals_ members.  Add exact_, globs_,
8051         default_version_, is_global_.
8052         (Version_script_info::Glob): Remove pattern, add expression and
8053         is_global.  Update constructor.  Change all callers.
8054         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8055         default version.
8056         (Versions::symbol_section_contents): If a symbol is undefined, or
8057         defined in a dynamic object, set the version index to
8058         VER_NDX_LOCAL.
8059         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8060         symbol_is_local.
8061         (Symbol_table::add_from_pluginobj): Likewise.
8062         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8063
8064 2010-01-11  Doug Kwan  <dougkwan@google.com>
8065
8066         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8067         (incremental_dump_LDADD): Add linking option for libintl.
8068         * Makefile.in: Regenerate.
8069
8070 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8071
8072         PR gold/11144
8073         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8074         instead of -Ds.
8075         * testsuite/Makefile.in: Regenerated.
8076
8077 2010-01-10  Doug Kwan  <dougkwan@google.com>
8078
8079         * options.h (DEFINE_var): Use parentheses around argument varname__
8080         in macro body to avoid any unintended subsequent substitutions.
8081
8082 2010-01-10  Ian Lance Taylor  <iant@google.com>
8083
8084         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8085         candidates before doing symbol resolution.
8086
8087         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8088         ODR candidates if only one is weak.
8089
8090 2010-01-08  Ian Lance Taylor  <iant@google.com>
8091
8092         * script.cc (Version_script_info::build_expression_list_lookup):
8093         Don't warn about ambiguous version, just record the ambiguity.
8094         (Version_script_info::get_symbol_version_helper): Give error if
8095         version is ambiguous.
8096
8097 2010-01-08  Doug Kwan  <dougkwan@google.com>
8098
8099         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8100         prev_data_size_ and prev_addralign_.  Remove initializer for
8101         deleted data member has_been_changed_.
8102         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8103         to determine if the table is empty.
8104         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8105         Remove.
8106         (Stub_table::add_reloc_stub): Define method in class definition
8107         instead of just declaring it there.
8108         (Stub_table::add_cortex_a8_stub): New method definition.
8109         (Stub_table::update_data_size_and_addralign): Ditto.
8110         (Stub_table::finalize_stubs): Ditto.
8111         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8112         (Stub_table::do_addralign_): Return address alignment in the
8113         (Stub_table::do_reset_address_and_file_offset): Define method in
8114         class definition instead of declaring it there.  Set current data
8115         size to be the data size of the previous pass.
8116         (Stub_table::set_final_data_size): Use current data size as the
8117         final data size.
8118         (Stub_table::relocate_stub): Change parameter type of stub from
8119         Reloc_stub pointer to Stub pointer.
8120         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8121         (Stub_table::Cortex_a8_stub_list): New typedef.
8122         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
8123          Stub_table::prev_addralign_): New data member.
8124         (Arm_relobj::Arm_relobj): Initialize data member
8125         section_has_cortex_a8_workaround_.
8126         (Arm_relobj::section_has_cortex_a8_workaround,
8127          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
8128          definitions.
8129         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
8130         declarations.
8131         (Target_arm::relocate_stub): Change parameter type of stub from
8132         Reloc_stub pointer to Stub pointer.
8133         (Insn_template::size, Insn_template::alignment): Handle
8134         THUMB16_SPECIAL_TYPE.
8135         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
8136          Stub_table::update_data_size_and_addralign,
8137          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
8138         definitions.
8139         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
8140         (Stub_table::do_write): Ditto.
8141         (Target_arm::do_relax): Adjust code for changes in Stub_table.
8142
8143 2010-01-08  Ian Lance Taylor  <iant@google.com>
8144
8145         PR 11108
8146         * symtab.h (class Symbol): Remove fields is_target_special_ and
8147         has_plt_offset_.  Add field is_defined_in_discarded_section_.
8148         (Symbol::is_defined_in_discarded_section): New function.
8149         (Symbol::set_is_defined_in_discarded_section): New function.
8150         (Symbol::has_plt_offset): Rewrite.
8151         (Symbol::set_plt_offset): Verify that new offset is not -1U.
8152         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
8153         Don't initialize is_target_special_ or has_plt_offset_.
8154         Initialize is_defined_in_discarded_section_.
8155         (Symbol_table::add_from_relobj): If appropriate, set
8156         is_defined_in_discarded_section.
8157         * resolve.cc (Symbol::override_base_with_special): Don't test
8158         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
8159         * target-reloc.h (relocate_section): Do special handling for
8160         symbols defined in discarded sections for global symbols as well
8161         as local symbols.
8162
8163 2010-01-08  Ian Lance Taylor  <iant@google.com>
8164
8165         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
8166         the SHT_SYMTAB case.
8167
8168 2010-01-08  Ian Lance Taylor  <iant@google.com>
8169
8170         * object.cc (Sized_relobj::do_layout): Don't get confused if
8171         layout_eh_frame returns NULL.
8172
8173 2010-01-08  Ian Lance Taylor  <iant@google.com>
8174
8175         PR 11084
8176         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
8177         dynamic symbol table, use the normal symbol table.
8178         (Sized_dynobj::do_read_symbols): Remove assertion about type of
8179         symbol table.
8180
8181 2010-01-08  Ian Lance Taylor  <iant@google.com>
8182
8183         PR 11072
8184         * layout.cc (Layout::include_section): Remove .gnu_debuglink
8185         sections.
8186
8187 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
8188
8189         * version.cc (print_version): Change to "Copyright 2010".
8190
8191 2010-01-08  Ian Lance Taylor  <iant@google.com>
8192
8193         PR 10287
8194         PR 11063
8195         * i386.cc (class Target_i386): Change return type of plt_section
8196         to be non-const.
8197         (class Output_data_plt_i386): Add tls_desc_rel_ field.
8198         (Output_data_plt_i386::Output_data_plt_i386): Initialize
8199         tls_desc_rel_ field.
8200         (Output_data_plt_i386::rel_tls_desc): New function.
8201         (Target_i386::rel_tls_desc_section): New function.
8202         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
8203         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
8204         R_386_TLS_DESC reloc in rel_tls_desc_section.
8205         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
8206         Define struct Tlsdesc_info.
8207         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
8208         (Target_x86_64::do_reloc_symbol_index): New function.
8209         (Target_x86_64::add_tlsdesc_info): New function.
8210         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
8211         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
8212         tlsdesc_rel_ field.
8213         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
8214         all callers.
8215         (Output_data_plt_x86_64::rela_tlsdesc): New function.
8216         (Target_x86_64::rela_tlsdesc_section): New function.
8217         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
8218         handling.
8219         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
8220         (Target_x86_64::do_reloc_addend): New function.
8221         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
8222         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
8223         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
8224         (Output_reloc::type): New function.
8225         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
8226         (Output_reloc::is_target_specific): New function.
8227         (Output_reloc::target_arg): New function.
8228         (class Output_reloc) [SHT_RELA]: Add four new constructors for
8229         absolute relocs and target specific relocs.
8230         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
8231         add_target_specific.
8232         (class Output_data_reloc) [SHT_RELA]: Likewise.
8233         * output.cc (Output_reloc::Output_reloc): Add four new versions
8234         for absolute relocs and target specific relocs.
8235         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
8236         (Output_reloc::get_symbol_index): Likewise.
8237         (Output_reloc::local_section_offset): Check that local_sym_index_
8238         is not TARGET_CODE or 0.
8239         (Output_reloc::symbol_value): Likewise.
8240         (Output_reloc::write) [SHT_RELA]: Call target for target specific
8241         reloc.
8242         * target.h (class Target): Add reloc_symbol_index and reloc_addend
8243         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
8244         functions.
8245         * layout.cc (add_target_dynamic_tags): Use output section for
8246         DT_PLTRELSZ and DT_JMPREL.
8247
8248 2010-01-07  Ian Lance Taylor  <iant@google.com>
8249
8250         PR 11061
8251         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
8252         function.
8253         (class Output_data_reloc_generic): Define.
8254         (class Output_data_reloc_base): Change base class to
8255         Output_data_reloc_generic.  Change add() method to call
8256         bump_relative_reloc_count for a relative reloc.  Remove
8257         sort_relocs_ field.
8258         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
8259         to sort_relocs().
8260         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
8261         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
8262         appropriate.
8263         * layout.h (class Layout): Update declaration.
8264
8265 2010-01-07  Ian Lance Taylor  <iant@google.com>
8266
8267         * output.h (class Output_data): Add const version of
8268         output_section and do_output_section.
8269         (class Output_section_data): Add const version of
8270         do_output_section.
8271         (class Output_section): Likewise.
8272         * layout.cc (Layout::add_target_dynamic_tags): New function.
8273         * layout.h (class Layout): Update declarations.
8274         * arm.cc (Target_arm::do_finalize_sections): Use
8275         add_target_dynamic_tags.
8276         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8277         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
8278         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
8279         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8280
8281 2010-01-07  Ian Lance Taylor  <iant@google.com>
8282
8283         PR 11042
8284         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
8285         object as needed.
8286
8287 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
8288             Ian Lance Taylor  <iant@google.com>
8289
8290         PR 11019
8291         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
8292         Xindex::read_symtab_xindex.
8293
8294 2010-01-07  Doug Kwan  <dougkwan@google.com>
8295
8296         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
8297         (Insn_template::thumb16_bcond_insn): New method declaration.
8298         (Insn_template): Fix spelling.
8299         (Stub::thumb16_special): New method declaration.
8300         (Stub::do_write): Define virtual method which was previously pure
8301         virtual.
8302         (Stub::do_thumb16_special): New method declaration.
8303         (Stub::do_fixed_endian_write): New template member.
8304         (Reloc_stub::do_write): Remove.
8305         (Reloc_stub::do_fixed_endian_write): Remove.
8306         (Cortex_a8_stub): New class definition.
8307         (Stub_factory::make_cortex_a8_stub): New method definition.
8308         (Stub_factory::Stub_factory): Add missing static storage class
8309         qualifier for elf32_arm_stub_a8_veneer_blx.
8310
8311 2010-01-07  Ian Lance Taylor  <iant@google.com>
8312
8313         PR 10980
8314         * options.h (class General_options): Add --warn-unresolved-symbols
8315         and --error-unresolved-symbols.
8316         * errors.cc (Errors::undefined_symbol): Implement
8317         --warn-unresolved-symbols.
8318
8319         * options.h (class General_options): Add -z text and -z textoff.
8320         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
8321
8322 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
8323
8324         * gc.h (Garbage_collection::Cident_section_map): New typedef.
8325         (Garbage_collection::cident_sections): New function.
8326         (Garbage_collection::add_cident_section): New function.
8327         (Garbage_collection::cident_sections_): New member.
8328         (gc_process_relocs): Add references to sections whose names are C
8329         identifiers.
8330         * gold.h (cident_section_start_prefix): New constant.
8331         (cident_section_stop_prefix): New constant.
8332         (is_cident): New function.
8333         * layout.cc (Layout::define_section_symbols): Replace string constants
8334         with the newly defined constants.
8335         * object.cc (Sized_relobj::do_layout): Track sections whose names are
8336         C identifiers.
8337         * testsuite/Makefile.am: Add gc_orphan_section_test.
8338         * testsuite/Makefile.in: Regenerate.
8339         * testsuite/gc_orphan_section_test.cc: New file.
8340         * testsuite/gc_orphan_section_test.sh: New file.
8341
8342 2010-01-06  Ian Lance Taylor  <iant@google.com>
8343
8344         PR 10980
8345         * options.h (class General_options): Add --warn-shared-textrel.
8346         * layout.cc (Layout::finish_dynamic_section): Implement
8347         --warn-shared-textrel.
8348
8349         PR 10980
8350         * options.h (class General_options): Add --warn-multiple-gp.
8351
8352 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8353
8354         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
8355         $(THREADSLIB) and $(LIBDL).
8356         * Makefile.in: Rebuild.
8357
8358 2010-01-06  Ian Lance Taylor  <iant@google.com>
8359
8360         PR 10980
8361         * options.cc (General_options::parse_section_start): New function.
8362         (General_options::section_start): New function.
8363         (General_options::General_options): Initialize all members.
8364         * options.h: Include <map>
8365         (class General_options): Add --section-start.  Add section_starts_
8366         member.
8367         * layout.cc (Layout::attach_allocated_section_to_segment): If
8368         --section-start was used, set the address of the segment.  Remove
8369         local sort_sections.
8370         (Layout::relaxation_loop_body): If the address of the load segment
8371         has been set by --section-start, don't use it.
8372         * output.h (Output_segment::update_flags_for_output_section): New
8373         function.
8374         * output.cc (Output_segment::add_output_section): Call
8375         update_flags_for_output_section.
8376
8377 2010-01-05  Ian Lance Taylor  <iant@google.com>
8378
8379         PR 10980
8380         * options.h (class General_options): Add --undefined-version.
8381         * script.cc (struct Version_expression): Add was_matched_by_symbol
8382         field.
8383         (Version_script_info::matched_symbol): New function.
8384         (Version_script_info::get_symbol_version_helper): Call
8385         matched_symbol.
8386         (Version_script_info::check_unmatched_names): New function.
8387         * script.h (class Version_script_info): Update declarations.
8388         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
8389
8390         * options.h (class General_options): Use DEFINE_bool_alias for
8391         allow_multiple_definition.
8392         * resolve.cc (Symbol_table::should_override): Don't test
8393         allow_multiple_definition.
8394
8395         PR 10980
8396         * options.h (class General_options): Add --cref.
8397         * main.cc (main): Print cref table if --cref.  Don't close mapfile
8398         until after printing cref table.
8399         * cref.cc: Include "symtab.h".
8400         (class Cref_inputs): Define Cref_table_compare and Cref_table.
8401         (Cref_table_compare::operator()): New function.
8402         (Cref_inputs::gather_cref): New function.
8403         (filecol): New static const.
8404         (Cref_inputs::print_cref): New function.
8405         (Cref::print_cref): New function.
8406         * cref.h: Include <cstdio>.
8407         (class Cref): Update declarations.
8408         * mapfile.h (Mapfile::file): New function.
8409         * object.h (class Object): Define Symbols.  Declare virtual
8410         do_get_global_symbols.
8411         (Object::get_global_symbols): New function.
8412         * object.cc (Input_objects::add_object): Pass object to cref_ if
8413         --cref.
8414         (Input_objects::archive_start): Likewise.
8415         (Input_objects::archive_stop): Likewise.
8416         (Input_objects::print_cref): New function.
8417         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
8418         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
8419         --cref.
8420         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
8421         function.
8422         * plugin.h (class Sized_pluginobj): Update declarations.
8423
8424 2010-01-05  Ian Lance Taylor  <iant@google.com>
8425
8426         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
8427         to is_default_version.  Rename insdef to insdefault.
8428         (Symbol_table::add_from_relobj): Rename def to is_default_version
8429         and local to is_forced_local.
8430         (Symbol_table::add_from_pluginobj): Likewise.
8431         (Symbol_table::add_from_dynobj): Likewise.
8432         (Symbol_table::define_special_symbol): Rename insdef to
8433         insdefault.
8434
8435 2010-01-04  Ian Lance Taylor  <iant@google.com>
8436
8437         PR 10980
8438         * options.h (class General_options): Add
8439         --allow-multiple-definition and -z muldefs.
8440         * resolve.cc (Symbol_table::should_override): Don't warn about a
8441         multiple symbol definition if --allow-multiple-definition or -z
8442         muldefs.
8443
8444         PR 10980
8445         * options.h (class General_options): Add --add-needed and
8446         --copy-dt-needed-entries.  Tweak --as-needed help entry.
8447         * object.cc (Input_objects::check_dynamic_dependencies): Give an
8448         error if --copy-dt-needed-entries aka --add-needed is used and
8449         would cause a change in behaviour.
8450
8451         PR 10980
8452         * options.h (class General_options): Add -G as a short version of
8453         --shared.  Add no-op options -assert, -g, and -i.
8454
8455 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
8456
8457         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
8458         check for .text or .gnu.linkonce.t sections.
8459         * icf.cc (Icf::find_identical_sections): Ditto.
8460         Change the detection for mangled function name within the section
8461         name.
8462         * icf.h (is_section_foldable_candidate): New function.
8463
8464 2009-12-30  Ian Lance Taylor  <iant@google.com>
8465
8466         PR 10980
8467         * options.h (class General_options): Permit two dashes with
8468         --retain-symbols-file.
8469
8470 2009-12-30  Ian Lance Taylor  <iant@google.com>
8471
8472         PR 10979
8473         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
8474         don't put the file header and segment headers in the text
8475         segment.
8476
8477         PR 10979
8478         * common.cc (Sort_commons::operator()): Stabilize sort when both
8479         entries are NULL.
8480         (Symbol_table::do_allocate_commons_list): When allocating common
8481         symbols, skip a symbol which is no longer common.
8482         * symtab.h (Symbol::is_common): Test whether the symbol comes from
8483         an object before checking its type.
8484         * testsuite/common_test_2.c: New file.
8485         * testsuite/common_test_3.c: New file.
8486         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
8487         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
8488         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
8489         (common_test_2_pic.o, common_test_2.so): New targets.
8490         (common_test_3_pic.o, common_test_3.so): New targets.
8491         * testsuite/Makefile.in: Rebuild.
8492
8493         PR 10979
8494         * script.cc (read_input_script): If we see a new SECTIONS clause,
8495         and we have added an input section, give an error.
8496         * layout.h (class Layout): Add have_added_input_section function.
8497         Add have_added_input_section_ field.
8498         * layout.cc (Layout::Layout): Initialize
8499         have_added_input_section_.
8500         (Layout::layout): Set have_added_input_section_.
8501         (Layout::layout_eh_frame): Likewise.
8502
8503 2009-12-30  Ian Lance Taylor  <iant@google.com>
8504
8505         PR 10931
8506         * options.h (class General_options): Add --sort-common option.
8507         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
8508         * common.cc (Sort_common): Add sort_order parameter to
8509         constructor.  Add sort_order_ field.
8510         (Sort_commons::operator): Check sort_order_.
8511         (Symbol_table::allocate_commons): Determine the sort order.
8512         (Symbol_table::do_allocate_commons): Add sort_order parameter.
8513         Change all callers.
8514         (Symbol_table::do_allocate_commons_list): Likewise.
8515
8516 2009-12-30  Ian Lance Taylor  <iant@google.com>
8517
8518         PR 10916
8519         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
8520         symbols from this object, don't change the visibility of an
8521         undefined symbol.
8522         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
8523
8524 2009-12-30  Ian Lance Taylor  <iant@google.com>
8525
8526         PR 10861
8527         * script.h (class Version_script_info): Define Language enum.
8528         Update declarations.  Define Glob, Exact, and Lookup types.  Add
8529         new fields globals_, locals_, and is_finalized_.
8530         * script.cc: Various formatting fixes.
8531         (class Parser_closure): Change language_stack_ from a vector of
8532         std::string to one of Version_script_info::Language.  Adjust all
8533         uses accordingly.
8534         (class Lazy_demangler): Remove.
8535         (struct Version_expression): Change language from std::string to
8536         Version_script_info::Language.
8537         (Version_script_info::Version_script_info): New function.
8538         (Version_script_info::~Version_script_info): Don't call clear.
8539         (Version_script_info::finalize): New function.
8540         (Version_script_info::build_lookup_tables): New function.
8541         (Version_script_info::build_expression_list_lookup): New
8542         function.
8543         (Version_script_info::get_symbol_version_helper): Rewrite to use
8544         lookup tables.
8545         (Version_script_info::print_expression_list): Adjust to use
8546         Version_script_info::Language.
8547         (script_push_lex_into_version_mode): Check that the version script
8548         has not been finalized.
8549         (version_script_push_lang): Change language string to
8550         Version_script_info::Language.
8551         * options.cc (Command_line::version_script): New function.
8552         * options.h (class General_options): Add finalize_dynamic_list
8553         function.  Change version_script from declaration to definition.
8554         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
8555         * testsuite/version_script.map: Remove duplicate def of foo.
8556         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
8557         version_script.map.
8558         * testsuite/Makefile.in: Rebuild.
8559
8560 2009-12-30  Ian Lance Taylor  <iant@google.com>
8561
8562         PR 10843
8563         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
8564         if the input symbol index is 0, make the output symbol index 0.
8565
8566 2009-12-30  Ian Lance Taylor  <iant@google.com>
8567
8568         PR 10670
8569         * options.h (class General_options): Add -x/--discard-all.
8570         * object.cc (Sized_relobj::do_count_local_symbols): Handle
8571         --discard-all.  If the local symbol needs a dynamic entry, check
8572         that before handling --discard-locals.
8573
8574 2009-12-30  Ian Lance Taylor  <iant@google.com>
8575
8576         PR 10450
8577         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
8578         flags to PF_R.
8579         (Output_segment::add_output_section): Don't change the flags if
8580         the type is PT_TLS.
8581
8582         PR 10450
8583         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
8584         GNU hash table if they need a dynamic value.  Otherwise, don't add
8585         them if they are defined in a dynamic object or are forced local.
8586
8587 2009-12-29  Ian Lance Taylor  <iant@google.com>
8588
8589         PR 10450
8590         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
8591         .gnu.hash table for a 32-bit target.
8592
8593         PR 10450
8594         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
8595         regular and a dynamic object only needs a dynamic symbol table
8596         entry if it is externally visible.
8597
8598         PR 10450
8599         * i386.cc (class Target_i386): Initialize global_offset_table_ in
8600         constructor.  Add global_offset_table_ field.
8601         (Target_i386::got_section): Set global_offset_table_.
8602         (Target_i386::do_finalize_sections): Set global_offset_table_
8603         size.
8604         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
8605         in constructor.  Add global_offset_table_ field.
8606         (Target_x86_64::got_section): Set global_offset_table_.
8607         (Target_x86_64::do_finalize_sections): Set global_offset_table_
8608         size.
8609
8610         * layout.cc (Layout::Layout): Initialize increase_relro_.
8611         (Layout::get_output_section): Add is_relro, is_last_relro, and
8612         is_first_non_relro parameters.  Change all callers.
8613         (Layout::choose_output_section): Likewise.
8614         (Layout::add_output_section_data): Likewise.
8615         (Layout::make_output_section): Likewise.
8616         (Layout::set_segment_offsets): Clear increase_relro when using a
8617         linker script.
8618         * layout.h (class Layout): Add increase_relro method.  Add
8619         increase_relro_ field.  Update declarations.
8620         * output.cc (Output_section::Output_section): Initialize
8621         is_last_relro_ and is_first_non_relro_.
8622         (Output_segment::add_output_section): Group relro sections is
8623         do_sort is true.  Handle is_last_relro and is_first_non_relro.
8624         (Output_segment::maximum_alignment): Remove relro handling.
8625         (Output_segment::set_section_addresses): Add increase_relro
8626         parameter.  Change all callers.  Add initial alignment to align
8627         relro sections on separate page.  Remove old relro handling.
8628         (Output_segment::set_section_list_addresses): Remove in_relro
8629         parameter.  Change all callers.
8630         (Output_segment::set_offset): Add increase parameter.  Change all
8631         callers.  Remove old relro handling.
8632         * output.h (class Output_section): Add new methods: is_last_relro,
8633         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
8634         Add is_last_relro_ and is_first_non_relro_ fields.
8635         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
8636         Create separate .got.plt section.  Call increase_relro.
8637         * x86_64.cc (Target_x86_64::got_section): Likewise.
8638         * testsuite/relro_script_test.t: Add .got.plt.
8639
8640         PR 10450
8641         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
8642         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
8643         (Layout::finalize): Call set_dynamic_symbol_size.
8644         (Layout::set_dynamic_symbol_size): New function.
8645         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
8646         set_dynamic_symbol_size.
8647
8648         PR 10450
8649         * output.h (class Output_section): Add is_entsize_zero_ field.
8650         * output.cc (Output_section::Output_section): Initialize
8651         is_entsize_zero_.
8652         (Output_section::set_entsize): If two different entsizes are
8653         requested, force it to zero.
8654         (Output_section::add_input_section): Set flags for .debug_str
8655         before updating section flags.  Set entsize.
8656         (Output_section::update_flags_for_input_section): Set SHF_MERGE
8657         and SHF_STRING if all input sections have those flags.
8658
8659 2009-12-29   Rafael Espindola  <espindola@google.com>
8660
8661         * main.cc (main): Fix the sys time reporting.
8662         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
8663         reporting.
8664
8665 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
8666
8667         * options.cc (General_options::parse_version): Allow -v to exit
8668         without an error if there is nothing to link.
8669
8670 2009-12-29  Ian Lance Taylor  <iant@google.com>
8671
8672         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
8673         using a version of gcc before 4.1.
8674         * configure: Rebuild.
8675
8676 2009-12-28  Chris Demetriou  <cgd@google.com>
8677
8678         * attributes.cc (Output_attributes_section_data::do_write): Use
8679         std::vector::front rather than std::vector::data.
8680
8681 2009-12-28  Ian Lance Taylor  <iant@google.com>
8682
8683         * symtab.h (class Symbol_table): Add enum Defined.
8684         * resolve.cc (Symbol_table::should_override): Add defined
8685         parameter.  Change all callers.  Test whether object is NULL
8686         before calling a method on it.
8687         (Symbol_table::report_resolve_problem): Add defined parameter.
8688         Change all callers.
8689         (Symbol_table::should_override_with_special): Likewise.
8690         * symtab.cc (Symbol_table::define_in_output_data): Add defined
8691         parameter.  Change all callers.
8692         (Symbol_table::do_define_in_output_data): Likewise.
8693         (Symbol_table::define_in_output_segment): Likewise.
8694         (Symbol_table::do_define_in_output_segment): Likewise.
8695         (Symbol_table::define_as_constant): Likewise.
8696         (Symbol_table::do_define_as_constant): Likewise.
8697         * script.h (class Symbol_assignment): Add is_defsym parameter to
8698         constructor; change all callers.
8699         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
8700         parameter.  Change all callers.  Add is_defsym_ field.
8701         (class Parser_closure): Add parsing_defsym parameter to
8702         constructor; change all callers.  Add parsing_defsym accessor
8703         function.  Add parsing_defsym_ field.
8704
8705 2009-12-28  Ian Lance Taylor  <iant@google.com>
8706
8707         * gold.cc (queue_middle_tasks): Fix formatting.
8708         * object.cc (Relobj::is_section_name_included): Likewise.
8709
8710 2009-12-23  Ian Lance Taylor  <iant@google.com>
8711
8712         * i386.cc (Target_i386::do_calls_non_split): Recognize
8713         -fsplit-stack prologue for a function with a static chain.
8714         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
8715         -fsplit-stack prologue when using %r11.
8716
8717 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
8718
8719         * options.cc (General_options::parse_version): Make -v continue and do
8720         the link like GNU ld does.
8721
8722 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
8723
8724         * Makefile.am (CCFILES): Add timer.cc.
8725         (HFILES): Add timer.h.
8726         * configure.ac: Check for sysconf and times.
8727         * main.cc: include timer.h.
8728         (main): Use Timer instead of get_run_time.
8729         * timer.cc: New.
8730         * timer.h: New.
8731         * workqueue.cc: include timer.h.
8732         (Workqueue::find_and_run_task):
8733         Report user, sys and wall time.
8734         * Makefile.in: Regenerate.
8735         * config.in: Regenerate.
8736         * configure: Regenerate.
8737
8738 2009-12-16  Doug Kwan  <dougkwan@google.com>
8739
8740         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
8741         sections.
8742         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
8743         relaxed input sections.
8744         * output.cc (Output_section::find_relaxed_input_section): Change
8745         return type to Output_relaxed_input_section pointer.  Adjust code
8746         for new type of relaxed_input_section_map_.
8747         * output.h (Output_section::find_relaxed_input_section): Change
8748         return type to Output_relaxed_input_section pointer.
8749         (Output_section::Output_relaxed_input_section_by_input_section_map):
8750         New type.
8751         (Output_section::relaxed_input_section_map_): Change type to
8752         Output_section::Output_relaxed_input_section_by_input_section_map.
8753         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
8754         input section.
8755
8756 2009-12-15  Ian Lance Taylor  <iant@google.com>
8757
8758         * layout.cc (Layout::create_shstrtab): Only write out after input
8759         sections if we are compressing debug sections.
8760
8761 2009-12-15  Ian Lance Taylor  <iant@google.com>
8762
8763         * archive.cc (Archive::add_symbols): Only look up a symbol without
8764         a version if there is, in fact, a version.
8765
8766 2009-12-14  Ian Lance Taylor  <iant@google.com>
8767
8768         Revert -Wshadow changes, all changes from:
8769         2009-12-11  Doug Kwan  <dougkwan@google.com>
8770         2009-12-11  Nick Clifton  <nickc@redhat.com>
8771         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
8772
8773 2009-12-11  Doug Kwan  <dougkwan@google.com>
8774
8775         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
8776         due to -Wshadow.
8777         * attributes.cc (Object_attribute::size): Ditto.
8778         (Attributes_section_data::size): Ditto.
8779         (Attributes_section_data::Attributes_section_data): Ditto.
8780         (Output_attributes_section_data::do_write): Ditto.
8781         * attributes.h (Object_attribute::set_type): Ditto.
8782         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
8783
8784 2009-12-11  Nick Clifton  <nickc@redhat.com>
8785
8786         * archive.cc: Fix shadowed variable warnings.
8787         * arm.cc: Likewise.
8788         * compressed_output.cc: Likewise.
8789         * compressed_output.h: Likewise.
8790         * configure: Likewise.
8791         * dwarf_reader.cc: Likewise.
8792         * dynobj.cc: Likewise.
8793         * dynobj.h: Likewise.
8794         * ehframe.cc: Likewise.
8795         * ehframe.h: Likewise.
8796         * errors.cc: Likewise.
8797         * expression.cc: Likewise.
8798         * fileread.cc: Likewise.
8799         * fileread.h: Likewise.
8800         * freebsd.h: Likewise.
8801         * i386.cc: Likewise.
8802         * icf.cc: Likewise.
8803         * incremental.h: Likewise.
8804         * layout.cc: Likewise.
8805         * layout.h: Likewise.
8806         * mapfile.cc: Likewise.
8807         * merge.cc: Likewise.
8808         * merge.h: Likewise.
8809         * object.cc: Likewise.
8810         * object.h: Likewise.
8811         * options.h: Likewise.
8812         * output.cc: Likewise.
8813         * output.h: Likewise.
8814         * parameters.cc: Likewise.
8815         * plugin.cc: Likewise.
8816         * powerpc.cc: Likewise.
8817         * reduced_debug_output.cc: Likewise.
8818         * reduced_debug_output.h: Likewise.
8819         * reloc.cc: Likewise.
8820         * reloc.h: Likewise.
8821         * resolve.cc: Likewise.
8822         * script-sections.cc: Likewise.
8823         * script.cc: Likewise.
8824         * script.h: Likewise.
8825         * sparc.cc: Likewise.
8826         * symtab.cc: Likewise.
8827         * symtab.h: Likewise.
8828         * target-select.cc: Likewise.
8829         * target-select.h: Likewise.
8830         * token.h: Likewise.
8831         * workqueue.cc: Likewise.
8832         * workqueue.h: Likewise.
8833         * x86_64.cc: Likewise.
8834
8835 2009-12-10  Doug Kwan  <dougkwan@google.com>
8836
8837         * arm.cc (attributes.h): New include.
8838         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
8839         (Arm_relobj::~Arm_relobj): Delete object pointed by
8840         attributes_section_data_.
8841         (Arm_relobj::attributes_section_data): New method definition.
8842         (Arm_relobj::attributes_section_data_): New data member declaration.
8843         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
8844         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
8845         attributes_section_data_.
8846         (Arm_dynobj::attributes_section_data): New method definition.
8847         (Arm_dynobj::attributes_section_data_): New data member declaration.
8848         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
8849         initialization value of may_use_blx_ to false.
8850         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
8851         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
8852         object attributes to compute results instead of hard-coding.
8853         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
8854         Target_arm::get_secondary_compatible_arch,
8855         Target_arm::set_secondary_compatible_arch
8856         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8857         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
8858         New method declarations.
8859         (Target_arm::get_aeabi_object_attribute): New method definition.
8860         (Target_arm::attributes_section_data_): New data member declaration.
8861         (read_arm_attributes_section): New template definition.
8862         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
8863         (Arm_dynobj::do_read_symbols): Ditto.
8864         (Target_arm::do_finalize_sections): Merge attributes sections from
8865         input.  Check for BLX use after attributes section merging.
8866         Fix __exidx_start and __exidx_end visibility.  Create an
8867         .ARM.attributes section if necessary.
8868         (Target_arm::get_secondary_compatible_arch,
8869         Target_arm::set_secondary_compatible_arch,
8870         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
8871         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
8872         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
8873         New method definitions.
8874
8875 2009-12-09  Ian Lance Taylor  <iant@google.com>
8876
8877         * plugin.cc (Plugin::load): Don't cast from void* to a function
8878         pointer.
8879
8880 2009-12-09  Ian Lance Taylor  <iant@google.com>
8881
8882         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
8883         information fields.
8884
8885 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
8886
8887         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
8888         Replace two_file_shared_1.so with two_file_shared_2.so.
8889         * testsuite/Makefile.in: Regenerated.
8890
8891 2009-12-08  Doug Kwan  <dougkwan@google.com>
8892
8893         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
8894         (HFILES): Add attributes.h and int_encoding.h.
8895         * Makefile.in: Regenerate.
8896         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
8897         function definitions to int_encoding.cc
8898         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
8899         prototypes to int_encoding.h
8900         * reduced_debug_output.cc (int_encoding.h): New include.
8901         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
8902         function definitions to int_encoding.cc
8903         (insert_into_vector, read_from_pointer): Move template definitions to
8904         int_encoding.h
8905         * attributes.cc: New file.
8906         * attributes.h: New file.
8907         * int_encoding.cc: New file.
8908         * int_encoding.h: New file.
8909
8910 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
8911
8912         PR gold/11055
8913         * incremental-dump.cc (dump_incremental_inputs): New.
8914         (main): Use dump_incremental_inputs.
8915
8916 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
8917
8918         PR gold/10893
8919         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
8920         checking elfcpp::STT_FUNC.
8921         (Target_i386::Relocate::relocate): Likewise.
8922         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
8923
8924         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
8925         symbols from shared libraries into normal FUNC symbols.
8926
8927         * symtab.h (Symbol): Add is_func and use it.
8928
8929 2009-12-05  Doug Kwan  <dougkwan@google.com>
8930
8931         * arm.cc (Target_arm::arm_info): Initialize new fields
8932         attributes_section and attributes_vendor.
8933         * i386.cc (Target_i386::i386_info): Same.
8934         * object.cc (Sized_relobj::do_layout): Skip attribute section.
8935         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
8936         fields attributes_section and attributes_vendor.
8937         * sparc.cc (Target_sparc::sparc_info): Same.
8938         * target.h (Target::attributes_section, Target::attributes_vendor,
8939         Target::is_attributes_section, Target::attribute_arg_type,
8940         Target::attributes_order): New method definitions.
8941         (Target::Target_info::attributes_section,
8942         Target::Target_info::attributes_vendor): New fields.
8943         (Target::do_attribute_arg_type, Target::do_attributes_order): New
8944         virtual method definitions.
8945         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
8946         attributes_section and attributes_vendor.
8947         * testsuite/testfile.cc (Target_test::test_target_info): Same.
8948
8949 2009-12-05  Doug Kwan  <dougkwan@google.com>
8950
8951         * arm.cc: Update comments about interworking and stub generation.
8952         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
8953         considered as non-PIC.
8954         (Arm_relocate_functions::base_abs): Fix formatting.
8955         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
8956         of function to use GOT entry address instead of offset.
8957         (Target_arm::Scan::global): Issue an error if a symbol would need a
8958         PLT does not get one because it is untyped.  Remove code to create
8959         dynamic symbols for relative branches.
8960         (Target_arm::Relocate::relocate: Use 0 instead of false since function
8961         takes unsigned integer instead of boolean.
8962
8963 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
8964
8965         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
8966         (two_file_test_LDADD): Likewise.
8967         (common_test_1_LDADD): Likewise.
8968         (exception_test_LDADD) Likewise.
8969         (weak_test_LDADD): Likewise.
8970         (many_sections_test_LDADD): Likewise.
8971         (initpri1_LDADD): Likewise.
8972         (script_test_1_LDADD): Likewise.
8973         (script_test_2_LDADD): Likewise.
8974         (justsyms_LDADD): Likewise.
8975         (binary_test_LDADD): Likewise.
8976         (large_LDADD): Likewise.
8977         * testsuite/Makefile.in: Regenerated.
8978
8979 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
8980
8981         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
8982         (Symbol_table::override_with_special): Likewise.
8983         (Symbol_table::add_from_object): Likewise.
8984
8985 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8986
8987         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
8988         Don't set the data_offset twice.
8989
8990 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
8991
8992         * testsuite/Makefile.in: Regenerate.
8993
8994 2009-12-03  Doug Kwan  <dougkwan@google.com>
8995
8996         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
8997         (Target_arm::do_finalize_sections): Add parameter for symbol table
8998         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
8999         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9000         parameter for symbol table pointer.
9001         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9002         an additional parameter for a pointer to symbol table.
9003         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9004         parameter for a symbol table pointer.
9005         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9006         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9007         Ditto.
9008         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9009         parameter for a symbol table pointer.
9010
9011 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9012
9013         * incremental.cc (Incremental_inputs_header)
9014         (Incremental_inputs_header_write, Incremental_inputs_entry)
9015         (Incremental_inputs_entry_write): Move ...
9016         * incremental.h (Incremental_inputs_header)
9017         (Incremental_inputs_header_write, Incremental_inputs_entry)
9018         (Incremental_inputs_entry_write): here.
9019
9020 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9021
9022         * incremental.cc (make_sized_incremental_binary): Set the target.
9023         Error if it is incompatible.
9024         * output.h (Output_file): Add filename method.
9025
9026 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9027
9028         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9029         from the get_* methods.
9030
9031 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9032
9033         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9034         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9035         Write 0 for the data_offset of scripts.
9036
9037 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9038
9039         * testsuite/Makefile.am: Add the incremental_test.sh test.
9040         * testsuite/incremental_test.sh: New.
9041         * testsuite/incremental_test_1.c: New.
9042         * testsuite/incremental_test_2.c: New.
9043
9044 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9045
9046         * incremental-dump.cc (main): Fix typos.
9047
9048 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9049
9050         PR gold/11025
9051         * incremental-dump.cc (main): Use llu to print 64 bit values.
9052
9053 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9054             H.J. Lu  <hongjiu.lu@intel.com>
9055
9056         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9057         $(LIBDL).
9058         (incremental_dump_LDADD): Likewise.
9059         * Makefile.in: Regenerated.
9060
9061 2009-11-25  Doug Kwan  <dougkwan@google.com>
9062
9063         Revert:
9064
9065         2009-11-25  Doug Kwan  <dougkwan@google.com>
9066
9067                 * arm.cc (Target_arm::Target_arm): Move method definition
9068                 outside of class definition.  Add code to handle
9069                 --target1-rel, --target1-abs and --target2= options.
9070                 (Target_arm::get_reloc_reloc_type): Change method to be
9071                 non-static and const.
9072                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9073                 New data member declaration.
9074                 (Target_arm::Scan::local, Target_arm::Scan::global,
9075                 Target_arm::Relocate::relocate,
9076                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9077                 Adjust call to Target_arm::get_real_reloc_type.
9078                 (Target_arm::get_real_reloc_type): Use command line options
9079                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9080                 * options.h (--target1-rel, --target1-abs, --target2): New
9081                 ARM-only options.
9082
9083 2009-11-25  Doug Kwan  <dougkwan@google.com>
9084
9085         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9086         class definition.  Add code to handle --target1-rel, --target1-abs
9087         and --target2= options.
9088         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9089         and const.
9090         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9091         member declaration.
9092         (Target_arm::Scan::local, Target_arm::Scan::global,
9093         Target_arm::Relocate::relocate,
9094         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9095         call to Target_arm::get_real_reloc_type.
9096         (Target_arm::get_real_reloc_type): Use command line options to
9097         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9098         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9099         options.
9100
9101 2009-11-25  Doug Kwan  <dougkwan@google.com>
9102
9103         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9104         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9105         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9106         formatting.
9107         (Arm_relocate_functions::thm_call): Replace body with a call to
9108         Arm_relocate_functions::thumb_branch_common.
9109         (Arm_relocate_functions::thm_jump24,
9110         Arm_relocate_functions::thm_xpc22): New method definitions.
9111         (Arm_relocate_functions::thumb_branch_common): New method definition.
9112         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9113         operator.
9114         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9115         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9116
9117 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9118
9119         * Makefile.am: Build incremental-dump
9120         * Makefile.in: Regenerate.
9121         * incremental-dump.cc: New.
9122         * incremental.cc (Incremental_inputs_header_data,
9123         Incremental_inputs_entry_data): Move to incremental.h
9124         * incremental.h: (Incremental_inputs_header_data,
9125         Incremental_inputs_entry_data): Move from incremental.cc
9126
9127 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9128
9129         * incremental.cc (Incremental_inputs_header,
9130         Incremental_inputs_header_write, Incremental_inputs_entry,
9131         Incremental_inputs_entry_write): Add a typedef with the data type.
9132
9133 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9134
9135         * incremental.cc (Incremental_inputs_header,
9136         Incremental_inputs_header_write, Incremental_inputs_entry,
9137         Incremental_inputs_entry_write): Update comment about which
9138         type has the filed descriptions.
9139
9140 2009-11-15  Doug Kwan  <dougkwan@google.com>
9141
9142         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
9143         (Arm_relocate_functions::arm_branch_common): Change method defintion
9144         in class definition to a method declaration and update list of formal
9145         parameters.
9146         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
9147         Arm_relocation_functions::jump24): Adjust call to
9148         Arm_relocate_functions::arm_branch_common.  Update list of formal
9149         parameters.
9150         (Arm_relocate_functions::xpc25): New method definition.
9151         (Arm_relocate_functions::arm_branch_common): Move method defintion
9152         out from class definition.  Use stubs for mode-switching and extending
9153         branch ranges.
9154         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
9155         specially.  Change code to enable use of stubs in ARM branches.
9156
9157 2009-11-10  Doug Kwan  <dougkwan@google.com>
9158
9159         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
9160         in method declaration.
9161         (Target_arm::relocate_stub): New method declaration.
9162         (Target_arm::default_target): Change to return a pointer instead of
9163         a const reference.
9164         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
9165         Target_arm::default_target.
9166         (Arm_Relobj::do_relocate_sections): Remove options paramater in
9167         method definition.
9168         (Target_arm::relocate_section): Adjust view.
9169         (Target_arm::relocate_stub): New method definition.
9170
9171 2009-11-10  Doug Kwan  <dougkwan@google.com>
9172
9173         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
9174         a format warning.
9175         * incremental.cc (open_incremental_binary): Initialized local
9176         variables to avoid warnings.
9177         * object.cc (make_elf_object): Ditto.
9178         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
9179         a format warning.
9180
9181 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
9182
9183         PR gold/10930
9184         * testsuite/plugin_test.c: Include "config.h".
9185
9186 2009-11-09  Doug Kwan  <dougkwan@google.com>
9187
9188         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
9189         (arm_symbol_value): Remove.
9190         (Arm_relocate_functions::arm_branch_common,
9191         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
9192         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
9193         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
9194         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
9195         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
9196         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
9197         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
9198         Arm_relocate_functions::thm_mobw_abs_nc,
9199         Arm_relocate_functions::thm_mov_abs,
9200         Arm_relocate_functions::movw_prel_nc,
9201         Arm_relocate_functions::thm_movt_abs,
9202         Arm_relocate_functions::movt_prel,
9203         Arm_relocate_functions::thm_movw_prel_nc,
9204         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
9205         (Target_arm::Relocate::relocate): Only decompose address into two
9206         parts if relocation type uses the thumb-bit and pass the actual
9207         bit instead of a flag indicating that the thumb-bit is used.  Adjust
9208         calls to methods in Arm_relocate_functions for this change.
9209
9210 2009-11-08  Ian Lance Taylor  <iant@google.com>
9211
9212         PR 10925
9213         * reloc.cc: Instantiate
9214         Sized_relobj::initialize_input_to_output_maps and
9215         Sized_relobj:free_input_to_output_maps.
9216
9217 2009-11-06  Ian Lance Taylor  <iant@google.com>
9218
9219         PR 10876
9220         * defstd.cc (in_segment): Set only_if_ref true for "end".
9221
9222 2009-11-06  Doug Kwan  <dougkwan@google.com>
9223
9224         * arm.cc (class Reloc_stub): Correct a comment.
9225         (Target_arm::Target_arm): Initialize arm_input_section_map_.
9226         (Target_arm::scan_section_for_stubs): New method declaration.
9227         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
9228         Change methods from private to protected.
9229         (Target_arm::do_may_relax): New method definition.
9230         (Target_arm::do_relax, Target_arm::group_sections,
9231         Target_arm::scan_reloc_for_stub,
9232         Target_arm::scan_reloc_section_for_stubs): New method declarations.
9233         (Target_arm::arm_input_section_map_): New data member declaration.
9234         (Target_arm::scan_reloc_for_stub,
9235         Target_arm::scan_reloc_section_for_stubs,
9236         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
9237         Target_arm::do_relax): New method definitions.
9238
9239 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
9240
9241         * configure.ac: Check for (struct stat)::st_mtim
9242         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
9243         * config.in: Regenerate.
9244         * configure: Regenerate.
9245
9246 2009-11-05  Ian Lance Taylor  <iant@google.com>
9247
9248         PR 10910
9249         * output.cc (Output_segment::add_output_section): Add missing
9250         return statement.
9251
9252 2009-11-04  Ian Lance Taylor  <iant@google.com>
9253
9254         PR 10880
9255         * object.h (class Object): Add is_needed and set_is_needed
9256         methods.  Add is_needed_ field.  Make bool fields into bitfields.
9257         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
9258         defined in a dynamic object and referenced by a regular object,
9259         set is_needed for the dynamic object.
9260         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
9261         if the file is marked with as_needed and it is not needed.
9262
9263 2009-11-04  Ian Lance Taylor  <iant@google.com>
9264
9265         PR 10887
9266         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
9267         tags if data is discarded by linker script.
9268         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9269         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9270         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9271         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9272
9273 2009-11-04  Ian Lance Taylor  <iant@google.com>
9274
9275         * layout.cc (Layout::get_output_section): Add is_interp and
9276         is_dynamic_linker_section parameters.  Change all callers.
9277         (Layout::choose_output_section): Likewise.
9278         (Layout::make_output_section): Likewise.
9279         (Layout::add_output_section_data): Add is_dynamic_linker_section
9280         parameter.  Change all callers.
9281         * layout.h (class Layout): Update declarations.
9282         * output.h (class Output_section): Add is_interp, set_is_interp,
9283         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
9284         Add is_interp_, is_dynamic_linker_section_ fields.  Change
9285         generate_code_fills_at_write_ to a bitfield.
9286         * output.cc (Output_section::Output_sections): Initialize new
9287         fields.
9288         (Output_segment::add_output_section): Add do_sort parameter.
9289         Change all callers.
9290
9291 2009-11-03  Ian Lance Taylor  <iant@google.com>
9292
9293         PR 10860
9294         * options.h (class General_options): Add --warn-common.
9295         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
9296         merging two common symbols.
9297         (Symbol_table::should_override): Handle --warn-common when merging
9298         a common symbol with a defined symbol.  Use report_resolve_problem
9299         for multiple definitions.
9300         (Symbol_table::report_resolve_problem): New function.
9301         * symtab.h (class Symbol_table): Declare report_resolve_problem.
9302
9303 2009-11-03  Doug Kwan  <dougkwan@google.com>
9304
9305         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
9306         stub_factory_.
9307         (Target_arm::stub_factory): New method definition.
9308         (Target_arm::new_arm_input_section,
9309         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
9310         Target_arm::reloc_uses_thumb_bit): New method declarations.
9311         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
9312         New type definitions.
9313         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
9314         member declarations.
9315         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
9316         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
9317         New method definitions.
9318
9319 2009-11-03  Ian Lance Taylor  <iant@google.com>
9320
9321         * options.h (class General_options): Add --warn_constructors.
9322
9323 2009-11-03  Ian Lance Taylor  <iant@google.com>
9324
9325         PR 10893
9326         * defstd.cc (in_section): Add entries for __rel_iplt_start,
9327         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
9328
9329 2009-11-03  Ian Lance Taylor  <iant@google.com>
9330
9331         PR 10895
9332         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
9333         --msgid-bugs-address.
9334         (install-pdf): New target.
9335         (install-data_yes): Look up one directory to find mkinstalldirs.
9336
9337 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
9338
9339         * po/Make-in (.po.gmo): Don't generate .gmo files in source
9340         tree.
9341
9342 2009-10-30  Doug Kwan  <dougkwan@google.com>
9343
9344         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
9345
9346 2009-10-30  Doug Kwan  <dougkwan@google.com>
9347
9348         * arm.cc (Stub_addend_reader): New struct template definition
9349         and partial specializations.
9350         (Stub_addend_reader::operator()): New method definition for a
9351         partially specialized template.
9352
9353 2009-10-30  Doug Kwan  <dougkwan@google.com>
9354
9355         * arm.cc (Arm_relobj::processor_specific_flags): New method
9356         definition.
9357         (Arm_relobj::do_read_symbols): New method declaration.
9358         (Arm_relobj::processor_specific_flags_): New data member declaration.
9359         (Arm_dynobj): New class definition.
9360         (Target_arm::do_finalize_sections): Add input_objects parameter.
9361         (Target_arm::do_adjust_elf_header): New method declaration.
9362         (Target_arm::are_eabi_versions_compatible,
9363         (Target_arm::merge_processor_specific_flags): New method declaration.
9364         (Target_arm::do_make_elf_object): New overloaded method definitions
9365         and declaration.
9366         (Arm_relobj::do_read_symbols): New method definition.
9367         (Arm_dynobj::do_read_symbols): Ditto.
9368         (Target_arm::do_finalize_sections): Add input_objects parameters.
9369         Merge processor-specific flags from all input objects.
9370         (Target_arm::are_eabi_versions_compatible,
9371         Target_arm::merge_processor_specific_flags,
9372         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
9373         New method definitions.
9374         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
9375         Input_objects pointer type parameter.
9376         * layout.cc (Layout::finalize): Pass input objects to target's.
9377         finalize_sections function.
9378         * output.cc (Output_file_header::do_sized_write): Set ELF file
9379         header's processor-specific flags.
9380         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
9381         Input_objects pointer type parameter.
9382         * sparc.cc (Target_sparc::do_finalize_sections): Same.
9383         * target.h (Input_objects): New forward class declaration.
9384         (Target::processor_specific_flags,
9385         Target::are_processor_specific_flags_sect): New method definitions.
9386         (Target::finalize_sections): Add input_objects parameter.
9387         (Target::Target): Initialize processor_specific_flags_ and
9388         are_processor_specific_flags_set_.
9389         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
9390         parameter.
9391         (Target::set_processor_specific_flags): New method definition.
9392         (Target::processor_specific_flags_,
9393         Target::are_processor_specific_flags_set_): New data member
9394         declarations.
9395         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
9396         Input_objects pointer type parameter.
9397
9398 2009-10-30  Doug Kwan  <dougkwan@google.com>
9399
9400         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
9401
9402 2009-10-28  Ian Lance Taylor  <iant@google.com>
9403
9404         * object.h (class Relobj): Drop options parameter from
9405         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
9406         do_scan_relocs, do_relocate.  Change all callers.
9407         (class Sized_relobj): Drop options parameters from
9408         do_gc_process_relocs, do_scan_relocs, do_relocate,
9409         do_relocate_sections, relocate_sections, emit_relocs_scan,
9410         emit_relocs_scan_reltype.  Change all callers.
9411         (struct Relocate_info): Remove options field and all references to
9412         it.
9413         * reloc.h (class Read_relocs): Remove options constructor
9414         parameter and options_ field.  Change all callers.
9415         (class Gc_process_relocs, class Scan_relocs): Likewise.
9416         (class Relocate_task): Likewise.
9417         * target-reloc.h (scan_relocs): Remove options parameter.  Change
9418         all callers.
9419         (scan_relocatable_relocs): Likewise.
9420         * target.h (class Sized_target): Remove options parameter from
9421         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
9422         all callers.
9423         * gc.h (gc_process_relocs): Remove options parameter.  Change all
9424         callers.
9425         * arm.cc: Update functions to remove options parameters.
9426         * i386.cc: Likewise.
9427         * powerpc.cc: Likewise.
9428         * sparc.cc: Likewise.
9429         * x86_64.cc: Likewise.
9430         * testsuite/testfile.cc: Likewise.
9431
9432 2009-10-28  Doug Kwan  <dougkwan@google.com>
9433
9434         * arm.cc (Arm_relobj): New class definition.
9435         (Arm_relobj::scan_sections_for_stubs,
9436         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
9437         New method definitions.
9438
9439 2009-10-28  Cary Coutant  <ccoutant@google.com>
9440
9441         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
9442         (Plugin::cleanup_done_): New member.
9443         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
9444         (Plugin_manager::cleanup_done_): Remove.
9445         (Plugin_manager::add_input_file): Edit error message.
9446         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
9447         (Plugin_manager::cleanup): Remove use of cleanup_done_.
9448
9449 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
9450
9451         * fileread.cc: (File_read::View::~View): Use the new
9452         data_ownership_ filed.
9453         (File_read::~File_read): Dispose the new whole_file_view_.
9454         (File_read::open): Mmap the whole file if needed.
9455         (File_read::open): Use whole_file_view_ instead of contents_.
9456         (File_read::find_view): Use whole_file_view_ if applicable.
9457         (File_read::do_read): Use whole_file_view_ instead of contents_.
9458         (File_read::make_view): Use whole_file_view_ instead of contents_,
9459         update File_read::View::View call.
9460         (File_read::find_or_make_view): Update File_read::View::View
9461         call.
9462         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
9463         remove contents_
9464         (File_read::View::Data_ownership): New enum.
9465         (File_read::View::View): Replace bool mapped_ with Data_ownership
9466         argument.
9467         (File_read::View::mapped_): Remove (replaced by data_ownership_).
9468         (File_read::View::data_ownership_): New field.
9469         (File_read::contents_): Remove (replaced by whole_file_view_).
9470         (File_read::whole_file_view_): New field.
9471         * options.h (class General_options): Add --keep-files-mapped.
9472
9473 2009-10-27  Cary Coutant  <ccoutant@google.com>
9474
9475         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
9476         * testsuite/Makefile.am (plugin_test_5): New test case.
9477         * testsuite/Makefile.in: Regenerate.
9478
9479 2009-10-25  Doug Kwan  <dougkwan@google.com>
9480
9481         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
9482         from private to protected to allow access by child class.
9483         (Sized_relobj::do_relocate_sections): New method declaration.
9484         (Sized_relobj::relocate_sections): Virtualize.
9485         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
9486         Sized_relobj::relocate_sections.  Instantiate template explicitly
9487         for different target sizes and endianity.
9488
9489 2009-10-24  Doug Kwan  <dougkwan@google.com>
9490
9491         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
9492         (Arm_input_section::as_arm_input_section): New method.
9493         (Arm_output_section): New class definition.
9494         (Arm_output_section::create_stub_group,
9495         Arm_output_section::group_sections): New method definitions.
9496
9497 2009-10-22  Doug Kwan  <dougkwan@google.com>
9498
9499         * arm.cc (Arm_input_section): New class definition.
9500         (Arm_input_section::init, Arm_input_section:do_write,
9501         Arm_input_section::set_final_data_size,
9502         Arm_input_section::do_reset_address_and_file_offset): New method
9503         definitions.
9504
9505 2009-10-21  Doug Kwan  <dougkwan@google.com>
9506
9507         * arm.cc (Stub_table, Arm_input_section): New forward class
9508         declarations.
9509         (Stub_table): New class defintion.
9510         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
9511         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
9512         New method definition.
9513
9514 2009-10-21  Doug Kwan  <dougkwan@google.com>
9515
9516         * arm.cc: Update copyright comments.
9517         (Target_arm): New forward class template declaration.
9518         (Arm_address): New type.
9519         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
9520         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
9521         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
9522         constants.
9523         (Insn_template): Same.
9524         (DEF_STUBS): New macro.
9525         (Stub_type): New enum type.
9526         (Stub_template): New class definition.
9527         (Stub): Same.
9528         (Reloc_stub): Same.
9529         (Stub_factory): Same.
9530         (Target_arm::Target_arm): Initialize may_use_blx_ and
9531         should_force_pic_veneer_.
9532         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
9533         Target_arm::should_force_pic_veneer,
9534         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
9535         Target_arm::using_thumb_only, Target_arm:;default_target): New
9536         method defintions.
9537         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
9538         New data member declarations.
9539         (Insn_template::size, Insn_template::alignment): New method defintions.
9540         (Stub_template::Stub_template): New method definition.
9541         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
9542         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
9543         (Stub_factory::Stub_factory): New method definition.
9544         * gold.h (string_hash): New template.
9545         * output.h (Input_section_specifier::hash_value): Use
9546         gold::string_hash.
9547         (Input_section_specifier::string_hash): Remove.
9548         * stringpool.cc (Stringpool_template::string_hash): Use
9549         gold::string_hash.
9550
9551 2009-10-20  Doug Kwan  <dougkwan@google.com>
9552
9553         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
9554         symbols of relaxed input sections.
9555         * output.h (Output_section::find_relaxed_input_section): Make
9556         method public.
9557
9558 2009-10-16  Doug Kwan  <dougkwan@google.com>
9559
9560         * dynobj.cc (Versions::Versions): Initialize version_script_.
9561         Only insert base version symbol definition for a shared object
9562         if version script defines any version versions.
9563         (Versions::define_base_version): New method definition.
9564         (Versions::add_def): Check that base version is not needed.
9565         (Versions::add_need): Define base version lazily.
9566         * dynobj.h (Versions::define_base_version): New method declaration.
9567         (Versions::needs_base_version_): New data member declaration.
9568         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
9569         (check_DATA): Add no_version_test.stdout.
9570         (libno_version_test.so, no_version_test.o no_version_test.stdout):
9571         New make rules.
9572         * testsuite/Makefile.in: Regenerate.
9573         * testsuite/no_version_test.c: New file.
9574         * testsuite/no_version_test.sh: Ditto.
9575
9576 2009-10-16  Doug Kwan  <dougkwan@google.com>
9577
9578         * expression.cc (class Segment_start_expression): New class definition.
9579         (Segment_start_expression::value): New method definition.
9580         (script_exp_function_segment_start): Return a new
9581         Segment_start_expression.
9582         * gold/script-c.h (script_saw_segment_start_expression): New function
9583         prototype.
9584         * script-sections.cc (Script_sections::Script_sections): Initialize
9585         SAW_SEGMENT_START_EXPRESSION_ to false.
9586         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
9587         and -Tbbs options to specify section addresses if given in
9588         command line and no SEGMENT_START expression is seen in a script.
9589         * script-sections.h (Script_sections::saw_segment_start_expression,
9590         Script_sections::set_saw_segment_start_expression): New method
9591         definition.
9592         (Script_sections::saw_segment_start_expression_): New data member
9593         declaration.
9594         * script.cc (script_saw_segment_start_expression): New function.
9595         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
9596         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
9597         script_test_7.sh and script_test_8.sh.
9598         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
9599         script_test_8.stdout.
9600         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
9601         (script_test_6, script_test_6.stdout, script_test_7,
9602         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
9603         * Makefile.in: Regenerate.
9604         * testsuite/script_test_6.sh: New file.
9605         * testsuite/script_test_6.t: Same.
9606         * testsuite/script_test_7.sh: Same.
9607         * testsuite/script_test_7.t: Same.
9608         * testsuite/script_test_8.sh: Same.
9609
9610 2009-10-16  Doug Kwan  <dougkwan@google.com>
9611
9612         * output.cc (Output_segment::set_section_list_address): Cast
9613         expressions to unsigned long long type to avoid format warnings.
9614
9615 2009-10-15  Ian Lance Taylor  <iant@google.com>
9616
9617         * script.cc (Script_options::add_symbol_assignment): Always add a
9618         dot assignment to script_sections_.
9619         * script-sections.cc (Script_sections::add_dot_assignment):
9620         Initialize if necessary.
9621
9622         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
9623         program headers with no load segment if there is a linker script.
9624
9625         * layout.cc (Layout::set_segment_offsets): Align the file offset
9626         to the segment aligment for -N or -n with no load segment.
9627         * output.cc (Output_segment::add_output_section): Don't crash if
9628         the first section is a TLS section.
9629         (Output_segment::set_section_list_addresses): Print an error
9630         message if the address moves backward in a linker script.
9631         * script-sections.cc
9632         (Output_section_element_input::set_section_addresses): Don't
9633         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
9634         (Orphan_output_section::set_section_addresses): Likewise.
9635
9636 2009-10-15  Doug Kwan  <dougkwan@google.com>
9637
9638         * layout.cc (Layout::finish_dynamic_section): Generate tags
9639         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
9640         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
9641         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
9642
9643 2009-10-14  Ian Lance Taylor  <iant@google.com>
9644
9645         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
9646         fields.
9647         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
9648         data_shdr fields of relinfo.
9649         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
9650         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
9651         R_386_TLS_LDO_32, adjust based on section flags.
9652         (Target_i386::Relocate::fix_up_ldo): Remove.
9653
9654 2009-10-13  Ian Lance Taylor  <iant@google.com>
9655
9656         Add support for -pie.
9657         * options.h (class General_options): Add -pie and
9658         --pic-executable.
9659         (General_options::output_is_position_independent): Test -pie.
9660         (General_options::output_is_executable): Return true if not shared
9661         and not relocatable.
9662         (General_options::output_is_pie): Remove.
9663         * options.cc (General_options::finalize): Reject incompatible uses
9664         of -pie.
9665         * gold.cc (queue_middle_tasks): A -pie link is not static.
9666         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
9667         * symtab.cc (Symbol::final_value_is_known): Return false if
9668         output_is_position_independent.
9669         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
9670         output_is_position_independent.
9671         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
9672         output_is_position_independent.
9673         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
9674         output_is_position_independent.
9675         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
9676         two_file_pie_test.
9677         (basic_pie_test.o, basic_pie_test): New targets.
9678         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
9679         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
9680         (two_file_pie_test): New target.
9681         * testsuite/Makefile.in: Rebuild.
9682         * README: Remove note saying that -pie is not supported.
9683
9684 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
9685
9686         * options.h (class General_options): Add -init and -fini.
9687         * layout.cc (Layout::finish_dynamic_section): Emit
9688         given init and fini functions.
9689
9690 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
9691
9692         * gc.h (gc_process_relocs): Check if icf is enabled using new
9693         function.
9694         * gold.cc (queue_initial_tasks): Likewise.
9695         (queue_middle_tasks): Likewise.
9696         * object.cc (do_layout): Likewise.
9697         * symtab.cc (is_section_folded): Likewise.
9698         * main.cc (main): Likewise.
9699         * reloc.cc (Read_relocs::run): Likewise.
9700         (Sized_relobj::do_scan_relocs): Likewise.
9701         * icf.cc (is_function_ctor_or_dtor): New function.
9702         (Icf::find_identical_sections): Check if function is ctor or dtor when
9703         safe icf is chosen.
9704         * options.h (General_options::icf): Change option to be an enum.
9705         (Icf_status): New enum.
9706         (icf_enabled): New method.
9707         (icf_safe_folding): New method.
9708         (set_icf_status): New method.
9709         (icf_status_): New variable.
9710         * (options.cc) (General_options::finalize): Set icf_status_.
9711         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
9712         icf_test and icf_keep_unique_test to use the --icf enum flag.
9713         * testsuite/icf_safe_test.sh: New file.
9714         * testsuite/icf_safe_test.cc: New file.
9715
9716 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
9717
9718         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
9719         includes to gc.h and icf.h.
9720         * arm.cc: Include gc.h.
9721         * gold.cc: Likewise.
9722         * i386.cc: Likewise.
9723         * powerpc.cc: Likewise.
9724         * sparc.cc: Likewise.
9725         * x86_64.cc: Likewise.
9726         * gc.h: Include icf.h.
9727
9728 2009-10-11  Ian Lance Taylor  <iant@google.com>
9729
9730         * plugin.cc: Include "gold.h" before other header files.
9731
9732 2009-10-10  Chris Demetriou  <cgd@google.com>
9733
9734         * options.h (Input_file_argument::Input_file_type): New enum.
9735         (Input_file_argument::is_lib_): Replace with...
9736         (Input_file_argument::type_): New member.
9737         (Input_file_argument::Input_file_argument): Take Input_file_type
9738         'type' rather than boolean 'is_lib' as second argument.
9739         (Input_file_argument::is_lib): Use type_.
9740         (Input_file_argument::is_searched_file): New function.
9741         (Input_file_argument::may_need_search): Handle is_searched_file.
9742         * options.cc (General_options::parse_library): Support -l:filename.
9743         (General_options::parse_just_symbols): Update for Input_file_argument
9744         changes.
9745         (Command_line::process): Likewise.
9746         * archive.cc (Archive::get_file_and_offset): Likewise.
9747         * plugin.cc (Plugin_manager::release_input_file): Likewise.
9748         * script.cc (read_script_file, script_add_file): Likewise.
9749         * fileread.cc (Input_file::Input_file): Likewise.
9750         (Input_file::will_search_for): Handle is_searched_file.
9751         (Input_file::open): Likewise.
9752         * readsyms.cc (Read_symbols::get_name): Likewise.
9753         * testsuite/Makefile.am (searched_file_test): New test.
9754         * testsuite/Makefile.in: Regenerate.
9755         * testsuite/searched_file_test.cc: New file.
9756         * testsuite/searched_file_test_lib.cc: New file.
9757
9758 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9759             Ian Lance Taylor  <iant@google.com>
9760
9761         * descriptor.cc: Include <cstdio> and "binary-io.h".
9762         (Descriptors::open): Open the files in binary mode always.
9763         * script.cc (Lex::get_token): Treat \r as whitespace.
9764
9765 2009-10-09  Ian Lance Taylor  <iant@google.com>
9766
9767         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
9768
9769 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9770             Ian Lance Taylor  <iant@google.com>
9771
9772         * configure.ac: Check for readv function also.
9773         * fileread.cc (readv): Define if not HAVE_READV.
9774         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
9775         does not exist.
9776         * config.in: Regenerate.
9777         * configure: Regenerate.
9778
9779 2009-10-09  Doug Kwan  <dougkwan@google.com>
9780
9781         * layout.cc (Layout::make_output_section): Call target hook to make
9782         ordinary output section.
9783         (Layout::finalize): Adjust parameter list of call the
9784         Target::may_relax().
9785         * layout.h (class Layout::section_list): New method.
9786         * merge.h (Output_merge_base::entsize): Change visibility to public.
9787         (Output_merge_base::is_string, Output_merge_base::do_is_string):
9788         New methods.
9789         (Output_merge_string::do_is_string): New method.
9790         * object.cc (Sized_relobj::do_setup): renamed from
9791         Sized_relobj::set_up.
9792         * object.h (Sized_relobj::adjust_shndx,
9793         Sized_relobj::initializ_input_to_output_maps,
9794         Sized_relobj::free_input_to_output_maps): Change visibilities to
9795         protected.
9796         (Sized_relobj::setup): Virtualize.
9797         (Sized_relobj::do_setup): New method declaration.
9798         (Sized_relobj::invalidate_section_offset,
9799         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
9800         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
9801         * options.cc (parse_int): New function.
9802         * options.h (parse_int): New declaration.
9803         (DEFINE_int): New macro.
9804         (stub_group_size): New option.
9805         * output.cc (Output_section::Output_section): Initialize memebers
9806         merge_section_map_, merge_section_by_properties_map_,
9807         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
9808         (Output_section::add_input_section): Handled deferred code-fill
9809         generation and remove an old comment.
9810         (Output_section::add_relaxed_input_section): New method definition.
9811         (Output_section::add_merge_input_section): Use merge section by
9812         properties map to speed to search.  Update merge section maps
9813         as appropriate.
9814         (Output_section::build_relaxation_map): New method definition.
9815         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9816         Same.
9817         (Output_section::relax_input_section): Renamed to
9818         Output_section::convert_input_sections_to_relaxed_sections and change
9819         interface to take a vector of pointers to relaxed sections.
9820         (Output_section::find_merge_section,
9821         Output_section::find_relaxed_input_section): New method definitions.
9822         (Output_section::is_input_address_mapped,
9823         Output_section::output_offset, Output_section::output_address):
9824         Use output section data maps to speed up searching.
9825         (Output_section::find_starting_output_address): Add comments.
9826         (Output_section::do_write,
9827         Output_section::write_to_postprocessing_buffer): Do code-fill
9828         generation as appropriate.
9829         (Output_section::get_input_sections): Invalidate relaxed input section
9830         map.
9831         (Output_section::restore_states): Adjust type of checkpoint .
9832         Invalidate relaxed input section map.
9833         * output.h (Output_merge_base): New class declaration.
9834         (Input_section_specifier): New class defintion.
9835         (class Output_relaxed_input_section) Change base class to
9836         Output_section_data_build.
9837         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
9838         base class initializer.
9839         (Output_section::add_relaxed_input_section): New method declaration.
9840         (Output_section::Input_section): Change visibility to protected.
9841         (Output_section::Input_section::relobj,
9842         Output_section::Input_section::shndx): Handle relaxed input sections.
9843         Output_section::input_sections) Change visibility to protected.  Also
9844         define overload to return a non-const pointer.
9845         (Output_section::Merge_section_properties): New class defintion.
9846         (Output_section::Merge_section_by_properties_map,
9847         Output_section::Output_section_data_by_input_section_map,
9848         Output_section::Relaxation_map): New types.
9849         (Output_section::relax_input_section): Rename method to
9850         Output_section::convert_input_sections_to_relaxed_sections and change
9851         interface to take a vector of relaxed section pointers.
9852         (Output_section::find_merge_section,
9853         Output_section::find_relaxed_input_section,
9854         Output_section::build_relaxation_map,
9855         Output_section::convert_input_sections_in_list_to_relaxed_sections):
9856         New method declarations.
9857         (Output_section::merge_section_map_
9858         Output_section::merge_section_by_properties_map_,
9859         Output_section::relaxed_input_section_map_,
9860         Output_section::is_relaxed_input_section_map_valid_,
9861         Output_section::generate_code_fills_at_write_): New data members.
9862         * script-sections.cc
9863         (Output_section_element_input::set_section_addresses): Call
9864         current_data_size and addralign methods of relaxed input sections.
9865         (Orphan_output_section::set_section_addresses): Call current_data_size
9866         and addralign methods of relaxed input sections.
9867         * symtab.cc (Symbol_table::compute_final_value): Extract template
9868         from the body of Symbol_table::sized_finalize_symbol.
9869         (Symbol_table::sized_finalized_symbol): Call
9870         Symbol_table::compute_final_value.
9871         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
9872         (Symbol_table::compute_final_value): New templated method declaration.
9873         * target.cc (Target::do_make_output_section): New method defintion.
9874         * target.h (Target::make_output_section): New method declaration.
9875         (Target::relax): Add more parameters for input objects, symbol table
9876         and layout.  Adjust call to do_relax.
9877         (Target::do_make_output_section): New method declaration.
9878         (Target::do_relax): Add parameters for input objects, symbol table
9879         and layout.
9880
9881 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9882
9883         * pread.c: Include stdio.h.
9884
9885 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9886
9887         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
9888         defined.
9889
9890 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
9891
9892         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
9893         Change read_shndx type to unsigned int.
9894         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9895         int.
9896         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9897         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
9898         Change read_shndx type to unsigned int.
9899         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
9900         int.
9901         (Sized_dwarf_line_info::read_line_mappings): Likewise.
9902         * layout.cc (Layout::create_symtab_sections): Cast the result of
9903         local_symcount * symsize to off_t in the gold_assert.
9904
9905 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9906
9907         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
9908         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
9909         R_ARM_BASE_ABS.
9910         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
9911         (Arm_relocate_functions::thm_abs5): New function.
9912         (Arm_relocate_functions::abs12): New function.
9913         (Arm_relocate_functions::abs16): New function.
9914         (Arm_relocate_functions::base_abs): New function.
9915         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
9916         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
9917         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
9918         R_ARM_BASE_ABS.
9919         (Scan::global): Likewise.
9920         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
9921         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
9922         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
9923         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
9924         R_ARM_BASE_ABS.
9925
9926 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9927
9928         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
9929         (Arm_relocate_functions::movt_prel): New function.
9930         (Arm_relocate_functions::thm_movw_prel_nc): New function.
9931         (Arm_relocate_functions::thm_movt_prel): New function.
9932         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
9933         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
9934         (Scan::global, Relocate::relocate): Likewise.
9935         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9936
9937 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9938
9939         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
9940         Incremental_checker.
9941         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
9942         unsigned int.
9943         (class Incremental_inputs_header): New class.
9944         (Incremental_inputs_header_writer): Edit comment.
9945         (Incremental_inputs_entry): New class.
9946         (Incremental_inputs_entry_writer): Edit comment.
9947         (Sized_incremental_binary::do_find_incremental_inputs_section):
9948         Add *strtab_shndx parameter, fill it.
9949         (Sized_incremental_binary::do_check_inputs): New method.
9950         (Incremental_checker::can_incrementally_link_output_file): Use
9951         Sized_incremental_binary::check_inputs.
9952         (Incremental_inputs::report_command_line): Save command line in
9953         command_line_.
9954         * incremental.h:
9955         (Incremental_binary::find_incremental_inputs_section): New
9956         method.
9957         (Incremental_binary::do_find_incremental_inputs_section): Add
9958         strtab_shndx parameter.
9959         (Incremental_binary::do_check_inputs): New pure virtual method.
9960         (Sized_incremental_binary::do_check_inputs): Declare.
9961         (Incremental_checker::Incremental_checker): Add incremental_inputs
9962         parameter, use it to initialize incremental_inputs_.
9963         (Incremental_checker::incremental_inputs_): New field.
9964         (Incremental_checker::command_line): New method.
9965         (Incremental_checker::inputs): New method.
9966         (Incremental_checker::command_line_): New field.
9967
9968 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
9969
9970         * incremental.cc: Include <cstdarg> and "target-select.h".
9971         (vexplain_no_incremental): New function.
9972         (explain_no_incremental): New function.
9973         (Incremental_binary::error): New method.
9974         (Sized_incremental_binary::do_find_incremental_inputs_section): New
9975         method.
9976         (make_sized_incremental_binary): New function.
9977         (open_incremental_binary): New function.
9978         (can_incrementally_link_file): Add checks if output is ELF and has
9979         inputs section.
9980         * incremental.h: Include "elfcpp_file.h" and "output.h".
9981         (Incremental_binary): New class.
9982         (Sized_incremental_binary): New class.
9983         (open_incremental_binary): Declare.
9984         * object.cc (is_elf_object): Use
9985         elfcpp::Elf_recognizer::is_elf_file.
9986         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
9987         * output.h (Output_file::filesize): New method.
9988
9989 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9990
9991         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
9992         New function.
9993         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
9994         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
9995         function.
9996         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
9997         function.
9998         (Arm_relocate_functions::movw_abs_nc): New function.
9999         (Arm_relocate_functions::movt_abs): New function.
10000         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10001         (Arm_relocate_functions::thm_movt_abs): New function.
10002         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10003         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10004         (Scan::global): Likewise.
10005         (Relocate::relocate): Likewise.
10006         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10007
10008 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10009
10010         * arm.cc (Arm_relocate_functions::got_prel) New function.
10011         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10012         (Relocate::relocate): Likewise.
10013         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10014
10015 2009-10-06  Ian Lance Taylor  <iant@google.com>
10016
10017         * options.h (class General_options): Define
10018         split_stack_adjust_size parameter.
10019         * object.h (class Object): Add uses_split_stack_ and
10020         has_no_split_stack_ fields.  Add uses_split_stack and
10021         has_no_split_stack accessor functions.  Declare
10022         handle_split_stack_section.
10023         (class Reloc_symbol_changes): Define.
10024         (class Sized_relobj): Define Function_offsets.  Declare
10025         split_stack_adjust, split_stack_adjust_reltype, and
10026         find_functions.
10027         * object.cc (Object::handle_split_stack_section): New function.
10028         (Sized_relobj::do_layout): Call handle_split_stack_section.
10029         * dynobj.cc (Sized_dynobj::do_layout): Call
10030         handle_split_stack_section.
10031         * reloc.cc (Sized_relobj::relocate_sections): Call
10032         split_stack_adjust for executable sections in split_stack
10033         objects.  Pass reloc_map to relocate_section.
10034         (Sized_relobj::split_stack_adjust): New function.
10035         (Sized_relobj::split_stack_adjust_reltype): New function.
10036         (Sized_relobj::find_functions): New function.
10037         * target-reloc.h: Include "object.h".
10038         (relocate_section): Add reloc_symbol_changes parameter.  Change
10039         all callers.
10040         * target.h (class Target): Add calls_non_split method.  Declare
10041         do_calls_non_split virtual method.  Declare match_view and
10042         set_view_to_nop.
10043         * target.cc: Include "elfcpp.h".
10044         (Target::do_calls_non_split): New function.
10045         (Target::match_view): New function.
10046         (Target::set_view_to_nop): New function.
10047         * gold.cc (queue_middle_tasks): Give an error if mixing
10048         split-stack and non-split-stack objects with -r.
10049         * i386.cc (Target_i386::relocate_section): Add
10050         reloc_symbol_changes parameter.
10051         (Target_i386::do_calls_non_split): New function.
10052         * x86_64.cc (Target_x86_64::relocate_section): Add
10053         reloc_symbol_changes parameter.
10054         (Target_x86_64::do_calls_non_split): New function.
10055         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10056         parameter.
10057         * powerpc.cc (Target_powerpc::relocate_section): Add
10058         reloc_symbol_changes parameter.
10059         * sparc.cc (Target_sparc::relocate_section): Add
10060         reloc_symbol_changes parameter.
10061         * configure.ac: Call AM_CONDITIONAL for the default target.
10062         * configure: Rebuild.
10063         * testsuite/Makefile.am (TEST_AS): New variable.
10064         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10065         (check_DATA): Add split_i386 and split_x86_64 files.
10066         (SPLIT_DEFSYMS): Define.
10067         (split_i386_[1234n].o): New targets.
10068         (split_i386_[124]): New targets.
10069         (split_i386_[1234r].stdout): New targets.
10070         (split_x86_64_[1234n].o): New targets.
10071         (split_x86_64_[124]): New targets.
10072         (split_x86_64_[1234r].stdout): New targets.
10073         (MOSTLYCLEANFILES): Add new executables.
10074         * testsuite/split_i386.sh: New file.
10075         * testsuite/split_x86_64.sh: New file.
10076         * testsuite/split_i386_1.s: New file.
10077         * testsuite/split_i386_2.s: New file.
10078         * testsuite/split_i386_3.s: New file.
10079         * testsuite/split_i386_4.s: New file.
10080         * testsuite/split_i386_n.s: New file.
10081         * testsuite/split_x86_64_1.s: New file.
10082         * testsuite/split_x86_64_2.s: New file.
10083         * testsuite/split_x86_64_3.s: New file.
10084         * testsuite/split_x86_64_4.s: New file.
10085         * testsuite/split_x86_64_n.s: New file.
10086         * testsuite/testfile.cc (Target_test): Update relocation_section
10087         function.
10088         * testsuite/Makefile.in: Rebuild.
10089
10090 2009-10-06  Ian Lance Taylor  <iant@google.com>
10091
10092         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10093         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10094         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10095         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10096         the address on ldo_addrs_.
10097         (Target_i386::Relocate::fix_up_ldo): New function.
10098
10099 2009-10-06   Rafael Espindola  <espindola@google.com>
10100
10101         * plugin.cc (add_input_library): New.
10102         (Plugin::load): Add add_input_library to tv.
10103         (Plugin_manager::add_input_file): Add the is_lib argument.
10104         (add_input_file): Update call to Plugin_manager::add_input_file.
10105         (add_input_library): New.
10106         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10107
10108 2009-09-30  Doug Kwan  <dougkwan@google.com>
10109
10110         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10111         symbol and call Symbol::may_need_copy_reloc to determine if
10112         a copy reloc is needed.
10113         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10114         nocopyreloc is given in command line.
10115         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10116         given in command line.
10117         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10118         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10119         of the removed Target_i386::may_need_copy_reloc.
10120         * options.h (copyreloc): New option with default value false.
10121         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10122         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
10123         instead of the removed Target_powerpc::may_need_copy_reloc.
10124         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
10125         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
10126         instead of the removed Target_sparc::may_need_copy_reloc.
10127         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
10128         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
10129         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
10130         instead of the removed Target_x86_64::may_need_copy_reloc.
10131
10132 2009-09-30  Ian Lance Taylor  <iant@google.com>
10133
10134         * object.h (class Object): Remove target_ field, and target,
10135         sized_target, and set_target methods.
10136         (Object::sized_target): Remove.
10137         (class Sized_relobj): Update declarations.  Remove sized_target.
10138         * object.cc (Sized_relobj::setup): Remove target parameter.
10139         Change all callers.
10140         (Input_objects::add_object): Don't do anything with the target.
10141         (make_elf_sized_object): Add punconfigured parameter.  Change all
10142         callers.  Set or test parameter target.
10143         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
10144         Change all callers.
10145         * parameters.cc (Parameters::set_target): Change parameter type to
10146         be non-const.
10147         (Parameters::default_target): Remove.
10148         (set_parameters_target): Change parameter type to be non-const.
10149         (parameters_force_valid_target): New function.
10150         (parameters_clear_target): New function.
10151         * parameters.h (class Parameters): Update declarations.  Remove
10152         default_target method.  Add sized_target and clear_target
10153         methods.  Change target_ to be non-const.
10154         (set_parameters_target): Update declaration.
10155         (parameters_force_valid_target): Declare.
10156         (parameters_clear_target): Declare.
10157         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
10158         as NULL if we aren't searching.
10159         (Add_symbols::run): Don't check for compatible target.
10160         * fileread.cc (Input_file::open_binary): Call
10161         parameters_force_valid_target.
10162         * gold.cc (queue_middle_tasks): Likewise.
10163         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
10164         set_target on object.
10165         * dynobj.h (class Sized_dynobj): Update declarations.
10166         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
10167         make_elf_object returns NULL.
10168         (Archive::include_member): Don't check whether object target is
10169         compatible.
10170         * output.cc (Output_section::add_input_section): Get target from
10171         parameters.
10172         (Output_section::relax_input_section): Likewise.
10173         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
10174         parameters.
10175         (Sized_relobj::do_scan_relocs): Likewise.
10176         (Sized_relobj::relocate_sections): Likewise.
10177         * resolve.cc (Symbol_table::resolve): Likewise.
10178         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
10179         parameter.  Change all callers.
10180         (Symbol_table::add_from_object): Get target from parameters.
10181         (Symbol_table::add_from_relobj): Don't check object target.
10182         (Symbol_table::add_from_dynobj): Likewise.
10183         (Symbol_table::define_special_symbol): Get target from
10184         parameters.
10185         * symtab.h (class Symbol_table): Update declaration.
10186         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
10187         parameter.  Change all callers.  Clear parameter target.
10188         (Binary_test): Test target here.
10189         * testsuite/object_unittest.cc (gold_testsuite): Remove
10190         target_test_pointer parameter.  Change all callers.
10191         (Object_test): Test target here.
10192
10193 2009-09-26  Ian Lance Taylor  <iant@google.com>
10194
10195         * testsuite/initpri1.c: Don't try to use constructor priorities if
10196         compiling with gcc before 4.3.
10197
10198 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
10199
10200         * testsuite/retain_symbols_file_test.sh (check_present): Change
10201         output file name to retain_symbols_file_test.stdout.
10202         (check_absent): Likewise.
10203
10204 2009-09-18  Craig Silverstein  <csilvers@google.com>
10205
10206         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
10207         * options.cc: Include <cerrno> and <fstream>.
10208         (General_options::finalize): Parse -retain-symbols-file tag.
10209         * options.h: New flag.
10210         (General_options): New method should_retain_symbol, new
10211         variable symbols_to_retain.
10212         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
10213         should_retain_symbol map.
10214         * testsuite/Makefile.am (retain_symbols_file_test): New test.
10215         * testsuite/Makefile.in: Regenerate.
10216         * testsuite/retain_symbols_file_test.sh: New file.
10217
10218 2009-09-18  Nick Clifton  <nickc@redhat.com>
10219
10220         * po/es.po: Updated Spanish translation.
10221
10222 2009-09-17  Doug Kwan  <dougkwan@google.com>
10223
10224         * debug.h (DEBUG_RELAXATION): New constant.
10225         (DEBUG_ALL): Add DEBUG_RELAXATION.
10226         (debug_string_to_enum): Add relaxation debug option.
10227         * layout.cc
10228         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
10229         Layout::Relaxation_debug_check::read_sections,
10230         Layout::Relaxation_debug_check::read_sections): New method definitions.
10231         (Layout::Layout): Initialize data members
10232         record_output_section_data_from_scrips_,
10233         script_output_section_data_list_ and relaxation_debug_check_.
10234         (Layout::save_segments, Layout::restore_segments,
10235         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10236         Layout::relaxation_loop_body): New method definitions.
10237         (Layout::finalize): Support relaxation.  Move section layout code to
10238         Layout::relaxation_loop_body.
10239         (Layout::set_asection_address_from_script): Move code for orphan
10240         section placement out.
10241         (Layout::place_orphan_sections_in_script): New method definition.
10242         * layout.h (Output_segment_headers, Output_file_header):
10243         New forward class declarations.
10244         (Layout::~Layout): Define.
10245         (Layout::new_output_section_data_from_script): New method definition.
10246         (Layout::place_orphan_sections_in_script): New method declaration.
10247         (Layout::Segment_states): New type declaration.
10248         (Layout::save_segments, Layout::restore_segments,
10249         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
10250         Layout::relaxation_loop_body): New method declarations.
10251         (Layout::Output_section_data_list): New type declaration.
10252         (Layout::Relaxation_debug_check): New class definition.
10253         (Layout::record_output_section_data_from_script_,
10254         Layout::script_output_section_data_list_, Layout::segment_states_,
10255         Layout::relaxation_debug_check_): New data members.
10256         * output.cc: (Output_section_headers::do_size): New method definition.
10257         (Output_section_headers::Output_section_headers): Move size
10258         computation to Output_section_headers::do_size.
10259         (Output_segment_headers::do_size): New method definition.
10260         (Output_file_header::Output_file_header): Move size computation to
10261         Output_file_header::do_size and call it.
10262         (Output_file_header::do_size): New method definition.
10263         (Output_data_group::Output_data_group): Adjust call to
10264         Output_section_data.
10265         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
10266         (Output_symtab_xindex::do_write): Add array bound check.
10267         (Output_section::Input_section::print_to_mapfile): Handle
10268         RELAXED_INPUT_SECTION_CODE.
10269         (Output_section::Output_section): Initialize data member checkpoint_.
10270         (Output_section::~Output_section): Delete checkpoint object pointed
10271         by checkpoint_.
10272         (Output_section::add_input_section): Always add an Input_section if
10273         relaxing.
10274         (Output_section::add_merge_input_section): Add assert.
10275         (Output_section::relax_input_section): New method definition.
10276         (Output_section::set_final_data_size): Set load address to zero for
10277         an unallocated section.
10278         (Output_section::do_address_and_file_offset_have_reset_values):
10279         New method definition.
10280         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
10281         Handle relaxed input section.
10282         (Output_section::sort_attached_input_sections): Checkpoint input
10283         section list lazily.
10284         (Output_section::get_input_sections): Change type of input_sections to
10285         list of Simple_input_section pointers.  Checkpoint input section list
10286         lazily.  Also handle relaxed input sections.
10287         (Output_section::add_input_section_for_script): Take a reference to
10288         a Simple_input_section object instead of Relobj pointer and section
10289         index as parameter.  Handle relaxed input sections.
10290         (Output_section::save_states, Output_section::restore_states): New
10291         method definitions.
10292         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
10293         (Output_data::is_data_size_fixed): New method definition.
10294         (Output_data::reset_addresss_and_file_offset): Do not reset data size
10295         if it is fixed.
10296         (Output_data::address_and_file_offset_have_reset_values): New method
10297         definition.
10298         (Output_data::do_address_and_file_offset_have_reset_values): New method
10299         definition.
10300         (Output_data::set_data_size): Check that data size is not fixed.
10301         (Output_data::fix_data_size): New method definition.
10302         (Output_data::is_data_size_fixed_): New data member.
10303         (Output_section_headers::set_final_data_size): New method definition.
10304         (Output_section_headers::do_size): New method declaration.
10305         (Output_segment_headers::set_final_data_size): New method definition.
10306         (Output_segment_headers::do_size): New method declaration.
10307         (Output_file_header::set_final_data_size)::New method definition.
10308         (Output_file_header::do_size)::New method declaration.
10309         (Output_section_data::Output_section_data): Add new parameter
10310         is_data_size_fixed and use it to fix data size.
10311         (Output_data_const::Output_data_const): Adjust call to base class
10312         constructor and fix data size.
10313         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
10314         base class constructor and fix data size.
10315         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
10316         base class constructor and fix data size.
10317         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
10318         class constructor and fix data size.
10319         (Output_data_group::set_final_data_size): New method definition.
10320         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
10321         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
10322         class constructor and fix data size.
10323         (Output_relaxed_input_section): New class definition.
10324         (Output_section::Simple_input_section): New class definition.
10325         (Output_section::get_input_sections): Adjust parameter list.
10326         (Output_section::add_input_section_for_script): Same.
10327         (Output_section::save_states, Output_section::restore_states,
10328         Output_section::do_address_and_file_offset_have_reset_values,
10329         (Output_section::Input_section::Input_section): Handle
10330         RELAXED_INPUT_SECTION_CODE.  Add new overload for
10331         Output_relaxed_input_section.
10332         (Output_section::Input_section::is_input_section,
10333         Output_section::Input_section::set_output_section): Handle relaxed
10334         input section.
10335         (Output_section::Input_section::is_relaxed_input_section,
10336         Output_section::Input_section::output_section_data,
10337         Output_section::Input_section::relaxed_input_section): New method
10338         definitions.
10339         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
10340         value.
10341         (Output_section::Input_section::u1_): Update comments.
10342         (Output_section::Input_section::u2_): Add new union member poris.
10343         (Output_section::Checkpoint_output_section): New classs definition.
10344         (Output_section::relax_input_section): New method declaration.
10345         (Output_section::checkpoint_): New data member.
10346         (Output_segment): Update comments.
10347         (Output_segment::Output_segment): Un-privatize copy constructor.
10348         (Output_segment::operator=): Un-privatize.
10349         * script-sections.cc (Output_section_element::Input_section_list):
10350         Change element type to Output_section::Simple_input_section.
10351         (Output_section_element_dot_assignment::set_section_addresses):
10352         Register output section data for relaxation clean up.
10353         (Output_data_exression::Output_data_expression): Adjust call to base
10354         constructor to fix data size.
10355         (Output_section_element_data::set_section_addresses): Register
10356         Output_data_expression object for relaxation clean up.
10357         (struct Input_section_info): Replace Relobj pointer and section index
10358         pair with Output_section::Simple_input_section and Convert struct to a
10359         class.
10360         (Input_section_sorter::operator()): Adjust access to
10361         Input_section_info data member to use accessors.
10362         (Output_section_element_input::set_section_addresses): Use layout
10363         parameter.  Adjust code to use Output_section::Simple_input_section
10364         and Input_secction_info classes.  Register filler for relaxation
10365         clean up.
10366         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
10367         and section index pair with Output_section::Simple_input_section
10368         class.  Adjust code accordingly.
10369         (Phdrs_element::release_segment): New method definition.
10370         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
10371         segment list.
10372         (Script_sections::release_segments): New method definition.
10373         * gold/script-sections.h (Script_sections::release_segments): New
10374         method declaration.
10375         * gold/target.h (Target::may_relax, Target::relax,
10376         Target::do_may_relax, Target::do_relax): New method definitions.
10377
10378 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10379
10380         * arm.cc (has_signed_unsigned_overflow): New function.
10381         (Arm_relocate_functions::abs8): New function.
10382         (Target_arm::Scan::local): Handle R_ARM_ABS8.
10383         (Target_arm::Scan::global): Likewise.
10384         (Target_arm::relocate::relocate): Likewise.
10385         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10386         Likewise.
10387
10388 2009-09-16  Cary Coutant  <ccoutant@google.com>
10389
10390         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
10391         * testsuite/Makefile.in: Regenerate.
10392
10393 2009-09-11  Nick Clifton  <nickc@redhat.com>
10394
10395         * po/gold.pot: Updated by the Translation project.
10396
10397 2009-09-08  Cary Coutant  <ccoutant@google.com>
10398
10399         * output.cc (Output_file::open): Add execute permission to empty file.
10400         * testsuite/Makefile.am (permission_test): New test.
10401         * testsuite/Makefile.in: Regenerate.
10402
10403 2009-09-02  Ian Lance Taylor  <iant@google.com>
10404
10405         * output.cc (Output_file::resize): Call map_no_anonymous rather
10406         than map.
10407
10408 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
10409
10410         * gold.cc: Include "incremental.h".
10411         (queue_initial_tasks): Call Incremental_checker methods.
10412         * incremental.cc: Include "output.h".
10413         (Incremental_checker::can_incrementally_link_output_file): New
10414         method.
10415         * incremental.h (Incremental_checker): New class.
10416
10417         * output.cc (Output_file::open_for_modification): New method.
10418         (Output_file::map_anonymous): Changed return type to bool.  Record
10419         map in base_ field.
10420         (Output_file::map_no_anonymous): New method, broken out of map.
10421         (Output_file::map): Use map_no_anonymous and map_anonymous.
10422         * output.h (class Output_file): Update declarations.
10423
10424 2009-08-24  Cary Coutant  <ccoutant@google.com>
10425
10426         * options.h (Command_line::Pre_options): New class.
10427         (Command_line::pre_options): New member.
10428         * options.cc (gold::options::ready_to_register): New variable.
10429         (One_option::register_option): Do nothing if not registering options.
10430         Assert if same short option registered twice.
10431         (General_options::General_options): Turn off option registration when
10432         done constructing.
10433         (Command_line::Pre_options::Pre_options): New constructor.
10434
10435 2009-08-24  Cary Coutant  <ccoutant@google.com>
10436
10437         * options.h (General_options::no_keep_memory): Remove incorrect
10438         short option.
10439
10440 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10441
10442         * Makefile.am (am__skiplex, am__skipyacc): New.
10443         * Makefile.in: Regenerate.
10444
10445 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10446
10447         * Makefile.am (AM_CPPFLAGS): Renamed from ...
10448         (INCLUDES): ... this.
10449         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
10450         (AM_CPPFLAGS): Renamed from ...
10451         (INCLUDE): ... this.
10452         * Makefile.in, testsuite/Makefile.in: Regenerate.
10453
10454         * Makefile.in: Regenerate.
10455         * aclocal.m4: Likewise.
10456         * config.in: Likewise.
10457         * configure: Likewise.
10458         * testsuite/Makefile.in: Likewise.
10459
10460         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10461         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
10462         * Makefile.in: Regenerate.
10463         * testsuite/Makefile.in: Regenerate.
10464
10465 2009-08-19  Cary Coutant  <ccoutant@google.com>
10466
10467         * resolve.cc (Symbol_table::resolve): Don't complain about defined
10468         symbols in shared libraries overridden by hidden or internal symbols
10469         in the main program.
10470
10471 2009-08-19  Chris Demetriou  <cgd@google.com>
10472
10473         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
10474         checking source file names in error messages.
10475
10476 2009-08-18  Doug Kwan  <dougkwan@google.com>
10477
10478         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
10479         an elcpp::Ehdr as parameter.  Adjust call to set_target.
10480         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
10481         an elfcpp::Ehdr as parameter.
10482         * object.cc (Object::set_target): Remove the version that looks up
10483         a target and sets it.
10484         (Sized_relobj::setup): Take a Target object instead of
10485         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
10486         (make_elf_sized_object): Find target and ask target to
10487         make an ELF object.
10488         * object.h: (Object::set_target): Remove the version that looks up
10489         a target and sets it.
10490         (Sized_relobj::setup): Take a Target object instead of
10491         an elfcpp:Ehdr as parameter.
10492         * target.cc: Include dynobj.h.
10493         (Target::do_make_elf_object_implementation): New.
10494         (Target::do_make_elf_object): New.
10495         * target.h (Target::make_elf_object): New template declaration.
10496         (Target::do_make_elf_object): New method declarations.
10497         (Target::do_make_elf_object_implementation): New template declaration.
10498
10499 2009-08-14  Ian Lance Taylor  <iant@google.com>
10500
10501         * gold.h (FUNCTION_NAME): Define.
10502         (gold_unreachable): Use FUNCTION_NAME.
10503
10504 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10505
10506         * icf.cc (Icf::find_identical_sections): Issue a warning when a
10507         symbol in the --keep-unique list is not found.
10508
10509 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
10510
10511         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
10512         been maked as --keep-unique.
10513         (Icf::unfold_section): New function.
10514         * icf.h (Icf::unfold_section): New function.
10515         * options.h (General_options::keep_unique): New option.
10516         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
10517         * testsuite/Makefile.in: Regenerate.
10518         * testsuite/icf_keep_unique_test.sh: New file.
10519         * testsuite/icf_keep_unique_test.cc: New file.
10520
10521 2009-08-12  Cary Coutant  <ccoutant@google.com>
10522
10523         PR 10471
10524         * resolve.cc (Symbol_table::resolve): Check for references from
10525         dynamic objects to hidden and internal symbols.
10526         * testsuite/Makefile.am (hidden_test.sh): New test.
10527         * testsuite/Makefile.in: Regenerate.
10528         * testsuite/hidden_test.sh: New script.
10529         * testsuite/hidden_test_1.c: New test source.
10530         * testsuite/hidden_test_main.c: New test source.
10531
10532 2009-08-11  Doug Kwan  <dougkwan@google.com>
10533
10534         * arm.cc: Update comments.
10535         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
10536         segment to locate the .ARM.exidx section if present.
10537
10538 2009-08-09  Doug Kwan  <dougkwan@google.com>
10539
10540         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
10541         patch.
10542
10543 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
10544         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
10545         compiler warnings.
10546
10547 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
10548
10549         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
10550         valid tls_segment only for non-debug-section relocations.
10551         * testsuite/Makefile.am: Add gc_tls_test.
10552         * testsuite/Makefile.in: Regenerate.
10553         * testsuite/gc_tls_test.cc: New file.
10554         * testsuite/gc_tls_test.sh: New file.
10555
10556 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
10557
10558         * icf.cc: New file.
10559         * icf.h: New file.
10560         * Makefile.am (CCFILES): Add icf.cc.
10561         (HFILES): Add icf.h
10562         * Makefile.in: Regenerate.
10563         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
10564         * gc.h (gc_process_relocs): Populate lists used by icf to contain
10565         section, symbol and addend information for the relocs.
10566         * gold.cc (queue_middle_tasks): Call identical code folding.
10567         * gold.h: Add defines for multimap.
10568         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
10569         to the call of finalize_local_symbols.
10570         * main.cc (main): Create object of class Icf.
10571         * object.cc (Sized_relobj::do_layout): Allow this function to be
10572         called twice during icf.
10573         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
10574         to sections marked as identical by icf.
10575         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
10576         when available.
10577         (Sized_relobj::do_section_entsize): New function.
10578         * object.h (Object::section_entsize): New function.
10579         (Object::do_section_entsize): New pure virtual function.
10580         (Relobj::finalize_local_symbols): Add new parameter.
10581         (Relobj::do_section_entsize): New function.
10582         * options.h (General_options::icf): New option.
10583         (General_options::icf_iterations): New option.
10584         (General_options::print_icf_sections): New option.
10585         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
10586         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
10587         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
10588         icf.
10589         * symtab.cc (Symbol_table::is_section_folded): New function.
10590         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
10591         to sections marked as identical by icf.
10592         * symtab.h (Symbol_table::set_icf): New function.
10593         (Symbol_table::icf): New function.
10594         (Symbol_table::is_section_folded): New function.
10595         (Symbol_table::icf_): New data member.
10596         * target-reloc.h (relocate_section): Ignore sections folded by icf.
10597         * testsuite/Makefile.am: Add commands to build icf_test.
10598         * testsuite/Makefile.in: Regenerate.
10599         * testsuite/icf_test.sh: New file.
10600         * testsuite/icf_test.cc: New file.
10601
10602 2009-07-24  Chris Demetriou  <cgd@google.com>
10603
10604         * layout.cc (is_compressible_debug_section): Fix incorrect
10605         comment about compressed section names.
10606
10607 2009-07-20  Ian Lance Taylor  <ian@airs.com>
10608
10609         PR 10419
10610         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
10611
10612 2009-07-16  Ian Lance Taylor  <iant@google.com>
10613
10614         PR 10400
10615         * layout.h: #include <map>.
10616         (class Kept_section): Change from struct to class.  Add accessors
10617         and setters.  Add section size to Comdat_group mapping.  Change
10618         Comdat_group to std::map.  Add is_comdat_ field.  Add
10619         linkonce_size field in union.
10620         (class Layout): Update declaration of find_or_add_kept_section.
10621         Don't declare find_kept_object.
10622         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
10623         parameter.  Add object, shndx, is_comdat, and is_group_name
10624         parameters.  Change all callers.  Adjust for new Kept_section.
10625         (Layout::find_kept_object): Remove.
10626         * object.cc (Sized_relobj::include_section_group): Update use of
10627         Kept_section.  Rename secnum to shndx.  Only record
10628         Kept_comdat_section if sections are the same size.
10629         (Sized_relobj::include_linkonce_section): Update use of
10630         Kept_section.  Only record Kept_comdat_section if sections are the
10631         same size.  Set size of linkonce section.
10632         (Sized_relobj::map_to_kept_section): Update call to
10633         get_kept_comdat_section.
10634         * object.h (class Sized_relobj): Rename fields in
10635         Kept_comdat_section to drop trailing underscores; change object
10636         field to Relobj*.  Change Kept_comdat_section_table to store
10637         struct rather than pointer.
10638         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
10639         Add kept_object and kept_shndx parameters.  Change all callers.
10640         (Sized_relobj::get_kept_comdat_section): Change return type to
10641         bool.  Add kept_object and kept_shndx parameters.  Change all
10642         callers.
10643         * plugin.cc (Pluginobj::include_comdat_group): Update call to
10644         Layout::find_or_add_kept_section.
10645
10646 2009-07-09  Ian Lance Taylor  <iant@google.com>
10647
10648         * merge.cc (Object_merge_map::initialize_input_to_output_map):
10649         Reserve space in the hash table.
10650
10651 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
10652
10653         * fileread.cc (File_read::get_mtime): New method.
10654         * fileread.h (Timespec): New structure.
10655         (File_read::get_mtime): New method.
10656         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
10657         Renamed from timestamp_nsec.
10658         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
10659         Elf_Xword.
10660         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
10661         timestamp_nsec.
10662         (Incremental_inputs::report_archive): Save mtime; style fix.
10663         (Incremental_inputs::report_obejct): Save mtime; style fix.
10664         (Incremental_inputs::report_script): Save mtime; style fix.
10665         (Incremental_inputs::finalize_inputs): Style fix.
10666         (Incremental_inputs::finalize): Style fix.
10667         (Incremental_inputs::create_input_section_data): Store inputs
10668         mtime.
10669         * incremental.h (Incremental_inputs::report_script): Add mtime
10670         argument.
10671         (Incremental_inputs::Input_info::Input_info): Intialize only one
10672         union member.
10673         (Incremental_inputs::Input_info::archive): Move to nameless
10674         union.
10675         (Incremental_inputs::Input_info::obejct): Move to nameless union.
10676         (Incremental_inputs::Input_info::script): Move to nameless union.
10677         (Incremental_inputs::mtime): New field.
10678         * script.cc (read_input_script): Pass file mtime to
10679         Incremental_input.
10680         * script.h (Script_info::inputs): Style fix.
10681
10682 2009-07-01  Ian Lance Taylor  <ian@airs.com>
10683
10684         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
10685         instead of 32.
10686
10687 2009-06-24  Ian Lance Taylor  <iant@google.com>
10688
10689         PR 10156
10690         * layout.cc (Layout::choose_output_section): If we find an
10691         existing section, update the flags.
10692         (Layout::create_notes): New function, broken out of
10693         Layout::finalize.
10694         (Layout::finalize): Don't create note sections.
10695         (Layout::create_note): Don't crash if linker script discards
10696         section.
10697         (Layout::create_gold_note): Likewise.
10698         (Layout::create_build_id): Likewise.  Don't set
10699         after_input_sections on the section.
10700         (Layout::create_executable_stack_info): Remove target parameter.
10701         Change caller.
10702         * layout.h (class Layout): Declare create_notes.  Update
10703         declaration of create_executable_stack_info.
10704         * gold.cc (queue_middle_tasks): Call create_notes.
10705         * output.cc (Output_section::update_flags_for_input_section): Move
10706         here from output.h.  If SHF_ALLOC flag is newly set, mark address
10707         invalid.
10708         * output.h (Output_data::mark_address_invalid): New function.
10709         (class Output_section): Only declare, not define,
10710         update_flags_for_input_section.  Remove set_flags.
10711
10712 2009-06-24  Ian Lance Taylor  <iant@google.com>
10713
10714         * script-sections.cc (Output_section_definition::
10715         set_section_addresses): Rename shadowing local load_address to
10716         laddr.
10717
10718 2009-06-24  Ian Lance Taylor  <iant@google.com>
10719
10720         PR 10244
10721         * reloc.cc (relocate_sections): Skip empty relocation sections.
10722
10723 2009-06-23  Ian Lance Taylor  <iant@google.com>
10724
10725         PR 10156
10726         * layout.cc (Layout::create_note): Use choose_output_section
10727         rather than make_output_section.
10728
10729 2009-06-23  Ian Lance Taylor  <iant@google.com>
10730
10731         PR 10237
10732         * options.cc (General_options::parse_V): Set printed_version_.
10733         (General_options::General_options): Initialize printed_version_.
10734         * options.h (class General_options): Add printed_version_ field.
10735         * gold.cc (queue_initial_tasks): If there are no input files,
10736         don't give a fatal error if we printed the version information.
10737         (queue_middle_tasks): If using -r with a shared object, give a
10738         fatal error rather than an ordinary error.
10739
10740 2009-06-23  Ian Lance Taylor  <iant@google.com>
10741
10742         PR 10219
10743         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
10744         (Layout::make_output_section): Set have_stabstr_section_ if we see
10745         a .stab*str section.
10746         (Layout::finalize): Call link_stabs_sections.
10747         (Layout::link_stabs_sections): New file.
10748         * layout.h (class Layout): Add have_stabstr_section_ field.
10749         Declare link_stabs_sections.
10750
10751 2009-06-23  Doug Kwan  <dougkwan@google.com>
10752
10753         * Makefile.am (libgold_a_LIBADD): New.
10754         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
10755         * Makefile.in: Regenerate.
10756         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
10757         * configure: Regenerate.
10758         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
10759         * fileread.cc: Include sys/state.h
10760         * gold.h: Declare memmem and strndup if found missing.
10761         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
10762
10763 2009-06-23  Ian Lance Taylor  <iant@google.com>
10764
10765         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
10766         * configure: Rebuild.
10767
10768 2009-06-23  Ian Lance Taylor  <iant@google.com>
10769
10770         PR 10147
10771         * object.cc (Object::section_contents): Don't try to get a view if
10772         the section has length zero.
10773         (Object::handle_gnu_warning_section): If the section is empty, use
10774         the name of the section as the warning.
10775
10776 2009-06-23  Ian Lance Taylor  <iant@google.com>
10777
10778         PR 10133
10779         * stringpool.h (class Stringpool_template): Add optimize_ field.
10780         (Stringpool_template::set_optimize): New function.
10781         * stringpool.cc (Stringpool_template::Stringpool_template):
10782         Initialize optimize_ field.
10783         (Stringpool_template::set_string_offsets): Test local optimize
10784         fild rather than parameter.
10785         * layout.cc (Layout::Layout): Call set_optimize on the section
10786         name stringpool.
10787
10788 2009-06-22  Ian Lance Taylor  <iant@google.com>
10789
10790         PR 10030
10791         * yyscript.y: Parse TARGET.
10792         * script.cc (script_set_target): New function.
10793         * script-c.h (script_set_target): Declare.
10794         * options.cc (General_options::string_to_object_format): Rename
10795         from string_to_object_format in anonymous namespace.  Change
10796         callers.
10797         * options.h (class General_options): Declare
10798         string_to_object_format.
10799
10800 2009-06-22  Ian Lance Taylor  <iant@google.com>
10801
10802         * script-sections.cc (Script_sections::create_segments): Don't put
10803         program headers in a PT_LOAD segment if -n or -N.
10804
10805 2009-06-22  Ian Lance Taylor  <iant@google.com>
10806
10807         PR 10141
10808         * options.h (class General_options): Add -z lazy and -z now.  Sort
10809         -z options into alphabetical order.
10810         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
10811
10812 2009-06-21  Ian Lance Taylor  <iant@google.com>
10813
10814         * layout.cc (Layout::make_output_section): Call
10815         Target::new_output_section.
10816         (Layout::attach_allocated_section_to_segment): Put large section
10817         sections in a separate load segment with the large segment flag
10818         set.
10819         (Layout::segment_precedes): Sort large data segments after other
10820         load segments.
10821         (align_file_offset): New static function.
10822         (Layout::set_segment_offsets): Use align_file_offset.
10823         * output.h (class Output_section): Add is_small_section_ and
10824         is_large_section_ fields.
10825         (Output_section::is_small_section): New function.
10826         (Output_section::set_is_small_section):  New function.
10827         (Output_section::is_large_section): New function.
10828         (Output_section::set_is_large_section): New function.
10829         (Output_section::is_large_data_section): New function.
10830         (class Output_segment): Add is_large_data_segment_ field.
10831         (Output_segment::is_large_data_segment): New function.
10832         (Output_segment::set_is_large_data_segment): New function.
10833         * output.cc (Output_section::Output_section): Initialize new
10834         fields.
10835         (Output_segment::Output_segment): Likewise.
10836         (Output_segment::add_output_section): Add assertion that large
10837         data sections always go in large data segments.  Force small data
10838         sections to the end of the list of data sections.  Force small BSS
10839         sections to the start of the list of BSS sections.  For large BSS
10840         sections to the end of the list of BSS sections.
10841         * symtab.h (class Symbol): Declare is_common_shndx.
10842         (Symbol::is_defined): Check Symbol::is_common_shndx.
10843         (Symbol::is_common): Likewise.
10844         (class Symbol_table): Define enum Commons_section_type.  Update
10845         declarations.  Add small_commons_ and large_commons_ fields.
10846         * symtab.cc (Symbol::is_common_shndx): New function.
10847         (Symbol_table::Symbol_table): Initialize new fields.
10848         (Symbol_table::add_from_object): Put small and large common
10849         symbols in the right list.
10850         (Symbol_table::sized_finalized_symbol): Check
10851         Symbol::is_common_shndx.
10852         (Symbol_table::sized_write_globals): Likewise.
10853         * common.cc (Symbol_table::do_allocate_commons): Allocate new
10854         common symbol lists.  Don't call do_allocate_commons_list if the
10855         list is empty.
10856         (Symbol_table::do_allocate_commons_list): Remove is_tls
10857         parameter.  Add comons_section_type parameter.  Change all
10858         callers.  Handle small and large common symbols.
10859         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
10860         Symbol::is_common_shndx.
10861         * resolve.cc (symbol_to_bits): Likewise.
10862         * target.h (Target::small_common_shndx): New function.
10863         (Target::small_common_section_flags): New function.
10864         (Target::large_common_shndx): New function.
10865         (Target::large_common_section_flags): New function.
10866         (Target::new_output_section): New function.
10867         (Target::Target_info): Add small_common_shndx, large_common_shndx,
10868         small_common_section_flags, and large_common_section_flags
10869         fields.
10870         (Target::do_new_output_section): New virtual function.
10871         * arm.cc (Target_arm::arm_info): Initialize new fields.
10872         * i386.cc (Target_i386::i386_info): Likewise.
10873         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
10874         Likewise.
10875         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
10876         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
10877         (Target_x86_64::do_new_output_section): New function.
10878         * configure.ac: Define conditional MCMODEL_MEDIUM.
10879         * testsuite/Makefile.am (check_PROGRAMS): Add large.
10880         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
10881         (large_LDFLAGS): Define.
10882         * testsuite/large.c: New file.
10883         * testsuite/testfile.cc (Target_test::test_target_info):
10884         Initialize new fields.
10885         * configure, testsuite/Makefile.in: Rebuild.
10886
10887 2009-06-05  Doug Kwan  <dougkwan@google.com>
10888
10889         * Makefile.am (CCFILES): Add target.cc.
10890         * Makefile.in: Regenerate.
10891         * i386.cc (class Target_i386): Define new virtual method to
10892         override do_is_local_label_name in parent.
10893         * object.cc (Sized_relobj::do_count_local_symbols): Discard
10894         local symbols if --discard-locals or -X is given.
10895         * options.h (class General_options): Declare new options
10896         '--discard-locals' and '-X' for discarding locals.
10897         * target.h (class Target): Define new methods is_local_label_name.
10898         Declare new virtual method do_is_local_label_name.
10899         * target.cc: New file.
10900         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
10901         (check_SCRIPTS): Add discard_locals_test.sh.
10902         (check_DATA): Add discard_local_tests.syms.
10903         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
10904         (discard_local_tests.syms, discard_locals_test.o): New make rules.
10905         * testsuite/Makefile.in: Regenerate.
10906         * testsuite/discard_locals_test.c: New file.
10907         * testsuite/discard_locals_test.sh: Same.
10908
10909 2009-06-05  Doug Kwan  <dougkwan@google.com>
10910
10911         * object.cc (Sized_relobj::Sized_relobj): Initialize
10912         discarded_eh_frame_shndx_ to -1U.
10913         (Sized_relobj::do_layout): Record index of a discard .eh_frame
10914         section.
10915         (Sized_relobj::do_count_local_symbols): Skip local symbols in
10916         a discarded .eh_frame section.
10917         (Sized_relobj::do_finalize_local_symbols): Ditto.
10918         * object.h (class Sized_relobj): Declare new member
10919         discarded_eh_frame_shndx_.
10920         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
10921         (local_labels_test.o, local_labels_test): New rules.
10922         * testsuite/Makefile.in: Regenerate.
10923
10924 2009-06-04  Doug Kwan  <dougkwan@google.com>
10925
10926         * layout.cc (Layout::section_name_mapping): Add mapping for
10927         special ARM sections.
10928
10929 2009-06-03  Doug Kwan  <dougkwan@google.com>
10930
10931         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
10932         (utils::has_overflow): Same.
10933
10934 2009-06-03  Ian Lance Taylor  <iant@google.com>
10935
10936         * layout.cc (Layout::section_name_mapping): New array, replacing
10937         Layout::linkonce_mapping.
10938         (Layout::section_name_mapping_count): New variable, replacing
10939         Layout::linkonce_mapping_count.
10940         (Layout::linkonce_output_name): Remove.
10941         (Layout::output_section_name): Rewrite.
10942         * layout.h (class Layout): Rename Linkonce_mapping to
10943         Section_name_mapping, linkonce_mapping to section_name_mapping,
10944         linkonce_mapping_count to section_name_mapping_count.  Don't
10945         declare linkonce_output_name.
10946
10947 2009-06-03  Doug Kwan  <dougkwan@google.com>
10948
10949         * gold/arm.cc (namespace utils): New.
10950         (Target_arm::reloc_is_non_pic): Define new method.
10951         (class Arm_relocate_functions): New.
10952         (Target_arm::Relocate::relocate): Handle relocation types used by
10953         Android.
10954
10955 2009-06-03  Ian Lance Taylor  <iant@google.com>
10956
10957         * arm.cc (Target_arm::scan::global): Use || instead of |.
10958
10959 2009-06-02  Doug Kwan  <dougkwan@google.com>
10960
10961         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
10962         issued_non_pic_error_.
10963         (class Target_arm::Scan): Declare new method check_non_pic.
10964         Define new method symbol_needs_plt_entry.
10965         Declare new data member issued_non_pic_error_.
10966         (class Target_arm::Relocate): Declare new method
10967         should_apply_static_reloc.
10968         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
10969         (Target_arm::Scan::check_non_pic): Define new method.
10970         (Target_arm::Scan::local): Handle a small subset of reloc types used
10971         by Android.
10972         (Target_arm::Scan::local): Same.
10973         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
10974
10975 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
10976
10977         * incremental.cc (Incremental_inputs::report_command_line): Filter
10978         out --incremental-* options.
10979
10980 2009-05-29  Doug Kwan  <dougkwan@google.com>
10981
10982         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
10983         template class.
10984         (class Target_arm): Update comment.
10985         (Target_arm::Target_arm): Initialize new data members GOT_,
10986         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
10987         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
10988         and Target_arm::rel_dyn_section.
10989         Declare new_enum Target_arm::Got_type.
10990         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
10991         and DYNBSS_.
10992         Update commments for member do_dynsym_value.
10993         (Target_arm::got_size, Target_arm::plt_section,
10994         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
10995         new methods inside class defintion.
10996         (Target_arm::got_section): Define new method.
10997         (Target_arm::rel_dyn_section): Same.
10998         (Output_data_plt_arm): New template class.
10999         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11000         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11001         (Output_data_plt_arm::add_entry): Same.
11002         (Output_data_plt_arm::first_plt_entry): Define new
11003         static data member for PLT instruction template.
11004         (Output_data_plt_arm::plt_entry): Same.
11005         (Output_data_plt_arm::do_write): Define new method.
11006         (Target_arm::make_plt_entry): Same.
11007         (Target_arm::do_finalize_sections): Same.
11008         (Target_arm::do_dynsym_value): Same.
11009
11010 2009-05-28  Doug Kwan  <dougkwan@google.com>
11011
11012         * Makefile.am (TARGETSOURCES): Add arm.cc.
11013         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11014         * Makefile.in: Regenerate.
11015         * arm.cc: New file.
11016         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11017
11018 2009-05-26  Doug Kwan  <dougkwan@google.com>
11019
11020         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11021         (General_options::check_excluded_libs): Strip off directories in
11022         archive name before matching like GNU ld does.
11023         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11024         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11025         (exclude_libs_test_LDFLAGS): Add linker option
11026         -Wl,--exclude-libs,libexclude_libs_test_3
11027         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11028         an explicit archive without using -l.
11029         (alt/libexclude_libs_test_3.a): New make rule.
11030         * testsuite/Makefile.in: Regenerate.
11031         * testsuite/exclude_libs_test.c : Declare lib3_default().
11032         (main): Call it.
11033         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11034         * exclude_libs_test_3.c: New file.
11035
11036 2009-05-26  Nick Clifton  <nickc@redhat.com>
11037
11038         * po/id.po: New Indonesian translation.
11039         * po/gold.pot: Updated template file.
11040
11041 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11042
11043         * testsuite/Makefile.am: Add -ffunction-sections to compile
11044         gc_comdat_test files.  Add -Wl,--gc-sections to build
11045         gc_comdat_test.
11046         * testsuite/Makefile.in: Regenerate.
11047         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11048
11049 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11050
11051         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11052         kept comdat section was garbage collected.
11053         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11054         * testsuite/Makefile.in: Regenerate.
11055         * testsuite/gc_comdat_test.sh: New file.
11056         * testsuite/gc_comdat_test_1.cc: New file.
11057         * testsuite/gc_comdat_test_2.cc: New file.
11058
11059 2009-05-19  Doug Kwan  <dougkwan@google.com>
11060
11061         * archive.cc (Archive::Archive): Move constructor from archive.h
11062         to here.  Initialize no_export_.
11063         (Archive::get_elf_object_for_member): Set no_export flag of object.
11064         * archive.h (Archive::Archive): Move constructor body to
11065         archive.cc.
11066         (Archive::no_export): New method.
11067         (Archive::no_export_): New field.
11068         * object.h (Object::Object): Initialize no_export_ to false.
11069         (Object::no_export, Object::set_no_export): New methods.
11070         (Object::no_export_): New field.
11071         * options.cc (General_options::parse_exclude_libs): New method.
11072         (General_options::check_excluded_libs) Same.
11073         * options.h (exclude_libs): New option.
11074         (General_options::check_excluded_libs): New method declaration.
11075         (General_options::excluded_libs_): New field.
11076         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11077         default or protected visibility if an object has no-export flag set.
11078         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11079         (check_SCRIPTS): Add exclude_libs_test.sh.
11080         (check_DATA): Add exclude_libs_test.syms.
11081         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11082         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11083         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11084         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11085         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11086         libexclude_libs_test_2.a): New rules.
11087         * testsuite/Makefile.in: Regenerate.
11088         * testsuite/exclude_libs_test.c: New file.
11089         * testsuite/exclude_libs_test.sh: Ditto.
11090         * testsuite/exclude_libs_test_1.c: Ditto.
11091         * testsuite/exclude_libs_test_2.c: Ditto.
11092
11093 2009-05-15  Ian Lance Taylor  <iant@google.com>
11094
11095         * configure.ac: Check for declarations for cases where libiberty.h
11096         checks HAVE_DECL_xxx.
11097         * configure, config.in: Rebuild.
11098
11099 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11100
11101         * gold.h (Incremental_argument_list): Remove (invalid) forward
11102         declaration.
11103         * incremental.cc (Incremental_inputs::report_achive): New method.
11104         (Incremental_inputs::report_object): New method.
11105         (Incremental_inputs::report_script): New method.
11106         (Incremental_inputs::finalize_inputs): New method.
11107         (Incremental_inputs::finalize): Call finalize_inputs().
11108         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11109         Create inputs entries.
11110         * incremental.h (Incremental_input_type): New enum.
11111         (Incremental_inputs::Incremental_input): Initialize new fields.
11112         (Incremental_inputs::report_inputs): New method.
11113         (Incremental_inputs::report_achive): New method.
11114         (Incremental_inputs::report_object): New method.
11115         (Incremental_inputs::report_script): New method.
11116         (Incremental_inputs::finalize_inputs): New method.
11117         (Incremental_inputs::Input_info): New struct.
11118         (Incremental_inputs::Input_info_map): New typedef.
11119         (Incremental_inputs::lock_): New field.
11120         (Incremental_inputs::Inputs_): New field.
11121         (Incremental_inputs::Inputs_map): New field.
11122         * main.cc (main): Call Incremental_input::report_inputs.
11123         * options.h (Input_argument_list): Typedef moved from
11124         Input_arguments.
11125         (Input_file_group::Files): Remove, use ::Input_argument_list.
11126         (Input_file_group::Input_argument_list): Remove, use
11127         ::Input_argument_list.
11128         * plugin.cc (Plugin_manager::add_input_file): Add error in
11129         incremental build.
11130         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
11131         functions.
11132         * script.cc (read_input_script): Call
11133         Incremental_input::report_script.
11134         * script.h (Script_info): New class.
11135
11136 2009-04-27  Ian Lance Taylor  <iant@google.com>
11137
11138         * x86_64.cc (do_adjust_output_section): Set entsize to
11139         plt_entry_size.
11140
11141 2009-04-23  Elliott Hughes  <enh@google.com>
11142
11143         * output.cc (Output_file::close): After short writes, continue
11144         writing from the correct offset in the buffer being written.
11145
11146 2009-04-23  Chris Demetriou  <cgd@google.com>
11147
11148         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
11149         * configure: Regenerate.
11150         * config.in: Regenerate.
11151         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
11152         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
11153
11154 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
11155
11156         * incremental.cc (Incremental_inputs_header_data): Renamed from
11157         Incremental_input_header_data.
11158         (Incremental_inputs_header_data::data_size): New field.
11159         (Incremental_inputs_header_data::put_input_file_count): Renamed
11160         from input_file_count.
11161         (Incremental_inputs_header_data::put_command_line_offset): Renamed
11162         from command_line_offset.
11163         (Incremental_inputs_header_data::put_reserved): Renamed from
11164         put_reserved.
11165         (Incremental_inputs_entry_data): Renamed from
11166         Incremental_input_entry_data.
11167         (Incremental_inputs_entry_data::data_size): New field.
11168         (Incremental_inputs::report_command_line): New method.
11169         (Incremental_inputs::finalize): New method.
11170         (Incremental_inputs::create_incremental_inputs_data): New method.
11171         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
11172         * incremental.h: New file.
11173         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
11174         (Layout::finalize): Create incremental inputs section in
11175         incremental builds.
11176         (Layout::create_incremental_info_sections): New method.
11177         * layout.h (Layout::incremental_inputs): New method.
11178         (Layout::create_incremental_info_sections): New method.
11179         (Layout::incremental_inputs_): New field.
11180         * main.cc (main): Notify Incremental_input of the command line.
11181
11182 2009-04-01  Ian Lance Taylor  <iant@google.com>
11183             Mikolaj Zalewski  <mikolajz@google.com>
11184
11185         * gold.h (reserve_unordered_map): Define, three versions, one for
11186         each version of Unordered_map.
11187         * layout.cc (Layout::Layout): Remove options parameter.  Add
11188         number_of_input_files parameter.  Don't initialize options_.
11189         Initialize number_of_input_files_ and resized_signatures_.  Move
11190         sections_are_attached_.
11191         (Layout::layout_group): Reserve space for group_signatures_.
11192         (Layout::find_or_add_kept_section): Change name parameter to be a
11193         reference.  Resize signatures_ map when it gets large enough.
11194         (Layout::layout_eh_frame): Use parameters->options() instead of
11195         this->options_.
11196         (Layout::make_output_section): Likewise.
11197         (Layout::attach_allocated_section_to_segment): Likewise.
11198         (Layout::finalize, Layout::create_executable_stack): Likewise.
11199         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
11200         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
11201         * layout.h (class Layout): Update declarations.  Remove options_
11202         field.  Add number_of_input_files_ and resized_signatures_
11203         fields.  Move sections_are_attached_ field.
11204         * main.cc (main): Pass number of input files to Layout
11205         constructor.  Don't pass options.
11206
11207 2009-03-30  Ian Lance Taylor  <iant@google.com>
11208
11209         * ffsll.c (ffsll): Correct implementation.
11210
11211 2009-03-27  Ian Lance Taylor  <iant@google.com>
11212
11213         * ffsll.c: New file.
11214         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
11215         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
11216         * ftruncate.c (ftruncate): Declare before definition.
11217         * mremap.c (mremap): Likewise.
11218         * pread.c (pread): Likewise.
11219         * configure, Makefile.in, config.in: Rebuild.
11220
11221         * mremap.c: New file.
11222         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
11223         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
11224         (mremap): Declare if HAVE_MREMAP is not defined.
11225         * configure, Makefile.in, config.in: Rebuild.
11226
11227 2009-03-27  Cary Coutant  <ccoutant@google.com>
11228
11229         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
11230         position independent.
11231         * sparc.cc (Target_sparc::check_non_pic): Likewise.
11232         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
11233
11234 2009-03-24  Cary Coutant  <ccoutant@google.com>
11235
11236         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
11237         an executable.
11238         (needs_dynamic_reloc): Likewise.
11239
11240 2009-03-24  Ian Lance Taylor  <iant@google.com>
11241
11242         * yyscript.y (file_cmd): Recognize EXTERN.
11243         (extern_name_list, extern_name_list_body): New nonterminals.
11244         * script.cc (script_add_extern): Define.
11245         * script-c.h (script_add_extern): Declare.
11246
11247 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
11248
11249         * object.cc (is_elf_object): Define.
11250         * object.h (is_elf_object): Declare.
11251         * archive.cc (Archive::get_elf_object_for_member): Call
11252         is_elf_object.
11253         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
11254
11255 2009-03-24  Elliott Hughes  <enh@google.com>
11256
11257         * output.cc (Output_file::map_anonymous): Define.
11258         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
11259         try an anonymous one.  Report the size if the mmap fails.
11260         * output.h (class Output_file): Declare map_anonymous.
11261
11262 2009-03-24  Ian Lance Taylor  <iant@google.com>
11263
11264         * target-select.cc (instantiate_target): Don't acquire the lock if
11265         the instantiated_target_ field has already been set.
11266
11267 2009-03-23  Ian Lance Taylor  <iant@google.com>
11268
11269         * gold-threads.h (class Initialize_lock): Define.
11270         * gold-threads.cc (class Initialize_lock_once): Define.
11271         (initialize_lock_control): New static variable.
11272         (initialize_lock_pointer): New static variable.
11273         (initialize_lock_once): New static function.
11274         (Initialize_lock::Initialize_lock): Define.
11275         (Initialize_lock::initialize): Define.
11276         * target-select.h: Include "gold-threads.h".
11277         (class Target_selector): Add lock_ and initialize_lock_ fields.
11278         Don't define instantiate_target, just declare it.
11279         * target-select.cc (Target_selector::Target_selector): Initialize
11280         new fields.
11281         (Target_selector::instantiate_target): Define.
11282         * descriptors.h: Include "gold-threads.h".
11283         (class Descriptors): Add initialize_lock_ field.
11284         * descriptors.cc (Descriptors::Descriptors): Initialize new
11285         field.
11286         (Descriptors::open): Use initialize_lock_ field
11287         * errors.h (class Errors): Add initialize_lock_ field.
11288         * errors.cc (Errors::Errors): Initialize new field.
11289         (Errors::initialize_lock): Use initialize_lock_ field.
11290         * powerpc.cc (class Target_selector_powerpc): Remove
11291         instantiated_target_ field.  In do_recognize call
11292         instantiate_target rather than do_instantiate_target.  In
11293         do_instantiate_target just allocate a new target.
11294         * sparc.cc (class Target_selector_sparc): Likewise.
11295
11296         * freebsd.h: New file.
11297         * i386.cc: Include "freebsd.h".
11298         (Target_i386): Derive from Target_freebsd rather than
11299         Sized_target.
11300         (Target_selector_i386): Derive from Target_selector_freebsd rather
11301         than Target_selector.
11302         * x86_64.cc: Include "freebsd.h".
11303         (Target_x86_64): Derive from Target_freebsd rather than
11304         Sized_target.
11305         (Target_selector_x86_64): Derive from Target_selector_freebsd
11306         rather than Target_selector.
11307         * target.h (class Target): Add adjust_elf_header and
11308         do_adjust_elf_header.
11309         * output.cc (Output_file_header:: do_sized_write): Call target
11310         adjust_elf_header routine.
11311         * configure.tgt: Set targ_osabi.
11312         * configure.ac: Define GOLD_DEFAULT_OSABI.
11313         * parameters.cc (Parameters::default_target): Pass
11314         GOLD_DEFAULT_OSABI to select_target.
11315         * target-select.h (class Target_selector): Make instantiate_target
11316         protected rather than private.
11317         * Makefile.am (HFILES): Add freebsd.h.
11318         * configure, Makefile.in, config.in: Rebuild.
11319
11320         * merge.cc (do_add_input_section): Correct pend value.  Change
11321         message about last entry not being null terminated from error to
11322         warning.
11323
11324 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
11325
11326         * incremental.cc: New file.
11327         * Makefile.am (CCFILES): Add incremental.cc.
11328         * Makefile.in: Rebuild.
11329
11330 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
11331
11332         * layout.cc (Layout::output_section_name): Preserve names
11333         of '.note.' sections.
11334
11335 2009-03-19  Ian Lance Taylor  <iant@google.com>
11336
11337         * descriptors.cc (Descriptors::open): Check that the options are
11338         valid before using them.
11339
11340 2009-03-18  Ian Lance Taylor  <iant@google.com>
11341
11342         * script-sections.h: Include <list>.
11343         (class Script_sections): Change Sections_elements from std::vector
11344         to std::list.  Typedef public Elements_iterator.  Add
11345         orphan_section_placement_, data_segment_align_start_, and
11346         saw_data_segment_align_ fields.  Remove data_segment_align_index_
11347         field.
11348         * script-sections.cc (class Orphan_section_placement): New class.
11349         (class Sections_element): Add virtual functions is_relro and
11350         orphan_section_init.  Remove virtual function place_orphan_here.
11351         (class Output_section_definition): Add is_relro and
11352         orphan_section_init.  Remove place_orphan_here.
11353         (class Orphan_output_section): Likewise.
11354         (Script_sections::Script_sections): Update for field changes.
11355         (Script_sections::data_segment_align): Set saw_data_segment_align_
11356         and data_segment_align_start_, not data_segment_align_index.
11357         (Script_sections::data_segment_relro_end): Check
11358         saw_data_segment_align_.  Use data_segment_align_start_ rather
11359         than data_segment_align_index_.
11360         (Script_sections::place_orphan): Rewrite to use
11361         Orphan_section_placement.
11362
11363 2009-03-17  Ian Lance Taylor  <iant@google.com>
11364
11365         * archive.cc (Archive::add_symbols): Check for a version attached
11366         to the symbol name in the archive map.
11367         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
11368         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
11369         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
11370         (ver_test_11.a): New target.
11371         * testsuite/Makefile.in: Rebuild.
11372
11373         * configure.ac: Check for chsize and posix_fallocate.  Replace
11374         ftruncate.
11375         * ftruncate.c: New file, from gnulib.
11376         * output.cc (posix_fallocate): Define dummy version if not
11377         HAVE_POSIX_FALLOCATE.
11378         (Output_file::map): Call posix_fallocate rather than lseek and
11379         write.
11380         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
11381         * configure, Makefile.in, config.in: Rebuild.
11382
11383 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
11384
11385         * layout.h (Layout::create_note): Add section_name parameter.
11386         * layout.cc (Layout::create_note): Likewise.
11387         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
11388
11389 2009-03-17  Ian Lance Taylor  <iant@google.com>
11390
11391         * descriptors.cc: Include "options.h".
11392         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
11393         (Descriptors::open): Always use O_CLOEXEC when opening a new
11394         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
11395         then set FD_CLOEXEC.
11396
11397         * sparc.cc (class Target_sparc): Add has_got_section.
11398         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
11399         make sure we have a GOT section.
11400
11401         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
11402         (Target_sparc::Scan::local): Likewise.
11403         (Target_sparc::Scan::global): Likewise.
11404         (Target_sparc::Relocate::relocate): Likewise.
11405         (Target_sparc::Relocate::relocate_tls): Likewise.
11406
11407         * symtab.cc (Symbol_table::define_default_version): New function,
11408         broken out of add_from_object.
11409         (Symbol_table::add_from_object): Call define_default_version.
11410         (Symbol_table::define_special_symbol): Add resolve_oldsym
11411         parameter.  Change all callers.  If the version for a symbol comes
11412         from a version script, resolve it with the symbol with the same
11413         name with no version.  Also add the symbol without a version if
11414         appropriate.
11415         (do_define_in_output_data): If resolving with oldsym, don't delete
11416         sym.
11417         (do_define_in_output_segment): Likewise.
11418         (do_define_as_constant): Likewise.
11419         * symtab.h (class Symbol_table): Update declarations.
11420
11421 2009-03-13  Ian Lance Taylor  <iant@google.com>
11422
11423         * readsyms.cc (Read_symbols::incompatible_warning): New function.
11424         (Read_symbols::requeue): New function.
11425         (Read_symbols::do_read_symbols): If make_elf_object fails because
11426         the target type is not configured, and the file was searched for,
11427         issue a warning and retry with the next directory.
11428         (Add_symbols::run): If the file has an incompatible format, and
11429         it was searched for, requeue the Read_symbols task.  On error,
11430         release the object.
11431         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
11432         dirindex parameter to constructor.  Change all callers.  Declare
11433         incompatible_warning and requeue.
11434         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
11435         input_argument_ and input_group_ fields.  Add them to
11436         constructor.  Change all callers.
11437         (class Read_script): Add dirindex_ field.  Add it to constructor.
11438         Change all callers.
11439         * archive.cc (Archive::setup): Remove input_objects parameter.
11440         Change all callers.
11441         (Archive::get_file_and_offset): Likewise.
11442         (Archive::read_all_symbols): Likewise.
11443         (Archive::read_symbols): Likewise.
11444         (Archive::get_elf_object_for_member): Remove input_objects
11445         parameter.  Add punconfigured parameter.  Change all callers.
11446         (Archive::add_symbols): Change return type to bool.  Check return
11447         value of include_member.
11448         (Archive::include_all_members): Likewise.
11449         (Archive::include_member): Change return type to bool.  Return
11450         false if first included object has incompatible target.  Set
11451         included_member_ field.
11452         (Add_archive_symbols::run): If add_symbols returns false, requeue
11453         Read_symbols task.
11454         * archive.h (class Archive): Add included_member_ field.
11455         Initialize it in constructor.  Add input_file and searched_for
11456         methods.  Update declarations.
11457         (class Add_archive_symbols): Add dirpath_, dirindex_, and
11458         input_argument_ fields.  Add them to constructor.  Change all
11459         callers.
11460         * script.cc: Include "target-select.h".
11461         (class Parser_closure): Add skip_on_incompatible_target_ and
11462         found_incompatible_target_ fields.  Add
11463         skip_on_incompatible_target parameter to constructor.  Change all
11464         callers.  Add methods skip_on_incompatible_target,
11465         clear_skip_on_incompatible_target, found_incompatible_target, and
11466         set_found_incompatible_target.
11467         (read_input_script): Add dirindex parameter.  Change all callers.
11468         If parser finds an incompatible target, requeue Read_symbols
11469         task.
11470         (script_set_symbol): Clear skip_on_incompatible_target in
11471         closure.
11472         (script_add_assertion, script_parse_option): Likewise.
11473         (script_start_sections, script_add_phdr): Likewise.
11474         (script_check_output_format): New function.
11475         * script.h (read_input_script): Update declaration.
11476         * script-c.h (script_check_output_format): Declare.
11477         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
11478         (ignore_cmd): Remove OUTPUT_FORMAT.
11479         * fileread.cc (Input_file::Input_file): Add explicit this.
11480         (Input_file::will_search_for): New function.
11481         (Input_file::open): Add pindex parameter.  Change all callers.
11482         * fileread.h (class Input_file): Add input_file_argument method.
11483         Declare will_search_for.  Update declarations.
11484         * object.cc (make_elf_object): Add punconfigured parameter.
11485         Change all callers.
11486         * object.h (class Object): Make input_file public.  Add
11487         searched_for method.
11488         (make_elf_object): Update declaration.
11489         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
11490         restart search.
11491         * dirsearch.h (class Dirsearch): Update declaration.
11492         * options.h (class General_options): Add --warn-search-mismatch.
11493         * parameters.cc (Parameters::is_compatible_target): New function.
11494         * parameters.h (class Parameters): Declare is_compatible_target.
11495         * workqueue.cc (Workqueue::add_blocker): New function.
11496         * workqueue.h (class Workqueue): Declare add_blocker.
11497
11498         * fileread.cc (Input_file::open): Remove options parameter.
11499         Change all callers.
11500         (Input_file::open_binary): Likewise.
11501         * script.cc (read_input_script): Likewise.
11502         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
11503         options parameter from constructor.  Change all callers.
11504         (class Read_script): Likewise.
11505         * fileread.h (class Input_file): Update declarations.
11506         * script.h (read_input_script): Update declaration.
11507
11508 2009-03-10  Nick Clifton  <nickc@redhat.com>
11509
11510         * po/es.po: New Spanish translation.
11511
11512 2009-03-06  Cary Coutant  <ccoutant@google.com>
11513
11514         * options.cc (parse_short_option): Keep dash_z from registering itself.
11515
11516 2009-03-03  Ian Lance Taylor  <iant@google.com>
11517
11518         PR 9918
11519         * target-reloc.h (relocate_section): Pass output_section to
11520         relocate.
11521         * i386.cc (Target_i386::should_apply_static_reloc): Add
11522         output_section parameter.  Change all callers.
11523         (Target_i386::Relocate::relocate): Add output_section parameter.
11524         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11525         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
11526         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
11527         * testsuite/two_file_shared.sh: New script.
11528         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
11529         (check_DATA): Add two_file_shared.dbg.
11530         (two_file_shared.dbg): New target.
11531         * testsuite/Makefile.in: Rebuild.
11532
11533 2009-03-01  Ian Lance Taylor  <iant@google.com>
11534
11535         * configure.ac: Check for byteswap.h.
11536         * configure: Rebuild.
11537         * config.in: Rebuild.
11538
11539 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
11540
11541         * layout.cc (Layout::find_or_add_kept_section): New function.
11542         (Layout::add_comdat): Removed.
11543         * layout.h (struct Kept_section): Move out of class Layout.
11544         Remove trailing underscores from field names.  Add group_sections
11545         field.  Rename group_ field to is_group.  Change all uses.
11546         (class Layout): Declare find_or_add_kept_section, not add_comdat.
11547         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
11548         comdat_groups_ field.
11549         (Sized_relobj::include_section_group): Use
11550         find_or_add_kept_section and Kept_section::group_sections.
11551         (Sized_relobj::include_linkonce_section): Likewise.
11552         * object.cc (class Sized_relobj): Don't define Comdat_group or
11553         Comdat_group_table.  Remove find_comdat_group and
11554         add_comdat_group.  Remove comdat_groups_ field.
11555         * plugin.cc (include_comdat_group): Use
11556         Layout::find_or_add_kept_section.
11557
11558 2009-02-28  Ian Lance Taylor  <iant@google.com>
11559
11560         * README: --gc-sections and map files are now supported.  Document
11561         some build requirements.
11562
11563         PR 6992
11564         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
11565         relocatable link set the value of the section symbol to zero.
11566         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
11567         relocatable link don't include the section address in the local
11568         symbol value.
11569
11570 2009-02-27  Ian Lance Taylor  <iant@google.com>
11571
11572         PR 6811
11573         * options.h (class Search_directory): Add is_system_directory.
11574         (class General_options): Declare is_in_system_directory.
11575         * options.cc (get_relative_sysroot): Make static.
11576         (get_default_sysroot): Make static.
11577         (General_optoins::is_in_system_directory): New function.
11578         * fileread.cc (Input_file::is_in_system_directory): New function.
11579         * fileread.h (class Input_file): Declare is_in_system_directory.
11580         * object.h (class Object): Add is_in_system_directory.
11581         (class Input_objects): Remove system_library_directory_ field.
11582         * object.cc (Input_objects::add_object): Don't set
11583         system_library_directory_.
11584         (input_objects::found_in_system_library_directory): Remove.
11585         * symtab.cc (Symbol_table::write_globals): Remove input_objects
11586         parameter.  Change all callers.
11587         (Symbol_table::sized_write_globals): Likewise.
11588         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
11589         Call Object::is_in_system_directory.
11590         * symtab.h (class Symbol_table): Update declarations.
11591
11592         PR 5990
11593         * descriptors.h (Open_descriptor): Add is_on_stack field.
11594         * descriptors.cc (Descriptors::open): If the descriptor is on the
11595         top of the stack, remove it.  Initialize is_on_stack field.
11596         (Descriptors::release): Only add pod to stack if it is not on the
11597         stack already.
11598         (Descriptors::close_some_descriptor): Clear stack_next and
11599         is_on_stack fields.
11600
11601         PR 7091
11602         * output.cc (Output_section::find_starting_output_address): Rename
11603         from starting_output_address; add PADDR parameter; change return
11604         type.
11605         * output.h (class Output_section): Declare
11606         find_starting_output_address instead of starting_output_address.
11607         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
11608         section symbol for which we can't find a merge section.
11609
11610         PR 9836
11611         * symtab.cc (Symbol_table::add_from_object): If the visibility is
11612         hidden or internal, force the symbol to be local.
11613         * resolve.cc (Symbol::override_visibility): Define.
11614         (Symbol::override_base): Use override_visibility.
11615         (Symbol_table::resolve): Likewise.
11616         (Symbol::override_base_with_special): Likewise.
11617         (Symbol_table::override_with_special): If the visibility is hidden
11618         or internal, force the symbol to be local.
11619         * symtab.h (class Symbol): Add set_visibility and
11620         override_visibility.
11621         * testsuite/ver_test_1.sh: New file.
11622         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
11623         (check_DATA): Add ver_test_1.syms.
11624         (ver_test_1.syms): New target.
11625         * testsuite/Makefile.in: Rebuild.
11626
11627 2009-02-25  Cary Coutant  <ccoutant@google.com>
11628
11629         * layout.cc (Layout::choose_output_section): Don't rename sections
11630         when using a linker script that has a SECTIONS clause.
11631         * Makefile.in: Regenerate.
11632
11633         * testsuite/Makefile.am (script_test_5.sh): New test case.
11634         * testsuite/Makefile.in: Regenerate.
11635         * testsuite/script_test_5.cc: New file.
11636         * testsuite/script_test_5.sh: New file.
11637         * testsuite/script_test_5.t: New file.
11638
11639 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
11640
11641         * archive.cc (Archive::include_member): Update calls to add_symbols.
11642         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
11643         the Layout argument.
11644         * dynobj.h (do_add_symbols): Add the Layout argument.
11645         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
11646         Layout argument.
11647         * object.h (Object::add_symbols): Add the Layout argument.
11648         (Object::do_add_symbols): Add the Layout argument.
11649         (Sized_relobj::do_add_symbols): Add the Layout argument.
11650         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
11651         Unify the two versions.
11652         (Add_plugin_symbols): Remove.
11653         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
11654         (Sized_pluginobj::do_add_symbols): Unify the two versions.
11655         (Add_plugin_symbols): Remove.
11656         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
11657         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
11658         (Add_symbols::run): Make it work with Pulginobj.
11659
11660 2009-02-06  Ian Lance Taylor  <iant@google.com>
11661
11662         * object.cc (Sized_relobj::do_layout): Make info message start
11663         with lower case letter.
11664
11665 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
11666
11667         * binary.cc: Fix file comment.
11668
11669         * options.h (enum Incremental_disposition): Define.
11670         (class General_options): Add new options: --incremental,
11671         --incremental_changed, --incremental_unchanged,
11672         --incremental_unknown.  Add incremental_disposition_ and
11673         implicit_incremental_ fields.
11674         (General_options::incremental_disposition): New function.
11675         (class Position_dependent_options): Add incremental_disposition
11676         option.
11677         (Position_dependent_options::copy_from_options): Set incremental
11678         dispositions.
11679         * options.cc (General_options::parse_incremental_changed): New
11680         function.
11681         (General_options::parse_incremental_unchanged): New function.
11682         (General_options::parse_incremental_unknown): New function.
11683         (General_options::General_options): Initialize new fields
11684         incremental_disposition_ and implicit_incremental_.
11685         (General_options::finalize): Check for uasge of --incremental-*
11686         without --incremental.
11687
11688 2009-02-06  Chris Demetriou  <cgd@google.com>
11689
11690         * gold.h (gold_undefined_symbol): Change to take only a Symbol
11691         pointer and to report location as the file name associated with
11692         the symbol.
11693         (gold_undefined_symbol_at_location): New function to replace the
11694         old gold_undefined_symbol functionality.
11695         * target-reloc.h (relocate_section): Update to use
11696         gold_undefined_symbol_at_location.
11697         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
11698         Call gold_undefined_symbol function rather than gold_error.
11699         * errors.h (Errors::undefined_symbol): Take location as a
11700         string, rather than calculating it from a relocation.
11701         * errors.cc (Errors::fatal): Print "fatal error:" before the
11702         formatted message.
11703         (Errors::error, Errors::error_at_location): Print "error: "
11704         before the formatted message.
11705         (Errors::undefined_symbol): Take location as a string, rather
11706         than calculating it from a relocation.
11707         (gold_undefined_symbol_at_location): New function akin to
11708         old gold_undefined_symbol, calculates location from relocation.
11709         (gold_undefined_symbol): Change to take only a Symbol pointer
11710         and to report location as the file name associated with the symbol.
11711         * testsuite/debug_msg.sh: Update for changed error messages.
11712         * testsuite/undef_symbol.sh: Likewise.
11713
11714 2009-02-04  Duncan Sands  <baldrick@free.fr>
11715
11716         PR 9812
11717         * reduced_debug_output.h
11718         (Output_reduced_debug_abbrev_section::failed): Use format for
11719         gold_warning.
11720         (Output_reduced_debug_info_section::faild): Likewise.
11721
11722 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
11723
11724         * script.cc (Lazy_demangler): New class.
11725         (Version_script_info::get_symbol_version_helper): Demangle a
11726         symbol only once.
11727
11728 2009-01-29  Cary Coutant  <ccoutant@google.com>
11729
11730         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
11731         to __tls_get_addr.
11732         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
11733
11734 2009-01-28  Ian Lance Taylor  <iant@google.com>
11735
11736         * version.cc (version_string): Bump to 1.9.
11737
11738         * gold.h: Include <cstring> and <stdint.h>.
11739         * version.cc: Include <cstdio>.
11740         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
11741         warning.
11742         * reduced_debug_output.cc (insert_into_vector): Rename from
11743         Insert_into_vector; change all callers.  Use Swap_unaligned to
11744         avoid aliasing issue; remove union since it is unnecessary.
11745
11746 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
11747
11748         * Makefile.am (CCFILES): Add gc.cc.
11749         (HFILES): Add gc.h.
11750         * Makefile.in: Regenerate.
11751         * gold.cc (Gc_runner): New class.
11752         (queue_initial_tasks): Call garbage collection related tasks
11753         when corresponding options are invoked.
11754         (queue_middle_gc_tasks): New function.
11755         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
11756         processed early before laying out sections during garbage collection.
11757         * gold.h (queue_middle_gc_tasks): New function.
11758         (is_prefix_of): Move from "layout.cc".
11759         * i386.cc (Target_i386::gc_process_relocs): New function.
11760         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
11761         * main.cc (main): Create object of class "Garbage_collection".
11762         * object.cc (Relobj::copy_symbols_data): New function.
11763         (Relobj::is_section_name_included): New function.
11764         (Sized_relobj::do_layout): Allow this function to be called twice
11765         during garbage collection and defer layout of section during the
11766         first call.
11767         * object.h (Relobj::get_symbols_data): New function.
11768         (Relobj::is_section_name_included): New function.
11769         (Relobj::copy_symbols_data): New function.
11770         (Relobj::set_symbols_data): New function.
11771         (Relobj::get_relocs_data): New function.
11772         (Relobj::set_relocs_data): New function.
11773         (Relobj::is_output_section_offset_invalid): New pure virtual function.
11774         (Relobj::gc_process_relocs): New function.
11775         (Relobj::do_gc_process_relocs): New pure virtual function.
11776         (Relobj::sd_): New data member.
11777         (Sized_relobj::is_output_section_offset_invalid): New function.
11778         (Sized_relobj::do_gc_process_relocs): New function.
11779         * options.h (General_options::gc_sections): Modify to not be a no-op.
11780         (General_options::print_gc_sections): New option.
11781         * plugin.cc (Plugin_finish::run): Remove function call to
11782         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
11783         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
11784         * reloc.cc (Read_relocs::run): Add task to process relocs and
11785         determine unreferenced sections when doing garbage collection.
11786         (Gc_process_relocs): New class.
11787         (Sized_relobj::do_gc_process_relocs): New function.
11788         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
11789         sections that are garbage collected.
11790         * reloc.h (Gc_process_relocs): New class.
11791         * sparc.cc (Target_sparc::gc_process_relocs): New function.
11792         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
11793         symbols whose corresponding sections are garbage collected.
11794         (Symbol_table::Symbol_table): Add new parameter for the garbage
11795         collection object.
11796         (Symbol_table::gc_mark_undef_symbols): New function.
11797         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11798         (Symbol_table::gc_mark_dyn_syms): New function.
11799         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
11800         as garbage.
11801         (Symbol_table::add_from_object): Likewise.
11802         (Symbol_table::add_from_relobj): When building shared objects, do not
11803         treat externally visible symbols as garbage.
11804         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
11805         table information for static and relocatable links.
11806         * symtab.h (Symbol_table::set_gc): New function.
11807         (Symbol_table::gc): New function.
11808         (Symbol_table::gc_mark_undef_symbols): New function.
11809         (Symbol_table::gc_mark_symbol_for_shlib): New function.
11810         (Symbol_table::gc_mark_dyn_syms): New function.
11811         (Symbol_table::gc_): New data member.
11812         * target.h (Sized_target::gc_process_relocs): New pure virtual
11813         function.
11814         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
11815         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
11816
11817 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
11818
11819         * options.h (General_options::gc_sections): Define as a no-op for now.
11820         (General_options::no_keep_memory): Ditto.
11821         (General_options::Bshareable): Define.
11822         * options.cc (General_options::finalize): Honor -Bshareable.
11823
11824 2009-01-20  Andreas Schwab  <schwab@suse.de>
11825
11826         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
11827         read the value in the contents, since we don't use it.  Use the
11828         template endianness when writing.
11829         (Relocate::relocate): Use it for R_PPC_REL16_HA.
11830
11831 2009-01-19  Andreas Schwab  <schwab@suse.de>
11832
11833         * configure.tgt (powerpc64-*): Fix targ_obj.
11834
11835 2009-01-15  Ian Lance Taylor  <iant@google.com>
11836
11837         * object.cc (Sized_relobj::write_local_symbols): Don't write out
11838         local symbols when stripping all symbols.
11839
11840 2009-01-14  Cary Coutant  <ccoutant@google.com>
11841
11842         * output.cc (Output_reloc): Add explicit instantiations.
11843
11844 2009-01-14  Cary Coutant  <ccoutant@google.com>
11845
11846         * archive.cc (Archive::get_elf_object_for_member): Remove call
11847         to File_read::claim_for_plugin.
11848         * descriptors.cc (Descriptors::open): Remove reference to
11849         is_claimed.
11850         (Descriptors::claim_for_plugin): Remove.
11851         * descriptors.h (Descriptors::claim_for_plugin): Remove.
11852         (Descriptors::is_claimed): Remove.
11853         (claim_descriptor_for_plugin): Remove.
11854         * fileread.cc (File_read::claim_for_plugin): Remove.
11855         * fileread.h (File_read::claim_for_plugin): Remove.
11856         (File_read::descriptor): Reopen descriptor if necessary.
11857         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
11858         (Plugin_manager::all_symbols_read): Add task parameter. Change
11859         all callers.
11860         (Plugin_manager::get_input_file): New function.
11861         (Plugin_manager::release_input_file): New function.
11862         (Pluginobj::Pluginobj): Add filesize parameter and initialize
11863         corresponding data member.
11864         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
11865         and pass to base constructor. Change all callers.
11866         (get_input_file, release_input_file): New functions.
11867         (make_sized_plugin_object): Add filesize parameter. Change all callers.
11868         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
11869         (Plugin_manager::all_symbols_read): Add task parameter.
11870         (Plugin_manager::get_input_file): New function.
11871         (Plugin_manager::release_input_file): New function.
11872         (Plugin_manager::task_): New data member.
11873         (Pluginobj::Pluginobj): Add filesize parameter.
11874         (Pluginobj::filename): New function.
11875         (Pluginobj::descriptor): New function.
11876         (Pluginobj::filesize): New function.
11877         (Pluginobj::filesize_): New data member.
11878         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
11879         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
11880         File_read::claim_for_plugin; use Object::unlock to unlock the file.
11881
11882         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
11883         with archive libraries.
11884         * testsuite/Makefile.in: Regenerate.
11885         * testsuite/plugin_test.c (struct sym_info): New type.
11886         (get_input_file, release_input_file): New static variables.
11887         (onload): Capture new transfer vector entries.
11888         (claim_file_hook): Stop reading at end of file according to filesize.
11889         Factor out parsing of readelf output into separate function.
11890         (all_symbols_read_hook): Exercise get_input_file and release_input_file
11891         APIs and get the source file name from the symbol table.  Convert
11892         source file name to corresponding object file name.  Print info
11893         message when adding new input files.
11894         (parse_readelf_line): New function.
11895         * testsuite/plugin_test_1.sh: Add checks for new info messages.
11896         * testsuite/plugin_test_2.sh: Likewise.
11897         * testsuite/plugin_test_3.sh: Likewise.
11898         * testsuite/plugin_test_4.sh: New test case.
11899
11900 2009-01-07  Ian Lance Taylor  <iant@google.com>
11901
11902         * version.cc (version_string): Bump to 1.8.
11903
11904 2008-12-23  Cary Coutant  <ccoutant@google.com>
11905
11906         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
11907         * plugin.cc (Plugin_manager::finish): Rename as
11908         layout_deferred_objects.  Move cleanup to separate function.
11909         (Plugin_manager::cleanup): New function.
11910         (Plugin_finish::run): Call layout_deferred_objects and cleanup
11911         separately.
11912         * plugin.h (Plugin_manager::finish): Rename as
11913         layout_deferred_objects.
11914         (Plugin_manager::cleanup): New function.
11915         (Plugin_manager::cleanup_done): New field.
11916
11917 2008-12-23  Cary Coutant  <ccoutant@google.com>
11918
11919         * plugin.cc (is_visible_from_outside): New function.
11920         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
11921         so we don't return "IR only" status for exported symbols or -r links.
11922
11923         * testsuite/Makefile.am (plugin_test_3): New test case.
11924         * testsuite/Makefile.in: Regenerate.
11925         * testsuite/plugin_test_3.sh: New file.
11926
11927 2008-12-22  Cary Coutant  <ccoutant@google.com>
11928
11929         * object.cc (Sized_relobj::layout_section): New function.
11930         (Sized_relobj::do_layout): Defer layout of input sections until after
11931         plugin has provided replacement files.
11932         (Sized_relobj::do_layout_deferred_sections): New function.
11933         * object.h (Relobj::set_section_offset): Remove virtual keyword.
11934         (Relobj::layout_deferred_sections): New function.
11935         (Relobj::do_layout_deferred_sections): New function.
11936         (Sized_relobj::do_layout_deferred_sections): New function.
11937         (Sized_relobj::layout_section): New function.
11938         (Sized_relobj::Deferred_layout): New structure.
11939         (Sized_relobj::deferred_layout_): New field.
11940         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
11941         Change all callers.  Layout deferred sections.
11942         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
11943         references.
11944         (Plugin_hook::run): Move code from do_plugin_hook inline.
11945         (Plugin_hook::do_plugin_hook): Remove.
11946         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
11947         (Plugin_manager::finish): Renamed, was cleanup.
11948         (Plugin_manager::should_defer_layout): New function.
11949         (Plugin_manager::add_deferred_layout_object): New function.
11950         (Plugin_manager::Deferred_layout_list): New type.
11951         (Plugin_manager::deferred_layout_objects_): New field.
11952         (Plugin_hook::do_plugin_hook): Remove.
11953
11954 2008-12-17  Ian Lance Taylor  <iant@google.com>
11955
11956         * options.h (class General_options): Add --no case for
11957         --export-dynamic.
11958
11959 2008-12-16  Cary Coutant  <ccoutant@google.com>
11960
11961         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
11962         vector.
11963         (Plugin_manager::claim_file): Create plugin object even if
11964         plugin did not call the add_symbols callback.
11965         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
11966         asking for more symbols than were added.
11967         * testsuite/Makefile.am (plugin_test_1): Add test case with
11968         no global symbols.
11969         (empty.syms): New target.
11970         * testsuite/Makefile.in: Regenerate.
11971         * testsuite/plugin_test.c (claim_file_hook): Add new debug
11972         message. Don't call add_symbols if no globals.
11973         (all_symbols_read_hook): Don't provide replacement for empty
11974         claimed file.
11975
11976 2008-12-12  Ian Lance Taylor  <iant@google.com>
11977
11978         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
11979         r_type == 0 for a local symbol with r_sym == 0.
11980         (scan_relocatable_relocs): Pass r_sym to
11981         local_non_section_strategy.
11982         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
11983         r_sym parameter.
11984
11985         * configure.ac: Update test for TLS descriptors: they are
11986         supported as of glibc 2.9.
11987         * configure: Rebuild.
11988
11989 2008-12-11  Ian Lance Taylor  <iant@google.com>
11990
11991         PR 7091
11992         * target-reloc.h (Default_scan_relocatable_relocs): For each
11993         function, map r_type == 0 to RELOC_DISCARD.
11994
11995 2008-12-10  Cary Coutant  <ccoutant@google.com>
11996
11997         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
11998         object to override a kept COMDAT group from a plugin object.
11999
12000 2008-12-09  Ian Lance Taylor  <iant@google.com>
12001
12002         PR 7088
12003         * yyscript.y (file_cmd): Handle INPUT.
12004
12005         * testsuite/initpri1.c: Change all declarations to be full
12006         prototypes by adding void, to avoid compiler warnings.
12007
12008 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12009
12010         * options.cc (General_options::parse_plugin_opt): New.
12011         (General_options::add_plugin): The argument now is just the filename.
12012         (General_options::add_plugin_option): New.
12013         * options.h (plugin_opt): New.
12014         (add_plugin): Change argument name.
12015         (add_plugin_option): New.
12016         * plugin.cc (Plugin::load): Don't parse the plugin option.
12017         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12018         (Plugin::add_option): New.
12019         (Plugin::args_): Change type.
12020         (Plugin::filename_): New.
12021         (Plugin_manager::add_plugin_option): New.
12022         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12023         * testsuite/Makefile.in: Regenerate.
12024
12025 2008-12-05  Cary Coutant  <ccoutant@google.com>
12026
12027         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12028         Handle --strip-lto-sections option.
12029         * options.h (strip_lto_sections): New option.
12030
12031 2008-12-01  Cary Coutant  <ccoutant@google.com>
12032
12033         * plugin.cc (ld_plugin_message): Change format parameter to const.
12034         Fix mismatch between new[] and delete.
12035
12036 2008-11-14  Cary Coutant  <ccoutant@google.com>
12037
12038         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12039         instead of -1U.
12040
12041 2008-11-05  Craig Silverstein  <csilvers@google.com>
12042
12043         * options.cc (General_options::parse_dynamic_list): New function.
12044         * options.h (General_options): New flags dynamic_list,
12045         dynamic_list_data, dynamic_list_cpp_new, and
12046         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12047         (General_options::in_dynamic_list): New function.
12048         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12049         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12050         (Lex::can_continue_name): Likewise.
12051         (yylex): Likewise.
12052         (read_script_file): New parameter script_options.
12053         (read_dynamic_list): New function.
12054         (Script_options::define_dynamic_list): New function.
12055         (dynamic_list_keyword_parsecodes): New variable.
12056         (dynamic_list_keywords): New variable.
12057         * script.h (Script_options::define_dynamic_list): New function
12058         prototype.
12059         (read_dynamic_list): New function prototype.
12060         * symtab.cc (strprefix): New macro.
12061         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12062         dynamic_list_data, dynamic_list_cpp_new, and
12063         dynamic_list_cpp_typeinfo.
12064         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12065         (dynamic_list_expr): New rule.
12066         (dynamic_list_nodes): Likewise.
12067         (dynamic_list_node): Likewise.
12068         * testsuite/Makefile.am (dynamic_list): New test.
12069         * testsuite/Makefile.in: Regenerated.
12070         * testsuite/dynamic_list.t: New file.
12071         * testsuite/dynamic_list.sh: New file.
12072
12073 2008-11-05  Craig Silverstein  <csilvers@google.com>
12074
12075         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12076         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12077         (t11_last): Likewise.
12078         * testsuite/ver_test_6.c (main): Likewise.
12079
12080 2008-10-07  Cary Coutant  <ccoutant@google.com>
12081
12082         * options.c (General_options::finalize): Add check for -static and
12083         -shared.
12084         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12085         is not empty.
12086
12087 2008-10-02  Cary Coutant  <ccoutant@google.com>
12088
12089         * plugin.cc (make_sized_plugin_object): Fix conditional
12090         compilation to work when not all targets are enabled.
12091
12092 2008-09-29  Cary Coutant  <ccoutant@google.com>
12093
12094         * archive.cc (Archive::get_file_and_offset): Use filename instead
12095         of name to get library path.
12096         (Archive::include_member): Unlock external member of a thin archive.
12097
12098         * testsuite/Makefile.am (TEST_AR): New variable.
12099         (thin_archive_test_1): New test.
12100         (thin_archive_test_2): New test.
12101         * testsuite/Makefile.in: Regenerate.
12102         * testsuite/thin_archive_main.cc: New file.
12103         * testsuite/thin_archive_test_1.cc: New file.
12104         * testsuite/thin_archive_test_2.cc: New file.
12105         * testsuite/thin_archive_test_3.cc: New file.
12106         * testsuite/thin_archive_test_4.cc: New file.
12107
12108 2008-09-29  Cary Coutant  <ccoutant@google.com>
12109
12110         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12111         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12112         instead of -1U.
12113         (Sized_relobj::do_finalize_local_symbols): Likewise.
12114         (Sized_relobj::map_to_kept_section): Likewise.
12115         * object.h (Sized_relobj::invalid_address): New constant.
12116         (Sized_relobj::do_output_section_offset): Check for invalid_address
12117         and return -1ULL.
12118         * output.cc (Output_reloc::local_section_offset): Use constant
12119         invalid_address instead of -1U.
12120         (Output_reloc::get_address): Likewise.
12121         (Output_section::output_address): Change -1U to -1ULL.
12122         * output.h (Output_reloc::invalid_address): New constant.
12123         * reloc.cc (Sized_relobj::write_sections): Use constant
12124         invalid_address instead of -1U.
12125         (Sized_relobj::relocate_sections): Likewise.
12126         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
12127         values for merge sections.
12128         * target-reloc.h (relocate_for_relocatable): Use constant
12129         invalid_address instead of -1U.
12130
12131 2008-09-19  Cary Coutant  <ccoutant@google.com>
12132
12133         Add plugin functionality for link-time optimization (LTO).
12134         * configure.ac (plugins): Add --enable-plugins option.
12135         * configure: Regenerate.
12136         * config.in: Regenerate.
12137         * Makefile.am (LIBDL): New variable.
12138         (CCFILES): Add plugin.cc.
12139         (HFILES): Add plugin.h.
12140         (ldadd_var): Add LIBDL.
12141         * Makefile.in: Regenerate.
12142
12143         * archive.cc: Include "plugin.h".
12144         (Archive::setup): Don't preread archive symbols when using a plugin.
12145         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
12146         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
12147         files.
12148         (Archive::include_member): Add symbols from plugin objects.
12149         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
12150         * descriptors.cc (Descriptors::open): Check for file descriptors
12151         abandoned by plugins.
12152         (Descriptors::claim_for_plugin): New function.
12153         * descriptors.h (Descriptors::claim_for_plugin): New function.
12154         (Open_descriptor::is_claimed): New field.
12155         (claim_descriptor_for_plugin): New function.
12156         * fileread.cc (File_read::claim_for_plugin): New function.
12157         * fileread.h (File_read::claim_for_plugin): New function.
12158         (File_read::descriptor): New function.
12159         * gold.cc: Include "plugin.h".
12160         (queue_initial_tasks): Add task to call plugin hooks for generating
12161         new object files.
12162         * main.cc: Include "plugin.h".
12163         (main): Load plugin libraries.
12164         * object.h (Pluginobj): Declare.
12165         (Object::pluginobj): New function.
12166         (Object::do_pluginobj): New function.
12167         (Object::set_target): New function.
12168         * options.cc: Include "plugin.h".
12169         (General_options::parse_plugin): New function.
12170         (General_options::General_options): Initialize plugins_ field.
12171         (General_options::add_plugin): New function.
12172         * options.h (Plugin_manager): Declare.
12173         (General_options): Add --plugin option.
12174         (General_options::has_plugins): New function.
12175         (General_options::plugins): New function.
12176         (General_options::add_plugin): New function.
12177         (General_options::plugins_): New field.
12178         * plugin.cc: New file.
12179         * plugin.h: New file.
12180         * readsyms.cc: Include "plugin.h".
12181         (Read_symbols::do_read_symbols): Check for archive before checking
12182         for ELF file.  Call plugin hooks to claim files.
12183         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
12184         from a real object file; force override when processing replacement
12185         files.
12186         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
12187         (Symbol::init_base_object): Likewise.
12188         (Symbol::init_base_output_data): Likewise.
12189         (Symbol::init_base_output_segment): Likewise.
12190         (Symbol::init_base_constant): Likewise.
12191         (Symbol::init_base_undefined): Likewise.
12192         (Symbol::output_section): Assert that object is not a plugin.
12193         (Symbol_table::add_from_pluginobj): New function.
12194         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
12195         undefined.
12196         (Symbol_table::sized_write_globals): Likewise.
12197         (Symbol_table::add_from_pluginobj): Instantiate template.
12198         * symtab.h (Sized_pluginobj): Declare.
12199         (Symbol::in_real_elf): New function.
12200         (Symbol::set_in_real_elf): New function.
12201         (Symbol::in_real_elf_): New field.
12202         (Symbol_table::add_from_pluginobj): New function.
12203
12204         * testsuite/Makefile.am (AM_CFLAGS): New variable.
12205         (LIBDL): New variable.
12206         (LDADD): Add LIBDL.
12207         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
12208         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
12209         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
12210         (MOSTLYCLEANFILES): Likewise.
12211         * testsuite/Makefile.in: Regenerate.
12212         * testsuite/plugin_test.c: New file.
12213         * testsuite/plugin_test_1.sh: New file.
12214         * testsuite/plugin_test_2.sh: New file.
12215
12216 2008-09-16  Ian Lance Taylor  <iant@google.com>
12217
12218         * target-reloc.h (relocate_section): Check whether a symbol is
12219         defined by the ABI before reporting an undefined symbol error.
12220         * target.h (Target::is_defined_by_abi): Make parameter const.
12221         (Target::do_is_defined_by_abi): Likewise.
12222         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
12223         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
12224         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
12225         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
12226         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
12227         * testsuite/Makefile.in: Rebuild.
12228
12229         * fileread.cc (make_view): Add casts to avoid warning.
12230
12231 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12232
12233         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
12234         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12235
12236 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
12237
12238         * options.h (General_options::output_is_executable): New.
12239         (General_options::output_is_pie): New.
12240         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
12241         for shared libraries.
12242         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
12243
12244 2008-09-11  Chris Demetriou  <cgd@google.com>
12245
12246         * options.h (origin): New -z option.
12247         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
12248         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
12249         in DT_FLAGS_1.
12250
12251 2008-09-05  Cary Coutant  <ccoutant@google.com>
12252
12253         * fileread.cc (File_read::make_view): Add check for attempt to map
12254         beyond end of file.
12255
12256 2008-09-05  Cary Coutant  <ccoutant@google.com>
12257
12258         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
12259         explicit instantiations.
12260
12261 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
12262
12263         PR gold/6858
12264         * options.cc (General_options::finalize): Allow undefined symbols
12265         in shlibs if linking -shared.
12266
12267         PR gold/6859
12268         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
12269         symbols as not needing a dynsym entry.
12270
12271 2008-08-20  Craig Silverstein  <csilvers@google.com>
12272
12273         * fileread.cc (File_read::open): Do not lock the file unless it
12274         was successfully opened.
12275
12276 2008-08-14  Cary Coutant  <ccoutant@google.com>
12277
12278         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
12279         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
12280         * testsuite/tls_test.cc (struct int128): 128-bit struct
12281         for testing TLS relocs with non-zero addend.
12282         (v12): New TLS variable.
12283         (t12): New test.
12284         (t_last): Add check for v12.
12285         * testsuite/tls_test.h (t12): New function.
12286         * testsuite/tls_test_main.cc (thread_routine): Call new test.
12287
12288 2008-08-13  Ian Lance Taylor  <iant@google.com>
12289
12290         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
12291         set tls_segment_ or relro_segment_.
12292         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
12293         when appropriate.
12294         * output.h (Output_section::clear_is_relro): New function.
12295         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
12296         sections specially even when output_data_ is empty.
12297         (Output_segment::maximum_alignment): When first section is relro,
12298         only force alignment for PT_LOAD segments.
12299         * script.cc (script_data_segment_align): New function.
12300         (script_data_segment_relro_end): New function.
12301         * script-c.h (script_data_segment_align): Declare.
12302         (script_data_segment_relro_end): Declare.
12303         * script-sections.h (class Script_sections): Declare
12304         data_segment_align and data_segment_relro_end.  Add fields
12305         segment_align_index_ and saw_relro_end_.
12306         * script-sections.cc (class Sections_element): Add set_is_relro
12307         virtual function.  Add new bool* parameter to place_orphan_here.
12308         Add get_output_section virtual function.
12309         (class Output_section_definition): Add set_is_relro.  Add new
12310         bool* parameter to place_orphan_here.  Add get_output_section.
12311         Add is_relro_ field.
12312         (Output_section_definition::Output_section_definition): Initialize
12313         evaluated_address_, evaluated_load_address, evaluated_addralign_,
12314         and is_relro_ fields.
12315         (Output_section_definition::place_orphan_here): Add is_relro
12316         parameter.
12317         (Output_section_definition::set_section_addresses): Set relro for
12318         output section.
12319         (Output_section_definition::alternate_constraint): Likewise.
12320         (class Orphan_output_section): Add new bool* parameter to
12321         place_orphan_here.  Add get_output_section.
12322         (Orphan_output_section::place_orphan_here): Add is_relro
12323         parameter.
12324         (Script_sections::Script_sections): Initialize
12325         data_segment_align_index_ and saw_relro_end_.
12326         (Script_sections::data_segment_align): New function.
12327         (Script_sections::data_segment_relro_end): New function.
12328         (Script_sections::place_orphan): Set or clear is_relro.
12329         (Script_sections::set_section_addresses): Force alignment of first
12330         TLS section.
12331         * yyscript.y (exp): Call script_data_segment_align and
12332         script_data_segment_relro_end.
12333         * testsuite/relro_script_test.t: New file.
12334         * testsuite/relro_test.cc (using_script): Declare.
12335         (t1, t2): Test using_script.
12336         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
12337         (relro_script_test_SOURCES): Define.
12338         (relro_script_test_DEPENDENCIES): Define.
12339         (relro_script_test_LDFLAGS): Define.
12340         (relro_script_test_LDADD): Define.
12341         (relro_script_test.so): New target.
12342         * testsuite/Makefile.in: Rebuild.
12343
12344 2008-08-06  Cary Coutant <ccoutant@google.com>
12345
12346         * archive.cc (Archive::total_archives, Archive::total_members)
12347         (Archive::total_members_loaded): New variables.
12348         (Archive::setup): Add parameter.  Add option to preread
12349         archive symbols.
12350         (Archive::read_armap): Add counter.
12351         (Archive::get_file_and_offset): New function.
12352         (Archive::get_elf_object_for_member): New function.
12353         (Archive::read_all_symbols): New function.
12354         (Archive::read_symbols): New function.
12355         (Archive::add_symbols): Add counters.
12356         (Archive::include_all_members): Use armap to find members if it's
12357         already built.
12358         (Archive::include_member): Skip reading symbols if already read.
12359         Factored code into Archive::get_file_and_offset and
12360         Archive::get_elf_object_for_member.  Changed call to
12361         Mapfile::report_include_archive_member.
12362         (Archive::print_stats): New function.
12363         * archive.h: Declare Object and Read_symbols_data classes.
12364         (Archive::Archive): Add initializers for new members.
12365         (Archive::setup): Add parameter.
12366         (Archive::print_stats): New function.
12367         (Archive::total_archives, Archive::total_members)
12368         (Archive::total_members_loaded): New variables.
12369         (Archive::get_file_and_offset): New function.
12370         (Archive::get_elf_object_for_member): New function.
12371         (Archive::read_all_symbols): New function.
12372         (Archive::read_symbols): New function.
12373         (Archive::Archive_member): New class.
12374         (Archive::members_): New member.
12375         (Archive::num_members_): New member.
12376         * main.cc: Include archive.h.
12377         (main): Call Archive::print_stats.
12378         * mapfile.cc (Mapfile::report_include_archive_member): Delete
12379         archive parameter; member_name is now the fully-decorated name.
12380         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
12381         * options.h: (General_options): Add --preread-archive-symbols option.
12382         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
12383         Archive::setup.
12384
12385 2008-08-04  Ian Lance Taylor  <iant@google.com>
12386
12387         * symtab.h (Symbol::use_plt_offset): New function.
12388         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
12389         * powerpc.cc (Relocate::relocate): Likewise.
12390         * sparc.cc (Relocate::relocate): Likewise.
12391         * x86_64.cc (Relocate::relocate): Likewise.
12392         * testsuite/weak_plt.sh: New test.
12393         * testsuite/weak_plt_main.cc: New test.
12394         * testsuite/weak_plt_shared.cc: New test.
12395         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
12396         (check_PROGRAMS): Add weak_plt.
12397         (check_DATA): Add weak_plt_shared.so.
12398         (weak_plt_main_pic.o, weak_plt): New targets.
12399         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
12400         * testsuite/Makefile.in: Rebuild.
12401
12402         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
12403         gcctestdir/ld.
12404         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
12405         * testsuite/Makefile.in: Rebuild.
12406
12407 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
12408
12409         * Makefile.am (POTFILES.in): Set LC_ALL=C.
12410         * Makefile.in: Regenerate.
12411         * po/POTFILES.in: Regenerate.
12412
12413 2008-07-29  Ian Lance Taylor  <iant@google.com>
12414
12415         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
12416         symbols before other symbols.
12417         * testsuite/script_test_2.cc (test_addr): Declare.
12418         (test_addr_alias): Declare.
12419         (main): Check that test_addr and test_addr_alias have the right
12420         values.
12421         * testsuite/script_test_2.t: Define test_addr_alias and
12422         test_addr.
12423
12424 2008-07-24  Ian Lance Taylor  <iant@google.com>
12425
12426         PR 5990
12427         * descriptors.cc: New file.
12428         * descriptors.h: New file.
12429         * gold-threads.h (class Hold_optional_lock): New class.
12430         * fileread.cc: Include "descriptors.h".
12431         (File_read::~File_read): Release descriptor rather than closing
12432         it.
12433         (File_read::open) [file]: Call open_descriptor rather than open.
12434         Set is_descriptor_opened_.
12435         (File_read::open) [memory]: Assert that descriptor is not open.
12436         (File_read::reopen_descriptor): New function.
12437         (File_read::release): Release descriptor.
12438         (File_read::do_read): Make non-const.  Reopen descriptor.
12439         (File_read::read): Make non-const.
12440         (File_read::make_view): Reopen descriptor.
12441         (File_read::do_readv): Likewise.
12442         * fileread.h (class File_read): Add is_descriptor_opened_ field.
12443         Update declarations.
12444         * layout.cc: Include "descriptors.h".
12445         (Layout::create_build_id): Use open_descriptor rather than open.
12446         * output.cc: Include "descriptors.h".
12447         (Output_file::open): Use open_descriptor rather than open.
12448         * archive.cc (Archive::const_iterator): Change Archive to be
12449         non-const.
12450         (Archive::begin, Archive::end): Make non-const.
12451         (Archive::count_members): Likewise.
12452         * archive.h (class Archive): Update declarations.
12453         * object.h (Object::read): Make non-const.
12454         * Makefile.am (CCFILES): Add descriptors.cc.
12455         (HFILES): Add descriptors.h.
12456         * Makefile.in: Rebuild.
12457
12458         PR 6716
12459         * gold.h: Always include <clocale>.  Add Solaris workarounds
12460         following code in binutils/sysdep.h.
12461
12462         PR 6048
12463         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
12464         this->eh_frame_hdr_ is NULL before using it.
12465
12466         * dynobj.cc (Versions::Versions): Update comment.
12467
12468         * dynobj.cc (Versions::Versions): If there is an soname, use it as
12469         the base version name.
12470
12471         * stringpool.cc (Stringpool_template::add_with_length): Set key to
12472         array size plus one.
12473         (Stringpool_template::set_string_offsets): Subtract one from key
12474         before using it as an array index.
12475         (Stringpool_template::get_offset_with_length): Likewise.
12476         (Stringpool_template::write_to_buffer): Likewise.
12477         * stringpool.h (Stringpool_template::get_offset_from_key):
12478         Likewise.
12479
12480 2008-07-23  Ian Lance Taylor  <iant@google.com>
12481
12482         PR 6658
12483         * object.h (Merged_symbol_value::value): Do our best to handle a
12484         negative addend.
12485
12486         PR 6647
12487         * script.cc (Version_script_info::get_versions): Don't add empty
12488         version tag to return value.
12489         (Version_script_info::get_symbol_version_helper): Change return
12490         type to bool.  Add pversion parameter.  Change all callers.
12491         (script_register_vers_node): Don't require a non-NULL tag.
12492         * script.h (class Version_script_info): Update declarations.
12493         (Version_script_info::get_symbol_version): Change return type to
12494         bool.  Add version parameter.  Change all callers.
12495         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
12496         handling.  Handle an empty version from a version script.
12497         (Symbol_table::define_special_symbol): Likewise.
12498         * testsuite/ver_test_10.script: New file.
12499         * testsuite/ver_test_10.sh: New file.
12500         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
12501         (check_DATA): Add ver_test_10.syms.
12502         (ver_test_10.syms, ver_test_10.so): New target.
12503         * testsuite/Makefile.in: Rebuild.
12504
12505 2008-07-23  Simon Baldwin  <simonb@google.com>
12506
12507         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
12508         to zero for undefined symbols from dynamic libraries.
12509
12510 2008-07-23  Ian Lance Taylor  <iant@google.com>
12511
12512         * symtab.cc (Symbol_table::resolve): Remove version parameter.
12513         Change all callers.
12514         * symtab.h (class Symbol_table): Update declaration.
12515         * testsuite/ver_test_9.cc: New file.
12516         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
12517         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
12518         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
12519         (ver_test_9.so, ver_test_9.o): New targets.
12520         * testsuite/Makefile.in: Rebuild.
12521
12522 2008-07-22  Ian Lance Taylor  <iant@google.com>
12523
12524         * options.h (class General_options): Define --check-sections.
12525         * layout.cc (Layout::set_segment_offsets): Handle
12526         --check-sections.
12527
12528         * options.h (class General_options): Define -n/--nmagic and
12529         -N/--omagic.
12530         * options.cc (General_options::finalize): For -n/--nmagic or
12531         -N/--omagic, set -static.
12532         * layout.cc (Layout::attach_allocated_section_to_segment): If
12533         -N/--omagic, don't put read-only and read-write sections in
12534         different segments.
12535         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
12536         finding a read-only segment.
12537         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
12538         don't set the minimum segment alignment to the common page size,
12539         and don't set the file offset to the address modulo the page size.
12540         * script-sections.cc (Script_sections::create_segments): If
12541         -n/--omagic, don't put read-only and read-write sections in
12542         different segments.
12543
12544         * cref.cc: New file.
12545         * cref.h: New file.
12546         * options.h (class General_options): Add --print-symbol-counts.
12547         * main.cc (main): Issue defined symbol report if requested.
12548         * archive.cc (Archive::interpret_header): Make into a const member
12549         function.
12550         (Archive::add_symbols): Call Input_objects::archive_start and
12551         archive_stop.
12552         (Archive::const_iterator): Define new class.
12553         (Archive::begin, Archive::end): New functions.
12554         (Archive::include_all_members): Rewrite to use iterator.
12555         (Archive::count_members): New function.
12556         * archive.h (class Archive): Update declarations.
12557         (Archive::filename): New function.
12558         * object.cc: Include "cref.h".
12559         (Sized_relobj::Sized_relobj): Initialize defined_count_.
12560         (Sized_relobj::do_get_global_symbol_counts): New function.
12561         (Input_objects::add_object): Add object to cross-referencer.
12562         (Input_objects::archive_start): New function.
12563         (Input_objects::archive_stop): New function.
12564         (Input_objects::print_symbol_counts): New function.
12565         * object.h: Declare Cref and Archive.
12566         (Object::get_global_symbol_counts): New function.
12567         (Object::do_get_global_symbol_counts): New pure virtual function.
12568         (class Sized_relobj): Add defined_count_ field.  Update
12569         declarations.
12570         (class Input_objects): Add cref_ field.  Update constructor.
12571         Update declarations.
12572         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
12573         defined_count_.
12574         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
12575         symbol counts.
12576         (Sized_dynobj::do_get_global_symbol_counts): New function.
12577         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
12578         defined_count_.  Update declarations.  Define Symbols typedef.
12579         * symtab.cc (Symbol_table::add_from_relobj): Add defined
12580         parameter.  Change all callers.
12581         (Symbol_table::add_from_dynobj): Add sympointers and defined
12582         parameters.  Change all callers.
12583         * symtab.h (class Symbol_table): Update declarations.
12584         * Makefile.am (CCFILES): Add cref.cc.
12585         (HFILES): Add cref.h.
12586         * Makefile.in: Rebuild.
12587
12588 2008-07-22  Simon Baldwin  <simonb@google.com>
12589
12590         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
12591         to zero when writing undefined symbols.
12592
12593 2008-07-22  Ian Lance Taylor  <iant@google.com>
12594
12595         * output.cc (Output_section::add_input_section): Don't try to
12596         merge empty merge sections.
12597
12598 2008-07-21  Craig Silverstein  <csilvers@google.com>
12599
12600         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12601         Include symbol version in error message.
12602
12603 2008-07-20  Chris Demetriou  <cgd@google.com>
12604
12605         * configure.ac (gold_cv_c_random_seed): New configured variable.
12606         (RANDOM_SEED_CFLAGS): New substituted variable.
12607         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
12608         * configure: Rebuild.
12609         * Makefile.in: Likewise.
12610         * testsuite/Makefile.in: Likewise.
12611
12612 2008-07-18  Ian Lance Taylor  <iant@google.com>
12613
12614         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
12615         where we see NAME/NULL and NAME/VERSION  as separate symbols.
12616         * testsuite/ver_test_main.cc (main): Call t4.
12617         (t4, t4_2a): Define.
12618         * testsuite/ver_test_2.cc (t4_2): Define.
12619         * testsuite/ver_test_2.script: Put t4_2a in VER2.
12620         * testsuite/ver_test_4.cc (t4_2a): Define.
12621         * testsuite/ver_test_4.script: Put t4_2a in VER2.
12622         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
12623
12624 2008-07-17  Ian Lance Taylor  <iant@google.com>
12625
12626         * dynobj.cc (Versions::add_def): If we give an error about a
12627         missing version, go ahead and create the version anyhow.
12628
12629 2008-07-10  Ian Lance Taylor  <iant@google.com>
12630
12631         Handle output sections with more than 0x7fffffff bytes.
12632         * object.h (class Relobj): Change map_to_output_ to
12633         output_sections_, and just keep a section pointer.  Change all
12634         uses.  Move comdat group support to Sized_relobj.
12635         (Relobj::is_section_specially_mapped): Remove.
12636         (Relobj::output_section): Remove poff parameter.  Change all
12637         callers.
12638         (Relobj::output_section_offset): New function.
12639         (Relobj::set_section_offset): Rewrite.
12640         (Relobj::map_to_output): Remove.
12641         (Relobj::output_sections): New function.
12642         (Relobj::do_output_section_offset): New pure virtual function.
12643         (Relobj::do_set_section_offset): Likewise.
12644         (class Sized_relobj): Add section_offsets_ field.  Add comdat
12645         group support from Relobj.  Update declarations.
12646         (Sized_relobj::get_output_section_offset): New function.
12647         (Sized_relobj::do_output_section_offset): New function.
12648         (Sized_relobj::do_set_section_offset): New function.
12649         * object.cc (Relobj::output_section_address): Remove.
12650         (Sized_relobj::Sized_relobj): Initialize new fields.
12651         (Sized_relobj::include_section_group): Cast find_kept_object to
12652         Sized_relobj.
12653         (Sized_relobj::include_linkonce_section): Likewise.
12654         (Sized_relobj::do_layout): Use separate arrays for output section
12655         and output offset.
12656         (Sized_relobj::do_count_local_symbols): Change map_to_output to
12657         output_sections.
12658         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
12659         output_sections and section_offsets.
12660         (Sized_relobj::write_local_symbols): Likewise.
12661         (map_to_kept_section): Compute output address directly.
12662         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
12663         output_sections and section_offsets.
12664         (Sized_relobj::write_sections): Likewise.
12665         (Sized_relobj::relocate_sections): Likewise.
12666         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
12667         * output.h (class Output_reloc): Update declarations.  Change
12668         u2_.relobj to Sized_relobj*.
12669         (class Output_data_reloc): Change add functions to use
12670         Sized_relobj*.
12671         * output.cc (Output_reloc::Output_reloc): Change relobj to
12672         Sized_relobj*.
12673         (Output_reloc::local_section_offset): Change return type to
12674         Elf_Addr.  Use get_output_section_offset.
12675         (Output_reloc::get_address): Likewise.
12676         (Output_section::is_input_address_mapped): Don't call
12677         is_section_specially_mapped.
12678         (Output_section::output_offset): Likewise.
12679         (Output_section::output_address): Likewise.
12680         (Output_section::starting_output_address): Likewise.
12681         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
12682         parameter to Sized_relobj*.
12683         (Copy_relocs::need_copy_reloc): Likewise.
12684         (Copy_relocs::save): Likewise.
12685         * copy-relocs.h (class Copy_relocs): Update declarations.
12686         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
12687         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
12688         * target-reloc.h (relocate_for_relocatable): Change
12689         offset_in_output_section type to Elf_Addr.  Change code that uses
12690         it as well.
12691         * layout.cc (Layout::layout): Always set *off.
12692         * mapfile.cc (Mapfile::print_input_section): Use
12693         output_section_offset.
12694         * i386.cc (Target_i386::copy_reloc): Change object parameter to
12695         Sized_relobj*.
12696         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
12697         * sparc.cc (Target_sparc::copy_reloc): Likewise.
12698         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
12699
12700 2008-07-03  Ian Lance Taylor  <iant@google.com>
12701
12702         * layout.cc (Layout::include_section): Do not discard unrecognized
12703         SHT_STRTAB sections.
12704
12705 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
12706
12707         * script.cc (Lex::can_continue_name): Make '?' allowable in
12708         version-script names.
12709         * testsuite/version_script.map: Change glob pattern to use '?'
12710
12711 2008-06-30  Manish Singh  <yosh@gimp.org>
12712
12713         PR 6585
12714         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
12715         Correct typo.
12716
12717 2008-06-30  Ian Lance Taylor  <iant@google.com>
12718
12719         PR 6660
12720         PR 6682
12721         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
12722         versions]: Don't try to read the value in the contents, since we
12723         don't use it.  Use the template endianness when writing.
12724
12725 2008-06-25  Cary Coutant  <ccoutant@google.com>
12726
12727         * fileread.cc (File_read::make_view): Assert on zero-length view.
12728         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
12729         symbol table when there are no symbols to read.
12730
12731 2008-06-23  Craig Silverstein  <csilvers@google.com>
12732
12733         * version.cc (version_string): Bump to 1.7
12734
12735 2008-06-18  Craig Silverstein  <csilvers@google.com>
12736
12737         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
12738         constant 0xFFFF to type Valtype.
12739         (Powerpc_relocate_functions::rel16_ha): Likewise.
12740
12741 2008-06-17  Ian Lance Taylor  <iant@google.com>
12742
12743         * output.h (Output_section::Input_section): Initialize p2align_ to
12744         zero for Output_section_data constructors.
12745         (Output_section::Input_section::addralign): If not an input
12746         section, return the alignment of the Output_section_data.
12747         * testsuite/copy_test.cc: New file.
12748         * testsuite/copy_test_1.cc: New file.
12749         * testsuite/copy_test_2.cc: New file.
12750         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
12751         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
12752         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
12753         (copy_test_1_pic.o, copy_test_1.so): New targets.
12754         (copy_test_2_pic.o, copy_test_2.so): New targets.
12755         * testsuite/Makefile.in: Rebuild.
12756
12757         * script-sections.cc (Script_sections::place_orphan): Initialize
12758         local variable exact.
12759
12760 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
12761
12762         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
12763
12764 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
12765             David S. Miller  <davem@davemloft.net>
12766
12767         * powerpc.cc: New file.
12768         * Makefile.am (TARGETSOURCES): Add powerpc.cc
12769         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
12770         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
12771         * Makefile.in: Rebuild.
12772
12773 2008-06-09  Ian Lance Taylor  <iant@google.com>
12774
12775         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
12776         <exception>.
12777         (throwing, orig_terminate): New static variables.
12778         (terminate_handler): New static function.
12779         (t2): Set terminate handler.
12780
12781 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
12782
12783         PR 6584
12784         * binary.cc (Binary_to_elf::sized_convert): Fix .data
12785         alignment.
12786
12787 2008-05-30  Cary Coutant  <ccoutant@google.com>
12788
12789         * archive.cc (Archive::include_all_members) Correct to step
12790         over symbol table and extended name table in thin archives.
12791
12792 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
12793
12794         PR 6407
12795         * target-reloc.h (relocate_for_relocatable): Fix new_offset
12796         calculation.
12797
12798 2008-05-28  Caleb Howe  <cshowe@google.com>
12799
12800         * reduced_debug_output.cc: New file.
12801         * reduced_debug_output.h: New file.
12802         * options.h (class General_options): Add --strip-debug-non-line.
12803         * options.cc (General_options::finalize): Add strip_debug_non_line
12804         to the strip heirarchy.
12805         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
12806         fields.
12807         * layout.cc: Include "reduced_debug_output.h".
12808         (Layout::Layout): Initialize new fields.
12809         (line_only_debug_sections): New static array.
12810         (is_lines_only_debug_sections): New static inline function.
12811         (Layout::include_section): Handle --strip-debug-non-line.
12812         (Layout::make_output_section): If --strip-debug-non-line, build
12813         new output sections for .debug_abbrev and .debug_info.
12814         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
12815         gold.  Warn about possible overflow.
12816         (read_signed_LEB_128): Likewise.
12817         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
12818         (read_signed_LEB_128): Declare.
12819         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
12820         (HFILES): Add reduced_debug_output.h.
12821         * Makefile.in: Rebuild.
12822
12823 2008-05-21  Ian Lance Taylor  <iant@google.com>
12824
12825         * mapfile.cc: New file.
12826         * mapfile.h: New file.
12827         * options.h (class General_options): Add -M/--print-map and -Map.
12828         * options.cc (General_options::finalize): Make -M equivalent to
12829         -Map -.
12830         * main.cc: Include <cstdio> and "mapfile.h".
12831         (main): Open mapfile if requested.
12832         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
12833         constructor.  Change caller.
12834         (queue_initial_tasks): Add mapfile parameter.  Change caller.
12835         (queue_middle_tasks): Likewise.
12836         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
12837         declarations.
12838         * archive.cc: Include "mapfile.h".
12839         (Archive::add_symbols): Add mapfile parameter.  Change all
12840         callers.  Pass mapfile, symbol, and reason to include_member.
12841         (Archive::include_all_members): Add mapfile parameter.  Change all
12842         callers.
12843         (Archive::include_member): Add mapfile, sym, and why parameters.
12844         Change all callers.  Report inclusion to map file.
12845         * archive.h: Include "fileread.h".
12846         (class Archive): Update declarations.
12847         (Archive::file): New const method.
12848         (class Add_archive_symbols): Add mapfile_ field.  Update
12849         constructor.  Change all callers.
12850         * readsyms.h (class Read_symbols): Likewise.
12851         (class Finish_group): Likewise.
12852         (class Read_script): Likewise.
12853         * common.cc: Include "mapfile.h".
12854         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
12855         all callers.
12856         (Symbol_table::do_allocate_commons): Likewise.
12857         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
12858         symbol allocation to mapfile.
12859         * common.h (class Allocate_commons_task): Add mapfile_ field.
12860         Update constructor.  Change all callers.
12861         * symtab.h (class Symbol_table): Update declarations.
12862         * layout.cc: Include "mapfile.h".
12863         (Layout_task_runner::run): Print information to mapfile.
12864         (Layout::create_gold_note): Change Output_data_fixed_space to
12865         Output_data_zero_fill.
12866         (Layout::create_build_id): Likewise.
12867         (Layout::print_to_mapfile): New function.
12868         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
12869         constructor.  Change caller.
12870         (class Layout): Declare print_to_mapfile.
12871         * output.cc (Output_section::Input_section::print_to_mapfile): New
12872         function.
12873         (Output_section::add_input_section): If producing a map, always
12874         add to input_sections_ list.
12875         (Output_section::do_print_to_mapfile): New function.
12876         (Output_segment::print_sections_to_mapfile): New function.
12877         (Output_segment::print_section_list_to_mapfile): New function.
12878         * output.h: Include "mapfile.h".
12879         (Output_data::print_to_mapfile): New function.
12880         (Output_data::do_print_to_mapfile): New virtual function.
12881         (Output_segment_headers::do_print_to_mapfile): New function.
12882         (Output_file_header::do_print_to_mapfile): New function.
12883         (Output_data_const::do_print_to_mapfile): New function.
12884         (class Output_data_const_buffer): Add map_name_ field.  Update
12885         constructor.  Change all callers.  Add do_print_to_mapfile
12886         function.
12887         (class Output_data_fixed_space): Likewise.
12888         (class Output_data_space): Likewise.
12889         (class Output_data_zero_fill): New class.
12890         (Output_data_strtab::do_print_to_mapfile): New function.
12891         (Output_data_reloc_base::do_print_to_mapfile): New function.
12892         (Output_relocatable_relocs::do_print_to_mapfile): New function.
12893         (Output_data_group::do_print_to_mapfile): New function.
12894         (Output_data_got::do_print_to_mapfile): New function.
12895         (Output_data_dynamic::do_print_to_mapfile): New function.
12896         (Output_symtab_xindex::do_print_to_mapfile): New function.
12897         (class Output_section): Declare do_print_to_mapflie.  Declare
12898         print_to_mapfile in Input_section.
12899         (class Output_segment): Declare new functions.
12900         * object.h (Sized_relobj::symbol_count): New function.
12901         * script-sections.cc
12902         (Output_section_element_dot_assignment::set_section_addresses):
12903         Change Output_data_fixed_space to Output_data_zero_fill.
12904         (Output_data_expression::do_print_to_mapfile): New function.
12905         * script.cc (read_input_script): Add mapfile parameter.  Change
12906         all callers.
12907         * script.h (read_input_script): Update declaration.
12908         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
12909         (Eh_frame::do_print_to_mapfile): New function.
12910         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
12911         (Output_merge_string::do_print_to_mapfile): New function.
12912         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
12913         function.
12914         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
12915         function.
12916         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
12917         function.
12918         * Makefile.am (CCFILES): Add mapfile.cc.
12919         (HFILES): Add mapfile.h.
12920         * Makefile.in: Rebuild.
12921
12922 2008-05-19  Ian Lance Taylor  <iant@google.com>
12923
12924         * options.h (class General_options): Add -z relro.
12925         * layout.cc (Layout::Layout): Initialize relro_segment_.
12926         (Layout::add_output_section_data): Return the output section.
12927         (Layout::make_output_section): Rcognize relro sections and mark
12928         them appropriately.
12929         (Layout::attach_allocated_section_to_segment): Put relro sections
12930         in a PT_GNU_RELRO segment.
12931         (Layout::create_initial_dynamic_sections): Mark the .dynamic
12932         section as relro.
12933         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
12934         PT_TLS segments.
12935         (Layout::linkonce_mapping): Map d.rel.ro.local to
12936         .data.rel.ro.local.
12937         (Layout::output_section_name): Us .data.rel.ro.local for any
12938         section which begins with that.
12939         * layout.h (class Layout): Update add_output_section_data
12940         declaration.  Add relro_segment_ field.
12941         * output.cc (Output_section::Output_section): Initialize is_relro_
12942         and is_relro_local_ fields.
12943         (Output_segment::add_output_section): Group relro sections.
12944         (Output_segment::is_first_section_relro): New function.
12945         (Output_segment::maximum_alignment): If there is a relro section,
12946         align the segment to the common page size.
12947         (Output_segment::set_section_addresses): Track whether we are
12948         looking at relro sections.  If the last section is a relro
12949         section, align to the common page size.
12950         (Output_segment::set_section_list_addresses): Add in_relro
12951         parameter.  Change all callers.  Align to the page size when
12952         moving from relro to non-relro section.
12953         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
12954         segment.
12955         * output.h (class Output_section): Add is_relro_ and
12956         is_relro_local_ fields.
12957         (Output_section::is_relro): New function.
12958         (Output_section::set_is_relro): New function.
12959         (Output_section::is_relro_local): New function.
12960         (Output_section::set_is_relro_local): New function.
12961         (class Output_segment): Update declarations.
12962         * i386.cc (Target_i386::got_section): Mark .got section as relro.
12963         * sparc.cc (Target_sparc::got_section): Likewise.
12964         * x86_64.cc (Target_x86_64::got_section): Likewise.
12965         * testsuite/relro_test_main.cc: New file.
12966         * testsuite/relro_test.cc: New file.
12967         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
12968         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
12969         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
12970         (relro_test.so, relro_test_pic.o): New targets.
12971         * testsuite/Makefile.in: Rebuild.
12972
12973 2008-05-16  Ian Lance Taylor  <iant@google.com>
12974
12975         * output.cc (Output_segment::add_output_section): Remove front
12976         parameter.
12977         * output.h (class Output_segment): Remove
12978         add_initial_output_section and overloaded add_output_section.
12979         Update declaration of remaining add_output_section.
12980         * layout.cc (Layout::create_interp): Call add_output_section
12981         rather than add_initial_output_section.
12982         (Layout::finish_dynamic_section): Likewise.
12983
12984         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
12985         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
12986         know the dynamic type.
12987         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
12988         field.  Initialize it in constructor.
12989         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
12990         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
12991         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
12992         reloc.
12993
12994         * output.cc (Output_reloc::get_address): Change return type to
12995         Elf_Addr.
12996         * output.h (class Output_reloc): Update get_address declaration.
12997         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
12998         for section addresses.
12999
13000 2008-05-09  Ian Lance Taylor  <iant@google.com>
13001
13002         PR 6493
13003         * gold.cc (gold_nomem): Use return value of write.
13004
13005 2008-05-08  Ian Lance Taylor  <iant@google.com>
13006
13007         * symtab.c (Symbol::init_base_output_data): Add version
13008         parameter.  Change all callers.
13009         (Symbol::init_base_output_segment): Likewise.
13010         (Symbol::init_base_constant): Likewise.
13011         (Symbol::init_base_undefined): Likewise.
13012         (Sized_symbol::init_output_data): Likewise.
13013         (Sized_symbol::init_output_segment): Likewise.
13014         (Sized_symbol::init_constant): Likewise.
13015         (Sized_symbol::init_undefined): Likewise.
13016         (Symbol_table::do_define_in_output_data): If the new symbol has a
13017         version, mark it as the default.
13018         (Symbol_table::do_define_in_output_segment): Likewise.
13019         (Symbol_table::do_define_as_constant): Likewise.
13020         * symtab.h (class Symbol): Update declarations.
13021         (class Sized_symbol): Likewise.
13022         * resolve.cc (Symbol::override_version): New function.
13023         (Symbol::override_base): Call override_version.
13024         (Symbol::override_base_with_special): Likewise.
13025         * testsuite/ver_script_8.script: New file.
13026         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13027         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13028         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13029         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13030
13031 2008-05-06  Ian Lance Taylor  <iant@google.com>
13032
13033         PR 6049
13034         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13035         functions.
13036         (class General_options): Remove existing --undefined, and add
13037         --no-undefined instead.  Add new --undefined as synonym for -u.
13038         * archive.cc (Archive::add_symbols): Check whether symbol was
13039         named with -u.
13040         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13041         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13042         all uses.  Add IS_UNDEFINED.  Update declarations to split
13043         different versions of init_base.  Declare init_base_undefined.
13044         (Symbol::is_defined): Handle IS_UNDEFINED.
13045         (Symbol::is_undefined): Likewise.
13046         (Symbol::is_weak_undefined): Call is_undefined.
13047         (Symbol::is_absolute): Handle IS_CONSTANT.
13048         (class Sized_symbol): Update declarations to split different
13049         versions of init.  Declare init_undefined.
13050         (class Symbol_table): Declare new functions.
13051         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13052         Change all callers.
13053         (Symbol::init_base_output_data): Likewise.
13054         (Symbol::init_base_output_segment): Likewise.
13055         (Symbol::init_base_constant): Likewise.
13056         (Symbol::init_base_undefined): New function.
13057         (Sized_symbol::init_object): Rename from init.  Change all
13058         callers.
13059         (Sized_symbol::init_output_data): Likewise.
13060         (Sized_symbol::init_output_segment): Likewise.
13061         (Sized_symbol::init_constant): Likewise.
13062         (Sized_symbol::init_undefined): New function.
13063         (Symbol_table::add_undefined_symbols_from_command_line): New
13064         function.
13065         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13066         function.
13067         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13068         (Symbol::output_section): Likewise.
13069         (Symbol::set_output_section): Likewise.
13070         (Symbol_table::sized_finalize_symbol): Likewise.
13071         (Symbol_table::sized_write_globals): Likewise.
13072         * resolve.cc (Symbol_table::should_override): Likewise.
13073         (Symbol::override_base_with_special): Likewise.
13074
13075         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13076         symbol, change it to have default visibility.
13077         * testsuite/protected_1.cc: New file.
13078         * testsuite/protected_2.cc: New file.
13079         * testsuite/protected_3.cc: New file.
13080         * testsuite/protected_main_1.cc: New file.
13081         * testsuite/protected_main_2.cc: New file.
13082         * testsuite/protected_main_3.cc: New file.
13083         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13084         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13085         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13086         (protected_1.so): New target.
13087         (protected_1_pic.o, protected_2_pic.o): New targets.
13088         (protected_3_pic.o): New target.
13089         (check_PROGRAMS): Add protected_2.
13090         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13091         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13092         * testsuite/Makefile.in: Rebuild.
13093
13094         * options.h (DEFINE_var): Add set_user_set_##varname__.
13095         (DEFINE_bool_alias): New macro.
13096         (class General_options): Define -Bstatic using DEFINE_bool_alias
13097         rather than DEFINE_special.  Add --undefined as an alias for -z
13098         defs.
13099         * options.cc (General_options::parse_Bstatic): Remove.
13100
13101         * options.h (class General_options): Add --fatal-warnings.
13102         * main.cc (main): Implement --fatal-warnings.
13103         * errors.h (Errors::warning_count): New function.
13104
13105         * options.h (class General_options): Add -Bsymbolic-functions.
13106         * symtab.h (Symbol::is_preemptible): Check for
13107         -Bsymbolic-functions.
13108
13109 2008-05-05  Ian Lance Taylor  <iant@google.com>
13110
13111         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13112         as noVARNAME rather than no-VARNAME.
13113         (class General_options): Add option -z combreloc.
13114         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13115         get_address.
13116         (Output_reloc::sort_before) [SHT_REL]: New function.
13117         (Output_reloc::sort_before) [SHT_RELA]: New function.
13118         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13119         Sort_relocs_comparison.
13120         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13121         parameter.  Change all callers.
13122         (Output_data_reloc::Output_data_reloc) [both versions]: Add
13123         sort_relocs parameter.  Change all callers.
13124         * output.cc (Output_reloc::get_address): New function, broken out
13125         of write_rel.
13126         (Output_reloc::write_rel): Call it.
13127         (Output_reloc::compare): New function.
13128         (Output_data_reloc_base::do_write): Optionally sort relocs.
13129
13130         * configure.ac: If targ_extra_obj is set, link it in.
13131         * configure.tgt: Initialize all variables.
13132         (x86_64*): Set targ_extra_obj and targ_extra_size.
13133         * configure: Rebuild.
13134
13135         * object.cc (Sized_relobj::include_section_group): Adjust section
13136         indexes read from group data.  Build vector to pass to
13137         layout_group.
13138         * layout.cc (Layout::layout_group): Add flags and shndxes
13139         parameters.  Remove contents parameter.  Change caller.  Update
13140         explicit instantiations.
13141         * layout.h (class Layout): Update layout_group declaration.
13142         * output.cc (Output_data_group::Output_data_group): Add flags and
13143         input_shndxes parameters.  Remove contents parameter.  Change
13144         caller.
13145         (Output_data_group::do_write): Change input_sections_ to
13146         input_shndxes_.
13147         * output.h (class Output_data_group): Update constructor
13148         declaration.  Rename input_sections_ to input_shndxes_.
13149         * testsuite/many_sections_test.cc: Add template.
13150
13151 2008-04-30  Cary Coutant  <ccoutant@google.com>
13152
13153         * target-reloc.h (relocate_section): Fix dead-pointer bug.
13154
13155         * layout.cc (Layout::include_section): Refactored check for debug
13156         info section.
13157         (Layout::add_comdat): Add new parameters.  Change type
13158         of signature parameter.  Add object and shndx to signatures table.
13159         (Layout::find_kept_object): New function.
13160         * layout.h: Include <cstring>.
13161         (Layout::is_debug_info_section): New function.
13162         (Layout::add_comdat): Add new parameters.
13163         (Layout::find_kept_object): New function.
13164         (Layout::Kept_section): New struct.
13165         (Layout::Signatures): Change type of map range.
13166         * object.cc (Relobj::output_section_address): New function.
13167         (Sized_relobj::include_section_group): Add new parameters.  Change
13168         calls to Layout::add_comdat.  Change to build table of kept comdat
13169         groups and table mapping discarded sections to kept sections.
13170         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
13171         (Sized_relobj::do_layout): Change calls to include_section_group and
13172         include_linkonce_section.
13173         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
13174         value to zero when section is discarded.
13175         (Sized_relobj::map_to_kept_section): New function.
13176         * object.h (Relobj::output_section_address): New function.
13177         (Relobj::Comdat_group): New type.
13178         (Relobj::find_comdat_group): New function.
13179         (Relobj::Comdat_group_table): New type.
13180         (Relobj::Kept_comdat_section): New type.
13181         (Relobj::Kept_comdat_section_table): New type.
13182         (Relobj::add_comdat_group): New function.
13183         (Relobj::set_kept_comdat_section): New function.
13184         (Relobj::get_kept_comdat_section): New function.
13185         (Relobj::comdat_groups_): New field.
13186         (Relobj::kept_comdat_sections_): New field.
13187         (Symbol_value::input_value): Update comment.
13188         (Sized_relobj::map_to_kept_section) New function.
13189         (Sized_relobj::include_linkonce_section): Add new parameter.
13190         * target-reloc.h (Comdat_behavior): New type.
13191         (get_comdat_behavior): New function.
13192         (relocate_section): Add code to map a discarded section to the
13193         corresponding kept section when applying a relocation.
13194
13195 2008-04-30  Craig Silverstein  <csilvers@google.com>
13196
13197         * dwarf_reader.cc (next_generation_count): New static var.
13198         (Addr2line_cache_entry): New struct.
13199         (addr2line_cache): New static var.
13200         (Dwarf_line_info::one_addr2line): Added caching.
13201         (Dwarf_line_info::clear_addr2line_cache): New function.
13202         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
13203         cache-size parameter.
13204         (Dwarf_line_info::one_addr2line_cache): New function.
13205         * symtab.cc (Symbol_table::detect_odr_violations): Pass
13206         new cache-size argument to one_addr2line(), and clear cache.
13207
13208 2008-04-28  Cary Coutant  <ccoutant@google.com>
13209
13210         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
13211         R_386_PC8 relocations.
13212
13213 2008-04-23  Ian Lance Taylor  <iant@google.com>
13214
13215         * object.cc (Sized_relobj::include_section_group): Check for
13216         invalid section group.
13217
13218         * object.cc (make_elf_object): Correct test for 64-bit ELF file
13219         header size.
13220
13221         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
13222         than read for file header.
13223         * archive.cc (Archive::include_member): Likewise.
13224
13225 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
13226
13227         * aclocal.m4: Regenerate.
13228         * configure: Regenerate.
13229
13230 2008-04-19  Ian Lance Taylor  <iant@google.com>
13231
13232         * version.cc (version_string): Bump to 1.6.
13233
13234         * testsuite/Makefile.am (many_sections_r_test): New target.
13235         (many_sections_r_test_SOURCES): Remove.
13236         (many_sections_r_test_DEPENDENCIES): Remove.
13237         (many_sections_r_test_LDFLAGS): Remove.
13238         (many_sections_r_test_LDADD): Remove.
13239
13240         * object.cc (Sized_relobj::do_add_symbols): Always pass
13241         local_symbol_count_ to add_from_relobj.
13242
13243         * testsuite/Makefile.am (many_sections_check.h): Only check one in
13244         every thousand variables.
13245         * testsuite/Makefile.in: Rebuild.
13246
13247         * object.cc (Xindex::initialize_symtab_xindex): New function.
13248         (Xindex::read_symtab_xindex): New function.
13249         (Xindex::sym_xindex_to_shndx): New function.
13250         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
13251         available.
13252         (Sized_relobj::do_initialize_xindex): New function.
13253         (Sized_relobj::do_read_symbols): Adjust section links.
13254         (Sized_relobj::symbol_section_and_value): Add is_ordinary
13255         parameter.  Change all callers.
13256         (Sized_relobj::include_section_group): Adjust section links and
13257         symbol section indexes.
13258         (Sized_relobj::do_layout): Adjust section links.
13259         (Sized_relobj::do_count_local_symbols): Adjust section links and
13260         symbol section indexes.
13261         (Sized_relobj::do_finalize_local_symbols): Distinguish between
13262         ordinary and special symbols.
13263         (Sized_relobj::write_local_symbols): Add symtab_xindex and
13264         dynsym_xindex parameters.  Change all callers.  Adjust section
13265         links.  Use SHN_XINDEX when needed.
13266         (Sized_relobj::get_symbol_location_info): Adjust section links.
13267         Don't get fooled by special symbols.
13268         * object.h (class Xindex): Define.
13269         (class Object): Add xindex_ parameter.  Declare virtual functoin
13270         do_initialize_xindex.
13271         (Object::adjust_sym_shndx): New function.
13272         (Object::set_xindex): New protected function.
13273         (class Symbol_value): Add is_ordinary_shndx_ field.
13274         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
13275         (Symbol_value::value): Assert ordinary section.
13276         (Symbol_value::initialize_input_to_output_map): Likewise.
13277         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
13278         Change all callers.
13279         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
13280         all callers.
13281         (class Sized_relobj): Update declarations.
13282         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
13283         parameter.  Change all callers.
13284         (Sized_relobj::adjust_shndx): New function.
13285         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
13286         field.
13287         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
13288         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
13289         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
13290         (Sized_dynobj::read_dynsym_section): Adjust section links.
13291         (Sized_dynobj::read_dynamic): Likewise.
13292         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
13293         section links.
13294         (Sized_dynobj::do_initialize_xindex): New function.
13295         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
13296         do_initialize_xindex.
13297         (Sized_dynobj::adjust_shndx): New function.
13298         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
13299         dynsym_xindex_ fields.
13300         (Layout::finalize): Add a call to set_section_indexes before
13301         creating the symtab sections.
13302         (Layout::set_section_indexes): Don't do anything if the section
13303         already has a section index.
13304         (Layout::create_symtab_sections): Add shnum parameter.  Change
13305         caller.  Create .symtab_shndx section if needed.
13306         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
13307         caller.
13308         (Layout::allocated_output_section_count): New function.
13309         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
13310         needed.
13311         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
13312         fields.  Update declarations.
13313         (Layout::symtab_xindex): New function.
13314         (Layout::dynsym_xindex): New function.
13315         (class Write_symbols_task): Add layout_ field.
13316         (Write_symbols_task::Write_symbols_task): Add layout parameter.
13317         Change caller.
13318         * output.cc (Output_section_headers::Output_section_headers): Add
13319         shstrtab_section parameter.  Change all callers.
13320         (Output_section_headers::do_sized_write): Store overflow values
13321         for section count and section string table section index in
13322         section header zero.
13323         (Output_file_header::do_sized_write): Check for overflow of
13324         section count and section string table section index.
13325         (Output_symtab_xindex::do_write): New function.
13326         (Output_symtab_xindex::endian_do_write): New function.
13327         * output.h (class Output_section_headers): Add shstrtab_section_.
13328         Update declarations.
13329         (class Output_symtab_xindex): Define.
13330         (Output_section::has_out_shndx): New function.
13331         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
13332         field.
13333         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
13334         Change all callers.
13335         (Sized_symbol::init): Likewise.
13336         (Symbol::output_section): Check for ordinary symbol.
13337         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
13338         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
13339         callers.
13340         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
13341         Change all callers.  Simplify handling of symbols from sections
13342         not included in the link.
13343         (Symbol_table::add_from_dynobj): Handle ordinary symbol
13344         distinction.
13345         (Weak_alias_sorter::operator()): Assert that symbols are
13346         ordinary.
13347         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
13348         distinction.
13349         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
13350         parameters.  Change all callers.
13351         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
13352         symbol distinction.  Use SHN_XINDEX when needed.
13353         (Symbol_table::write_section_symbol): Add symtab_xindex
13354         parameter.  Change all callers.
13355         (Symbol_table::sized_write_section_symbol): Likewise.  Use
13356         SHN_XINDEX when needed.
13357         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
13358         declarations.
13359         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
13360         (Symbol::is_defined): Check is_ordinary.
13361         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
13362         (Symbol::is_absolute, Symbol::is_common): Likewise.
13363         (class Sized_symbol): Update declarations.
13364         (class Symbol_table): Update declarations.
13365         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
13366         parameters.  Change all callers.
13367         (Sized_symbol::override): Likewise.
13368         (Symbol_table::override): Likewise.
13369         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
13370         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
13371         is_ordinary, and orig_st_shndx parameters.  Change all callers.
13372         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
13373         to be in an ordinary section.
13374         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
13375         object and is_ordinary parameters.  Change all callers.
13376         (Sized_dwarf_line_info::read_relocs): Add object parameter.
13377         Change all callers.  Don't add undefined or non-ordinary symbols
13378         to reloc_map_.
13379         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
13380         Change all callers.
13381         * dwarf_reader.h (class Sized_dwarf_line_info): Update
13382         declarations.
13383         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
13384         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
13385         (Sized_relobj::relocate_sections): Likewise.
13386         * target-reloc.h (scan_relocs): Adjust section symbol index.
13387         (scan_relocatable_relocs): Likewise.
13388         * i386.cc (Scan::local): Check for ordinary symbols.
13389         * sparc.cc (Scan::local): Likewise.
13390         * x86_64.cc (Scan::local): Likewise.
13391         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
13392         to symbol_section_and_value.
13393         * testsuite/many_sections_test.cc: New file.
13394         * testsuite/Makefile.am (BUILT_SOURCES): Define.
13395         (check_PROGRAMS): Add many_sections_test.
13396         (many_sections_test_SOURCES): Define.
13397         (many_sections_test_DEPENDENCIES): Define.
13398         (many_sections_test_LDFLAGS): Define.
13399         (BUILT_SOURCES): Add many_sections_define.h.
13400         (many_sections_define.h): New target.
13401         (BUILT_SOURCES): Add many_sections_check.h.
13402         (many_sections_check.h): New target.
13403         (check_PROGRAMS): Add many_sections_r_test.
13404         (many_sections_r_test_SOURCES): Define.
13405         (many_sections_r_test_DEPENDENCIES): Define.
13406         (many_sections_r_test_LDFLAGS): Define.
13407         (many_sections_r_test_LDADD): Define.
13408         (many_sections_r_test.o): New target.
13409         * testsuite/Makefile.in: Rebuild.
13410
13411 2008-04-17  Cary Coutant  <ccoutant@google.com>
13412
13413         * errors.cc (Errors::info): New function.
13414         (gold_info): New function.
13415         * errors.h (Errors::info): New function.
13416         * gold.h (gold_info): New function.
13417         * object.cc (Input_objects::add_object): Print trace output.
13418         * options.cc (options::parse_set): New function.
13419         (General_options::parse_wrap): Deleted.
13420         (General_options::General_options): Deleted initializer.
13421         * options.h (options::String_set): New typedef.
13422         (options::parse_set): New function.
13423         (DEFINE_set): New macro.
13424         (General_options::wrap): Changed to use DEFINE_set. Changed
13425         callers of any_wrap_symbols and is_wrap_symbol.
13426         (General_options::trace, General_options::trace_symbol):
13427         New options.
13428         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
13429         (General_options::wrap_symbols_): Deleted.
13430         * symtab.cc (Symbol_table::add_from_object): Print trace output.
13431
13432 2008-04-17  David S. Miller  <davem@davemloft.net>
13433
13434         * options.cc (General_options::parse_V): New function.
13435         * options.h: Add entries for -V and -Qy.
13436
13437 2008-04-17  Ian Lance Taylor  <iant@google.com>
13438
13439         * common.cc (Symbol_table::allocate_commons): Remove options
13440         parameter.  Change caller.
13441         (Symbol_table::do_allocate_commons): Remove options parameter.
13442         Change caller.  Just call do_allocate_commons_list twice.
13443         (Symbol_table::do_allocate_commons_list): New function, broken out
13444         of do_allocate_commons.
13445         * common.h (class Allocate_commons_task): Remove options_ field.
13446         Update constructor.
13447         * symtab.cc (Symbol_table::Symbol_table): Initialize
13448         tls_commons_.
13449         (Symbol_table::add_from_object): Put TLS common symbols on
13450         tls_commons_ list.
13451         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
13452         which are IN_OUTPUT_DATA.
13453         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
13454         allocate_commons and do_allocate_commons declarations.  Declare
13455         do_allocate_commons_list.
13456         * gold.cc (queue_middle_tasks): Update creation of
13457         Allocate_commons_task to not pass options.
13458         * testsuite/Makefile.am (INCLUDES): Add -I.. .
13459         (TLS_TEST_C_FLAGS): New variable.
13460         (tls_test_c_pic.o): New target.
13461         (tls_test_shared.so): Link in tls_test_c_pic.o.
13462         (tls_test_c_pic_ie.o): New target.
13463         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
13464         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
13465         (tls_test_c.o): New target.
13466         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
13467         (tls_pic_test_LDADD): Likewise.
13468         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
13469         (tls_shared_gd_to_ie_test_LDADD): Likewise.
13470         (tls_test_c_gnu2.o): New target.
13471         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
13472         tls_test_c_gnu2.o.
13473         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
13474         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
13475         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
13476         * testsuite/tls_test.cc: Include "config.h".
13477         (t_last): Call t11_last.
13478         * testsuite/tls_test.h (t11, t11_last): Declare.
13479         * testsuite/tls_test_c.c: New file.
13480         * testsuite/tls_test_main.cc (thread_routine): Call t11.
13481         * configure.ac: Check for OpenMP support.
13482         * configure, config.in, Makefile.in: Rebuild.
13483         * testsuite/Makefile.in: Rebuild.
13484
13485 2008-04-16  Cary Coutant  <ccoutant@google.com>
13486
13487         * i386.cc (Target_i386::define_tls_base_symbol): New function.
13488         (Target_i386::tls_base_symbol_defined_): New field.
13489         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13490         (Target_i386::Scan::global): Likewise.
13491         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
13492         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
13493         (Target_x86_64::tls_base_symbol_defined_): New field.
13494         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
13495         (Target_x86_64::Scan::global): Likewise.
13496
13497 2008-04-16  Cary Coutant  <ccoutant@google.com>
13498
13499         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
13500         (Symbol::needs_plt_entry): Allow weak undefined symbols.
13501         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
13502         building shared libraries.
13503         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
13504         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
13505         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
13506         * testsuite/Makefile.in: Rebuild.
13507         * testsuite/weak_undef.h: New file.
13508         * testsuite/weak_undef_file1.cc: Add extra test cases.
13509         * testsuite/weak_undef_file2.cc: Likewise.
13510         * testsuite/weak_undef_test.cc: Likewise.
13511
13512 2008-04-16  David S. Miller  <davem@davemloft.net>
13513
13514         * sparc.cc (Target_sparc::Scan): Change from struct to class.
13515         Add issued_non_pic_error_ field.  Declare check_non_pic.
13516         (Target_sparc::Scan::check_non_pic): New function.
13517         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
13518         (Target_sparc::Scan::global): Likewise.
13519
13520         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
13521         * configure: Rebuild.
13522
13523         * options.h (DEFINE_enable): New macro.
13524         (new_dtags): New enable option.
13525         (initfirst, interpose, loadfltr, nodefaultlib,
13526         nodelete, nodlopen, nodump): New -z options.
13527         * layout.cc (Layout:finish_dynamic_section): If new
13528         dtags enabled, emit DT_RUNPATH.  Also, emit a
13529         DT_FLAGS_1 containing any specified -z flags.
13530
13531 2008-04-16  Ian Lance Taylor  <iant@google.com>
13532
13533         * copy-relocs.cc: New file.
13534         * copy-relocs.h: New file.
13535         * reloc.cc: Remove Copy_relocs code.
13536         * reloc.h: Likewise.
13537         * reloc-types.h (struct Reloc_types) [both versions]: Add
13538         get_reloc_addend_noerror.
13539         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
13540         variants of add_global which take an addend which must be zero.
13541         * i386.cc: Include "copy-relocs.h".
13542         (class Target_i386): Change type of copy_relocs_ to variable,
13543         update initializer.
13544         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
13545         Change all callers.
13546         (Target_i386::do_finalize_sections): Change handling of
13547         copy_relocs_.
13548         * sparc.cc: Include "copy-relocs.h".
13549         (class Target_sparc): Change type of copy_relocs_ to variable,
13550         update initializer.
13551         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
13552         Change all callers.
13553         (Target_sparc::do_finalize_sections): Change handling of
13554         copy_relocs_.
13555         * x86_64.cc: Include "copy-relocs.h".
13556         (class Target_x86_64): Change type of copy_relocs_ to variable,
13557         update initializer.
13558         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
13559         class.  Change all callers.
13560         (Target_x86_64::do_finalize_sections): Change handling of
13561         copy_relocs_.
13562         * Makefile.am (CCFILES): Add copy-relocs.cc.
13563         (HFILES): Add copy-relocs.h.
13564
13565         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
13566
13567         * testsuite/script_test_4.sh: Permit leading zeroes.
13568
13569 2008-04-15  Ian Lance Taylor  <iant@google.com>
13570
13571         * script-sections.cc (Script_sections::create_segments): Use
13572         header_size_adjustment even when there is enough room for the
13573         headers.
13574         * testsuite/script_test_4.sh: New file.
13575         * testsuite/script_test_4.t: New file.
13576         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
13577         (check_DATA): Add script_test_4.stdout.
13578         (MOSTLYCLEANFILES): Likewise.
13579         (script_test_4): New target.
13580         (script_test_4.stdout): New target.
13581         * testsuite/Makefile.in: Rebuild.
13582
13583         * sparc.cc: Add definitions for Output_data_plt_sparc class
13584         constants.
13585
13586 2008-04-14  David S. Miller  <davem@davemloft.net>
13587
13588         * sparc.cc: New file.
13589         * Makefile.am (TARGETSOURCES): Add sparc.cc
13590         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
13591         * configure.tgt: Document targ_extra_size and
13592         targ_extra_big_endian.  Add entries for sparc-* and
13593         sparc64-*.
13594         * configure.ac: Handle targ_extra_size and
13595         targ_extra_big_endian.
13596         * Makefile.in: Rebuild.
13597         * configure: Likewise.
13598         * po/POTFILES.in: Likewise.
13599         * po/gold.pot: Likewise.
13600
13601 2008-04-14  Ian Lance Taylor  <iant@google.com>
13602
13603         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
13604         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
13605         in the name/type/flags to section mapping.  Don't call
13606         allocate_output_section.
13607         (Layout::choose_output_section): Change parameter from adjust_name
13608         to is_input_section.  Don't permit input sections after sections
13609         are attached to segments.  Don't call allocate_output_section.
13610         (Layout::layout_eh_frame): Call update_flags_for_input_section,
13611         not write_enable_output_section.
13612         (Layout::make_output_section): Don't push to
13613         unattached_section_list_ nor call attach_to_segment.  Call
13614         attach_section_to_segment if sections are attached.
13615         (Layout::attach_sections_to_segments): New function.
13616         (Layout::attach_section_to_segment): New function.
13617         (Layout::attach_allocated_section_to_segment): Rename from
13618         attach_to_segment.  Remove flags parameter.
13619         (Layout::allocate_output_section): Remove function.
13620         (Layout::write_enable_output_section): Remove function.
13621         * layout.h (class Layout): Update for above changes.  Add new
13622         field sections_are_attached_.
13623         * output.h (Output_section::update_flags_for_input_section): New
13624         function.
13625         * output.cc (Output_section::add_input_section): Call
13626         update_flags_for_input_section.
13627         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
13628
13629 2008-04-11  Cary Coutant  <ccoutant@google.com>
13630
13631         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
13632         thought unnecessary.
13633         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
13634
13635 2008-04-11  Ian Lance Taylor  <iant@google.com>
13636
13637         * output.h (class Output_section_data): Remove inline definition
13638         of set_addralign.
13639         * output.cc (Output_section_data::set_addralign): New function.
13640
13641 2008-04-11  Cary Coutant  <ccoutant@google.com>
13642
13643         Add support for TLS descriptors for i386 and x86_64.
13644         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
13645         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
13646         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
13647         GOT_TYPE_TLS_DESC.
13648         (Target_i386::got_mod_index_entry): Remove unnecessary code.
13649         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
13650         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
13651         relocations.
13652         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
13653         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
13654         Fix problem with initial-exec relocations.
13655         (Target_i386::Relocate::relocate_tls): Likewise.
13656         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
13657         relaxation.
13658         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
13659         support for section-plus-offset dynamic table entries.
13660         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
13661         (Output_data_dynamic::Dynamic_entry): Add support for
13662         section-plus-offset dynamic table entries.
13663         (Output_data_dynamic::Classification): Likewise.
13664         (Output_data_dynamic::classification_): Renamed offset_.
13665         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
13666         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
13667         (Target_x86_64::make_plt_section): New function.
13668         (Target_x86_64::reserve_tlsdesc_entries): New function.
13669         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
13670         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
13671         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
13672         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
13673         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
13674         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
13675         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
13676         add extra PLT entry for TLS descriptors.
13677         (Output_data_plt_x86_64::got_): New field.
13678         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
13679         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
13680         fields.
13681         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
13682         descriptors.
13683         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
13684         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
13685         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
13686         R_386_TLS_DESC_CALL relocations.
13687         (Target_x86_64::Scan::global): Likewise.
13688         (Target_x86_64::do_finalize_sections): Add dynamic table entries
13689         for TLS descriptors.
13690         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
13691         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
13692         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
13693         GD-to-IE relaxation.
13694         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
13695         and TLS_DESCRIPTORS.
13696         * Makefile.in: Rebuild.
13697         * configure: Rebuild.
13698         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
13699         (tls_test_shared2.so): New target.
13700         (tls_shared_gd_to_ie_test_SOURCES): New variable.
13701         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
13702         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
13703         (tls_shared_gd_to_ie_test_LDADD): New variable.
13704         (tls_shared_gnu2_gd_to_ie_test): New target.
13705         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
13706         New targets.
13707         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
13708         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
13709         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
13710         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
13711         (tls_shared_gnu2_test): New target.
13712         (tls_test_gnu2_shared.so): New target.
13713         (tls_shared_gnu2_test_SOURCES): New variable.
13714         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
13715         (tls_shared_gnu2_test_LDFLAGS): New variable.
13716         (tls_shared_gnu2_test_LDADD): New variable.
13717         * testsuite/Makefile.in: Rebuild.
13718         * testsuite/Makefile.
13719
13720 2008-04-11  Ian Lance Taylor  <iant@google.com>
13721
13722         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
13723         justsyms.t.
13724         * testsuite/Makefile.in: Rebuild.
13725
13726         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
13727         long.
13728         * testsuite/script_test_2.cc (main): Adjust test.
13729
13730 2008-04-11  David S. Miller  <davem@davemloft.net>
13731             Ian Lance Taylor  <iant@google.com>
13732
13733         * options.h (General_options): Add entries for '-Y' and
13734         '-relax'.
13735         * options.cc (General_options:finalize): If -Y was used, add those
13736         entries to the library path instead of the default "/lib" and
13737         "/usr/lib".
13738
13739 2008-04-11  David S. Miller  <davem@davemloft.net>
13740
13741         * testsuite/justsyms.t: Start at 0x100.
13742         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
13743         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
13744         long.
13745         * testsuite/script_test_2.cc: Adjust string and section length
13746         checks.
13747
13748 2008-04-09  Ian Lance Taylor  <iant@google.com>
13749
13750         PR gold/5996
13751         * script-sections.cc (Sections_element::allocate_to_segment): Add
13752         orphan parameter.
13753         (Output_section_definition::allocate_to_segment): Likewise.
13754         (Orphan_output_section::allocate_to_segment): Likewise.
13755         (Script_sections::attach_sections_using_phdrs_clause): Don't
13756         propagate non-PT_LOAD segments to orphan sections.
13757         * testsuite/Makefile.am (script_test_3.stdout): Generate using
13758         readelf rather than objdump.
13759         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
13760         .interp section and PT_INTERP segment are the same size.
13761         * testsuite/Makefile.in: Rebuild.
13762
13763         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
13764         aliases for symbols defined in the same object.
13765         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
13766         (weak_alias_test_SOURCES): New variable.
13767         (weak_alias_test_DEPENDENCIES): New variable.
13768         (weak_alias_test_LDFLAGS): New variable.
13769         (weak_alias_test_LDADD): New variable.
13770         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
13771         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
13772         (weak_alias_test_3.o): New target.
13773         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
13774         * testsuite/weak_alias_test_main.cc: New file.
13775         * testsuite/weak_alias_test_1.cc: New file.
13776         * testsuite/weak_alias_test_2.cc: New file.
13777         * testsuite/weak_alias_test_3.cc: New file.
13778
13779 2008-04-08  Ian Lance Taylor  <iant@google.com>
13780
13781         * options.h (class General_options): Add --noinhibit-exec option.
13782         * main.cc (main): Check --noinhibit-exec.
13783
13784         * options.h (class General_options): Define --wrap as a special
13785         option.  Add wrap_symbols_ field.
13786         (General_options::any_wrap_symbols): New function.
13787         (General_options::is_wrap_symbol): New function.
13788         * options.cc (General_options::parse_wrap): New function.
13789         (General_options::General_options): Initialize wrap_symbols_.
13790         * symtab.cc (Symbol_table::wrap_symbol): New function.
13791         (Symbol_table::add_from_object): Handle --wrap.
13792         * symtab.h (class Symbol_table): Declare wrap_symbol.
13793         * target.h (Target::wrap_char): New function.
13794         (Target::Target_info): Add wrap_char field.
13795         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
13796         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13797         * testsuite/testfile.cc (Target_test::test_target_info):
13798         Likewise.
13799
13800         * errors.cc (Errors::undefined_symbol): Mention symbol version if
13801         there is one.
13802
13803         * layout.h (class Layout): Add added_eh_frame_data_ field.
13804         * layout.cc (Layout::Layout): Initialize new field.
13805         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
13806         output section until we find a section we merged successfully.
13807         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
13808         that the size be non-zero.
13809
13810         * merge.cc (Object_merge_map::get_output_offset): Remove inline
13811         qualifier.
13812
13813 2008-04-08  Craig Silverstein  <csilvers@google.com>
13814
13815         * configure.ac: Export new conditional variable HAVE_ZLIB.
13816         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
13817         on HAVE_ZLIB.
13818         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
13819         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13820
13821 2008-04-07  Ian Lance Taylor  <iant@google.com>
13822
13823         * version.cc (version_string): Set to "1.5".
13824
13825         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
13826         Add issued_non_pic_error_ field.  Declare check_non_pic.
13827         (Target_x86_64::Scan::check_non_pic): New function.
13828         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
13829         (Target_x86_64::Scan::global): Likewise.
13830
13831         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
13832         addend parameter.  Change caller.  Handle merge sections.
13833         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
13834         Address to Addend.  Don't add in the result of
13835         local_section_offset, pass down the addend and use the returned
13836         value.
13837         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
13838         Update declarations of local_section_offset and symbol_value.
13839         * testsuite/two_file_test_1.cc (t18): New function.
13840         * testsuite/two_file_test_2.cc (f18): New function.
13841         * testsuite/two_file_test_main.cc (main): Call t18.
13842         * testsuite/two_file_test.h (t18, f18): Declare.
13843
13844         * configure.ac: Don't test for objdump, c++filt, or readelf.
13845         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
13846         conditionals.
13847         (TEST_READELF): New variable.
13848         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
13849         (check_PROGRAMS): Add two_file_strip_test.
13850         (two_file_strip_test): New target.
13851         (check_PROGRAMS): Add two_file_same_shared_strip_test.
13852         (two_file_same_shared_strip_test_SOURCES): New variable.
13853         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
13854         (two_file_same_shared_strip_test_LDFLAGS): New variable.
13855         (two_file_same_shared_strip_test_LDADD): New variable.
13856         (two_file_shared_strip.so): New target.
13857         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
13858         (ver_test_5.syms, ver_test_7.syms): Likewise.
13859         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
13860         (strip_test_3.stdout): Use TEST_OBJDUMP.
13861         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
13862
13863 2008-04-04  Cary Coutant  <ccoutant@google.com>
13864
13865         * symtab.h (Symbol::is_weak_undefined): New function.
13866         (Symbol::is_strong_undefined): New function.
13867         (Symbol::is_absolute): New function.
13868         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
13869         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
13870         absolute symbols.
13871         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
13872         (weak_undef_test): New target.
13873         * testsuite/Makefile.in: Rebuild.
13874         * testsuite/weak_undef_file1.cc: New file.
13875         * testsuite/weak_undef_file2.cc: New file.
13876         * testsuite/weak_undef_test.cc: New file.
13877
13878 2008-04-03  Craig Silverstein  <csilvers@google.com>
13879
13880         * compressed_output.h (class Output_compressed_section): Use
13881         unsigned buffer.
13882         * compressed_output.cc (zlib_compress): Use unsigned buffers,
13883         add zlib header.
13884         (zlib_compressed_suffix): Removed.
13885         (Output_compressed_section::set_final_data_size): Use unsigned
13886         buffers.
13887         * testsuite/Makefile.am (flagstest_compress_debug_sections):
13888         Fix linker invocation.
13889         (flagstest_o_specialfile_and_compress_debug_sections):
13890         Likewise.
13891         * testsuite/Makefile.in: Regenerated.
13892
13893 2008-04-02  David S. Miller  <davem@davemloft.net>
13894
13895         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
13896         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
13897
13898 2008-04-02  Craig Silverstein  <csilvers@google.com>
13899
13900         * TODO: New file.
13901
13902 2008-04-02  Ian Lance Taylor  <iant@google.com>
13903
13904         * fileread.cc (File_read::find_view): Add byteshift and vshifted
13905         parameters.  Update for new key type to views_.  Change all
13906         callers.
13907         (File_read::read): Adjust for byteshift in returned view.
13908         (File_read::add_view): New function, broken out of
13909         find_and_make_view.
13910         (File_read::make_view): New function, broken out of
13911         find_and_make_view.
13912         (File_read::find_or_make_view): Add offset and aligned
13913         parameters.  Rewrite accordingly.  Change all callers.
13914         (File_read::get_view): Add offset and aligned parameters.  Adjust
13915         for byteshift in return value.
13916         (File_read::get_lasting_view): Likewise.
13917         * fileread.h (class File_read): Update declarations.
13918         (class File_read::View): Add byteshift_ field.  Add byteshift to
13919         constructor.  Add byteshift method.
13920         * archive.h (Archive::clear_uncached_views): New function.
13921         (Archive::get_view): Add aligned parameter.  Change all callers.
13922         * object.h (Object::get_view): Add aligned parameter.  Change all
13923         callers.
13924         (Object::get_lasting_view): Likewise.
13925
13926         * fileread.cc (File_read::release): Don't call clear_views if
13927         there are multiple objects.
13928         * fileread.h (File_read::clear_uncached_views): New function.
13929         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
13930         on the archive.
13931
13932 2008-03-31  Cary Coutant  <ccoutant@google.com>
13933
13934         Add thin archive support.
13935         * archive.cc (Archive::armagt): New const.
13936         (Archive::setup): Remove task parameter and calls to unlock.
13937         (Archive::unlock_nested_archives): New function.
13938         (Archive::read_header): Add nested_off parameter. Change
13939         all callers.
13940         (Archive::interpret_header): Likewise.
13941         (Archive::include_all_members): Change to handle thin
13942         archives.
13943         (Archive::include_member): Likewise.
13944         * archive.h (Archive::Archive): Add new parameters and
13945         initializers.
13946         (Archive::armagt): New const.
13947         (Archive::setup): Remove task parameter.
13948         (Archive::unlock_nested_archives): New function.
13949         (Archive::read_header): Add nested_off parameter.
13950         (Archive::interpret_header): Likewise.
13951         (Archive::Nested_archive_table): New typedef.
13952         (Archive::is_thin_archive_): New field.
13953         (Archive::nested_archives_): New field.
13954         (Archive::options_): New field.
13955         (Archive::dirpath_): New field.
13956         (Archive::task_): New field.
13957         * readsyms.cc (Read_symbols::do_read_symbols): Add check
13958         for thin archives.  Pass additional parameters to
13959         Archive::Archive.  Unlock the archive file after calling
13960         Archive::setup.
13961
13962 2008-03-29  Ian Lance Taylor  <iant@google.com>
13963
13964         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
13965         version symbol to be local.
13966         * testsuite/ver_test_4.sh: New file.
13967         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
13968         (check_DATA): Add ver_test_4.syms.
13969         (ver_test_4.syms): New target.
13970         * testsuite/Makefile.in: Rebuild.
13971
13972         * output.cc
13973         (Output_section::Input_section_sort_entry::has_priority): New
13974         function.
13975         (Output_section::Input_section_sort_entry::match_file_name): New
13976         function.
13977         (Output_section::Input_section_sort_entry::match_section_name):
13978         Remove.
13979         (Output_section::Input_section_sort_entry::match_section_name_prefix):
13980         Remove.
13981         (Output_section::Input_section_sort_entry::match_section_file):
13982         Remove.
13983         (Output_section::Input_section_sort_compare::operator()): Rewrite
13984         using new Input_section_sort_entry functions.  Sort crtbegin and
13985         crtend first.  Sort sections with no priority before sections with
13986         a priority.
13987         * testsuite/initpri1.c (d3): Check j != 4.
13988         (cd5): New constructor/destructor function.
13989         (main): Check j != 2.
13990
13991         * symtab.cc (Symbol_table::add_from_object): If we don't use the
13992         new symbol when resolving, don't call set_is_default.
13993         * testsuite/ver_test_7.cc: New file.
13994         * testsuite/ver_test_7.sh: New file.
13995         * testsuite/Makefile.am (ver_test_7.so): New target.
13996         (ver_test_7.o): New target.
13997         (check_SCRIPTS): Add ver_test_7.sh.
13998         (check_DATA): Add ver_test_7.syms.
13999         (ver_test_7.syms): New target.
14000
14001 2008-03-28  Ian Lance Taylor  <iant@google.com>
14002
14003         * layout.cc (Layout::layout): If we see an input section with a
14004         name that needs sorting, set the must_sort flag for the output
14005         section.
14006         (Layout::make_output_section): If the name of the output section
14007         indicates that it might require sorting, set the may_sort flag.
14008         * output.h (Output_section::may_sort_attached_input_sections): New
14009         function.
14010         (Output_section::set_may_sort_attached_input_sections): New
14011         function.
14012         (Output_section::must_sort_attached_input_sections): New
14013         function.
14014         (Output_section::set_must_sort_attached_input_sections): New
14015         function.
14016         (class Output_section): Declare Input_section_sort_entry.  Define
14017         Input_section_sort_compare.  Declare
14018         sort_attached_input_sections.  Add new fields:
14019         may_sort_attached_input_sections_,
14020         must_sort_attached_input_sections_,
14021         attached_input_sections_are_sorted_.
14022         * output.cc (Output_section::Output_section): Initialize new
14023         fields.
14024         (Output_section::add_input_section): Add an entry to
14025         input_sections_ if may_sort or must_sort are true.
14026         (Output_section::set_final_data_size): Call
14027         sort_attached_input_sections if necessary.
14028         (Output_section::Input_section_sort_entry): Define new class.
14029         (Output_section::Input_section_sort_compare::operator()): New
14030         function.
14031         (Output_section::sort_attached_input_sections): New function.
14032         * configure.ac: Check whether the compiler supports constructor
14033         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14034         * testsuite/initpri1.c: New file.
14035         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14036         CONSTRUCTOR_PRIORITY.
14037         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14038         (initpri1_LDFLAGS): New variable.
14039         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14040
14041 2008-03-27  Ian Lance Taylor  <iant@google.com>
14042
14043         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14044         * testsuite/common_test_1.c: New file.
14045         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14046         (common_test_1_SOURCES): New variable.
14047         (common_test_1_DEPENDENCIES): New variable.
14048         (common_test_1_LDFLAGS): New variable.
14049
14050         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14051         and commons_ correctly when NAME/VERSION does not override
14052         NAME/NULL.
14053         * testsuite/ver_test_6.c: New file.
14054         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14055         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14056         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14057
14058 2008-03-26  Ian Lance Taylor  <iant@google.com>
14059
14060         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14061         of an undefined symbol from a version script.
14062         * testsuite/Makefile.am (ver_test_5.so): New target.
14063         (ver_test_5.o): New target.
14064         (check_SCRIPTS): Add ver_test_5.sh.
14065         (check_DATA): Add ver_test_5.syms.
14066         (ver_test_5.syms): New target.
14067         * testsuite/ver_test_5.cc: New file.
14068         * testsuite/ver_test_5.script: New file.
14069         * testsuite/ver_test_5.sh: New file.
14070         * Makefile.in, testsuite/Makefile.in: Rebuild.
14071
14072         PR gold/5986
14073         Fix problems building gold with gcc 4.3.0.
14074         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14075         (gold_error_at_location, gold_warning_at_location): Use it.
14076         * configure.ac: Check whether we can compile and use a template
14077         function with a printf attribute.
14078         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14079         when jumping over bytes.
14080         * object.cc: Instantiate Object::read_section_data.
14081         * debug.h: Include <cstring>
14082         * dwarf_reader.cc: Include <algorithm>
14083         * main.cc: Include <cstring>.
14084         * options.cc: Include <cstring>.
14085         * output.cc: Include <cstring>.
14086         * script.cc: Include <cstring>.
14087         * script.h: Include <string>.
14088         * symtab.cc: Include <cstring> and <algorithm>.
14089         * target-select.cc: Include <cstring>.
14090         * version.cc: Include <string>.
14091         * testsuite/testmain.cc: Include <cstdlib>.
14092         * configure, config.in: Rebuild.
14093
14094 2008-03-25  Ian Lance Taylor  <iant@google.com>
14095
14096         * options.cc: Include "../bfd/bfdver.h".
14097         (options::help): Print bug reporting address.
14098
14099         * version.cc (print_version): Adjust output for current value of
14100         BFD_VERSION_STRING.
14101
14102         * NEWS: New file.
14103
14104         * options.cc (options::help): Print list of supported targets.
14105         * target-select.h: Include <vector>.
14106         (class Target_selector): Make machine_, size_, and is_big_endian_
14107         fields const.  Add bfd_name_ and instantiated_target_ fields.
14108         (Target_selector::Target_selector): Add bfd_name parameter.
14109         (Target_selector::recognize): Make non-virtual, call
14110         do_recognize.
14111         (Target_selector::recognize_by_name): Make non-virtual, call
14112         do_recognize_by_name.
14113         (Target_selector::supported_names): New function.
14114         (Target_selector::bfd_name): New function.
14115         (Target_selector::do_instantiate_target): New pure virtual
14116         function.
14117         (Target_selector::do_recognize): New virtual function.
14118         (Target_selector::do_recognize_by_name): New virtual function.
14119         (Target_selector::instantiate_target): New private function.
14120         (supported_target_names): Declare.
14121         * target-select.cc (Target_selector::Target_selector): Update for
14122         new parameter and fields.
14123         (select_target_by_name): Check that the name matches before
14124         calling recognize_by_name.
14125         (supported_target_names): New function.
14126         * i386.cc (class Target_selector_i386): Update Target_selector
14127         constructor call.  Remove recognize and recognize_by_name.  Add
14128         do_instantiate_target.
14129         * x86_64.cc (class Target_selector_x86_64): Likewise.
14130         * testsuite/testfile.cc (class Target_selector_test): Update for
14131         changes to Target_selector.
14132
14133         * README: Rewrite, with some notes on unsupported features.
14134
14135 2008-03-24  Cary Coutant  <ccoutant@google.com>
14136
14137         * i386.cc (Target_i386::Got_type): New enum declaration.
14138         (Target_i386::Scan::local): Updated callers of Output_data_got
14139         member functions.
14140         (Target_i386::Scan::global): Likewise.
14141         (Target_i386::Relocate::relocate): Likewise.
14142         (Target_i386::Relocate::relocate_tls): Likewise.
14143         * object.h (Got_offset_list): New class.
14144         (Sized_relobj::local_has_got_offset): Added got_type parameter.
14145         (Sized_relobj::local_got_offset): Likewise.
14146         (Sized_relobj::set_local_got_offset): Likewise.
14147         (Sized_relobj::local_has_tls_got_offset): Removed.
14148         (Sized_relobj::local_tls_got_offset): Removed.
14149         (Sized_relobj::set_local_tls_got_offset): Removed.
14150         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
14151         * output.cc (Output_data_got::add_global): Added got_type parameter.
14152         (Output_data_got::add_global_with_rel): Likewise.
14153         (Output_data_got::add_global_with_rela): Likewise.
14154         (Output_data_got::add_global_pair_with_rel): New function.
14155         (Output_data_got::add_global_pair_with_rela): New function.
14156         (Output_data_got::add_local): Added got_type parameter.
14157         (Output_data_got::add_local_with_rel): Likewise.
14158         (Output_data_got::add_local_with_rela): Likewise.
14159         (Output_data_got::add_local_pair_with_rel): New function.
14160         (Output_data_got::add_local_pair_with_rela): New function.
14161         (Output_data_got::add_global_tls): Removed.
14162         (Output_data_got::add_global_tls_with_rel): Removed.
14163         (Output_data_got::add_global_tls_with_rela): Removed.
14164         (Output_data_got::add_local_tls): Removed.
14165         (Output_data_got::add_local_tls_with_rel): Removed.
14166         (Output_data_got::add_local_tls_with_rela): Removed.
14167         * output.h (Output_data_got::add_global): Added got_type parameter.
14168         (Output_data_got::add_global_with_rel): Likewise.
14169         (Output_data_got::add_global_with_rela): Likewise.
14170         (Output_data_got::add_global_pair_with_rel): New function.
14171         (Output_data_got::add_global_pair_with_rela): New function.
14172         (Output_data_got::add_local): Added got_type parameter.
14173         (Output_data_got::add_local_with_rel): Likewise.
14174         (Output_data_got::add_local_with_rela): Likewise.
14175         (Output_data_got::add_local_pair_with_rel): New function.
14176         (Output_data_got::add_local_pair_with_rela): New function.
14177         (Output_data_got::add_global_tls): Removed.
14178         (Output_data_got::add_global_tls_with_rel): Removed.
14179         (Output_data_got::add_global_tls_with_rela): Removed.
14180         (Output_data_got::add_local_tls): Removed.
14181         (Output_data_got::add_local_tls_with_rel): Removed.
14182         (Output_data_got::add_local_tls_with_rela): Removed.
14183         * resolve.cc (Symbol::override_base_with_special): Removed
14184         reference to has_got_offset_ field.
14185         * symtab.cc (Symbol::init_fields): Replaced initialization
14186         of got_offset_ with got_offsets_.  Removed initialization
14187         of has_got_offset_
14188         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
14189         (Symbol::got_offset): Likewise.
14190         (Symbol::set_got_offset): Likewise.
14191         (Symbol::has_tls_got_offset): Removed.
14192         (Symbol::tls_got_offset): Removed.
14193         (Symbol::set_tls_got_offset): Removed.
14194         (Symbol::got_offset_): Removed.
14195         (Symbol::tls_mod_got_offset_): Removed.
14196         (Symbol::tls_pair_got_offset_): Removed.
14197         (Symbol::got_offsets_): New field.
14198         (Symbol::has_got_offset): Removed.
14199         (Symbol::has_tls_mod_got_offset): Removed.
14200         (Symbol::has_tls_pair_got_offset): Removed.
14201         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
14202         (Target_x86_64::Scan::local): Updated callers of Output_data_got
14203         member functions.
14204         (Target_x86_64::Scan::global): Likewise.
14205         (Target_x86_64::Relocate::relocate): Likewise.
14206         (Target_x86_64::Relocate::relocate_tls): Likewise.
14207
14208 2008-03-25  Ben Elliston  <bje@au.ibm.com>
14209
14210         * yyscript.y: Fix spelling error in comment.
14211
14212 2008-03-24  Ian Lance Taylor  <iant@google.com>
14213
14214         * options.h (class General_options): Define build_id option.
14215         * layout.h (class Layout): Declare write_build_id, create_note,
14216         create_build_id.  Add build_id_note_ member.
14217         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
14218         "libiberty.h", "md5.h", "sha1.h".
14219         (Layout::Layout): Initialize eh_frame_data_,
14220         eh_frame_hdr_section_, and build_id_note_.
14221         (Layout::finalize): Call create_build_id.
14222         (Layout::create_note): New function, broken out of
14223         Layout::create_gold_note.
14224         (Layout::create_gold_note): Call create_note.
14225         (Layout::create_build_id): New function.
14226         (Layout::write_build_id): New function.
14227         (Close_task_runner::run): Call write_build_id.
14228
14229         * x86_64.cc: Correct license to GPLv3.
14230
14231 2008-03-23  Ian Lance Taylor  <iant@google.com>
14232
14233         * options.cc: Include "demangle.h".
14234         (parse_optional_string): New function.
14235         (parse_long_option): Handle takes_optional_argument.
14236         (parse_short_option): Update dash_z initializer.  Handle
14237         takes_optional_argument.
14238         (General_options::General_options): Initialize do_demangle_.
14239         (General_options::finalize): Set do_demangle_.  Handle demangling
14240         style.
14241         * options.h (parse_optional_string): Declare.
14242         (struct One_option): Add optional_arg field.  Update constructor.
14243         Update call constructor calls.  Add takes_optional_argument
14244         function.
14245         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
14246         (DEFINE_optional_string): Define.
14247         (General_options::demangle): Change from DEFINE_bool to
14248         DEFINE_optional_string.
14249         (General_options::no_demangle): New function.
14250         (General_options::do_demangle): New function.
14251         (General_options::set_do_demangle): New function.
14252         (General_options::execstack_status_): Move definition to end of
14253         class definition.
14254         (General_options::static_): Likewise.
14255         (General_options::do_demangle_): New field.
14256         * object.cc (big_endian>::get_symbol_location_info): Call
14257         Options::do_demangle, not Options::demangle.
14258         * symtab.cc (demangle): Likewise.
14259
14260 2008-03-22  Ian Lance Taylor  <iant@google.com>
14261
14262         * gold.h: Include <cstddef> and <sys/types.h>
14263         * options.h: Include <cstring>.
14264
14265 2008-03-21  Ian Lance Taylor  <iant@google.com>
14266
14267         * Added source code to GNU binutils.
14268 \f
14269 Copyright (C) 2008-2012 Free Software Foundation, Inc.
14270
14271 Copying and distribution of this file, with or without modification,
14272 are permitted in any medium without royalty provided the copyright
14273 notice and this notice are preserved.
14274
14275 Local Variables:
14276 mode: change-log
14277 left-margin: 8
14278 fill-column: 74
14279 version-control: never
14280 End: